Search in sources :

Example 6 with InMemoryCacheManager

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

the class InMemoryCacheTest method testAccessors.

@Test
public void testAccessors() {
    InMemoryCacheManager imcm = new InMemoryCacheManager();
    Assert.assertNotNull(imcm.getCacheProviderName());
    Assert.assertTrue(imcm.listCachedFeatureNames().isEmpty());
    Assert.assertTrue(imcm.listCachedPropertyNames().isEmpty());
}
Also used : InMemoryCacheManager(org.ff4j.cache.InMemoryCacheManager) Test(org.junit.Test)

Example 7 with InMemoryCacheManager

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

the class InMemoryCacheTest method testExistBis.

@Test
public void testExistBis() {
    FF4jCacheProxy fscp = new FF4jCacheProxy(new InMemoryFeatureStore("ff4j.xml"), null, new InMemoryCacheManager());
    Assert.assertFalse(fscp.exist("toto"));
    Assert.assertFalse(fscp.exist("toto"));
    Assert.assertTrue(fscp.exist("first"));
    Assert.assertTrue(fscp.exist("first"));
}
Also used : InMemoryCacheManager(org.ff4j.cache.InMemoryCacheManager) InMemoryFeatureStore(org.ff4j.store.InMemoryFeatureStore) FF4jCacheProxy(org.ff4j.cache.FF4jCacheProxy) Test(org.junit.Test)

Example 8 with InMemoryCacheManager

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

the class InMemoryCacheTest method testGetPropertyTimeout.

@Test
public void testGetPropertyTimeout() throws InterruptedException {
    InMemoryCacheManager imcm = new InMemoryCacheManager();
    imcm.putProperty(new PropertyString("p1"), 1);
    imcm.putProperty(new PropertyString("p2"), 10);
    Thread.sleep(1100);
    Assert.assertNull(imcm.getProperty("p1"));
    Assert.assertNotNull(imcm.getProperty("p2"));
}
Also used : PropertyString(org.ff4j.property.PropertyString) InMemoryCacheManager(org.ff4j.cache.InMemoryCacheManager) Test(org.junit.Test)

Example 9 with InMemoryCacheManager

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

the class InMemoryCacheTest method testGetProperty2.

@Test(expected = IllegalArgumentException.class)
public void testGetProperty2() {
    InMemoryCacheManager imcm = new InMemoryCacheManager();
    imcm.putProperty(null, 1);
}
Also used : InMemoryCacheManager(org.ff4j.cache.InMemoryCacheManager) Test(org.junit.Test)

Example 10 with InMemoryCacheManager

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

the class InMemoryCacheTest method testGetProperty3.

@Test(expected = IllegalArgumentException.class)
public void testGetProperty3() {
    InMemoryCacheManager imcm = new InMemoryCacheManager();
    PropertyString p1 = new PropertyString("p1");
    p1.setName(null);
    imcm.putProperty(p1, 1);
}
Also used : PropertyString(org.ff4j.property.PropertyString) InMemoryCacheManager(org.ff4j.cache.InMemoryCacheManager) 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