Search in sources :

Example 36 with PropertyString

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

the class FF4jTest method createDeleteProperty.

@Test
public void createDeleteProperty() {
    FF4j ff4j = new FF4j();
    ff4j.createProperty(new PropertyString("p1", "v1"));
    ff4j.audit();
    ff4j.createProperty(new PropertyString("p2", "v2"));
    Assert.assertTrue(ff4j.getPropertiesStore().existProperty("p1"));
    ff4j.deleteProperty("p1");
    Assert.assertFalse(ff4j.getPropertiesStore().existProperty("p1"));
}
Also used : PropertyString(org.ff4j.property.PropertyString) FF4j(org.ff4j.FF4j) Test(org.junit.Test)

Example 37 with PropertyString

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

the class FeatureTest method testAddPropertyWithNullCustomPropertiesIsOK.

@Test
public void testAddPropertyWithNullCustomPropertiesIsOK() {
    // Given
    Feature feat = new Feature("abc", true);
    feat.setCustomProperties(null);
    // When
    feat.addProperty(new PropertyString("p1", "v1"));
    // Then
    Assert.assertTrue(feat.getCustomProperties().containsKey("p1"));
}
Also used : PropertyString(org.ff4j.property.PropertyString) Feature(org.ff4j.core.Feature) Test(org.junit.Test)

Example 38 with PropertyString

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

the class FeatureTest method testAddPropertyShouldAdd.

@Test
public void testAddPropertyShouldAdd() {
    // Given
    Feature feat = new Feature("abc", true);
    Assert.assertFalse(feat.getCustomProperties().containsKey("p1"));
    // When
    feat.addProperty(new PropertyString("p1", "v1"));
    // Then
    Assert.assertTrue(feat.getCustomProperties().containsKey("p1"));
}
Also used : PropertyString(org.ff4j.property.PropertyString) Feature(org.ff4j.core.Feature) Test(org.junit.Test)

Example 39 with PropertyString

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

the class PropertyFactoryTest method testCreatePropertyOK.

@Test
public void testCreatePropertyOK() {
    PropertyJsonBean jsonBean = new PropertyJsonBean(new PropertyString("p1", "v1"));
    Assert.assertNotNull(PropertyFactory.createProperty(jsonBean));
}
Also used : PropertyString(org.ff4j.property.PropertyString) PropertyJsonBean(org.ff4j.property.util.PropertyJsonBean) Test(org.junit.Test)

Example 40 with PropertyString

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

the class PropertyTest method tesInitPropertyString.

@Test
public void tesInitPropertyString() {
    new PropertyString();
    PropertyString p1 = new PropertyString("p1");
    p1.setReadOnly(p1.isReadOnly());
    PropertyString p2 = new PropertyString("p2", "EAST", Util.set("EAST", "WEST", "SOUTH", "NORTH"));
    Assert.assertNotNull(p1.getName());
    Assert.assertNotNull(p2.getFixedValues());
}
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