Example usage for java.util TimeZone setDefault

List of usage examples for java.util TimeZone setDefault

Introduction

In this page you can find the example usage for java.util TimeZone setDefault.

Prototype

public static void setDefault(TimeZone zone) 

Source Link

Document

Sets the TimeZone that is returned by the getDefault method.

Usage

From source file:org.osgpfoundation.osgp.webdemoapp.application.config.WebDemoInitializer.java

@Override
public void onStartup(final ServletContext servletContext) throws ServletException {
    try {/*from  w  ww .  j a v a2s  .co  m*/
        TimeZone.setDefault(TimeZone.getTimeZone("UTC"));

        final Context initialContext = new InitialContext();

        final AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
        rootContext.register(ApplicationContext.class);

        final ServletRegistration.Dynamic dispatcher = servletContext.addServlet(DISPATCHER_SERVLET_NAME,
                new DispatcherServlet(rootContext));
        dispatcher.setLoadOnStartup(1);
        dispatcher.addMapping(DISPATCHER_SERVLET_MAPPING);

        servletContext.addListener(new ContextLoaderListener(rootContext));
    } catch (final NamingException e) {
        throw new ServletException("naming exception", e);
    }
}

From source file:org.wte4j.FormatDateExpressionTest.java

@AfterClass
public static void resetDefaulTimeZone() {
    TimeZone.setDefault(STARTUP_TIMEZONE);
}

From source file:com.appglu.impl.AbstractAppGluApiTest.java

@Before
public void setup() {
    /* Setting time zone to GMT+0 avoiding time zone issues in tests */
    TimeZone gmt = TimeZone.getTimeZone("GMT");
    TimeZone.setDefault(gmt);

    appGluTemplate = createAppGluTemplate();

    mockServer = MockRestServiceServer.createServer(appGluTemplate.getRestTemplate());

    responseHeaders = new HttpHeaders();
    responseHeaders.setContentType(jsonMediaType);
}

From source file:com.alliander.osgp.webdevicesimulator.application.config.WebDeviceSimulatorInitializer.java

@Override
public void onStartup(final ServletContext servletContext) throws ServletException {
    try {// w w w .ja  v  a 2  s.c o  m
        // Force the timezone of application to UTC (required for
        // Hibernate/JDBC)
        TimeZone.setDefault(TimeZone.getTimeZone("UTC"));

        final Context initialContext = new InitialContext();

        final String logLocation = (String) initialContext
                .lookup("java:comp/env/osp/webDeviceSimulator/log-config");
        LogbackConfigurer.initLogging(logLocation);
        InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory());

        final AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
        rootContext.register(ApplicationContext.class);

        final ServletRegistration.Dynamic dispatcher = servletContext.addServlet(DISPATCHER_SERVLET_NAME,
                new DispatcherServlet(rootContext));
        dispatcher.setLoadOnStartup(1);
        dispatcher.addMapping(DISPATCHER_SERVLET_MAPPING);

        servletContext.addListener(new ContextLoaderListener(rootContext));
    } catch (final NamingException e) {
        throw new ServletException("naming exception", e);
    } catch (final FileNotFoundException e) {
        throw new ServletException("Logging file not found", e);
    } catch (final JoranException e) {
        throw new ServletException("Logback exception", e);
    }
}

From source file:org.sipfoundry.sipxconfig.rest.VoicemailResourceTest.java

@Override
protected void setUp() throws Exception {
    m_timeZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
}

From source file:org.apache.apex.malhar.sql.sample.FusionStyleSQLApplicationTest.java

@Before
public void setUp() throws Exception {
    defaultTZ = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("GMT"));

    kafka = new EmbeddedKafka();
    kafka.start();//  w w  w .  j av a 2 s  .  c o m
    kafka.createTopic(testTopicData);
    kafka.createTopic(testTopicResult);

    outputFolder += testName.getMethodName() + "/";
}

From source file:net.audumla.astronomy.algorithims.AstronomicalTest.java

@After
public void tearDown() throws Exception {
    TimeZone.setDefault(deftz);
}

From source file:org.dspace.content.DCDateTest.java

/**
 * This method will be run before every test as per @Before. It will
 * initialize resources required for the tests.
 *
 * Other methods can be annotated with @Before here or in subclasses
 * but no execution order is guaranteed/*from   w w w.j a v  a2 s. c om*/
 */
@Before
@Override
public void init() {
    super.init();
    TimeZone.setDefault(TimeZone.getTimeZone("GMT-8"));
}

From source file:com.github.rnewson.couchdb.lucene.DocumentConverterTest.java

@Before
public void setup() {
    context = Context.enter();
    tz = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
}

From source file:org.sipfoundry.sipxconfig.rest.VoicemailResourceTest.java

@Override
protected void tearDown() throws Exception {
    TimeZone.setDefault(m_timeZone);
    SecurityContextHolder.getContext().setAuthentication(null);
}