Package org.eurekastreams.server.domain

Examples of org.eurekastreams.server.domain.Theme


     * Look for a theme known to exist (present in dataset.xml).
     */
    @Test
    public void findByUUIDWithKnownUUID()
    {
        Theme theme = jpaThemeMapper.findByUUID("f81d4fae-7dec-11d0-a765-00a0c91e6bf6");

        assertNotNull("Did not find the theme and did not throw exception", theme);
        assertEquals("Theme id does not match", testThemeId, theme.getId());
    }
View Full Code Here


     * Look for the default theme.
     */
    @Test
    public void findDefault()
    {
        Theme theme = jpaThemeMapper.findDefault();

        assertNotNull("Did not find the default theme and did not throw exception", theme);
        assertEquals("Theme id does not match", testThemeId, theme.getId());
    }
View Full Code Here

     * Test deleting a theme.
     */
    @Test
    public void testDelete()
    {
        Theme theme = null;
        final long themeId = 103L;
        theme = jpaThemeMapper.findById(themeId);
        jpaThemeMapper.delete(theme);

        try
View Full Code Here

     *             can throw an exception on bad UUID.
     */
    @Test
    public final void testProvideWithNonExistentUrl() throws Exception
    {
        final Theme theme = new Theme("src/main/webapp/themes/vegas.xml", "Las Vegas", "Las Vegas sky line", null,
                null, null, "Phil Plait", "phil.plait@awesome.com");

        final HashMap<String, Serializable> formData = new HashMap<String, Serializable>();
        formData.put("url", "src/main/webapp/themes/vegas.xml");
        formData.put("category", "CITY");

        context.checking(new Expectations()
        {
            {
                oneOf(galleryItemFactory).create();
                will(returnValue(theme));

                oneOf(themeMapper).findByUrl("src/main/webapp/themes/vegas.xml");
                will(returnValue(null));

                oneOf(personMapper).findByAccountId(username);
                will(returnValue(user));
            }
        });

        // Make the call
        Theme actual = sut.provide(getActionContext(username), formData);

        context.assertIsSatisfied();

        assertEquals("property should be gotten", "Las Vegas", actual.getName());
        assertEquals("property should be gotten", "Las Vegas sky line", actual.getDescription());
        assertEquals("property should be gotten", "Phil Plait", actual.getAuthorName());
        assertEquals("property should be gotten", "phil.plait@awesome.com", actual.getAuthorEmail());
        assertEquals("property should be gotten", "src/main/webapp/themes/vegas.xml", actual.getUrl());
    }
View Full Code Here

     *             can throw an exception on bad UUID.
     */
    @Test(expected = ValidationException.class)
    public final void testProvideWithExistingUrl() throws Exception
    {
        final Theme theme = new Theme("src/main/webapp/themes/vegas.xml", "Las Vegas", "Las Vegas sky line", null,
                null, null, "Phil Plait", "phil.plait@awesome.com");

        final HashMap<String, Serializable> formData = new HashMap<String, Serializable>();
        formData.put("url", "src/main/webapp/themes/vegas.xml");
        formData.put("category", "CITY");
View Full Code Here

        final String email = "foo.bar@blah.com";
        final String themeName = "Las Vegas";
        final String themeDesc = "Las Vegas sky line";
        final String themeUrl = "src/main/webapp/themes/vegas.xml";

        final Theme theme = new Theme(themeUrl, themeName, themeDesc, null, null, null, name, email);

        final HashMap<String, Serializable> formData = new HashMap<String, Serializable>();
        formData.put("id", "1");

        context.checking(new Expectations()
        {
            {
                oneOf(themeMapper).findById(1L);
                will(returnValue(theme));
            }
        });

        // Make the call
        Theme actual = sut.provide(actionContext, formData);

        context.assertIsSatisfied();

        assertSame(theme, actual);
        assertEquals("property should be gotten", themeName, theme.getName());
View Full Code Here

        final String personName = "Phil Plait";
        final String personEmail = "phil.plait@awesome.com";
        final String themeUrl = "src/main/webapp/themes/vegas.xml";
        final String themeCategory = "CITY";

        final Theme theme = new Theme(themeUrl, themeName, themeDesc, null, null, null, personName, personEmail);

        final HashMap<String, Serializable> formData = new HashMap<String, Serializable>();
        formData.put("url", themeUrl);
        formData.put("category", themeCategory);
        final GalleryItemCategory galleryItemCategory = new GalleryItemCategory(themeCategory);

        final String url = themeUrl;
        final String category = themeCategory;

        final Map<String, Serializable> fields = new HashMap<String, Serializable>();
        fields.put("url", url);
        fields.put("category", category);

        context.checking(new Expectations()
        {
            {
                oneOf(userDetails).getParams();
                will(returnValue(fields));

                oneOf(galleryItemGetter).provide(userDetails, formData);
                will(returnValue(theme));

                oneOf(galleryItemPopulator).populate(theme, url);

                oneOf(galleryItemCategoryMapper).findByName(GalleryItemType.THEME, category);
                will(returnValue(galleryItemCategory));

                oneOf(galleryItemSaver).save(theme);
            }
        });

        // Make the call
        Theme actual = (Theme) sutTheme.execute(userDetails);

        context.assertIsSatisfied();

        assertSame(theme, actual);
        assertEquals("property should be gotten", themeName, theme.getName());
View Full Code Here

        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder db = dbf.newDocumentBuilder();
        final Document xmlDoc = db.parse("src/test/resources/themes/vegas.xml");

        Theme theme = new Theme();

        context.checking(new Expectations()
        {
            {
                oneOf(documentCreator).execute("src/test/resources/themes/vegas.xml");
                will(returnValue(xmlDoc));
            }
        });

        // Make the call
        sut.populate(theme, "src/test/resources/themes/vegas.xml");

        context.assertIsSatisfied();

        assertEquals("property should be gotten", themeName, theme.getName());
        assertEquals("property should be gotten", themeDesc, theme.getDescription());
        assertEquals("property should be gotten", personName, theme.getAuthorName());
        assertEquals("property should be gotten", personEmail, theme.getAuthorEmail());
        assertEquals("property should be gotten", themeBannerId, theme.getBannerId());
    }
View Full Code Here

        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder db = dbf.newDocumentBuilder();
        final Document xmlDoc = db.parse("src/test/resources/themes/vegas-dangerous-title.xml");

        Theme theme = new Theme();

        context.checking(new Expectations()
        {
            {
                oneOf(documentCreator).execute("src/test/resources/themes/vegas.xml");
                will(returnValue(xmlDoc));
            }
        });

        // Make the call
        sut.populate(theme, "src/test/resources/themes/vegas.xml");
        context.assertIsSatisfied();
        assertEquals("property should be gotten", themeName, theme.getName());
        assertEquals("property should be gotten", themeDesc, theme.getDescription());
        assertEquals("property should be gotten", personName, theme.getAuthorName());
        assertEquals("property should be gotten", personEmail, theme.getAuthorEmail());
        assertEquals("property should be gotten", themeBannerId, theme.getBannerId());
        assertNull(theme.getCssFile());

    }
View Full Code Here

            tabDtos.add(tdto);
        }

        PersonPagePropertiesDTO ppp = new PersonPagePropertiesDTO();
        ppp.setTabDTOs(tabDtos);
        Theme theme = inPerson.getTheme();
        ppp.setThemeUuid(theme == null ? null : theme.getUUID().toLowerCase());
        return ppp;
    }
View Full Code Here

TOP

Related Classes of org.eurekastreams.server.domain.Theme

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.