Search in sources :

Example 1 with SomeAccountsWaitSet

use of com.zimbra.cs.session.SomeAccountsWaitSet in project zm-mailbox by Zimbra.

the class TestImapNotificationsViaWaitsets method runOp.

@Override
protected void runOp(MailboxOperation op, ZMailbox zmbox, ZFolder folder) throws Exception {
    ImapServerListener listener = ImapServerListenerPool.getInstance().get(zmbox);
    String wsID = listener.getWSId();
    SomeAccountsWaitSet ws = (SomeAccountsWaitSet) (WaitSetMgr.lookup(wsID));
    long lastSequence = ws.getCurrentSeqNo();
    op.run(zmbox);
    boolean applied = false;
    int timeout = 6000;
    while (timeout > 0) {
        if (listener.getLastKnownSequenceNumber() > lastSequence) {
            applied = true;
            break;
        }
        timeout -= 500;
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            break;
        }
    }
    assertTrue("operation not applied within 6 seconds", applied);
    String failure = op.checkResult();
    assertNull(failure, failure);
}
Also used : ImapServerListener(com.zimbra.cs.imap.ImapServerListener) SomeAccountsWaitSet(com.zimbra.cs.session.SomeAccountsWaitSet)

Aggregations

ImapServerListener (com.zimbra.cs.imap.ImapServerListener)1 SomeAccountsWaitSet (com.zimbra.cs.session.SomeAccountsWaitSet)1