Package org.jtalks.jcommune.service.nontransactional

Examples of org.jtalks.jcommune.service.nontransactional.Base64Wrapper


    @Test
    public void getForumLogoShouldReturnPropertyLogoWhenPropertyExists() throws IOException, ImageProcessException {
        Component forumComponent = new Component();

        String logoProperty = "logo";
        Base64Wrapper wrapper = new Base64Wrapper();
        byte[] logoBytes = wrapper.decodeB64Bytes(logoProperty);

        forumComponent.addProperty(TransactionalComponentService.LOGO_PROPERTY, logoProperty);
        when(componentService.getComponentOfForum()).thenReturn(forumComponent);
        when(componentService.getComponentModificationTime()).thenReturn(new Date());
View Full Code Here


    @Test
    public void getFavIconPNGLogoShouldReturnPropertyIconWhenPropertyExists() throws IOException, ImageProcessException {
        Component forumComponent = new Component();

        String logoProperty = "logo";
        Base64Wrapper wrapper = new Base64Wrapper();
        byte[] logoBytes = wrapper.decodeB64Bytes(logoProperty);

        forumComponent.addProperty(TransactionalComponentService.COMPONENT_FAVICON_PNG_PARAM, logoProperty);
        when(componentService.getComponentOfForum()).thenReturn(forumComponent);
        when(componentService.getComponentModificationTime()).thenReturn(new Date());
View Full Code Here

    @Test
    public void getFavIconICOLogoShouldReturnPropertyIconWhenPropertyExists() throws IOException, ImageProcessException {
        Component forumComponent = new Component();

        String logoProperty = "logo";
        Base64Wrapper wrapper = new Base64Wrapper();
        byte[] logoBytes = wrapper.decodeB64Bytes(logoProperty);

        forumComponent.addProperty(TransactionalComponentService.COMPONENT_FAVICON_ICO_PARAM, logoProperty);
        when(componentService.getComponentOfForum()).thenReturn(forumComponent);
        when(componentService.getComponentModificationTime()).thenReturn(new Date());
View Full Code Here

    }

    @Test
    public void setComponentInformationShouldSetAllProperties() throws ImageProcessException {
        when(componentDao.getComponent()).thenReturn(component);
        Base64Wrapper wrapper = new Base64Wrapper();
        byte[] iconBytes = wrapper.decodeB64Bytes(ICON);
        when(imageService.preProcessAndEncodeInString64(iconBytes)).thenReturn(ICON_IN_ICO_FORMAT);

        ComponentInformation information = new ComponentInformation();
        information.setId(COMPONENT_ID);
        information.setName(FORUM_NAME);
View Full Code Here

    }

    @Test(dataProvider = "emptyValues")
    public void setComponentInformationShouldShouldNotSetLogoIfItIsEmpty(String logo) throws ImageProcessException {
        when(componentDao.getComponent()).thenReturn(component);
        Base64Wrapper wrapper = new Base64Wrapper();
        byte[] iconBytes = wrapper.decodeB64Bytes(ICON);
        when(imageService.preProcessAndEncodeInString64(iconBytes)).thenReturn(ICON_IN_ICO_FORMAT);

        ComponentInformation information = new ComponentInformation();
        information.setId(COMPONENT_ID);
        information.setName(FORUM_NAME);
View Full Code Here

        byte[] imageBytes = null;

        if (imageProperty == null || imageProperty.isEmpty()) {
            imageBytes = imageControllerUtils.getDefaultImage();
        } else {
            Base64Wrapper wrapper = new Base64Wrapper();
            imageBytes = wrapper.decodeB64Bytes(imageProperty);
        }

        return imageBytes;
    }
View Full Code Here

        }

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

    @Mock
    private RedirectAttributes redirectAttributes;

    @BeforeClass
    public void mockAvatar() {
        avatar = new Base64Wrapper().encodeB64Bytes(avatarByteArray);
    }
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.service.nontransactional.Base64Wrapper

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.