This is a sample project of TIBCO BusinessEvents. It illustrates the use of various data types in TIBCO BusinessEvents (BE) applications. The main purpose of this project is, however, to demonstrate a framework for testing BE applications.
To support Test-Driven development (TDD) and Continuous Delivery (CD), we need a test framework to automate the unit tests for individual rules and rule-functions in BE applications. This project illustrates a light-weight framework for developers to write unit tests within the same BE application project, and expose all tests as a uniform REST API. The Java project beunit illustrates how to use JUnit to run tests and collect BE test results via the REST API of this test framework. With the help of Maven and Jenkins, we can include the unit test as a step in the CD process.
It is tested with TIBCO BusinessEvents 5.2.0, but the framework may work with earlier version of BE as well. If you are a licensed TIBCO customer, you can download and install the following BE packages from TIBCO eDelivery:
- TIBCO BusinessEvents Standard Edition
- TIBCO BusinessEvents Data Modeling
- TIBCO BusinessEvents Decision Manager
- TIBCO BusinessEvents Stream Processing
If Git has not been installed, please check the notes in beunit to install and configure Git and Maven.
In the root folder of your workspace, clone the project using the command
git clone https://github.com/yxuco/DataTypeDemo.git
It should download the source code to the DataTypeDemo
folder under your workspace.
To write readable tests with assertion, we wrapped and extended the JUnit and Hamcrest core assertion APIs as BusinessEvents catalog functions. These functions are implemented by the project beassert. So, before continue, you need to download and build beassert according to the instructions there.
Launch the TIBCO BusinessEvents Studio, import and configure the BE project as follows.
- Pulldown File menu and select Import...
- In the Import dialog, select Existing TIBCO BusinessEvents Studio Project, then click Next > button.
- In the Existing TIBCO BusinessEvents Project Import Wizard dialog, browse for Existing project root directory, select and open the
DataTypeDemo
folder under your workspace. - Confirm that
your-workspace/DataTypeDemo
is populated as the Existing project root directory, uncheckCopy project info workspace
, then click the Finish button. - If the BusinessEvents Studio Development perspective is not open, in Package Explorer or Studio Explorer, highlight the root of the imported project
DataTypeDemo
, and pulldown Window menu to open the BusinessEvents Studio Development Perspective. - Right-click the project root
DataTypeDemo
and select popup menu Properties. Highlight Build Path and in Java Libraries panel, add a Third Party librarybeassert-1.0.jar
, which is built by the project beassert. - In Studio Explorer, highlight the project root folder
DataTypeDemo
, pulldown Project menu and select Clean.... - In Studio Explorer, right-click the project root folder and select the popup menu Build Enterprise Archive....
- In Building Enterprise Archive... dialog, select a File Location for the EAR file, e.g.,
/tmp/DataTypeDemo.ear
, then click the OK button. - If you see a dialog "
The Enterprise Archive file was built correctly
", you are ready to start the BE engine. - To start the BE engine in BusinessEvents Studio, in the "run configuration", add 3 jars to the classpath:
junit-4.12.jar
,hamcrest-core-1.3.jar
, andbeassert-1.0.jar
. All 3 jars can be found in the Maven local repository, which is by default, ~/.m2/repository. - To start the BE engine from command-line, use the following command from where you generated the
DataTypeDemo.ear
file. Note: edit thebe-engine.tra
to add the 3 jar files to the classpath.
${BE_HOME}/bin/be-engine --propFile ${BE_HOME}/bin/be-engine.tra -u default \
-c ${WORKSPACE}/DataTypeDemo/Deployments/DataTypeDemo.cdd DataTypeDemo.ear
where BE_HOME
is the root folder of the BE product installation, e.g., /usr/local/tibco/be/5.2
, and WORKSPACE
is the workspace folder where you cloned the DataTypeDemo
project.
While the BE engine is running, you can launch the JUnit tests in the BusinessEvents Studio as described in the beunit project. Change to Java Perspective when you run the JUnit tests. Congratulations if you see a Green bar in the JUnit test panel, indicating success of all test cases.
Please email or open issues if there is any problem with this project. To get started on using this test framework, you may check out the tutorial.
Note: On my Mac, BusinessEvents Studio sometimes hangs during startup due to Eclipse cached state. If you experience the same, you may try to start it from command-line using the following flags:
cd $BE_HOME/studio/eclipse/studio.app/Contents/MacOS
./studio -clean -clearPersistedState
If this does not work, delete the following 2 files from the workspace and then restart:
$workspace/.metadata/.lock
$workspace/.metadata/.plugins/org.eclipse.core.resources/*.snap
Yueming is a Sr. Architect working at TIBCO Architecture Service Group.