Search in sources :

Example 21 with InMemoryCacheManager

use of org.ff4j.cache.InMemoryCacheManager in project ff4j by ff4j.

the class InMemoryCacheTest method testInitializations.

@Test
public void testInitializations() {
    InMemoryCacheManager fcm = new InMemoryCacheManager();
    Assert.assertNotNull(fcm.getFeatureNativeCache());
    Assert.assertNotNull(fcm.getPropertyNativeCache());
}
Also used : InMemoryCacheManager(org.ff4j.cache.InMemoryCacheManager) Test(org.junit.Test)

Example 22 with InMemoryCacheManager

use of org.ff4j.cache.InMemoryCacheManager in project ff4j by ff4j.

the class InMemoryCacheTest method testPutNullPropertyName.

@Test(expected = IllegalArgumentException.class)
public void testPutNullPropertyName() {
    PropertyString p = new PropertyString();
    p.setName(null);
    new InMemoryCacheManager().putProperty(p);
}
Also used : PropertyString(org.ff4j.property.PropertyString) InMemoryCacheManager(org.ff4j.cache.InMemoryCacheManager) Test(org.junit.Test)

Example 23 with InMemoryCacheManager

use of org.ff4j.cache.InMemoryCacheManager in project ff4j by ff4j.

the class InMemoryCacheTest method testPutEmptyFeatureId.

@Test(expected = IllegalArgumentException.class)
public void testPutEmptyFeatureId() {
    Feature f = new Feature("a");
    f.setUid("");
    new InMemoryCacheManager().putFeature(f);
}
Also used : InMemoryCacheManager(org.ff4j.cache.InMemoryCacheManager) Feature(org.ff4j.core.Feature) Test(org.junit.Test)

Example 24 with InMemoryCacheManager

use of org.ff4j.cache.InMemoryCacheManager in project ff4j by ff4j.

the class InMemoryCacheTest method testReadFeature.

@Test
public void testReadFeature() {
    // Given
    InMemoryCacheManager imcm = new InMemoryCacheManager();
    imcm.putFeature(new Feature("f1"), 100);
    // When
    Feature f = imcm.getFeature("f1");
    // Then
    Assert.assertNotNull(f);
    // When
    imcm.putFeature(new Feature("f1"), 1);
}
Also used : InMemoryCacheManager(org.ff4j.cache.InMemoryCacheManager) Feature(org.ff4j.core.Feature) Test(org.junit.Test)

Example 25 with InMemoryCacheManager

use of org.ff4j.cache.InMemoryCacheManager in project ff4j by ff4j.

the class InMemoryCacheTest method testPutNullFeatureId.

@Test(expected = IllegalArgumentException.class)
public void testPutNullFeatureId() {
    Feature f = new Feature("a");
    f.setUid(null);
    new InMemoryCacheManager().putFeature(f);
}
Also used : InMemoryCacheManager(org.ff4j.cache.InMemoryCacheManager) Feature(org.ff4j.core.Feature) Test(org.junit.Test)

Aggregations

InMemoryCacheManager (org.ff4j.cache.InMemoryCacheManager)29 Test (org.junit.Test)24 PropertyString (org.ff4j.property.PropertyString)11 FF4jCacheProxy (org.ff4j.cache.FF4jCacheProxy)9 Feature (org.ff4j.core.Feature)7 Given (cucumber.api.java.en.Given)5 InMemoryFeatureStore (org.ff4j.store.InMemoryFeatureStore)4 InMemoryPropertyStore (org.ff4j.property.store.InMemoryPropertyStore)3 HashSet (java.util.HashSet)2 FF4j (org.ff4j.FF4j)2 FF4JCacheManager (org.ff4j.cache.FF4JCacheManager)2 PropertyStoreAuditProxy (org.ff4j.audit.proxy.PropertyStoreAuditProxy)1 Store2CachePollingScheduler (org.ff4j.cache.Store2CachePollingScheduler)1 FeatureStore (org.ff4j.core.FeatureStore)1 Property (org.ff4j.property.Property)1 PropertyLogLevel (org.ff4j.property.PropertyLogLevel)1 PropertyStore (org.ff4j.property.store.PropertyStore)1 AbstractCacheManagerJUnitTest (org.ff4j.test.cache.AbstractCacheManagerJUnitTest)1