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 FeatureStoreJCacheTest method testUpdateFeatureCoreData.
/**
* TDD.
*/
@Test
public void testUpdateFeatureCoreData() {
// Parameters
String newDescription = "new-description";
FlippingStrategy newStrategy = new PonderationStrategy(0.12);
// Given
assertFf4j.assertThatFeatureExist(F1);
Assert.assertFalse(newDescription.equals(testedStore.read(F1).getDescription()));
// When
Feature fpBis = testedStore.read(F1);
fpBis.setDescription(newDescription);
fpBis.setFlippingStrategy(newStrategy);
testedStore.update(fpBis);
// Then
Feature updatedFeature = testedStore.read(F1);
Assert.assertTrue(newDescription.equals(updatedFeature.getDescription()));
Assert.assertNotNull(updatedFeature.getFlippingStrategy());
Assert.assertEquals(newStrategy.toString(), updatedFeature.getFlippingStrategy().toString());
}
use of org.ff4j.strategy.PonderationStrategy in project ff4j by ff4j.
the class FeatureStoreJCacheTest method testUpdateAddFlippingStrategy.
/**
* TDD.
*/
@Test
public void testUpdateAddFlippingStrategy() {
// Given
assertFf4j.assertThatFeatureExist(F2);
assertFf4j.assertThatFeatureDoesNotHaveFlippingStrategy(F2);
// When
Feature myFeature = ff4j.getFeatureStore().read(F2);
myFeature.setFlippingStrategy(new PonderationStrategy(0.1));
testedStore.update(myFeature);
// Then
assertFf4j.assertThatFeatureHasFlippingStrategy(F2);
}
use of org.ff4j.strategy.PonderationStrategy in project ff4j by ff4j.
the class FeatureStoreTestSupport 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 FeatureStoreTestSupport method testUpdateFeatureCoreData.
/**
* TDD.
*/
@Test
public void testUpdateFeatureCoreData() {
// Parameters
String newDescription = "new-description";
FlippingStrategy newStrategy = new PonderationStrategy(0.12);
// Given
assertFf4j.assertThatFeatureExist(F1);
Assert.assertFalse(newDescription.equals(testedStore.read(F1).getDescription()));
// When
Feature fpBis = testedStore.read(F1);
fpBis.setDescription(newDescription);
fpBis.setFlippingStrategy(newStrategy);
testedStore.update(fpBis);
// Then
Feature updatedFeature = testedStore.read(F1);
Assert.assertTrue(newDescription.equals(updatedFeature.getDescription()));
Assert.assertNotNull(updatedFeature.getFlippingStrategy());
Assert.assertEquals(newStrategy.toString(), updatedFeature.getFlippingStrategy().toString());
}
Aggregations