Maven Test Sample of Main Process
This sample covers mocking for activities in process, service binding, starter activity and types of activity assertions.
-
Ensure that Apache Maven is installed on your system.
-
Ensure that the Maven plugin is installed correctly in your bw studio by verifying the Maven folder present under
<TIBCO_HOME>\bwce\2.x
directory.
- Procedure
In the samples directory, select AppSpace > UnitTesting and double-click tibco.bw.UT.sample.MainProcessWithUnitTestDemo.zip. For more information, see Accessing Samples.
Mavenize the project by right-clicking tibco.bw.UT.sample.MainProcessWithUnitTestDemo.application and selecting the Generate POM for Application option. The POM Generation window is displayed.
Enter the Parent POM details such as Group Id, Parent Artifact Id, and so on, and click Finish.
Note: The workspace is indexed after generating the POM files for the first time and may take some time. You can continue with the following steps and allow the indexing to run in the background.tibco.bw.UT.sample.MainProcessWithUnitTestDemo.application.parent is generated and the project is converted to Maven (Eclipse project) nature.
Right-click tibco.bw.UT.sample.MainProcessWithUnitTestDemo.application.parent and select Run as > Maven test.
Check the console to see the result.
The console displays messages similar to the following:
Understanding the Configuration
The project contains the following processes.
MainProcessWithProcessStarterMocked.bwp:
This process has JMSReceiver as a starter activity. Whenever a message is published on JMS queue, this process gets triggered. From the JMS message content, input for “GetBooks By author” SOAP call is constructed using mapper activity. Later in the process,“GetBooks By Author” SOAP call is made, which returns corresponding book details, and then using a mapper, the output response is converted in required format.
This process shows assertion support in the main process along with mocking support on process starter.
RESTServicBindingeMocked.bwp:
This process is triggered by the POST endpoint call, which requires book details like isbn, name, description, and author name in the post body. First this process publishes the book name, which it received in the POST body, as JMS message body and author name as dynamic property to a JMS queue. Later using mapper activity output for the REST endpoint is constructed and then using mapper the output is mapped to the postOut (reply activity).
This process shows mocking support on the REST Service binding.
SOAPServiceBindingMocked.bwp:
This process is triggered by the Get Books SOAP call, which receives ‘author’ as an input. After accepting author as input, depending on the author, the required output is constructed using mapper activity and then using GetBooksOut (Reply activity) the response like title, author, date isbn, and publisher is returned in the response.
This process shows mocking support on the SOAP Service binding.
Troubleshooting
If you find the application = null
error in the console then check the Maven version by navigating to Window > Preferences > Maven Defaults. The BW6 Maven Plugin Version should be the same as the plugin version you installed while installing TIBCO Business Studio for BusinessWorks. Similarly, check Maven version in the pom.xml
file.
Refer the Troubleshooting guide for any issues.