use of org.ff4j.property.Property in project ff4j by ff4j.
the class PropertyStoreAwsSSM method readAllProperties.
/**
* {@inheritDoc}
*/
@Override
public Map<String, Property<?>> readAllProperties() {
List<Parameter> parameters = getParameters();
Map<String, Property<?>> properties = new HashMap<>();
for (Parameter parameter : parameters) {
properties.put(parameter.name().replace(path + "/", ""), new PropertyString(parameter.value()));
}
return properties;
}
use of org.ff4j.property.Property in project ff4j by ff4j.
the class StoreMapper method fromFeatureStore.
public static Feature fromFeatureStore(ArangoDBFeature f) {
Map<String, Property<?>> customProperties = convertMap(f.getCustomProperties(), StoreMapper::fromPropertyStore);
Feature feature = new Feature(f.getId());
feature.setEnable(f.isEnable());
feature.setDescription(f.getDescription());
feature.setGroup(f.getGroup());
feature.setPermissions(f.getPermissions());
feature.setFlippingStrategy(f.getFlippingStrategy());
feature.setCustomProperties(customProperties);
return feature;
}
use of org.ff4j.property.Property in project ff4j by ff4j.
the class JdbcFeatureStoreSchemaTest method testworkWithSchema.
@Test
public void testworkWithSchema() {
// Given
testedStore.createSchema();
Assert.assertFalse(testedStore.exist("fx"));
// 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);
// Then
Assert.assertTrue(testedStore.exist("fx"));
}
use of org.ff4j.property.Property in project ff4j by ff4j.
the class JdbcFeatureStoreSchemaTest method testCreateCustomProperties.
@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.Property 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);
}
Aggregations