Search in sources :

Example 1 with CreateDataSourceRequest

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

the class ZMailbox method createDataSource.

/**
 * Creates a data source.
 *
 * @return the new data source id
 */
public String createDataSource(ZDataSource source) throws ServiceException {
    CreateDataSourceRequest req = new CreateDataSourceRequest();
    DataSource jaxbObj = source.toJaxb();
    req.setDataSource(jaxbObj);
    CreateDataSourceResponse resp = (CreateDataSourceResponse) invokeJaxb(req);
    return resp.getDataSource().getId();
}
Also used : CreateDataSourceResponse(com.zimbra.soap.mail.message.CreateDataSourceResponse) CreateDataSourceRequest(com.zimbra.soap.mail.message.CreateDataSourceRequest) RssDataSource(com.zimbra.soap.type.RssDataSource) TestDataSource(com.zimbra.soap.mail.type.TestDataSource) DataSource(com.zimbra.soap.type.DataSource) Pop3DataSource(com.zimbra.soap.type.Pop3DataSource) ImapDataSource(com.zimbra.soap.type.ImapDataSource) CalDataSource(com.zimbra.soap.type.CalDataSource)

Example 2 with CreateDataSourceRequest

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

the class TestPurgeDataSource method createDataSources.

private void createDataSources() throws ServiceException {
    CreateDataSourceRequest req = new CreateDataSourceRequest();
    MailImapDataSource imap = new MailImapDataSource();
    imap.setUsername(IMAP_ACCOUNT_NAME_1);
    imap.setPassword("test123");
    imap.setEnabled(true);
    imap.setHost("localhost");
    imap.setPort(Integer.valueOf(TestUtil.getServerAttr(Provisioning.A_zimbraImapBindPort)));
    imap.setConnectionType(ConnectionType.cleartext);
    imap.setFolderId(imapDsFolder1Id);
    imap.setName(IMAP_DS_NAME_1);
    req.setDataSource(imap);
    CreateDataSourceResponse resp = mbox.invokeJaxb(req);
    imapDsId1 = resp.getDataSource().getId();
    req = new CreateDataSourceRequest();
    imap = new MailImapDataSource();
    imap.setUsername(IMAP_ACCOUNT_NAME_2);
    imap.setPassword("test123");
    imap.setEnabled(true);
    imap.setHost("localhost");
    imap.setPort(Integer.valueOf(TestUtil.getServerAttr(Provisioning.A_zimbraImapBindPort)));
    imap.setConnectionType(ConnectionType.cleartext);
    imap.setFolderId(imapDsFolder2Id);
    imap.setName(IMAP_DS_NAME_2);
    req.setDataSource(imap);
    resp = mbox.invokeJaxb(req);
    imapDsId2 = resp.getDataSource().getId();
    req = new CreateDataSourceRequest();
    MailPop3DataSource pop3 = new MailPop3DataSource();
    pop3.setUsername(POP3_ACCOUNT_NAME);
    pop3.setPassword("test123");
    pop3.setEnabled(true);
    pop3.setHost("localhost");
    pop3.setPort(Integer.valueOf(TestUtil.getServerAttr(Provisioning.A_zimbraPop3BindPort)));
    pop3.setConnectionType(ConnectionType.cleartext);
    pop3.setFolderId(pop3DsFolderId);
    pop3.setName(POP3_DS_NAME);
    pop3.setLeaveOnServer(true);
    req.setDataSource(pop3);
    resp = mbox.invokeJaxb(req);
    pop3DsId = resp.getDataSource().getId();
}
Also used : CreateDataSourceResponse(com.zimbra.soap.mail.message.CreateDataSourceResponse) MailImapDataSource(com.zimbra.soap.mail.type.MailImapDataSource) MailPop3DataSource(com.zimbra.soap.mail.type.MailPop3DataSource) CreateDataSourceRequest(com.zimbra.soap.mail.message.CreateDataSourceRequest)

Example 3 with CreateDataSourceRequest

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

the class TestTrashImapMessage method createDataSources.

private void createDataSources() throws ServiceException {
    CreateDataSourceRequest req = new CreateDataSourceRequest();
    MailImapDataSource imap = new MailImapDataSource();
    imap.setUsername(IMAP_ACCOUNT_NAME_1);
    imap.setPassword("test123");
    imap.setEnabled(true);
    imap.setHost("localhost");
    imap.setPort(Integer.valueOf(TestUtil.getServerAttr(Provisioning.A_zimbraImapBindPort)));
    imap.setConnectionType(ConnectionType.cleartext);
    imap.setFolderId(imapDsFolder1Id);
    imap.setName(IMAP_DS_NAME_1);
    req.setDataSource(imap);
    CreateDataSourceResponse resp = mbox.invokeJaxb(req);
    imapDsId1 = resp.getDataSource().getId();
}
Also used : CreateDataSourceResponse(com.zimbra.soap.mail.message.CreateDataSourceResponse) MailImapDataSource(com.zimbra.soap.mail.type.MailImapDataSource) CreateDataSourceRequest(com.zimbra.soap.mail.message.CreateDataSourceRequest)

Example 4 with CreateDataSourceRequest

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

the class TestAccess method CreateDataSource.

@Test
public void CreateDataSource() throws Exception {
    String dateSourceName = genDataSourceName(seq);
    CreateDataSourceRequest req = buildCeateDataSourceRequest(dateSourceName);
    /*
        XMLElement req = new XMLElement(MailConstants.CREATE_DATA_SOURCE_REQUEST);
        Element dataSource = req.addElement(MailConstants.E_DS_POP3);
        dataSource.addAttribute(MailConstants.A_NAME, dateSourceName);
        dataSource.addAttribute(MailConstants.A_DS_IS_ENABLED, "true");
        dataSource.addAttribute(MailConstants.A_DS_HOST, "pop3.google.com");
        dataSource.addAttribute(MailConstants.A_DS_PORT, "pop3.google.com");
        dataSource.addAttribute(MailConstants.A_DS_USERNAME, "my-pop3-name");
        dataSource.addAttribute(MailConstants.A_DS_PASSWORD, "my-pop3-password");
        dataSource.addAttribute(MailConstants.A_FOLDER, createFolderAndReturnFolderId(role, perm));
        dataSource.addAttribute(MailConstants.A_DS_CONNECTION_TYPE, "ssl");
        */
    accessTest(Perm.PERM_SELF_ONLY, req);
}
Also used : CreateDataSourceRequest(com.zimbra.soap.mail.message.CreateDataSourceRequest) Test(org.junit.Test)

Example 5 with CreateDataSourceRequest

use of com.zimbra.soap.mail.message.CreateDataSourceRequest 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

CreateDataSourceRequest (com.zimbra.soap.mail.message.CreateDataSourceRequest)8 CreateDataSourceResponse (com.zimbra.soap.mail.message.CreateDataSourceResponse)5 MailPop3DataSource (com.zimbra.soap.mail.type.MailPop3DataSource)4 MailImapDataSource (com.zimbra.soap.mail.type.MailImapDataSource)3 Test (org.junit.Test)3 DataSource (com.zimbra.soap.type.DataSource)2 SoapTransport (com.zimbra.common.soap.SoapTransport)1 DeleteDataSourceRequest (com.zimbra.soap.mail.message.DeleteDataSourceRequest)1 MailCalDataSource (com.zimbra.soap.mail.type.MailCalDataSource)1 MailCaldavDataSource (com.zimbra.soap.mail.type.MailCaldavDataSource)1 MailDataSource (com.zimbra.soap.mail.type.MailDataSource)1 MailGalDataSource (com.zimbra.soap.mail.type.MailGalDataSource)1 MailRssDataSource (com.zimbra.soap.mail.type.MailRssDataSource)1 Pop3DataSourceNameOrId (com.zimbra.soap.mail.type.Pop3DataSourceNameOrId)1 TestDataSource (com.zimbra.soap.mail.type.TestDataSource)1 CalDataSource (com.zimbra.soap.type.CalDataSource)1 ImapDataSource (com.zimbra.soap.type.ImapDataSource)1 Pop3DataSource (com.zimbra.soap.type.Pop3DataSource)1 RssDataSource (com.zimbra.soap.type.RssDataSource)1 JAXBContext (javax.xml.bind.JAXBContext)1