Example usage for com.liferay.portal.kernel.util PortletKeys EXPORT_IMPORT

List of usage examples for com.liferay.portal.kernel.util PortletKeys EXPORT_IMPORT

Introduction

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

Prototype

String EXPORT_IMPORT

To view the source code for com.liferay.portal.kernel.util PortletKeys EXPORT_IMPORT.

Click Source Link

Usage

From source file:com.liferay.exportimport.test.ExportImportDateUtilTest.java

License:Open Source License

@Before
public void setUp() throws Exception {
    _group = GroupTestUtil.addGroup();//from ww w .  j  a va 2  s . com

    _layout = LayoutTestUtil.addLayout(_group);

    _layoutSet = _layout.getLayoutSet();

    _portletPreferences = PortletPreferencesFactoryUtil.getPortletSetup(_layout, PortletKeys.EXPORT_IMPORT,
            null);
}

From source file:com.liferay.exportimport.test.ExportImportDateUtilTest.java

License:Open Source License

@Test
public void testUpdateLastPublishDateFirstPublishPortlet() throws Exception {

    Date now = new Date();

    Date startDate = new Date(now.getTime() + Time.DAY);
    Date endDate = new Date(now.getTime() + Time.WEEK);

    DateRange dateRange = new DateRange(startDate, endDate);

    ExportImportDateUtil.updateLastPublishDate(PortletKeys.EXPORT_IMPORT, _portletPreferences, dateRange,
            endDate);/*from   w ww.ja v a 2s.c o  m*/

    Date lastPublishDate = ExportImportDateUtil.getLastPublishDate(_portletPreferences);

    // It should be null, since no update should have happened, because it
    // would result in a gap for contents

    Assert.assertNull(lastPublishDate);
}

From source file:com.liferay.exportimport.test.ExportImportDateUtilTest.java

License:Open Source License

@Test
public void testUpdateLastPublishDateOverlappingRangePortlet() throws Exception {

    Date now = new Date();

    updateLastPublishDate(_portletPreferences, now);

    Date startDate = new Date(now.getTime() - Time.DAY);
    Date endDate = new Date(now.getTime() + Time.WEEK);

    DateRange dateRange = new DateRange(startDate, endDate);

    ExportImportDateUtil.updateLastPublishDate(PortletKeys.EXPORT_IMPORT, _portletPreferences, dateRange,
            endDate);//w  w  w  . j a va  2 s  .  c  o m

    Date lastPublishDate = ExportImportDateUtil.getLastPublishDate(_portletPreferences);

    Assert.assertEquals(endDate.getTime(), lastPublishDate.getTime());
}

From source file:com.liferay.exportimport.test.ExportImportDateUtilTest.java

License:Open Source License

@Test
public void testUpdateLastPublishDateRangeBeforeLastPublishDatePortlet() throws Exception {

    Date now = new Date();

    updateLastPublishDate(_portletPreferences, now);

    Date startDate = new Date(now.getTime() - Time.WEEK);
    Date endDate = new Date(now.getTime() - Time.DAY);

    DateRange dateRange = new DateRange(startDate, endDate);

    ExportImportDateUtil.updateLastPublishDate(PortletKeys.EXPORT_IMPORT, _portletPreferences, dateRange,
            endDate);/*from w  ww  . j a  v  a 2  s.  com*/

    Date lastPublishDate = ExportImportDateUtil.getLastPublishDate(_portletPreferences);

    Assert.assertEquals(now.getTime(), lastPublishDate.getTime());
}

From source file:com.liferay.exportimport.test.ExportImportDateUtilTest.java

License:Open Source License

@Test
public void testUpdateLastPublishDateWithGapPortlet() throws Exception {
    Date now = new Date();

    updateLastPublishDate(_portletPreferences, now);

    Date startDate = new Date(now.getTime() + Time.DAY);
    Date endDate = new Date(now.getTime() + Time.WEEK);

    DateRange dateRange = new DateRange(startDate, endDate);

    ExportImportDateUtil.updateLastPublishDate(PortletKeys.EXPORT_IMPORT, _portletPreferences, dateRange,
            endDate);/* w  ww.  j a v a2s  .c  om*/

    Date lastPublishDate = ExportImportDateUtil.getLastPublishDate(_portletPreferences);

    Assert.assertEquals(now.getTime(), lastPublishDate.getTime());
}

From source file:com.liferay.exportimport.test.ExportImportDateUtilTest.java

License:Open Source License

@Test
public void testUpdateLastPublishDateWithoutExistingLastPublishDate() throws Exception {

    Date lastPublishDate = ExportImportDateUtil.getLastPublishDate(_portletPreferences);

    Assert.assertNull(lastPublishDate);//from w ww .j  av  a 2  s  . c  om

    Date now = new Date();

    DateRange dateRange = new DateRange(now, null);

    ExportImportDateUtil.updateLastPublishDate(PortletKeys.EXPORT_IMPORT, _portletPreferences, dateRange, now);

    lastPublishDate = ExportImportDateUtil.getLastPublishDate(_portletPreferences);

    Assert.assertNull(lastPublishDate);

    dateRange = new DateRange(null, now);

    ExportImportDateUtil.updateLastPublishDate(PortletKeys.EXPORT_IMPORT, _portletPreferences, dateRange, now);

    lastPublishDate = ExportImportDateUtil.getLastPublishDate(_portletPreferences);

    Assert.assertEquals(now, lastPublishDate);
}

From source file:com.liferay.exportimport.test.ExportImportDateUtilTest.java

License:Open Source License

@Test
public void testUpdateLastPublishDateWithoutGapPortlet() throws Exception {
    Date now = new Date();

    updateLastPublishDate(_portletPreferences, now);

    // Start date is exactly the last publish date

    Date startDate = new Date(now.getTime());
    Date endDate = new Date(now.getTime() + Time.WEEK);

    DateRange dateRange = new DateRange(startDate, endDate);

    ExportImportDateUtil.updateLastPublishDate(PortletKeys.EXPORT_IMPORT, _portletPreferences, dateRange,
            endDate);//from   w ww  . j a  va2s . com

    Date lastPublishDate = ExportImportDateUtil.getLastPublishDate(_portletPreferences);

    Assert.assertEquals(endDate.getTime(), lastPublishDate.getTime());

    updateLastPublishDate(_portletPreferences, now);

    // End date is exactly the last publish date

    startDate = new Date(now.getTime() - Time.WEEK);
    endDate = new Date(now.getTime());

    dateRange = new DateRange(startDate, endDate);

    ExportImportDateUtil.updateLastPublishDate(PortletKeys.EXPORT_IMPORT, _portletPreferences, dateRange,
            endDate);

    lastPublishDate = ExportImportDateUtil.getLastPublishDate(_portletPreferences);

    Assert.assertEquals(endDate.getTime(), lastPublishDate.getTime());
}

From source file:com.liferay.exportimport.web.internal.trash.ExportImportConfigurationTrashRenderer.java

License:Open Source License

@Override
public String getPortletId() {
    return PortletKeys.EXPORT_IMPORT;
}