Package org.eurekastreams.server.domain

Examples of org.eurekastreams.server.domain.Layout


    @Test
    public final void testExecuteValid() throws Exception
    {
        final Long tabId = 100L;
        final Long gadgetDefinitionId = 9928L;
        final Layout tabLayout = Layout.THREECOLUMNLEFTWIDEHEADER;
        final Person person = context.mock(Person.class);

        final List<Tab> tabList = Collections.singletonList(tab);

        final List<Gadget> gadgets = new ArrayList<Gadget>();

        // Set up expectations
        context.checking(new Expectations()
        {
            {
                allowing(actionContext).getParams();
                will(returnValue(gadgetRequest));

                allowing(gadgetRequest).getTabId();
                will(returnValue(tabId));

                allowing(gadgetRequest).getGadgetDefinitionUrl();
                will(returnValue(GADGET_DEF_URL));

                allowing(gadgetRequest).getUserPrefs();
                will(returnValue(null));

                // action has to load the tab by ID
                allowing(tabMapper).findById(tabId);
                will(returnValue(tab));

                // then find-or-create the gadget definition
                allowing(gadgetDefinitionMapper).findByUrl(GADGET_DEF_URL);
                will(returnValue(gadgetDefinition));

                // gadget definition ID is 9928
                allowing(gadgetDefinition).getId();
                will(returnValue(gadgetDefinitionId));

                // and check what the last zone number is
                allowing(tab).getTabLayout();
                will(returnValue(tabLayout));

                // setup the list of mocked gadgets

                // ----------------
                // -- Gadget #0 - zone 0, index 0
                Gadget gadget0 = context.mock(Gadget.class, "gadget0");

                exactly(1).of(gadget0).getZoneNumber();
                will(returnValue(0));

                // should never have to ask this gadget for its zone index
                never(gadget0).getZoneIndex();
                // ----------------

                // ----------------
                // -- Gadget #1 - <LAST ZONE>, index 0
                Gadget gadget1 = context.mock(Gadget.class, "gadget1");
                exactly(1).of(gadget1).getZoneNumber();
                will(returnValue(tabLayout.getNumberOfZones() - 1));

                // ----------------
                // -- Gadget #2 - <LAST ZONE>, index 1
                Gadget gadget2 = context.mock(Gadget.class, "gadget2");

                // set the zone number - it MUST be requested once
                exactly(1).of(gadget2).getZoneNumber();
                will(returnValue(tabLayout.getNumberOfZones() - 1));

                // add the gadgets to the collection
                gadgets.add(gadget0);
                gadgets.add(gadget1);
                gadgets.add(gadget2);
View Full Code Here


     *             performAction can throw an exception
     */
    @Test
    public final void testExecuteGrow() throws Exception
    {
        final Layout newLayout = Layout.THREECOLUMNLEFTWIDEHEADER;

        // set up expectations
        context.checking(new Expectations()
        {
            {
View Full Code Here

     *             not expected
     */
    @Test
    public final void testExecuteShrink() throws Exception
    {
        final Layout newLayout = Layout.TWOCOLUMN;

        // set up expectations
        context.checking(new Expectations()
        {
            {
View Full Code Here

     *             not expected
     */
    @Test
    public void performActionSameZoneCount() throws Exception
    {
        final Layout newLayout = Layout.THREECOLUMN;

        // set up expectations
        context.checking(new Expectations()
        {
            {
View Full Code Here

    {
        final List<Gadget> gadgetsList = new ArrayList<Gadget>();
        gadgetsList.add(testGadgetOne);
        gadgetsList.add(testGadgetTwo);
        gadgetsList.add(testGadgetThree);
        final Layout currentLayout = Layout.TWOCOLUMN;

        setupGadgetExpectations();

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

    {
        final List<Gadget> gadgetsList = new ArrayList<Gadget>();
        gadgetsList.add(testGadgetOne);
        gadgetsList.add(testGadgetTwo);
        gadgetsList.add(testGadgetThree);
        final Layout currentLayout = Layout.TWOCOLUMN;

        setupGadgetExpectations();

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

    {
        final List<Gadget> gadgetsList = new ArrayList<Gadget>();
        gadgetsList.add(testGadgetOne);
        gadgetsList.add(testGadgetTwo);
        gadgetsList.add(testGadgetThree);
        final Layout currentLayout = Layout.TWOCOLUMN;

        setupGadgetExpectations();

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

    {
        final List<Gadget> gadgetsList = new ArrayList<Gadget>();
        gadgetsList.add(testGadgetOne);
        gadgetsList.add(testGadgetTwo);
        gadgetsList.add(testGadgetThree);
        final Layout currentLayout = Layout.TWOCOLUMN;

        setupGadgetExpectations();

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

    {
        final List<Gadget> gadgetsList = new ArrayList<Gadget>();
        gadgetsList.add(testGadgetOne);
        gadgetsList.add(testGadgetTwo);
        gadgetsList.add(testGadgetThree);
        final Layout currentLayout = Layout.TWOCOLUMN;

        context.checking(new Expectations()
        {
            {
                oneOf(mockedContext).getParams();
View Full Code Here

            vex.addError("invalidTab", "Destination zone does not exist.");
            throw vex;
        }

        TabTemplate destinationTemplate = destinationTab.getTemplate();
        Layout destinationLayout = destinationTemplate.getTabLayout();

        // Save the Source and Destination TabTemplate to state so they can be reused in execution.
        inActionContext.getState().put("destinationTemplate", destinationTemplate);
        inActionContext.getState().put("sourceTemplate", sourceTemplate);

        // Destination zone is within the valid number of destination zones.
        if (targetZoneNumber + 1 > destinationLayout.getNumberOfZones())
        {
            vex.addError("invalidZone", "ReorderGadgetAction told to move a gadget to a nonexistent zone.");
            throw vex;
        }
View Full Code Here

TOP

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

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.