List of usage examples for java.util TimeZone setDefault
public static void setDefault(TimeZone zone)
From source file:org.pentaho.reporting.engine.classic.core.testsupport.gold.GoldTestBase.java
@Before public void setUp() throws Exception { Locale.setDefault(Locale.US); TimeZone.setDefault(TimeZone.getTimeZone("UTC")); // enforce binary compatibility for the xml-files so that comparing them can be faster. ClassicEngineBoot.getInstance().start(); if (NamingManager.hasInitialContextFactoryBuilder() == false) { NamingManager.setInitialContextFactoryBuilder(new DebugJndiContextFactoryBuilder()); }//from w w w.j a va2s . com localFontRegistry = new LocalFontRegistry(); localFontRegistry.initialize(); }
From source file:org.enerj.apache.commons.collections.TestFactoryUtils.java
public void testInstantiateFactoryComplex() { TimeZone.setDefault(TimeZone.getTimeZone("GMT")); // 2nd Jan 1970 Factory factory = FactoryUtils.instantiateFactory(Date.class, new Class[] { Integer.TYPE, Integer.TYPE, Integer.TYPE }, new Object[] { new Integer(70), new Integer(0), new Integer(2) }); assertNotNull(factory);/*from w w w .ja v a2s. c o m*/ Object created = factory.create(); assertTrue(created instanceof Date); // long time of 1 day (== 2nd Jan 1970) assertEquals(new Date(1000 * 60 * 60 * 24), created); }
From source file:azkaban.webapp.AzkabanWebServer.java
/** * Constructor/*from w ww.j av a2s. c o m*/ */ public AzkabanWebServer(Server server, Props props) throws Exception { this.props = props; this.server = server; velocityEngine = configureVelocityEngine(props.getBoolean(VELOCITY_DEV_MODE_PARAM, false)); sessionCache = new SessionCache(props); userManager = loadUserManager(props); alerters = loadAlerters(props); executorManager = loadExecutorManager(props); projectManager = loadProjectManager(props); triggerManager = loadTriggerManager(props); loadBuiltinCheckersAndActions(); // load all trigger agents here scheduleManager = loadScheduleManager(triggerManager, props); String triggerPluginDir = props.getString("trigger.plugin.dir", "plugins/triggers"); loadPluginCheckersAndActions(triggerPluginDir); baseClassLoader = this.getClassLoader(); tempDir = new File(props.getString("azkaban.temp.dir", "temp")); // Setup time zone if (props.containsKey(DEFAULT_TIMEZONE_ID)) { String timezone = props.getString(DEFAULT_TIMEZONE_ID); System.setProperty("user.timezone", timezone); TimeZone.setDefault(TimeZone.getTimeZone(timezone)); DateTimeZone.setDefault(DateTimeZone.forID(timezone)); logger.info("Setting timezone to " + timezone); } configureMBeanServer(); }
From source file:org.jfree.data.time.junit.MillisecondTest.java
/** * Some checks for the getLastMillisecond() method. */// ww w . j av a 2 s .co m public void testGetLastMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Millisecond m = new Millisecond(750, 1, 1, 1, 1, 1, 1970); assertEquals(61750L, m.getLastMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }
From source file:org.jfree.data.time.MonthTest.java
/** * Some checks for the getLastMillisecond() method. */// w w w. j a va2 s . c o m @Test public void testGetLastMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Month m = new Month(3, 1970); assertEquals(7772399999L, m.getLastMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }
From source file:org.jfree.data.time.DayTest.java
/** * Some checks for the getLastMillisecond() method. *//*ww w .j a v a 2 s . c o m*/ @Test public void testGetLastMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Day d = new Day(1, 1, 1970); assertEquals(82799999L, d.getLastMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }
From source file:org.jfree.data.time.junit.HourTest.java
/** * Some checks for the getLastMillisecond() method. *///from w w w . j av a 2s . c om public void testGetLastMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Hour h = new Hour(1, 1, 1, 1970); assertEquals(3599999L, h.getLastMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }
From source file:org.jfree.data.time.MinuteTest.java
/** * Some checks for the getStart() method. *//* w w w. j a v a 2 s . com*/ @Test public void testGetStart() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.ITALY); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/Rome")); Calendar cal = Calendar.getInstance(Locale.ITALY); cal.set(2006, Calendar.JANUARY, 16, 3, 47, 0); cal.set(Calendar.MILLISECOND, 0); Minute m = new Minute(47, 3, 16, 1, 2006); assertEquals(cal.getTime(), m.getStart()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }
From source file:org.activequant.util.charting.IntradayMarketTimeline.java
public static void main(String[] args) { TimeZone.setDefault(TimeZone.getTimeZone("GMT")); IntradayMarketTimeline testedObject = new IntradayMarketTimeline(0L, 0L, 34200000L, 57600000L, 34200000L, 57600000L, 34200000L, 57600000L, 34200000L, 57600000L, 34200000L, 57600000L, 0L, 0L); //one week + 1 day + 10:48am //604800000// w w w. ja va 2 s .c om //86400000 System.out.println("millisecond -> timeline" + Long.toString( IntradayMarketTimeline.MILLIS_PER_DAY + IntradayMarketTimeline.MILLIS_PER_WEEK + +38880000L)); //leads to 121680000 milliseconds in timeline time System.out.println(Long.toString(testedObject.toTimelineValue( IntradayMarketTimeline.MILLIS_PER_DAY + IntradayMarketTimeline.MILLIS_PER_WEEK + +38880000L))); System.out.println("timeline -> millisecond " + Long.toString(testedObject.toMillisecond(145080000L))); }
From source file:org.jfree.data.time.QuarterTest.java
/** * Some checks for the getLastMillisecond() method. *//*from w ww .j a v a 2 s .c o m*/ @Test public void testGetLastMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Quarter q = new Quarter(3, 1970); assertEquals(23583599999L, q.getLastMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }