[tx-control] Integration tests for JPA two phase commit
git-svn-id: https://svn.apache.org/repos/asf/aries/trunk/tx-control@1745194 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/AbstractJPATransactionTest.java b/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/AbstractJPATransactionTest.java
index 7398f1b..0c66fbf 100644
--- a/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/AbstractJPATransactionTest.java
+++ b/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/AbstractJPATransactionTest.java
@@ -81,12 +81,11 @@
private String getRemoteDBPath() {
String fullResourceName = getClass().getName().replace('.', '/') + ".class";
- String resourcePath = getClass().getResource(getClass().getSimpleName() + ".class").getPath();
+ String resourcePath = getClass().getClassLoader().getResource(fullResourceName).getPath();
File testClassesDir = new File(resourcePath.substring(0, resourcePath.length() - fullResourceName.length()));
- String dbPath = new File(testClassesDir.getParentFile(), "testdb/db1").getAbsolutePath();
- return dbPath;
+ return new File(testClassesDir.getParentFile(), "testdb/db1").getAbsolutePath();
}
private EntityManager configuredEntityManager(String jdbcUrl) throws IOException {
diff --git a/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/XAEclipseLink_2_6_0_Test.java b/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/XAEclipseLink_2_6_0_Test.java
new file mode 100644
index 0000000..9682f0c
--- /dev/null
+++ b/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/XAEclipseLink_2_6_0_Test.java
@@ -0,0 +1,32 @@
+package org.apache.aries.tx.control.itests;
+
+import static org.ops4j.pax.exam.CoreOptions.bootClasspathLibrary;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.systemPackage;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+
+import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Option;
+
+public class XAEclipseLink_2_6_0_Test extends XAJPATransactionTest {
+
+ @Override
+ protected Option jpaProvider() {
+ return CoreOptions.composite(
+ // Add JTA 1.1 as a system package because of the link to javax.sql
+ systemProperty(ARIES_EMF_BUILDER_TARGET_FILTER)
+ .value("(osgi.unit.provider=org.eclipse.persistence.jpa.PersistenceProvider)"),
+ systemPackage("javax.transaction;version=1.1"),
+ systemPackage("javax.transaction.xa;version=1.1"),
+ bootClasspathLibrary(mavenBundle("org.apache.geronimo.specs", "geronimo-jta_1.1_spec", "1.1.1")),
+
+ // EclipseLink bundles and their dependencies (JPA API is available from the tx-control)
+ mavenBundle("org.eclipse.persistence", "org.eclipse.persistence.jpa", "2.6.0"),
+ mavenBundle("org.eclipse.persistence", "org.eclipse.persistence.core", "2.6.0"),
+ mavenBundle("org.eclipse.persistence", "org.eclipse.persistence.asm", "2.6.0"),
+ mavenBundle("org.eclipse.persistence", "org.eclipse.persistence.antlr", "2.6.0"),
+ mavenBundle("org.eclipse.persistence", "org.eclipse.persistence.jpa.jpql", "2.6.0"),
+ mavenBundle("org.apache.aries.jpa", "org.apache.aries.jpa.eclipselink.adapter", "2.4.0-SNAPSHOT"));
+ }
+
+}
diff --git a/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/XAHibernate_5_0_9_Test.java b/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/XAHibernate_5_0_9_Test.java
new file mode 100644
index 0000000..a367620
--- /dev/null
+++ b/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/XAHibernate_5_0_9_Test.java
@@ -0,0 +1,44 @@
+package org.apache.aries.tx.control.itests;
+
+import static org.ops4j.pax.exam.CoreOptions.bootClasspathLibrary;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.systemPackage;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+
+import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Option;
+
+public class XAHibernate_5_0_9_Test extends XAJPATransactionTest {
+
+ protected String ariesJPAVersion() {
+ return "2.4.0-SNAPSHOT";
+ }
+
+ @Override
+ protected Option jpaProvider() {
+ return CoreOptions.composite(
+ // Add JTA 1.1 as a system package because of the link to javax.sql
+ // Also set javax.xml.stream to 1.0 due to hibernate's funny packaging
+
+ systemProperty(ARIES_EMF_BUILDER_TARGET_FILTER)
+ .value("(osgi.unit.provider=org.hibernate.jpa.HibernatePersistenceProvider)"),
+ systemPackage("javax.xml.stream;version=1.0"),
+ systemPackage("javax.xml.stream.events;version=1.0"),
+ systemPackage("javax.xml.stream.util;version=1.0"),
+ systemPackage("javax.transaction;version=1.1"),
+ systemPackage("javax.transaction.xa;version=1.1"),
+ bootClasspathLibrary(mavenBundle("org.apache.geronimo.specs", "geronimo-jta_1.1_spec", "1.1.1")).beforeFramework(),
+
+ // Hibernate bundles and their dependencies (JPA API is available from the tx-control)
+ mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.antlr", "2.7.7_5"),
+ mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.dom4j", "1.6.1_5"),
+ mavenBundle("org.javassist", "javassist", "3.18.1-GA"),
+ mavenBundle("org.jboss.logging", "jboss-logging", "3.3.0.Final"),
+ mavenBundle("org.jboss", "jandex", "2.0.0.Final"),
+ mavenBundle("org.hibernate.common", "hibernate-commons-annotations", "5.0.1.Final"),
+ mavenBundle("org.hibernate", "hibernate-core", "5.0.9.Final"),
+ mavenBundle("org.hibernate", "hibernate-osgi", "5.0.9.Final"),
+ mavenBundle("org.hibernate", "hibernate-entitymanager", "5.0.9.Final"));
+ }
+
+}
diff --git a/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/XAJPATransactionTest.java b/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/XAJPATransactionTest.java
new file mode 100644
index 0000000..9f2f787
--- /dev/null
+++ b/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/XAJPATransactionTest.java
@@ -0,0 +1,379 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * 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 WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.tx.control.itests;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.streamBundle;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.CoreOptions.when;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Field;
+import java.util.Arrays;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
+import org.apache.aries.itest.AbstractIntegrationTest;
+import org.apache.aries.tx.control.itests.entity.Message;
+import org.h2.tools.Server;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.ProbeBuilder;
+import org.ops4j.pax.exam.TestProbeBuilder;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.ops4j.pax.exam.util.Filter;
+import org.ops4j.pax.tinybundles.core.TinyBundles;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.service.jdbc.DataSourceFactory;
+import org.osgi.service.jpa.EntityManagerFactoryBuilder;
+import org.osgi.service.transaction.control.TransactionControl;
+import org.osgi.service.transaction.control.TransactionRolledBackException;
+import org.osgi.service.transaction.control.jpa.JPAEntityManagerProvider;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public abstract class XAJPATransactionTest extends AbstractIntegrationTest {
+
+ static final String XA_TEST_UNIT_1 = "xa-test-unit-1";
+ static final String XA_TEST_UNIT_2 = "xa-test-unit-2";
+
+ protected static final String ARIES_EMF_BUILDER_TARGET_FILTER = "aries.emf.builder.target.filter";
+
+ @Inject
+ @Filter("(osgi.xa.enabled=true)")
+ protected TransactionControl txControl;
+
+ protected EntityManager em1;
+ protected EntityManager em2;
+
+ private Server server1;
+ private Server server2;
+
+ @Before
+ public void setUp() throws Exception {
+ server1 = Server.createTcpServer("-tcpPort", "0");
+ server1.start();
+
+ server2 = Server.createTcpServer("-tcpPort", "0");
+ server2.start();
+
+ String jdbcUrl1 = "jdbc:h2:tcp://127.0.0.1:" + server1.getPort() + "/" + getRemoteDBPath("db1");
+ String jdbcUrl2 = "jdbc:h2:tcp://127.0.0.1:" + server2.getPort() + "/" + getRemoteDBPath("db2");
+
+ em1 = configuredEntityManager(jdbcUrl1, XA_TEST_UNIT_1);
+ em2 = configuredEntityManager(jdbcUrl2, XA_TEST_UNIT_2);
+ }
+
+ private String getRemoteDBPath(String dbName) {
+ String fullResourceName = getClass().getName().replace('.', '/') + ".class";
+
+ String resourcePath = getClass().getClassLoader().getResource(fullResourceName).getPath();
+
+ File testClassesDir = new File(resourcePath.substring(0, resourcePath.length() - fullResourceName.length()));
+
+ return new File(testClassesDir.getParentFile(), "testdb/" + dbName).getAbsolutePath();
+ }
+
+ private EntityManager configuredEntityManager(String jdbcUrl, String unit) throws IOException {
+
+ Dictionary<String, Object> props = getBaseProperties();
+
+ props.put(DataSourceFactory.OSGI_JDBC_DRIVER_CLASS, "org.h2.Driver");
+ props.put(DataSourceFactory.JDBC_URL, jdbcUrl);
+ props.put(EntityManagerFactoryBuilder.JPA_UNIT_NAME, unit);
+
+ String filter = System.getProperty(ARIES_EMF_BUILDER_TARGET_FILTER);
+
+ if(filter != null) {
+ props.put(ARIES_EMF_BUILDER_TARGET_FILTER, "(&(osgi.unit.name=" + unit + ")" + filter + ")");
+ }
+
+ ConfigurationAdmin cm = context().getService(ConfigurationAdmin.class, 5000);
+
+ org.osgi.service.cm.Configuration config = cm.createFactoryConfiguration(
+ "org.apache.aries.tx.control.jpa.xa", null);
+ config.update(props);
+
+ return context().getService(JPAEntityManagerProvider.class,
+ "(" + EntityManagerFactoryBuilder.JPA_UNIT_NAME + "=" + unit + ")",
+ 5000).getResource(txControl);
+ }
+
+ protected Dictionary<String, Object> getBaseProperties() {
+ return new Hashtable<>();
+ }
+
+ @After
+ public void tearDown() {
+
+ clearConfiguration();
+
+ if(server1 != null) {
+ server1.stop();
+ }
+ if(server2 != null) {
+ server2.stop();
+ }
+
+ em1 = null;
+ em2 = null;
+ }
+
+ private void clearConfiguration() {
+ ConfigurationAdmin cm = context().getService(ConfigurationAdmin.class, 5000);
+ org.osgi.service.cm.Configuration[] cfgs = null;
+ try {
+ cfgs = cm.listConfigurations(null);
+ } catch (Exception e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+
+ if(cfgs != null) {
+ for(org.osgi.service.cm.Configuration cfg : cfgs) {
+ try {
+ cfg.delete();
+ } catch (Exception e) {}
+ }
+ try {
+ Thread.sleep(250);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @ProbeBuilder
+ public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) {
+ return probe;
+ }
+
+ @Configuration
+ public Option[] xaTxConfiguration() {
+ String localRepo = System.getProperty("maven.repo.local");
+ if (localRepo == null) {
+ localRepo = System.getProperty("org.ops4j.pax.url.mvn.localRepository");
+ }
+
+ return options(junitBundles(), systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
+ when(localRepo != null)
+ .useOptions(CoreOptions.vmOption("-Dorg.ops4j.pax.url.mvn.localRepository=" + localRepo)),
+ mavenBundle("org.apache.aries.testsupport", "org.apache.aries.testsupport.unit").versionAsInProject(),
+ mavenBundle("org.apache.aries.tx-control", "tx-control-service-xa").versionAsInProject(),
+ mavenBundle("com.h2database", "h2").versionAsInProject(),
+ mavenBundle("org.apache.aries.tx-control", "tx-control-provider-jpa-xa").versionAsInProject(),
+ jpaProvider(),
+ mavenBundle("org.apache.aries.jpa", "org.apache.aries.jpa.container", ariesJPAVersion()),
+ mavenBundle("org.apache.felix", "org.apache.felix.configadmin").versionAsInProject(),
+ mavenBundle("org.ops4j.pax.logging", "pax-logging-api").versionAsInProject(),
+ mavenBundle("org.ops4j.pax.logging", "pax-logging-service").versionAsInProject(),
+
+ streamBundle(getTestUnit(XA_TEST_UNIT_1)),
+ streamBundle(getTestUnit(XA_TEST_UNIT_2))
+
+// ,CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005")
+ );
+ }
+
+ private InputStream getTestUnit(String unit) {
+ String descriptor = "META-INF/" + unit + ".xml";
+ return TinyBundles.bundle()
+ .add(Message.class)
+ .add(descriptor, getClass().getResource("/" + descriptor))
+ .set("Meta-Persistence", descriptor)
+ .set("Bundle-SymbolicName", unit)
+ .set("Import-Package", "javax.persistence")
+ .set("Require-Capability", "osgi.contract;filter:=\"(&(osgi.contract=JavaJPA)(version=2.0))\"")
+ // This line is necessary while https://hibernate.atlassian.net/browse/HHH-10742 is unfixed
+ .set("DynamicImport-Package", "org.hibernate.proxy,javassist.util.proxy")
+ .build();
+ }
+
+ protected String ariesJPAVersion() {
+ return "2.3.0";
+ }
+
+ protected abstract Option jpaProvider();
+
+ @Test
+ public void testTwoPhaseCommit() throws Exception {
+ Object m1 = getMessageEntityFrom(XA_TEST_UNIT_1);
+ Object m2 = getMessageEntityFrom(XA_TEST_UNIT_2);
+
+ txControl.required(() -> {
+ setMessage(m1, "Hello World!");
+
+ em1.persist(m1);
+
+ setMessage(m2, "Hello 1!");
+
+ em2.persist(m2);
+
+ return null;
+ });
+
+ assertEquals("Hello World!", txControl.notSupported(() -> {
+ return getMessage(em1.find(m1.getClass(), getId(m1)));
+ }));
+
+ assertEquals("Hello 1!", txControl.notSupported(() -> {
+ return getMessage(em2.find(m2.getClass(), getId(m2)));
+ }));
+ }
+
+ @Test
+ public void testTwoPhaseRollback() throws Exception {
+ Object m1 = getMessageEntityFrom(XA_TEST_UNIT_1);
+ Object m2 = getMessageEntityFrom(XA_TEST_UNIT_2);
+ Object m3 = getMessageEntityFrom(XA_TEST_UNIT_2);
+ try {
+
+ txControl.required(() -> {
+ setMessage(m1, "Hello World!");
+
+ em1.persist(m1);
+
+ setMessage(m2, "Hello 1!");
+
+ em2.persist(m2);
+
+ txControl.requiresNew(() -> {
+ setMessage(m3, "Hello 2!");
+ em2.persist(m3);
+ return null;
+ });
+
+ txControl.getCurrentContext().registerXAResource(new PoisonResource());
+
+ return null;
+ });
+ fail("Should roll back");
+ } catch (TransactionRolledBackException trbe) {
+ }
+
+ assertEquals(0, (int) txControl.notSupported(() -> {
+ CriteriaBuilder cb = em1.getCriteriaBuilder();
+ CriteriaQuery<Long> countQuery = cb.createQuery(Long.class);
+ countQuery.select(cb.count(countQuery.from(m1.getClass())));
+
+ return em1.createQuery(countQuery).getSingleResult().intValue();
+ }));
+
+
+ assertEquals(Arrays.asList("Hello 2!"), txControl.notSupported(() -> {
+ CriteriaBuilder cb = em2.getCriteriaBuilder();
+ CriteriaQuery<String> query = cb.createQuery(String.class);
+ query.select(query.from(m2.getClass()).get("message"));
+
+ return em2.createQuery(query).getResultList();
+ }));
+ }
+
+ Object getMessageEntityFrom(String unit) throws Exception {
+ Class<?> clz = context().getBundleByName(unit).loadClass(
+ "org.apache.aries.tx.control.itests.entity.Message");
+ return clz.newInstance();
+ }
+
+ void setMessage(Object entity, String message) throws Exception {
+ Field f = entity.getClass().getField("message");
+ f.set(entity, message);
+ }
+
+ String getMessage(Object entity) throws Exception {
+ Field f = entity.getClass().getField("message");
+ return (String) f.get(entity);
+ }
+
+ Integer getId(Object entity) throws Exception {
+ Field f = entity.getClass().getField("id");
+ return (Integer) f.get(entity);
+ }
+
+ private static class PoisonResource implements XAResource {
+
+ @Override
+ public void commit(Xid arg0, boolean arg1) throws XAException {
+ throw new XAException(XAException.XA_RBOTHER);
+ }
+
+ @Override
+ public void end(Xid arg0, int arg1) throws XAException {
+ }
+
+ @Override
+ public void forget(Xid arg0) throws XAException {
+ }
+
+ @Override
+ public int getTransactionTimeout() throws XAException {
+ return 30;
+ }
+
+ @Override
+ public boolean isSameRM(XAResource arg0) throws XAException {
+ return false;
+ }
+
+ @Override
+ public int prepare(Xid arg0) throws XAException {
+ throw new XAException(XAException.XA_RBOTHER);
+ }
+
+ @Override
+ public Xid[] recover(int arg0) throws XAException {
+ return new Xid[0];
+ }
+
+ @Override
+ public void rollback(Xid arg0) throws XAException {
+ }
+
+ @Override
+ public boolean setTransactionTimeout(int arg0) throws XAException {
+ return false;
+ }
+
+ @Override
+ public void start(Xid arg0, int arg1) throws XAException {
+ }
+ }
+}
diff --git a/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/XAOpenJPA_2_4_1_Test.java b/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/XAOpenJPA_2_4_1_Test.java
new file mode 100644
index 0000000..fcfa813
--- /dev/null
+++ b/tx-control-jpa-itests/src/test/java/org/apache/aries/tx/control/itests/XAOpenJPA_2_4_1_Test.java
@@ -0,0 +1,56 @@
+package org.apache.aries.tx.control.itests;
+
+import static org.ops4j.pax.exam.CoreOptions.bootClasspathLibrary;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.systemPackage;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.ops4j.pax.exam.CoreOptions;
+import org.ops4j.pax.exam.Option;
+
+public class XAOpenJPA_2_4_1_Test extends XAJPATransactionTest {
+
+ @Override
+ protected String ariesJPAVersion() {
+ return "2.4.0-SNAPSHOT";
+ }
+
+ @Override
+ protected Dictionary<String, Object> getBaseProperties() {
+ Dictionary<String, Object> base = new Hashtable<>();
+ //This is necessary due to https://issues.apache.org/jira/browse/OPENJPA-2521
+ base.put("openjpa.MetaDataFactory", "jpa(Types=org.apache.aries.tx.control.itests.entity.Message)");
+ base.put("openjpa.RuntimeUnenhancedClasses", "supported");
+
+ //This is necessary as OpenJPA is only JPA 2.0 compliant and does not understand the standard properties
+ base.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true, SchemaAction='add,deleteTableContents')");
+
+ base.put("openjpa.Log", "DefaultLevel=TRACE");
+ return base;
+ }
+
+ @Override
+ protected Option jpaProvider() {
+ return CoreOptions.composite(
+ // Add JTA 1.1 as a system package because of the link to javax.sql
+
+ systemProperty(ARIES_EMF_BUILDER_TARGET_FILTER)
+ .value("(osgi.unit.provider=org.apache.openjpa.persistence.PersistenceProviderImpl)"),
+ systemPackage("javax.transaction;version=1.1"),
+ systemPackage("javax.transaction.xa;version=1.1"),
+ bootClasspathLibrary(mavenBundle("org.apache.geronimo.specs", "geronimo-jta_1.1_spec", "1.1.1")).beforeFramework(),
+
+ // OpenJPA bundles and their dependencies (JPA API is available from the tx-control)
+ mavenBundle("commons-pool", "commons-pool", "1.5.4"),
+ mavenBundle("commons-lang", "commons-lang", "2.4"),
+ mavenBundle("commons-collections", "commons-collections", "3.2.2"),
+ mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.serp", "1.15.1_1"),
+ mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.commons-dbcp", "1.4_3"),
+ mavenBundle("org.apache.xbean", "xbean-asm5-shaded", "3.17"),
+ mavenBundle("org.apache.openjpa", "openjpa", "2.4.1"));
+ }
+
+}
diff --git a/tx-control-jpa-itests/src/test/resources/META-INF/xa-test-unit-1.xml b/tx-control-jpa-itests/src/test/resources/META-INF/xa-test-unit-1.xml
new file mode 100644
index 0000000..7c4a116
--- /dev/null
+++ b/tx-control-jpa-itests/src/test/resources/META-INF/xa-test-unit-1.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ 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.
+-->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+ version="2.0">
+
+ <persistence-unit name="xa-test-unit-1">
+ <description>Test XA persistence unit for the Transaction Control JPA Provider</description>
+ <properties>
+ <!-- These properties are creating the database on the fly.
+ We are using them to avoid the tests having
+ to create a database -->
+ <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
+ </properties>
+ </persistence-unit>
+</persistence>
\ No newline at end of file
diff --git a/tx-control-jpa-itests/src/test/resources/META-INF/xa-test-unit-2.xml b/tx-control-jpa-itests/src/test/resources/META-INF/xa-test-unit-2.xml
new file mode 100644
index 0000000..ea83167
--- /dev/null
+++ b/tx-control-jpa-itests/src/test/resources/META-INF/xa-test-unit-2.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+ 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.
+-->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+ version="2.0">
+
+ <persistence-unit name="xa-test-unit-2">
+ <description>Test XA persistence unit for the Transaction Control JPA Provider</description>
+ <properties>
+ <!-- These properties are creating the database on the fly.
+ We are using them to avoid the tests having
+ to create a database -->
+ <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
+ </properties>
+ </persistence-unit>
+</persistence>
\ No newline at end of file