Search in sources :

Example 1 with PropertyString

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

the class InMemoryPropertyStoreTest method testEmpty3.

@Test
public void testEmpty3() {
    // Given
    InMemoryPropertyStore ips = new InMemoryPropertyStore();
    ips.createProperty(new PropertyString("P1", "v1"));
    Assert.assertFalse(ips.isEmpty());
}
Also used : PropertyString(org.ff4j.property.PropertyString) InMemoryPropertyStore(org.ff4j.property.store.InMemoryPropertyStore) Test(org.junit.Test)

Example 2 with PropertyString

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

the class PropertyStoreCommonsConfig method readProperty.

/**
 * {@inheritDoc}
 */
@Override
public Property<?> readProperty(String name) {
    Util.assertHasLength(name);
    String value = conf().getString(name);
    if (value == null) {
        throw new PropertyNotFoundException(name);
    }
    return new PropertyString(name, value);
}
Also used : PropertyString(org.ff4j.property.PropertyString) PropertyNotFoundException(org.ff4j.exception.PropertyNotFoundException) PropertyString(org.ff4j.property.PropertyString)

Example 3 with PropertyString

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

the class FeatureCacheProviderJCacheRITest method testCacheManagerProperties.

@Test
public void testCacheManagerProperties() {
    // Given
    FF4jJCacheManager fcm = new FF4jJCacheManager(RICachingProvider.class.getName());
    Assert.assertNotNull(fcm.getCacheProviderName());
    Assert.assertNotNull(fcm.getNativeCache());
    Assert.assertNotNull(fcm.getPropertyNativeCache());
    // When
    fcm.putProperty(new PropertyString("p1", "v1"));
    // Then
    Assert.assertNotNull(fcm.getProperty("p1"));
    Assert.assertTrue(fcm.listCachedPropertyNames().contains("p1"));
    // When
    fcm.evictProperty("p1");
    fcm.evictProperty("p2");
    // Then
    Assert.assertNull(fcm.getProperty("p1"));
}
Also used : PropertyString(org.ff4j.property.PropertyString) RICachingProvider(org.jsr107.ri.spi.RICachingProvider) AbstractCacheManagerJUnitTest(org.ff4j.test.cache.AbstractCacheManagerJUnitTest) Test(org.junit.Test)

Example 4 with PropertyString

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

the class PropertyStoreJCacheTest method deleteOK.

/**
 * TDD.
 */
@Test
public void deleteOK() {
    // Given
    testedStore.createProperty(new PropertyString("deleteOK", "ff4j"));
    Assert.assertTrue(testedStore.existProperty("deleteOK"));
    // When
    testedStore.deleteProperty("deleteOK");
    // Then
    Assert.assertFalse(testedStore.existProperty("deleteOK"));
}
Also used : PropertyString(org.ff4j.property.PropertyString) Test(org.junit.Test)

Example 5 with PropertyString

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

the class PropertyStoreJCacheTest method addPropertyOKsimple.

// --------------- create -----------
/**
 * TDD.
 */
@Test
public void addPropertyOKsimple() {
    // Given
    Assert.assertFalse(testedStore.existProperty("addPropertyOKsimple"));
    // When
    testedStore.createProperty(new PropertyString("addPropertyOKsimple", "ff4j"));
    // Then
    Assert.assertTrue(testedStore.existProperty("addPropertyOKsimple"));
}
Also used : PropertyString(org.ff4j.property.PropertyString) Test(org.junit.Test)

Aggregations

PropertyString (org.ff4j.property.PropertyString)54 Test (org.junit.Test)52 Feature (org.ff4j.core.Feature)18 InMemoryCacheManager (org.ff4j.cache.InMemoryCacheManager)11 Property (org.ff4j.property.Property)6 HashSet (java.util.HashSet)5 Set (java.util.Set)4 InMemoryPropertyStore (org.ff4j.property.store.InMemoryPropertyStore)4 HashMap (java.util.HashMap)3 FF4j (org.ff4j.FF4j)3 PonderationStrategy (org.ff4j.strategy.PonderationStrategy)3 SQLException (java.sql.SQLException)2 ArrayList (java.util.ArrayList)2 DataSource (javax.sql.DataSource)2 FF4jCacheProxy (org.ff4j.cache.FF4jCacheProxy)2 PropertyJsonBean (org.ff4j.property.util.PropertyJsonBean)2 InMemoryFeatureStore (org.ff4j.store.InMemoryFeatureStore)2 IOException (java.io.IOException)1 BigDecimal (java.math.BigDecimal)1 BigInteger (java.math.BigInteger)1