Package org.jtalks.common.model.entity

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


    }

    @Test
    public void testUpdate() {
        String newUuid = "1234-1231-1231";
        Component component = PersistedObjectsFactory.getDefaultComponent();
        session.save(component);
        component.setUuid(newUuid);

        componentDao.saveOrUpdate(component);
        session.flush();
        session.evict(component);
        Component result = (Component) session.get(Component.class, component.getId());

        assertEquals(result.getUuid(), newUuid);
    }
View Full Code Here


        assertEquals(result.getUuid(), newUuid);
    }

    @Test(expectedExceptions = javax.validation.ValidationException.class)
    public void testUpdateUuidNotNullViolation() {
        Component component = PersistedObjectsFactory.getDefaultComponent();
        session.save(component);
        component.setUuid(null);

        componentDao.saveOrUpdate(component);
        session.flush();
    }
View Full Code Here

        session.flush();
    }

    @Test
    public void testOrphanRemoving() {
        Component component = PersistedObjectsFactory.getDefaultComponent();

        component.getProperties().remove(0);
        componentDao.saveOrUpdate(component);
        session.flush();
        session.evict(component);

        assertEquals(componentDao.get(component.getId()).getProperties().size(), 1);
    }
View Full Code Here

    public void setComponentInformation(ComponentInformation componentInformation) {
        if (componentInformation.getId() != getComponentOfForum().getId()) {
            throw new IllegalArgumentException(
                    "Service should work with the same component as the componentInformation argument.");
        }
        Component forumComponent = getDao().getComponent();
        forumComponent.setName(componentInformation.getName());
        forumComponent.setDescription(componentInformation.getDescription());
        forumComponent.setProperty(LOGO_TOOLTIP_PROPERTY, componentInformation.getLogoTooltip());
        forumComponent.setProperty(TITLE_PREFIX_PROPERTY, componentInformation.getTitlePrefix());
        forumComponent.setProperty(COPYRIGHT_PROPERTY, componentInformation.getCopyright());
       
        if (!StringUtils.isEmpty(componentInformation.getLogo())) {
            forumComponent.setProperty(LOGO_PROPERTY, componentInformation.getLogo());
        }

        if (!StringUtils.isEmpty(componentInformation.getIcon())) {
            forumComponent.setProperty(COMPONENT_FAVICON_PNG_PARAM, componentInformation.getIcon());

            Base64Wrapper wrapper = new Base64Wrapper();
            byte[] favIcon = wrapper.decodeB64Bytes(componentInformation.getIcon());
            try {
                String iconInTheIcoFormat = icoFormatImageService.preProcessAndEncodeInString64(favIcon);
                forumComponent.setProperty(COMPONENT_FAVICON_ICO_PARAM, iconInTheIcoFormat);
            } catch (ImageProcessException e) {
                LOGGER.error("Can't convert fav icon to *.ico format", e);
            }
        }

        DateTime now = new DateTime();
        now = now.withMillisOfSecond(0);
        forumComponent.setProperty(COMPONENT_INFO_CHANGE_DATE_PROPERTY, String.valueOf(now.getMillis()));
    }
View Full Code Here

    }

    @Test
    public void testAddLink() throws Exception {
        ExternalLink linkToSave = new ExternalLink();
        Component component = new Component();
        service.saveLink(linkToSave, component);
        verify(dao).saveOrUpdate(linkToSave);
    }
View Full Code Here

        verify(dao).saveOrUpdate(linkToSave);
    }

    @Test
    public void testRemoveLink() throws Exception {
        Component component = new Component();
        service.deleteLink(1L, component);
        verify(dao).delete(eq(1L));
    }
View Full Code Here

        assertEquals(rssViewer.buildFeedItems(model, request, response), null);
    }

    @Test
    public void rssShouldBeGeneratedWithMetaDataFromComponent() throws Exception {
        Component component = new Component();
        String name = "my component";
        String description = "my description";
        component.setName(name);
        component.setDescription(description);
        model.put("forumComponent", component);

        rssViewer.buildFeedMetadata(model, channel, request);
        assertFalse(channel.equals(new Channel()));
        assertEquals(channel.getTitle(), name);
View Full Code Here

    @BeforeMethod
    public void init() {
        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 testChangeGrants() {
        PermissionChanges changes = mock(PermissionChanges.class);
        Branch branch = mock(Branch.class);
        permissionService.changeGrants(branch, changes);

        Component component = mock(Component.class);
        permissionService.changeGrants(component, changes);

        Group group = mock(Group.class);
        permissionService.changeGrants(group, changes);
    }
View Full Code Here

    public void testChangeRestrictions() {
        PermissionChanges changes = mock(PermissionChanges.class);
        Branch branch = mock(Branch.class);
        permissionService.changeRestrictions(branch, changes);

        Component component = mock(Component.class);
        permissionService.changeRestrictions(component, changes);

        Group group = mock(Group.class);
        permissionService.changeRestrictions(group, changes);
    }
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.