address npe in intermittent failure in ci

This commit is contained in:
gtully 2016-08-30 15:39:49 +01:00
parent de4f4e406f
commit bf5b1fcfce
2 changed files with 3 additions and 4 deletions

View File

@ -117,7 +117,7 @@ public class DbRestartJDBCQueueMasterSlaveTest extends JDBCQueueMasterSlaveTest
ActiveMQMessage mqMessage = (ActiveMQMessage) message;
MessageId id = mqMessage.getMessageId();
dbConnection = sharedDs.getConnection();
PreparedStatement s = dbConnection.prepareStatement(((JDBCPersistenceAdapter) connectedToBroker().getPersistenceAdapter()).getStatements().getFindMessageStatement());
PreparedStatement s = dbConnection.prepareStatement(findStatement);
s.setString(1, id.getProducerId().toString());
s.setLong(2, id.getProducerSequenceId());
ResultSet rs = s.executeQuery();
@ -143,7 +143,4 @@ public class DbRestartJDBCQueueMasterSlaveTest extends JDBCQueueMasterSlaveTest
}
}
private BrokerService connectedToBroker() {
return ((ActiveMQConnection)receiveConnection).getBrokerInfo().getBrokerName().equals("master") ? master : slave.get();
}
}

View File

@ -38,11 +38,13 @@ public class JDBCQueueMasterSlaveTest extends QueueMasterSlaveTestSupport {
protected SyncCreateDataSource sharedDs;
protected String MASTER_URL = "tcp://localhost:62001";
protected String SLAVE_URL = "tcp://localhost:62002";
protected String findStatement;
protected void setUp() throws Exception {
// startup db
sharedDs = new SyncCreateDataSource((EmbeddedDataSource) DataSourceServiceSupport.createDataSource(IOHelper.getDefaultDataDirectory()));
super.setUp();
findStatement = ((JDBCPersistenceAdapter) master.getPersistenceAdapter()).getStatements().getFindMessageStatement();
}
protected void tearDown() throws Exception {