Example usage for com.liferay.portal.util PropsValues STAGING_SYSTEM_EVENT_MAX_AGE

List of usage examples for com.liferay.portal.util PropsValues STAGING_SYSTEM_EVENT_MAX_AGE

Introduction

In this page you can find the example usage for com.liferay.portal.util PropsValues STAGING_SYSTEM_EVENT_MAX_AGE.

Prototype

int STAGING_SYSTEM_EVENT_MAX_AGE

To view the source code for com.liferay.portal.util PropsValues STAGING_SYSTEM_EVENT_MAX_AGE.

Click Source Link

Usage

From source file:com.liferay.exportimport.system.event.test.SystemEventCheckTest.java

License:Open Source License

public void doTestSystemEventCheck() throws Exception {
    _group = GroupTestUtil.addGroup();/*from  ww  w. j  a v a2  s.co m*/

    Calendar calendar = Calendar.getInstance();

    calendar.add(Calendar.HOUR, -PropsValues.STAGING_SYSTEM_EVENT_MAX_AGE - 1);

    Date createDate = calendar.getTime();

    List<SystemEvent> expiredSystemEvents = new LinkedList<>();

    for (int i = 0; i < 5; i++) {
        SystemEvent systemEvent = addSystemEvent();

        systemEvent.setCreateDate(createDate);

        SystemEventLocalServiceUtil.updateSystemEvent(systemEvent);

        expiredSystemEvents.add(systemEvent);
    }

    validate(expiredSystemEvents, false);

    List<SystemEvent> nonexpiredSystemEvents = new LinkedList<>();

    for (int i = 0; i < 7; i++) {
        nonexpiredSystemEvents.add(addSystemEvent());
    }

    validate(nonexpiredSystemEvents, false);

    SystemEventLocalServiceUtil.checkSystemEvents();

    if (PropsValues.STAGING_SYSTEM_EVENT_MAX_AGE <= 0) {
        validate(expiredSystemEvents, false);
    } else {
        validate(expiredSystemEvents, true);
    }

    validate(nonexpiredSystemEvents, false);
}

From source file:com.liferay.exportimport.system.event.test.SystemEventCheckTest.java

License:Open Source License

@Test
public void testSystemEventCheckWithMaxAge0() throws Exception {
    int stagingSystemEventMaxAge = PropsValues.STAGING_SYSTEM_EVENT_MAX_AGE;

    setPortalProperty("STAGING_SYSTEM_EVENT_MAX_AGE", 0);

    doTestSystemEventCheck();/*w  w w .  ja va2  s  .c  o m*/

    setPortalProperty("STAGING_SYSTEM_EVENT_MAX_AGE", stagingSystemEventMaxAge);
}

From source file:com.liferay.exportimport.system.event.test.SystemEventCheckTest.java

License:Open Source License

@Test
public void testSystemEventCheckWithMaxAge1() throws Exception {
    int stagingSystemEventMaxAge = PropsValues.STAGING_SYSTEM_EVENT_MAX_AGE;

    setPortalProperty("STAGING_SYSTEM_EVENT_MAX_AGE", 1);

    doTestSystemEventCheck();/*from w w w  .  j  a  v a 2s  .  c o m*/

    setPortalProperty("STAGING_SYSTEM_EVENT_MAX_AGE", stagingSystemEventMaxAge);
}