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());
}
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());
}
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());
}
Aggregations