use of org.ff4j.property.util.PropertyJsonBean 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));
}
use of org.ff4j.property.util.PropertyJsonBean in project ff4j by ff4j.
the class PropertyTest method testPropertyJsonBeanFromScratch.
@Test
public void testPropertyJsonBeanFromScratch() {
PropertyJsonBean jb = new PropertyJsonBean();
jb.setName("name");
jb.setType(PropertyString.class.getName());
jb.setFixedValues(Util.set("AMER", "EUROP"));
jb.setValue("AMER");
Assert.assertNotNull(jb.toString());
}
use of org.ff4j.property.util.PropertyJsonBean in project ff4j by ff4j.
the class PropertyTest method testPropertyJsonBean.
@Test
public void testPropertyJsonBean() {
PropertyString p2 = new PropertyString("p2", "EAST", Util.set("EAST", "WEST", "SOUTH", "NORTH"));
PropertyJsonBean jb = new PropertyJsonBean(p2);
jb.setDescription("descs");
Assert.assertNotNull(jb);
Assert.assertNotNull(jb.getName());
Assert.assertNotNull(jb.getType());
Assert.assertNotNull(jb.getDescription());
Assert.assertNotNull(jb.getFixedValues());
Assert.assertNotNull(jb.getValue());
Assert.assertNotNull(jb.asProperty());
}
use of org.ff4j.property.util.PropertyJsonBean in project ff4j by ff4j.
the class MongoPropertyMapper method fromStore.
/**
* {@inheritDoc}
*/
@Override
@SuppressWarnings("unchecked")
public Property<?> fromStore(Document dbObject) {
PropertyJsonBean pf = new PropertyJsonBean();
pf.setName((String) dbObject.get(PROPERTY_NAME));
pf.setDescription((String) dbObject.get(PROPERTY_DESCRIPTION));
pf.setType((String) dbObject.get(PROPERTY_TYPE));
pf.setValue((String) dbObject.get(PROPERTY_VALUE));
if (dbObject.containsKey(PROPERTY_FIXEDVALUES)) {
ArrayList<String> dbList = (ArrayList<String>) dbObject.get(PROPERTY_FIXEDVALUES);
if (dbList != null) {
for (Object item : dbList) {
pf.addFixedValue((String) item);
}
}
}
return pf.asProperty();
}
Aggregations