Search in sources :

Example 1 with AssertFf4j

use of org.ff4j.test.AssertFf4j in project ff4j by ff4j.

the class SampleServiceFeatureTest method testAOP.

@Test
public void testAOP() {
    // Given
    ff4j.createFeature("AwesomeFeature", true);
    assertFF4j = new AssertFf4j(ff4j);
    assertFF4j.assertThatFeatureExist("AwesomeFeature");
    assertFF4j.assertThatFeatureIsEnabled("AwesomeFeature");
    // When feature is enabled
    String result1 = sample.someAwesomeFeature("HELLO");
    // Then it works as expected
    Assert.assertEquals("HELLO", result1);
    // When feature is disabled, nothing and return null
    ff4j.disable("AwesomeFeature");
    // Then
    Assert.assertNull(sample.someAwesomeFeature("HELLO"));
}
Also used : AssertFf4j(org.ff4j.test.AssertFf4j) Test(org.junit.Test)

Example 2 with AssertFf4j

use of org.ff4j.test.AssertFf4j in project ff4j by ff4j.

the class SecuredFF4JResourceTestIT method setUp.

/**
 * {@inheritDoc}
 */
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    // Bridge security between ff4j and jersey
    ff4j.setAuthorizationsManager(new FF4JSecurityContextAuthenticationManager());
    if (assertFF4J == null) {
        assertFF4J = new AssertFf4j(ff4j);
    }
}
Also used : AssertFf4j(org.ff4j.test.AssertFf4j) FF4JSecurityContextAuthenticationManager(org.ff4j.web.api.security.FF4JSecurityContextAuthenticationManager) Before(org.junit.Before)

Example 3 with AssertFf4j

use of org.ff4j.test.AssertFf4j in project ff4j by ff4j.

the class CoreFeatureStoreTestSupport method setUp.

/**
 * {@inheritDoc}
 */
@Before
public void setUp() throws Exception {
    ff4j = new FF4j();
    FeatureStore fs = initStore();
    ff4j.setFeatureStore(fs);
    testedStore = fs;
    assertFf4j = new AssertFf4j(ff4j);
}
Also used : AssertFf4j(org.ff4j.test.AssertFf4j) FF4j(org.ff4j.FF4j) TestConstantsFF4j(org.ff4j.test.TestConstantsFF4j) FeatureStore(org.ff4j.core.FeatureStore) Before(org.junit.Before)

Example 4 with AssertFf4j

use of org.ff4j.test.AssertFf4j in project ff4j by ff4j.

the class FF4JMBeanTest method setUp.

@Before
public void setUp() throws Exception {
    openJmxConnection();
    assertFF4J = new AssertFf4j(ff4j);
}
Also used : AssertFf4j(org.ff4j.test.AssertFf4j) Before(org.junit.Before)

Example 5 with AssertFf4j

use of org.ff4j.test.AssertFf4j in project ff4j by ff4j.

the class AssertTest method initFF4J.

@Before
public void initFF4J() {
    if (assertFF4j == null) {
        ff4j = new FF4j();
        ff4j.setFeatureStore(new InMemoryFeatureStore("test-ff4j-features.xml"));
        ff4j.setPropertiesStore(new InMemoryPropertyStore("test-ff4j-features.xml"));
        ff4j.setAuthorizationsManager(new DefaultAuthorisationManager(Util.set("PERM1", "PERM2"), Util.set("PERM1", "PERM2", "PERM3")));
        assertFF4j = new AssertFf4j(ff4j);
    }
}
Also used : AssertFf4j(org.ff4j.test.AssertFf4j) InMemoryPropertyStore(org.ff4j.property.store.InMemoryPropertyStore) FF4j(org.ff4j.FF4j) InMemoryFeatureStore(org.ff4j.store.InMemoryFeatureStore) Before(org.junit.Before)

Aggregations

AssertFf4j (org.ff4j.test.AssertFf4j)7 Before (org.junit.Before)6 FF4j (org.ff4j.FF4j)4 FeatureStore (org.ff4j.core.FeatureStore)1 InMemoryPropertyStore (org.ff4j.property.store.InMemoryPropertyStore)1 InMemoryFeatureStore (org.ff4j.store.InMemoryFeatureStore)1 TestConstantsFF4j (org.ff4j.test.TestConstantsFF4j)1 FF4JSecurityContextAuthenticationManager (org.ff4j.web.api.security.FF4JSecurityContextAuthenticationManager)1 Test (org.junit.Test)1