use of org.ff4j.cache.InMemoryCacheManager in project ff4j by ff4j.
the class InMemoryCacheTest method testGetProperty.
@Test
public void testGetProperty() throws InterruptedException {
InMemoryCacheManager imcm = new InMemoryCacheManager();
imcm.putProperty(new PropertyString("p1"));
Assert.assertNull(imcm.getProperty("p2"));
Assert.assertNotNull(imcm.getProperty("p1"));
}
use of org.ff4j.cache.InMemoryCacheManager in project ff4j by ff4j.
the class InMemoryCacheTest method testEvictProperty1.
@Test
public void testEvictProperty1() {
// Given
InMemoryCacheManager imcm = new InMemoryCacheManager();
imcm.putProperty(new PropertyString("p1"));
Assert.assertFalse(imcm.listCachedPropertyNames().isEmpty());
// When
imcm.evictProperty("p1");
// Then
Assert.assertTrue(imcm.listCachedPropertyNames().isEmpty());
}
use of org.ff4j.cache.InMemoryCacheManager in project ff4j by ff4j.
the class InMemoryCacheTest method testPutEmptyPropertyName.
@Test(expected = IllegalArgumentException.class)
public void testPutEmptyPropertyName() {
PropertyString p = new PropertyString();
p.setName("");
new InMemoryCacheManager().putProperty(p);
}
use of org.ff4j.cache.InMemoryCacheManager in project ff4j by ff4j.
the class InMemoryCacheTest method testEvictProperty2.
@Test
public void testEvictProperty2() {
// Given
InMemoryCacheManager imcm = new InMemoryCacheManager();
imcm.putProperty(new PropertyString("p2"));
Assert.assertFalse(imcm.listCachedPropertyNames().isEmpty());
// When
imcm.evictProperty("p1");
// Then
Assert.assertFalse(imcm.listCachedPropertyNames().isEmpty());
}
use of org.ff4j.cache.InMemoryCacheManager in project ff4j by ff4j.
the class AbstractCacheManagerTest method testAbstractCacheManagerForCoverage.
@Test
public void testAbstractCacheManagerForCoverage() {
AbstractCacheManagerJUnitTest ac = new AbstractCacheManagerJUnitTest() {
protected FF4JCacheManager getCacheManager() {
if (cacheManager == null) {
cacheManager = new InMemoryCacheManager();
}
return cacheManager;
}
};
ac.initialize();
ac.testClear();
ac.testPutOK();
ac.clean();
ac.testPutSeveral();
ac.testEvictOK();
ac.clean();
ac.testPutAvoidDoublon();
ac.clean();
ac.testEvictFeatureNotExist();
ac.clean();
Assert.assertNotNull(ac);
}
Aggregations