Search in sources :

Example 11 with AdminCreateWaitSetResponse

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());
}
Also used : AdminWaitSetRequest(com.zimbra.soap.admin.message.AdminWaitSetRequest) ZMailbox(com.zimbra.client.ZMailbox) CountDownLatch(java.util.concurrent.CountDownLatch) JAXBException(javax.xml.bind.JAXBException) AdminServiceException(com.zimbra.cs.service.admin.AdminServiceException) SoapFaultException(com.zimbra.common.soap.SoapFaultException) ServiceException(com.zimbra.common.service.ServiceException) SoapParseException(com.zimbra.common.soap.SoapParseException) IOException(java.io.IOException) MailServiceException(com.zimbra.cs.mailbox.MailServiceException) HashSet(java.util.HashSet) AdminCreateWaitSetResponse(com.zimbra.soap.admin.message.AdminCreateWaitSetResponse) Test(org.junit.Test)

Aggregations

AdminCreateWaitSetResponse (com.zimbra.soap.admin.message.AdminCreateWaitSetResponse)11 AdminWaitSetRequest (com.zimbra.soap.admin.message.AdminWaitSetRequest)8 ZMailbox (com.zimbra.client.ZMailbox)7 SoapFaultException (com.zimbra.common.soap.SoapFaultException)7 Test (org.junit.Test)7 ServiceException (com.zimbra.common.service.ServiceException)6 AdminServiceException (com.zimbra.cs.service.admin.AdminServiceException)6 HashSet (java.util.HashSet)6 SoapParseException (com.zimbra.common.soap.SoapParseException)5 MailServiceException (com.zimbra.cs.mailbox.MailServiceException)4 AdminWaitSetResponse (com.zimbra.soap.admin.message.AdminWaitSetResponse)4 WaitSetAddSpec (com.zimbra.soap.type.WaitSetAddSpec)4 IOException (java.io.IOException)4 CountDownLatch (java.util.concurrent.CountDownLatch)4 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)4 JAXBException (javax.xml.bind.JAXBException)4 AdminCreateWaitSetRequest (com.zimbra.soap.admin.message.AdminCreateWaitSetRequest)3 ZFolder (com.zimbra.client.ZFolder)2 ArrayList (java.util.ArrayList)2 Element (com.zimbra.common.soap.Element)1