use of org.ff4j.strategy.PonderationStrategy 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.strategy.PonderationStrategy 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.strategy.PonderationStrategy in project ff4j by ff4j.
the class FF4jTest method testEmptyPermission.
@Test
public void testEmptyPermission() {
FF4j ff4j = new FF4j();
ff4j.createFeature("f1", true);
ff4j.setAuthorizationsManager(new DefinedPermissionSecurityManager("a", new HashSet<String>()));
Assert.assertTrue(ff4j.checkOveridingStrategy("f1", new PonderationStrategy(1d)));
Assert.assertTrue(ff4j.isAllowed(ff4j.getFeature("f1")));
}
use of org.ff4j.strategy.PonderationStrategy in project ff4j by ff4j.
the class FeatureTest method testCopyConstructorFeature.
@Test
public void testCopyConstructorFeature() {
Feature f = new Feature("abc", true, "samething", "groupA", Util.set("a", "b"));
f.getPermissions().add("USER");
f.setFlippingStrategy(new PonderationStrategy(0.5d));
f.getCustomProperties().put("p1", new PropertyString("p1", "v1"));
f.getCustomProperties().put("p2", new PropertyString("p1", "v1", Util.set("v1", "v2")));
Feature f2 = new Feature(f);
Assert.assertEquals(f2.getUid(), f.getUid());
Assert.assertEquals(f2.getPermissions(), f.getPermissions());
new Feature("f3", true, "samething", "groupA", Util.set("a", "b"), null);
new Feature(new Feature("f4", true));
}
use of org.ff4j.strategy.PonderationStrategy in project ff4j by ff4j.
the class FeatureTest method testFullToStringImpl.
@Test
public void testFullToStringImpl() {
List<String> auths = Arrays.asList(new String[] { "something" });
Feature f = new Feature("ok", true, "grp1", "description", auths, new PonderationStrategy());
Assert.assertTrue(f.toString().contains("ok"));
}
Aggregations