use of com.zimbra.soap.mail.message.CreateWaitSetRequest in project zm-mailbox by Zimbra.
the class TestWaitSetRequest method testWaitSetRequest.
@Test
public void testWaitSetRequest() throws Exception {
ZMailbox mbox = TestUtil.getZMailbox(USER_NAME);
String authToken = mbox.getAuthToken().getValue();
CreateWaitSetRequest req = new CreateWaitSetRequest("all");
WaitSetAddSpec add = new WaitSetAddSpec();
add.setId(mbox.getAccountInfo(false).getId());
req.addAccount(add);
DocumentResult dr = new DocumentResult();
marshaller.marshal(req, dr);
Document doc = dr.getDocument();
ZimbraLog.test.info(doc.getRootElement().asXML());
CreateWaitSetResponse createResp = (CreateWaitSetResponse) sendReq(envelope(authToken, doc.getRootElement().asXML()), "CreateWaitSetRequest");
String waitSetId = createResp.getWaitSetId();
Assert.assertNotNull(waitSetId);
WaitSetRequest waitSet = new com.zimbra.soap.mail.message.WaitSetRequest(waitSetId, "0");
dr = new DocumentResult();
marshaller.marshal(waitSet, dr);
doc = dr.getDocument();
WaitSetResponse wsResp = (WaitSetResponse) sendReq(envelope(authToken, doc.getRootElement().asXML()), "WaitSetRequest");
Assert.assertEquals("0", wsResp.getSeqNo());
String subject = NAME_PREFIX + " test wait set request 1";
TestUtil.addMessageLmtp(subject, USER_NAME, "user999@example.com");
try {
Thread.sleep(500);
} catch (Exception e) {
}
wsResp = (WaitSetResponse) sendReq(envelope(authToken, doc.getRootElement().asXML()), "WaitSetRequest");
Assert.assertFalse(wsResp.getSeqNo().equals("0"));
}
Aggregations