use of org.ff4j.FF4j in project ff4j by ff4j.
the class InvalidParameter method testInvalidParameter.
@Test(expected = IllegalArgumentException.class)
public void testInvalidParameter() throws Throwable {
final IDoIt service = new IDoItImpl();
service.doIt("");
FeatureAdvisor fa = new FeatureAdvisor();
fa.setFf4j(new FF4j("test-ff4j-features.xml"));
MethodInvocation mi = new MethodInvocation() {
public Object proceed() throws Throwable {
return null;
}
public Object getThis() {
return service;
}
public AccessibleObject getStaticPart() {
return null;
}
public Object[] getArguments() {
return null;
}
public Method getMethod() {
try {
Method m = IDoIt.class.getMethod("doIt", String.class);
return m;
} catch (SecurityException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
return null;
}
};
fa.invoke(mi);
}
use of org.ff4j.FF4j in project ff4j by ff4j.
the class EhCacheCacheManagerTest2 method initialize.
@Before
public /**
* Init cache.
*/
void initialize() {
cacheManager = new FeatureCacheProviderEhCache();
// Stores in memory
ff4j = new FF4j();
ff4j.createFeature(new Feature("f1", false));
// Enable caching using EHCACHE
ff4j.cache(cacheManager);
// How to access cacheManager from FF4J
// ff4j.getCacheProxy().getCacheManager();
}
use of org.ff4j.FF4j in project ff4j by ff4j.
the class FF4jTest method testImportProperties.
@Test
public void testImportProperties() {
FF4j ff4j = new FF4j();
List<Property<?>> listOfProperties = new ArrayList<Property<?>>();
listOfProperties.add(new PropertyString("p1", "v1"));
ff4j.importProperties(listOfProperties);
Assert.assertTrue(ff4j.getPropertiesStore().existProperty("p1"));
// no Error
ff4j.importProperties(null);
}
use of org.ff4j.FF4j in project ff4j by ff4j.
the class FF4jTest method getConcreteFeatureStore.
@Test
public void getConcreteFeatureStore() {
FF4j ff4j = new FF4j();
ff4j.cache(new InMemoryCacheManager());
Assert.assertNotNull(ff4j.getCacheProxy());
Assert.assertNotNull(ff4j.getConcreteFeatureStore());
Assert.assertNotNull(ff4j.getConcretePropertyStore());
ff4j.setPropertiesStore(new PropertyStoreAuditProxy(ff4j, ff4j.getPropertiesStore()));
Assert.assertNotNull(ff4j.getConcretePropertyStore());
}
use of org.ff4j.FF4j in project ff4j by ff4j.
the class FF4jTest method testReadCoreMetadata.
@Test
public void testReadCoreMetadata() {
FF4j ff4j = new FF4j();
ff4j.getVersion();
Assert.assertNotNull(ff4j.getStartTime());
Assert.assertNotNull(ff4j.getPropertiesStore());
Assert.assertNotNull(ff4j.getCurrentContext());
Assert.assertNotNull(ff4j.getProperties());
}
Aggregations