Example usage for com.liferay.portal.kernel.util TimeZoneUtil GMT

List of usage examples for com.liferay.portal.kernel.util TimeZoneUtil GMT

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util TimeZoneUtil GMT.

Prototype

TimeZone GMT

To view the source code for com.liferay.portal.kernel.util TimeZoneUtil GMT.

Click Source Link

Usage

From source file:com.liferay.calendar.test.util.RecurrenceTestUtil.java

License:Open Source License

public static Recurrence getDailyRecurrence() {
    return getDailyRecurrence(0, TimeZoneUtil.GMT, null);
}

From source file:com.liferay.calendar.test.util.RecurrenceTestUtil.java

License:Open Source License

public static Recurrence getDailyRecurrence(int count) {
    return getDailyRecurrence(count, TimeZoneUtil.GMT, null);
}

From source file:com.liferay.calendar.test.util.RecurrenceTestUtil.java

License:Open Source License

public static Recurrence getDailyRecurrence(java.util.Calendar untilJCalendar) {

    return getDailyRecurrence(0, TimeZoneUtil.GMT, untilJCalendar);
}

From source file:com.liferay.calendar.util.JCalendarUtilTest.java

License:Open Source License

@Test
public void testGetDSTShiftAtLosAngelesDuringDST() {
    Calendar jCalendar1 = JCalendarUtil.getJCalendar(2012, Calendar.MAY, 1, 12, 0, 0, 0, TimeZoneUtil.GMT);
    Calendar jCalendar2 = JCalendarUtil.getJCalendar(2013, Calendar.JULY, 2, 12, 0, 0, 0, TimeZoneUtil.GMT);

    int shift = JCalendarUtil.getDSTShift(jCalendar1, jCalendar2, _losAngelesTimeZone);

    Assert.assertEquals(0, shift);//from w ww.j  a v  a 2  s . c  o m
}

From source file:com.liferay.calendar.util.JCalendarUtilTest.java

License:Open Source License

@Test
public void testGetDSTShiftAtLosAngelesDuringNoDST() {
    Calendar jCalendar1 = JCalendarUtil.getJCalendar(2013, Calendar.DECEMBER, 1, 12, 0, 0, 0, TimeZoneUtil.GMT);
    Calendar jCalendar2 = JCalendarUtil.getJCalendar(2013, Calendar.JANUARY, 2, 12, 0, 0, 0, TimeZoneUtil.GMT);

    int shift = JCalendarUtil.getDSTShift(jCalendar1, jCalendar2, _losAngelesTimeZone);

    Assert.assertEquals(0, shift);// w  w  w.  j a va 2s .  c om
}

From source file:com.liferay.calendar.util.JCalendarUtilTest.java

License:Open Source License

@Test
public void testGetDSTShiftAtLosAngelesFromDSTToNoDST() {
    Calendar jCalendar1 = JCalendarUtil.getJCalendar(2013, Calendar.JULY, 1, 12, 0, 0, 0, TimeZoneUtil.GMT);
    Calendar jCalendar2 = JCalendarUtil.getJCalendar(2013, Calendar.JANUARY, 1, 12, 0, 0, 0, TimeZoneUtil.GMT);

    int shift = JCalendarUtil.getDSTShift(jCalendar1, jCalendar2, _losAngelesTimeZone);

    Assert.assertEquals(JCalendarUtil.HOUR, shift);
}

From source file:com.liferay.calendar.util.JCalendarUtilTest.java

License:Open Source License

@Test
public void testGetDSTShiftAtLosAngelesFromNoDSTToDST() {
    Calendar jCalendar1 = JCalendarUtil.getJCalendar(2013, Calendar.JANUARY, 1, 12, 0, 0, 0, TimeZoneUtil.GMT);
    Calendar jCalendar2 = JCalendarUtil.getJCalendar(2013, Calendar.JULY, 1, 12, 0, 0, 0, TimeZoneUtil.GMT);

    int shift = JCalendarUtil.getDSTShift(jCalendar1, jCalendar2, _losAngelesTimeZone);

    Assert.assertEquals(-1 * JCalendarUtil.HOUR, shift);
}

From source file:com.liferay.exportimport.lifecycle.test.ExportImportLifecycleEventTest.java

License:Open Source License

@Test
public void testFailedLayoutExport() throws Exception {
    Map<String, Serializable> exportLayoutSettingsMap = ExportImportConfigurationSettingsMapFactory
            .buildExportLayoutSettingsMap(TestPropsValues.getUserId(), 0, false, new long[0], _parameterMap,
                    Locale.US, TimeZoneUtil.GMT);

    ExportImportConfiguration exportImportConfiguration = ExportImportConfigurationLocalServiceUtil
            .addDraftExportImportConfiguration(TestPropsValues.getUserId(),
                    ExportImportConfigurationConstants.TYPE_EXPORT_LAYOUT, exportLayoutSettingsMap);

    try {// w  w w  . j  ava 2 s  .co m
        ExportImportLocalServiceUtil.exportLayoutsAsFile(exportImportConfiguration);

        Assert.fail();
    } catch (NoSuchGroupException nsge) {
        Assert.assertEquals("No Group exists with the primary key 0", nsge.getMessage());
    } catch (NoSuchLayoutSetException nslse) {
        Assert.assertEquals("No LayoutSet exists with the key {groupId=0, " + "privateLayout=false}",
                nslse.getMessage());
    }

    Assert.assertTrue(_firedExportImportLifecycleEventsMap
            .containsKey(ExportImportLifecycleConstants.EVENT_LAYOUT_EXPORT_FAILED));
}

From source file:com.liferay.exportimport.lifecycle.test.ExportImportLifecycleEventTest.java

License:Open Source License

@Test
public void testFailedLayoutImport() throws Exception {
    Map<String, Serializable> importLayoutSettingsMap = ExportImportConfigurationSettingsMapFactory
            .buildImportLayoutSettingsMap(TestPropsValues.getUserId(), 0, false, new long[0], _parameterMap,
                    Locale.US, TimeZoneUtil.GMT);

    ExportImportConfiguration exportImportConfiguration = ExportImportConfigurationLocalServiceUtil
            .addDraftExportImportConfiguration(TestPropsValues.getUserId(),
                    ExportImportConfigurationConstants.TYPE_IMPORT_LAYOUT, importLayoutSettingsMap);

    try {/*from w w w. j av a  2 s  .c  o  m*/
        ExportImportLocalServiceUtil.importLayouts(exportImportConfiguration, (File) null);

        Assert.fail();
    } catch (NoSuchGroupException nsge) {
        Assert.assertEquals("No Group exists with the primary key 0", nsge.getMessage());
    }

    Assert.assertTrue(_firedExportImportLifecycleEventsMap
            .containsKey(ExportImportLifecycleConstants.EVENT_LAYOUT_IMPORT_FAILED));
}

From source file:com.liferay.exportimport.lifecycle.test.ExportImportLifecycleEventTest.java

License:Open Source License

@Test
public void testFailedPortletExport() throws Exception {
    long plid = RandomTestUtil.nextLong();

    Map<String, Serializable> exportPortletSettingsMap = ExportImportConfigurationSettingsMapFactory
            .buildExportPortletSettingsMap(TestPropsValues.getUserId(), plid, _group.getGroupId(),
                    StringPool.BLANK, _parameterMap, Locale.US, TimeZoneUtil.GMT, StringPool.BLANK);

    ExportImportConfiguration exportImportConfiguration = ExportImportConfigurationLocalServiceUtil
            .addDraftExportImportConfiguration(TestPropsValues.getUserId(),
                    ExportImportConfigurationConstants.TYPE_EXPORT_PORTLET, exportPortletSettingsMap);

    try {/*  ww  w . ja v  a 2  s .com*/
        ExportImportLocalServiceUtil.exportPortletInfoAsFile(exportImportConfiguration);

        Assert.fail();
    } catch (NoSuchLayoutException nsle) {
        Assert.assertEquals("No Layout exists with the primary key " + plid, nsle.getMessage());
    }

    Assert.assertTrue(_firedExportImportLifecycleEventsMap
            .containsKey(ExportImportLifecycleConstants.EVENT_PORTLET_EXPORT_FAILED));
}