while(System.currentTimeMillis() < limit) {
Thread.sleep(tickTime); // Try the assertions each tick interval, until they pass or we time out
try {
//now check the sequence is running
SequenceReport report = SandeshaClient.getOutgoingSequenceReport(serviceClient);
assertEquals(report.getSequenceStatus(), SequenceReport.SEQUENCE_STATUS_ESTABLISHED);
lastError = null;
break;
} catch(Error e) {
lastError = e;
}
}
if(lastError != null) throw lastError;
// Send the ACK request
SandeshaClient.sendAckRequest(serviceClient);
limit = System.currentTimeMillis() + waitTime;
while(System.currentTimeMillis() < limit) {
Thread.sleep(tickTime); // Try the assertions each tick interval, until they pass or we time out
try {
// Get the storage manager from the ConfigurationContext
StorageManager storageManager = SandeshaUtil.getSandeshaStorageManager(configContext, configContext.getAxisConfiguration());
// Get the sequence id for this sequence.
String sequenceId = SandeshaClient.getSequenceID(serviceClient);
// Get the SenderBeanManager
SenderBeanMgr senderManager = storageManager.getSenderBeanMgr();
Transaction transaction = storageManager.getTransaction();
// Check that there are no sender beans inside the SenderBeanMgr.
SenderBean senderBean = new SenderBean();
senderBean.setSequenceID(sequenceId);
senderBean.setSend(true);
senderBean.setReSend(false);
// Find any sender beans for the to address.
List beans = senderManager.find(senderBean);
//only the ackRequested bean will be present.
assertTrue("SenderBeans found when the list should be empty", (beans.size()==1));
SequenceReport sequenceReport = SandeshaClient.getOutgoingSequenceReport(serviceClient);
transaction.commit();
assertNotNull(sequenceReport.getSequenceID());
assertFalse(sequenceReport.isSecureSequence());
lastError = null;
break;
} catch(Error e) {
lastError = e;