Search in sources :

Example 21 with PropertyString

use of org.ff4j.property.PropertyString 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());
}
Also used : PropertyString(org.ff4j.property.PropertyString) InMemoryCacheManager(org.ff4j.cache.InMemoryCacheManager) Test(org.junit.Test)

Example 22 with PropertyString

use of org.ff4j.property.PropertyString 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);
}
Also used : PropertyString(org.ff4j.property.PropertyString) InMemoryCacheManager(org.ff4j.cache.InMemoryCacheManager) Test(org.junit.Test)

Example 23 with PropertyString

use of org.ff4j.property.PropertyString 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());
}
Also used : PropertyString(org.ff4j.property.PropertyString) InMemoryCacheManager(org.ff4j.cache.InMemoryCacheManager) Test(org.junit.Test)

Example 24 with PropertyString

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

the class AbstractPropertyStoreJunitTest method readOK.

// ------------------ read --------------------
@Test
public void readOK() {
    // Given
    testedStore.createProperty(new PropertyString("toto", "ff4j"));
    // When
    Property<?> ap = testedStore.readProperty("toto");
    // Then
    Assert.assertNotNull(ap);
    Assert.assertNotNull(ap.getName());
    Assert.assertEquals("toto", ap.getName());
    Assert.assertEquals("ff4j", ap.getValue());
    Assert.assertEquals("ff4j", ap.asString());
    Assert.assertNull(ap.getFixedValues());
}
Also used : PropertyString(org.ff4j.property.PropertyString) Test(org.junit.Test)

Example 25 with PropertyString

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

the class AbstractPropertyStoreJunitTest method deleteOK.

/**
 * TDD.
 */
@Test
public void deleteOK() {
    // Given
    testedStore.createProperty(new PropertyString("toto", "ff4j"));
    Assert.assertTrue(testedStore.existProperty("toto"));
    // When
    testedStore.deleteProperty("toto");
    // Then
    Assert.assertFalse(testedStore.existProperty("toto"));
}
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