Skip to main content
summaryrefslogtreecommitdiffstats
blob: 3285439008b43349cf4d183aef3b86b9315f6126 (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
66
67
68
69
70
/*******************************************************************************
 * Copyright (c) 2014 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.config;

import org.eclipse.osee.ats.api.data.AtsArtifactTypes;
import org.eclipse.osee.ats.core.util.AtsUtilCore;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery;
import org.junit.Assert;
import org.junit.Test;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;

/**
 * Unit Test for {@link ActionableItemResource}
 * 
 * @author Donald G. Dunne
 */
public class ActionableItemResourceTest extends AbstractConfigurationRestTest {

   @Test
   public void testAtsAisRestCall() throws Exception {
      JsonArray array = getAndCheck("/ats/ai");
      Assert.assertEquals(44, array.size());
      JsonObject obj = getObjectNamed("SAW Code", array);
      Assert.assertNotNull("Did not find value SAW Code", obj);
      Assert.assertFalse(obj.has("ats.Active"));
   }

   @Test
   public void testAtsAisDetailsRestCall() throws Exception {
      JsonArray array = getAndCheck("/ats/ai/details");
      Assert.assertEquals(44, array.size());
      JsonObject obj = getObjectNamed("SAW Code", array);
      Assert.assertNotNull("Did not find value SAW Code", obj);
      Assert.assertTrue(obj.has("ats.Active"));
   }

   @Test
   public void testAtsAiRestCall() throws Exception {
      JsonArray array = getAndCheck("/ats/ai/" + getSawCodeAi().getArtId());
      Assert.assertEquals(1, array.size());
      JsonObject obj = getObjectNamed("SAW Code", array);
      Assert.assertNotNull("Did not find value SAW Code", obj);
      Assert.assertFalse(obj.has("ats.Active"));
   }

   @Test
   public void testAtsAiDetailsRestCall() throws Exception {
      JsonArray array = getAndCheck("/ats/ai/" + getSawCodeAi().getArtId() + "/details");
      Assert.assertEquals(1, array.size());
      JsonObject obj = getObjectNamed("SAW Code", array);
      Assert.assertNotNull("Did not find value SAW Code", obj);
      Assert.assertTrue(obj.has("ats.Active"));
   }

   private Artifact getSawCodeAi() {
      return ArtifactQuery.getArtifactFromTypeAndName(AtsArtifactTypes.ActionableItem, "SAW Code",
         AtsUtilCore.getAtsBranch());
   }

}

Back to the top