Search in sources :

Example 61 with Provisioning

use of com.zimbra.cs.account.Provisioning in project zm-mailbox by Zimbra.

the class GetMsgTest method setUp.

/**
     * @throws java.lang.Exception
     */
@Before
public void setUp() throws Exception {
    MailboxTestUtil.initServer();
    MailboxTestUtil.clearData();
    Provisioning prov = Provisioning.getInstance();
    Map<String, Object> attrs = Maps.newHashMap();
    prov.createDomain("zimbra.com", attrs);
    attrs = Maps.newHashMap();
    attrs.put(Provisioning.A_zimbraId, UUID.randomUUID().toString());
    prov.createAccount("test@zimbra.com", "secret", attrs);
    attrs = Maps.newHashMap();
    attrs.put(Provisioning.A_zimbraId, UUID.randomUUID().toString());
    prov.createAccount("test2@zimbra.com", "secret", attrs);
    // this MailboxManager does everything except actually send mail
    MailboxManager.setInstance(new MailboxManager() {

        @Override
        protected Mailbox instantiateMailbox(MailboxData data) {
            return new Mailbox(data) {

                @Override
                public MailSender getMailSender() {
                    return new MailSender() {

                        @Override
                        protected Collection<Address> sendMessage(Mailbox mbox, MimeMessage mm, Collection<RollbackData> rollbacks) {
                            try {
                                return Arrays.asList(getRecipients(mm));
                            } catch (Exception e) {
                                return Collections.emptyList();
                            }
                        }
                    };
                }
            };
        }
    });
}
Also used : MailboxData(com.zimbra.cs.mailbox.Mailbox.MailboxData) MailSender(com.zimbra.cs.mailbox.MailSender) Provisioning(com.zimbra.cs.account.Provisioning) MailboxManager(com.zimbra.cs.mailbox.MailboxManager) Mailbox(com.zimbra.cs.mailbox.Mailbox) MimeMessage(javax.mail.internet.MimeMessage) Collection(java.util.Collection) Before(org.junit.Before)

Example 62 with Provisioning

use of com.zimbra.cs.account.Provisioning in project zm-mailbox by Zimbra.

the class ItemActionTest method init.

@BeforeClass
public static void init() throws Exception {
    MailboxTestUtil.initServer();
    Provisioning prov = Provisioning.getInstance();
    prov.createAccount("test@zimbra.com", "secret", Maps.<String, Object>newHashMap());
    Map<String, Object> attrs = Maps.newHashMap();
    attrs.put(Provisioning.A_zimbraId, UUID.randomUUID().toString());
    prov.createAccount("test2@zimbra.com", "secret", attrs);
}
Also used : Provisioning(com.zimbra.cs.account.Provisioning) BeforeClass(org.junit.BeforeClass)

Example 63 with Provisioning

use of com.zimbra.cs.account.Provisioning in project zm-mailbox by Zimbra.

the class GetFolderTest method init.

@BeforeClass
public static void init() throws Exception {
    MailboxTestUtil.initServer();
    Provisioning prov = Provisioning.getInstance();
    Map<String, Object> attrs = Maps.newHashMap();
    prov.createAccount("test@zimbra.com", "secret", attrs);
    attrs = Maps.newHashMap();
    attrs.put(Provisioning.A_zimbraId, UUID.randomUUID().toString());
    prov.createAccount("test2@zimbra.com", "secret", attrs);
}
Also used : Provisioning(com.zimbra.cs.account.Provisioning) BeforeClass(org.junit.BeforeClass)

Example 64 with Provisioning

use of com.zimbra.cs.account.Provisioning in project zm-mailbox by Zimbra.

the class GetFilterRulesTest method init.

@BeforeClass
public static void init() throws Exception {
    MailboxTestUtil.initServer();
    Provisioning prov = Provisioning.getInstance();
    Map<String, Object> attrs = Maps.newHashMap();
    prov.createAccount("test@zimbra.com", "secret", attrs);
}
Also used : Provisioning(com.zimbra.cs.account.Provisioning) BeforeClass(org.junit.BeforeClass)

Example 65 with Provisioning

use of com.zimbra.cs.account.Provisioning in project zm-mailbox by Zimbra.

the class TagActionTest method init.

@BeforeClass
public static void init() throws Exception {
    MailboxTestUtil.initServer();
    Provisioning prov = Provisioning.getInstance();
    prov.createAccount("test@zimbra.com", "secret", Maps.<String, Object>newHashMap());
    Map<String, Object> attrs = Maps.newHashMap();
    attrs.put(Provisioning.A_zimbraId, UUID.randomUUID().toString());
    prov.createAccount("test2@zimbra.com", "secret", attrs);
}
Also used : Provisioning(com.zimbra.cs.account.Provisioning) BeforeClass(org.junit.BeforeClass)

Aggregations

Provisioning (com.zimbra.cs.account.Provisioning)532 Account (com.zimbra.cs.account.Account)216 ZimbraSoapContext (com.zimbra.soap.ZimbraSoapContext)158 Element (com.zimbra.common.soap.Element)144 ServiceException (com.zimbra.common.service.ServiceException)96 BeforeClass (org.junit.BeforeClass)93 MockProvisioning (com.zimbra.cs.account.MockProvisioning)89 Server (com.zimbra.cs.account.Server)83 HashMap (java.util.HashMap)76 Domain (com.zimbra.cs.account.Domain)70 SoapProvisioning (com.zimbra.cs.account.soap.SoapProvisioning)53 Mailbox (com.zimbra.cs.mailbox.Mailbox)50 Cos (com.zimbra.cs.account.Cos)32 Test (org.junit.Test)30 NamedEntry (com.zimbra.cs.account.NamedEntry)25 AuthToken (com.zimbra.cs.account.AuthToken)23 Group (com.zimbra.cs.account.Group)23 ArrayList (java.util.ArrayList)23 AccountServiceException (com.zimbra.cs.account.AccountServiceException)22 DistributionList (com.zimbra.cs.account.DistributionList)22