Package org.eurekastreams.server.domain

Examples of org.eurekastreams.server.domain.TabTemplate


    @Test
    public void testGetTabTemplate()
    {
        final long welcomeId = 5555L;

        TabTemplate welcome = jpaTabMapper.getTabTemplate(TabType.WELCOME);
        assertEquals(welcomeId, welcome.getId());
        assertEquals(TabType.WELCOME, welcome.getType());
    }
View Full Code Here


     */
    @Test
    public void testMoveGadgetWithinTab()
    {
        Tab fords1stTab = jpaTabMapper.findById(fordsFirstTabId);
        TabTemplate fords1stTabTemplate = fords1stTab.getTemplate();

        // Ensure starting state.
        assertEquals(fordsFirstTabFirstGadgetId, fords1stTabTemplate.getGadgets().get(0).getId());
        assertEquals("Zone number should be 0 before the move", 0, fords1stTabTemplate.getGadgets().get(0)
                .getZoneNumber());
        assertEquals("Zone index should be 0 before the move", 0, fords1stTabTemplate.getGadgets().get(0)
                .getZoneIndex());

        assertEquals(fordsFirstTabSecondGadgetId, fords1stTabTemplate.getGadgets().get(1).getId());
        assertEquals("Zone number should be 0 before the move", 0, fords1stTabTemplate.getGadgets().get(1)
                .getZoneNumber());
        assertEquals("Zone index should be 1 before the move", 1, fords1stTabTemplate.getGadgets().get(1)
                .getZoneIndex());

        assertEquals(fordsFirstTabThirdGadgetId, fords1stTabTemplate.getGadgets().get(2).getId());
        assertEquals("Zone number should be 2 before the move", 2, fords1stTabTemplate.getGadgets().get(2)
                .getZoneNumber());
        assertEquals("Zone number index be 0 before the move", 0, fords1stTabTemplate.getGadgets().get(2)
                .getZoneIndex());

        jpaTabMapper.moveGadget(fordsFirstTabFirstGadgetId, fordsFirstTabId, 0, 0, fordsFirstTabId, 1, 2);

        jpaTabMapper.flush();

        getEntityManager().clear();

        Tab fords1stTabAfterMove = jpaTabMapper.findById(fordsFirstTabId);
        TabTemplate fords1stTabTemplateAfterMove = fords1stTabAfterMove.getTemplate();

        // Assert after state.
        assertEquals(fordsFirstTabSecondGadgetId, fords1stTabTemplateAfterMove.getGadgets().get(0).getId());
        assertEquals("Zone number should be 0 after the move", 0, fords1stTabTemplateAfterMove.getGadgets().get(0)
                .getZoneNumber());
        assertEquals("Zone index should be 0 after the move", 0, fords1stTabTemplateAfterMove.getGadgets().get(0)
                .getZoneIndex());

        assertEquals(fordsFirstTabThirdGadgetId, fords1stTabTemplateAfterMove.getGadgets().get(1).getId());
        assertEquals("Zone number should be 2 after the move", 2, fords1stTabTemplateAfterMove.getGadgets().get(1)
                .getZoneNumber());
        assertEquals("Zone index should be 0 after the move", 0, fords1stTabTemplateAfterMove.getGadgets().get(1)
                .getZoneIndex());

        assertEquals(fordsFirstTabFirstGadgetId, fords1stTabTemplateAfterMove.getGadgets().get(2).getId());
        assertEquals("Zone number for moved gadget should be 2 after the move", 2, fords1stTabTemplateAfterMove
                .getGadgets().get(2).getZoneNumber());
        assertEquals("Zone index for moved gadget should be 1 after the move", 1, fords1stTabTemplateAfterMove
                .getGadgets().get(2).getZoneIndex());
    }
View Full Code Here

    @Test
    public void testMoveGadgetToAnotherTab()
    {
        Tab fords1stTab = jpaTabMapper.findById(fordsFirstTabId);
        Tab fords3rdTab = jpaTabMapper.findById(fordsThirdTabId);
        TabTemplate fords1stTabTemplate = fords1stTab.getTemplate();
        TabTemplate fords3rdTabTemplate = fords3rdTab.getTemplate();

        // Ensure starting state.
        // First Tab
        assertEquals(fordsFirstTabFirstGadgetId, fords1stTabTemplate.getGadgets().get(0).getId());
        assertEquals("Zone number should be 0 before the move", 0, fords1stTabTemplate.getGadgets().get(0)
                .getZoneNumber());
        assertEquals("Zone index should be 0 before the move", 0, fords1stTabTemplate.getGadgets().get(0)
                .getZoneIndex());

        assertEquals(fordsFirstTabSecondGadgetId, fords1stTabTemplate.getGadgets().get(1).getId());
        assertEquals("Zone number should be 0 before the move", 0, fords1stTabTemplate.getGadgets().get(1)
                .getZoneNumber());
        assertEquals("Zone index should be 1 before the move", 1, fords1stTabTemplate.getGadgets().get(1)
                .getZoneIndex());

        assertEquals(fordsFirstTabThirdGadgetId, fords1stTabTemplate.getGadgets().get(2).getId());
        assertEquals("Zone number should be 2 before the move", 2, fords1stTabTemplate.getGadgets().get(2)
                .getZoneNumber());
        assertEquals("Zone number index be 0 before the move", 0, fords1stTabTemplate.getGadgets().get(2)
                .getZoneIndex());

        // Third tab
        assertEquals(fordsThirdTabFirstGadgetId, fords3rdTabTemplate.getGadgets().get(0).getId());
        assertEquals("Zone number should be 0 before the move", 0, fords3rdTabTemplate.getGadgets().get(0)
                .getZoneNumber());
        assertEquals("Zone index should be 0 before the move", 0, fords3rdTabTemplate.getGadgets().get(0)
                .getZoneIndex());

        assertEquals(fordsThirdTabSecondGadgetId, fords3rdTabTemplate.getGadgets().get(1).getId());
        assertEquals("Zone number should be 0 before the move", 0, fords3rdTabTemplate.getGadgets().get(1)
                .getZoneNumber());
        assertEquals("Zone index should be 1 before the move", 1, fords3rdTabTemplate.getGadgets().get(1)
                .getZoneIndex());

        assertEquals(fordsThirdTabThirdGadgetId, fords3rdTabTemplate.getGadgets().get(2).getId());
        assertEquals("Zone number should be 0 before the move", 0, fords3rdTabTemplate.getGadgets().get(2)
                .getZoneNumber());
        assertEquals("Zone index should be 2 before the move", 2, fords3rdTabTemplate.getGadgets().get(2)
                .getZoneIndex());

        assertEquals(fordsThirdTabFourthGadgetId, fords3rdTabTemplate.getGadgets().get(3).getId());
        assertEquals("Zone number should be 1 before the move", 1, fords3rdTabTemplate.getGadgets().get(3)
                .getZoneNumber());
        assertEquals("Zone index should be 0 before the move", 0, fords3rdTabTemplate.getGadgets().get(3)
                .getZoneIndex());

        jpaTabMapper.moveGadget(fordsFirstTabFirstGadgetId, fordsFirstTabId, 0, 0, fordsThirdTabId, 2, 0);

        jpaTabMapper.flush();

        getEntityManager().clear();

        Tab fords1stTabAfterMove = jpaTabMapper.findById(fordsFirstTabId);
        Tab fords3rdTabAfterMove = jpaTabMapper.findById(fordsThirdTabId);
        TabTemplate fords1stTabTemplateAfterMove = fords1stTabAfterMove.getTemplate();
        TabTemplate fords3rdTabTemplateAfterMove = fords3rdTabAfterMove.getTemplate();

        // Assert after state.
        assertEquals(fordsFirstTabSecondGadgetId, fords1stTabTemplateAfterMove.getGadgets().get(0).getId());
        assertEquals("Zone number should be 0 after the move", 0, fords1stTabTemplateAfterMove.getGadgets().get(0)
                .getZoneNumber());
        assertEquals("Zone index should be 0 after the move", 0, fords1stTabTemplateAfterMove.getGadgets().get(0)
                .getZoneIndex());

        assertEquals(fordsFirstTabThirdGadgetId, fords1stTabTemplateAfterMove.getGadgets().get(1).getId());
        assertEquals("Zone number should be 0 after the move", 2, fords1stTabTemplateAfterMove.getGadgets().get(1)
                .getZoneNumber());
        assertEquals("Zone index should be 1 after the move", 0, fords1stTabTemplateAfterMove.getGadgets().get(1)
                .getZoneIndex());

        // Third tab
        assertEquals(fordsThirdTabFirstGadgetId, fords3rdTabTemplateAfterMove.getGadgets().get(0).getId());
        assertEquals("Zone number should be 0 after the move", 0, fords3rdTabTemplateAfterMove.getGadgets().get(0)
                .getZoneNumber());
        assertEquals("Zone index should be 0 after the move", 0, fords3rdTabTemplateAfterMove.getGadgets().get(0)
                .getZoneIndex());

        assertEquals(fordsThirdTabSecondGadgetId, fords3rdTabTemplateAfterMove.getGadgets().get(1).getId());
        assertEquals("Zone number should be 0 after the move", 0, fords3rdTabTemplateAfterMove.getGadgets().get(1)
                .getZoneNumber());
        assertEquals("Zone index should be 1 after the move", 1, fords3rdTabTemplateAfterMove.getGadgets().get(1)
                .getZoneIndex());

        // Moved gadget
        assertEquals(fordsFirstTabFirstGadgetId, fords3rdTabTemplateAfterMove.getGadgets().get(2).getId());
        assertEquals("Zone number for moved gadget should be 0 after the move", 0, fords3rdTabTemplateAfterMove
                .getGadgets().get(2).getZoneNumber());
        assertEquals("Zone index for moved gadget should be 2 after the move", 2, fords3rdTabTemplateAfterMove
                .getGadgets().get(2).getZoneIndex());

        assertEquals(fordsThirdTabThirdGadgetId, fords3rdTabTemplateAfterMove.getGadgets().get(3).getId());
        assertEquals("Zone number should be 0 after the move", 0, fords3rdTabTemplateAfterMove.getGadgets().get(3)
                .getZoneNumber());
        assertEquals("Zone index should be 3 after the move", 3, fords3rdTabTemplateAfterMove.getGadgets().get(3)
                .getZoneIndex());

        assertEquals(fordsThirdTabFourthGadgetId, fords3rdTabTemplateAfterMove.getGadgets().get(4).getId());
        assertEquals("Zone number should be 1 after the move", 1, fords3rdTabTemplateAfterMove.getGadgets().get(4)
                .getZoneNumber());
        assertEquals("Zone index should be 0 after the move", 0, fords3rdTabTemplateAfterMove.getGadgets().get(4)
                .getZoneIndex());
    }
View Full Code Here

                oneOf(ppg).getPersonProperties(inFields);
                will(returnValue(ppr));

                oneOf(ppr).getTabTemplates();
                will(returnValue(new ArrayList<TabTemplate>(//
                        Arrays.asList(new TabTemplate("welcome", Layout.ONECOLUMN)))));

                oneOf(ppr).getTheme();
                will(returnValue(null));
            }
        });
View Full Code Here

                oneOf(ppg).getPersonProperties(inFields);
                will(returnValue(ppr));

                oneOf(ppr).getTabTemplates();
                will(returnValue(new ArrayList<TabTemplate>(//
                        Arrays.asList(new TabTemplate("welcome", Layout.ONECOLUMN)))));

                oneOf(ppr).getTheme();
                will(returnValue(null));
            }
        });
View Full Code Here

                oneOf(ppg).getPersonProperties(inFields);
                will(returnValue(ppr));

                oneOf(ppr).getTabTemplates();
                will(returnValue(new ArrayList<TabTemplate>(//
                        Arrays.asList(new TabTemplate("welcome", Layout.ONECOLUMN)))));

                oneOf(ppr).getTheme();
                will(returnValue(null));
            }
        });
View Full Code Here

                oneOf(ppg).getPersonProperties(inFields);
                will(returnValue(ppr));

                oneOf(ppr).getTabTemplates();
                will(returnValue(new ArrayList<TabTemplate>(//
                        Arrays.asList(new TabTemplate("welcome", Layout.ONECOLUMN)))));

                oneOf(ppr).getTheme();
                will(returnValue(null));
            }
        });
View Full Code Here

                oneOf(ppg).getPersonProperties(inFields);
                will(returnValue(ppr));

                oneOf(ppr).getTabTemplates();
                will(returnValue(new ArrayList<TabTemplate>(//
                        Arrays.asList(new TabTemplate("welcome", Layout.ONECOLUMN)))));

                oneOf(ppr).getTheme();
                will(returnValue(null));
            }
        });
View Full Code Here

    {
        ArrayList<String> sourceList = new ArrayList<String>(Arrays.asList("blah"));
        HashMap<String, Serializable> inParams = new HashMap<String, Serializable>();
        inParams.put("sourceList", sourceList);

        final TabTemplate tt = new TabTemplate("mc tab title", Layout.ONECOLUMN);
        final ArrayList<MembershipCriteria> mcs = new ArrayList<MembershipCriteria>(Arrays.asList(membershipCriteria));

        context.checking(new Expectations()
        {
            {
View Full Code Here

     */
    public void deleteGadget(final Gadget gadgetToDelete) throws GadgetDeletionException
    {

        // find the tab to which the input gadget belongs
        TabTemplate tab = null;
        try
        {
            tab = getTabTemplateByGadgetId(gadgetToDelete.getId(), false);
        }
        catch (Exception ex)
        {
            throw new GadgetDeletionException("Could not find either the specified Gadget or Tab", gadgetToDelete
                    .getId());
        }

        // remove the gadget from the collection
        if (tab.getGadgets().size() > 1)
        {
            tab.getGadgets().remove(gadgetToDelete);
            tab.getGadgets().add(gadgetToDelete);
        }

        // rearrange the gadgetIndexes of the other gadgets
        for (Gadget currentGadget : tab.getGadgets())
        {
            if (currentGadget.getZoneNumber() == gadgetToDelete.getZoneNumber()
                    && currentGadget.getZoneIndex() > gadgetToDelete.getZoneIndex())
            {
                currentGadget.setZoneIndex(currentGadget.getZoneIndex() - 1);
View Full Code Here

TOP

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

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.