Skip to main content
summaryrefslogtreecommitdiffstats
blob: 1c588b64b47192e42daf68a3e9a81a20b9008bbe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
 * Created on Nov 24, 2015
 *
 * PLACE_YOUR_DISTRIBUTION_STATEMENT_RIGHT_HERE
 */
package org.eclipse.osee.ats.client.integration.tests.ats.world.search;

import java.util.Collection;
import org.eclipse.osee.ats.AtsImage;
import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.api.workflow.WorkItemType;
import org.eclipse.osee.ats.world.search.ShowOpenWorkflowsByReviewType;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;

public class ShowOpenWorkflowsByArtifactTypeTest {

   @org.junit.Test
   public void testOpenDecisionReviews() throws Exception {
      ShowOpenWorkflowsByReviewType search =
         new ShowOpenWorkflowsByReviewType("Show Open " + WorkItemType.DecisionReview.name() + "s",
            WorkItemType.DecisionReview, false, false, AtsImage.DECISION_REVIEW);
      Collection<Artifact> results = search.performSearchGetResults();
      checkResults(5, AtsArtifactTypes.DecisionReview, results);
   }

   @org.junit.Test
   public void testWorkflowsWaitingDecisionReviews() throws Exception {
      ShowOpenWorkflowsByReviewType search =
         new ShowOpenWorkflowsByReviewType("Show Workflows Waiting " + WorkItemType.DecisionReview.name() + "s",
            WorkItemType.DecisionReview, false, true, AtsImage.DECISION_REVIEW);
      Collection<Artifact> results = search.performSearchGetResults();
      checkResults(5, AtsArtifactTypes.TeamWorkflow, results);
   }

   @org.junit.Test
   public void testOpenPeerReviews() throws Exception {
      ShowOpenWorkflowsByReviewType search =
         new ShowOpenWorkflowsByReviewType("Show Open " + WorkItemType.PeerReview.name() + "s", WorkItemType.PeerReview,
            false, false, AtsImage.PEER_REVIEW);
      Collection<Artifact> results = search.performSearchGetResults();
      checkResults(5, AtsArtifactTypes.PeerToPeerReview, results);
   }

   @org.junit.Test
   public void testWorkflowsWaitingPeerToPeerReviews() throws Exception {
      ShowOpenWorkflowsByReviewType search =
         new ShowOpenWorkflowsByReviewType("Show Workflows Waiting " + WorkItemType.PeerReview.name() + "s",
            WorkItemType.PeerReview, false, true, AtsImage.PEER_REVIEW);
      Collection<Artifact> results = search.performSearchGetResults();
      checkResults(4, AtsArtifactTypes.TeamWorkflow, results);
   }

   private void checkResults(int expectedCount, IArtifactType ofType, Collection<Artifact> results) {
      org.junit.Assert.assertEquals(expectedCount, results.size());
      int count = 0;
      for (Artifact art : results) {
         if (art.isOfType(ofType)) {
            count++;
         }
      }
      org.junit.Assert.assertEquals("Not all results are of correct type", expectedCount, count);
   }

}

Back to the top