Search in sources :

Example 51 with XMLElement

use of com.zimbra.common.soap.Element.XMLElement in project zm-mailbox by Zimbra.

the class TestAccess method createFolderAndReturnFolderId.

private String createFolderAndReturnFolderId(Role role, Perm perm) throws Exception {
    String folderName = "/folder-" + random();
    XMLElement req = new XMLElement(MailConstants.CREATE_FOLDER_REQUEST);
    Element folder = req.addElement(MailConstants.E_FOLDER);
    folder.addAttribute(MailConstants.A_NAME, folderName);
    Element response = accessTest(role, perm, req);
    if (response == null) {
        // to validate that the next Create/ModifyDataSource call will get PERM_DENIED
        return "1000";
    } else
        return response.getElement(MailConstants.E_FOLDER).getAttribute(MailConstants.A_ID);
}
Also used : XMLElement(com.zimbra.common.soap.Element.XMLElement) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 52 with XMLElement

use of com.zimbra.common.soap.Element.XMLElement in project zm-mailbox by Zimbra.

the class TestAccess method ModifyDataSource.

public void ModifyDataSource(Role role, Perm perm) throws Exception {
    String dateSourceName = "datasource-modify-" + random();
    DataSource ds = mProvAdmin.setup_createDataSource(this, role, perm, ACCT_1_EMAIL, dateSourceName);
    XMLElement req = new XMLElement(MailConstants.MODIFY_DATA_SOURCE_REQUEST);
    Element dataSource = req.addElement(MailConstants.E_DS_POP3);
    dataSource.addAttribute(MailConstants.A_ID, ds.getId());
    dataSource.addAttribute(MailConstants.A_DS_IS_ENABLED, "false");
    accessTest(role, perm, req);
}
Also used : XMLElement(com.zimbra.common.soap.Element.XMLElement) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement) DataSource(com.zimbra.cs.account.DataSource)

Example 53 with XMLElement

use of com.zimbra.common.soap.Element.XMLElement in project zm-mailbox by Zimbra.

the class TestAccess method ModifyProperties.

public void ModifyProperties(Role role, Perm perm) throws Exception {
    XMLElement req = new XMLElement(AccountConstants.MODIFY_PROPERTIES_REQUEST);
    accessTest(role, perm, req);
}
Also used : XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 54 with XMLElement

use of com.zimbra.common.soap.Element.XMLElement in project zm-mailbox by Zimbra.

the class TestAccess method Auth.

// ================= APIs ================
public void Auth(Role role, Perm perm) throws Exception {
    XMLElement req = new XMLElement(AccountConstants.AUTH_REQUEST);
    Element a = req.addElement(AccountConstants.E_ACCOUNT);
    a.addAttribute(AccountConstants.A_BY, "name");
    a.setText(ACCT_2_EMAIL);
    req.addElement(AccountConstants.E_PASSWORD).setText(PASSWORD);
    accessTest(role, perm, req);
}
Also used : XMLElement(com.zimbra.common.soap.Element.XMLElement) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement)

Example 55 with XMLElement

use of com.zimbra.common.soap.Element.XMLElement in project zm-mailbox by Zimbra.

the class TestAccess method GetIdentities.

public void GetIdentities(Role role, Perm perm) throws Exception {
    XMLElement req = new XMLElement(AccountConstants.GET_IDENTITIES_REQUEST);
    accessTest(role, perm, req);
}
Also used : XMLElement(com.zimbra.common.soap.Element.XMLElement)

Aggregations

XMLElement (com.zimbra.common.soap.Element.XMLElement)140 Element (com.zimbra.common.soap.Element)111 Test (org.junit.Test)30 JSONElement (com.zimbra.common.soap.Element.JSONElement)29 XmlAnyElement (javax.xml.bind.annotation.XmlAnyElement)25 XmlElement (javax.xml.bind.annotation.XmlElement)25 FilterTest (com.zimbra.soap.mail.type.FilterTest)24 SoapHttpTransport (com.zimbra.common.soap.SoapHttpTransport)9 HashMap (java.util.HashMap)8 Account (com.zimbra.cs.account.Account)6 ArrayList (java.util.ArrayList)6 ZAuthToken (com.zimbra.common.auth.ZAuthToken)5 KeyValuePair (com.zimbra.soap.type.KeyValuePair)5 ByteBuilder (com.zimbra.common.mime.HeaderUtils.ByteBuilder)4 ServiceException (com.zimbra.common.service.ServiceException)4 DataSource (com.zimbra.cs.account.DataSource)4 Auth (com.zimbra.cs.service.account.Auth)4 URL (java.net.URL)4 Cookie (javax.servlet.http.Cookie)4 Signature (com.zimbra.cs.account.Signature)3