Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Joy2013-05-01 16:06:40 +0000
committerRoberto E. Escobar2013-06-17 23:09:01 +0000
commitf101f03067105c4db777a811ba15b911bfdd083e (patch)
treeeabc3a2b6445670074d131f2ae2b033f964b07a4 /plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats
parent5e4905614db8ac2cf75158fc31de69c908a4e5b5 (diff)
downloadorg.eclipse.osee-f101f03067105c4db777a811ba15b911bfdd083e.tar.gz
org.eclipse.osee-f101f03067105c4db777a811ba15b911bfdd083e.tar.xz
org.eclipse.osee-f101f03067105c4db777a811ba15b911bfdd083e.zip
feature[ats_1W87K]: Create ability for Actions to be auto-added to Goals
Diffstat (limited to 'plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats')
-rw-r--r--plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsCoreClient_Suite.java2
-rw-r--r--plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/action/AtsCoreClient_Action_Suite.java35
-rw-r--r--plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/action/AutoAddActionToGoalTest.java214
3 files changed, 251 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/AtsCoreClient_Suite.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsCoreClient_Suite.java
index 2bf0bccdb1d..a2199dc7dbc 100644
--- a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsCoreClient_Suite.java
+++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/AtsCoreClient_Suite.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.osee.ats.client.integration.tests.ats.core.client;
+import org.eclipse.osee.ats.client.integration.tests.ats.core.client.action.AtsCoreClient_Action_Suite;
import org.eclipse.osee.ats.client.integration.tests.ats.core.client.branch.AtsCoreClient_Branch_Suite;
import org.eclipse.osee.ats.client.integration.tests.ats.core.client.config.AtsCoreClient_Config_Suite;
import org.eclipse.osee.ats.client.integration.tests.ats.core.client.notify.AtsCoreClient_Notify_Suite;
@@ -30,6 +31,7 @@ import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
AtsTestUtilTest.class,
+ AtsCoreClient_Action_Suite.class,
AtsCoreClient_Branch_Suite.class,
AtsCoreClient_Config_Suite.class,
AtsCoreClient_Notify_Suite.class,
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/action/AtsCoreClient_Action_Suite.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/action/AtsCoreClient_Action_Suite.java
new file mode 100644
index 00000000000..d1913bc2846
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/action/AtsCoreClient_Action_Suite.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.client.integration.tests.ats.core.client.action;
+
+import org.eclipse.osee.framework.jdk.core.util.OseeProperties;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+/**
+ * @author Mark Joy
+ */
+@RunWith(Suite.class)
+@Suite.SuiteClasses({AutoAddActionToGoalTest.class})
+public class AtsCoreClient_Action_Suite {
+ @BeforeClass
+ public static void setUp() throws Exception {
+ OseeProperties.setIsInTest(true);
+ System.out.println("\n\nBegin " + AtsCoreClient_Action_Suite.class.getSimpleName());
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+ System.out.println("End " + AtsCoreClient_Action_Suite.class.getSimpleName());
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/action/AutoAddActionToGoalTest.java b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/action/AutoAddActionToGoalTest.java
new file mode 100644
index 00000000000..1b5b85df49e
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.client.integration.tests/src/org/eclipse/osee/ats/client/integration/tests/ats/core/client/action/AutoAddActionToGoalTest.java
@@ -0,0 +1,214 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ats.client.integration.tests.ats.core.client.action;
+
+import java.util.List;
+import junit.framework.Assert;
+import org.eclipse.osee.ats.api.ai.IAtsActionableItem;
+import org.eclipse.osee.ats.api.data.AtsRelationTypes;
+import org.eclipse.osee.ats.api.team.IAtsTeamDefinition;
+import org.eclipse.osee.ats.api.workdef.IAtsWorkDefinition;
+import org.eclipse.osee.ats.artifact.GoalManager;
+import org.eclipse.osee.ats.client.integration.tests.AtsClientService;
+import org.eclipse.osee.ats.client.integration.tests.ats.core.client.AtsTestUtil;
+import org.eclipse.osee.ats.core.client.action.ActionManager;
+import org.eclipse.osee.ats.core.client.artifact.GoalArtifact;
+import org.eclipse.osee.ats.core.client.team.TeamWorkFlowArtifact;
+import org.eclipse.osee.ats.util.AtsUtil;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache;
+import org.eclipse.osee.framework.skynet.core.transaction.SkynetTransaction;
+import org.eclipse.osee.framework.skynet.core.transaction.TransactionManager;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+/**
+ * Test for {@link ActionManager}
+ *
+ * @author Mark Joy
+ */
+public class AutoAddActionToGoalTest {
+
+ @BeforeClass
+ @AfterClass
+ public static void cleanup() throws Exception {
+ AtsTestUtil.cleanup();
+ }
+
+ // Test that no action is added to the Goal
+ @org.junit.Test
+ public void testNoActionAddedToGoal() throws OseeCoreException {
+ AtsTestUtil.cleanupAndReset("AutoAddActionToGoalTest - NoAdd");
+
+ GoalArtifact goalArt = GoalManager.createGoal("NoActionAddedGoal");
+ TeamWorkFlowArtifact teamWf2 = AtsTestUtil.getTeamWf2();
+ TeamWorkFlowArtifact teamWf3 = AtsTestUtil.getTeamWf3();
+ TeamWorkFlowArtifact teamWf4 = AtsTestUtil.getTeamWf4();
+ List<Artifact> memArt = goalArt.getRelatedArtifacts(AtsRelationTypes.Goal_Member);
+ Assert.assertEquals("Goal should have no memebers", 0, memArt.size());
+ ArtifactCache.deCache(goalArt);
+ }
+
+ // Create a goal with a relation to an AI and add an Action. The
+ // Team Workflow should be added to the Goal
+ @org.junit.Test
+ public void testAutoAddActionToGoal_AI() throws OseeCoreException {
+ AtsTestUtil.cleanupAndReset("AutoAddActionToGoalTest - AddActionWithAI");
+
+ IAtsWorkDefinition workDef = AtsTestUtil.getWorkDef();
+ GoalArtifact goalArt = GoalManager.createGoal("AddActionToGoalFromAI");
+ IAtsActionableItem actionItem2 = AtsTestUtil.getTestAi2();
+
+ SkynetTransaction transaction =
+ TransactionManager.createTransaction(AtsUtil.getAtsBranchToken(), getClass().getSimpleName());
+ AtsClientService.get().storeConfigObject(actionItem2, transaction);
+ IAtsTeamDefinition teamDef = AtsTestUtil.getTestTeamDef();
+ teamDef.getVersions().clear();
+ AtsClientService.get().storeConfigObject(teamDef, transaction);
+ transaction.execute();
+
+ Artifact testAI2 = AtsClientService.get().getArtifact(AtsTestUtil.getTestAi2());
+
+ goalArt.addRelation(AtsRelationTypes.AutoAddActionToGoal_ConfigObject, testAI2);
+
+ AtsClientService.get().getWorkDefinitionAdmin().addWorkDefinition(workDef);
+
+ TeamWorkFlowArtifact teamWf2 = AtsTestUtil.getTeamWf2();
+
+ List<Artifact> memArt = goalArt.getRelatedArtifacts(AtsRelationTypes.Goal_Member);
+ Assert.assertEquals("Goal should have one memeber from AI", 1, memArt.size());
+ Assert.assertTrue("Team Workflow with AI not part of Goal",
+ goalArt.getRelatedArtifacts(AtsRelationTypes.Goal_Member).contains(teamWf2));
+
+ AtsTestUtil.cleanup();
+ testAI2.deleteAndPersist();
+ ArtifactCache.deCache(goalArt);
+ }
+
+ // Create a goal with a relation to a Team Definition and add an Action. The
+ // Team Workflow should be added to the Goal
+ @org.junit.Test
+ public void testAutoAddActionToGoal_TeamWF() throws OseeCoreException {
+ AtsTestUtil.cleanupAndReset("AutoAddActionToGoalTest - AddActionWithTeamDef");
+
+ GoalArtifact goalArt = GoalManager.createGoal("AddActionToGoalFromTeamDef");
+
+ SkynetTransaction transaction =
+ TransactionManager.createTransaction(AtsUtil.getAtsBranchToken(), getClass().getSimpleName());
+ IAtsTeamDefinition teamDef = AtsTestUtil.getTestTeamDef();
+ teamDef.getVersions().clear();
+ AtsClientService.get().storeConfigObject(teamDef, transaction);
+ transaction.execute();
+
+ Artifact teamDefArtifact = AtsClientService.get().getArtifact(AtsTestUtil.getTestTeamDef());
+
+ goalArt.addRelation(AtsRelationTypes.AutoAddActionToGoal_ConfigObject, teamDefArtifact);
+
+ TeamWorkFlowArtifact teamWf2 = AtsTestUtil.getTeamWf2();
+ List<Artifact> memArt = goalArt.getRelatedArtifacts(AtsRelationTypes.Goal_Member);
+ Assert.assertEquals("Goal should have one memeber from Team Definition", 1, memArt.size());
+ Assert.assertTrue("Team Workflow with TeamDef not part of Goal",
+ goalArt.getRelatedArtifacts(AtsRelationTypes.Goal_Member).contains(teamWf2));
+
+ AtsTestUtil.cleanup();
+ ArtifactCache.deCache(goalArt);
+ }
+
+ // Create a Goal with a relation to an AI and Team Definition. The action should
+ // only be added to the goal once.
+ @org.junit.Test
+ public void testAutoAddActionToGoal_AIandTeamWF() throws OseeCoreException {
+ AtsTestUtil.cleanupAndReset("AutoAddActionToGoalTest - AddActionWithAIandTeamDef");
+
+ IAtsWorkDefinition workDef = AtsTestUtil.getWorkDef();
+ GoalArtifact goalArt = GoalManager.createGoal("AddActionToGoalFromAIorTeamDef");
+ IAtsActionableItem actionItem = AtsTestUtil.getTestAi2();
+
+ SkynetTransaction transaction =
+ TransactionManager.createTransaction(AtsUtil.getAtsBranchToken(), getClass().getSimpleName());
+ AtsClientService.get().storeConfigObject(actionItem, transaction);
+ IAtsTeamDefinition teamDef = AtsTestUtil.getTestTeamDef();
+ teamDef.getVersions().clear();
+ AtsClientService.get().storeConfigObject(teamDef, transaction);
+ transaction.execute();
+
+ Artifact testAI2 = AtsClientService.get().getArtifact(AtsTestUtil.getTestAi2());
+ Artifact teamDefArtifact = AtsClientService.get().getArtifact(AtsTestUtil.getTestTeamDef());
+
+ goalArt.addRelation(AtsRelationTypes.AutoAddActionToGoal_ConfigObject, testAI2);
+ goalArt.addRelation(AtsRelationTypes.AutoAddActionToGoal_ConfigObject, teamDefArtifact);
+
+ AtsClientService.get().getWorkDefinitionAdmin().addWorkDefinition(workDef);
+
+ TeamWorkFlowArtifact teamWf2 = AtsTestUtil.getTeamWf2();
+ List<Artifact> memArt = goalArt.getRelatedArtifacts(AtsRelationTypes.Goal_Member);
+ Assert.assertEquals("Goal should only have one memeber", 1, memArt.size());
+ Assert.assertTrue("Team Workflow with AI and TeamDef not part of Goal",
+ goalArt.getRelatedArtifacts(AtsRelationTypes.Goal_Member).contains(teamWf2));
+
+ AtsTestUtil.cleanup();
+ testAI2.deleteAndPersist();
+ ArtifactCache.deCache(goalArt);
+ }
+
+ // Create two Goals. Goal one has relation to two different AIs. Goal two has a relation to
+ // one of those AIs. Create two Actions and test Goal one has two members and Goal two has
+ // only one member.
+ @org.junit.Test
+ public void testAutoAddActionToGoal_TwoAIsTwoGoals() throws OseeCoreException {
+ AtsTestUtil.cleanupAndReset("DecisionReviewManagerTest - UnAssigned");
+
+ IAtsWorkDefinition workDef = AtsTestUtil.getWorkDef();
+ GoalArtifact goalArt = GoalManager.createGoal("AddTwoActions");
+ GoalArtifact goalArt2 = GoalManager.createGoal("SecondGoal");
+ IAtsActionableItem actionItem2 = AtsTestUtil.getTestAi2();
+ IAtsActionableItem actionItem3 = AtsTestUtil.getTestAi3();
+
+ SkynetTransaction transaction =
+ TransactionManager.createTransaction(AtsUtil.getAtsBranchToken(), getClass().getSimpleName());
+ AtsClientService.get().storeConfigObject(actionItem2, transaction);
+ AtsClientService.get().storeConfigObject(actionItem3, transaction);
+ IAtsTeamDefinition teamDef = AtsTestUtil.getTestTeamDef();
+ teamDef.getVersions().clear();
+ AtsClientService.get().storeConfigObject(teamDef, transaction);
+ transaction.execute();
+
+ Artifact testAI2 = AtsClientService.get().getArtifact(AtsTestUtil.getTestAi2());
+ Artifact testAI3 = AtsClientService.get().getArtifact(AtsTestUtil.getTestAi3());
+
+ goalArt.addRelation(AtsRelationTypes.AutoAddActionToGoal_ConfigObject, testAI2);
+ goalArt.addRelation(AtsRelationTypes.AutoAddActionToGoal_ConfigObject, testAI3);
+ goalArt2.addRelation(AtsRelationTypes.AutoAddActionToGoal_ConfigObject, testAI2);
+
+ AtsClientService.get().getWorkDefinitionAdmin().addWorkDefinition(workDef);
+
+ TeamWorkFlowArtifact teamWf2 = AtsTestUtil.getTeamWf2();
+ TeamWorkFlowArtifact teamWf3 = AtsTestUtil.getTeamWf3();
+ List<Artifact> memArt = goalArt.getRelatedArtifacts(AtsRelationTypes.Goal_Member);
+ Assert.assertEquals("Goal should have two memebers", 2, memArt.size());
+ Assert.assertTrue("Team Workflow with two memebers of Goal - TeamWf",
+ goalArt.getRelatedArtifacts(AtsRelationTypes.Goal_Member).contains(teamWf2));
+ Assert.assertTrue("Team Workflow with two memebers of Goal - TeamWf2",
+ goalArt.getRelatedArtifacts(AtsRelationTypes.Goal_Member).contains(teamWf3));
+ List<Artifact> memArt2 = goalArt2.getRelatedArtifacts(AtsRelationTypes.Goal_Member);
+ Assert.assertEquals("Goal2 should only have one memeber", 1, memArt2.size());
+ Assert.assertTrue("Team Workflow with AI part of Goal2",
+ goalArt2.getRelatedArtifacts(AtsRelationTypes.Goal_Member).contains(teamWf2));
+
+ AtsTestUtil.cleanup();
+ testAI2.deleteAndPersist();
+ testAI3.deleteAndPersist();
+ ArtifactCache.deCache(goalArt);
+ ArtifactCache.deCache(goalArt2);
+ }
+
+}

Back to the top