Package org.jtalks.jcommune.model.entity

Examples of org.jtalks.jcommune.model.entity.PluginProperty


        doCallRealMethod().when(plugin).getState();
    }

    @Test
    public void configureShouldApplyConfiguration() throws Exception{
        List<PluginProperty> properties = Arrays.asList(new PluginProperty());
        when(configuration.getProperties()).thenReturn(properties);
        when(plugin.applyConfiguration(properties)).thenReturn(Collections.<PluginProperty, String>emptyMap());

        plugin.configure(configuration);
        verify(plugin).applyConfiguration(properties);
View Full Code Here


        verify(plugin).applyConfiguration(properties);
    }

    @Test(expectedExceptions = UnexpectedErrorException.class)
    public void configureShouldThrowUnexpectedErrorExceptionWhenRuntimeExceptionOccurs() throws Exception{
        List<PluginProperty> properties = Arrays.asList(new PluginProperty());
        when(configuration.getProperties()).thenReturn(properties);
        when(plugin.applyConfiguration(properties)).thenThrow(new RuntimeException());

        plugin.configure(configuration);
    }
View Full Code Here

        plugin.configure(configuration);
    }

    @Test
    public void getStateShouldReturnEnabledStateWhenPluginConfiguredAsActive() throws Exception{
        List<PluginProperty> properties = Arrays.asList(new PluginProperty());
        when(configuration.getProperties()).thenReturn(properties);
        when(configuration.isActive()).thenReturn(true);
        when(plugin.applyConfiguration(properties)).thenReturn(Collections.<PluginProperty, String>emptyMap());

        plugin.configure(configuration);
View Full Code Here

        assertEquals(plugin.getState(), Plugin.State.ENABLED);
    }

    @Test
    public void getStateShouldReturnConfiguredStateWhenPluginConfiguredAsNotActive() throws Exception{
        List<PluginProperty> properties = Arrays.asList(new PluginProperty());
        when(configuration.getProperties()).thenReturn(properties);
        when(configuration.isActive()).thenReturn(false);
        when(plugin.applyConfiguration(properties)).thenReturn(Collections.<PluginProperty, String>emptyMap());

        plugin.configure(configuration);
View Full Code Here

        assertEquals(plugin.getState(), Plugin.State.CONFIGURED);
    }

    @Test
    public void getStateShouldReturnInErrorStateWhenConfigurationErrorOccurs() throws PluginConfigurationException {
        List<PluginProperty> properties = Arrays.asList(new PluginProperty());
        when(configuration.getProperties()).thenReturn(properties);
        when(plugin.applyConfiguration(properties)).thenThrow(new RuntimeException());

        try {
            plugin.configure(configuration);
View Full Code Here

    private static final String ORDER_PROPERTY = "label.order";

    @Test
    public void testConfigure() throws Exception {
        PluginProperty property = new PluginProperty(ORDER_PROPERTY, PluginProperty.Type.INT, "102");
        PluginConfiguration config = new PluginConfiguration("Questions and Answers plugin", true, Arrays.asList(property));
        QuestionsAndAnswersPlugin plugin = new QuestionsAndAnswersPlugin();

        plugin.configure(config);
View Full Code Here

        assertEquals(plugin.getState(), Plugin.State.ENABLED);
    }

    @Test(expectedExceptions = UnexpectedErrorException.class)
    public void configurationWithIncorrectParameterShouldThrowUnexpectedErrorException() throws Exception {
        PluginProperty property = new PluginProperty("anyProperty", PluginProperty.Type.STRING, "string");
        PluginConfiguration config = new PluginConfiguration("Questions and Answers plugin", true, Arrays.asList(property));
        QuestionsAndAnswersPlugin plugin = new QuestionsAndAnswersPlugin();

        plugin.configure(config);
    }
View Full Code Here

        plugin.configure(config);
    }

    @Test(expectedExceptions = UnexpectedErrorException.class)
    public void configurationWithIncorrectParametersNumberShouldThrowUnexpectedErrorException() throws Exception {
        PluginProperty correctProperty = new PluginProperty(ORDER_PROPERTY, PluginProperty.Type.INT, "102");
        PluginProperty incorrectProperty = new PluginProperty("anyProperty", PluginProperty.Type.STRING, "string");
        PluginConfiguration config = new PluginConfiguration("Questions and Answers plugin", true,
                Arrays.asList(correctProperty, incorrectProperty));
        QuestionsAndAnswersPlugin plugin = new QuestionsAndAnswersPlugin();

        plugin.configure(config);
View Full Code Here

        plugin.configure(config);
    }

    @Test(expectedExceptions = UnexpectedErrorException.class)
    public void configurationWithIncorrectParameterTypeShouldThrowUnexpectedErrorException() throws Exception {
        PluginProperty property = new PluginProperty(ORDER_PROPERTY, PluginProperty.Type.INT, "string");
        PluginConfiguration config = new PluginConfiguration("Questions and Answers plugin", true, Arrays.asList(property));
        QuestionsAndAnswersPlugin plugin = new QuestionsAndAnswersPlugin();

        plugin.configure(config);
    }
View Full Code Here

        plugin.configure(config);
    }

    @Test
    public void defaultConfigurationShouldBeAppliedIfConfigureWithNullOrderValue() throws Exception {
        PluginProperty property = new PluginProperty(ORDER_PROPERTY, PluginProperty.Type.INT, null);
        PluginConfiguration config = new PluginConfiguration("Questions and Answers plugin", true, Arrays.asList(property));
        QuestionsAndAnswersPlugin plugin = new QuestionsAndAnswersPlugin();

        plugin.configure(config);
        List<PluginProperty> actualConfiguration = plugin.getConfiguration();
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.model.entity.PluginProperty

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.