Search in sources :

Example 6 with AddAccountAliasResponse

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

the class TestDLMembership method testAddMemberByAlias.

@Test
public void testAddMemberByAlias() {
    SoapTransport transport;
    try {
        transport = TestUtil.getAdminSoapTransport();
        //add an alias to the account
        AddAccountAliasResponse addAliasResp = SoapTest.invokeJaxb(transport, new AddAccountAliasRequest(testUser.getId(), TestUtil.getAddress(TEST_ALIAS)));
        assertNotNull("AddAccountAliasResponse cannot be null", addAliasResp);
        Account acct = Provisioning.getInstance().getAccount(testUser.getId());
        assertNotNull(acct);
        assertNotNull("account's aliases are null", acct.getAliases());
        assertEquals("account has no aliases", acct.getAliases().length, 1);
        //add a member by alias
        AddDistributionListMemberResponse addDLMemberResp = SoapTest.invokeJaxb(transport, new AddDistributionListMemberRequest(testDL.getId(), Collections.singleton(TestUtil.getAddress(TEST_ALIAS))));
        assertNotNull("AddDistributionListMemberResponse cannot be null", addDLMemberResp);
        //verify that account is a member of the DL
        GetAccountMembershipResponse resp = SoapTest.invokeJaxb(transport, new GetAccountMembershipRequest(AccountSelector.fromName(TEST_USER)));
        assertNotNull("GetAccountMembershipRequest cannot be null", resp);
        List<DLInfo> dlInfoList = resp.getDlList();
        assertTrue("Account is not a member of any DLs", dlInfoList.size() > 0);
        assertEquals("Account should be a member of the test DL only", dlInfoList.get(0).getName(), testDL.getName());
    } catch (Exception e) {
        fail(e.getLocalizedMessage());
    }
}
Also used : Account(com.zimbra.cs.account.Account) AddDistributionListMemberResponse(com.zimbra.soap.admin.message.AddDistributionListMemberResponse) GetAccountMembershipResponse(com.zimbra.soap.admin.message.GetAccountMembershipResponse) AddAccountAliasRequest(com.zimbra.soap.admin.message.AddAccountAliasRequest) AddDistributionListMemberRequest(com.zimbra.soap.admin.message.AddDistributionListMemberRequest) GetAccountMembershipRequest(com.zimbra.soap.admin.message.GetAccountMembershipRequest) AddAccountAliasResponse(com.zimbra.soap.admin.message.AddAccountAliasResponse) DLInfo(com.zimbra.soap.admin.type.DLInfo) SoapTransport(com.zimbra.common.soap.SoapTransport) Test(org.junit.Test) SoapTest(com.zimbra.qa.unittest.prov.soap.SoapTest)

Aggregations

AddAccountAliasRequest (com.zimbra.soap.admin.message.AddAccountAliasRequest)6 AddAccountAliasResponse (com.zimbra.soap.admin.message.AddAccountAliasResponse)6 Account (com.zimbra.cs.account.Account)5 Test (org.junit.Test)5 SoapTransport (com.zimbra.common.soap.SoapTransport)3 SoapTest (com.zimbra.qa.unittest.prov.soap.SoapTest)3 AddDistributionListMemberRequest (com.zimbra.soap.admin.message.AddDistributionListMemberRequest)3 AddDistributionListMemberResponse (com.zimbra.soap.admin.message.AddDistributionListMemberResponse)3 GetAccountMembershipRequest (com.zimbra.soap.admin.message.GetAccountMembershipRequest)3 GetAccountMembershipResponse (com.zimbra.soap.admin.message.GetAccountMembershipResponse)3 DLInfo (com.zimbra.soap.admin.type.DLInfo)3 SoapFaultException (com.zimbra.common.soap.SoapFaultException)2 DistributionList (com.zimbra.cs.account.DistributionList)2 SoapProvisioning (com.zimbra.cs.account.soap.SoapProvisioning)2 DeleteAccountRequest (com.zimbra.soap.admin.message.DeleteAccountRequest)2 GetAccountRequest (com.zimbra.soap.admin.message.GetAccountRequest)2 GetMailboxRequest (com.zimbra.soap.admin.message.GetMailboxRequest)2 RemoveAccountAliasRequest (com.zimbra.soap.admin.message.RemoveAccountAliasRequest)2 RemoveDistributionListMemberRequest (com.zimbra.soap.admin.message.RemoveDistributionListMemberRequest)2 RemoveDistributionListMemberResponse (com.zimbra.soap.admin.message.RemoveDistributionListMemberResponse)2