10 Replies Latest reply on Jul 31, 2006 10:29 AM by ryan.campbell

    Standalone release of jboss-test

    Rajesh Rajasekaran Newbie

      We are doing a standalone release of the jboss test module which contains the jboss tests framework and the ant server controller tasks.

      Any project that would require their tests to be run against the JBoss Application Server can use jboss-test to create their own configuration, start the server, run tests and stop the server.

      The first release, jboss-test-1.0RC1 would include the following
      1. Libraries required to use jboss-test
      2. Javadocs (API)
      3. Links to wiki pages which explains how to use the jboss-test framework and how to use the server controller tasks

      Should anything else be included in the release?

      Rajesh
      JBoss QA

        • 1. Re: Standalone release of jboss-test
          ryan.campbell Expert

          There should be a /docs/examples/build-test.xml which shows makes it clear how to use the different tasks.

          The readme ought to point to this as well.

          • 2. Re: Standalone release of jboss-test
            Rali Genova Novice

            Also we are refactoring org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter from the jboss/testsuite module to the jboss/test module as discussed in http://jira.jboss.com/jira/browse/JBAS-3156. The XMLJUnitMultipleResultFormatter is used to create different formatters for the same test when it is run multiple times and we would like to not override the previous run. Here is an example from the reports generated by the jboss-4.0-compatibility-matrix testsuite:
            MatrixTestContainer(bmp_3_2_8) 2
            MatrixTestContainer(bmp_3_2_x) 2
            MatrixTestContainer(bmp_4_0_1SP1)
            MatrixTestContainer(bmp_4_0_2) 2
            MatrixTestContainer(bmp_4_0_3) 2
            MatrixTestContainer(bmp_4_0_3SP1)
            Same test is run against different versions of the Application Server.
            Since modules other than the jboss server might need compatibility tests, we are moving the code to the test module for reusability

            • 3. Re: Standalone release of jboss-test
              Rajesh Rajasekaran Newbie

              JBossTest 1.0.0.CR1 has been released and is available for download on Sourceforge at

              http://sourceforge.net/project/showfiles.php?group_id=22866&package_id=21938&release_id=416399


              Its available in the repository under jboss/test

              • 4. Re: Standalone release of jboss-test
                msegvich Newbie

                I'm on jboss 4.0.4 GA, Windows XP. I can successfully run the following manually without a problem:

                run.bat -c default - b localhost
                


                However, when I try to run the example build.xml (using ant -v test) I get the following:

                test:
                [server:start] Starting server "default" with command:
                [server:start] C:\Program Files\Java\jdk1.5.0_06\bin\java -cp C:\jboss-4.0.4\bin
                \run.jar;C:\Program Files\Java\jdk1.5.0_06\lib\tools.jar -Xmx128m -Djava.endors
                ed.dirs=C:\jboss-4.0.4/lib/endorsed org.jboss.Main -c default -b localhost
                
                BUILD FAILED
                C:\jboss-test-1.0.0.CR1\examples\build.xml:83: Error starting server "default":
                Server failed to start; see logs. exit code: 1
                 at org.jboss.ant.taskdefs.server.StartServerTask.execute(StartServerTask
                .java:54)
                 at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
                 at org.apache.tools.ant.Task.perform(Task.java:364)
                 at org.apache.tools.ant.Target.execute(Target.java:341)
                 at org.apache.tools.ant.Target.performTasks(Target.java:369)
                 at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
                 at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
                 at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
                cutor.java:40)
                 at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
                 at org.apache.tools.ant.Main.runBuild(Main.java:668)
                 at org.apache.tools.ant.Main.startAnt(Main.java:187)
                 at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
                 at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
                Caused by: java.io.IOException: Server failed to start; see logs. exit code: 1
                 at org.jboss.test.util.server.ServerController.waitForServer(ServerContr
                oller.java:174)
                 at org.jboss.test.util.server.ServerController.startServer(ServerControl
                ler.java:110)
                 at org.jboss.test.util.server.ServerManager.startServer(ServerManager.ja
                va:127)
                 at org.jboss.ant.taskdefs.server.StartServerTask.execute(StartServerTask
                .java:50)
                 ... 12 more
                --- Nested Exception ---
                java.io.IOException: Server failed to start; see logs. exit code: 1
                 at org.jboss.test.util.server.ServerController.waitForServer(ServerContr
                oller.java:174)
                 at org.jboss.test.util.server.ServerController.startServer(ServerControl
                ler.java:110)
                 at org.jboss.test.util.server.ServerManager.startServer(ServerManager.ja
                va:127)
                 at org.jboss.ant.taskdefs.server.StartServerTask.execute(StartServerTask
                .java:50)
                 at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
                 at org.apache.tools.ant.Task.perform(Task.java:364)
                 at org.apache.tools.ant.Target.execute(Target.java:341)
                 at org.apache.tools.ant.Target.performTasks(Target.java:369)
                 at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
                 at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
                 at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
                cutor.java:40)
                 at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
                 at org.apache.tools.ant.Main.runBuild(Main.java:668)
                 at org.apache.tools.ant.Main.startAnt(Main.java:187)
                 at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
                 at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
                


                Both error and output log files are empty. Not sure what I'm doing wrong. Any pointers would be appreciated.

                • 5. Re: Standalone release of jboss-test
                  Rajesh Rajasekaran Newbie

                  You need to pass your JBoss home directory while calling ant.

                  ant test -Djboss.home=YOUR_JBOSS_HOME_DIRECTORY(which is your 4.0.4.GA installation)

                  • 6. Re: Standalone release of jboss-test
                    msegvich Newbie

                    Forgot to mention I already had added that property to the build.xml. You can see it on the stdout as part of the classpath (c:\jboss-4.0.4).

                    • 7. Re: Standalone release of jboss-test
                      Rajesh Rajasekaran Newbie

                      The example starts up the "all" config as shown in <server:start name="all"/> in build.xml

                      Your code snippet shows the "default" config being started.
                      C:\jboss-4.0.4/lib/endorsed org.jboss.Main -c default -b localhost

                      In case you had updated the build.xml to start the default config, please update the <server:config> to default as well.

                      • 8. Re: Standalone release of jboss-test
                        msegvich Newbie

                        I had that too. My default server is under:

                        C:\jboss-4.0.4\server\default


                        I'm running jdk 5.0 and I have a JAVA_HOME environment variable.

                        Here's my build.xml file, which is under:
                        C:\jboss-test-1.0.0.CR1\examples

                        <?xml version="1.0"?>
                        
                         <project name="jboss-test-example" default="" xmlns:server="http://jboss.org/ns/test/ant/server">
                        
                         <property name="examples.home" value="."/>
                         <property name="jboss.test.home" value="../"/>
                         <property environment="env"/>
                         <property name="jboss.home" value="C:\jboss-4.0.4"/>
                        
                        
                         <!-- ==========================================================================
                         Classpath
                         =========================================================================== -->
                         <path id="compile.classpath">
                        
                         <fileset dir="${jboss.test.home}/lib">
                         <include name="*.jar"/>
                         </fileset>
                         <fileset dir="${examples.home}/lib">
                         <include name="*.jar"/>
                         </fileset>
                         <pathelement location="${examples.home}/lib"/>
                         </path>
                        
                         <path id="jboss.test.classpath">
                         <pathelement path="${jboss.test.home}/lib/jboss-test.jar"/>
                         </path>
                        
                         <property name="node0" value="localhost" />
                         <property name="node0.jndi.url" value="jnp://${node0}:1099" />
                         <property name="jpda.cmdline" value="" />
                         <property name="junit.formatter.usefile" value="true" />
                         <property name="jboss-junit-configuration" value="YOUR_SERVER_VERSION" />
                        
                         <!-- ==========================================================================
                         Compile the source
                         =========================================================================== -->
                         <target name="compile">
                        
                         <mkdir dir="output"/>
                        
                         <javac destdir="output"
                         debug="on"
                         deprecation="on"
                         optimize="on"
                         classpathref="compile.classpath">
                         <src path="src"/>
                         </javac>
                        
                         </target>
                        
                         <!-- ==========================================================================
                         Task Definition
                         =========================================================================== -->
                         <taskdef name="config" classname="org.jboss.ant.taskdefs.server.ConfigManagerTask"
                         uri="http://jboss.org/ns/test/ant/server" loaderref="server.loader">
                         <classpath id="server.taskdef.classpath">
                         <path refid="jboss.test.classpath"/>
                         </classpath>
                         </taskdef>
                         <taskdef name="start" classname="org.jboss.ant.taskdefs.server.StartServerTask"
                         uri="http://jboss.org/ns/test/ant/server" loaderref="server.loader">
                         <classpath refid="server.taskdef.classpath"/>
                         </taskdef>
                         <taskdef name="stop" classname="org.jboss.ant.taskdefs.server.StopServerTask"
                         uri="http://jboss.org/ns/test/ant/server" loaderref="server.loader">
                         <classpath refid="server.taskdef.classpath"/>
                         </taskdef>
                        
                         <!-- ==========================================================================
                         Server Tasks
                         =========================================================================== -->
                         <server:config javaHome="${env.JAVA_HOME}" jbossHome="${jboss.home}">
                         <server name="default" host="${node0}">
                         <jvmarg value="${jpda.cmdline}" />
                         <jvmarg value="-Xmx256m" />
                         <sysproperty key="java.endorsed.dirs" value="${jboss.home}/lib/endorsed" />
                         </server>
                         </server:config>
                        
                        
                         <target name="test" depends="compile">
                         <server:start name="default"/>
                        
                         <junit printsummary="yes" haltonfailure="yes">
                         <sysproperty key="java.naming.provider.url" value="${node0.jndi.url}"/>
                        
                         <classpath>
                         <path refid="compile.classpath"/>
                         <pathelement location="output"/>
                         </classpath>
                         <formatter type="plain"/>
                        
                         <sysproperty key="jboss-junit-configuration" value="${jboss-junit-configuration}"/>
                         <formatter classname="org.jboss.ant.taskdefs.XMLJUnitMultipleResultFormatter" usefile="${junit.formatter.usefile}" extension="-${jboss-junit-configuration}.xml" />
                        
                         <test name="org.jboss.test.naming.test.SimpleUnitTestCase" haltonfailure="no"/>
                         </junit>
                        
                         <server:stop name="all"/>
                         </target>
                        
                        </project>
                        


                        • 9. Re: Standalone release of jboss-test
                          Sean Dawson Newbie

                          Hello,

                          There is a bug when attempting to use the config task in Ant scripts when the JAVA_HOME variable is set to a path with spaces in it (i.e., C:\Program Files\Java\jdk...).

                          The executable invoked should be enclosed in quotes to prevent this from happening!

                          • 10. Re: Standalone release of jboss-test
                            ryan.campbell Expert

                            This is a known issue which I just assigned to Rajesh to fix. http://jira.jboss.com/jira/browse/JBQA-292