You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Neeme Praks <ne...@apache.org> on 2003/12/01 19:22:33 UTC
Re: FortressRunner ant task
After some delay (almost 6 months :-)) I finally refactored this a bit,
wrote a testcase for it and commited it as
org.apache.avalon.fortress.tools.FortressBean.
It can be used as an Ant task or it can also be used to simplify
embedding scenarios. The testcase is the best example of this, but it
basically boils down to:
FortressBean bean = new FortressBean();
bean.setRoleManagerConfiguration("resource://org/apache/avalon/fortress/tools/FortressBeanTestCase.roles");
bean.setContainerConfiguration("resource://org/apache/avalon/fortress/tools/FortressBeanTestCase.xconf");
bean.setLoggerManagerConfiguration("resource://org/apache/avalon/fortress/tools/FortressBeanTestCase.xlog");
bean.setLookupComponentRole(TestInterface.ROLE); //optional, see
below
bean.setInvokeMethod("run"); //optional, see below
bean.setSystemExitOnDispose(false); //optional, defaults to true
bean.initialize();
//do something useful, if you configured lookup role and invoke method,
then you can use bean.run();
//otherwise, if you use it straight from java code then just get the
servicemanager and do whatever
this.bean.dispose(); //clean up
Rgds,
Neeme
Berin Loritsch wrote:
> Neeme Praks wrote:
>
>>
>> I have written an Ant task for running Fortress (see attachment). If
>> this is of general interest then I can beef up the JavaDocs and
>> commit it. However, the question is then: where should it go? Under
>> fortress source tree?
>
>
> Excellent. It should go under src/tools along with the
> MetaInfoCollector. BTW, the all important question is:
> Can you run JUnit tests against it?
>
>>
>> Example of usage:
>> <target name="run" depends="compile">
>> <taskdef name="fortress"
>> classname="org.apache.avalon.fortress.ant.FortressRunner">
>> <classpath refid="classpath"/>
>> </taskdef>
>> <fortress
>>
>> containerClass="org.apache.avalon.fortress.impl.DefaultContainer"
>> contextDirectory="./"
>> workDirectory="./"
>> containerConfiguration="resource://app.xconf"
>> loggerManagerConfiguration="resource://app.xlog"
>> roleManagerConfiguration="resource://app.roles"
>>
>> lookupComponentRole="com.mycompany.ui.swing.Runnable/gui"
>> invokeMethod="run"
>> />
>> </target>
>>
>> Rgds,
>> Neeme
>>
>>
>> ------------------------------------------------------------------------
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
>> For additional commands, e-mail: dev-help@avalon.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org