Package org.wildfly.clustering.web.infinispan.session

Examples of org.wildfly.clustering.web.infinispan.session.SimpleSessionMetaData


import static org.junit.Assert.*;

public class SimpleSessionMetaDataTestCase {
    @Test
    public void isNew() {
        SessionMetaData metaData = new SimpleSessionMetaData();
        assertTrue(metaData.isNew());

        metaData.setLastAccessedTime(new Date());
        assertFalse(metaData.isNew());

        metaData = new SimpleSessionMetaData(new Date(), new Date(), new Time(0, TimeUnit.SECONDS));
        assertFalse(metaData.isNew());
    }
View Full Code Here


        assertFalse(metaData.isNew());
    }

    @Test
    public void isExpired() {
        SessionMetaData metaData = new SimpleSessionMetaData();
        assertFalse(metaData.isExpired());

        Date now = new Date();

        metaData.setMaxInactiveInterval(1, TimeUnit.MINUTES);
        assertFalse(metaData.isExpired());

        metaData.setLastAccessedTime(new Date(now.getTime() - metaData.getMaxInactiveInterval(TimeUnit.MILLISECONDS) - 1));
        assertTrue(metaData.isExpired());
    }
View Full Code Here

        return cache.get(id);
    }

    @Override
    public FineSessionCacheEntry<L> createValue(String id) {
        FineSessionCacheEntry<L> entry = new FineSessionCacheEntry<>(new SimpleSessionMetaData());
        FineSessionCacheEntry<L> existing = this.sessionCache.getAdvancedCache().withFlags(Flag.FORCE_SYNCHRONOUS).putIfAbsent(id, entry);
        return (existing != null) ? existing : entry;
    }
View Full Code Here

        return new InfinispanImmutableSession(id, metaData, attributes, this.context);
    }

    @Override
    public CoarseSessionEntry<L> createValue(String id) {
        CoarseSessionCacheEntry<L> entry = new CoarseSessionCacheEntry<>(new SimpleSessionMetaData());
        CoarseSessionCacheEntry<L> existingEntry = this.sessionCache.getAdvancedCache().withFlags(Flag.FORCE_SYNCHRONOUS).putIfAbsent(id, entry);
        if (existingEntry != null) {
            MarshalledValue<Map<String, Object>, MarshallingContext> value = this.attributesCache.get(new SessionAttributesCacheKey(id));
            return new CoarseSessionEntry<>(existingEntry, value);
        }
View Full Code Here

TOP

Related Classes of org.wildfly.clustering.web.infinispan.session.SimpleSessionMetaData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.