Examples of PluginConfiguration


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

    @Test
    public void getRegistrationPluginsIfAnyPluginConfigurationNotFoundShouldNotBeFailed() throws NotFoundException {
        RegistrationPlugin plugin = mock(RegistrationPlugin.class);
        Long pluginId = 1L;
        PluginConfiguration pluginConfiguration = new PluginConfiguration();
        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())).thenThrow(new NotFoundException());
View Full Code Here

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

    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);

        assertEquals(plugin.getState(), Plugin.State.ENABLED);
View Full Code Here

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

    }

    @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

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

    @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

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

    }

    @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

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

    }

    @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

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

        return registrationPluginMap;
    }

    @Override
    public Plugin getPluginById(String pluginId, PluginFilter... filters) throws NotFoundException {
        PluginConfiguration conf = getDao().get(Long.valueOf(pluginId));
        Plugin plugin = findPluginByName(pLuginLoader.getPlugins(filters), conf.getName());
        if (plugin == null) {
            throw new NotFoundException("Plugin with Id '" + pluginId + "' not found.");
        }
        return plugin;
    }
View Full Code Here

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

    @Override
    @PreAuthorize("hasPermission(#forumComponentId, 'COMPONENT', 'GeneralPermission.ADMIN')")
    public void updatePluginActivating(PluginActivatingDto updatedPlugin, long forumComponentId) throws NotFoundException {
        PluginConfigurationDao pluginConfigurationDao = getDao();
        String pluginName = updatedPlugin.getPluginName();
        PluginConfiguration configuration = pluginConfigurationDao.get(pluginName);
        boolean isActivated = updatedPlugin.isActivated();
        LOGGER.debug("Plugin activation for {} will be changed to {}.", pluginName, isActivated);
        configuration.setActive(isActivated);
        pluginConfigurationDao.saveOrUpdate(configuration);
        pLuginLoader.reloadPlugins(new NameFilter(updatedPlugin.getPluginName()));
    }
View Full Code Here

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

    @Test
    public void getShouldReturnPluginById() {

        session.clear();

        PluginConfiguration pluginConfiguration = PersistedObjectsFactory.getDefaultPluginConfiguration();

        PluginConfiguration foundPluginConfiguration = pluginConfigurationDao.get(pluginConfiguration.getId());

        assertNotNull(foundPluginConfiguration);
        assertReflectionEquals(foundPluginConfiguration, pluginConfiguration);
    }
View Full Code Here

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

        assertReflectionEquals(foundPluginConfiguration, pluginConfiguration);
    }

    @Test
    public void getWithPassedIdOfNonExistingPluginShouldReturnNull() {
        PluginConfiguration nonExistPluginConfiguration = pluginConfigurationDao.get(-788888L);

        assertNull(nonExistPluginConfiguration, "PluginConfiguration doesn't exist, so get must return null");
    }
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.