You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Elijah Zupancic (Resolved) (JIRA)" <ji...@apache.org> on 2011/10/03 03:24:34 UTC

[jira] [Resolved] (CHAIN-60) In certain build configurations unit tests fail with the following message: testDefault: Correct command count expected:<17> but was:<19>

     [ https://issues.apache.org/jira/browse/CHAIN-60?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Elijah Zupancic resolved CHAIN-60.
----------------------------------

    Resolution: Fixed

After debugging, I found out that the CatalogFactory instance collection was not being cleared between unit tests, so this was causing the unit tests to fail when executed in a particular order. For some reason, some boxes execute the tests in a different order that reveals this error.

Debug output of the commands loaded in memory are as follows:

{noformat}
1. Name: foo
2. Name: noSuchCatalog:fallback
3. Name: AddingCommand
4. Name: DelegatingCommand
5. Name: DelegatingFilter
6. Name: ExceptionCommand
7. Name: ExceptionFilter
8. Name: NonDelegatingCommand
9. Name: NonDelegatingFilter
10. Name: ChainBase
11. Name: Configurable
12. Name: Execute2a
13. Name: Execute2b
14. Name: Execute2c
15. Name: Execute2d
16. Name: Execute4a
17. Name: Execute4b
18. Name: Execute4c
19. Name: Execute4d

{noformat}

Please take note of lines 1 and 2. Those commands are loaded on the following test: CatalogFactoryBaseTestCase:162 and are not relevant to the testDefault test. In other words, the getInstance() reference is being kept between test cases  and it is being appended to.

I don't think that this is a bug in the chain source, but rather a bug in the test code. However, it may still merit more investigation because I'm a little hazy on how the Catalogs are supposed to work.

                
> In certain build configurations unit tests fail with the following message: testDefault: Correct command count expected:<17> but was:<19>
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CHAIN-60
>                 URL: https://issues.apache.org/jira/browse/CHAIN-60
>             Project: Commons Chain
>          Issue Type: Bug
>    Affects Versions: 1.2, 1.3, 2.0
>         Environment: {noformat}
>  Operating system : Linux(unknown)
>   Java Home version :
>           java version "1.6.0_24"
>           Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
>           Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
>   Builder version :
>           Apache Maven 2.2.1 (r801777; 2009-08-06 19:16:01+0000)
>           Java version: 1.6.0_24
>           Java home: /usr/lib/jvm/java-6-sun-1.6.0.24/jre
>           Default locale: en_AU, platform encoding: UTF-8
>           OS name: "linux" version: "2.6.32-31-server" arch: "amd64" Family: "unix"
> {noformat}
>            Reporter: Elijah Zupancic
>             Fix For: 2.0
>
>
> This bug occurs only on *some* build configurations. On my laptop and on the continuum build server it occurs every time, but when I try to replicate on different boxes with the exact same jvm and operating system, it is not repeatable. Moreover, this bug was happening in the 1.2 and 1.3 versions of chain and was no a result of changes introduced in 2.0.
> The full output of the bug is as follows:
> {noformat}
> >  /commons/proper/chain/trunk/pom.xml ( 1173817 )
> >  /commons/proper/chain/trunk/src/assembly ( 1173817 )
> >  /commons/proper/chain/trunk/src/main/assembly (from /commons/proper/chain/trunk/src/assembly:1172686) ( 1173817 )
> >  /commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/test-config-2.xml ( 1173817 )
> >  /commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/test-config.xml ( 1173817 )
> >  /commons/proper/chain/trunk/src/test/resources ( 1173817 )
> >  /commons/proper/chain/trunk/src/test/resources/org ( 1173817 )
> >  /commons/proper/chain/trunk/src/test/resources/org/apache ( 1173817 )
> >  /commons/proper/chain/trunk/src/test/resources/org/apache/commons ( 1173817 )
> >  /commons/proper/chain/trunk/src/test/resources/org/apache/commons/chain ( 1173817 )
> >  /commons/proper/chain/trunk/src/test/resources/org/apache/commons/chain/config ( 1173817 )
> >  /commons/proper/chain/trunk/src/test/resources/org/apache/commons/chain/config/test-config-2.xml (from /commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/test-config-2.xml:1172686) ( 1173817 )
> >  /commons/proper/chain/trunk/src/test/resources/org/apache/commons/chain/config/test-config.xml (from /commons/proper/chain/trunk/src/test/java/org/apache/commons/chain/config/test-config.xml:1172686) ( 1173817 )
> >
> > Changed: simonetripodi @ Wed 21 Sep 2011 20:02:11 +0000
> > Comment: parent reference updated to version 22
> > Files changed:
> >  /commons/proper/chain/trunk/pom.xml ( 1173818 )
> >
> > Changed: simonetripodi @ Wed 21 Sep 2011 20:03:47 +0000
> > Comment: added missing release metadata
> > Files changed:
> >  /commons/proper/chain/trunk/pom.xml ( 1173819 )
> >
> > Changed: simonetripodi @ Wed 21 Sep 2011 20:05:35 +0000
> > Comment: 4 spaces replaced with 2 spaces, as generally adopted in commons
> > Files changed:
> >  /commons/proper/chain/trunk/pom.xml ( 1173821 )
> >
> > ****************************************************************************
> > Dependencies Changes:
> > ****************************************************************************
> > No dependencies changed
> >
> >
> > ****************************************************************************
> > Build Definition:
> > ****************************************************************************
> > POM filename: pom.xml
> > Goals: clean deploy
> > Arguments: --batch-mode -Pjava-1.5
> > Build Fresh: false
> > Always Build: false
> > Default Build Definition: true
> > Schedule: COMMONS_SCHEDULE
> > Profile Name: Maven 2.2.1
> > Description: Default Maven 2 Build Definition (Java 1.5)
> >
> > ****************************************************************************
> > Test Summary:
> > ****************************************************************************
> > Tests: 125
> > Failures: 1
> > Errors: 0
> > Success Rate: 99
> > Total time: 1.1960001
> >
> > ****************************************************************************
> > Test Failures:
> > ****************************************************************************
> >
> > ConfigParserTestCase
> >    testDefault :
> >  java.lang.AssertionError
> >  java.lang.AssertionError: Correct command count expected:<17> but was:<19>
> >        at org.junit.Assert.fail(Assert.java:93)
> >        at org.junit.Assert.failNotEquals(Assert.java:647)
> >        at org.junit.Assert.assertEquals(Assert.java:128)
> >        at org.junit.Assert.assertEquals(Assert.java:472)
> >        at org.apache.commons.chain.config.ConfigParserTestCase.checkCommandCount(ConfigParserTestCase.java:322)
> >        at org.apache.commons.chain.config.ConfigParserTestCase.testDefault(ConfigParserTestCase.java:113)
> >        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:592)
> >        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
> >        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> >        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
> >        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
> >        at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
> >        at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
> >        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
> >        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:69)
> >        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:48)
> >        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
> >        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
> >        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
> >        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
> >        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
> >        at org.junit.runners.ParentRunner.run(ParentRunner.java:292)
> >        at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53)
> >        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123)
> >        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104)
> >        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:592)
> >        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164)
> >        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110)
> >        at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:172)
> >        at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:104)
> >        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:70)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira