Package org.togglz.core

Examples of org.togglz.core.Feature


    @Override
    public Boolean get(Object key) {

        Validate.notNull(key, "The feature must not be null");

        Feature feature = null;
        if (key instanceof Feature) {
            feature = (Feature) key;
        } else {
            feature = new NamedFeature(key.toString());
        }
View Full Code Here


    public synchronized void setFeatureState(FeatureState featureState) {

        // update file if changed
        fileContent.reloadIfUpdated();

        Feature feature = featureState.getFeature();
        Editor editor = fileContent.getEditor();

        // enabled
        String enabledKey = getEnabledPropertyName(feature);
        String enabledValue = featureState.isEnabled() ? "true" : "false";
View Full Code Here

        // Step 1: concurrently write a large number of state
        for (int i = 0; i < NUMBER_OF_FEATURES; i++) {

            // build up a feature state containing some data
            String name = "FEATURE" + i;
            Feature feature = new TestFeature(name);
            final FeatureState state = new FeatureState(feature)
                .setStrategyId("strategy-for-" + name)
                .setParameter("param-of-" + name, "some-value-of-" + name);

            // queue a thread writing that state
View Full Code Here

        StateRepository repository = new CachingStateRepository(delegate, 0);

        // do some lookups
        for (int i = 0; i < 10; i++) {
            Feature feature = (i % 2 == 0) ? DummyFeature.TEST :
                new NamedFeature(DummyFeature.TEST.name());
            assertTrue(repository.getFeatureState(feature).isEnabled());
            Thread.sleep(10);
        }
View Full Code Here

        if (!initialized) {
            throw new FactoryBeanNotInitializedException();
        }

        // create the invocation handler that switches between implementations
        Feature namedFeature = new NamedFeature(feature);
        FeatureProxyInvocationHandler proxy = new FeatureProxyInvocationHandler(namedFeature, active, inactive);

        // obtain the interface for which to create the proxy
        Class<?> proxyType = getEffectiveProxyType();
View Full Code Here

        FeatureManager featureManager = event.getFeatureManager();
        HttpServletRequest request = event.getRequest();
        HttpServletResponse response = event.getResponse();

        // identify the feature
        Feature feature = null;
        String featureAsString = request.getParameter("f");
        for (Feature f : featureManager.getFeatures()) {
            if (f.name().equals(featureAsString)) {
                feature = f;
            }
View Full Code Here

    public void canBootstrapViaConstructor() {
        FeatureManager featureManager = mock(FeatureManager.class);
        Set<Feature> features = new HashSet<Feature>();
        String name1 = "Feature 1";
        String name2 = "Feature 2";
        Feature feature1 = mock(Feature.class, name1);
        Feature feature2 = mock(Feature.class, name2);
        features.add(feature1);
        features.add(feature2);
        when(featureManager.getFeatures()).thenReturn(features);
        when(feature1.name()).thenReturn(name1);
        when(feature2.name()).thenReturn(name2);
        when(featureManager.isActive(featureNamed(name1))).thenReturn(true);
        when(featureManager.isActive(featureNamed(name2))).thenReturn(false);
        Map<Object, Boolean> map = new FeatureMap(featureManager);
        assertThat(map.size(), equalTo(2));
        assertThat(map.isEmpty(), is(false));
View Full Code Here

TOP

Related Classes of org.togglz.core.Feature

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.