Version 2

    Test Source

     

    The test artifacts are stored in the trunk/integration-tests/src/test/resources folder.

     

    The tests that are based on examples are placed in the samples subfolder. Tests based on jira issues are placed in the xxx subfolder.

     

    Each test is placed within its own folder, which should contain a build.xml ant script with a default target used to deploy the test archives and artifacts (i.e. messages) into the trunk/integration-tests/target/tests/${testProjectName} folder. The testProjectName property is the project name of the test's ant script.

     

     

    Packaging the Integration Tests

     

    In the trunk/integration-tests/build.xml, is a target called "package-tests". This target invokes the specific test ant scripts to deploy the test archives into the trunk/integration-tests/target/tests folder.

     

    The usual convention is to have a sub-folder named after the ant script project name, which will contain the archives to be deployed and any test messages etc that are required for performing the test.

     

     

    Running the Tests

     

    When the integration test mechanism is invoked, it will build all of the test archives before deploying riftsaw to a JBoss AS server, starting the server, and then running a set of JUnit tests.

     

    Therefore each test needs to deploy the relevant archives, send and receive relevant messages as required to test the deployed BPEL service(s), and then finally undeploy the test archives. These steps are all achieved under the control of JUnit.

     

    The source for the JUnit tests are in trunk/integration-tests/src/test/java/org/jboss/soa/bpel/tests/samples.

     

     

    package org.jboss.soa.bpel.tests.samples;
    
    import org.jboss.soa.bpel.tests.RiftSawTest;
    import org.jboss.soa.bpel.tests.RiftSawTestSetup;
    
    import junit.framework.Test;
    
    /**
     * Test case for running the Quickstart_bpel_hello_world sample.
     */
    public class QuickstartBPELHelloWorldTestCase extends RiftSawTest {
    
         private static final String TEST_NAME = "Quickstart_bpel_hello_world";
    
         public QuickstartBPELHelloWorldTestCase() {
              super(TEST_NAME);
         }
         
         public static Test suite() {
              return(new RiftSawTestSetup(QuickstartBPELHelloWorldTestCase.class,
                                  TEST_NAME, "Quickstart_bpel_hello_world-1.jar"));
         }
    
         public void testSendHello() throws Exception {
              String result=sendSOAPMessage("hello_request1.xml",
                             "http://localhost:8080/bpel/processes/helloWorld");
              
              assertMessageFromFile(result, "hello_response1.xml");
         }
    }
    

     

    This test provides a test suite based on the RiftSawTestSetup class. This class is responsible for deploying supplied archives (comma separated list if more than one archive) from the trunk/integration-tests/target/tests/${TEST_NAME} folder - so the TEST_NAME value must be the same as the test ant script's project name.

     

    The test method (testSendHello) uses the 'sendMessage' method to send an XML message to a particular URL. The first parameter is the name of a file expected to be found in the trunk/integration-tests/target/tests/${TEST_NAME} folder.