Thomas Vandahl wrote:
Scott Eade wrote:
Is it just me or does YaafiContainerTest fail (see below) when it is run
using mvn?  It seems to run fine within eclipse.

It works for me(TM). But Gump is unhappy, too. Could you please check
why YAAFI finds a role file when it shouldn't?

When "mvn test" is executed from the command line the exception does not occur and processing continues on to the fail (and so the test fails):
testLoadingContainerWithNoRolesfileFails(org.apache.fulcrum.testcontainer.YaafiContainerTest) Time elapsed: 0.02 sec <<< FAILURE!
junit.framework.AssertionFailedError: We should fail
    at junit.framework.Assert.fail(Assert.java:47)
at org.apache.fulcrum.testcontainer.YaafiContainerTest.testLoadingContainerWithNoRolesfileFails(YaafiContainerTest.java:94)

The test case in question does this:
        this.setRoleFileName(null);
        this.setConfigurationFileName(
            "src/test/TestComponentConfigIntegratedRoles.xml");
And src/test/TestComponentConfigIntegratedRoles.xml reads thus:
<my-system>
  <component
    role="org.apache.fulcrum.testcontainer.SimpleComponent"
    class="org.apache.fulcrum.testcontainer.AlternativeComponentImpl">
  </component>
</my-system>
So is this not the matching role? If so then I can see why the fail statement is hit.

OTOH when it is executed within eclipse it does hit an exception, but perhaps it is the wrong one? The exception is caught and thus the fail is not hit (and so the test passes):
[WARNING] Unable to find any resource with the name '/componentRoles.xml'
[ERROR] Unable to locate the role configuration : /componentRoles.xml
[ERROR] Could not initialize the container
org.apache.avalon.framework.configuration.ConfigurationException: Unable to locate the role configuration : /componentRoles.xml at org.apache.fulcrum.yaafi.framework.container.ServiceContainerImpl.initialize(ServiceContainerImpl.java:409) at org.apache.avalon.framework.container.ContainerUtil.initialize(ContainerUtil.java:245) at org.apache.fulcrum.yaafi.framework.factory.ServiceContainerFactory.create(ServiceContainerFactory.java:131) at org.apache.fulcrum.yaafi.framework.factory.ServiceContainerFactory.create(ServiceContainerFactory.java:55) at org.apache.fulcrum.testcontainer.YAAFIContainer.initialize(YAAFIContainer.java:108) at org.apache.fulcrum.testcontainer.YAAFIContainer.startup(YAAFIContainer.java:87) at org.apache.fulcrum.testcontainer.BaseUnitTest.lookup(BaseUnitTest.java:137) at org.apache.fulcrum.testcontainer.YaafiContainerTest.testLoadingContainerWithNoRolesfileFails(YaafiContainerTest.java:93)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
[DEBUG] Disposing of container...
[INFO] YaffiContainer has been disposed.
Why would yaafi be insisting that a componentRoles.xml file be present when it is run from within eclipse?

Scott

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to