Search in sources :

Example 21 with FF4j

use of org.ff4j.FF4j in project ff4j by ff4j.

the class InMemoryPropertiesStoreTest method testProperty.

public void testProperty() {
    FF4j ff4j = new FF4j("ff4j.xml");
    ff4j.getPropertiesStore().createProperty(new PropertyDate("property_3", new Date()));
    Property<?> ap = ff4j.getPropertiesStore().readProperty("property_3");
    PropertyDate pDate = (PropertyDate) ap;
    pDate.setValue(new Date());
    ff4j.getPropertiesStore().updateProperty(pDate);
    ff4j.getPropertiesStore().deleteProperty("property_3");
}
Also used : FF4j(org.ff4j.FF4j) Date(java.util.Date) PropertyDate(org.ff4j.property.PropertyDate) PropertyDate(org.ff4j.property.PropertyDate)

Example 22 with FF4j

use of org.ff4j.FF4j in project ff4j by ff4j.

the class FeatureJsonMarshallTest method marshallOfficeHourFlippingStrategy.

/**
 * TDD.
 */
@Test
@Ignore
public void marshallOfficeHourFlippingStrategy() throws Exception {
    // When-Then
    Feature f = new FF4j("test-strategy-officehour.xml").getFeature("first");
    assertMarshalling(f);
}
Also used : FF4j(org.ff4j.FF4j) TestConstantsFF4j(org.ff4j.test.TestConstantsFF4j) Feature(org.ff4j.core.Feature) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 23 with FF4j

use of org.ff4j.FF4j in project ff4j by ff4j.

the class ApiConfigTest method testApiConfig.

@Test
public void testApiConfig() {
    ApiConfig apc1 = new ApiConfig();
    apc1.setVersion("1");
    apc1.getVersion();
    apc1.isAuthenticate();
    apc1.isAutorize();
    apc1.isDocumentation();
    apc1.isLog();
    apc1.setFF4j(new FF4j());
    apc1.getFF4j();
    apc1.setApiKeys(Util.set("1", "2"));
    apc1.getApiKeys();
    apc1.setAuthenticate(false);
    apc1.setAutorize(false);
    apc1.setHost("localhost");
    apc1.getHost();
    apc1.setPort(8080);
    apc1.getPort();
    apc1.setPermissions(new HashMap<String, Set<String>>());
    apc1.getPermissions();
    apc1.setLog(false);
    apc1.setUsers(new HashMap<String, String>());
    apc1.getUsers();
    apc1.getWebContext();
    apc1.getContextPath();
    apc1.createApiKey("key", true, true, Util.set("USER", "ADMIN"));
    apc1.createUser("john", "tiger", true, true, Util.set("USER", "ADMIN"));
    apc1.setFF4j(new FF4j());
    new ApiConfigBuilder(apc1);
}
Also used : ApiConfigBuilder(org.ff4j.web.ApiConfigBuilder) Set(java.util.Set) FF4j(org.ff4j.FF4j) ApiConfig(org.ff4j.web.ApiConfig) Test(org.junit.Test)

Example 24 with FF4j

use of org.ff4j.FF4j in project ff4j by ff4j.

the class ApiConfigTest method tesApiConfigBuilder.

@Test
public void tesApiConfigBuilder() {
    ApiConfigBuilder b = new ApiConfigBuilder();
    b.addApiKey("123").addUser("", "").authenticate(false).documentation(false).host("localhost").port(12).webContext("/ok").withAuthentication().withAutorization().withDocumentation().withoutAuthentication().withoutAutorization().withoutDocumentation();
    ApiConfig conf = b.build();
    Assert.assertNotNull(conf);
    new ApiConfigBuilder(new FF4j());
}
Also used : ApiConfigBuilder(org.ff4j.web.ApiConfigBuilder) FF4j(org.ff4j.FF4j) ApiConfig(org.ff4j.web.ApiConfig) Test(org.junit.Test)

Example 25 with FF4j

use of org.ff4j.FF4j in project ff4j by ff4j.

the class FF4jInitializationTest method testInitConstructor2.

@Test
public void testInitConstructor2() {
    FF4j f2 = new FF4j();
    f2.setAutocreate(true);
    testingGeneratedFF4j(f2);
}
Also used : FF4j(org.ff4j.FF4j) Test(org.junit.Test)

Aggregations

FF4j (org.ff4j.FF4j)60 Test (org.junit.Test)41 Before (org.junit.Before)9 Feature (org.ff4j.core.Feature)8 ArrayList (java.util.ArrayList)4 PropertyString (org.ff4j.property.PropertyString)4 InMemoryFeatureStore (org.ff4j.store.InMemoryFeatureStore)4 AssertFf4j (org.ff4j.test.AssertFf4j)4 InMemoryPropertyStore (org.ff4j.property.store.InMemoryPropertyStore)3 Date (java.util.Date)2 HashSet (java.util.HashSet)2 PropertyStoreAuditProxy (org.ff4j.audit.proxy.PropertyStoreAuditProxy)2 InMemoryCacheManager (org.ff4j.cache.InMemoryCacheManager)2 FeatureStore (org.ff4j.core.FeatureStore)2 PropertyDate (org.ff4j.property.PropertyDate)2 PropertyStore (org.ff4j.property.store.PropertyStore)2 SpringSecurityAuthorisationManager (org.ff4j.security.SpringSecurityAuthorisationManager)2 TestConstantsFF4j (org.ff4j.test.TestConstantsFF4j)2 ApiConfig (org.ff4j.web.ApiConfig)2 ApiConfigBuilder (org.ff4j.web.ApiConfigBuilder)2