Example usage for org.springframework.session.data.gemfire.config.annotation.web.http GemFireHttpSessionConfiguration DEFAULT_MAX_INACTIVE_INTERVAL_IN_SECONDS

List of usage examples for org.springframework.session.data.gemfire.config.annotation.web.http GemFireHttpSessionConfiguration DEFAULT_MAX_INACTIVE_INTERVAL_IN_SECONDS

Introduction

In this page you can find the example usage for org.springframework.session.data.gemfire.config.annotation.web.http GemFireHttpSessionConfiguration DEFAULT_MAX_INACTIVE_INTERVAL_IN_SECONDS.

Prototype

int DEFAULT_MAX_INACTIVE_INTERVAL_IN_SECONDS

To view the source code for org.springframework.session.data.gemfire.config.annotation.web.http GemFireHttpSessionConfiguration DEFAULT_MAX_INACTIVE_INTERVAL_IN_SECONDS.

Click Source Link

Document

Default maximum interval in seconds in which a Session can remain inactive before it expires.

Usage

From source file:org.springframework.session.data.gemfire.AbstractGemFireOperationsSessionRepositoryTest.java

@Test
@SuppressWarnings("unchecked")
public void gemfireOperationsSessionRepositoryIsProperlyConstructedAndInitialized() throws Exception {
    ApplicationEventPublisher mockApplicationEventPublisher = mock(ApplicationEventPublisher.class);
    AttributesMutator<Object, ExpiringSession> mockAttributesMutator = mock(AttributesMutator.class);
    Region<Object, ExpiringSession> mockRegion = mock(Region.class);

    given(mockRegion.getFullPath()).willReturn("/Example");
    given(mockRegion.getAttributesMutator()).willReturn(mockAttributesMutator);

    GemfireTemplate template = new GemfireTemplate(mockRegion);

    AbstractGemFireOperationsSessionRepository sessionRepository = new TestGemFireOperationsSessionRepository(
            template);/* w w  w . java  2 s.  com*/

    ApplicationEventPublisher applicationEventPublisher = sessionRepository.getApplicationEventPublisher();

    assertThat(applicationEventPublisher).isNotNull();
    assertThat(sessionRepository.getFullyQualifiedRegionName()).isNull();
    assertThat(sessionRepository.getMaxInactiveIntervalInSeconds())
            .isEqualTo(GemFireHttpSessionConfiguration.DEFAULT_MAX_INACTIVE_INTERVAL_IN_SECONDS);
    assertThat(sessionRepository.getTemplate()).isSameAs(template);

    sessionRepository.setApplicationEventPublisher(mockApplicationEventPublisher);
    sessionRepository.setMaxInactiveIntervalInSeconds(300);
    sessionRepository.afterPropertiesSet();

    assertThat(sessionRepository.getApplicationEventPublisher()).isSameAs(mockApplicationEventPublisher);
    assertThat(sessionRepository.getFullyQualifiedRegionName()).isEqualTo("/Example");
    assertThat(sessionRepository.getMaxInactiveIntervalInSeconds()).isEqualTo(300);
    assertThat(sessionRepository.getTemplate()).isSameAs(template);

    verify(mockRegion, times(1)).getAttributesMutator();
    verify(mockRegion, times(1)).getFullPath();
    verify(mockAttributesMutator, times(1)).addCacheListener(same(sessionRepository));
}

From source file:org.springframework.session.data.gemfire.AbstractGemFireOperationsSessionRepositoryTest.java

@Test
public void maxInactiveIntervalInSecondsAllowsNegativeValuesAndExtremelyLargeValues() {
    assertThat(this.sessionRepository.getMaxInactiveIntervalInSeconds())
            .isEqualTo(GemFireHttpSessionConfiguration.DEFAULT_MAX_INACTIVE_INTERVAL_IN_SECONDS);

    this.sessionRepository.setMaxInactiveIntervalInSeconds(-1);

    assertThat(this.sessionRepository.getMaxInactiveIntervalInSeconds()).isEqualTo(-1);

    this.sessionRepository.setMaxInactiveIntervalInSeconds(Integer.MIN_VALUE);

    assertThat(this.sessionRepository.getMaxInactiveIntervalInSeconds()).isEqualTo(Integer.MIN_VALUE);

    this.sessionRepository.setMaxInactiveIntervalInSeconds(3600);

    assertThat(this.sessionRepository.getMaxInactiveIntervalInSeconds()).isEqualTo(3600);

    this.sessionRepository.setMaxInactiveIntervalInSeconds(Integer.MAX_VALUE);

    assertThat(this.sessionRepository.getMaxInactiveIntervalInSeconds()).isEqualTo(Integer.MAX_VALUE);
}