Package org.nxplanner.domain

Examples of org.nxplanner.domain.Integration


        assertFalse("listeners notified", mockIntegrationListener.onEventCalled);
        assertCommit();
    }

    public void testLeaveWhenFirst() throws Exception {
        Integration integration1 = new Integration();
        integration1.setId(234);
        integration1.setState(Integration.PENDING);
        Integration integration2 = new Integration();
        integration2.setId(400);
        integration2.setState(Integration.PENDING);
        ArrayList results1 = new ArrayList();
        results1.add(integration1);
        results1.add(integration2);
        ArrayList results2 = new ArrayList();
        results2.add(integration2);
        mockSession.find3Returns = new ArrayList();
        mockSession.find3Returns.add(results1);
        mockSession.find3Returns.add(results2);
        Integration integration = new Integration();
        integration.setId(234);
        mockSession.loadReturn = integration;
        support.request.setParameterValue("action.leave.234", new String[]{""});
        replay();

        ActionForward forward = support.executeAction(action);
View Full Code Here


        assertEquals(integration2, mockIntegrationListener.onEventIntegration);
        assertCommit();
    }

    public void testLeaveWhenOnly() throws Exception {
        Integration integration1 = new Integration();
        integration1.setId(234);
        integration1.setState(Integration.PENDING);
        ArrayList results1 = new ArrayList();
        results1.add(integration1);
        ArrayList results2 = new ArrayList();
        mockSession.find3Returns = new ArrayList();
        mockSession.find3Returns.add(results1);
        mockSession.find3Returns.add(results2);
        Integration integration = new Integration();
        integration.setId(234);
        mockSession.loadReturn = integration;
        support.request.setParameterValue("action.leave.234", new String[]{""});
        replay();

        ActionForward forward = support.executeAction(action);
View Full Code Here

        assertRollback();
    }

    public void testStart() throws Exception {
        ArrayList activeIntegrations = new ArrayList();
        Integration integration1 = new Integration();
        integration1.setState(Integration.PENDING);
        Integration integration2 = new Integration();
        integration2.setState(Integration.PENDING);
        ArrayList pendingIntegrations = new ArrayList();
        mockSession.find3Return = new ArrayList();
        pendingIntegrations.add(integration1);
        pendingIntegrations.add(integration2);
        mockSession.find3Returns = new ArrayList();
        mockSession.find3Returns.add(activeIntegrations);
        mockSession.find3Returns.add(pendingIntegrations);
        support.request.setParameterValue("action.start", new String[]{""});
        replay();

        ActionForward forward = support.executeAction(action);

        verify();
        assertEquals(addProjectId("DISPLAY"), forward.getPath());
        assertTrue("find not called", mockSession.find3Called);
        assertEquals(Integration.ACTIVE, integration1.getState());
        assertNotNull(integration1.getWhenStarted());
        assertEquals(Integration.PENDING, integration2.getState());
        assertNull(integration2.getWhenStarted());
        assertCommit();
    }
View Full Code Here

     * integrations. This could happen if someone has not refreshed their
     * browser window.
     * @throws Exception
     */
    public void testStartWhenAlreadyStarted() throws Exception {
        Integration integration0 = new Integration();
        integration0.setState(Integration.ACTIVE);
        ArrayList activeIntegrations = new ArrayList();
        activeIntegrations.add(integration0);
        Integration integration1 = new Integration();
        integration1.setState(Integration.PENDING);
        Integration integration2 = new Integration();
        integration2.setState(Integration.PENDING);
        ArrayList pendingIntegrations = new ArrayList();
        mockSession.find3Return = new ArrayList();
        pendingIntegrations.add(integration1);
        pendingIntegrations.add(integration2);
        mockSession.find3Returns = new ArrayList();
        mockSession.find3Returns.add(activeIntegrations);
        mockSession.find3Returns.add(pendingIntegrations);
        support.request.setParameterValue("action.start", new String[]{""});
        replay();

        ActionForward forward = support.executeAction(action);

        verify();
        assertEquals(addProjectId("ERROR"), forward.getPath());
        ActionErrors errors = (ActionErrors)support.request.getAttribute(Globals.ERROR_KEY);
        assertNotNull(errors);
        assertEquals(1, errors.size());
        assertEquals("integrations.error.alreadyactive", ((ActionError)errors.get().next()).getKey());
        assertEquals(Integration.ACTIVE, integration0.getState());
        assertEquals(Integration.PENDING, integration1.getState());
        assertNull(integration1.getWhenStarted());
        assertEquals(Integration.PENDING, integration2.getState());
        assertNull(integration2.getWhenStarted());
        assertCommit();
    }
View Full Code Here

        assertEquals("ERROR", forward.getPath());
        assertRollback();
    }

    public void testFinish() throws Exception {
        Integration integration1 = new Integration();
        integration1.setState(Integration.ACTIVE);
        integration1.setWhenStarted(new Date());
        Integration integration2 = new Integration();
        ArrayList results1 = new ArrayList();
        results1.add(integration1);
        ArrayList results2 = new ArrayList();
        results2.add(integration2);
        mockSession.find3Returns = new ArrayList();
View Full Code Here

        assertEquals("ERROR", forward.getPath());
        assertRollback();
    }

    public void testCancel() throws Exception {
        Integration integration1 = new Integration();
        integration1.setState(Integration.ACTIVE);
        integration1.setWhenStarted(new Date());
        Integration integration2 = new Integration();
        ArrayList results1 = new ArrayList();
        results1.add(integration1);
        ArrayList results2 = new ArrayList();
        results2.add(integration2);
        mockSession.find3Returns = new ArrayList();
View Full Code Here

TOP

Related Classes of org.nxplanner.domain.Integration

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.