Search in sources :

Example 16 with PonderationStrategy

use of org.ff4j.strategy.PonderationStrategy in project ff4j by ff4j.

the class FeatureStoreTestSupport 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);
}
Also used : PonderationStrategy(org.ff4j.strategy.PonderationStrategy) Feature(org.ff4j.core.Feature) Test(org.junit.Test)

Example 17 with PonderationStrategy

use of org.ff4j.strategy.PonderationStrategy in project ff4j by ff4j.

the class InMemoryFeatureStoreTest method testUnitFeatureInitialization.

@Test
public void testUnitFeatureInitialization() {
    InMemoryFeatureStore imfs = new InMemoryFeatureStore();
    imfs.create(new Feature("default", true, "grp1", "desc", null, new PonderationStrategy()));
    Assert.assertEquals(1, imfs.readAll().size());
}
Also used : PonderationStrategy(org.ff4j.strategy.PonderationStrategy) InMemoryFeatureStore(org.ff4j.store.InMemoryFeatureStore) Feature(org.ff4j.core.Feature) Test(org.junit.Test)

Example 18 with PonderationStrategy

use of org.ff4j.strategy.PonderationStrategy in project ff4j by ff4j.

the class CoreFeatureStoreTestSupport 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);
}
Also used : PonderationStrategy(org.ff4j.strategy.PonderationStrategy) Feature(org.ff4j.core.Feature) Test(org.junit.Test)

Example 19 with PonderationStrategy

use of org.ff4j.strategy.PonderationStrategy in project ff4j by ff4j.

the class CoreFeatureStoreTestSupport 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);
}
Also used : PonderationStrategy(org.ff4j.strategy.PonderationStrategy) Feature(org.ff4j.core.Feature) Test(org.junit.Test)

Example 20 with PonderationStrategy

use of org.ff4j.strategy.PonderationStrategy in project ff4j by ff4j.

the class CoreFeatureStoreTestSupport 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);
}
Also used : PonderationStrategy(org.ff4j.strategy.PonderationStrategy) Feature(org.ff4j.core.Feature) Test(org.junit.Test)

Aggregations

PonderationStrategy (org.ff4j.strategy.PonderationStrategy)22 Test (org.junit.Test)22 Feature (org.ff4j.core.Feature)19 PropertyString (org.ff4j.property.PropertyString)9 FlippingStrategy (org.ff4j.core.FlippingStrategy)4 HashMap (java.util.HashMap)2 Property (org.ff4j.property.Property)2 AbstractFf4jTest (org.ff4j.test.AbstractFf4jTest)2 HashSet (java.util.HashSet)1 FF4j (org.ff4j.FF4j)1 InMemoryFeatureStore (org.ff4j.store.InMemoryFeatureStore)1 DarkLaunchStrategy (org.ff4j.strategy.DarkLaunchStrategy)1 Transaction (org.neo4j.graphdb.Transaction)1