no jira - fix up contention between rar and test creating the embedded broker - intermittent ci failure

This commit is contained in:
gtully 2018-10-18 11:16:32 +01:00
parent 8690436b5b
commit b9c8f6228c
2 changed files with 18 additions and 5 deletions

View File

@ -19,6 +19,7 @@ package org.apache.activemq.ra;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.URI;
import javax.jms.ConnectionFactory;
import javax.jms.Session;
@ -30,18 +31,22 @@ import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.ActiveMQPrefetchPolicy;
import org.apache.activemq.JmsQueueTransactionTest;
import org.apache.activemq.broker.BrokerFactory;
import org.apache.activemq.broker.BrokerService;
public class JmsXAQueueTransactionTest extends JmsQueueTransactionTest {
private static final String KAHADB_DIRECTORY = "target/activemq-data/";
private static final String DEFAULT_HOST = "vm://localhost?broker.dataDirectory=" + KAHADB_DIRECTORY;
private ConnectionManagerAdapter connectionManager = new ConnectionManagerAdapter();
private ActiveMQManagedConnectionFactory managedConnectionFactory;
private XAResource xaResource;
private static long txGenerator;
private Xid xid;
@Override
protected BrokerService createBroker() throws Exception {
return BrokerFactory.createBroker(new URI("broker://()/localhost?persistent=false&useJmx=false"));
}
@Override
protected void setSessionTransacted() {
resourceProvider.setTransacted(false);
@ -51,7 +56,7 @@ public class JmsXAQueueTransactionTest extends JmsQueueTransactionTest {
@Override
protected ConnectionFactory newConnectionFactory() throws Exception {
managedConnectionFactory = new ActiveMQManagedConnectionFactory();
managedConnectionFactory.setServerUrl(DEFAULT_HOST);
managedConnectionFactory.setServerUrl("vm://localhost?create=false&waitForStart=5000");
managedConnectionFactory.setUserName(org.apache.activemq.ActiveMQConnectionFactory.DEFAULT_USER);
managedConnectionFactory.setPassword(ActiveMQConnectionFactory.DEFAULT_PASSWORD);

View File

@ -19,6 +19,7 @@ package org.apache.activemq.ra;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.URI;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
@ -32,6 +33,8 @@ import org.apache.activemq.ActiveMQConnection;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.ActiveMQPrefetchPolicy;
import org.apache.activemq.JmsQueueTransactionTest;
import org.apache.activemq.broker.BrokerFactory;
import org.apache.activemq.broker.BrokerService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -39,7 +42,7 @@ public class JmsXARollback2CxTransactionTest extends JmsQueueTransactionTest {
protected static final Logger LOG = LoggerFactory.getLogger(JmsXARollback2CxTransactionTest.class);
private static final String DEFAULT_HOST = "vm://localhost?create=false";
private static final String DEFAULT_HOST = "vm://localhost?create=false&waitForStart=5000";
private ManagedConnectionProxy cx2;
private ConnectionManagerAdapter connectionManager = new ConnectionManagerAdapter();
@ -48,6 +51,11 @@ public class JmsXARollback2CxTransactionTest extends JmsQueueTransactionTest {
private XAResource[] xares = new XAResource[2];
private int index = 0;
@Override
protected BrokerService createBroker() throws Exception {
return BrokerFactory.createBroker(new URI("broker://()/localhost?persistent=false&useJmx=false"));
}
@Override
protected void setUp() throws Exception {
LOG.info("Starting ----------------------------> {}", this.getName());