Search in sources :

Example 1 with ActivityInfo

use of com.zimbra.soap.mail.type.ActivityInfo in project zm-mailbox by Zimbra.

the class OctopusJaxbTest method toActivityInfo.

private static ActivityInfo toActivityInfo(String account, String op, long timestamp, String itemId, int version, String itemName, Map<String, String> args) {
    ActivityInfo activity = ActivityInfo.fromOperationTimeStampItemId(op, timestamp, itemId);
    if (version > 0)
        activity.setVersion(version);
    if (account != null)
        activity.setEmail(account);
    activity.setArgs(args);
    checkActivityInfo(activity, "toActivityInfo result ");
    return activity;
}
Also used : ActivityInfo(com.zimbra.soap.mail.type.ActivityInfo)

Example 2 with ActivityInfo

use of com.zimbra.soap.mail.type.ActivityInfo in project zm-mailbox by Zimbra.

the class OctopusJaxbTest method activityInfoForGetActivityStreamXml.

@Test
public void activityInfoForGetActivityStreamXml() throws Exception {
    Map<String, String> args = Maps.newHashMap();
    args.put("key1", "value1");
    args.put("key2", "value2");
    ActivityInfo ai = toActivityInfo("account", "op", 333L, "123-123-123:22", 44, "itemName", args);
    Element notify = XMLElement.create(SoapProtocol.Soap12, "pink");
    Element activityElem = JaxbUtil.addChildElementFromJaxb(notify, MailConstants.E_A, MailConstants.NAMESPACE_STR, ai);
    ai = JaxbUtil.elementToJaxb(activityElem, ActivityInfo.class);
    checkActivityInfo(ai, "XML round tripped ");
}
Also used : ActivityInfo(com.zimbra.soap.mail.type.ActivityInfo) XMLElement(com.zimbra.common.soap.Element.XMLElement) Element(com.zimbra.common.soap.Element) JSONElement(com.zimbra.common.soap.Element.JSONElement) Test(org.junit.Test)

Example 3 with ActivityInfo

use of com.zimbra.soap.mail.type.ActivityInfo in project zm-mailbox by Zimbra.

the class OctopusJaxbTest method activityInfoForGetActivityStreamJSON.

@Test
public void activityInfoForGetActivityStreamJSON() throws Exception {
    Map<String, String> args = Maps.newHashMap();
    args.put("key1", "value1");
    args.put("key2", "value2");
    ActivityInfo ai = toActivityInfo("account", "op", 333L, "123-123-123:22", 44, "itemName", args);
    Element notify = JSONElement.create(SoapProtocol.SoapJS, "pink");
    Element activityElem = JaxbUtil.addChildElementFromJaxb(notify, MailConstants.E_A, MailConstants.NAMESPACE_STR, ai);
    ai = JaxbUtil.elementToJaxb(activityElem, ActivityInfo.class);
    checkActivityInfo(ai, "JSON round tripped ");
}
Also used : ActivityInfo(com.zimbra.soap.mail.type.ActivityInfo) XMLElement(com.zimbra.common.soap.Element.XMLElement) Element(com.zimbra.common.soap.Element) JSONElement(com.zimbra.common.soap.Element.JSONElement) Test(org.junit.Test)

Aggregations

ActivityInfo (com.zimbra.soap.mail.type.ActivityInfo)3 Element (com.zimbra.common.soap.Element)2 JSONElement (com.zimbra.common.soap.Element.JSONElement)2 XMLElement (com.zimbra.common.soap.Element.XMLElement)2 Test (org.junit.Test)2