Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonald.g.dunne2015-07-08 13:09:08 -0400
committerAngel Avila2015-09-11 20:57:27 -0400
commit6f23090e15cd28fa60b05ec6b2fc2acf653b9df3 (patch)
tree2dcaa71d9de0fb22aedc9c7e275d3c8a2d370f98 /plugins/org.eclipse.osee.ats.core.test
parent490ef361c8db397d5fd12c35bea1b86422756664 (diff)
downloadorg.eclipse.osee-6f23090e15cd28fa60b05ec6b2fc2acf653b9df3.tar.gz
org.eclipse.osee-6f23090e15cd28fa60b05ec6b2fc2acf653b9df3.tar.xz
org.eclipse.osee-6f23090e15cd28fa60b05ec6b2fc2acf653b9df3.zip
feature[ats_ATS209457]: Performance Reporting - Add Color Team to ATS
Diffstat (limited to 'plugins/org.eclipse.osee.ats.core.test')
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/column/AtsCore_Column_JT_Suite.java3
-rw-r--r--plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/column/ColorTeamColumnTest.java124
2 files changed, 126 insertions, 1 deletions
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/column/AtsCore_Column_JT_Suite.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/column/AtsCore_Column_JT_Suite.java
index 6cf84093ef5..c3bf0fd06f1 100644
--- a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/column/AtsCore_Column_JT_Suite.java
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/column/AtsCore_Column_JT_Suite.java
@@ -28,7 +28,8 @@ import org.junit.runners.Suite;
InsertionActivityColumnTest.class,
ParentTopTeamColumnTest.class,
ProgramColumnTest.class,
- TeamColumnUtilityTest.class})
+ TeamColumnUtilityTest.class,
+ ColorTeamColumnTest.class})
/**
* This test suite contains tests that can be run as stand-alone JUnit tests (JT)
*
diff --git a/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/column/ColorTeamColumnTest.java b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/column/ColorTeamColumnTest.java
new file mode 100644
index 00000000000..7373533ce75
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.core.test/src/org/eclipse/osee/ats/core/column/ColorTeamColumnTest.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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.core.column;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+import org.eclipse.osee.ats.api.IAtsServices;
+import org.eclipse.osee.ats.api.IAtsWorkItem;
+import org.eclipse.osee.ats.api.data.AtsAttributeTypes;
+import org.eclipse.osee.ats.api.review.IAtsPeerToPeerReview;
+import org.eclipse.osee.ats.api.workdef.IAttributeResolver;
+import org.eclipse.osee.ats.api.workflow.IAtsAction;
+import org.eclipse.osee.ats.api.workflow.IAtsTask;
+import org.eclipse.osee.ats.api.workflow.IAtsTeamWorkflow;
+import org.eclipse.osee.framework.core.data.ArtifactId;
+import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.type.Pair;
+import org.junit.Before;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+/**
+ * Test Case for {@link ColorTeamColumn}
+ *
+ * @author Donald G. Dunne
+ */
+public class ColorTeamColumnTest {
+
+ // @formatter:off
+ @Mock private IAtsAction action;
+
+ @Mock private IAtsTeamWorkflow teamWf1;
+ @Mock private IAtsTask childWorkItem;
+ @Mock private IAtsPeerToPeerReview peerReview;
+
+ @Mock private IAtsServices atsServices;
+ @Mock private IAttributeResolver attributeResolver;
+
+ @Mock private ArtifactId workPackageArt;
+
+ // @formatter:on
+
+ @Before
+ public void setup() throws OseeCoreException {
+ MockitoAnnotations.initMocks(this);
+
+ when(atsServices.getAttributeResolver()).thenReturn(attributeResolver);
+ }
+
+ @org.junit.Test
+ public void testTeamWorkflow() throws Exception {
+ when(attributeResolver.getSoleAttributeValue(teamWf1, AtsAttributeTypes.WorkPackageGuid, null)).thenReturn(null);
+
+ Pair<String, Boolean> result = ColorTeamColumn.getWorkItemColorTeam(teamWf1, atsServices);
+ assertEquals("", result.getFirst());
+
+ when(attributeResolver.getSoleAttributeValue(teamWf1, AtsAttributeTypes.WorkPackageGuid, null)).thenReturn(
+ "guid");
+ when(atsServices.getArtifactById("guid")).thenReturn(null);
+
+ result = ColorTeamColumn.getWorkItemColorTeam(teamWf1, atsServices);
+ assertEquals("", result.getFirst());
+
+ when(atsServices.getArtifactById("guid")).thenReturn(workPackageArt);
+ when(attributeResolver.getSoleAttributeValue(workPackageArt, AtsAttributeTypes.ColorTeam, "")).thenReturn("");
+
+ result = ColorTeamColumn.getWorkItemColorTeam(teamWf1, atsServices);
+ assertEquals("", result.getFirst());
+
+ when(attributeResolver.getSoleAttributeValue(workPackageArt, AtsAttributeTypes.ColorTeam, "")).thenReturn("red");
+
+ result = ColorTeamColumn.getWorkItemColorTeam(teamWf1, atsServices);
+ assertEquals("red", result.getFirst());
+ }
+
+ @org.junit.Test
+ public void testTask() throws Exception {
+ testChildWorkItem(childWorkItem);
+ }
+
+ @org.junit.Test
+ public void testReview() throws Exception {
+ testChildWorkItem(peerReview);
+ }
+
+ private void testChildWorkItem(IAtsWorkItem childWorkItem) {
+ when(attributeResolver.getSoleAttributeValue(childWorkItem, AtsAttributeTypes.WorkPackageGuid, null)).thenReturn(
+ null);
+
+ Pair<String, Boolean> result = ColorTeamColumn.getWorkItemColorTeam(childWorkItem, atsServices);
+ assertEquals("", result.getFirst());
+
+ when(childWorkItem.getParentTeamWorkflow()).thenReturn(teamWf1);
+ result = ColorTeamColumn.getWorkItemColorTeam(childWorkItem, atsServices);
+ assertEquals("", result.getFirst());
+
+ when(attributeResolver.getSoleAttributeValue(teamWf1, AtsAttributeTypes.WorkPackageGuid, null)).thenReturn(
+ "guid");
+ when(atsServices.getArtifactById("guid")).thenReturn(null);
+
+ result = ColorTeamColumn.getWorkItemColorTeam(childWorkItem, atsServices);
+ assertEquals("", result.getFirst());
+
+ when(atsServices.getArtifactById("guid")).thenReturn(workPackageArt);
+ when(attributeResolver.getSoleAttributeValue(workPackageArt, AtsAttributeTypes.ColorTeam, "")).thenReturn("");
+
+ result = ColorTeamColumn.getWorkItemColorTeam(childWorkItem, atsServices);
+ assertEquals("", result.getFirst());
+
+ when(attributeResolver.getSoleAttributeValue(workPackageArt, AtsAttributeTypes.ColorTeam, "")).thenReturn("red");
+
+ result = ColorTeamColumn.getWorkItemColorTeam(childWorkItem, atsServices);
+ assertEquals("red", result.getFirst());
+ }
+
+}

Back to the top