Search in sources :

Example 21 with Provisioning

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

the class ReplaceHeaderTest method init.

@BeforeClass
public static void init() 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());
    Account acct = 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);
    attrs = Maps.newHashMap();
    attrs.put(Provisioning.A_zimbraId, UUID.randomUUID().toString());
    prov.createAccount("test3@zimbra.com", "secret", attrs);
    // this MailboxManager does everything except actually send mail
    MailboxManager.setInstance(new DirectInsertionMailboxManager());
}
Also used : Account(com.zimbra.cs.account.Account) Provisioning(com.zimbra.cs.account.Provisioning) DirectInsertionMailboxManager(com.zimbra.cs.service.mail.SendMsgTest.DirectInsertionMailboxManager) BeforeClass(org.junit.BeforeClass)

Example 22 with Provisioning

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

the class RejectTest method init.

@BeforeClass
public static void init() 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());
    attrs.put(Provisioning.A_zimbraSieveRejectMailEnabled, "TRUE");
    prov.createAccount("test@zimbra.com", "secret", attrs);
    attrs = Maps.newHashMap();
    attrs.put(Provisioning.A_zimbraId, UUID.randomUUID().toString());
    attrs.put(Provisioning.A_zimbraSieveRejectMailEnabled, "TRUE");
    prov.createAccount("test2@zimbra.com", "secret", attrs);
    // this MailboxManager does everything except actually send mail
    MailboxManager.setInstance(new DirectInsertionMailboxManager());
}
Also used : Provisioning(com.zimbra.cs.account.Provisioning) DirectInsertionMailboxManager(com.zimbra.cs.service.mail.SendMsgTest.DirectInsertionMailboxManager) BeforeClass(org.junit.BeforeClass)

Example 23 with Provisioning

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

the class RelationalExtensionTest method init.

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

Example 24 with Provisioning

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

the class RuleManagerWithCustomActionFilterTest method init.

@BeforeClass
public static void init() throws Exception {
    // keep original sieve factory
    original_sf = RuleManager.getSieveFactory();
    ExtensionTestUtil.init();
    MailboxTestUtil.initServer();
    Provisioning prov = Provisioning.getInstance();
    prov.createAccount("test@zimbra.com", "secret", new HashMap<String, Object>());
    // make sure the behavior before registering custom actions
    Account account = Provisioning.getInstance().getAccount(MockProvisioning.DEFAULT_ACCOUNT_ID);
    Mailbox mbox = MailboxManager.getInstance().getMailboxByAccount(account);
    AbstractActionCommand ext = (AbstractActionCommand) ExtensionUtil.getExtension("discard");
    Assert.assertNull(ext);
    RuleManager.clearCachedRules(account);
    account.setMailSieveScript("if socialcast { discard; }");
    List<ItemId> ids = RuleManager.applyRulesToIncomingMessage(new OperationContext(mbox), mbox, new ParsedMessage("From: do-not-reply@socialcast.com\nReply-To: share@socialcast.com\nSubject: test".getBytes(), false), 0, account.getName(), new DeliveryContext(), Mailbox.ID_FOLDER_INBOX, true);
    Assert.assertEquals(0, ids.size());
    // register custom action extensions
    ExtensionTestUtil.registerExtension("com.zimbra.extensions.DummyCustomDiscard");
    ExtensionTestUtil.registerExtension("com.zimbra.extensions.DummyCustomTag");
    ExtensionUtil.initAll();
}
Also used : Account(com.zimbra.cs.account.Account) AbstractActionCommand(org.apache.jsieve.commands.AbstractActionCommand) ParsedMessage(com.zimbra.cs.mime.ParsedMessage) ItemId(com.zimbra.cs.service.util.ItemId) MockProvisioning(com.zimbra.cs.account.MockProvisioning) Provisioning(com.zimbra.cs.account.Provisioning) BeforeClass(org.junit.BeforeClass)

Example 25 with Provisioning

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

the class TagTest method init.

@BeforeClass
public static void init() throws Exception {
    MailboxTestUtil.initServer();
    Provisioning prov = Provisioning.getInstance();
    prov.createAccount("test@zimbra.com", "secret", new HashMap<String, Object>());
}
Also used : MockProvisioning(com.zimbra.cs.account.MockProvisioning) 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