Search in sources :

Example 1 with DeleteDataSourceRequest

use of com.zimbra.soap.mail.message.DeleteDataSourceRequest in project zm-mailbox by Zimbra.

the class JaxbToElementTest method DeleteDataSourceRequestTest.

/*
     * Currently, DeleteDataSourceRequest does not have a setter for all datasource children.  Making sure that
     * it works.  Actually believe that JAXB ignores setters for lists and adds by using the getter to get the
     * list and adding to that.
     */
@Test
public void DeleteDataSourceRequestTest() throws Exception {
    DeleteDataSourceRequest req = new DeleteDataSourceRequest();
    Pop3DataSourceNameOrId pop = new Pop3DataSourceNameOrId();
    pop.setName("pop3name");
    ImapDataSourceNameOrId imap = new ImapDataSourceNameOrId();
    imap.setName("imap4name");
    req.addDataSource(pop);
    req.addDataSource(imap);
    Element elem = JaxbUtil.jaxbToElement(req, XMLElement.mFactory);
    Assert.assertNotNull("DataSourceRequest elem", elem);
    Element imapE = elem.getElement(MailConstants.E_DS_IMAP);
    Assert.assertNotNull("imap elem", imapE);
    Element popE = elem.getElement(MailConstants.E_DS_POP3);
    Assert.assertNotNull("imap elem", popE);
    req = JaxbUtil.elementToJaxb(elem, DeleteDataSourceRequest.class);
    Assert.assertNotNull("JAXB DeleteDataSourceRequest", req);
    Assert.assertEquals("Number of datasources in JAXB", 2, req.getDataSources().size());
}
Also used : DeleteDataSourceRequest(com.zimbra.soap.mail.message.DeleteDataSourceRequest) Element(com.zimbra.common.soap.Element) XMLElement(com.zimbra.common.soap.Element.XMLElement) JSONElement(com.zimbra.common.soap.Element.JSONElement) JAXBElement(javax.xml.bind.JAXBElement) Pop3DataSourceNameOrId(com.zimbra.soap.mail.type.Pop3DataSourceNameOrId) ImapDataSourceNameOrId(com.zimbra.soap.mail.type.ImapDataSourceNameOrId) Test(org.junit.Test)

Example 2 with DeleteDataSourceRequest

use of com.zimbra.soap.mail.message.DeleteDataSourceRequest in project zm-mailbox by Zimbra.

the class TestAccess method DeleteDataSource.

@Test
public void DeleteDataSource() throws Exception {
    String dateSourceName = genDataSourceName(seq);
    // create a data cource
    SoapTransport transport = authUser(ACCT_NAME);
    CreateDataSourceRequest createReq = buildCeateDataSourceRequest(dateSourceName);
    CreateDataSourceResponse createResp = invokeJaxb(transport, createReq);
    assertNotNull("CreateDataSourceResponse", createResp);
    Pop3DataSourceNameOrId name = new Pop3DataSourceNameOrId();
    name.setName(dateSourceName);
    DeleteDataSourceRequest req = new DeleteDataSourceRequest();
    req.addDataSource(name);
    /*
        DataSource ds = mProvAdmin.setup_createDataSource(this, role, perm, ACCT_1_EMAIL, dateSourceName);

        XMLElement req = new XMLElement(MailConstants.DELETE_DATA_SOURCE_REQUEST);
        Element dataSource = req.addElement(MailConstants.E_DS_POP3);
        dataSource.addAttribute(MailConstants.A_ID, ds.getId());
        */
    accessTest(Perm.PERM_SELF_ONLY, req);
}
Also used : DeleteDataSourceRequest(com.zimbra.soap.mail.message.DeleteDataSourceRequest) CreateDataSourceResponse(com.zimbra.soap.mail.message.CreateDataSourceResponse) Pop3DataSourceNameOrId(com.zimbra.soap.mail.type.Pop3DataSourceNameOrId) SoapTransport(com.zimbra.common.soap.SoapTransport) CreateDataSourceRequest(com.zimbra.soap.mail.message.CreateDataSourceRequest) Test(org.junit.Test)

Aggregations

DeleteDataSourceRequest (com.zimbra.soap.mail.message.DeleteDataSourceRequest)2 Pop3DataSourceNameOrId (com.zimbra.soap.mail.type.Pop3DataSourceNameOrId)2 Test (org.junit.Test)2 Element (com.zimbra.common.soap.Element)1 JSONElement (com.zimbra.common.soap.Element.JSONElement)1 XMLElement (com.zimbra.common.soap.Element.XMLElement)1 SoapTransport (com.zimbra.common.soap.SoapTransport)1 CreateDataSourceRequest (com.zimbra.soap.mail.message.CreateDataSourceRequest)1 CreateDataSourceResponse (com.zimbra.soap.mail.message.CreateDataSourceResponse)1 ImapDataSourceNameOrId (com.zimbra.soap.mail.type.ImapDataSourceNameOrId)1 JAXBElement (javax.xml.bind.JAXBElement)1