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());
}
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);
}
Aggregations