glassfish
  1. glassfish
  2. GLASSFISH-17285 Support building with Java SE 7
  3. GLASSFISH-17318

Unit tests that fail randomly (jdbc/admin) when using JDK7 to build GlassFish from scratch

    Details

    • Type: Sub-task Sub-task
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0
    • Fix Version/s: 4.0
    • Component/s: build_system
    • Labels:
      None
    • Environment:

      Ubutu 11.04 (2.6.38-11-generic) ; JDK 1.7.0 ; Maven 2.2.1

      Description

      Some unit tests from "jdbc/admin" are failing when using JDK7.

      When trying to build the GlassFish workspace with JDK7 from scratch (from top level directory), the build fails because of some unit tests. According to the following link it seems that these unit tests depends somehow on the order of invocation.

      The behavior is quite random because the unit tests don't fail when you run "mvn clean install" from the appropriate module. Also I've tried several times to build from scratch (i.e. on a fresh checkout) and the tests that fail can be different each time.

      Here is a diff file available as attachment that disable other failing tests so it will be easier to reproduce the bug. For your information: I've reproduced the bug 3 times in 4 trials from fresh checkout + patch.
      ===============================================================================================================================

      • Here is the outputs from Maven:

      ===============================================================================================================================

      -------------------------------------------------------
       T E S T S
      -------------------------------------------------------
      Running org.glassfish.jdbc.admin.cli.ListJdbcResourcesTest
      Sep 19, 2011 4:13:57 PM org.jvnet.hk2.component.ContractLocatorImpl warnOnUsage
      WARNING: name and scope are currently only appropriate for byContract usage; (name: default-instance-name; type: com.sun.enterprise.config.serverbeans.JavaConfig)
      Sep 19, 2011 4:13:57 PM org.jvnet.hk2.component.ContractLocatorImpl warnOnUsage
      WARNING: name and scope are currently only appropriate for byContract usage; (name: default-instance-name; type: com.sun.enterprise.config.serverbeans.Server)
      Sep 19, 2011 4:13:57 PM org.jvnet.hk2.config.ConfigParser handleElement
      SEVERE: Ignoring unrecognized element management-rules at Line number = 156
      Column number = 40
      System Id = file:/home/romano/workspaces/glassfish/main-scratch-jdk7_28/appserver/jdbc/admin/target/test-classes/DomainTest.xml
      Public Id = null
      Location Uri= file:/home/romano/workspaces/glassfish/main-scratch-jdk7_28/appserver/jdbc/admin/target/test-classes/DomainTest.xml
      CharacterOffset = 10705
      
      Sep 19, 2011 4:13:57 PM org.hibernate.validator.util.Version <clinit>
      INFO: Hibernate Validator 4.1.0.Final
      Sep 19, 2011 4:13:57 PM org.hibernate.validator.engine.resolver.DefaultTraversableResolver detectJPA
      INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
      Tests run: 6, Failures: 1, Errors: 0, Skipped: 2, Time elapsed: 0.46 sec <<< FAILURE!
      Running org.glassfish.jdbc.admin.cli.TestDocument
      Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0 sec
      Running org.glassfish.jdbc.admin.cli.CreateJdbcResourceTest
      Tests run: 6, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.044 sec
      Running org.glassfish.jdbc.admin.cli.DeleteJdbcResourceTest
      Tests run: 6, Failures: 0, Errors: 0, Skipped: 3, Time elapsed: 0.041 sec
      Running org.glassfish.jdbc.config.JdbcConnectionPoolValidationTest
      Sep 19, 2011 4:13:57 PM org.jvnet.hk2.component.ContractLocatorImpl warnOnUsage
      WARNING: name and scope are currently only appropriate for byContract usage; (name: default-instance-name; type: com.sun.enterprise.config.serverbeans.JavaConfig)
      Sep 19, 2011 4:13:57 PM org.jvnet.hk2.component.ContractLocatorImpl warnOnUsage
      WARNING: name and scope are currently only appropriate for byContract usage; (name: default-instance-name; type: com.sun.enterprise.config.serverbeans.Server)
      Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.079 sec
      Running org.glassfish.jdbc.config.JdbcConnectionPoolDefaultsTest
      Sep 19, 2011 4:13:57 PM org.jvnet.hk2.component.ContractLocatorImpl warnOnUsage
      WARNING: name and scope are currently only appropriate for byContract usage; (name: default-instance-name; type: com.sun.enterprise.config.serverbeans.JavaConfig)
      Sep 19, 2011 4:13:57 PM org.jvnet.hk2.component.ContractLocatorImpl warnOnUsage
      WARNING: name and scope are currently only appropriate for byContract usage; (name: default-instance-name; type: com.sun.enterprise.config.serverbeans.Server)
      Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.064 sec
      Running org.glassfish.jdbc.config.ConcurrentModificationsTest
      Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 sec
      
      Results :
      
      Failed tests: 
        testExecuteSuccessListNoBob(org.glassfish.jdbc.admin.cli.ListJdbcResourcesTest)
      
      Tests run: 23, Failures: 1, Errors: 0, Skipped: 7
      
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] There are test failures.
      
      Please refer to /home/romano/workspaces/glassfish/main-scratch-jdk7_28/appserver/jdbc/admin/target/surefire-reports for the individual test results.
      [INFO] ------------------------------------------------------------------------
      [INFO] For more information, run Maven with the -e switch
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 4 minutes 21 seconds
      [INFO] Finished at: Mon Sep 19 16:13:57 CEST 2011
      [INFO] Final Memory: 403M/752M
      [INFO] ------------------------------------------------------------------------
      

      ===============================================================================================================================

      • Here is the surfire report:

      ===============================================================================================================================

      romano@frenchfish:~/workspaces/glassfish/main-scratch-jdk7_28$ cat appserver/jdbc/admin/target/surefire-reports/*.txt
      -------------------------------------------------------------------------------
      Test set: org.glassfish.jdbc.admin.cli.CreateJdbcResourceTest
      -------------------------------------------------------------------------------
      Tests run: 6, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.044 sec
      -------------------------------------------------------------------------------
      Test set: org.glassfish.jdbc.admin.cli.DeleteJdbcResourceTest
      -------------------------------------------------------------------------------
      Tests run: 6, Failures: 0, Errors: 0, Skipped: 3, Time elapsed: 0.041 sec
      -------------------------------------------------------------------------------
      Test set: org.glassfish.jdbc.admin.cli.ListJdbcResourcesTest
      -------------------------------------------------------------------------------
      Tests run: 6, Failures: 1, Errors: 0, Skipped: 2, Time elapsed: 0.46 sec <<< FAILURE!
      testExecuteSuccessListNoBob(org.glassfish.jdbc.admin.cli.ListJdbcResourcesTest)  Time elapsed: 0.01 sec  <<< FAILURE!
      java.lang.AssertionError: expected:<SUCCESS> but was:<FAILURE>
      	at org.junit.Assert.fail(Assert.java:71)
      	at org.junit.Assert.failNotEquals(Assert.java:451)
      	at org.junit.Assert.assertEquals(Assert.java:99)
      	at org.junit.Assert.assertEquals(Assert.java:116)
      	at org.glassfish.jdbc.admin.cli.ListJdbcResourcesTest.testExecuteSuccessListNoBob(ListJdbcResourcesTest.java:235)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
      	at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
      	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
      	at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
      	at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
      	at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
      	at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
      	at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
      	at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
      	at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
      	at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
      	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
      	at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
      	at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
      	at org.apache.maven.surefire.booter.SurefireBooter.run(SurefireBooter.java:241)
      	at org.apache.maven.plugin.surefire.SurefirePlugin.execute(SurefirePlugin.java:537)
      	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
      	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
      	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
      	at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
      	at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      	at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      	at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      	at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      
      -------------------------------------------------------------------------------
      Test set: org.glassfish.jdbc.admin.cli.TestDocument
      -------------------------------------------------------------------------------
      Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.001 sec
      -------------------------------------------------------------------------------
      Test set: org.glassfish.jdbc.config.ConcurrentModificationsTest
      -------------------------------------------------------------------------------
      Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 sec
      -------------------------------------------------------------------------------
      Test set: org.glassfish.jdbc.config.JdbcConnectionPoolDefaultsTest
      -------------------------------------------------------------------------------
      Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.064 sec
      -------------------------------------------------------------------------------
      Test set: org.glassfish.jdbc.config.JdbcConnectionPoolValidationTest
      -------------------------------------------------------------------------------
      Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.08 sec
      

        Activity

        Hide
        Romain Grécourt added a comment -

        attaching patch to reproduce the bug.

        Show
        Romain Grécourt added a comment - attaching patch to reproduce the bug.
        Hide
        Romain Grécourt added a comment -

        As the issue can be only seen when building from top level directory (which can be very long), you may want to use the following steps:

        $ cd [glassfishWorkspace]/appserver/jdbc/admin
        $ mvn -Dtest=org.glassfish.jdbc.admin.cli.ListJdbcResourcesTest#testExecuteSuccessListNoBob org.apache.maven.plugins:maven-surefire-plugin:2.8:test
        

        You must use a version of the surefire plugin greater or equals to 2.7.3. For more information see this link

        Show
        Romain Grécourt added a comment - As the issue can be only seen when building from top level directory (which can be very long), you may want to use the following steps: $ cd [glassfishWorkspace]/appserver/jdbc/admin $ mvn -Dtest=org.glassfish.jdbc.admin.cli.ListJdbcResourcesTest#testExecuteSuccessListNoBob org.apache.maven.plugins:maven-surefire-plugin:2.8:test You must use a version of the surefire plugin greater or equals to 2.7.3. For more information see this link
        Hide
        Romain Grécourt added a comment -

        changing versions.

        Show
        Romain Grécourt added a comment - changing versions.
        Hide
        Tom Mueller added a comment -

        Note, this issue is actually for jdbc/admin even though the description says "orb/orb-connector" at the top.

        Show
        Tom Mueller added a comment - Note, this issue is actually for jdbc/admin even though the description says "orb/orb-connector" at the top.
        Hide
        Romain Grécourt added a comment -

        removing mistake in description.

        Show
        Romain Grécourt added a comment - removing mistake in description.
        Hide
        Shalini added a comment -

        Assigning the issue to Jennifer, as this is an issue with the test case.

        On JDK7, i tried executing the commands
        asadmin create-jdbc-resource
        asadmin list-jdbc-resources
        asadmin delete-jdbc-resource

        manually using admin CLI. They were passing fine. In the Test, i introduced a 10 second delay after the delete-jdbc-resource in line 233. This does not seem to help. The test is still failing on the line :

        assertEquals(ActionReport.ExitCode.SUCCESS, context.getActionReport().getActionExitCode());

        which is just after the delete-jdbc-resource command invocation.

        Show
        Shalini added a comment - Assigning the issue to Jennifer, as this is an issue with the test case. On JDK7, i tried executing the commands asadmin create-jdbc-resource asadmin list-jdbc-resources asadmin delete-jdbc-resource manually using admin CLI. They were passing fine. In the Test, i introduced a 10 second delay after the delete-jdbc-resource in line 233. This does not seem to help. The test is still failing on the line : assertEquals(ActionReport.ExitCode.SUCCESS, context.getActionReport().getActionExitCode()); which is just after the delete-jdbc-resource command invocation.
        Hide
        Jennifer Chou added a comment -

        This should be fixed now. I had some other issues trying verify and build completely with JDK7. Please reopen if there is still a problem.

        Show
        Jennifer Chou added a comment - This should be fixed now. I had some other issues trying verify and build completely with JDK7. Please reopen if there is still a problem.

          People

          • Assignee:
            Jennifer Chou
            Reporter:
            Romain Grécourt
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: