Search in sources :

Example 11 with MockProvisioning

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

the class MailboxTestUtil method initProvisioning.

/**
 * Initializes the provisioning.
 *
 * @param zimbraServerDir the directory that contains the ZimbraServer project
 * @throws Exception
 */
public static void initProvisioning(String zimbraServerDir) throws Exception {
    zimbraServerDir = getZimbraServerDir(zimbraServerDir);
    System.setProperty("log4j.configuration", "log4j-test.properties");
    System.setProperty("zimbra.config", zimbraServerDir + "src/java-test/localconfig-test.xml");
    LC.reload();
    // substitute test TZ file
    String timezonefilePath = zimbraServerDir + "src/java-test/timezones-test.ics";
    File d = new File(timezonefilePath);
    if (!d.exists()) {
        throw new FileNotFoundException("timezones-test.ics not found in " + timezonefilePath);
    }
    LC.timezone_file.setDefault(timezonefilePath);
    LC.zimbra_rights_directory.setDefault(StringUtils.removeEnd(zimbraServerDir, "/") + "-conf" + "/conf/rights");
    LC.zimbra_attrs_directory.setDefault(zimbraServerDir + "conf/attrs");
    LC.zimbra_tmp_directory.setDefault(zimbraServerDir + "tmp");
    // substitute test DS config file
    String dsfilePath = zimbraServerDir + "src/java-test/datasource-test.xml";
    d = new File(dsfilePath);
    if (!d.exists()) {
        throw new FileNotFoundException("datasource-test.xml not found in " + dsfilePath);
    }
    LC.data_source_config.setDefault(dsfilePath);
    // default MIME handlers are now set up in MockProvisioning constructor
    Provisioning.setInstance(new MockProvisioning());
}
Also used : FileNotFoundException(java.io.FileNotFoundException) MockProvisioning(com.zimbra.cs.account.MockProvisioning) File(java.io.File)

Example 12 with MockProvisioning

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

the class ParsedMessageTest method init.

@BeforeClass
public static void init() {
    System.setProperty("log4j.configuration", "log4j-test.properties");
    Provisioning.setInstance(new MockProvisioning());
}
Also used : MockProvisioning(com.zimbra.cs.account.MockProvisioning) BeforeClass(org.junit.BeforeClass)

Example 13 with MockProvisioning

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

the class DbMailboxTest method init.

@BeforeClass
public static void init() throws Exception {
    MailboxTestUtil.initServer();
    Provisioning.setInstance(new MockProvisioning());
    LC.zimbra_class_database.setDefault(HSQLDB.class.getName());
    DbPool.startup();
    HSQLDB.createDatabase();
}
Also used : MockProvisioning(com.zimbra.cs.account.MockProvisioning) BeforeClass(org.junit.BeforeClass)

Example 14 with MockProvisioning

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

the class LdapLockoutPolicyTest method init.

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

Example 15 with MockProvisioning

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

the class ModifyFilterRulesTest method init.

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

Aggregations

MockProvisioning (com.zimbra.cs.account.MockProvisioning)16 BeforeClass (org.junit.BeforeClass)14 DirectInsertionMailboxManager (com.zimbra.cs.service.mail.SendMsgTest.DirectInsertionMailboxManager)2 Account (com.zimbra.cs.account.Account)1 Config (com.zimbra.cs.account.Config)1 Provisioning (com.zimbra.cs.account.Provisioning)1 HSQLDB (com.zimbra.cs.db.HSQLDB)1 TextEnrichedHandler (com.zimbra.cs.mime.handler.TextEnrichedHandler)1 TextHtmlHandler (com.zimbra.cs.mime.handler.TextHtmlHandler)1 UnknownTypeHandler (com.zimbra.cs.mime.handler.UnknownTypeHandler)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 HashMap (java.util.HashMap)1 Before (org.junit.Before)1