ServerControllerTasks

    The JBoss AS Testsuite starts & stops multiple JBoss instances  The Server Controller Ant Tasks provide a mechanism for starting & stopping these server instances.

     

    Features

     

    • stderr & stdout logged to server/config/log/output.log and server/config/log/error.log.

    • A shutdown hook is registered with the VM to kill remaining jboss instances on shutdown.

    • If server does not respond to Shutdown request, the java.lang.Process is destroyed.

    • Supports nested java task arguments: jvmarg, arg, sysproperty

    • Core functionality is pure j2se code in test module; no dependencies on Ant or JBoss classes.

     

    Quick Start Example

     

    To use the tasks in the JBoss Testsuite:

     

    1.  Add your server configuration to the <server:config> tag in testsuite/imports/server-config.xml

       <server:config javaHome="${env.JAVA_HOME}" jbossHome="${jboss.dist}">
         ...
          <server name="my-config" host="${node0}">
             <jvmarg value="${jpda.cmdline}" ></jvmarg>
             <jvmarg value="-Xmx128m" ></jvmarg>
             <sysproperty key="java.endorsed.dirs" value="${jboss.dist}/lib/endorsed" ></sysproperty>
          </server>
          ...
    

     

    2. Call the server:start & server:stop tasks in testsuite/build.xml

       <target name="tests-my-config">
          <server:start name="my-config"></server:start>
          <!-- tests go here -->
          <server:stop name="my-config"></server:stop>
       </target>
    

     

    Task Documentation

     

    <server:start>

     

    Start a server with the given name.

     

    Attributes:

    • name - the name of the server to run.

     

     

    <server:stop>

     

    Start a server with the given name.

     

    Attributes:

    • name - the name of the server to stop.

     

    <server:config>

     

    Defines the servers which are available to run.  There must be only one <server:config> per Ant project.

     

    Attributes:

    • javaHome - which java installation to use.

    • jbossHome - which JBoss installation to use.

    • udpGroup - the value to pass as the -u option to JBoss.

     

    Elements:

    • 1..n <server> elements

     

    <server> - defines the configuration to run, and any arguments to use when starting that configuration.  Must be inside a <server:config> element.

     

    Attributes:

    • name - The name of the server.  Required value.

    • config - The server configuration to run.  This is the "-c" option you pass to run.sh.  Defaults to the server name.

    • host - The hostname or IP address to bind to.  This is the "-b" option passed to run.sh.  Defaults to localhost.

    • httpPort - Which port will tomcat listen to?  Defaults to 8080. 

    • hasWebServer - Does the server have a webserver configured?  Defaults to true.

    • rmiPort - Which port is RMI listening on?  Defaults to 1099.

     

    Elements:

    • 1..n <sysproperty> elements

    • 1..n <jvmarg> elements

    • 1..n <arg> elements

     

     

    <sysproperty> - Defines a system property which is added to the command line when starting the server using the -Dname=value syntax.

     

    Attributes:

    • key - the name of the system property.

    • value - the value of the system property.

     

    <jvmarg - Arguments passed to Java, such as -Xmx

     

    Attributes:

    • line - the argument to pass

     

    <arg> - Arguments passed to JBoss

     

    Attributes:

    • line - the argument to pass