use of org.ff4j.property.PropertyString in project ff4j by ff4j.
the class CacheProxyTest method testCacheProxyManager.
@Test
public void testCacheProxyManager() {
FF4jCacheProxy proxy = new FF4jCacheProxy();
FF4JCacheManager cm = new InMemoryCacheManager();
proxy.setCacheManager(cm);
proxy.isCached();
Assert.assertNotNull(proxy.getCacheProvider());
proxy.setTargetPropertyStore(new InMemoryPropertyStore());
Assert.assertEquals(0, proxy.readAllProperties().size());
proxy.createProperty(new PropertyString("p1", "v1"));
Assert.assertTrue(proxy.existProperty("p1"));
Assert.assertFalse(proxy.existProperty("p2"));
proxy.setTargetFeatureStore(new InMemoryFeatureStore());
Set<Feature> setOfFeatures = new HashSet<Feature>();
setOfFeatures.add(new Feature("f1"));
setOfFeatures.add(new Feature("f2"));
proxy.importFeatures(setOfFeatures);
}
use of org.ff4j.property.PropertyString in project ff4j by ff4j.
the class InMemoryCacheTest method testGetProperty4.
@Test(expected = IllegalArgumentException.class)
public void testGetProperty4() {
InMemoryCacheManager imcm = new InMemoryCacheManager();
PropertyString p1 = new PropertyString("p1");
p1.setName("");
imcm.putProperty(p1, 1);
}
use of org.ff4j.property.PropertyString 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"));
}
use of org.ff4j.property.PropertyString 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);
}
use of org.ff4j.property.PropertyString 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"));
}
Aggregations