Search in sources :

Example 1 with Configuration

use of org.projectforge.framework.configuration.Configuration in project projectforge by micromata.

the class AbstractTestBase method recreateDataBase.

/**
 * Will be called once (BeforeClass). You may it call in your test to get a fresh database in your test class for your
 * method.
 */
public void recreateDataBase() {
    System.setProperty("user.timezone", "UTC");
    TimeZone.setDefault(DateHelper.UTC);
    Locale.setDefault(Locale.ENGLISH);
    baseLog.info("user.timezone is: " + System.getProperty("user.timezone"));
    final JdbcTemplate jdbc = new JdbcTemplate(dataSource);
    try {
        jdbc.execute("CHECKPOINT DEFRAG");
    } catch (final org.springframework.jdbc.BadSqlGrammarException ex) {
    // ignore
    }
    clearDatabase();
    new Configuration(configurationService);
    ConfigXmlTest.createTestConfiguration();
    Registry.getInstance().init(applicationContext);
    try {
        initDb();
    } catch (BeansException e) {
        baseLog.error("Something in setUp go wrong: " + e.getMessage(), e);
    }
    return;
}
Also used : ContextConfiguration(org.springframework.test.context.ContextConfiguration) Configuration(org.projectforge.framework.configuration.Configuration) JdbcTemplate(org.springframework.jdbc.core.JdbcTemplate) BeansException(org.springframework.beans.BeansException)

Example 2 with Configuration

use of org.projectforge.framework.configuration.Configuration in project projectforge by micromata.

the class TeamEventDaoTest method setUp.

@BeforeEach
public void setUp() {
    final String domain = "projectforge.org";
    final Configuration config = Configuration.getInstance();
    config.forceReload();
    config.putParameterManual(ConfigurationParam.CALENDAR_DOMAIN, domain);
}
Also used : Configuration(org.projectforge.framework.configuration.Configuration) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

Configuration (org.projectforge.framework.configuration.Configuration)2 BeforeEach (org.junit.jupiter.api.BeforeEach)1 BeansException (org.springframework.beans.BeansException)1 JdbcTemplate (org.springframework.jdbc.core.JdbcTemplate)1 ContextConfiguration (org.springframework.test.context.ContextConfiguration)1