Skip to content

Commit

Permalink
Update jbpm-in-container-test to support WebSphere 9 (kiegroup#838)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarianMacik authored and hxf0801 committed Apr 27, 2018
1 parent 81efc3b commit 1f9c6cb
Show file tree
Hide file tree
Showing 13 changed files with 106 additions and 86 deletions.
13 changes: 9 additions & 4 deletions jbpm-container-test/jbpm-in-container-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ jBPM in container tests
=====================

**This test suite tests the jBPM engine inside various containers, namely WildFly 10, EAP 7, Tomcat 8,
Oracle WebLogic 12 and IBM WebSphere 8.5.5, using Maven Cargo and Arquillian.** Tests are focused on various aspects of jBPM engine
Oracle WebLogic 12 and IBM WebSphere 9, using Maven Cargo and Arquillian.** Tests are focused on various aspects of jBPM engine
such as transactions, EJB APIs, tasks, REST and WebServices integration.

This module consists of three submodules:
Expand All @@ -16,7 +16,7 @@ Tests are run very easily using the command

where `<container-profile>` is simply a particular container. Another container-specific parameters may also be configured (see the table below).
WildFly10, EAP 7 and Tomcat 8 do not have to be pre-installed, they will be downloaded automatically (in case of EAP 7, download URL has to be provided).
Oracle WebLogic 12 and IBM WebSphere 8.5.5 have to be pre-installed and the installation path has to be provided using a Maven property `weblogic.home` or `websphere.home` respectively.
Oracle WebLogic 12 and IBM WebSphere 9 have to be pre-installed and the installation path has to be provided using a Maven property `weblogic.home` or `websphere.home` respectively.

The following table lists all currently supported combinations of parameters:

Expand All @@ -26,12 +26,17 @@ The following table lists all currently supported combinations of parameters:
| EAP 7 | eap7 | eap7.download.url |
| Tomcat 8 | tomcat8 | *none* |
| Oracle WebLogic 12 | oracle-wls-12 | weblogic.home |
| IBM WebSphere 8.5.5 | was85x | websphere.home, env.WAS85_HOME<sup>1</sup>|
| IBM WebSphere 9 | was9 | websphere.home, env.WAS9_HOME<sup>1</sup> |

<sup>1</sup> Special property for Arquillian adapter for WebSphere, the value is the same as websphere.home

## Database configuration
By default, the tests are run with the H2 database. If you want to change the database, simply override **Datasource properties** in the **jbpm-container-test/pom.xml** file.

## WebSphere and Arquillian adapter
Currently, Arquillian adapter for WebSphere is not publicly available in Central Maven Repository. Instead, you have to build your own adapter and add it as a dependency to the profile **was85x** in the **jbpm-container-test-suite/pom.xml** file. This adapter's source code is available on [GitHub](https://github.com/arquillian/arquillian-container-was/tree/master/was-remote-8.5) as well.
Currently, Arquillian adapter for WebSphere is not publicly available in Central Maven Repository. Instead, you have to build your own adapter and add it as a dependency to the profile **was9** in the **jbpm-container-test-suite/pom.xml** file.
This adapter's source code is available on [GitHub](https://github.com/arquillian/arquillian-container-was/tree/master/was-remote-8.5) as well.

## Running a single test
If you want to run a single test, just specify it via an additional parameter ```-Dit.test=<test-name>``` and add ```-DfailIfNoTests=false```.
The latter has to be provided because of maven failsafe plugin which will fail by default if no tests are run on other modules.
Original file line number Diff line number Diff line change
Expand Up @@ -865,20 +865,20 @@
</profile>

<profile>
<id>was85x</id>
<id>was9</id>
<activation>
<property>
<name>container.profile</name>
<value>was85x</value>
<value>was9</value>
</property>
</activation>
<properties>
<container.id>websphere85x</container.id>
<container.id>websphere9</container.id>
<container.port>9080</container.port>
<!--WebSphere has to use this H2 driver class for pooling datasource-->
<org.jbpm.datasource.driver.class>org.h2.jdbcx.JdbcDataSource</org.jbpm.datasource.driver.class>
<org.jbpm.persistence.ds>jdbc/jbpm</org.jbpm.persistence.ds>
<container.tm>org.hibernate.service.jta.platform.internal.WebSphereExtendedJtaPlatform</container.tm>
<container.tm>org.jbpm.test.container.webspherefix.WebSphereFixedJtaPlatform</container.tm>
<!--Different web service URL for WebSphere has to be used-->
<wsdl.token>/SimpleService.wsdl</wsdl.token>
</properties>
Expand All @@ -890,6 +890,8 @@
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<container>
<!-- There is no Cargo for WebSphere 9 yet so we have to use the previous one -->
<containerId>websphere85x</containerId>
<type>installed</type>
<home>${websphere.home}</home>
<timeout>240000</timeout>
Expand All @@ -899,6 +901,10 @@
<artifactId>h2</artifactId>
</dependency>
</dependencies>
<systemProperties>
<!-- Disable implicit bean archives scanning to speed up deployment -->
<com.ibm.ws.cdi.enableImplicitBeanArchives>false</com.ibm.ws.cdi.enableImplicitBeanArchives>
</systemProperties>
</container>
<configuration>
<type>standalone</type>
Expand Down Expand Up @@ -936,85 +942,17 @@
<!--Arquillian connector-->
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-was-remote-8.5</artifactId>
<version>1.0.0.BRMS-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.ibm.ws</groupId>
<artifactId>ejb-thinclient</artifactId>
<version>8.5.0</version>
<scope>system</scope>
<systemPath>${websphere.home}/runtimes/com.ibm.ws.ejb.thinclient_8.5.0.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm.ws</groupId>
<artifactId>sib.client.thin.jms</artifactId>
<version>8.5.0</version>
<scope>system</scope>
<systemPath>${websphere.home}/runtimes/com.ibm.ws.sib.client.thin.jms_8.5.0.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm.ws</groupId>
<artifactId>orb</artifactId>
<version>8.5.0</version>
<scope>system</scope>
<systemPath>${websphere.home}/runtimes/com.ibm.ws.orb_8.5.0.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm.ws</groupId>
<artifactId>was_public</artifactId>
<version>8.5.0</version>
<scope>system</scope>
<systemPath>${websphere.home}/dev/was_public.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm.ws</groupId>
<artifactId>ibmjgssprovider</artifactId>
<version>8.5.0</version>
<scope>system</scope>
<systemPath>${websphere.home}/java/jre/lib/ibmjgssprovider.jar</systemPath>
</dependency>
<dependency>
<groupId>com.ibm.ws</groupId>
<artifactId>admin_client</artifactId>
<version>8.5.0</version>
<scope>system</scope>
<systemPath>${websphere.home}/runtimes/com.ibm.ws.admin.client_8.5.0.jar</systemPath>
<artifactId>arquillian-was-remote-9</artifactId>
<version>1.0.0.Final-BXMS-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-was-remote-8.5</artifactId>
<artifactId>arquillian-was-remote-9</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.ibm.ws</groupId>
<artifactId>ejb-thinclient</artifactId>
</dependency>
<dependency>
<groupId>com.ibm.ws</groupId>
<artifactId>sib.client.thin.jms</artifactId>
</dependency>
<dependency>
<groupId>com.ibm.ws</groupId>
<artifactId>orb</artifactId>
</dependency>
<dependency>
<groupId>com.ibm.ws</groupId>
<artifactId>was_public</artifactId>
</dependency>
<dependency>
<groupId>com.ibm.ws</groupId>
<artifactId>ibmjgssprovider</artifactId>
</dependency>
<dependency>
<groupId>com.ibm.ws</groupId>
<artifactId>admin_client</artifactId>
</dependency>
</dependencies>
</profile>
<profile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.jbpm.test.container.AbstractRuntimeEJBServicesTest;
import org.jbpm.test.container.JbpmContainerTest;
import org.jbpm.test.container.listeners.TrackingAgendaEventListener;
import org.jbpm.test.container.webspherefix.WebSphereFixedJtaPlatform;
import org.jbpm.test.container.tools.IntegrationMavenResolver;
import org.jboss.shrinkwrap.api.ArchivePaths;
import org.jboss.shrinkwrap.api.ShrinkWrap;
Expand Down Expand Up @@ -92,6 +93,8 @@ public WebArchive buildArchive() throws Exception {
.create(WebArchive.class, ARCHIVE_NAME + ".war")
.addAsLibraries(dependencies)
.addClass(EJBService.class)
// Workaroud for https://hibernate.atlassian.net/browse/HHH-11606
.addClass(WebSphereFixedJtaPlatform.class)
.addClass(JbpmContainerTest.class)
.addClass(AbstractEJBServicesTest.class)
.addClass(AbstractRuntimeEJBServicesTest.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.jbpm.test.container.JbpmContainerTest;
import org.jbpm.test.container.listeners.TrackingProcessEventListener;
import org.jbpm.test.container.test.EJBTransactionsTest;
import org.jbpm.test.container.webspherefix.WebSphereFixedJtaPlatform;
import org.jbpm.test.container.tools.IntegrationMavenResolver;
import org.jbpm.test.container.tools.TrackingListenerAssert;
import org.kie.api.KieServices;
Expand Down Expand Up @@ -66,6 +67,8 @@ public EnterpriseArchive buildArchive() {
.addPackages(true, "org.jbpm.test.container.groups", EJB_TRANSACTIONS_PACKAGE)
.addClass(EJBTransactions.class)
.addClass(JbpmContainerTest.class)
// Workaroud for https://hibernate.atlassian.net/browse/HHH-11606
.addClass(WebSphereFixedJtaPlatform.class)
.addClass(AbstractEJBTransactionsTest.class)
.addClass(EJBTransactionsTest.class)
.addClass(TrackingProcessEventListener.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.shrinkwrap.resolver.api.maven.PomEquippedResolveStage;
import org.jbpm.test.container.webspherefix.WebSphereFixedJtaPlatform;
import org.jbpm.test.container.tools.IntegrationMavenResolver;
import org.kie.api.KieServices;
import org.kie.api.io.Resource;
Expand Down Expand Up @@ -58,6 +59,8 @@ public WebArchive buildArchive() {
war = ShrinkWrap
.create(WebArchive.class, ARCHIVE_NAME + ".war")
.addPackage(HELLO_WEB_SERVICE_PACKAGE)
// Workaroud for https://hibernate.atlassian.net/browse/HHH-11606
.addClass(WebSphereFixedJtaPlatform.class)
.setWebXML(HELLO_WEB_SERVICE_PATH + "WEB-INF/web.xml")
.addAsLibraries(dependencies);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.jbpm.test.container.handlers.ListWorkItemHandler;
import org.jbpm.test.container.listeners.TrackingAgendaEventListener;
import org.jbpm.test.container.listeners.TrackingProcessEventListener;
import org.jbpm.test.container.webspherefix.WebSphereFixedJtaPlatform;
import org.jbpm.test.container.tools.IntegrationMavenResolver;
import org.jbpm.test.container.tools.KieUtils;
import org.kie.api.KieServices;
Expand Down Expand Up @@ -68,6 +69,8 @@ public WebArchive buildArchive() {
.addAsLibraries(dependencies);

war.addClass(LocalTransactions.class)
// Workaroud for https://hibernate.atlassian.net/browse/HHH-11606
.addClass(WebSphereFixedJtaPlatform.class)
.addClass(ListWorkItemHandler.class)
.addClass(TrackingAgendaEventListener.class)
.addClass(TrackingProcessEventListener.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.io.File;

import org.jbpm.test.container.webspherefix.WebSphereFixedJtaPlatform;
import org.jbpm.test.container.tools.IntegrationMavenResolver;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ArchivePaths;
Expand Down Expand Up @@ -62,6 +63,8 @@ public Archive<?> buildArchive() {
war = ShrinkWrap
.create(WebArchive.class, ARCHIVE_NAME + ".war")
.addPackage(REGISTER_REST_SERVICE_PACKAGE)
// Workaroud for https://hibernate.atlassian.net/browse/HHH-11606
.addClass(WebSphereFixedJtaPlatform.class)
.setWebXML(getClass().getResource("registerrestservice/WEB-INF/web.xml"))
.addAsWebInfResource(getClass().getResource("registerrestservice/WEB-INF/weblogic.xml"),
ArchivePaths.create("weblogic.xml"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.jbpm.test.container.groups.WLS;
import org.jbpm.test.container.listeners.TrackingProcessEventListener;
import org.jbpm.test.container.tools.TrackingListenerAssert;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.kie.api.KieBase;
Expand All @@ -43,7 +44,8 @@ public class EJBTransactionsTest extends AbstractEJBTransactionsTest {

private KieBase kbase;

public EJBTransactionsTest() {
@Before
public void setUp() {
kbase = getKBase(et.getResource(EJBTransactions.BPMN_DOUBLE_HUMAN_TASKS));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright 2017 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.jbpm.test.container.webspherefix;

import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
import javax.transaction.UserTransaction;

import org.hibernate.engine.transaction.jta.platform.internal.AbstractJtaPlatform;

/**
* Workaroud for https://hibernate.atlassian.net/browse/HHH-11606 .
*/
public class WebSphereFixedJtaPlatform extends AbstractJtaPlatform {

private static final long serialVersionUID = 1L;
public static final String UT_NAME = "java:comp/UserTransaction";

@Override
protected boolean canCacheTransactionManager() {
return true;
}

@Override
protected TransactionManager locateTransactionManager() {
try {
return (TransactionManager) Class.forName("com.ibm.ws.Transaction.TransactionManagerFactory").getMethod("getTransactionManager").invoke(null);
} catch (Exception e) {
throw new RuntimeException(e);
}
}

@Override
protected UserTransaction locateUserTransaction() {
return (UserTransaction) jndiService().locate(UT_NAME);
}

@Override
public Object getTransactionIdentifier(Transaction transaction) {
// WebSphere, however, is not a sane JEE/JTA container...
return Integer.valueOf(transaction.hashCode());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd
http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_2_0.xsd">
<persistence-unit name="org.jbpm.domain" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>${org.jbpm.persistence.ds}</jta-data-source>
<mapping-file>META-INF/Taskorm.xml</mapping-file>
<mapping-file>META-INF/JBPMorm.xml</mapping-file>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_1_0.xsd">

<persistence-unit name="containerPU" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>${org.jbpm.persistence.ds}</jta-data-source>
<mapping-file>META-INF/JBPMorm.xml</mapping-file>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@
</profile>

<profile>
<id>shrinkwrap-remote-was8</id>
<id>shrinkwrap-remote-was9</id>
<activation>
<property>
<name>container.profile</name>
<value>was85x</value>
<value>was9</value>
</property>
</activation>
<dependencies>
Expand All @@ -237,8 +237,8 @@
<artifactId>hibernate-jpa-2.1-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
Expand Down Expand Up @@ -286,6 +286,10 @@
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</exclusion>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
Expand Down

0 comments on commit 1f9c6cb

Please sign in to comment.