use of org.ff4j.property.PropertyString in project ff4j by ff4j.
the class InMemoryPropertiesStoreTest method testEmpty3.
@Test
public void testEmpty3() {
// Given
InMemoryPropertyStore ips = new InMemoryPropertyStore();
ips.createProperty(new PropertyString("P1", "v1"));
Assert.assertFalse(ips.isEmpty());
}
use of org.ff4j.property.PropertyString in project ff4j by ff4j.
the class JdbcFeatureStoreErrorTest method testcreateCustomKO.
@Test(expected = FeatureAccessException.class)
public void testcreateCustomKO() throws SQLException {
DataSource mockDS = Mockito.mock(DataSource.class);
doThrow(new SQLException()).when(mockDS).getConnection();
JdbcFeatureStore jrepo = new JdbcFeatureStore(mockDS);
jrepo.setDataSource(mockDS);
List<Property<?>> lp = new ArrayList<Property<?>>();
lp.add(new PropertyString("p1", "v1"));
lp.add(new PropertyString("p2", "v2"));
jrepo.createCustomProperties("F1", lp);
}
use of org.ff4j.property.PropertyString in project ff4j by ff4j.
the class FF4jTest method testgetProperty.
@Test
public void testgetProperty() {
FF4j ff4j = new FF4j();
ff4j.createProperty(new PropertyString("p1", "v1"));
Assert.assertNotNull(ff4j.getProperty("p1"));
Assert.assertNotNull(ff4j.getPropertyAsString("p1"));
Assert.assertEquals("v1", ff4j.getPropertyAsString("p1"));
}
use of org.ff4j.property.PropertyString in project ff4j by ff4j.
the class SpringJdbcXMLDataSourceStoreTest method testUpdateEditPropertyRemoveFixedValues.
/**
* TDD.
*/
@Test
@Override
@SuppressWarnings("unchecked")
public void testUpdateEditPropertyRemoveFixedValues() {
// Given
assertFf4j.assertThatFeatureExist(F1);
assertFf4j.assertThatFeatureHasProperty(F1, "regionIdentifier");
Set<String> fixValues = (Set<String>) ff4j.getFeatureStore().read(//
F1).getCustomProperties().get("regionIdentifier").getFixedValues();
Assert.assertEquals(3, fixValues.size());
// When
Feature myFeature = ff4j.getFeatureStore().read(F1);
PropertyString p1 = new PropertyString("regionIdentifier");
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("regionIdentifier").getFixedValues();
Assert.assertEquals(2, fixValues2.size());
}
use of org.ff4j.property.PropertyString in project ff4j by ff4j.
the class FeatureStoreJCacheTest 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