Add integration tests for the Transaction Control Service implementations
diff --git a/tx-control-services/pom.xml b/tx-control-services/pom.xml
index 8332a22..d5de45f 100644
--- a/tx-control-services/pom.xml
+++ b/tx-control-services/pom.xml
@@ -37,6 +37,7 @@
         <module>tx-control-service-common</module>
         <module>tx-control-service-local</module>
         <module>tx-control-service-xa</module>
+        <module>tx-control-service-itests</module>
     </modules>
 
 </project>
diff --git a/tx-control-services/tx-control-service-itests/LICENSE b/tx-control-services/tx-control-service-itests/LICENSE
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/tx-control-services/tx-control-service-itests/LICENSE
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+
diff --git a/tx-control-services/tx-control-service-itests/NOTICE b/tx-control-services/tx-control-service-itests/NOTICE
new file mode 100644
index 0000000..4e2a476
--- /dev/null
+++ b/tx-control-services/tx-control-service-itests/NOTICE
@@ -0,0 +1,8 @@
+
+Apache Aries
+Copyright 2009-2019 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+
diff --git a/tx-control-services/tx-control-service-itests/pom.xml b/tx-control-services/tx-control-service-itests/pom.xml
new file mode 100644
index 0000000..8704190
--- /dev/null
+++ b/tx-control-services/tx-control-service-itests/pom.xml
@@ -0,0 +1,200 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.aries.tx-control</groupId>
+        <artifactId>tx-control-service-parent</artifactId>
+        <version>1.0.1-SNAPSHOT</version>
+        <relativePath>../tx-control-service-parent/pom.xml</relativePath>
+    </parent>
+	<groupId>org.apache.aries.tx-control</groupId>
+	<artifactId>tx-control-service-itests</artifactId>
+	<version>1.0.1-SNAPSHOT</version>
+	<name>Apache Aries Transaction Control Service iTests</name>
+	<description>
+        Integration tests for the Aries Transaction Control service implementations
+    </description>
+
+	<properties>
+		<exam.version>3.4.0</exam.version>
+		<url.version>1.6.0</url.version>
+	</properties>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.framework</artifactId>
+			<scope>test</scope>
+			<version>5.0.1</version>
+		</dependency>
+		
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>org.osgi.service.transaction.control</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.aries.tx-control</groupId>
+			<artifactId>tx-control-service-local</artifactId>
+			<scope>test</scope>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.aries.tx-control</groupId>
+			<artifactId>tx-control-service-xa</artifactId>
+			<scope>test</scope>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>org.apache.felix.configadmin</artifactId>
+			<scope>test</scope>
+			<version>1.8.8</version>
+		</dependency>
+
+		<!-- pax exam -->
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+			<version>1.7.7</version>
+		</dependency>
+		<dependency>
+			<groupId>org.ops4j.pax.exam</groupId>
+			<artifactId>pax-exam</artifactId>
+			<version>${exam.version}</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.ops4j.pax.exam</groupId>
+			<artifactId>pax-exam-container-forked</artifactId>
+			<version>${exam.version}</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.ops4j.pax.exam</groupId>
+			<artifactId>pax-exam-junit4</artifactId>
+			<version>${exam.version}</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.ops4j.pax.exam</groupId>
+			<artifactId>pax-exam-link-mvn</artifactId>
+			<version>${exam.version}</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.ops4j.pax.url</groupId>
+			<artifactId>pax-url-aether</artifactId>
+			<version>${url.version}</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>ch.qos.logback</groupId>
+			<artifactId>logback-core</artifactId>
+			<version>0.9.29</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>ch.qos.logback</groupId>
+			<artifactId>logback-classic</artifactId>
+			<version>0.9.29</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.ops4j.pax.tinybundles</groupId>
+			<artifactId>tinybundles</artifactId>
+			<version>2.0.0</version>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>javax.inject</groupId>
+			<artifactId>javax.inject</artifactId>
+			<version>1</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.ops4j.pax.logging</groupId>
+			<artifactId>pax-logging-api</artifactId>
+			<version>1.7.2</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.ops4j.pax.logging</groupId>
+			<artifactId>pax-logging-service</artifactId>
+			<version>1.7.2</version>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<configuration>
+					<forkMode>pertest</forkMode>
+				</configuration>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.servicemix.tooling</groupId>
+				<artifactId>depends-maven-plugin</artifactId>
+				<version>1.2</version>
+				<executions>
+					<execution>
+						<id>generate-depends-file</id>
+						<goals>
+							<goal>generate-depends-file</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+
+	<profiles>
+		<profile>
+			<id>ci-build-profile</id>
+			<activation>
+				<property>
+					<name>maven.repo.local</name>
+				</property>
+			</activation>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.apache.maven.plugins</groupId>
+						<artifactId>maven-surefire-plugin</artifactId>
+						<configuration>
+							<!-- when the local repo location has been specified, we need to pass 
+								on this information to PAX mvn url -->
+							<argLine>-Dorg.ops4j.pax.url.mvn.localRepository=${maven.repo.local}</argLine>
+						</configuration>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+	</profiles>
+
+</project>
diff --git a/tx-control-services/tx-control-service-itests/src/test/java/org/apache/aries/tx/control/itests/service/LocalTransactionTest.java b/tx-control-services/tx-control-service-itests/src/test/java/org/apache/aries/tx/control/itests/service/LocalTransactionTest.java
new file mode 100644
index 0000000..0c7dcf7
--- /dev/null
+++ b/tx-control-services/tx-control-service-itests/src/test/java/org/apache/aries/tx/control/itests/service/LocalTransactionTest.java
@@ -0,0 +1,126 @@
+/*

+ * 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.service;

+

+import static org.junit.Assert.assertEquals;

+import static org.junit.Assert.assertNull;

+import static org.junit.Assert.assertTrue;

+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.systemProperty;

+import static org.ops4j.pax.exam.CoreOptions.when;

+

+import java.util.concurrent.Callable;

+

+import javax.inject.Inject;

+

+import org.apache.aries.tx.control.itests.service.RecordingResource.Action;

+import org.apache.aries.tx.control.itests.service.RecordingResource.Interaction;

+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.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.osgi.service.transaction.control.TransactionContext;

+import org.osgi.service.transaction.control.TransactionControl;

+

+@RunWith(PaxExam.class)

+@ExamReactorStrategy(PerClass.class)

+public class LocalTransactionTest {

+

+	@Inject

+	@Filter("(osgi.local.enabled=true)")

+	private TransactionControl txControl;

+

+	@Test

+	public void testLocalSupportAdvertised() {

+		txControl.required(new Callable<Object>() {

+			@Override

+			public Object call() throws Exception {

+				assertTrue(txControl.getCurrentContext().supportsLocal());

+				return null;

+			}

+		});

+	}

+

+	@Test

+	public void testRegisterLocalResource() {

+

+		RecordingResource resource = new RecordingResource();

+		

+		txControl.required(new Callable<Object>() {

+			@Override

+			public Object call() throws Exception {

+				TransactionContext context = txControl.getCurrentContext();

+				context.registerLocalResource(resource);

+				return null;

+			}

+		});

+		

+		Interaction i = resource.getList().get(0);

+		

+		assertEquals(Action.LOCAL_COMMIT, i.action);

+		assertNull(i.xid);

+		

+		assertEquals(1, resource.getList().size());

+	}

+

+	@Configuration

+	public Option[] localTxConfiguration() {

+		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.tx-control", "tx-control-service-local").versionAsInProject(),

+				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()

+

+		// ,CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005")

+		);

+	}

+	

+	@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.tx-control", "tx-control-service-xa").versionAsInProject(),

+				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()

+				

+				// ,CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005")

+				);

+	}

+}

diff --git a/tx-control-services/tx-control-service-itests/src/test/java/org/apache/aries/tx/control/itests/service/PoisonResource.java b/tx-control-services/tx-control-service-itests/src/test/java/org/apache/aries/tx/control/itests/service/PoisonResource.java
new file mode 100644
index 0000000..9f2d336
--- /dev/null
+++ b/tx-control-services/tx-control-service-itests/src/test/java/org/apache/aries/tx/control/itests/service/PoisonResource.java
@@ -0,0 +1,27 @@
+package org.apache.aries.tx.control.itests.service;
+
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.Xid;
+
+import org.osgi.service.transaction.control.TransactionException;
+
+public class PoisonResource extends RecordingResource {
+
+	@Override
+	public void commit(Xid arg0, boolean arg1) throws XAException {
+		super.commit(arg0, arg1);
+		throw new XAException(XAException.XA_RBOTHER);
+	}
+
+	@Override
+	public int prepare(Xid arg0) throws XAException {
+		super.prepare(arg0);
+		throw new XAException(XAException.XA_RBOTHER);
+	}
+
+	@Override
+	public void commit() throws TransactionException {
+		super.commit();
+		throw new TransactionException("Poison");
+	}
+}
\ No newline at end of file
diff --git a/tx-control-services/tx-control-service-itests/src/test/java/org/apache/aries/tx/control/itests/service/RecordingResource.java b/tx-control-services/tx-control-service-itests/src/test/java/org/apache/aries/tx/control/itests/service/RecordingResource.java
new file mode 100644
index 0000000..6408878
--- /dev/null
+++ b/tx-control-services/tx-control-service-itests/src/test/java/org/apache/aries/tx/control/itests/service/RecordingResource.java
@@ -0,0 +1,97 @@
+package org.apache.aries.tx.control.itests.service;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
+import org.osgi.service.transaction.control.LocalResource;
+import org.osgi.service.transaction.control.TransactionException;
+
+public class RecordingResource implements XAResource, LocalResource {
+	
+	public static enum Action {
+		LOCAL_COMMIT, LOCAL_ROLLBACK, STARTED, PREPARED, COMMITTED_ONE_PHASE, COMMITTED, ROLLED_BACK, FORGOTTEN, END;
+	}
+
+	public static class Interaction {
+		public final RecordingResource.Action action;
+		public final Xid xid;
+		
+		public Interaction(RecordingResource.Action action, Xid xid) {
+			this.action = action;
+			this.xid = xid;
+		}
+	}
+
+	private final List<RecordingResource.Interaction> list = new ArrayList<>();
+
+	@Override
+	public void commit(Xid arg0, boolean arg1) throws XAException {
+		list.add(new Interaction(
+				arg1 ? Action.COMMITTED_ONE_PHASE : Action.COMMITTED, arg0));
+	}
+
+	@Override
+	public void end(Xid arg0, int arg1) throws XAException {
+		list.add(new Interaction(Action.END, arg0));
+	}
+
+	@Override
+	public void forget(Xid arg0) throws XAException {
+		list.add(new Interaction(Action.FORGOTTEN, arg0));
+	}
+
+	@Override
+	public int getTransactionTimeout() throws XAException {
+		return 30;
+	}
+
+	@Override
+	public boolean isSameRM(XAResource arg0) throws XAException {
+		return this == arg0;
+	}
+
+	@Override
+	public int prepare(Xid arg0) throws XAException {
+		list.add(new Interaction(Action.PREPARED, arg0));
+		return XA_OK;
+	}
+
+	@Override
+	public Xid[] recover(int arg0) throws XAException {
+		return new Xid[0];
+	}
+
+	@Override
+	public void rollback(Xid arg0) throws XAException {
+		list.add(new Interaction(Action.ROLLED_BACK, arg0));
+	}
+
+	@Override
+	public boolean setTransactionTimeout(int arg0) throws XAException {
+		return false;
+	}
+
+	@Override
+	public void start(Xid arg0, int arg1) throws XAException {
+		list.add(new Interaction(Action.STARTED, arg0));
+	}
+
+	public List<RecordingResource.Interaction> getList() {
+		return Collections.unmodifiableList(list);
+	}
+
+	@Override
+	public void commit() throws TransactionException {
+		list.add(new Interaction(Action.LOCAL_COMMIT, null));
+	}
+
+	@Override
+	public void rollback() throws TransactionException {
+		list.add(new Interaction(Action.LOCAL_ROLLBACK, null));
+	}
+}
\ No newline at end of file
diff --git a/tx-control-services/tx-control-service-itests/src/test/java/org/apache/aries/tx/control/itests/service/RecoveryTest.java b/tx-control-services/tx-control-service-itests/src/test/java/org/apache/aries/tx/control/itests/service/RecoveryTest.java
new file mode 100644
index 0000000..934b684
--- /dev/null
+++ b/tx-control-services/tx-control-service-itests/src/test/java/org/apache/aries/tx/control/itests/service/RecoveryTest.java
@@ -0,0 +1,204 @@
+/*

+ * 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.service;

+

+import static org.junit.Assert.assertEquals;

+import static org.junit.Assert.assertTrue;

+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.systemProperty;

+import static org.ops4j.pax.exam.CoreOptions.when;

+

+import java.util.ArrayList;

+import java.util.Collections;

+import java.util.List;

+import java.util.concurrent.Callable;

+import java.util.concurrent.CountDownLatch;

+import java.util.concurrent.TimeUnit;

+

+import javax.inject.Inject;

+import javax.transaction.xa.XAException;

+import javax.transaction.xa.XAResource;

+import javax.transaction.xa.Xid;

+

+import org.apache.aries.tx.control.itests.service.RecordingResource.Action;

+import org.apache.aries.tx.control.itests.service.RecordingResource.Interaction;

+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.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.osgi.framework.BundleContext;

+import org.osgi.framework.ServiceRegistration;

+import org.osgi.service.transaction.control.TransactionContext;

+import org.osgi.service.transaction.control.TransactionControl;

+import org.osgi.service.transaction.control.recovery.RecoverableXAResource;

+

+@RunWith(PaxExam.class)

+@ExamReactorStrategy(PerClass.class)

+public class RecoveryTest {

+

+	@Inject

+	@Filter("(osgi.xa.enabled=true)")

+	private TransactionControl txControl;

+	

+	@Inject

+	private BundleContext context;

+	

+	@Test

+	public void testResourceRevcovery() throws InterruptedException {

+		RecordingResource resource = new RecordingResource() {

+

+			@Override

+			public void commit(Xid arg0, boolean arg1) throws XAException {

+				super.commit(arg0, arg1);

+				throw new XAException(XAException.XAER_RMFAIL);

+			}

+			

+		};

+		

+		txControl.required(new Callable<Object>() {

+			@Override

+			public Object call() throws Exception {

+				TransactionContext context = txControl.getCurrentContext();

+				context.registerXAResource(new RecordingResource(), null);

+				context.registerXAResource(resource, "test");

+				return null;

+			}

+		});

+

+		

+		Interaction i = resource.getList().get(0);

+		

+		assertEquals(Action.STARTED, i.action);

+		

+		Xid id = i.xid;

+		

+		i = resource.getList().get(1);

+		

+		assertEquals(Action.END, i.action);

+		assertEquals(id, i.xid);

+

+		i = resource.getList().get(2);

+		

+		assertEquals(Action.PREPARED, i.action);

+		assertEquals(id, i.xid);

+

+		i = resource.getList().get(3);

+

+		assertEquals(Action.COMMITTED, i.action);

+		assertEquals(id, i.xid);

+		

+		assertEquals(4, resource.getList().size());

+		

+		CountDownLatch latch = new CountDownLatch(1);

+		

+		RecordingResource recovery = new RecordingResource() {

+			List<Xid> list = new ArrayList<>(Collections.singleton(id));

+

+			@Override

+			public void commit(Xid arg0, boolean arg1) throws XAException {

+				super.commit(arg0, arg1);

+				list.remove(arg0);

+				latch.countDown();

+			}

+

+			@Override

+			public void forget(Xid arg0) throws XAException {

+				super.forget(arg0);

+				list.remove(arg0);

+				latch.countDown();

+			}

+

+			@Override

+			public Xid[] recover(int arg0) throws XAException {

+				return list.toArray(new Xid[1]);

+			}

+

+			@Override

+			public void rollback(Xid arg0) throws XAException {

+				super.rollback(arg0);

+				list.remove(arg0);

+				latch.countDown();

+			}

+		};

+		

+		

+		

+		RecoverableXAResource r = new RecoverableXAResource() {

+			

+			@Override

+			public void releaseXAResource(XAResource xaRes) {

+				

+			}

+			

+			@Override

+			public XAResource getXAResource() throws Exception {

+				return recovery;

+			}

+			

+			@Override

+			public String getId() {

+				return "test";

+			}

+		};

+		

+		ServiceRegistration<?> reg = context.registerService(RecoverableXAResource.class, r, null);

+		

+		try {

+			

+			assertTrue(latch.await(30, TimeUnit.SECONDS));

+			

+			i = recovery.getList().get(0);

+			

+			assertEquals(Action.COMMITTED, i.action);

+			assertEquals(id, i.xid);

+			

+			assertEquals(1, recovery.getList().size());

+			

+		} finally {

+			reg.unregister();

+		}

+	}

+

+	@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.tx-control", "tx-control-service-xa").versionAsInProject(),

+				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(),

+				CoreOptions.frameworkProperty("org.apache.aries.tx.control.service.xa.recovery.log.enabled").value("true")

+

+//		 ,CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005")

+		);

+	}

+}

diff --git a/tx-control-services/tx-control-service-itests/src/test/java/org/apache/aries/tx/control/itests/service/XATransactionTest.java b/tx-control-services/tx-control-service-itests/src/test/java/org/apache/aries/tx/control/itests/service/XATransactionTest.java
new file mode 100644
index 0000000..29a3db4
--- /dev/null
+++ b/tx-control-services/tx-control-service-itests/src/test/java/org/apache/aries/tx/control/itests/service/XATransactionTest.java
@@ -0,0 +1,493 @@
+/*

+ * 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.service;

+

+import static org.junit.Assert.assertArrayEquals;

+import static org.junit.Assert.assertEquals;

+import static org.junit.Assert.assertNull;

+import static org.junit.Assert.assertTrue;

+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.systemProperty;

+import static org.ops4j.pax.exam.CoreOptions.when;

+

+import java.util.concurrent.Callable;

+

+import javax.inject.Inject;

+import javax.transaction.xa.Xid;

+

+import org.apache.aries.tx.control.itests.service.RecordingResource.Action;

+import org.apache.aries.tx.control.itests.service.RecordingResource.Interaction;

+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.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.osgi.service.transaction.control.TransactionContext;

+import org.osgi.service.transaction.control.TransactionControl;

+import org.osgi.service.transaction.control.TransactionRolledBackException;

+

+@RunWith(PaxExam.class)

+@ExamReactorStrategy(PerClass.class)

+public class XATransactionTest {

+

+	@Inject

+	@Filter("(osgi.xa.enabled=true)")

+	private TransactionControl txControl;

+

+	@Test

+	public void testXASupportAdvertised() {

+		txControl.required(new Callable<Object>() {

+			@Override

+			public Object call() throws Exception {

+				assertTrue(txControl.getCurrentContext().supportsXA());

+				return null;

+			}

+		});

+	}

+

+	@Test

+	public void testRegisterXAResource() {

+

+		RecordingResource resource = new RecordingResource();

+		

+		txControl.required(new Callable<Object>() {

+			@Override

+			public Object call() throws Exception {

+				TransactionContext context = txControl.getCurrentContext();

+				context.registerXAResource(resource, null);

+				return null;

+			}

+		});

+		

+		Interaction i = resource.getList().get(0);

+		

+		assertEquals(Action.STARTED, i.action);

+		

+		Xid id = i.xid;

+		

+		i = resource.getList().get(1);

+		

+		assertEquals(Action.END, i.action);

+		assertEquals(id, i.xid);

+

+		i = resource.getList().get(2);

+		

+		assertEquals(Action.COMMITTED_ONE_PHASE, i.action);

+		assertEquals(id, i.xid);

+		

+		assertEquals(3, resource.getList().size());

+	}

+

+	@Test

+	public void testRegisterXAResourceRollback() {

+		

+		RecordingResource resource = new RecordingResource();

+		

+		txControl.required(new Callable<Object>() {

+			@Override

+			public Object call() throws Exception {

+				TransactionContext context = txControl.getCurrentContext();

+				context.registerXAResource(resource, null);

+				context.setRollbackOnly();

+				return null;

+			}

+		});

+		

+		Interaction i = resource.getList().get(0);

+		

+		assertEquals(Action.STARTED, i.action);

+		

+		Xid id = i.xid;

+		

+		i = resource.getList().get(1);

+		

+		assertEquals(Action.END, i.action);

+		assertEquals(id, i.xid);

+		

+		i = resource.getList().get(2);

+		

+		assertEquals(Action.ROLLED_BACK, i.action);

+		assertEquals(id, i.xid);

+		

+		assertEquals(3, resource.getList().size());

+	}

+

+	@Test

+	public void testRegisterXAResourcesTwoPhase() {

+		

+		RecordingResource resourceA = new RecordingResource();

+		RecordingResource resourceB = new RecordingResource();

+		

+		txControl.required(new Callable<Object>() {

+			@Override

+			public Object call() throws Exception {

+				TransactionContext context = txControl.getCurrentContext();

+				context.registerXAResource(resourceA, null);

+				context.registerXAResource(resourceB, null);

+				return null;

+			}

+		});

+		

+		Interaction i = resourceA.getList().get(0);

+		

+		assertEquals(Action.STARTED, i.action);

+		

+		Xid idA = i.xid;

+		

+		i = resourceB.getList().get(0);

+		

+		assertEquals(Action.STARTED, i.action);

+

+		Xid idB = i.xid;

+		

+		assertArrayEquals(idA.getGlobalTransactionId(), idB.getGlobalTransactionId());

+		

+		i = resourceA.getList().get(1);

+		

+		assertEquals(Action.END, i.action);

+		assertEquals(idA, i.xid);

+		

+		i = resourceB.getList().get(1);

+		

+		assertEquals(Action.END, i.action);

+		assertEquals(idB, i.xid);

+		

+		i = resourceA.getList().get(2);

+		

+		assertEquals(Action.PREPARED, i.action);

+		assertEquals(idA, i.xid);

+

+		i = resourceB.getList().get(2);

+		

+		assertEquals(Action.PREPARED, i.action);

+		assertEquals(idB, i.xid);

+

+		i = resourceA.getList().get(3);

+		

+		assertEquals(Action.COMMITTED, i.action);

+		assertEquals(idA, i.xid);

+		

+		i = resourceB.getList().get(3);

+		

+		assertEquals(Action.COMMITTED, i.action);

+		assertEquals(idB, i.xid);

+		

+		

+		assertEquals(4, resourceA.getList().size());

+		assertEquals(4, resourceB.getList().size());

+	}

+

+	@Test

+	public void testRegisterXAResourcesTwoPhaseWithFirstFailure() {

+		

+		RecordingResource resourceA = new PoisonResource();

+		RecordingResource resourceB = new RecordingResource();

+		

+		try {

+			txControl.required(new Callable<Object>() {

+				@Override

+				public Object call() throws Exception {

+					TransactionContext context = txControl.getCurrentContext();

+					context.registerXAResource(resourceA, null);

+					context.registerXAResource(resourceB, null);

+					return null;

+				}

+			});

+			fail("Should roll back");

+		} catch (TransactionRolledBackException te) {

+			// Expected

+		}

+		

+		Interaction i = resourceA.getList().get(0);

+		

+		assertEquals(Action.STARTED, i.action);

+		

+		Xid idA = i.xid;

+		

+		i = resourceB.getList().get(0);

+		

+		assertEquals(Action.STARTED, i.action);

+		

+		Xid idB = i.xid;

+		

+		assertArrayEquals(idA.getGlobalTransactionId(), idB.getGlobalTransactionId());

+		

+		i = resourceA.getList().get(1);

+		

+		assertEquals(Action.END, i.action);

+		assertEquals(idA, i.xid);

+		

+		i = resourceB.getList().get(1);

+		

+		assertEquals(Action.END, i.action);

+		assertEquals(idB, i.xid);

+		

+		i = resourceA.getList().get(2);

+		

+		assertEquals(Action.PREPARED, i.action);

+		assertEquals(idA, i.xid);

+		

+		i = resourceB.getList().get(2);

+		

+		assertEquals(Action.ROLLED_BACK, i.action);

+		assertEquals(idB, i.xid);

+		

+		i = resourceA.getList().get(3);

+		

+		assertEquals(Action.ROLLED_BACK, i.action);

+		assertEquals(idA, i.xid);

+		

+		

+		assertEquals(4, resourceA.getList().size());

+		assertEquals(3, resourceB.getList().size());

+	}

+	

+	@Test

+	public void testRegisterXAResourcesTwoPhaseWithSecondFailure() {

+		

+		RecordingResource resourceA = new RecordingResource();

+		RecordingResource resourceB = new PoisonResource();

+		

+		try {

+			txControl.required(new Callable<Object>() {

+				@Override

+				public Object call() throws Exception {

+					TransactionContext context = txControl.getCurrentContext();

+					context.registerXAResource(resourceA, null);

+					context.registerXAResource(resourceB, null);

+					return null;

+				}

+			});

+		} catch (TransactionRolledBackException te) {

+			// Expected

+		}

+		

+		Interaction i = resourceA.getList().get(0);

+		

+		assertEquals(Action.STARTED, i.action);

+		

+		Xid idA = i.xid;

+		

+		i = resourceB.getList().get(0);

+		

+		assertEquals(Action.STARTED, i.action);

+		

+		Xid idB = i.xid;

+		

+		assertArrayEquals(idA.getGlobalTransactionId(), idB.getGlobalTransactionId());

+		

+		i = resourceA.getList().get(1);

+		

+		assertEquals(Action.END, i.action);

+		assertEquals(idA, i.xid);

+		

+		i = resourceB.getList().get(1);

+		

+		assertEquals(Action.END, i.action);

+		assertEquals(idB, i.xid);

+		

+		i = resourceA.getList().get(2);

+		

+		assertEquals(Action.PREPARED, i.action);

+		assertEquals(idA, i.xid);

+		

+		i = resourceB.getList().get(2);

+		

+		assertEquals(Action.PREPARED, i.action);

+		assertEquals(idB, i.xid);

+		

+		i = resourceA.getList().get(3);

+		

+		assertEquals(Action.ROLLED_BACK, i.action);

+		assertEquals(idA, i.xid);

+		

+		i = resourceB.getList().get(3);

+		

+		assertEquals(Action.ROLLED_BACK, i.action);

+		assertEquals(idB, i.xid);

+		

+		

+		assertEquals(4, resourceA.getList().size());

+		assertEquals(4, resourceB.getList().size());

+	}

+

+	@Test

+	public void testLastParticipantGambit() {

+		

+		RecordingResource resource = new RecordingResource();

+		

+		txControl.required(new Callable<Object>() {

+			@Override

+			public Object call() throws Exception {

+				TransactionContext context = txControl.getCurrentContext();

+				context.registerXAResource(resource, null);

+				context.registerLocalResource(resource);

+				return null;

+			}

+		});

+		

+		Interaction i = resource.getList().get(0);

+		

+		assertEquals(Action.STARTED, i.action);

+		

+		Xid id = i.xid;

+		

+		i = resource.getList().get(1);

+		

+		assertEquals(Action.END, i.action);

+		assertEquals(id, i.xid);

+		

+		i = resource.getList().get(2);

+		

+		assertEquals(Action.PREPARED, i.action);

+		assertEquals(id, i.xid);

+		

+		i = resource.getList().get(3);

+		

+		assertEquals(Action.LOCAL_COMMIT, i.action);

+		assertNull(i.xid);

+		

+		i = resource.getList().get(4);

+		

+		assertEquals(Action.COMMITTED, i.action);

+		assertEquals(id, i.xid);

+		

+		assertEquals(5, resource.getList().size());

+	}

+	

+	@Test

+	public void testLastParticipantGambitLocalFailure() {

+		

+		RecordingResource resource = new RecordingResource();

+		

+		try {

+			txControl.required(new Callable<Object>() {

+				@Override

+				public Object call() throws Exception {

+					TransactionContext context = txControl.getCurrentContext();

+					context.registerXAResource(resource, null);

+					context.registerLocalResource(new PoisonResource());

+					return null;

+				}

+			});

+			fail("Should roll back");

+		} catch (TransactionRolledBackException te) {

+			// Expected

+		}

+		

+		Interaction i = resource.getList().get(0);

+		

+		assertEquals(Action.STARTED, i.action);

+		

+		Xid id = i.xid;

+		

+		i = resource.getList().get(1);

+		

+		assertEquals(Action.END, i.action);

+		assertEquals(id, i.xid);

+		

+		i = resource.getList().get(2);

+		

+		assertEquals(Action.PREPARED, i.action);

+		assertEquals(id, i.xid);

+		

+		i = resource.getList().get(3);

+		

+		assertEquals(Action.ROLLED_BACK, i.action);

+		assertEquals(id, i.xid);

+		

+		assertEquals(4, resource.getList().size());

+	}

+

+	@Test

+	public void testLastParticipantGambitXAFailure() {

+		

+		RecordingResource xaResource = new PoisonResource();

+		RecordingResource localResource = new RecordingResource();

+		

+		try {

+			txControl.required(new Callable<Object>() {

+				@Override

+				public Object call() throws Exception {

+					TransactionContext context = txControl.getCurrentContext();

+					context.registerXAResource(xaResource, null);

+					context.registerLocalResource(localResource);

+					return null;

+				}

+			});

+			fail("Should roll back");

+		} catch (TransactionRolledBackException te) {

+			// Expected

+		}

+		

+		Interaction i = localResource.getList().get(0);

+		

+		assertEquals(Action.LOCAL_ROLLBACK, i.action);

+		assertNull(i.xid);

+		

+		i = xaResource.getList().get(0);

+		

+		assertEquals(Action.STARTED, i.action);

+		

+		Xid id = i.xid;

+		

+		i = xaResource.getList().get(1);

+		

+		assertEquals(Action.END, i.action);

+		assertEquals(id, i.xid);

+		

+		i = xaResource.getList().get(2);

+		

+		assertEquals(Action.PREPARED, i.action);

+		assertEquals(id, i.xid);

+		

+		i = xaResource.getList().get(3);

+		

+		assertEquals(Action.ROLLED_BACK, i.action);

+		assertEquals(id, i.xid);

+		

+		assertEquals(4, xaResource.getList().size());

+	}

+

+	@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.tx-control", "tx-control-service-xa").versionAsInProject(),

+				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()

+

+		// ,CoreOptions.vmOption("-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005")

+		);

+	}

+}