Search in sources :

Example 26 with InMemoryPropertyStore

use of org.ff4j.property.store.InMemoryPropertyStore in project ff4j by ff4j.

the class EventRepositoryTestSupport method setUp.

/**
 * {@inheritDoc}
 */
@Before
public void setUp() throws Exception {
    ff4j = new FF4j();
    ff4j.setFeatureStore(new InMemoryFeatureStore("test-ff4j-features.xml"));
    ff4j.setPropertiesStore(new InMemoryPropertyStore("test-ff4j-features.xml"));
    ff4j.setEventRepository(initRepository());
    repo = ff4j.getEventRepository();
}
Also used : InMemoryPropertyStore(org.ff4j.property.store.InMemoryPropertyStore) FF4j(org.ff4j.FF4j) InMemoryFeatureStore(org.ff4j.store.InMemoryFeatureStore) Before(org.junit.Before)

Example 27 with InMemoryPropertyStore

use of org.ff4j.property.store.InMemoryPropertyStore in project ff4j by ff4j.

the class PropertyStoreArchaiusPolledSourceTest method initArchauis.

@BeforeClass
public static void initArchauis() throws InterruptedException {
    // Sample FF4J Store
    PropertyStore ff4jStore = new InMemoryPropertyStore("ff4j-properties.xml");
    // FF4Store as polling Source for Archiaus
    PolledConfigurationSource ff4jSource = new FF4jPolledConfigurationSource(ff4jStore);
    // Working Thread (polling from ff4j => Archaius)
    AbstractPollingScheduler scheduler = new FixedDelayPollingScheduler(0, 1000, true);
    // Define configuration with polling and source
    configuration = new DynamicConfiguration(ff4jSource, scheduler);
}
Also used : InMemoryPropertyStore(org.ff4j.property.store.InMemoryPropertyStore) DynamicConfiguration(com.netflix.config.DynamicConfiguration) AbstractPollingScheduler(com.netflix.config.AbstractPollingScheduler) FixedDelayPollingScheduler(com.netflix.config.FixedDelayPollingScheduler) PolledConfigurationSource(com.netflix.config.PolledConfigurationSource) InMemoryPropertyStore(org.ff4j.property.store.InMemoryPropertyStore) PropertyStore(org.ff4j.property.store.PropertyStore) BeforeClass(org.junit.BeforeClass)

Example 28 with InMemoryPropertyStore

use of org.ff4j.property.store.InMemoryPropertyStore in project ff4j by ff4j.

the class CommonsConfigWithPropertyStoreTest method initCommonsConfWithFF4j.

@Before
public void initCommonsConfWithFF4j() throws ConfigurationException {
    // init configuration
    ff4jConf = new FF4jConfiguration(new InMemoryPropertyStore("ff4j-properties.xml"));
    // composite
    config = new CompositeConfiguration();
    config.setThrowExceptionOnMissing(true);
    config.addConfiguration(ff4jConf);
}
Also used : InMemoryPropertyStore(org.ff4j.property.store.InMemoryPropertyStore) CompositeConfiguration(org.apache.commons.configuration.CompositeConfiguration) Before(org.junit.Before)

Example 29 with InMemoryPropertyStore

use of org.ff4j.property.store.InMemoryPropertyStore in project ff4j by ff4j.

the class InMemoryPropertyStoreTest method testDonotImportInvalid.

@Test(expected = IllegalArgumentException.class)
public void testDonotImportInvalid() {
    InMemoryPropertyStore f = new InMemoryPropertyStore();
    f.importPropertiesFromXmlFile("invalid.xml");
}
Also used : InMemoryPropertyStore(org.ff4j.property.store.InMemoryPropertyStore) Test(org.junit.Test)

Example 30 with InMemoryPropertyStore

use of org.ff4j.property.store.InMemoryPropertyStore in project ff4j by ff4j.

the class InMemoryPropertyStoreTest method testImportTwice.

@Test
public void testImportTwice() {
    InMemoryPropertyStore f = new InMemoryPropertyStore();
    f.importPropertiesFromXmlFile("test-ff4j-features.xml");
    f.importPropertiesFromXmlFile("test-ff4j-features.xml");
}
Also used : InMemoryPropertyStore(org.ff4j.property.store.InMemoryPropertyStore) Test(org.junit.Test)

Aggregations

InMemoryPropertyStore (org.ff4j.property.store.InMemoryPropertyStore)41 Test (org.junit.Test)28 InMemoryFeatureStore (org.ff4j.store.InMemoryFeatureStore)10 PropertyString (org.ff4j.property.PropertyString)8 Property (org.ff4j.property.Property)6 PropertyStore (org.ff4j.property.store.PropertyStore)6 InputStream (java.io.InputStream)4 Before (org.junit.Before)4 FF4j (org.ff4j.FF4j)3 FF4jCacheProxy (org.ff4j.cache.FF4jCacheProxy)3 InMemoryCacheManager (org.ff4j.cache.InMemoryCacheManager)3 AbstractPollingScheduler (com.netflix.config.AbstractPollingScheduler)2 DynamicConfiguration (com.netflix.config.DynamicConfiguration)2 FixedDelayPollingScheduler (com.netflix.config.FixedDelayPollingScheduler)2 PolledConfigurationSource (com.netflix.config.PolledConfigurationSource)2 HashSet (java.util.HashSet)2 FF4JCacheManager (org.ff4j.cache.FF4JCacheManager)2 Feature (org.ff4j.core.Feature)2 BeforeClass (org.junit.BeforeClass)2 ClientResponse (com.sun.jersey.api.client.ClientResponse)1