Search in sources :

Example 16 with PropertyLogLevel

use of org.ff4j.property.PropertyLogLevel in project ff4j by ff4j.

the class AbstractPropertyStoreJunitTest method updateOKProperties.

/**
 * TDD.
 */
@Test
public void updateOKProperties() {
    // Given
    testedStore.createProperty(new PropertyLogLevel("log", LogLevel.ERROR));
    // When
    PropertyLogLevel pll = new PropertyLogLevel("log", LogLevel.INFO);
    testedStore.updateProperty(pll);
    // Then
    Assert.assertEquals(LogLevel.INFO, testedStore.readProperty("log").getValue());
}
Also used : PropertyLogLevel(org.ff4j.property.PropertyLogLevel) Test(org.junit.Test)

Example 17 with PropertyLogLevel

use of org.ff4j.property.PropertyLogLevel in project ff4j by ff4j.

the class AbstractPropertyStoreJunitTest method readOKFixed.

@Test
public void readOKFixed() {
    // Given
    testedStore.createProperty(new PropertyLogLevel("log", LogLevel.ERROR));
    // When
    Property<?> log = testedStore.readProperty("log");
    // Then
    Assert.assertNotNull(log);
    Assert.assertNotNull(log.getName());
    Assert.assertEquals("log", log.getName());
    Assert.assertEquals(LogLevel.ERROR, log.getValue());
    Assert.assertEquals("ERROR", log.asString());
    Assert.assertNotNull(log.getFixedValues());
}
Also used : PropertyLogLevel(org.ff4j.property.PropertyLogLevel) Test(org.junit.Test)

Example 18 with PropertyLogLevel

use of org.ff4j.property.PropertyLogLevel in project ff4j by ff4j.

the class CacheProxyTest method testCacheProxyManagerProperty.

@Test
public void testCacheProxyManagerProperty() {
    FF4jCacheProxy proxy = new FF4jCacheProxy();
    proxy.setTargetPropertyStore(new InMemoryPropertyStore());
    proxy.setTargetFeatureStore(new InMemoryFeatureStore());
    proxy.setCacheManager(new InMemoryCacheManager());
    Assert.assertTrue(proxy.isEmpty());
    proxy.create(new Feature("a"));
    Assert.assertFalse(proxy.isEmpty());
    proxy.createProperty(new PropertyString("p1", "v1"));
    Property<?> p1 = proxy.readProperty("p1");
    proxy.readProperty("p1");
    proxy.getTargetPropertyStore().createProperty(new PropertyString("p2"));
    proxy.readProperty("p2");
    proxy.updateProperty("p1", "v2");
    proxy.updateProperty(p1);
    Assert.assertFalse(proxy.isEmpty());
    Assert.assertFalse(proxy.listPropertyNames().isEmpty());
    proxy.deleteProperty("p1");
    proxy.clear();
    Set<Property<?>> setOfProperty = new HashSet<Property<?>>();
    setOfProperty.add(new PropertyLogLevel("a", LogLevel.INFO));
    setOfProperty.add(new PropertyLogLevel("titi1", LogLevel.INFO));
    proxy.importProperties(setOfProperty);
    // Already in cache, but not same value
    proxy.createProperty(new PropertyString("cacheNStore", "cacheNStore"));
    proxy.readProperty("cacheNStore", p1);
    // Not in cache, but in store, but not same default value
    proxy.getTargetPropertyStore().createProperty(new PropertyString("p4", "v4"));
    proxy.readProperty("p1", p1);
    proxy.readProperty("p1", p1);
    // Nowhere, return default
    proxy.readProperty("p2", new PropertyString("p2"));
    proxy.readProperty("p1", new PropertyString("p3"));
}
Also used : PropertyLogLevel(org.ff4j.property.PropertyLogLevel) PropertyString(org.ff4j.property.PropertyString) InMemoryPropertyStore(org.ff4j.property.store.InMemoryPropertyStore) InMemoryCacheManager(org.ff4j.cache.InMemoryCacheManager) InMemoryFeatureStore(org.ff4j.store.InMemoryFeatureStore) FF4jCacheProxy(org.ff4j.cache.FF4jCacheProxy) Feature(org.ff4j.core.Feature) Property(org.ff4j.property.Property) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 19 with PropertyLogLevel

use of org.ff4j.property.PropertyLogLevel in project ff4j by ff4j.

the class PropertyStoreAwsSSMTest method readOKFixed.

@Override
@Test
public void readOKFixed() {
    // Given
    testedStore.createProperty(new PropertyLogLevel(READ_OK_FIXED, PropertyLogLevel.LogLevel.ERROR));
    // When
    Property<?> log = testedStore.readProperty(READ_OK_FIXED);
    // Then
    Assert.assertNotNull(log);
    Assert.assertNotNull(log.getName());
    Assert.assertEquals(READ_OK_FIXED, log.getName());
    Assert.assertEquals(PropertyLogLevel.LogLevel.ERROR.name(), log.getValue());
}
Also used : PropertyLogLevel(org.ff4j.property.PropertyLogLevel) Test(org.junit.Test)

Example 20 with PropertyLogLevel

use of org.ff4j.property.PropertyLogLevel in project ff4j by ff4j.

the class PropertyStoreCommonsConfigTest method readOKFixed.

/**
 * TDD.
 */
@Override
@Test
public void readOKFixed() {
    // Given
    testedStore.createProperty(new PropertyLogLevel(READ_OK_FIXED, LogLevel.ERROR));
    // When
    Property<?> log = testedStore.readProperty(READ_OK_FIXED);
    // Then
    Assert.assertNotNull(log);
    Assert.assertNotNull(log.getName());
    Assert.assertEquals(READ_OK_FIXED, log.getName());
    Assert.assertEquals(LogLevel.ERROR.name(), log.getValue());
}
Also used : PropertyLogLevel(org.ff4j.property.PropertyLogLevel) Test(org.junit.Test)

Aggregations

PropertyLogLevel (org.ff4j.property.PropertyLogLevel)33 Test (org.junit.Test)33 Property (org.ff4j.property.Property)3 HashSet (java.util.HashSet)2 Feature (org.ff4j.core.Feature)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 FF4jCacheProxy (org.ff4j.cache.FF4jCacheProxy)1 InMemoryCacheManager (org.ff4j.cache.InMemoryCacheManager)1 XmlConfig (org.ff4j.conf.XmlConfig)1 XmlParser (org.ff4j.conf.XmlParser)1 PropertyString (org.ff4j.property.PropertyString)1 InMemoryPropertyStore (org.ff4j.property.store.InMemoryPropertyStore)1 InMemoryFeatureStore (org.ff4j.store.InMemoryFeatureStore)1