Examples of PluginConfiguration


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

    }

    @Test
    public void startConfiguringPluginShouldMoveToPluginConfigurationPage() throws NotFoundException {
        String configuredPluginName = "plugin";
        PluginConfiguration expectedConfiguration = new PluginConfiguration();
        long componentId = 25L;
        Component component = new Component();
        component.setId(componentId);
        List<Plugin> pluginList = Arrays.asList((Plugin) new DummyPlugin());

        when(componentService.getComponentOfForum()).thenReturn(component);
        when(pluginService.getPluginConfiguration(configuredPluginName, componentId)).thenReturn(expectedConfiguration);
        when(pluginLoader.getPlugins(new NameFilter(configuredPluginName))).thenReturn(pluginList);

        ModelAndView pluginConfigModelAndView = pluginController.startConfiguringPlugin(configuredPluginName);

        assertViewName(pluginConfigModelAndView, "plugin/pluginConfiguration");
        assertModelAttributeAvailable(pluginConfigModelAndView, "pluginConfiguration");
        assertModelAttributeAvailable(pluginConfigModelAndView, "labelsTranslation");
        PluginConfiguration actualPluginConfiguration = (PluginConfiguration) pluginConfigModelAndView.getModel().get("pluginConfiguration");
        assertEquals(actualPluginConfiguration, expectedConfiguration, "Plugin should be returned from services.");
    }
View Full Code Here

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

        long componentId = 25L;
        Component component = new Component();
        component.setId(componentId);
        when(componentService.getComponentOfForum()).thenReturn(component);
        String pluginName = "plugin";
        PluginConfiguration newConfiguration = new PluginConfiguration();
        newConfiguration.setName(pluginName);

        Model model = new ExtendedModelMap();
        ModelAndView mav = pluginController.updateConfiguration(model, newConfiguration);

        assertViewName(mav, "redirect:/plugins/configure/" + pluginName);
View Full Code Here

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

    }

    @Test
    public void updateConfigurationShouldReturnConfigurationPageWithErrorWhenConfigurationWasFailed()
            throws NotFoundException, UnexpectedErrorException {
        PluginConfiguration newConfiguration = createFailingConfiguration();

        Model model = new ExtendedModelMap();
        ModelAndView mav = pluginController.updateConfiguration(model, newConfiguration);

        assertViewName(mav, "plugin/pluginConfiguration");
View Full Code Here

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

        long componentId = 25L;
        Component component = new Component();
        component.setId(componentId);
        when(componentService.getComponentOfForum()).thenReturn(component);
        String pluginName = "plugin";
        PluginConfiguration newConfiguration = new PluginConfiguration();
        newConfiguration.setName(pluginName);

        doThrow(new UnexpectedErrorException(new IllegalArgumentException("Testing exception!")))
                .when(pluginService).updateConfiguration(newConfiguration, componentId);
        return newConfiguration;
    }
View Full Code Here

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

     * @throws NotFoundException if passed plugin wasn't found
     */
    @RequestMapping(value = "/configure/{name}", method = RequestMethod.GET)
    public ModelAndView startConfiguringPlugin(@PathVariable String name) throws NotFoundException {
        long componentId = getForumComponentId();
        PluginConfiguration pluginConfiguration = pluginService.getPluginConfiguration(name, componentId);
        return getModel(pluginConfiguration);
    }
View Full Code Here

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

    @Override
    public PluginConfiguration get(String name) throws NotFoundException {

        Query query = session().getNamedQuery("getPluginConfiguration");

        PluginConfiguration configuration = (PluginConfiguration) query.setParameter("name", name).uniqueResult();

        if (configuration == null){
            throw new NotFoundException(name + " plugin not found in the database");
        } else {
            return configuration;
View Full Code Here

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

        plugin.setPluginService(service);
    }

    @Test
    public void testConfigure() throws Exception {
        PluginConfiguration configuration = createConfiguration("http://localhost", "user", "1234");
        plugin.configure(configuration);

        assertTrue(plugin.getState() == Plugin.State.ENABLED,
                "Plugin with correct parameters should be configured properly.");
    }
View Full Code Here

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

                "Plugin with correct parameters should be configured properly.");
    }

    @Test
    public void pluginWithIncorrectParametersShouldNotBeConfigured() throws Exception {
        PluginConfiguration configuration = createConfiguration(null, "user", "1234");
        try {
            plugin.configure(configuration);
        } catch (UnexpectedErrorException ex) {
        }
View Full Code Here

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

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

    @Test(expectedExceptions = UnexpectedErrorException.class)
    public void pluginWithIncorrectParametersShouldThrowException() throws Exception {
        PluginConfiguration configuration = createConfiguration(null, "user", "1234");
        plugin.configure(configuration);
    }
View Full Code Here

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
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.