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
Input and Output folders are located at
, properties file
Utility to ease the creation of the test case Template Generator
.
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.
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