use of com.zimbra.soap.admin.message.UndeployZimletResponse in project zm-mailbox by Zimbra.
the class TestDeployZimlet method testValidAdminExtension.
@Test
public void testValidAdminExtension() throws Exception {
SoapHttpTransport transport = new SoapHttpTransport(TestUtil.getAdminSoapUrl());
com.zimbra.soap.admin.message.AuthRequest authReq = new com.zimbra.soap.admin.message.AuthRequest(LC.zimbra_ldap_user.value(), LC.zimbra_ldap_password.value());
authReq.setCsrfSupported(false);
Element response = transport.invoke(JaxbUtil.jaxbToElement(authReq, SoapProtocol.SoapJS.getFactory()));
com.zimbra.soap.admin.message.AuthResponse authResp = JaxbUtil.elementToJaxb(response);
String authToken = authResp.getAuthToken();
String aid = adminUpload(authToken, "adminextension.zip", "/opt/zimbra/unittest/zimlets/adminextension.zip");
assertNotNull("Attachment ID should not be null", aid);
AttachmentIdAttrib att = new AttachmentIdAttrib(aid);
transport.setAdmin(true);
transport.setAuthToken(authToken);
DeployZimletRequest deployReq = new DeployZimletRequest(AdminConstants.A_DEPLOYLOCAL, false, true, att);
Element req = JaxbUtil.jaxbToElement(deployReq);
Element res = transport.invoke(req);
DeployZimletResponse deployResp = JaxbUtil.elementToJaxb(res);
assertNotNull(deployResp);
String status = deployResp.getProgresses().get(0).getStatus();
assertTrue("should be getting 'pending' or 'succeeded' status", status.equals(DeployZimlet.sPENDING) || status.equals(DeployZimlet.sSUCCEEDED));
UndeployZimletRequest undeployReq = new UndeployZimletRequest("adminextension", AdminConstants.A_DEPLOYALL);
req = JaxbUtil.jaxbToElement(undeployReq);
res = transport.invoke(req);
UndeployZimletResponse undeployResp = JaxbUtil.elementToJaxb(res);
assertNotNull(undeployResp);
}
use of com.zimbra.soap.admin.message.UndeployZimletResponse in project zm-mailbox by Zimbra.
the class TestDeployZimlet method testUndeployBadName.
@Test
public void testUndeployBadName() throws Exception {
SoapHttpTransport transport = new SoapHttpTransport(TestUtil.getAdminSoapUrl());
com.zimbra.soap.admin.message.AuthRequest authReq = new com.zimbra.soap.admin.message.AuthRequest(LC.zimbra_ldap_user.value(), LC.zimbra_ldap_password.value());
authReq.setCsrfSupported(false);
Element response = transport.invoke(JaxbUtil.jaxbToElement(authReq, SoapProtocol.SoapJS.getFactory()));
com.zimbra.soap.admin.message.AuthResponse authResp = JaxbUtil.elementToJaxb(response);
String authToken = authResp.getAuthToken();
transport.setAdmin(true);
transport.setAuthToken(authToken);
UndeployZimletRequest undeployReq = new UndeployZimletRequest("../data/something", AdminConstants.A_DEPLOYALL);
Element req = JaxbUtil.jaxbToElement(undeployReq);
try {
Element res = transport.invoke(req);
UndeployZimletResponse undeployResp = JaxbUtil.elementToJaxb(res);
fail("Should throw SoapFaultException. Instead received " + undeployResp.toString());
} catch (SoapFaultException e) {
// expected
}
}
Aggregations