Search in sources :

Example 1 with TransactionalService

use of org.jboss.as.test.xts.annotation.service.TransactionalService in project wildfly by wildfly.

the class TransactionalClient method newInstance.

public static TransactionalService newInstance(final String deploymentUrl) throws MalformedURLException {
    LOG.debug("TransactionalClient.newInstance(deploymentUrl = " + deploymentUrl + ")");
    final URL wsdlLocation = new URL(deploymentUrl + "/" + NAME + "?wsdl");
    LOG.debug("wsdlLocation for service: " + wsdlLocation);
    final QName serviceName = new QName(TARGET_NAMESPACE, SERVICE_NAME);
    final QName portName = new QName(TARGET_NAMESPACE, PORT_NAME);
    final Service service = Service.create(wsdlLocation, serviceName);
    final TransactionalService transactionalService = service.getPort(portName, TransactionalService.class);
    return transactionalService;
}
Also used : QName(javax.xml.namespace.QName) TransactionalService(org.jboss.as.test.xts.annotation.service.TransactionalService) TransactionalService(org.jboss.as.test.xts.annotation.service.TransactionalService) Service(javax.xml.ws.Service) URL(java.net.URL)

Example 2 with TransactionalService

use of org.jboss.as.test.xts.annotation.service.TransactionalService in project wildfly by wildfly.

the class TransactionalTestCase method testNoTransaction.

@Test
public void testNoTransaction() throws Exception {
    final String deploymentUrl = DEPLOYMENT_URL;
    final TransactionalService transactionalService = TransactionalClient.newInstance(deploymentUrl);
    final boolean isTransactionActive = transactionalService.isTransactionActive();
    Assert.assertEquals(false, isTransactionActive);
}
Also used : TransactionalService(org.jboss.as.test.xts.annotation.service.TransactionalService) Test(org.junit.Test)

Example 3 with TransactionalService

use of org.jboss.as.test.xts.annotation.service.TransactionalService in project wildfly by wildfly.

the class TransactionalTestCase method testActiveTransaction.

@Test
public void testActiveTransaction() throws Exception {
    final String deploymentUrl = DEPLOYMENT_URL;
    final TransactionalService transactionalService = TransactionalClient.newInstance(deploymentUrl);
    final UserTransaction userTransaction = UserTransaction.getUserTransaction();
    userTransaction.begin();
    final boolean isTransactionActive = transactionalService.isTransactionActive();
    userTransaction.commit();
    Assert.assertEquals(true, isTransactionActive);
}
Also used : UserTransaction(com.arjuna.mw.wst11.UserTransaction) TransactionalService(org.jboss.as.test.xts.annotation.service.TransactionalService) Test(org.junit.Test)

Aggregations

TransactionalService (org.jboss.as.test.xts.annotation.service.TransactionalService)3 Test (org.junit.Test)2 UserTransaction (com.arjuna.mw.wst11.UserTransaction)1 URL (java.net.URL)1 QName (javax.xml.namespace.QName)1 Service (javax.xml.ws.Service)1