use of com.zimbra.soap.admin.message.AdminCreateWaitSetResponse in project zm-mailbox by Zimbra.
the class TestWaitSetRequest method testBlockingAdminWait1Account.
@Test
public void testBlockingAdminWait1Account() throws Exception {
ZimbraLog.test.info("Starting testBlockingAdminWait1Account");
Set<String> accountIds = new HashSet<String>();
String user1Name = "testBlockingAdminWait1Account_user1";
String user2Name = "testBlockingAdminWait1Account_user2";
acc1 = TestUtil.createAccount(user1Name);
acc2 = TestUtil.createAccount(user2Name);
ZMailbox mbox = TestUtil.getZMailbox(user1Name);
accountIds.add(mbox.getAccountId());
ZMailbox mbox2 = TestUtil.getZMailbox(user2Name);
String adminAuthToken = TestUtil.getAdminSoapTransport().getAuthToken().getValue();
AdminCreateWaitSetResponse resp = createAdminWaitSet(accountIds, adminAuthToken, false);
assertNotNull(resp);
waitSetId = resp.getWaitSetId();
assertNotNull(waitSetId);
int seq = resp.getSequence();
AdminWaitSetRequest waitSetReq = new AdminWaitSetRequest(waitSetId, Integer.toString(seq));
waitSetReq.setBlock(true);
final CountDownLatch doneSignal = new CountDownLatch(1);
waitForAccounts(Arrays.asList(mbox.getAccountId()), doneSignal, waitSetReq, "testBlockingAdminWait1Account", false);
String subject = NAME_PREFIX + " test wait set request 1";
TestUtil.addMessage(mbox, subject);
TestUtil.addMessage(mbox2, subject);
try {
doneSignal.await(5, TimeUnit.SECONDS);
} catch (Exception e) {
fail("Wait interrupted.");
}
assertTrue("callback was not triggered.", cbCalled.get());
assertTrue(failureMessage, success.get());
}
Aggregations