Package org.eurekastreams.server.domain

Examples of org.eurekastreams.server.domain.Theme


        {
            person.setTheme(null);
        }
        else
        {
            person.setTheme(new Theme("", "", "", dto.getThemeCssFile(), "", "", "", ""));
        }

        TabGroup startTabGroup = new TabGroup();

        for (TabDTO tabDTO : dto.getTabDTOs())
View Full Code Here


     * Test the persistence of a Tab.
     */
    @Test
    public void testInsert()
    {
        Theme t = new Theme("url", "name", "desc", "css", UUID.randomUUID().toString(), "bannerId", "authorName",
                "vswatter@gmail.com");
        jpaThemeMapper.insert(t);
        assertTrue(t.getId() > 0);
    }
View Full Code Here

     * Test the DBUnit XML Dataset - Theme.
     */
    @Test
    public void testFindByIdDataset()
    {
        Theme theme = jpaThemeMapper.findById(testThemeId);

        assertEquals("Name does not match.", "Test Theme", theme.getName());
        assertEquals("Theme URL File does not match.", "http://www.eurekastreams.org/theme.xml", theme.getUrl());
        assertEquals("Theme UUID does not match.", "f81d4fae-7dec-11d0-a765-00a0c91e6bf6", theme.getUUID());
    }
View Full Code Here

    @Test
    public final void testExecuteWithUrl() throws Exception
    {
        final String themeId = "http://localhost:8080/themes/myTheme.xml";

        final Theme testTheme = new Theme(themeId, "My Theme", "My Theme Description",
                "http://localhost:8080/themes/myTheme.css", "FAKE-UUID-0000-0000-0000", "My Theme Banner Id",
                "authorName", "authorEmail");

        context.checking(new Expectations()
        {
            {
                oneOf(personMapper).findById(userId);
                will(returnValue(person));

                oneOf(themeMapper).findByUrl(themeId);
                will(returnValue(testTheme));

                oneOf(person).setTheme(testTheme);

                allowing(person).getTheme();

                // persist
                oneOf(personMapper).flush();

                never(themeMapper).findByUUID(with(any(String.class)));

                oneOf(deleteCacheKeysMapper).execute(with(any(Set.class)));
            }
        });

        // Make the call
        String actual = (String) sut.execute(buildServerActionContext(themeId));

        assertEquals(testTheme.getCssFile(), actual);

        context.assertIsSatisfied();
    }
View Full Code Here

    @Test
    public final void testWithThemePassedThroughInState() throws Exception
    {
        final String themeId = "http://localhost:8080/themes/myTheme.xml";

        final Theme testTheme = new Theme(themeId, "My Theme", "My Theme Description",
                "http://localhost:8080/themes/myTheme.css", "FAKE-UUID-0000-0000-0000", "My Theme Banner Id",
                "authorName", "authorEmail");

        context.checking(new Expectations()
        {
            {
                oneOf(personMapper).findById(userId);
                will(returnValue(person));

                oneOf(person).setTheme(testTheme);

                allowing(person).getTheme();

                // persist
                oneOf(personMapper).flush();

                never(themeMapper).findByUUID(with(any(String.class)));

                oneOf(deleteCacheKeysMapper).execute(with(any(Set.class)));
            }
        });

        // Make the call
        PrincipalActionContext actionContext = buildServerActionContext(themeId);
        actionContext.getState().put("THEME", testTheme);
        String actual = (String) sut.execute(actionContext);

        assertEquals(testTheme.getCssFile(), actual);

        context.assertIsSatisfied();
    }
View Full Code Here

     *             can throw an exception on bad UUID.
     */
    @Test
    public final void testExecuteWithUUID() throws Exception
    {
        final Theme testTheme = new Theme("http://localhost:8080/themes/myTheme.xml", "My Theme",
                "My Theme Description", "http://localhost:8080/themes/myTheme.css", "FAKE-UUID-0000-0000-0000",
                "My Theme Banner Id", "authorName", "authorEmail");

        final String uuid = "FAKE-UUID-0000-0000-0000";

        context.checking(new Expectations()
        {
            {
                oneOf(personMapper).findById(userId);
                will(returnValue(person));

                oneOf(themeMapper).findByUUID(uuid);
                will(returnValue(testTheme));

                oneOf(person).setTheme(testTheme);

                allowing(person).getTheme();

                // persist
                oneOf(personMapper).flush();

                never(themeMapper).findByUrl((with(any(String.class))));

                oneOf(deleteCacheKeysMapper).execute(with(any(Set.class)));
            }
        });

        // Make the call
        String actual = (String) sut.execute(buildServerActionContext("{" + uuid + "}"));

        assertEquals(testTheme.getCssFile(), actual);

        context.assertIsSatisfied();
    }
View Full Code Here

     */
    @Test(expected = ExecutionException.class)
    public final void testExecuteWithBadUUID() throws Exception
    {
        final String themeUuid = "BAD-BAD-BAD";
        final Theme testTheme = new Theme("http://localhost:8080/themes/myTheme.xml", "My Theme",
                "My Theme Description", "http://localhost:8080/themes/myTheme.css", "FAKE-UUID-0000-0000-0000",
                "My Theme Banner Id", "authorName", "authorEmail");

        context.checking(new Expectations()
        {
            {
                oneOf(personMapper).findById(userId);
                will(returnValue(person));

                oneOf(themeMapper).findByUUID(themeUuid);
                will(returnValue(null));

                never(themeMapper).findByUrl((with(any(String.class))));

                oneOf(person).setTheme(testTheme);
            }
        });

        // Make the call
        String actual = (String) sut.execute(buildServerActionContext("{" + themeUuid + "}"));

        assertEquals(testTheme.getCssFile(), actual);

        context.assertIsSatisfied();
    }
View Full Code Here

     * Test the findOrCreate() method using a theme that is in the database.
     */
    @Test
    public void findByUrlWithExistingUrl()
    {
        Theme theme = jpaThemeMapper.findByUrl("http://www.eurekastreams.org/theme.xml");

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

     * Test the findOrCreate() method using a theme that is in the database.
     */
    @Test
    public void findByUrlWithNonExistingUrl()
    {
        Theme theme = jpaThemeMapper.findByUrl("http://www.eurekastreams.org/nonexistenttheme.xml");

        assertEquals("found the theme , but it should not exist", null, theme);
    }
View Full Code Here

        // assertEquals("Did not build the CSS path correctly", cssPath, theme.getCssFile());
        assertEquals("Did not set the name correctly", themeName, theme.getName());

        // Make sure the theme was persisted
        Theme foundTheme = jpaThemeMapper.findById(theme.getId());

        assertEquals("Created theme did not match looked-up theme", foundTheme, theme);
    }
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.