Package com.tacitknowledge.flip.model

Examples of com.tacitknowledge.flip.model.FeatureDescriptor


     */
    public FeatureDescriptor getFeatureDescriptor(final String name)
    {
        for (final PropertyReader reader : propertyReaders)
        {
            final FeatureDescriptor descriptor = reader.getFeatureDescriptor(name);
            if (descriptor != null)
            {
                return descriptor;
            }
        }
View Full Code Here


    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,
View Full Code Here

        featureService = new FeatureServiceImpl(environment);
    }
   
    @Test
    public void testInvokeFeature() {
        FeatureDescriptor featureDescriptor = mock(FeatureDescriptor.class);
        when(featureDescriptor.process(any(ContextManager.class))).thenReturn(FeatureState.ENABLED);
        when(propertyReader.getFeatureDescriptor(eq("test"))).thenReturn(featureDescriptor);
       
        assertEquals(FeatureState.ENABLED, featureService.getFeatureState("test"));
       
        verify(propertyReader).getFeatureDescriptor(eq("test"));
View Full Code Here

        verify(propertyReader).getFeatureDescriptor(eq("test"));
    }
   
    @Test
    public void testInvokeFeatureDisabled() {
        FeatureDescriptor featureDescriptor = mock(FeatureDescriptor.class);
        when(featureDescriptor.process(any(ContextManager.class))).thenReturn(FeatureState.DISABLED);
        when(propertyReader.getFeatureDescriptor(eq("test"))).thenReturn(featureDescriptor);
       
        assertEquals(FeatureState.DISABLED, featureService.getFeatureState("test"));
       
        verify(propertyReader).getFeatureDescriptor(eq("test"));
View Full Code Here

        verify(propertyReader).getFeatureDescriptor(eq("test"));
    }
   
    @Test
    public void testInvokeFeatureUnknownProperty() {
        FeatureDescriptor featureDescriptor = mock(FeatureDescriptor.class);
        when(featureDescriptor.process(any(ContextManager.class))).thenThrow(new UnknownContextPropertyException());
        when(propertyReader.getFeatureDescriptor(eq("test"))).thenReturn(featureDescriptor);
       
        assertEquals(FeatureState.DISABLED, featureService.getFeatureState("test"));
    }
View Full Code Here

        assertEquals(FeatureState.DISABLED, featureService.getFeatureState("test"));
    }
   
    @Test
    public void testHieraclicalFeaturesChildFailed() {
        FeatureDescriptor item = mock(FeatureDescriptor.class);
        when(item.process(any(ContextManager.class))).thenThrow(new UnknownContextPropertyException());
        when(propertyReader.getFeatureDescriptor(eq("test.item"))).thenReturn(item);

        FeatureDescriptor parent = mock(FeatureDescriptor.class);
        when(parent.process(any(ContextManager.class))).thenReturn(FeatureState.ENABLED);
        when(propertyReader.getFeatureDescriptor(eq("test"))).thenReturn(parent);
       
        assertEquals(FeatureState.DISABLED, featureService.getFeatureState("test.item"));
    }
View Full Code Here

        assertEquals(FeatureState.DISABLED, featureService.getFeatureState("test.item"));
    }
   
    @Test
    public void testHieraclicalFeaturesChildAndParentHaveTheSameStatus() {
        FeatureDescriptor item = mock(FeatureDescriptor.class);
        when(item.process(any(ContextManager.class))).thenReturn(FeatureState.ENABLED);
        when(propertyReader.getFeatureDescriptor(eq("test.item"))).thenReturn(item);

        FeatureDescriptor parent = mock(FeatureDescriptor.class);
        when(parent.process(any(ContextManager.class))).thenReturn(FeatureState.ENABLED);
        when(propertyReader.getFeatureDescriptor(eq("test"))).thenReturn(parent);
       
        assertEquals(FeatureState.ENABLED, featureService.getFeatureState("test.item"));
    }
View Full Code Here

        assertEquals(FeatureState.ENABLED, featureService.getFeatureState("test.item"));
    }
   
    @Test
    public void testHieraclicalFeaturesChildAndParentHaveDifferentStatuses() {
        FeatureDescriptor item = mock(FeatureDescriptor.class);
        when(item.process(any(ContextManager.class))).thenReturn(FeatureState.ENABLED);
        when(propertyReader.getFeatureDescriptor(eq("test.item"))).thenReturn(item);

        FeatureDescriptor parent = mock(FeatureDescriptor.class);
        when(parent.process(any(ContextManager.class))).thenReturn(FeatureState.DISABLED);
        when(propertyReader.getFeatureDescriptor(eq("test"))).thenReturn(parent);
       
        assertEquals(FeatureState.DISABLED, featureService.getFeatureState("test.item"));
    }
View Full Code Here

        assertEquals(FeatureState.DISABLED, featureService.getFeatureState("test.item"));
    }
   
    @Test
    public void testHieraclicalFeaturesChildAndParentHaveDifferentStatuses2() {
        FeatureDescriptor item = mock(FeatureDescriptor.class);
        when(item.process(any(ContextManager.class))).thenReturn(FeatureState.DISABLED);
        when(propertyReader.getFeatureDescriptor(eq("test.item"))).thenReturn(item);

        FeatureDescriptor parent = mock(FeatureDescriptor.class);
        when(parent.process(any(ContextManager.class))).thenReturn(FeatureState.ENABLED);
        when(propertyReader.getFeatureDescriptor(eq("test"))).thenReturn(parent);
       
        assertEquals(FeatureState.DISABLED, featureService.getFeatureState("test.item"));
    }
View Full Code Here

*/
@FlipProperty(priority=2)
public class TestPropertyReader implements PropertyReader {

    public FeatureDescriptor getFeatureDescriptor(String name) {
        FeatureDescriptor result = new FeatureDescriptor();
        result.setName("feature-1");
        return result;
    }
View Full Code Here

TOP

Related Classes of com.tacitknowledge.flip.model.FeatureDescriptor

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.