Skip to main content
summaryrefslogtreecommitdiffstats
blob: 3999bfbe75e2de76ebf33ba15faf247ee608481d (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
71
72
/*******************************************************************************
 * 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 com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import org.eclipse.osee.ats.client.demo.DemoTeam;
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;

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

   @Test
   public void testAtsTeamsRestCall() throws Exception {
      JsonArray array = getAndCheck("/ats/team");
      Assert.assertEquals(18, array.size());
      JsonObject obj = getObjectNamed("SAW SW", array);
      Assert.assertNotNull(String.format("Did not find value SAW SW in JsonArray [%s]", array), obj);
      Assert.assertFalse(obj.has("version"));
      Assert.assertFalse(obj.has("ats.Active"));
   }

   @Test
   public void testAtsTeamsDetailsRestCall() throws Exception {
      JsonArray array = getAndCheck("/ats/team/details");
      Assert.assertEquals(18, array.size());
      JsonObject obj = getObjectNamed("SAW SW", array);
      Assert.assertNotNull(String.format("Did not find value SAW SW in JsonArray [%s]", array), obj);
      Assert.assertEquals(3, obj.getAsJsonArray("version").size());
      Assert.assertTrue(obj.has("ats.Active"));
   }

   @Test
   public void testAtsTeamRestCall() throws Exception {
      JsonArray array = getAndCheck("/ats/team/" + getSawSwTeamDef().getArtId());
      Assert.assertEquals(1, array.size());
      JsonObject obj = getObjectNamed("SAW SW", array);
      Assert.assertNotNull(String.format("Did not find value SAW SW in JsonArray [%s]", array), obj);
      Assert.assertFalse(obj.has("version"));
      Assert.assertFalse(obj.has("ats.Active"));
   }

   @Test
   public void testAtsTeamDetailsRestCall() throws Exception {
      JsonArray array = getAndCheck("/ats/team/" + getSawSwTeamDef().getArtId() + "/details");
      Assert.assertEquals(1, array.size());
      JsonObject obj = getObjectNamed("SAW SW", array);
      Assert.assertNotNull(String.format("Did not find value SAW SW in JsonArray [%s]", array), obj);
      Assert.assertTrue(obj.has("version"));
      Assert.assertTrue(obj.has("ats.Active"));
   }

   private Artifact getSawSwTeamDef() {
      return ArtifactQuery.getArtifactFromToken(DemoTeam.SAW_SW.getTeamDefToken(), AtsUtilCore.getAtsBranch());
   }
}

Back to the top