Examples of FeatureState


Examples of com.sun.org.apache.xerces.internal.util.FeatureState

     *                                   it is <strong>really</strong>
     *                                   a critical error.
     */
    public boolean getFeature(String featureId)
            throws XMLConfigurationException {
        FeatureState state = getFeatureState(featureId);
        if (state.isExceptional()) {
            throw new XMLConfigurationException(state.status, featureId);
        }
        return state.state;
    }
View Full Code Here

Examples of com.tacitknowledge.flip.model.FeatureState

    }

    @Override
    public FeatureState getFeatureState(final String name)
    {
        FeatureState result;
        try
        {
            final FeatureDescriptor featureDescriptor = propertyManager.getFeatureDescriptor(name);
            result = featureDescriptor.process(contextManager);
        }
        catch (final FlipException ex)
        {
            logger.log(
                    Level.WARNING,
                    String.format(
                            "An exception has occured during Feature State extraction for feature named [%s]. Using [%s] value.",
                            name, FeatureState.DISABLED.toString()), ex);

            result = FeatureState.DISABLED;
        }

        if (isFeatureHasParent(name))
        {
            final FeatureState parentResult = getFeatureState(getParentFeatureName(name));
            result = FeatureState.getByState(parentResult.state() && result.state());
        }

        return result;
    }
View Full Code Here

Examples of org.togglz.core.repository.FeatureState

        String enabledAsStr = fileContent.getValue(getEnabledPropertyName(feature), null);

        if (enabledAsStr != null) {

            // new state instance
            FeatureState state = new FeatureState(feature);
            state.setEnabled(isTrue(enabledAsStr));

            // active strategy (may be null)
            String strategy = fileContent.getValue(getStrategyPropertyName(feature), null);
            state.setStrategyId(strategy);

            // all parameters
            String paramPrefix = getParameterPropertyName(feature, "");
            for (String key : fileContent.getKeysStartingWith(paramPrefix)) {
                String id = key.substring(paramPrefix.length());
                String value = fileContent.getValue(key, null);
                state.setParameter(id, value);
            }

            /*
             * Backwards compatibility: if there are users stored in the old format, add them to the corresponding property
             */
            List<String> additionalUsers = toList(fileContent.getValue(getUsersPropertyName(feature), null));
            if (!additionalUsers.isEmpty()) {

                // join the users to one list and update the property
                List<String> currentUsers = toList(state.getParameter(UsernameActivationStrategy.PARAM_USERS));
                currentUsers.addAll(additionalUsers);
                state.setParameter(UsernameActivationStrategy.PARAM_USERS, Strings.join(currentUsers, ","));

                // we should set strategy id if it is not yet set
                if (state.getStrategyId() == null) {
                    state.setStrategyId(UsernameActivationStrategy.ID);
                }

            }

            return state;
View Full Code Here

Examples of org.togglz.core.repository.FeatureState

        if (entry != null && !isExpired(entry)) {
            return entry.getState() != null ? entry.getState().copy() : null;
        }

        // no cache hit
        FeatureState featureState = delegate.getFeatureState(feature);

        // cache the result (may be null)
        cache.put(feature.name(), new CacheEntry(featureState != null ? featureState.copy() : null));

        // return the result
        return featureState;

    }
View Full Code Here

Examples of org.togglz.core.repository.FeatureState

        // obtain the service
        SomeService someService = (SomeService) getSpringBean("someServiceManuallySetProxyType");
        assertNotNull(someService);

        // disable the feature flag
        FeatureContext.getFeatureManager().setFeatureState(new FeatureState(ProxyFeatures.SERVICE_TOGGLE, false));

        // first the inactive Service is invoked
        assertEquals("I'm SomeServiceInactive", someService.whoAreYou());

        // enable the feature flag
        FeatureContext.getFeatureManager().setFeatureState(new FeatureState(ProxyFeatures.SERVICE_TOGGLE, true));

        // calls are now delegated to the other service implementation
        assertEquals("I'm SomeServiceActive", someService.whoAreYou());

    }
View Full Code Here

Examples of org.togglz.core.repository.FeatureState

        // obtain the service
        SomeService someService = (SomeService) getSpringBean("someServiceAutoDetectProxyType");
        assertNotNull(someService);

        // disable the feature flag
        FeatureContext.getFeatureManager().setFeatureState(new FeatureState(ProxyFeatures.SERVICE_TOGGLE, false));

        // first the inactive Service is invoked
        assertEquals("I'm SomeServiceInactive", someService.whoAreYou());

        // enable the feature flag
        FeatureContext.getFeatureManager().setFeatureState(new FeatureState(ProxyFeatures.SERVICE_TOGGLE, true));

        // calls are now delegated to the other service implementation
        assertEquals("I'm SomeServiceActive", someService.whoAreYou());

    }
View Full Code Here

Examples of org.togglz.core.repository.FeatureState

    @Test
    public void testShouldSaveStateWithoutStrategyOrParameters() throws EntityNotFoundException {
        /*
         * WHEN a feature without strategy is persisted
         */
        final FeatureState state = new FeatureState(TestFeature.F1).disable();
        repository.setFeatureState(state);

        /*
         * THEN there should be a corresponding entry in the database
         */
 
View Full Code Here

Examples of org.togglz.core.repository.FeatureState

    public void testShouldSaveStateStrategyAndParameters() throws EntityNotFoundException {

        /*
         * WHEN a feature without strategy is persisted
         */
        final FeatureState state = new FeatureState(TestFeature.F1)
            .enable()
            .setStrategyId("someId")
            .setParameter("param", "foo");
        repository.setFeatureState(state);

View Full Code Here

Examples of org.togglz.core.repository.FeatureState

    @Test
    public void shouldReturnNullWhenStateDoesntExist() {
        /*
         * GIVEN there is no feature state in the datastore WHEN the repository reads the state
         */
        final FeatureState state = repository.getFeatureState(TestFeature.F1);

        /*
         * THEN the properties should be set like expected
         */
        assertNull(state);
View Full Code Here

Examples of org.togglz.core.repository.FeatureState

        update("F1", false, null, null, null);

        /*
         * WHEN the repository reads the state
         */
        final FeatureState state = repository.getFeatureState(TestFeature.F1);

        /*
         * THEN the properties should be set like expected
         */
        assertNotNull(state);
        assertEquals(TestFeature.F1, state.getFeature());
        assertEquals(false, state.isEnabled());
        assertEquals(null, state.getStrategyId());
        assertEquals(0, state.getParameterNames().size());

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.