Tuesday, December 15, 2015

Run Integration Test with WSO2 ESB EJB2 Connector and Jboss 5.1

As we discussed earlier EJB2 connector is a tool to make calls between remote EJB2.X objects and wso2 ESB. there are two type of calls we can call.Stateless and stateful where stateless is a one time call and stateful maintain a state between remote object and client. Integration Test for EJB2.X connector written based on Jboss 5.1 server so there are some pre configuration we need to  set before we run the integration test.

in this blog lets see how to configure ESB before run the test and what are the libraries we need to add to ESB and Test Client. Integration test is very important to check the stability of connector(to validate the methods).

 Pre-requisites

  1. Maven 3.X
  2. Java 1.7 or above
  3. Jboss 5.1

The org.wso2.esb.integration.integration-base project is required. The test suite has been configured to download this project automatically. If the automatic download fails, download the following project and compile it using the mvn clean install command to update your local repository

Tested Platform: 

  • UBUNTU 14.04
  • WSO2 ESB 4.9.0

Dependency jars

  1. EJB2StatefulJboss.jar
  2. EJB2StatelessJboss.jar
  3. jbossall-client.jar
Make sure the ESB 4.9.0 zip file with latest patches available at "{CONNECTOR_HOME}/repository/" and add Dependency jar files into "{ESB_HOME}/repository/component/lib"
 
 jbossall-client.jar will avoid OSGI issues other wise we need to copy below jar files into lib folder

  • jbossall-client.jar
  • commons-logging.jar
  • concurrent.jar
  • ejb3-persistence.jar
  • hibernate-annotations.jar
  • jboss-aop-client.jar
  • jboss-appclient.jar
  • jboss-aspect-jdk50-client.jar
  • jboss-client.jar
  • jboss-common-core.jar
  • jboss-deployers-client-spi.jar
  • jboss-deployers-client.jar
  • jboss-deployers-core-spi.jar
  • jboss-deployers-core.jar
  • jboss-deployment.jar
  • jboss-ejb3-common-client.jar
  • jboss-ejb3-core-client.jar
  • jboss-ejb3-ext-api.jar
  • jboss-ejb3-proxy-clustered-client.jar
  • jboss-ejb3-proxy-impl-client.jar
  • jboss-ejb3-proxy-spi-client.jar
  • jboss-ejb3-security-client.jar
  • jboss-ha-client.jar
  • jboss-ha-legacy-client.jar
  • jboss-iiop-client.jar
  • jboss-integration.jar
  • jboss-j2se.jar
  • jboss-javaee.jar
  • jboss-jsr77-client.jar
  • jboss-logging-jdk.jar
  • jboss-logging-log4j.jar
  • jboss-logging-spi.jar
  • jboss-main-client.jar
  • jboss-mdr.jar
  • jboss-messaging-client.jar
  • jboss-remoting.jar
  • jboss-security-spi.jar
  • jboss-serialization.jar
  • jboss-srp-client.jar
  • jboss-system-client.jar
  • jboss-system-jmx-client.jar
  • jbosscx-client.jar
  • jbossjts-integration.jar
  • jbossjts.jar
  • jbosssx-as-client.jar
  • jbosssx-client.jar
  • jmx-client.jar
  • jmx-invoker-adaptor-client.jar
  • jnp-client.jar
  • slf4j-api.jar
  • slf4j-jboss-logging.jar
  • xmlsec.jar
  
for the actual client written in Integration test we already added Dependency 
<dependency>
    <groupId>org.jboss.jbossas</groupId>
    <artifactId>jboss-as-client</artifactId>
    <version>${jboss.lib.version}</version>
    <type>pom</type>
</dependency>

and we need to copy EJB2StatelessJboss.jar and EJB2StatefulJboss.jar into "{EJB_HOME}/ejb2-connector/ejb2-connector-1.0.9/org.wso2.carbon.connector/src/test/resource/ESB/jar/"

now run mvn clean install to run the test. you will get below output

PASSED: statefulBean
        Stateful Bean Jboss
PASSED: statelessBean
        Stateless Bean Jboss

===============================================
    Ejb2-Connector-Test
    Tests run: 2, Failures: 0, Skips: 0
===============================================