Permalink
Browse files
Merge pull request #12197 from ochaloup/WFLY-11917-narayana-to-5.9.5
[WFLY-11917] Narayana component upgrade to 5.9.5
- Loading branch information
Showing
with
529 additions
and 34 deletions.
- +1 −1 pom.xml
- +0 −2 ...java/org/jboss/as/test/integration/ejb/timerservice/tx/timeout/TxTimeoutTimerServiceTestCase.java
- +0 −4 .../org/jboss/as/test/integration/ejb/transaction/cmt/timeout/DefaultTransactionTimeoutTestCase.java
- +0 −4 ...st/java/org/jboss/as/test/integration/ejb/transaction/cmt/timeout/TransactionTimeoutTestCase.java
- +1 −1 ...est/java/org/jboss/as/test/integration/management/deploy/runtime/TimerEJBRuntimeNameTestCase.java
- +0 −3 ...va/org/jboss/as/test/integration/management/deploy/runtime/ejb/singleton/timer/PointLessBean.java
- +40 −19 testsuite/integration/rts/src/test/java/org/wildfly/test/extension/rts/InboundBridgeTestCase.java
- +6 −0 testsuite/integration/xts/pom.xml
- +140 −0 ...suite/integration/xts/src/test/java/org/jboss/as/test/txbridge/fromjta/BridgeFromJTATestCase.java
- +45 −0 testsuite/integration/xts/src/test/java/org/jboss/as/test/txbridge/fromjta/FirstClient.java
- +68 −0 .../integration/xts/src/test/java/org/jboss/as/test/txbridge/fromjta/service/FirstCounterEntity.java
- +56 −0 ...uite/integration/xts/src/test/java/org/jboss/as/test/txbridge/fromjta/service/FirstServiceAT.java
- +88 −0 .../integration/xts/src/test/java/org/jboss/as/test/txbridge/fromjta/service/FirstServiceATImpl.java
- +84 −0 ...tegration/xts/src/test/java/org/jboss/as/test/txbridge/fromjta/service/FirstServiceATService.java
| @@ -0,0 +1,140 @@ | ||
| /* | ||
| * JBoss, Home of Professional Open Source. | ||
| * Copyright 2018, Red Hat, Inc., and individual contributors | ||
| * as indicated by the @author tags. See the copyright.txt file in the | ||
| * distribution for a full listing of individual contributors. | ||
| * | ||
| * This is free software; you can redistribute it and/or modify it | ||
| * under the terms of the GNU Lesser General Public License as | ||
| * published by the Free Software Foundation; either version 2.1 of | ||
| * the License, or (at your option) any later version. | ||
| * | ||
| * This software is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public | ||
| * License along with this software; if not, write to the Free | ||
| * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
| * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
| */ | ||
|
|
||
| package org.jboss.as.test.txbridge.fromjta; | ||
|
|
||
| import javax.naming.InitialContext; | ||
| import javax.transaction.UserTransaction; | ||
|
|
||
| import org.jboss.arquillian.container.test.api.Deployment; | ||
| import org.jboss.arquillian.junit.Arquillian; | ||
| import org.jboss.as.test.txbridge.fromjta.service.FirstServiceAT; | ||
| import org.jboss.logging.Logger; | ||
| import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
| import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
| import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
| import org.junit.After; | ||
| import org.junit.Assert; | ||
| import org.junit.Before; | ||
| import org.junit.Test; | ||
| import org.junit.runner.RunWith; | ||
|
|
||
| /** | ||
| * <p> | ||
| * Simple set of starting JTA transaction and getting it bridged to the XTS-AT. | ||
| * <p> | ||
| * Test ported from https://github.com/jbosstm/quickstart repository. | ||
| */ | ||
| @RunWith(Arquillian.class) | ||
| public class BridgeFromJTATestCase { | ||
| private static final Logger log = Logger.getLogger(BridgeFromJTATestCase.class); | ||
|
|
||
| private static final String DEPLOYMENT = "fromjta-bridge"; | ||
| private static final String ManifestMF = | ||
| "Manifest-Version: 1.0\nDependencies: org.jboss.xts\n"; | ||
| private static final String persistentXml = | ||
| "<persistence>\n" + | ||
| " <persistence-unit name=\"first\">\n" + | ||
| " <jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>\n" + | ||
| " <properties>\n" + | ||
| " <property name=\"hibernate.hbm2ddl.auto\" value=\"create-drop\"/>\n" + | ||
| " </properties>\n" + | ||
| " </persistence-unit>\n" + | ||
| "</persistence>"; | ||
|
|
||
| private UserTransaction ut; | ||
| private FirstServiceAT firstClient; | ||
|
|
||
| @Deployment(name = DEPLOYMENT) | ||
| public static JavaArchive createTestArchive1() { | ||
| JavaArchive archive = ShrinkWrap.create(JavaArchive.class, DEPLOYMENT + ".jar") | ||
| .addPackages(true, BridgeFromJTATestCase.class.getPackage()) | ||
| .addAsManifestResource(new StringAsset(ManifestMF), "MANIFEST.MF") | ||
| .addAsManifestResource(new StringAsset(persistentXml), "persistence.xml"); | ||
| return archive; | ||
| } | ||
|
|
||
| @Before | ||
| public void setupTest() throws Exception { | ||
| ut = (UserTransaction) new InitialContext().lookup("java:comp/UserTransaction"); | ||
| firstClient = FirstClient.newInstance(); | ||
| } | ||
|
|
||
| @After | ||
| public void teardownTest() throws Exception { | ||
| tryRollback(ut); | ||
| try { | ||
| ut.begin(); | ||
| firstClient.resetCounter(); | ||
| ut.commit(); | ||
| } finally { | ||
| tryRollback(ut); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Test starts the JTA transaction while calling the 'incrementCounter' on the stub. | ||
| * Expecting the interceptor bridges from JTA to WS-AT. | ||
| * The commit of the JTA transaction should cause the commit of the WS-AT transaction as well. | ||
| */ | ||
| @Test | ||
| public void testCommit() throws Exception { | ||
| ut.begin(); | ||
| firstClient.incrementCounter(1); | ||
| ut.commit(); | ||
|
|
||
| // second JTA checks if the counter was really incremented | ||
| ut.begin(); | ||
| int counter = firstClient.getCounter(); | ||
| ut.commit(); | ||
|
|
||
| Assert.assertEquals("Bridged JTA transaction should commit the WS-AT and the counter is expected to be incremented", | ||
| 1, counter); | ||
| } | ||
|
|
||
| /** | ||
| * Test starts the JTA transaction while calling the 'incrementCounter' on the stub. | ||
| * Expecting the interceptor bridges from JTA to WS-AT. | ||
| * The rollback of the JTA transaction should cause the rollback of the WS-AT transaction as well. | ||
| */ | ||
| @Test | ||
| public void testRollback() throws Exception { | ||
| ut.begin(); | ||
| firstClient.incrementCounter(1); | ||
| ut.rollback(); | ||
|
|
||
| // second JTA checks if the counter was not incremented | ||
| ut.begin(); | ||
| int counter = firstClient.getCounter(); | ||
| ut.commit(); | ||
|
|
||
| Assert.assertEquals("Asserting that the counters were *not* incremented successfully", 0, counter); | ||
| } | ||
|
|
||
| private void tryRollback(UserTransaction ut) { | ||
| try { | ||
| ut.rollback(); | ||
| } catch (Throwable th2) { | ||
| log.trace("Cannot rollback transaction " + ut, th2); | ||
| } | ||
| } | ||
| } |
| @@ -0,0 +1,45 @@ | ||
| /* | ||
| * JBoss, Home of Professional Open Source. | ||
| * Copyright 2018, Red Hat, Inc., and individual contributors | ||
| * as indicated by the @author tags. See the copyright.txt file in the | ||
| * distribution for a full listing of individual contributors. | ||
| * | ||
| * This is free software; you can redistribute it and/or modify it | ||
| * under the terms of the GNU Lesser General Public License as | ||
| * published by the Free Software Foundation; either version 2.1 of | ||
| * the License, or (at your option) any later version. | ||
| * | ||
| * This software is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| * Lesser General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Lesser General Public | ||
| * License along with this software; if not, write to the Free | ||
| * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
| * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
| */ | ||
|
|
||
| package org.jboss.as.test.txbridge.fromjta; | ||
|
|
||
| import javax.xml.namespace.QName; | ||
| import javax.xml.ws.Service; | ||
|
|
||
| import org.jboss.as.test.txbridge.fromjta.service.FirstServiceAT; | ||
|
|
||
| import java.net.URL; | ||
|
|
||
| public class FirstClient { | ||
|
|
||
| public static FirstServiceAT newInstance() throws Exception { | ||
| URL wsdlLocation = new URL("http://localhost:8080/test/FirstServiceATService/FirstServiceAT?wsdl"); | ||
| QName serviceName = new QName("http://www.jboss.com/jbossas/test/txbridge/fromjta/first", "FirstServiceATService"); | ||
| QName portName = new QName("http://www.jboss.com/jbossas/test/txbridge/fromjta/first", "FirstServiceAT"); | ||
|
|
||
| Service service = Service.create(wsdlLocation, serviceName); | ||
| FirstServiceAT client = service.getPort(portName, FirstServiceAT.class); | ||
|
|
||
| return client; | ||
| } | ||
| } | ||
|
|
Oops, something went wrong.