Package org.jtalks.jcommune.model.entity

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


        sapeShowDummyLinks.setComponentDao(componentDao);
    }

    @Test
    public void testGetSapeConfiguration() {
        SapeConfiguration configuration = configurationService.getSapeConfiguration(COMPONENT_ID);

        assertEquals(configuration.getAccountId(), SAPE_ACCOUNT_ID);
        assertEquals(configuration.getTimeout(), SAPE_TIMEOUT);
        assertEquals(configuration.getHostUrl(), SAPE_HOST_URL);
        assertEquals(configuration.getNumberOfLinks(), SAPE_NUMBER_OF_LINKS);
        assertEquals(configuration.isShowOnMainPage(), SAPE_SHOW_ON_MAIN_PAGE);
        assertEquals(configuration.isShowDummyLinks(), SAPE_SHOW_DUMMY_LINKS);
    }
View Full Code Here


        assertEquals(configuration.isShowDummyLinks(), SAPE_SHOW_DUMMY_LINKS);
    }

    @Test
    public void testUpdateSapeConfiguration() {
        SapeConfiguration configuration = new SapeConfiguration();
        configuration.setAccountId(SAPE_ACCOUNT_ID);
        configuration.setTimeout(SAPE_TIMEOUT);
        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);
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    @PreAuthorize("hasPermission(#componentId, 'COMPONENT', 'GeneralPermission.ADMIN')")
    public SapeConfiguration getSapeConfiguration(long componentId) {
        SapeConfiguration configuration = new SapeConfiguration();
        configuration.setAccountId(sapeAccountId.getValue());
        configuration.setTimeout(sapeTimeout.intValue());
        configuration.setHostUrl(sapeHostUrl.getValue());
        configuration.setNumberOfLinks(sapeNumberOrLinks.intValue());
        configuration.setShowOnMainPage(sapeShowOnMainPage.booleanValue());
        configuration.setShowDummyLinks(sapeShowDummyLinks.booleanValue());
        configuration.setEnableSape(sapeEnableService.booleanValue());
        return configuration;
    }
View Full Code Here

     * @return SAPE configuration page
     */
    @RequestMapping(value="/configuration/sape", method=RequestMethod.GET)
    public ModelAndView showSapeConfigurationPage() {
        Component forumComponent = componentService.getComponentOfForum();
        SapeConfiguration configuration = configurationService.getSapeConfiguration(forumComponent.getId());
        return new ModelAndView(VIEW_SAPE_CONFIGURATION)
                .addObject(PARAM_SAPE_CONFIGURATION, configuration);
    }
View Full Code Here

        initMocks(this);
        controller = new ConfigurationController(configurationService, componentService);
    
        when(componentService.getComponentOfForum()).thenReturn(new Component());
       
        sapeConfiguration = new SapeConfiguration();
        when(configurationService.getSapeConfiguration(anyLong())).thenReturn(sapeConfiguration);
    }
View Full Code Here

    public void testShowSapeConfigurationPage() {
        ModelAndView mav = controller.showSapeConfigurationPage();
       
        assertViewName(mav, VIEW_SAPE_CONFIGURATION);
        assertModelAttributeAvailable(mav, PARAM_SAPE_CONFIGURATION);
        SapeConfiguration configuration = assertAndReturnModelAttributeOfType(
                mav, PARAM_SAPE_CONFIGURATION, SapeConfiguration.class);
        assertEquals(configuration, sapeConfiguration);
    }
View Full Code Here

        assertEquals(configuration, sapeConfiguration);
    }
   
    @Test
    public void testSaveSapeConfigurationValidationSuccess() {
        SapeConfiguration newConfiguration = new SapeConfiguration();
        BindingResult bindingResult = mock(BindingResult.class);
        when(bindingResult.hasErrors()).thenReturn(false);
       
        ModelAndView mav = controller.saveSapeConfiguration(newConfiguration, bindingResult);
       
        verify(configurationService).updateSapeConfiguration(eq(newConfiguration), anyLong());
        assertViewName(mav, VIEW_SAPE_CONFIGURATION);
        assertModelAttributeAvailable(mav, PARAM_SAPE_CONFIGURATION);
        SapeConfiguration configuration = assertAndReturnModelAttributeOfType(
                mav, PARAM_SAPE_CONFIGURATION, SapeConfiguration.class);
        assertEquals(configuration, newConfiguration);
    }
View Full Code Here

        assertEquals(configuration, newConfiguration);
    }
   
    @Test
    public void testSaveSapeConfigurationValidationFail() {
        SapeConfiguration newConfiguration = new SapeConfiguration();
        BindingResult bindingResult = mock(BindingResult.class);
        when(bindingResult.hasErrors()).thenReturn(true);
       
        ModelAndView mav = controller.saveSapeConfiguration(newConfiguration, bindingResult);
       
        verify(configurationService, never()).updateSapeConfiguration(eq(newConfiguration), anyLong());
        assertViewName(mav, VIEW_SAPE_CONFIGURATION);
        assertModelAttributeAvailable(mav, PARAM_SAPE_CONFIGURATION);
        SapeConfiguration configuration = assertAndReturnModelAttributeOfType(
                mav, PARAM_SAPE_CONFIGURATION, SapeConfiguration.class);
        assertEquals(configuration, newConfiguration);
    }
View Full Code Here

TOP

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

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.