* 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();
}