Package org.jtalks.jcommune.model.entity

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


        plugin.configure(configuration);
    }

    @Test
    public void pluginWithIncorrectUrlShouldNotBeConfigured() throws Exception {
        PluginConfiguration configuration = createConfiguration("http:/jtalks.org", "user", "1234");
        try {
            plugin.configure(configuration);
        } catch (UnexpectedErrorException ex) {
        }
View Full Code Here


                "Plugin with incorrect Url shouldn't be configured.");
    }

    @Test(expectedExceptions = UnexpectedErrorException.class)
    public void pluginWithIncorrectUrlShouldThrowException() throws Exception {
        PluginConfiguration configuration = createConfiguration("http:/jtalks.org", "user", "1234");
        plugin.configure(configuration);
    }
View Full Code Here

        urlProperty.setName("Url");
        PluginProperty loginProperty = new PluginProperty("LOGIN", STRING, login);
        loginProperty.setName("Login");
        PluginProperty passwordProperty = new PluginProperty("PASSWORD", STRING, password);
        passwordProperty.setName("Password");
        return new PluginConfiguration("Poulpe Auth Plugin", true,
                Arrays.asList(urlProperty, loginProperty, passwordProperty));
    }
View Full Code Here

    }

    @Test
    public void getPluginConfigurationShouldFindItInDatabase() throws NotFoundException {
        //GIVEN
        PluginConfiguration expectedConfiguration = new PluginConfiguration();
        String pluginName = "plugin";
        when(pluginConfigurationDao.get(pluginName)).thenReturn(expectedConfiguration);
        //WHEN
        PluginConfiguration actualConfiguration = pluginService.getPluginConfiguration(pluginName, FAKE_COMPONENT_ID);
        //THEN
        assertEquals(actualConfiguration, expectedConfiguration, "Plugin configuration should be retrieved from database.");
    }
View Full Code Here

    @Test
    public void updateConfigurationShouldSaveConfigurationProperties()
            throws NotFoundException, UnexpectedErrorException {
        //GIVEN
        List<PluginProperty> properties = Arrays.asList(new PluginProperty());
        PluginConfiguration configuration = new PluginConfiguration("Dummy", false, properties);
        when(pluginLoader.getPlugins()).thenReturn(Arrays.asList((Plugin) new DummyPlugin("Dummy")));
        //WHEN
        pluginService.updateConfiguration(configuration, FAKE_COMPONENT_ID);
        //THEN
        verify(pluginConfigurationDao).updateProperties(properties);
View Full Code Here

    @Test
    public void updateConfigurationShouldApplyConfigurationForPlugin()
            throws NotFoundException, UnexpectedErrorException {
        //GIVEN
        String pluginName = "Should be configured";
        PluginConfiguration configuration = new PluginConfiguration(pluginName, true, Collections.EMPTY_LIST);
        DummyPlugin shouldBeConfiguredPlugin = new DummyPlugin(pluginName);
        DummyPlugin shouldNotBeConfiguredPlugin = new DummyPlugin("Should not be configured");
        when(pluginLoader.getPlugins()).thenReturn(Arrays.asList((Plugin) shouldBeConfiguredPlugin, shouldNotBeConfiguredPlugin));
        //WHEN
        pluginService.updateConfiguration(configuration, FAKE_COMPONENT_ID);
View Full Code Here

    @Test(expectedExceptions = NotFoundException.class)
    public void updateConfigurationWhenPluginsNotLoadedShouldShowNotFoundError()
            throws NotFoundException, UnexpectedErrorException {
        //GIVEN
        PluginConfiguration configuration = new PluginConfiguration();
        when(pluginLoader.getPlugins()).thenReturn(Collections.<Plugin> emptyList());
        //WHEN
        pluginService.updateConfiguration(configuration, FAKE_COMPONENT_ID);
    }
View Full Code Here

    @Test
    public void getPluginByIdIfPluginExistsAndEnabledShouldBeSuccessful() throws NotFoundException {
        String pluginId = "1";
        String pluginName = "plugin";
        PluginConfiguration pluginConfiguration =
                new PluginConfiguration("plugin", true, new ArrayList<PluginProperty>());
        DummyPlugin plugin = new DummyPlugin(pluginName);
        when(pluginConfigurationDao.get(Long.valueOf(pluginId))).thenReturn(pluginConfiguration);
        List<Plugin> pluginList = new ArrayList<>();
        pluginList.add(plugin);
        when(pluginLoader.getPlugins()).thenReturn(pluginList);
View Full Code Here

    }

    @Test(expectedExceptions = NotFoundException.class)
    public void getPluginByIdIfPluginNotFoundShouldBeFailed() throws NotFoundException {
        String pluginId = "1";
        PluginConfiguration pluginConfiguration = new PluginConfiguration();
        when(pluginConfigurationDao.get(Long.valueOf(pluginId))).thenReturn(pluginConfiguration);
        List<Plugin> pluginList = new ArrayList<>();
        when(pluginLoader.getPlugins()).thenReturn(pluginList);

        pluginService.getPluginById(pluginId);
View Full Code Here

    @Test
    public void getRegistrationPluginsShouldReturnEnabledRegistrationPlugins() throws NotFoundException {
        RegistrationPlugin plugin = mock(RegistrationPlugin.class);
        Long pluginId = 1L;
        PluginConfiguration pluginConfiguration =
                new PluginConfiguration("plugin", true, new ArrayList<PluginProperty>());
        pluginConfiguration.setId(pluginId);
        List<Plugin> pluginList = new ArrayList<>();
        pluginList.add(plugin);
        when(plugin.getState()).thenReturn(Plugin.State.ENABLED);
        when(pluginLoader.getPlugins(any(TypeFilter.class))).thenReturn(pluginList);
        when(pluginConfigurationDao.get(plugin.getName())).thenReturn(pluginConfiguration);
View Full Code Here

TOP

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

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.