aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gge...@apache.org
Subject svn commit: r1702967 - /aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/blueprint/aries/itest/BlueprintTest.java
Date Mon, 14 Sep 2015 15:06:41 GMT
Author: ggerla
Date: Mon Sep 14 15:06:41 2015
New Revision: 1702967

URL: http://svn.apache.org/r1702967
Log:
Added test to verify that with JTA transaction and XA DataSource we are in real transactional
environment

Modified:
    aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/blueprint/aries/itest/BlueprintTest.java

Modified: aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/blueprint/aries/itest/BlueprintTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/blueprint/aries/itest/BlueprintTest.java?rev=1702967&r1=1702966&r2=1702967&view=diff
==============================================================================
--- aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/blueprint/aries/itest/BlueprintTest.java
(original)
+++ aries/trunk/jpa/itests/jpa-container-itest/src/test/java/org/apache/aries/jpa/blueprint/aries/itest/BlueprintTest.java
Mon Sep 14 15:06:41 2015
@@ -25,6 +25,9 @@ import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 
 import javax.inject.Inject;
+import javax.transaction.NotSupportedException;
+import javax.transaction.SystemException;
+import javax.transaction.UserTransaction;
 
 import org.apache.aries.jpa.container.itest.entities.Car;
 import org.apache.aries.jpa.container.itest.entities.CarService;
@@ -40,6 +43,9 @@ public class BlueprintTest extends Abstr
     @Inject
     Coordinator coordinator;
     
+    @Inject
+    UserTransaction ut;
+    
     @Test
     public void testCoordination() {
         assertNoCoordination();
@@ -91,6 +97,11 @@ public class BlueprintTest extends Abstr
     }
     
     @Test
+    public void testRealTransactional() throws Exception {
+        carRealTransactionalLifecycle(getCarService("emJtaAnn"));
+    }
+    
+    @Test
     public void testCoordinationLifecycle() throws InterruptedException, ExecutionException
{
         CarService carService = getCarService("em");
         assertNoCars(carService);
@@ -122,6 +133,17 @@ public class BlueprintTest extends Abstr
         assertBlueCar(carService.getCar(BLUE_CAR_PLATE));
         carService.deleteCar(BLUE_CAR_PLATE);
     }
+    
+    private void carRealTransactionalLifecycle(CarService carService) throws IllegalStateException,
SystemException, NotSupportedException {
+        assertNoCoordination();
+        if (carService.getCar(BLACK_CAR_PLATE) != null) {
+            carService.deleteCar(BLUE_CAR_PLATE);
+        }
+        ut.begin();
+        carService.addCar(createBlueCar());
+        ut.rollback();
+        Assert.assertNull(carService.getCar(BLUE_CAR_PLATE));
+    }
 
     private void assertNoCoordination() {
         Coordination coord = coordinator.peek();



Mime
View raw message