Return-Path: X-Original-To: apmail-aries-commits-archive@www.apache.org Delivered-To: apmail-aries-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 52CDC1016B for ; Mon, 14 Sep 2015 15:06:42 +0000 (UTC) Received: (qmail 91158 invoked by uid 500); 14 Sep 2015 15:06:42 -0000 Delivered-To: apmail-aries-commits-archive@aries.apache.org Received: (qmail 91099 invoked by uid 500); 14 Sep 2015 15:06:42 -0000 Mailing-List: contact commits-help@aries.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@aries.apache.org Delivered-To: mailing list commits@aries.apache.org Received: (qmail 91088 invoked by uid 99); 14 Sep 2015 15:06:42 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Sep 2015 15:06:42 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 08D63AC0111 for ; Mon, 14 Sep 2015 15:06:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@aries.apache.org From: ggerla@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150914150642.08D63AC0111@hades.apache.org> 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();