Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
base repository: wildfly/wildfly
Choose a Base Repository
wildfly/wildfly
2002simon01/jboss-as
ALRubinger/wildfly
ErikWRasmussen/jboss-as
KurtStam/jboss-as
Lerm/jboss-as
LinuxEvangelist/jboss-as
Mogztter/wildfly
OndraZizka/jboss-as
PayU-EMEA/jboss-as
aaronwalker/jboss-as
agibsonccc/jboss-as
akalachm/jboss-as
alesj/jboss-as
alns/jboss-as
aloubyansky/wildfly
aminorex/jboss-as
andersnorgaard/jboss-as
andredemathe/jboss-as
andytaylor/wildfly
aprilhu0/jboss-as
ashields/jboss-as
aslakknutsen/jboss-as
asoldano/wildfly
awirayaksa/jboss-as
bershath/jboss-as
bgeorges/jboss-as
blue61/jboss-as
bosschaert/jboss-as
bstansberry/wildfly
btison/jboss-as
cbue/jboss-as
charleswmiller/jboss-as
chikin/jboss-as
chriskriel/jboss-as
coberle/jboss-as
colmsean/jboss-as
ctomc/wildfly
dandreadis/wildfly
darranl/wildfly
dcaillia/jboss-as
denuno/jboss-as
deruelle/jboss-as
dhollandAtWex/dh-old-forks-jboss-as
dmlloyd/wildfly
dobozysaurus/jboss-as
dpospisil/wildfly
edbean/jboss-as
emannuel/jboss-as
emerile1/jboss-as
emuckenhuber/wildfly
esantana/jboss-as
fbricon/jboss-as
fedora-jboss-as/wildfly
fei-yin/jboss-as
fharms/wildfly
fregaham/jboss-as
fxlambda-twickly5/wildfly
garcimouche/jboss-as
goldmann/jboss-as
gonne/jboss-as
gvagenas/jboss-as
hamanju/jboss-as
hamming229/jboss-as
heiko-braun/wildfly
hgkmiracle/jboss-as
hunter-thom/jboss-as
ikaro/jboss-as
istudens/wildfly
jaikiran/wildfly
jamezp/wildfly
janpiel/jboss-as
java-coder/jboss-as
jayhowell/jboss-as
jbossejb3/jboss-as
jdmr/jboss-as
jdpgrailsdev/jboss-as
jeenapeter/jboss-as
jeffzhang/jboss-as
jeremiahshirk/jboss-as
jiwils/jboss-as
jlindesmith/jboss-as
jmartisk/wildfly
jocstar/jboss-as
joseph2000/jboss-as
jrwhitley/jboss-as
jswordfish/jboss-as
jtoerber/jboss-as
julianzhu/jboss-as
jwulf/jboss-as
kabir/wildfly
kbys/jboss-as
koledzhikov/jboss-as
kpiwko/wildfly
kylape/wildfly
ldevrie/jboss-as
lingling788/jboss-as
liweinan/jboss-as
luksa/wildfly
lydonchandra/jboss-as
maasvdberg/wildfly
madhumita/jboss-as
madhumita12/jboss-as
maerqiang/jboss-as
maeste/jboss-as
mageshbk/jboss-as
markmc/jboss-as
markyour/jboss-as
maschmid/jboss-as
matejonnet/jboss-as
mathieuancelin/jboss-as
mathieufortin01/jboss-as
mattdrees/jboss-as
maxandersen/jboss-as
maximilienw/jboss-as
mbogoevici/jboss-as
mbrasier/jboss-as
mdemerath/jboss-as
mgencur/jboss-as
michaelschuetz/jboss-as
miclark/jboss-as
migue/wildfly
mikebrock/jboss-as
mkiman/jboss-as
mlinhard/jboss-as
mmoyses/jboss-as
mojavelinux/jboss-as
mschwartzman/jboss-as
mstruk/jboss-as
nikkack/jboss-as
nookala/jboss-as
npfr/jboss-as
nscavell/jboss-as
ochaloup/wildfly
patmcdonough/jboss-as
pbielicki/jboss-as
pentarou/jboss-as
pepite/jboss-as
petbac/jboss-as
pferraro/wildfly
pmf8/jboss-as
pmuir/jboss-as
porobd/jboss-as
prabugp/jboss-as
pragnesh/jboss-as
prasad-deshpande/jboss-as
prcg66/jboss-as
pskopek/wildfly
pslegr/jboss-as
rachmatowicz/wildfly
rachmatowicz2/jboss-as
randythomas/jboss-as
rhusar/wildfly
richmidwinter/jboss-as
richsharples/jboss-as
ringerc/jboss-as
robertpanzer/jboss-as
robstryker/jboss-as
rsvoboda/wildfly
rzimmermann/jboss-as
sacdroid/jboss-as
samuelo/jboss-as
sasgww/jboss-as
scottmarlow/wildfly
sebersole/jboss-as
seeburger-ag/jboss-as
seko2000/jboss-as
sgilda/wildfly
shadangi/jboss-as
shuawest/jboss-as
sjancke/jboss-as
skoussou/jboss-as
smcgowan/wildfly
spreadline/jboss-as
ssilvert/wildfly
starksm64/jboss-as
starksmjboss/jboss-as
stliu/jboss-as
stuartwdouglas/wildfly
sujaybawaskar/jboss-as
tdiesler/wildfly
tfennelly/jboss-as
thammoud/jboss-as
thanhvc/jboss-as
thauser/jboss-as
thomasnymand/jboss-as
thunderlei/jboss-as
tomathome/jboss-as
tomwells/jboss-as
tristantarrant/wildfly
tyasuma/jboss-as
undertow-io/jboss-as
vladimirralev/jboss-as
vmariusvv/jboss-as
vratsel/jboss-as
weld/wildfly
wfink/wildfly
wolfc/jboss-as
zhigunovs/jboss-as
zhleonix/jboss-as
Nothing to show
base: 06ca2a1
head repository: wildfly/wildfly
Choose a Head Repository
wildfly/wildfly
2002simon01/jboss-as
ALRubinger/wildfly
ErikWRasmussen/jboss-as
KurtStam/jboss-as
Lerm/jboss-as
LinuxEvangelist/jboss-as
Mogztter/wildfly
OndraZizka/jboss-as
PayU-EMEA/jboss-as
aaronwalker/jboss-as
agibsonccc/jboss-as
akalachm/jboss-as
alesj/jboss-as
alns/jboss-as
aloubyansky/wildfly
aminorex/jboss-as
andersnorgaard/jboss-as
andredemathe/jboss-as
andytaylor/wildfly
aprilhu0/jboss-as
ashields/jboss-as
aslakknutsen/jboss-as
asoldano/wildfly
awirayaksa/jboss-as
bershath/jboss-as
bgeorges/jboss-as
blue61/jboss-as
bosschaert/jboss-as
bstansberry/wildfly
btison/jboss-as
cbue/jboss-as
charleswmiller/jboss-as
chikin/jboss-as
chriskriel/jboss-as
coberle/jboss-as
colmsean/jboss-as
ctomc/wildfly
dandreadis/wildfly
darranl/wildfly
dcaillia/jboss-as
denuno/jboss-as
deruelle/jboss-as
dhollandAtWex/dh-old-forks-jboss-as
dmlloyd/wildfly
dobozysaurus/jboss-as
dpospisil/wildfly
edbean/jboss-as
emannuel/jboss-as
emerile1/jboss-as
emuckenhuber/wildfly
esantana/jboss-as
fbricon/jboss-as
fedora-jboss-as/wildfly
fei-yin/jboss-as
fharms/wildfly
fregaham/jboss-as
fxlambda-twickly5/wildfly
garcimouche/jboss-as
goldmann/jboss-as
gonne/jboss-as
gvagenas/jboss-as
hamanju/jboss-as
hamming229/jboss-as
heiko-braun/wildfly
hgkmiracle/jboss-as
hunter-thom/jboss-as
ikaro/jboss-as
istudens/wildfly
jaikiran/wildfly
jamezp/wildfly
janpiel/jboss-as
java-coder/jboss-as
jayhowell/jboss-as
jbossejb3/jboss-as
jdmr/jboss-as
jdpgrailsdev/jboss-as
jeenapeter/jboss-as
jeffzhang/jboss-as
jeremiahshirk/jboss-as
jiwils/jboss-as
jlindesmith/jboss-as
jmartisk/wildfly
jocstar/jboss-as
joseph2000/jboss-as
jrwhitley/jboss-as
jswordfish/jboss-as
jtoerber/jboss-as
julianzhu/jboss-as
jwulf/jboss-as
kabir/wildfly
kbys/jboss-as
koledzhikov/jboss-as
kpiwko/wildfly
kylape/wildfly
ldevrie/jboss-as
lingling788/jboss-as
liweinan/jboss-as
luksa/wildfly
lydonchandra/jboss-as
maasvdberg/wildfly
madhumita/jboss-as
madhumita12/jboss-as
maerqiang/jboss-as
maeste/jboss-as
mageshbk/jboss-as
markmc/jboss-as
markyour/jboss-as
maschmid/jboss-as
matejonnet/jboss-as
mathieuancelin/jboss-as
mathieufortin01/jboss-as
mattdrees/jboss-as
maxandersen/jboss-as
maximilienw/jboss-as
mbogoevici/jboss-as
mbrasier/jboss-as
mdemerath/jboss-as
mgencur/jboss-as
michaelschuetz/jboss-as
miclark/jboss-as
migue/wildfly
mikebrock/jboss-as
mkiman/jboss-as
mlinhard/jboss-as
mmoyses/jboss-as
mojavelinux/jboss-as
mschwartzman/jboss-as
mstruk/jboss-as
nikkack/jboss-as
nookala/jboss-as
npfr/jboss-as
nscavell/jboss-as
ochaloup/wildfly
patmcdonough/jboss-as
pbielicki/jboss-as
pentarou/jboss-as
pepite/jboss-as
petbac/jboss-as
pferraro/wildfly
pmf8/jboss-as
pmuir/jboss-as
porobd/jboss-as
prabugp/jboss-as
pragnesh/jboss-as
prasad-deshpande/jboss-as
prcg66/jboss-as
pskopek/wildfly
pslegr/jboss-as
rachmatowicz/wildfly
rachmatowicz2/jboss-as
randythomas/jboss-as
rhusar/wildfly
richmidwinter/jboss-as
richsharples/jboss-as
ringerc/jboss-as
robertpanzer/jboss-as
robstryker/jboss-as
rsvoboda/wildfly
rzimmermann/jboss-as
sacdroid/jboss-as
samuelo/jboss-as
sasgww/jboss-as
scottmarlow/wildfly
sebersole/jboss-as
seeburger-ag/jboss-as
seko2000/jboss-as
sgilda/wildfly
shadangi/jboss-as
shuawest/jboss-as
sjancke/jboss-as
skoussou/jboss-as
smcgowan/wildfly
spreadline/jboss-as
ssilvert/wildfly
starksm64/jboss-as
starksmjboss/jboss-as
stliu/jboss-as
stuartwdouglas/wildfly
sujaybawaskar/jboss-as
tdiesler/wildfly
tfennelly/jboss-as
thammoud/jboss-as
thanhvc/jboss-as
thauser/jboss-as
thomasnymand/jboss-as
thunderlei/jboss-as
tomathome/jboss-as
tomwells/jboss-as
tristantarrant/wildfly
tyasuma/jboss-as
undertow-io/jboss-as
vladimirralev/jboss-as
vmariusvv/jboss-as
vratsel/jboss-as
weld/wildfly
wfink/wildfly
wolfc/jboss-as
zhigunovs/jboss-as
zhleonix/jboss-as
Nothing to show
compare: 12b419e
  • 5 commits
  • 14 files changed
  • 0 commit comments
  • 2 contributors
Commits on Apr 01, 2019
it happens to have issues to inject the Narayana CDI interceptor when
the tests forces using the internal org.jboss.jts module.
This is not needed as we use the WFTC project now and we don't need
to use the Narayana classes directly in the tests.
As Narayana CDI extension is not used then the CDI was not loaded
and happens the CDI was not capable to find it

[ERROR] org.jboss.as.test.integration.ejb.transaction.cmt.timeout.TransactionTimeoutTestCase  Time elapsed: 0.175 s  <<< ERROR!
org.jboss.arquillian.container.spi.client.container.DeploymentException:
Cannot deploy test-ejb-cmt-timeout.jar: {"WFLYCTL0062: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-1" => {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"test-ejb-cmt-timeout.jar\".WeldStartService" => "Failed to start service
    Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type TransactionExtension with qualifiers @default
  at injection point [BackedAnnotatedField] @Inject private com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.extension
  at com.arjuna.ats.jta.cdi.transactional.TransactionalInterceptorBase.extension(TransactionalInterceptorBase.java:0)
"}}}}
…ges as now there is setTimeout called up to the start/end/commit
Commits on Apr 04, 2019
[WFLY-11917] Narayana component upgrade to 5.9.5
@@ -326,7 +326,7 @@
<version.org.jboss.logmanager.commons-logging-jboss-logmanager>1.0.3.Final</version.org.jboss.logmanager.commons-logging-jboss-logmanager>
<version.org.jboss.metadata>13.0.0.Final</version.org.jboss.metadata>
<version.org.jboss.mod_cluster>1.4.0.Final</version.org.jboss.mod_cluster>
<version.org.jboss.narayana>5.9.3.Final</version.org.jboss.narayana>
<version.org.jboss.narayana>5.9.5.Final</version.org.jboss.narayana>
<version.org.jboss.openjdk-orb>8.1.2.Final</version.org.jboss.openjdk-orb>
<version.org.jboss.resteasy>3.6.3.Final</version.org.jboss.resteasy>
<version.org.jboss.seam.int>7.0.0.GA</version.org.jboss.seam.int>
@@ -28,7 +28,6 @@
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Assert;
import org.junit.Test;
@@ -46,7 +45,6 @@
public static Archive<?> deploy() {
JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "Jar.jar");
jar.addPackage(TxTimeoutTimerServiceTestCase.class.getPackage());
jar.addAsManifestResource(new StringAsset("Dependencies: org.jboss.jts \n"), "MANIFEST.MF");
return jar;
}

@@ -25,7 +25,6 @@
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -42,9 +41,6 @@
@Deployment
public static Archive<?> createDeployment() {
final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "test-ejb-cmt-timeout.jar");
// a manifest must have a \n at the end or else it'll not be properly process
// here we hack one in place
jar.addAsManifestResource(new StringAsset("Dependencies: org.jboss.jts \n"), "MANIFEST.MF");
jar.addClass(BeanWithTimeoutValue.class);
jar.addClass(TimeoutRemoteView.class);
jar.addClass(TimeoutLocalView.class);
@@ -27,7 +27,6 @@
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Assert;
import org.junit.Test;
@@ -41,9 +40,6 @@
@Deployment
public static Archive<?> createDeployment() {
final JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "test-ejb-cmt-timeout.jar");
// a manifest must have a \n at the end or else it'll not be properly process
// here we hack one in place
jar.addAsManifestResource(new StringAsset("Dependencies: org.jboss.jts \n"), "MANIFEST.MF");
jar.addClass(BeanWithTimeoutValue.class);
jar.addClass(TimeoutRemoteView.class);
jar.addClass(TimeoutLocalView.class);
@@ -36,7 +36,7 @@
private static final Logger log = Logger.getLogger(TimerEJBRuntimeNameTestCase.class);
private static final String EJB_TYPE = EJBManagementUtil.SINGLETON;
private static final Package BEAN_PACKAGE = PointLessBean.class.getPackage();
private static final Class BEAN_CLASS = PointlessInterface.class;
private static final Class<?> BEAN_CLASS = PointlessInterface.class;
private static final String BEAN_NAME = "POINT";

private static final String RT_MODULE_NAME = "nooma-nooma6-" + EJB_TYPE;
@@ -21,7 +21,6 @@
*/
package org.jboss.as.test.integration.management.deploy.runtime.ejb.singleton.timer;

import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import javax.ejb.Singleton;
import javax.ejb.Timeout;
@@ -35,8 +34,6 @@
@Singleton(name = "POINT")
public class PointLessBean implements PointlessInterface {

private static final int WAIT_TIME = 1;
private static final TimeUnit WAIT_UNIT = TimeUnit.SECONDS;
private static final TimerConfig TIMER_CONFIG = new TimerConfig("Eye Candy", true);

private int count = 0;
@@ -26,6 +26,7 @@
import javax.ws.rs.core.Response;

import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
@@ -86,11 +87,11 @@ public void testCommit() throws Exception {

final JSONArray jsonArray = getInboundBridgeResourceInvocations();

Assert.assertEquals(4, jsonArray.length());
Assert.assertEquals("LoggingXAResource.start", jsonArray.get(0));
Assert.assertEquals("LoggingXAResource.end", jsonArray.get(1));
Assert.assertEquals("LoggingXAResource.prepare", jsonArray.get(2));
Assert.assertEquals("LoggingXAResource.commit", jsonArray.get(3));
assertJsonArray(jsonArray, "LoggingXAResource.start", 1);
assertJsonArray(jsonArray, "LoggingXAResource.end", 1);
assertJsonArray(jsonArray, "LoggingXAResource.prepare", 1);
assertJsonArray(jsonArray, "LoggingXAResource.commit", 1);
assertJsonArray(jsonArray, "LoggingXAResource.rollback", 0);
}

@Test
@@ -101,10 +102,11 @@ public void testRollback() throws Exception {

JSONArray jsonArray = getInboundBridgeResourceInvocations();

Assert.assertEquals(3, jsonArray.length());
Assert.assertEquals("LoggingXAResource.start", jsonArray.get(0));
Assert.assertEquals("LoggingXAResource.end", jsonArray.get(1));
Assert.assertEquals("LoggingXAResource.rollback", jsonArray.get(2));
assertJsonArray(jsonArray, "LoggingXAResource.start", 1);
assertJsonArray(jsonArray, "LoggingXAResource.end", 1);
assertJsonArray(jsonArray, "LoggingXAResource.prepare", 0);
assertJsonArray(jsonArray, "LoggingXAResource.commit", 0);
assertJsonArray(jsonArray, "LoggingXAResource.rollback", 1);
}

@Test
@@ -123,12 +125,11 @@ public void testCommitWithTwoParticipants() throws Exception {
Assert.assertEquals("LoggingRestATResource.terminateParticipant(" + TxStatusMediaType.TX_COMMITTED + ")",
participantResourceInvocations.get(1));

Assert.assertEquals(4, xaResourceInvocations.length());
Assert.assertEquals("LoggingXAResource.start", xaResourceInvocations.get(0));
Assert.assertEquals("LoggingXAResource.end", xaResourceInvocations.get(1));
Assert.assertEquals("LoggingXAResource.prepare", xaResourceInvocations.get(2));
Assert.assertEquals("LoggingXAResource.commit", xaResourceInvocations.get(3));

assertJsonArray(xaResourceInvocations, "LoggingXAResource.start", 1);
assertJsonArray(xaResourceInvocations, "LoggingXAResource.end", 1);
assertJsonArray(xaResourceInvocations, "LoggingXAResource.prepare", 1);
assertJsonArray(xaResourceInvocations, "LoggingXAResource.commit", 1);
assertJsonArray(xaResourceInvocations, "LoggingXAResource.rollback", 0);
}

@Test
@@ -145,10 +146,11 @@ public void testRollbackWithTwoParticipants() throws Exception {
Assert.assertEquals("LoggingRestATResource.terminateParticipant(" + TxStatusMediaType.TX_ROLLEDBACK + ")",
participantResourceInvocations.get(0));

Assert.assertEquals(3, xaResourceInvocations.length());
Assert.assertEquals("LoggingXAResource.start", xaResourceInvocations.get(0));
Assert.assertEquals("LoggingXAResource.end", xaResourceInvocations.get(1));
Assert.assertEquals("LoggingXAResource.rollback", xaResourceInvocations.get(2));
assertJsonArray(xaResourceInvocations, "LoggingXAResource.start", 1);
assertJsonArray(xaResourceInvocations, "LoggingXAResource.end", 1);
assertJsonArray(xaResourceInvocations, "LoggingXAResource.prepare", 0);
assertJsonArray(xaResourceInvocations, "LoggingXAResource.commit", 0);
assertJsonArray(xaResourceInvocations, "LoggingXAResource.rollback", 1);
}

protected String getBaseUrl() {
@@ -192,4 +194,23 @@ private JSONArray getLoggingRestATParticipantInvocations() throws Exception {
return jsonArray;
}

/**
* Checking if the parameter <code>recordToAssert</code>
* is placed exactly once in the {@link JSONArray}.
*/
private void assertJsonArray(JSONArray invocationsJSONArray, String recordToAssert, int expectedRecordFoundCount) throws JSONException {
if(recordToAssert == null) throw new NullPointerException("recordToAssert");
int recordFoundCount = 0;
for(int i = 0; i < invocationsJSONArray.length(); i++) {
if(recordToAssert.equals(invocationsJSONArray.get(i))) {
recordFoundCount++;
}
}
if (recordFoundCount != expectedRecordFoundCount) {
Assert.fail("Invocation result returned as a JSON array '" + invocationsJSONArray + "' "
+ "expected to contain the record '" + recordToAssert + "' " + expectedRecordFoundCount + " times "
+ "but the record was " + recordFoundCount + " times in the array");
}
}

}
@@ -83,6 +83,12 @@
<artifactId>jboss-jaxws-api_2.3_spec</artifactId>
<scope>test</scope>
</dependency>
<!-- ExampleDS used in tests -->
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
@@ -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;
}
}

No commit comments for this range

You can’t perform that action at this time.