use of org.ff4j.property.PropertyInt in project ff4j by ff4j.
the class FeatureStoreJCacheTest method testUpdateEditPropertyAddFixedValues.
/**
* TDD.
*/
@Test
@SuppressWarnings("unchecked")
public void testUpdateEditPropertyAddFixedValues() {
// Given
assertFf4j.assertThatFeatureExist(F1);
Feature myFeature = ff4j.getFeatureStore().read(F1);
myFeature = ff4j.getFeatureStore().read(F1);
myFeature.addProperty(new PropertyInt("digitValue", 2, Util.set(0, 1, 2, 3)));
ff4j.getFeatureStore().update(myFeature);
assertFf4j.assertThatFeatureHasProperty(F1, "digitValue");
Set<Integer> fixValues = (Set<Integer>) ff4j.getFeatureStore().read(//
F1).getCustomProperties().get("digitValue").getFixedValues();
Assert.assertEquals(4, fixValues.size());
// When
myFeature = ff4j.getFeatureStore().read(F1);
PropertyInt p1 = new PropertyInt("digitValue");
p1.setFixedValues(Util.set(0, 1, 2, 3, 4));
p1.setValue(4);
myFeature.getCustomProperties().put(p1.getName(), p1);
testedStore.update(myFeature);
// Then
Set<Integer> fixValues2 = (Set<Integer>) ff4j.getFeatureStore().read(//
F1).getCustomProperties().get("digitValue").getFixedValues();
Assert.assertEquals(5, fixValues2.size());
}
use of org.ff4j.property.PropertyInt in project ff4j by ff4j.
the class PropertyTest method tesInitPropertyInt.
@Test
public void tesInitPropertyInt() {
new PropertyInt();
PropertyInt d1 = new PropertyInt("d1");
PropertyInt d2 = new PropertyInt("d2", 1);
PropertyInt d3 = new PropertyInt("d3", "2");
PropertyInt d4 = new PropertyInt("d4", 2, Util.set(0, 1, 2));
Assert.assertNotNull(d1.getName());
Assert.assertNotNull(d2.getFixedValues());
Assert.assertNotNull(d3.getName());
Assert.assertNotNull(d4.getName());
d4.toString();
}
use of org.ff4j.property.PropertyInt in project ff4j by ff4j.
the class SpringJdbcXMLDataSourceStoreTest method testUpdateEditPropertyAddFixedValues.
/**
* TDD.
*/
@Test
@Override
@SuppressWarnings("unchecked")
public void testUpdateEditPropertyAddFixedValues() {
// Given
assertFf4j.assertThatFeatureExist(F1);
Feature myFeature = ff4j.getFeatureStore().read(F1);
myFeature = ff4j.getFeatureStore().read(F1);
assertFf4j.assertThatFeatureHasProperty(F1, "digitValue");
Set<Integer> fixValues = (Set<Integer>) ff4j.getFeatureStore().read(//
F1).getCustomProperties().get("digitValue").getFixedValues();
Assert.assertEquals(4, fixValues.size());
// When
PropertyInt p1 = new PropertyInt("digitValue");
p1.setFixedValues(Util.set(0, 1, 2, 3, 4));
p1.setValue(4);
myFeature.getCustomProperties().put(p1.getName(), p1);
testedStore.update(myFeature);
// Then
Set<Integer> fixValues2 = (Set<Integer>) ff4j.getFeatureStore().read(//
F1).getCustomProperties().get("digitValue").getFixedValues();
Assert.assertEquals(5, fixValues2.size());
}
use of org.ff4j.property.PropertyInt in project ff4j by ff4j.
the class FeatureStoreTestSupport method testUpdateEditPropertyAddFixedValues.
/**
* TDD.
*/
@Test
@SuppressWarnings("unchecked")
public void testUpdateEditPropertyAddFixedValues() {
// Given
assertFf4j.assertThatFeatureExist(F1);
Feature myFeature = ff4j.getFeatureStore().read(F1);
myFeature.addProperty(new PropertyInt(DIGIT_VALUE, 2, Util.set(0, 1, 2, 3)));
ff4j.getFeatureStore().update(myFeature);
assertFf4j.assertThatFeatureHasProperty(F1, DIGIT_VALUE);
Set<Integer> fixValues = (Set<Integer>) //
ff4j.getFeatureStore().read(F1).getCustomProperties().get(DIGIT_VALUE).getFixedValues();
Assert.assertEquals(4, fixValues.size());
// When
myFeature = ff4j.getFeatureStore().read(F1);
PropertyInt p1 = new PropertyInt(DIGIT_VALUE);
p1.setFixedValues(Util.set(0, 1, 2, 3, 4));
p1.setValue(4);
myFeature.getCustomProperties().put(p1.getName(), p1);
testedStore.update(myFeature);
// Then
Set<Integer> fixValues2 = (Set<Integer>) //
ff4j.getFeatureStore().read(F1).getCustomProperties().get(DIGIT_VALUE).getFixedValues();
Assert.assertEquals(5, fixValues2.size());
}
use of org.ff4j.property.PropertyInt in project ff4j by ff4j.
the class CoreFeatureStoreTestSupport method testUpdateEditPropertyAddFixedValues.
/**
* TDD.
*/
@Test
@SuppressWarnings("unchecked")
public void testUpdateEditPropertyAddFixedValues() {
// Given
assertFf4j.assertThatFeatureExist(F1);
assertFf4j.assertThatFeatureHasProperty(F1, "digitValue");
Set<Integer> fixValues = (Set<Integer>) ff4j.getFeatureStore().read(//
F1).getCustomProperties().get("digitValue").getFixedValues();
Assert.assertEquals(4, fixValues.size());
// When
Feature myFeature = ff4j.getFeatureStore().read(F1);
PropertyInt p1 = new PropertyInt("digitValue");
p1.setFixedValues(Util.set(0, 1, 2, 3, 4));
p1.setValue(4);
myFeature.getCustomProperties().put(p1.getName(), p1);
testedStore.update(myFeature);
// Then
Set<Integer> fixValues2 = (Set<Integer>) ff4j.getFeatureStore().read(//
F1).getCustomProperties().get("digitValue").getFixedValues();
Assert.assertEquals(5, fixValues2.size());
}
Aggregations