Search in sources :

Example 1 with VerifyIndexResponse

use of com.zimbra.soap.admin.message.VerifyIndexResponse in project zm-mailbox by Zimbra.

the class JaxbToJsonTest method ZmBooleanAntStringXmlElements.

/**
     *  {
     *    "status": [{
     *        "_content": "true"   # Actually get true not "true" but should be ok
     *      }],
     *    "message": [{
     *        "_content": "ver ndx message"
     *      }],
     *    "_jsns": "urn:zimbraAdmin"
     *  }
     */
@Test
public void ZmBooleanAntStringXmlElements() throws Exception {
    final String msg = "ver ndx message";
    // ---------------------------------  For Comparison - Element handling
    Element legacyElem = JSONElement.mFactory.createElement(AdminConstants.VERIFY_INDEX_RESPONSE);
    legacyElem.addElement(AdminConstants.E_STATUS).addText(String.valueOf(true));
    legacyElem.addElement(AdminConstants.E_MESSAGE).addText(msg);
    logDebug("VerifyIndexResponse JSONElement ---> prettyPrint\n%1$s", legacyElem.prettyPrint());
    VerifyIndexResponse viResp = new VerifyIndexResponse(true, msg);
    Element jsonJaxbElem = JacksonUtil.jaxbToJSONElement(viResp);
    logDebug("VerifyIndexResponse JSONElement from JAXB ---> prettyPrint\n%1$s", jsonJaxbElem.prettyPrint());
    Assert.assertEquals("status", true, jsonJaxbElem.getAttributeBool(AdminConstants.E_STATUS));
    Assert.assertEquals("message", msg, jsonJaxbElem.getAttribute(AdminConstants.E_MESSAGE));
    VerifyIndexResponse roundtripped = JaxbUtil.elementToJaxb(jsonJaxbElem, VerifyIndexResponse.class);
    Assert.assertEquals("roundtripped status", true, roundtripped.isStatus());
    Assert.assertEquals("roundtripped message", msg, roundtripped.getMessage());
}
Also used : VerifyIndexResponse(com.zimbra.soap.admin.message.VerifyIndexResponse) XmlAnyElement(javax.xml.bind.annotation.XmlAnyElement) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement) JSONElement(com.zimbra.common.soap.Element.JSONElement) XmlElement(javax.xml.bind.annotation.XmlElement) FilterTest(com.zimbra.soap.mail.type.FilterTest) Test(org.junit.Test)

Example 2 with VerifyIndexResponse

use of com.zimbra.soap.admin.message.VerifyIndexResponse in project zm-mailbox by Zimbra.

the class JaxbToJsonTest method zmBooleanAntStringXmlElements.

/**
 *  {
 *    "status": [{
 *        "_content": "true"   # Actually get true not "true" but should be ok
 *      }],
 *    "message": [{
 *        "_content": "ver ndx message"
 *      }],
 *    "_jsns": "urn:zimbraAdmin"
 *  }
 */
@Test
public void zmBooleanAntStringXmlElements() throws Exception {
    final String msg = "ver ndx message";
    // ---------------------------------  For Comparison - Element handling
    Element legacyElem = JSONElement.mFactory.createElement(AdminConstants.VERIFY_INDEX_RESPONSE);
    legacyElem.addNonUniqueElement(AdminConstants.E_STATUS).addText(String.valueOf(true));
    legacyElem.addNonUniqueElement(AdminConstants.E_MESSAGE).addText(msg);
    logDebug("VerifyIndexResponse JSONElement ---> prettyPrint\n%1$s", legacyElem.prettyPrint());
    VerifyIndexResponse viResp = new VerifyIndexResponse(true, msg);
    Element jsonJaxbElem = JacksonUtil.jaxbToJSONElement(viResp);
    logDebug("VerifyIndexResponse JSONElement from JAXB ---> prettyPrint\n%1$s", jsonJaxbElem.prettyPrint());
    Assert.assertEquals("status", true, jsonJaxbElem.getAttributeBool(AdminConstants.E_STATUS));
    Assert.assertEquals("message", msg, jsonJaxbElem.getAttribute(AdminConstants.E_MESSAGE));
    VerifyIndexResponse roundtripped = JaxbUtil.elementToJaxb(jsonJaxbElem, VerifyIndexResponse.class);
    Assert.assertEquals("roundtripped status", true, roundtripped.isStatus());
    Assert.assertEquals("roundtripped message", msg, roundtripped.getMessage());
}
Also used : VerifyIndexResponse(com.zimbra.soap.admin.message.VerifyIndexResponse) XmlAnyElement(javax.xml.bind.annotation.XmlAnyElement) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement) JSONElement(com.zimbra.common.soap.Element.JSONElement) XmlElement(javax.xml.bind.annotation.XmlElement) FilterTest(com.zimbra.soap.mail.type.FilterTest) Test(org.junit.Test)

Example 3 with VerifyIndexResponse

use of com.zimbra.soap.admin.message.VerifyIndexResponse in project zm-mailbox by Zimbra.

the class SoapProvisioning method verifyIndex.

public VerifyIndexResult verifyIndex(Account account) throws ServiceException {
    VerifyIndexRequest req = new VerifyIndexRequest(new MailboxByAccountIdSelector(account.getId()));
    VerifyIndexResponse resp = invokeJaxb(req, getServer(account).getAttr(A_zimbraServiceHostname));
    return new VerifyIndexResult(resp.isStatus(), resp.getMessage());
}
Also used : VerifyIndexRequest(com.zimbra.soap.admin.message.VerifyIndexRequest) VerifyIndexResponse(com.zimbra.soap.admin.message.VerifyIndexResponse) MailboxByAccountIdSelector(com.zimbra.soap.admin.type.MailboxByAccountIdSelector)

Aggregations

VerifyIndexResponse (com.zimbra.soap.admin.message.VerifyIndexResponse)3 Element (com.zimbra.common.soap.Element)2 JSONElement (com.zimbra.common.soap.Element.JSONElement)2 XMLElement (com.zimbra.common.soap.Element.XMLElement)2 FilterTest (com.zimbra.soap.mail.type.FilterTest)2 XmlAnyElement (javax.xml.bind.annotation.XmlAnyElement)2 XmlElement (javax.xml.bind.annotation.XmlElement)2 Test (org.junit.Test)2 VerifyIndexRequest (com.zimbra.soap.admin.message.VerifyIndexRequest)1 MailboxByAccountIdSelector (com.zimbra.soap.admin.type.MailboxByAccountIdSelector)1