Search in sources :

Example 1 with FF4j

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

the class FF4jDisableAttrProcessor method isVisible.

@Override
protected boolean isVisible(Arguments arguments, Element element, String attributeName) {
    final String feature = element.getAttributeValue(attributeName);
    if (feature == null || feature.trim().equals("")) {
        return false;
    }
    // getFF4j(arguments.getContext());
    FF4j ff4j = new FF4j();
    return !ff4j.check(feature);
}
Also used : FF4j(org.ff4j.FF4j)

Example 2 with FF4j

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

the class FF4jEnableAttrProcessor method isVisible.

@Override
protected boolean isVisible(Arguments arguments, Element element, String attributeName) {
    final String feature = element.getAttributeValue(attributeName);
    if (feature == null || feature.trim().equals("")) {
        return false;
    }
    // getFF4j(arguments.getContext());
    FF4j ff4j = new FF4j();
    return ff4j.check(feature);
}
Also used : FF4j(org.ff4j.FF4j)

Example 3 with FF4j

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

the class PropertyStoreHttpTest method initializingInMemory.

/**
 * Start Server Grizzly before tests on remote FeatureStore.
 */
@BeforeClass
public static void initializingInMemory() throws Exception {
    // Reinit FF4J
    FeatureStoreHttpTestIT.ff4j = new FF4j("test-ff4j-features.xml");
    jt = new PropertyStoreHttpTestIT();
    jt.setUp();
}
Also used : FF4j(org.ff4j.FF4j) BeforeClass(org.junit.BeforeClass)

Example 4 with FF4j

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

the class FlipSecurityTests method setUp.

@Before
public void setUp() throws Exception {
    securityCtx = SecurityContextHolder.getContext();
    // Init SpringSecurity Context
    SecurityContext context = new SecurityContextImpl();
    List<GrantedAuthority> listOfRoles = new ArrayList<GrantedAuthority>();
    listOfRoles.add(new SimpleGrantedAuthority("ROLE_USER"));
    User u1 = new User("user1", "user1", true, true, true, true, listOfRoles);
    UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(u1.getUsername(), u1.getPassword(), u1.getAuthorities());
    token.setDetails(u1);
    context.setAuthentication(token);
    SecurityContextHolder.setContext(context);
    // <--
    ff4j = new FF4j("test-ff4j-security-spring.xml");
    ff4j.setAuthorizationsManager(new SpringSecurityAuthorisationManager());
}
Also used : SimpleGrantedAuthority(org.springframework.security.core.authority.SimpleGrantedAuthority) SecurityContextImpl(org.springframework.security.core.context.SecurityContextImpl) User(org.springframework.security.core.userdetails.User) FF4j(org.ff4j.FF4j) SimpleGrantedAuthority(org.springframework.security.core.authority.SimpleGrantedAuthority) GrantedAuthority(org.springframework.security.core.GrantedAuthority) SecurityContext(org.springframework.security.core.context.SecurityContext) ArrayList(java.util.ArrayList) SpringSecurityAuthorisationManager(org.ff4j.security.SpringSecurityAuthorisationManager) UsernamePasswordAuthenticationToken(org.springframework.security.authentication.UsernamePasswordAuthenticationToken) Before(org.junit.Before)

Example 5 with FF4j

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

the class FlipSecurityTests2 method setUp.

@Before
public void setUp() throws Exception {
    securityCtx = SecurityContextHolder.getContext();
    // Init SpringSecurity Context
    SecurityContext context = new SecurityContextImpl();
    List<GrantedAuthority> listOfRoles = new ArrayList<GrantedAuthority>();
    listOfRoles.add(new SimpleGrantedAuthority("ROLE_USER"));
    User u1 = new User("user1", "user1", true, true, true, true, listOfRoles);
    UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(u1.getUsername(), u1.getPassword(), u1.getAuthorities());
    token.setDetails(u1);
    context.setAuthentication(token);
    SecurityContextHolder.setContext(context);
    // <--
    ff4j = new FF4j("test-ff4j-security-spring.xml");
    ff4j.setAuthorizationsManager(new SpringSecurityAuthorisationManager());
}
Also used : SimpleGrantedAuthority(org.springframework.security.core.authority.SimpleGrantedAuthority) SecurityContextImpl(org.springframework.security.core.context.SecurityContextImpl) User(org.springframework.security.core.userdetails.User) FF4j(org.ff4j.FF4j) SimpleGrantedAuthority(org.springframework.security.core.authority.SimpleGrantedAuthority) GrantedAuthority(org.springframework.security.core.GrantedAuthority) SecurityContext(org.springframework.security.core.context.SecurityContext) ArrayList(java.util.ArrayList) SpringSecurityAuthorisationManager(org.ff4j.security.SpringSecurityAuthorisationManager) UsernamePasswordAuthenticationToken(org.springframework.security.authentication.UsernamePasswordAuthenticationToken) Before(org.junit.Before)

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