Package org.jtalks.common.model.entity

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


    }
   
    @Test
    public void newBannerShouldBeSaved() {
        Banner uploadedBanner = new Banner(BannerPosition.TOP, "<html></html>");
        bannerService.uploadBanner(uploadedBanner, new Component());

        verify(bannerDao).saveOrUpdate(uploadedBanner);
    }
View Full Code Here


    public void existingBannerShouldBeSavedWithNewContent() {
        Banner newBanner = new Banner(BannerPosition.TOP, "<html></html>");
        Banner existingBanner = new Banner(BannerPosition.TOP, "<html>exists banner</html>");
        when(bannerDao.getByPosition(BannerPosition.TOP)).thenReturn(existingBanner);

        bannerService.uploadBanner(newBanner, new Component());

        verify(bannerDao).saveOrUpdate(existingBanner);
        assertEquals(existingBanner.getContent(), newBanner.getContent(), "Content of banner must be changed.");
    }
View Full Code Here

    @Test
    public void testGetComponent() {
        session.save(cmp);

        Component result = componentDao.getComponent();

        assertNotNull(result, "Property is not found by name.");
        assertEquals(result.getId(), cmp.getId(), "Property not found");
    }
View Full Code Here

    }

    @Test
    public void testGetNameOfComponent() {
        String expected = "value";
        Component cmp = new Component(expected, "description", ComponentType.FORUM);
        Mockito.when(componentDao.getComponent()).thenReturn(cmp);
        jcommuneComponentProperty.setComponentDao(componentDao);
        jcommuneComponentProperty.setName("cmp.name");
        String actual = jcommuneComponentProperty.getValueOfComponent();
View Full Code Here

    }

    @Test
    public void testGetDescriptionOfComponent() {
        String expected = "description";
        Component cmp = new Component("name", expected, ComponentType.FORUM);
        Mockito.when(componentDao.getComponent()).thenReturn(cmp);
        jcommuneComponentProperty.setComponentDao(componentDao);
        jcommuneComponentProperty.setName("anyString");
        String actual = jcommuneComponentProperty.getValueOfComponent();
View Full Code Here

        setupAvatarHeaders(response, forumModificationDate);
    }

    private byte[] loadImageFromProperties(String propertyName, ImageControllerUtils imageControllerUtils) {
        Component forumComponent = componentService.getComponentOfForum();
        String imageProperty = null;
        if (forumComponent != null) {
            imageProperty = forumComponent.getProperty(propertyName);
        }
        byte[] imageBytes = null;

        if (imageProperty == null || imageProperty.isEmpty()) {
            imageBytes = imageControllerUtils.getDefaultImage();
View Full Code Here

     * Show SAPE configuration page
     * @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

     *      validation errors)
     */
    @RequestMapping(value="/configuration/sape", method=RequestMethod.POST)
    public ModelAndView saveSapeConfiguration(@ModelAttribute SapeConfiguration configuration, BindingResult result) {
        if (!result.hasErrors()) {
            Component forumComponent = componentService.getComponentOfForum();
            configurationService.updateSapeConfiguration(configuration, forumComponent.getId());
        }
        return new ModelAndView(VIEW_SAPE_CONFIGURATION)
            .addObject(PARAM_SAPE_CONFIGURATION, configuration);
    }
View Full Code Here

   
    /*===== Common methods =====*/

    @Test
    public void testGet() {
        Component component = PersistedObjectsFactory.getDefaultComponent();
        session.save(component);

        Component result = componentDao.get(component.getId());

        assertNotNull(result);
        assertEquals(result.getId(), component.getId());
        assertEquals(result.getProperties().size(), 2);
    }
View Full Code Here

    }


    @Test
    public void testGetInvalidId() {
        Component result = componentDao.get(-567890L);

        assertNull(result);
    }
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.