use of org.ff4j.core.Feature in project ff4j by ff4j.
the class FeatureStoreJCacheTest method testClear.
@Test
public void testClear() {
// Given
Assert.assertNotNull(testedStore);
Map<String, Feature> before = testedStore.readAll();
Assert.assertFalse(before.isEmpty());
// When
testedStore.clear();
// Then
Assert.assertTrue(testedStore.readAll().isEmpty());
// / Reinit
for (String pName : before.keySet()) {
testedStore.create(before.get(pName));
}
}
use of org.ff4j.core.Feature in project ff4j by ff4j.
the class FeatureStoreJCacheTest method testDeleteFeature.
/**
* TDD.
*/
@Test
public void testDeleteFeature() throws Exception {
// Given
assertFf4j.assertThatFeatureExist(F1);
Feature tmpf1 = testedStore.read(F1);
int initialNumber = testedStore.readAll().size();
// When
testedStore.delete(F1);
// Then
assertFf4j.assertThatStoreHasSize(initialNumber - 1);
assertFf4j.assertThatFeatureDoesNotExist(F1);
// End, Reinit initial state
testedStore.create(tmpf1);
assertFf4j.assertThatFeatureExist(F1);
}
use of org.ff4j.core.Feature in project ff4j by ff4j.
the class FeatureStoreJCacheTest method testUpdateEditFlippingStrategy.
/**
* TDD.
*/
@Test
public void testUpdateEditFlippingStrategy() {
// Given
assertFf4j.assertThatFeatureExist(F3);
// When
Feature myFeature = ff4j.getFeatureStore().read(F3);
myFeature.setFlippingStrategy(new PonderationStrategy(0.1));
testedStore.update(myFeature);
// Then
assertFf4j.assertThatFeatureHasFlippingStrategy(F3);
}
use of org.ff4j.core.Feature in project ff4j by ff4j.
the class FeatureStoreJCacheTest method testUpdateRemoveFlippingStrategy.
/**
* TDD.
*/
@Test
public void testUpdateRemoveFlippingStrategy() {
// Given
assertFf4j.assertThatFeatureExist(F3);
Feature myFeature = ff4j.getFeatureStore().read(F3);
myFeature.setFlippingStrategy(new PonderationStrategy(0.1));
testedStore.update(myFeature);
assertFf4j.assertThatFeatureHasFlippingStrategy(F3);
// When
Feature myFeature2 = ff4j.getFeatureStore().read(F3);
myFeature2.setFlippingStrategy(null);
testedStore.update(myFeature2);
// Then
assertFf4j.assertThatFeatureDoesNotHaveFlippingStrategy(F3);
}
use of org.ff4j.core.Feature in project ff4j by ff4j.
the class AbstractFeatureStore method removeRoleFromFeature.
/**
* {@inheritDoc}
*/
@Override
public void removeRoleFromFeature(String flipId, String roleName) {
Util.assertParamHasLength(roleName, "roleName (#2)");
// retrieve
Feature f = read(flipId);
f.getPermissions().remove(roleName);
// persist modification
update(f);
}
Aggregations