@BeforeClass public static void setUp() { // Needed if this tests runs before the ConfigurationTest. ConfigXmlTest.createTestConfiguration(); }
@Test public void testExport() { createTestConfiguration(); String exported_config = ConfigXml.getInstance().exportConfiguration(); String expected_config_without_posix = getConfigXML(false); String expected_config_with_posix = getConfigXML(true); // on windows other pathes may be used. expected_config_without_posix = StringUtils.replace(expected_config_without_posix, "\\", "/"); expected_config_with_posix = StringUtils.replace(expected_config_with_posix, "\\", "/"); exported_config = StringUtils.replace(exported_config, "\\", "/"); boolean equalsWithoutPosix = expected_config_without_posix.equals(exported_config); boolean equalsWithPosix = expected_config_with_posix.equals(exported_config); boolean equals = equalsWithoutPosix | equalsWithPosix; assertTrue("Exported config is not as expected.", equals); }
@BeforeClass public static void setUp() { // Needed if this tests runs before the ConfigurationTest. ConfigXmlTest.createTestConfiguration(); }
@BeforeClass public static void setUp() { // Needed if this tests runs before the ConfigurationTest. ConfigXmlTest.createTestConfiguration(); }
@BeforeClass public static void setUp() { // Needed if this tests runs before the ConfigurationTest. ConfigXmlTest.createTestConfiguration(); }
@BeforeClass public static void setUpThisTest() { // Needed if this tests runs before the ConfigurationTest. ConfigXmlTest.createTestConfiguration(); }
@BeforeClass public static void setUp() { ConfigXmlTest.createTestConfiguration(); }
@Override @BeforeClass public void setUp() { super.setUp(); ConfigXmlTest.createTestConfiguration(); }
@BeforeClass public void setUp() { System.setProperty("user.timezone", "UTC"); TimeZone.setDefault(DateHelper.UTC); log.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(); initDatabaseDao.insertDefaultTenant(); GlobalConfiguration.createConfiguration(configurationService); TenantRegistryMap tenantRegistryMap = TenantRegistryMap.getInstance(); tenantRegistryMap.setApplicationContext(applicationContext); ConfigXmlTest.createTestConfiguration(); Registry.getInstance().init(applicationContext); try { initDb(); } catch (BeansException e) { log.error("Something in setUp go wrong: " + e.getMessage(), e); } }
@Test public void testHolidayDefinition() { createTestConfiguration(); final ConfigXml config = ConfigXml.getInstance(); assertEquals(5, config.getHolidays().size()); ConfigureHoliday holiday = config.getHolidays().get(0); assertEquals(Calendar.MAY, (int) holiday.getMonth()); holiday = config.getHolidays().get(2); assertEquals(HolidayDefinition.XMAS_EVE, holiday.getId()); holiday = config.getHolidays().get(3); assertEquals(HolidayDefinition.SHROVE_TUESDAY, holiday.getId()); assertEquals(true, holiday.isIgnore()); final Holidays holidays = Holidays.getInstance(); final Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, 2009); cal.set(Calendar.MONTH, Calendar.MAY); cal.set(Calendar.DAY_OF_MONTH, 1); assertEquals("Should be there.", true, holidays.isHoliday(2009, cal.get(Calendar.DAY_OF_YEAR))); cal.set(Calendar.MONTH, Calendar.FEBRUARY); cal.set(Calendar.DAY_OF_MONTH, 23); assertEquals("Should be there.", true, holidays.isHoliday(2009, cal.get(Calendar.DAY_OF_YEAR))); cal.set(Calendar.DAY_OF_MONTH, 24); assertEquals("Should be ignored.", false, holidays.isHoliday(2009, cal.get(Calendar.DAY_OF_YEAR))); }