Search in sources :

Example 26 with InMemoryCacheManager

use of org.ff4j.cache.InMemoryCacheManager in project ff4j by ff4j.

the class InMemoryCacheTest method testGetFeatureTimeout.

@Test
public void testGetFeatureTimeout() throws InterruptedException {
    InMemoryCacheManager imcm = new InMemoryCacheManager();
    imcm.putFeature(new Feature("f2"), 1);
    Thread.sleep(1100);
    Assert.assertNull(imcm.getFeature("f2"));
}
Also used : InMemoryCacheManager(org.ff4j.cache.InMemoryCacheManager) Feature(org.ff4j.core.Feature) Test(org.junit.Test)

Example 27 with InMemoryCacheManager

use of org.ff4j.cache.InMemoryCacheManager in project ff4j by ff4j.

the class InMemoryCacheTest method testClear.

@Test
public void testClear() {
    // Given
    InMemoryCacheManager imcm = new InMemoryCacheManager();
    imcm.putProperty(new PropertyString("p1"));
    Assert.assertFalse(imcm.listCachedPropertyNames().isEmpty());
    // When
    imcm.clearProperties();
    // Then
    Assert.assertTrue(imcm.listCachedPropertyNames().isEmpty());
}
Also used : PropertyString(org.ff4j.property.PropertyString) InMemoryCacheManager(org.ff4j.cache.InMemoryCacheManager) Test(org.junit.Test)

Example 28 with InMemoryCacheManager

use of org.ff4j.cache.InMemoryCacheManager in project ff4j by ff4j.

the class InMemoryCacheTest method testPutNullFeatureId1.

@Test(expected = IllegalArgumentException.class)
public void testPutNullFeatureId1() {
    Feature f = new Feature("a");
    f.setUid(null);
    new InMemoryCacheManager().putFeature(f, 1);
}
Also used : InMemoryCacheManager(org.ff4j.cache.InMemoryCacheManager) Feature(org.ff4j.core.Feature) Test(org.junit.Test)

Example 29 with InMemoryCacheManager

use of org.ff4j.cache.InMemoryCacheManager in project ff4j by ff4j.

the class FF4jTest method testInitCache.

@Test
public void testInitCache() {
    FF4j ff4j = new FF4j();
    ff4j.cache(new InMemoryCacheManager());
}
Also used : InMemoryCacheManager(org.ff4j.cache.InMemoryCacheManager) FF4j(org.ff4j.FF4j) Test(org.junit.Test)

Aggregations

InMemoryCacheManager (org.ff4j.cache.InMemoryCacheManager)29 Test (org.junit.Test)24 PropertyString (org.ff4j.property.PropertyString)11 FF4jCacheProxy (org.ff4j.cache.FF4jCacheProxy)9 Feature (org.ff4j.core.Feature)7 Given (cucumber.api.java.en.Given)5 InMemoryFeatureStore (org.ff4j.store.InMemoryFeatureStore)4 InMemoryPropertyStore (org.ff4j.property.store.InMemoryPropertyStore)3 HashSet (java.util.HashSet)2 FF4j (org.ff4j.FF4j)2 FF4JCacheManager (org.ff4j.cache.FF4JCacheManager)2 PropertyStoreAuditProxy (org.ff4j.audit.proxy.PropertyStoreAuditProxy)1 Store2CachePollingScheduler (org.ff4j.cache.Store2CachePollingScheduler)1 FeatureStore (org.ff4j.core.FeatureStore)1 Property (org.ff4j.property.Property)1 PropertyLogLevel (org.ff4j.property.PropertyLogLevel)1 PropertyStore (org.ff4j.property.store.PropertyStore)1 AbstractCacheManagerJUnitTest (org.ff4j.test.cache.AbstractCacheManagerJUnitTest)1