use of org.ff4j.property.PropertyString in project ff4j by ff4j.
the class FeatureStoreTestSupport method testUpdateEditPropertyRemoveFixedValues.
/**
* TDD.
*/
@Test
@SuppressWarnings("unchecked")
public void testUpdateEditPropertyRemoveFixedValues() {
// Given
assertFf4j.assertThatFeatureExist(F1);
Feature myFeature = ff4j.getFeatureStore().read(F1);
myFeature.addProperty(new PropertyString(REGION_IDENTIFIER, "AMER", Util.set("AMER", "SSSS", "EAST")));
testedStore.update(myFeature);
assertFf4j.assertThatFeatureHasProperty(F1, REGION_IDENTIFIER);
Set<String> fixValues = (Set<String>) //
ff4j.getFeatureStore().read(F1).getCustomProperties().get(REGION_IDENTIFIER).getFixedValues();
Assert.assertEquals(3, fixValues.size());
// When
myFeature = ff4j.getFeatureStore().read(F1);
PropertyString p1 = new PropertyString(REGION_IDENTIFIER);
p1.setValue("AMER");
p1.setFixedValues(Util.set("AMER", "SSSS"));
myFeature.getCustomProperties().put(p1.getName(), p1);
testedStore.update(myFeature);
// Then
Set<Integer> fixValues2 = (Set<Integer>) //
ff4j.getFeatureStore().read(F1).getCustomProperties().get(REGION_IDENTIFIER).getFixedValues();
Assert.assertEquals(2, fixValues2.size());
}
use of org.ff4j.property.PropertyString in project ff4j by ff4j.
the class FeatureStoreTestSupport method testUpdateEditPropertyValue.
/**
* TDD.
*/
@Test
public void testUpdateEditPropertyValue() {
// Given
assertFf4j.assertThatFeatureExist(F1);
Feature myFeature = ff4j.getFeatureStore().read(F1);
if (myFeature.getCustomProperties().isEmpty()) {
PropertyString p1 = new PropertyString(PPSTRING);
p1.setValue("hello");
myFeature.getCustomProperties().put(p1.getName(), p1);
testedStore.update(myFeature);
}
assertFf4j.assertThatFeatureHasProperty(F1, PPSTRING);
Assert.assertEquals("hello", //
ff4j.getFeatureStore().read(F1).getCustomProperties().get(//
PPSTRING).asString());
// When
myFeature = ff4j.getFeatureStore().read(F1);
PropertyString p1 = new PropertyString(PPSTRING, "goodbye");
myFeature.getCustomProperties().put(p1.getName(), p1);
testedStore.update(myFeature);
// Then
Assert.assertEquals("goodbye", //
ff4j.getFeatureStore().read(F1).getCustomProperties().get(//
PPSTRING).asString());
}
use of org.ff4j.property.PropertyString in project ff4j by ff4j.
the class PropertyStoreTestSupport method deleteOK.
/**
* TDD.
*/
@Test
public void deleteOK() {
// Given
testedStore.createProperty(new PropertyString(DELETE_OK, "ff4j"));
Assert.assertTrue(testedStore.existProperty(DELETE_OK));
// When
testedStore.deleteProperty(DELETE_OK);
// Then
Assert.assertFalse(testedStore.existProperty(DELETE_OK));
}
use of org.ff4j.property.PropertyString in project ff4j by ff4j.
the class PropertyStoreTestSupport method addPropertyOKsimple.
// --------------- create -----------
/**
* TDD.
*/
@Test
public void addPropertyOKsimple() {
// Given
Assert.assertFalse(testedStore.existProperty(ADD_PROPERTY_O_KSIMPLE));
// When
testedStore.createProperty(new PropertyString(ADD_PROPERTY_O_KSIMPLE, "ff4j"));
// Then
Assert.assertTrue(testedStore.existProperty(ADD_PROPERTY_O_KSIMPLE));
}
use of org.ff4j.property.PropertyString in project ff4j by ff4j.
the class FeatureStoreTestSupport method testUpdateAddProperty.
/**
* TDD.
*/
@Test
public void testUpdateAddProperty() {
// Given
assertFf4j.assertThatFeatureExist(F2);
assertFf4j.assertThatFeatureHasNotProperty(F2, "p1");
// When
Feature myFeature = ff4j.getFeatureStore().read(F2);
PropertyString p1 = new PropertyString("p1", "v1", Util.set("v1", "v2"));
myFeature.getCustomProperties().put(p1.getName(), p1);
testedStore.update(myFeature);
// Then
assertFf4j.assertThatFeatureHasProperty(F2, "p1");
}
Aggregations