use of com.zimbra.soap.account.message.GetInfoResponse in project zm-mailbox by Zimbra.
the class JaxbToElementTest method JSONelementToJaxbUsingDom4jTest.
/*
* This seems to work fine, although similar code in JAXB enabled ExportContacts server-side does not - get:
* javax.xml.bind.UnmarshalException: Namespace URIs and local names to the unmarshaller needs to be interned.
*/
@SuppressWarnings("deprecation")
public // Disabled @Test
void JSONelementToJaxbUsingDom4jTest() throws Exception {
for (int cnt = 1; cnt <= 4; cnt++) {
Element env = Element.parseJSON(getInfoResponseJSONwithEnv);
Element el = env.listElements().get(0);
GetInfoResponse getInfoResp = JaxbUtil.elementToJaxbUsingDom4j(el);
Assert.assertEquals("Account name", "user1@tarka.local", getInfoResp.getAccountName());
}
}
use of com.zimbra.soap.account.message.GetInfoResponse in project zm-mailbox by Zimbra.
the class JaxbToElementTest method elementToJaxbTest.
@Test
public void elementToJaxbTest() throws Exception {
Element el = JaxbUtil.jaxbToElement(getInfoRespJaxb);
org.w3c.dom.Document doc = el.toW3cDom();
ZimbraLog.test.debug("(XML)elementToJaxbTest toW3cDom() Xml:\n%s", W3cDomUtil.asXML(doc));
for (int cnt = 1; cnt <= iterationNum; cnt++) {
GetInfoResponse getInfoResp = JaxbUtil.elementToJaxb(getInfoRespElem);
Assert.assertEquals("Account name", "user1@tarka.local", getInfoResp.getAccountName());
}
}
use of com.zimbra.soap.account.message.GetInfoResponse in project zm-mailbox by Zimbra.
the class JaxbToElementTest method JSONelementToJaxbTest.
@Test
public void JSONelementToJaxbTest() throws Exception {
Element env = Element.parseJSON(getInfoResponseJSONwithEnv);
Element el = env.listElements().get(0);
org.w3c.dom.Document doc = el.toW3cDom();
ZimbraLog.test.debug("JSONelementToJaxbTest toW3cDom Xml:\n%s", W3cDomUtil.asXML(doc));
GetInfoResponse getInfoResp = JaxbUtil.elementToJaxb(el);
Assert.assertEquals("Account name", "user1@tarka.local", getInfoResp.getAccountName());
}
use of com.zimbra.soap.account.message.GetInfoResponse in project zm-mailbox by Zimbra.
the class TestGetInfo method discoverRights.
@Test
public void discoverRights() throws Exception {
Account acct = provUtil.createAccount(genAcctNameLocalPart(), domain);
Group group = provUtil.createGroup(genGroupNameLocalPart(), domain, false);
prov.grantRight(TargetType.domain.getCode(), TargetBy.name, domain.getName(), GranteeType.GT_USER.getCode(), GranteeBy.name, acct.getName(), null, User.R_createDistList.getName(), null);
prov.grantRight(TargetType.dl.getCode(), TargetBy.name, group.getName(), GranteeType.GT_USER.getCode(), GranteeBy.name, acct.getName(), null, User.R_sendToDistList.getName(), null);
SoapTransport transport = authUser(acct.getName());
GetInfoRequest req = new GetInfoRequest();
req.addRight(User.R_createDistList.getName());
req.addRight(User.R_sendToDistList.getName());
GetInfoResponse resp = invokeJaxb(transport, req);
List<DiscoverRightsInfo> rightsInfo = resp.getDiscoveredRights();
Set<String> result = Sets.newHashSet();
for (DiscoverRightsInfo rightInfo : rightsInfo) {
String right = rightInfo.getRight();
List<DiscoverRightsTarget> targets = rightInfo.getTargets();
for (DiscoverRightsTarget target : targets) {
String id = target.getId();
String name = target.getName();
String type = target.getType().toString();
result.add(Verify.makeResultStr(right, id, name, type));
}
}
Verify.verifyEquals(Sets.newHashSet(Verify.makeResultStr(User.R_createDistList.getName(), domain.getId(), domain.getName(), TargetType.domain.getCode()), Verify.makeResultStr(User.R_sendToDistList.getName(), group.getId(), group.getName(), TargetType.dl.getCode())), result);
}
use of com.zimbra.soap.account.message.GetInfoResponse in project zm-mailbox by Zimbra.
the class TestAuth method accountStatusMaintenanceAfterAuth.
@Test
public void accountStatusMaintenanceAfterAuth() throws Exception {
Account acct = provUtil.createAccount(genAcctNameLocalPart(), domain);
SoapTransport transport = authUser(acct.getName());
/*
* change account status to maintenance
*/
prov.modifyAccountStatus(acct, AccountStatus.maintenance.name());
GetInfoRequest req = new GetInfoRequest();
String errorCode = null;
try {
GetInfoResponse resp = invokeJaxb(transport, req);
} catch (SoapFaultException e) {
errorCode = e.getCode();
}
assertEquals(AccountServiceException.AUTH_EXPIRED, errorCode);
provUtil.deleteAccount(acct);
}
Aggregations