Package org.jtalks.common.model.entity

Examples of org.jtalks.common.model.entity.Component


     * @param request http request
     */
    @Override
    protected void buildFeedMetadata(Map<String, Object> model, Channel feed,
                                     HttpServletRequest request) {
        Component component = (Component)model.get("forumComponent");
        String feedTitle = DEFAULT_FEED_TITLE;
        String feedDescription = DEFAULT_FEED_DESCRIPTION;

        if (component != null) {
            feedTitle = component.getName();
            feedDescription = component.getDescription();
        }

        feed.setTitle(feedTitle);
        feed.setDescription(feedDescription);
        feed.setLink(buildURL(request));
View Full Code Here


    }

    @Test
    public void getPluginsShouldReturnAllPlugins() {
        long componentId = 25L;
        Component component = new Component();
        component.setId(componentId);
        when(componentService.getComponentOfForum()).thenReturn(component);
        List<Plugin> expectedPlugins = Arrays.asList((Plugin) new DummyPlugin(), new DummyPlugin());
        when(pluginService.getPlugins(componentId)).thenReturn(expectedPlugins);

        ModelAndView pluginsModelAndView = pluginController.getPlugins();
View Full Code Here

    @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);
View Full Code Here

    }

    @Test(expectedExceptions = NotFoundException.class)
    public void startConfiguringPluginWhenPluginWasNotFoundShouldShowNotFoundError() throws NotFoundException {
        long componentId = 25L;
        Component component = new Component();
        component.setId(componentId);
        when(componentService.getComponentOfForum()).thenReturn(component);
        String nonExistPluginName = "non-exist";
        when(pluginService.getPluginConfiguration(nonExistPluginName, componentId)).thenThrow(new NotFoundException());

        pluginController.startConfiguringPlugin(nonExistPluginName);
View Full Code Here

    @Test
    public void updateConfigurationShouldUpdateItByCallingServiceLayer()
            throws NotFoundException, UnexpectedErrorException {
        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);
View Full Code Here

        assertTrue(model.containsAttribute("pluginConfiguration"));
    }

    private PluginConfiguration createFailingConfiguration() throws NotFoundException, UnexpectedErrorException {
        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);
View Full Code Here

    }

    @Test
    public void updateEnablingShouldUpdatePassedPlugin() throws NotFoundException {
        long componentId = 25L;
        Component component = new Component();
        component.setId(componentId);
        when(componentService.getComponentOfForum()).thenReturn(component);
        PluginActivatingDto pluginActivatingDto = new PluginActivatingDto("Dummy plugin", true);
       
        String expectedStatus = new JsonResponse(JsonResponseStatus.SUCCESS).getStatus().name();
       
View Full Code Here

    @ResponseBody
    public JsonResponse saveLink(@Valid @RequestBody ExternalLink link, BindingResult result) {
        if (result.hasErrors()) {
            return new JsonResponse(JsonResponseStatus.FAIL, result.getAllErrors());
        }
        Component component = componentService.getComponentOfForum();
        service.saveLink(link, component);
        return new JsonResponse(JsonResponseStatus.SUCCESS, link);
    }
View Full Code Here

     * @return {@code true} if link was successfully deleted.
     */
    @RequestMapping(value = "/links/delete/{id}", method = RequestMethod.DELETE)
    @ResponseBody
    public JsonResponse deleteLink(@PathVariable Long id) {
        Component component = componentService.getComponentOfForum();
        boolean result = service.deleteLink(id, component);
        return new JsonResponse(JsonResponseStatus.SUCCESS, result);
    }
View Full Code Here

        configuration.setHostUrl(SAPE_HOST_URL);
        configuration.setNumberOfLinks(SAPE_NUMBER_OF_LINKS);
        configuration.setShowOnMainPage(SAPE_SHOW_ON_MAIN_PAGE);
        configuration.setShowDummyLinks(SAPE_SHOW_DUMMY_LINKS);

        Component component = new Component();
        when(componentDao.getComponent()).thenReturn(component);

        configurationService.updateSapeConfiguration(configuration, COMPONENT_ID);

        verify(componentDao, times(6)).saveOrUpdate(any(Component.class));
        assertEquals(component.getProperties().size(), 6);
    }
View Full Code Here

TOP

Related Classes of org.jtalks.common.model.entity.Component

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.