use of org.ff4j.property.PropertyString in project ff4j by ff4j.
the class AbstractPropertyStoreJunitTest method updateKOdoesnotExist2.
/**
* TDD.
*/
@Test(expected = PropertyNotFoundException.class)
public void updateKOdoesnotExist2() {
// Given
Assert.assertFalse(testedStore.existProperty("invalid"));
// When
testedStore.updateProperty(new PropertyString("invalid", "abc"));
// Expected error
Assert.fail();
}
use of org.ff4j.property.PropertyString in project ff4j by ff4j.
the class JdbcFeatureStoreSchemaTest method testCreateCustomProperties.
@SuppressWarnings("unchecked")
@Test
public void testCreateCustomProperties() {
testedStore.createSchema();
// When
Feature fullFeature = new Feature("fx", true);
fullFeature.setPermissions(Util.set("toto", "tata"));
fullFeature.setFlippingStrategy(new PonderationStrategy(0.5d));
Map<String, Property<?>> customProperties = new HashMap<String, Property<?>>();
fullFeature.setCustomProperties(customProperties);
testedStore.create(fullFeature);
testedStore.createCustomProperties("fx", null);
Property<?> p1 = new PropertyString("p1");
p1.setFixedValues(null);
Property<String> p2 = new PropertyString("p2");
p2.setFixedValues(Util.set("v1", "v3"));
testedStore.createCustomProperties("fx", Arrays.asList(p2, p1));
testedStore.createCustomProperties("fx", null);
}
use of org.ff4j.property.PropertyString in project ff4j by ff4j.
the class MappingUtilsTest method testJsonCustomProperties.
@Test
public void testJsonCustomProperties() {
// Given
Map<String, Property<?>> props = new HashMap<String, Property<?>>();
props.put("f1", new PropertyString("f1", "v1"));
props.put("f2", new PropertyString("f2", "v2"));
// When
String expression = JsonUtils.customPropertiesAsJson(props);
// Then
Assert.assertNotNull(expression);
}
use of org.ff4j.property.PropertyString in project ff4j by ff4j.
the class PropertyStoreTestSupport method updateKOPropertyNotFound.
/**
* TDD.
*/
@Test(expected = PropertyNotFoundException.class)
public void updateKOPropertyNotFound() {
// When
PropertyString ps = new PropertyString("does-not-exist");
testedStore.updateProperty(ps);
}
use of org.ff4j.property.PropertyString in project ff4j by ff4j.
the class PropertyStoreTestSupport 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());
}
Aggregations