Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2013-03-26 17:21:42 +0000
committerdonald.g.dunne2013-03-27 19:21:08 +0000
commit2c20a3cc3324603350c040dbd64d0991e2428aa6 (patch)
treea6f0bf0e40e27d41b713dbb2e9c025148c09db0e /plugins/org.eclipse.osee.ats.client.integration.tests/src
parent06962d390def88d9c8b2874ffd2aba78c7154258 (diff)
downloadorg.eclipse.osee-2c20a3cc3324603350c040dbd64d0991e2428aa6.tar.gz
org.eclipse.osee-2c20a3cc3324603350c040dbd64d0991e2428aa6.tar.xz
org.eclipse.osee-2c20a3cc3324603350c040dbd64d0991e2428aa6.zip
bug[ats_99NLX]: Fix ATS.TransitionManager to set Percent Complete attribute
Diffstat (limited to 'plugins/org.eclipse.osee.ats.client.integration.tests/src')
-rw-r--r--plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/workflow/transition/TransitionManagerTest.java60
1 files changed, 60 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/workflow/transition/TransitionManagerTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/workflow/transition/TransitionManagerTest.java
index e3f8e20030..af920c3931 100644
--- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/workflow/transition/TransitionManagerTest.java
+++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/workflow/transition/TransitionManagerTest.java
@@ -50,6 +50,7 @@ import org.eclipse.osee.ats.core.workflow.transition.TransitionResult;
import org.eclipse.osee.ats.mocks.MockStateDefinition;
import org.eclipse.osee.framework.core.enums.SystemUser;
import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.util.Result;
import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
import org.junit.AfterClass;
@@ -649,4 +650,63 @@ public class TransitionManagerTest {
Assert.assertTrue(assigneesAfter.containsAll(assigneesBefore));
Assert.assertTrue(assigneesBefore.containsAll(assigneesAfter));
}
+
+ @org.junit.Test
+ public void testHandleTransition__PercentComplete() throws OseeCoreException {
+ AtsTestUtil.cleanupAndReset("TransitionManagerTest-G");
+ TeamWorkFlowArtifact teamArt = AtsTestUtil.getTeamWf();
+
+ // Setup - Transition to Implement
+ SkynetTransaction transaction = TransactionManager.createTransaction(AtsUtilCore.getAtsBranchToken(), "create");
+ Result result =
+ AtsTestUtil.transitionTo(AtsTestUtilState.Implement, AtsUsersClient.getUser(), transaction,
+ TransitionOption.OverrideAssigneeCheck);
+ transaction.execute();
+ Assert.assertTrue("Transition Error: " + result.getText(), result.isTrue());
+ Assert.assertEquals("Implement", teamArt.getCurrentStateName());
+ Assert.assertEquals(0, teamArt.getSoleAttributeValue(AtsAttributeTypes.PercentComplete, 0).intValue());
+
+ // Transition to completed should set percent to 100
+ MockTransitionHelper helper =
+ new MockTransitionHelper(getClass().getSimpleName(), Arrays.asList(teamArt),
+ AtsTestUtil.getCompletedStateDef().getName(), Arrays.asList(AtsUsersClient.getUser()), null,
+ TransitionOption.None);
+ TransitionManager transMgr = new TransitionManager(helper);
+ TransitionResults results = new TransitionResults();
+ transMgr.handleTransition(results);
+ transMgr.getTransaction().execute();
+ Assert.assertTrue("Transition Error: " + results.toString(), results.isEmpty());
+ Assert.assertEquals("Completed", teamArt.getCurrentStateName());
+ Assert.assertEquals(100, teamArt.getSoleAttributeValue(AtsAttributeTypes.PercentComplete, 100).intValue());
+
+ // Transition to Implement should set percent to 0
+ helper =
+ new MockTransitionHelper(getClass().getSimpleName(), Arrays.asList(teamArt),
+ AtsTestUtil.getImplementStateDef().getName(), Arrays.asList(AtsUsersClient.getUser()), null,
+ TransitionOption.None);
+ transMgr = new TransitionManager(helper);
+ results = new TransitionResults();
+ transMgr.handleTransition(results);
+ transMgr.getTransaction().execute();
+
+ Assert.assertTrue("Transition Error: " + results.toString(), results.isEmpty());
+ Assert.assertEquals("Implement", teamArt.getCurrentStateName());
+ Assert.assertEquals(0, teamArt.getSoleAttributeValue(AtsAttributeTypes.PercentComplete, 0).intValue());
+
+ // Transition to Cancelled should set percent to 0
+ helper =
+ new MockTransitionHelper(getClass().getSimpleName(), Arrays.asList(teamArt),
+ AtsTestUtil.getCancelledStateDef().getName(), Arrays.asList(AtsUsersClient.getUser()), null,
+ TransitionOption.None);
+ transMgr = new TransitionManager(helper);
+ results = new TransitionResults();
+ transMgr.handleTransition(results);
+ transMgr.getTransaction().execute();
+
+ Assert.assertTrue("Transition Error: " + results.toString(), results.isEmpty());
+ Assert.assertEquals("Cancelled", teamArt.getCurrentStateName());
+ Assert.assertEquals(100, teamArt.getSoleAttributeValue(AtsAttributeTypes.PercentComplete, 100).intValue());
+
+ }
+
}

Back to the top