Index Changes
Essential pieces of this test case are
  • creating the engine instance
  • deploying the Service Assembly
  • Sending the message to the Engine
  • Simulating a outbound delivery Channel
  • comparing the output

Considering the checked in test case, \alaska\jbicomps\bpelse\bpeljbiadapter\test\com\sun\jbi\engine\bpel\jbiadaptor\test\testAssign\TestAssign1.java

Creating the Engine instance

This test case simply constructs an engine instance, by calling new EngineImpl. Other ways to constuct engine instance are possible and should be explored as per the test needs. for instance, we can make sure that all tests are run with just one engine instance, by making use of OneTimesetUp class.
new SetUpHelper().getEngine()

Deploying the Service Assembly

When a SA is deployed to BPEL SE component it invokes, EngineHelper.deploy() API. The test case also does the same thing. This tests and verifies code to to deploying these artifacts.

Sending the message to the Engine

A message is sent to the BPEL SE by calling the API, Engine.processRequest(). This is the execution path as that of the engine in the JBI container.

Simulating a outbound delivery Channel

Refer the EngineChannelSimulatorAdaptor class. Override only the needed APIs here as required by your test case. Engine channgel in this test case sends back the status message for the received reply. Following is the code snippet,

mChannel = new EngineChannelSimulatorAdaptor()
mEng.setOutChannel(mChannel)

Comparing the output XML Unit is used to compare the expected and the actual returned value.

Diff diff = XMLUnit.compare(expectedOutputXML, receivedXML)
assertTrue(diff.similar())

Pls note: Currently there seems to be some bug (likely XMLUnit code) in comparing xml document objects.



Source Code structure

  • Associated junit test case is TestAssign1.java.
  • Associated deployment files are located under \bpels folder.
  • The Netbeans BPEL, JBI projects, SA deployed folders created in the process of creating this test case are located at
    • firstAssignTest\Assign1BPEL
    • firstAssignTest\Assign1JBI
    • firstAssignTest\deployedFolder
The deployment artifacts of the SA (above mentioned JBI project) are obtained by actual deployment of the JBI project into the appserver. These are copied over to firstAssignTest\deployedFolder.

Input and Output folders are located at

For this simple Assign test case, we need an input xml file to create the instance and an output xml file to compare the result with. Specific tests may want to have different types of files in these input and output folders. For instance, the developer can choose to make use of property files to run some specific scenarios. Output files are used to compare the output of the execution of the test case.

Utility to ease the creation of the test case Template Generator(info).

Usage of the utility is to run the class with atleast 2 arguments. A third argument can be optionally provided which points to the actual deployed folder.

  • TemplateGen 'testCaseFolderName' 'bpelJbiAdatperLocation' 'appserver_deployedFolder'

For example, TemplateGen WhileTest /alaska/jbicomps/bpelse/bpeljbiadapter /alaska/Sun/AppServer/domains/domain1/jbi/system/deployment/whileTest/com.sun.bpelse-1.0 The above command will add the following files and folders at /bpelse/bpeljbiadapter/test/com/sun/jbi/engine/bpel/jbiadaptor/test/persistence/bpels

  • Folder - WhileTest
    • Folder - input
      • File - test.properties
      • File - input.xml
    • Folder - output
      • File - output.xml
      • File - test.out (in case of persistence)
    • Folder - deployedFolder
      • File Structure as is in deployment/whileTest/com.sun.bpelse-1.0

JSPWiki v2.4.100
[RSS]
« Home Index Changes Prefs
This page (revision-1) was last changed on 22-Mar-07 18:08 PM, -0700 by VinayMulakkayala