Package org.togglz.core.user

Examples of org.togglz.core.user.FeatureUser


        assertEquals(false, active);
    }

    @Test
    public void multipleMachineIps() {
        FeatureUser user = new SimpleFeatureUser("ea", false);
        FeatureState state = new FeatureState(MyFeature.FEATURE).enable().setStrategyId(ServerIpActivationStrategy.ID);
        state.setParameter(ServerIpActivationStrategy.PARAM_IPS, "1.1.1.1,2.2.2.2," + getMachineIP());
        boolean active = strategy.isActive(state, user);
        assertEquals(true, active);
    }
View Full Code Here


    private final UsernameActivationStrategy strategy = new UsernameActivationStrategy();

    @Test
    public void shouldReturnFalseForEmptyUserlist() {

        FeatureUser user = new SimpleFeatureUser("ck", false);
        FeatureState state = new FeatureState(MyFeature.FEATURE)
            .enable()
            .setStrategyId(UsernameActivationStrategy.ID);

        boolean active = strategy.isActive(state, user);
View Full Code Here

    }

    @Test
    public void shouldReturnFalseForUnknownUser() {

        FeatureUser user = null;
        FeatureState state = new FeatureState(MyFeature.FEATURE)
            .enable()
            .setStrategyId(UsernameActivationStrategy.ID)
            .setParameter(UsernameActivationStrategy.PARAM_USERS, "person1,ck,person2");
View Full Code Here

    }

    @Test
    public void shouldReturnFalseForDifferentUser() {

        FeatureUser user = new SimpleFeatureUser("john", false);
        FeatureState state = new FeatureState(MyFeature.FEATURE)
            .enable()
            .setStrategyId(UsernameActivationStrategy.ID)
            .setParameter(UsernameActivationStrategy.PARAM_USERS, "person1,ck,person2");
View Full Code Here

    }

    @Test
    public void shouldReturnTrueForCorrectUser() {

        FeatureUser user = new SimpleFeatureUser("ck", false);
        FeatureState state = new FeatureState(MyFeature.FEATURE)
            .enable()
            .setStrategyId(UsernameActivationStrategy.ID)
            .setParameter(UsernameActivationStrategy.PARAM_USERS, "person1,ck,person2");
View Full Code Here

        response.sendError(404);

    }

    private boolean isFeatureAdmin() {
        FeatureUser user = featureManager.getCurrentFeatureUser();
        return user != null && user.isFeatureAdmin();
    }
View Full Code Here

            .setEnvIsAdmin(true)
            .setEnvEmail("admin@togglz.org")
            .setEnvAuthDomain("togglz.org");

        UserService userService = UserServiceFactory.getUserService();
        FeatureUser user = userProvider.getCurrentUser();
        assertTrue(user.isFeatureAdmin());
        assertEquals(userService.getCurrentUser().getUserId(), user.getName());
        assertEquals(userService.getCurrentUser().getEmail(), user.getAttribute("email"));
        assertEquals(userService.getCurrentUser().getNickname(), user.getAttribute("nickname"));
    }
View Full Code Here

TOP

Related Classes of org.togglz.core.user.FeatureUser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.