summaryrefslogtreecommitdiffstats
path: root/appc-dg/appc-dg-shared
diff options
context:
space:
mode:
Diffstat (limited to 'appc-dg/appc-dg-shared')
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/objects/TestAAIQueryResult.java84
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/objects/TestRelationship.java112
2 files changed, 196 insertions, 0 deletions
diff --git a/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/objects/TestAAIQueryResult.java b/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/objects/TestAAIQueryResult.java
new file mode 100644
index 000000000..b88a878f8
--- /dev/null
+++ b/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/objects/TestAAIQueryResult.java
@@ -0,0 +1,84 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : APPC
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+* ============LICENSE_END=========================================================
+*/
+package org.onap.appc.dg.aai.objects;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestAAIQueryResult {
+ private AAIQueryResult aaiQueryResult;
+ private Map<String,String> additionProperties;
+
+
+ @Before
+ public void setUp() {
+ aaiQueryResult=new AAIQueryResult();
+ additionProperties = new HashMap<>();
+ }
+
+ @Test
+ public void testGetRelationshipList() {
+ Assert.assertTrue(aaiQueryResult. getRelationshipList().isEmpty());
+ }
+
+ @Test
+ public void testGetRelationshipList_With_Data() {
+ Relationship r1=new Relationship();
+ r1.setRelatedLink("relatedLink");
+ r1.setRelatedTo("relatedTo");
+ r1.getRelatedProperties().put("1", "A");
+ r1.getRelationShipDataMap().put("B", "b");
+ aaiQueryResult.getRelationshipList().add(r1);
+ Assert.assertEquals(1,aaiQueryResult.getRelationshipList().size());
+ }
+
+ @Test
+ public void testGetAdditionProperties_IsEmpty() {
+ Assert.assertTrue(aaiQueryResult. getAdditionProperties().isEmpty());
+ }
+
+ @Test
+ public void testGetAdditionProperties_With_Data() {
+ additionProperties.put("1", "A");
+ Assert.assertTrue(additionProperties.containsKey("1"));
+ }
+
+ @Test
+ public void testGetAdditionProperties_WithValidKey() {
+ additionProperties.put("2", "B");
+ Assert.assertEquals("B",additionProperties.get("2"));
+ }
+
+ @Test
+ public void testGetAdditionProperties_WithInValidKey() {
+ Assert.assertEquals(null,additionProperties.get("3"));
+ }
+
+ @Test
+ public void testGetAdditionProperties_Size() {
+ additionProperties.put("3", "C");
+ additionProperties.put("4", "D");
+ Assert.assertEquals(2, additionProperties.size());
+ }
+}
diff --git a/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/objects/TestRelationship.java b/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/objects/TestRelationship.java
new file mode 100644
index 000000000..f0b832a1f
--- /dev/null
+++ b/appc-dg/appc-dg-shared/appc-dg-aai/src/test/java/org/onap/appc/dg/aai/objects/TestRelationship.java
@@ -0,0 +1,112 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : APPC
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+* ============LICENSE_END=========================================================
+*/
+package org.onap.appc.dg.aai.objects;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestRelationship {
+ private Relationship relationship;
+ private Map<String,String> relationShipDataMap;
+ private Map<String,String> relatedProperties;
+
+ @Before
+ public void setUp() {
+ relationship=new Relationship();
+ relationShipDataMap = new HashMap<>();
+ relatedProperties = new HashMap<>();
+ }
+
+ @Test
+ public void testGetRelatedTo() {
+ relationship.setRelatedTo("relatedTo");
+ Assert.assertNotNull(relationship.getRelatedTo());
+ Assert.assertEquals("relatedTo",relationship.getRelatedTo());
+ }
+
+ @Test
+ public void testGetRelatedLink() {
+ relationship.setRelatedLink("relatedLink");
+ Assert.assertNotNull(relationship.getRelatedLink());
+ Assert.assertEquals("relatedLink",relationship.getRelatedLink());
+ }
+
+ @Test
+ public void testgetRelationShipDataMap_IsEmpty() {
+ Assert.assertTrue(relationship.getRelationShipDataMap().isEmpty());
+ }
+
+ @Test
+ public void testGetRelationShipDataMap_With_Data() {
+ relationShipDataMap.put("1", "A");
+ Assert.assertTrue(relationShipDataMap.containsKey("1"));
+ }
+
+ @Test
+ public void testGetRelationShipDataMap_WithValidKey() {
+ relationShipDataMap.put("2", "B");
+ Assert.assertEquals("B",relationShipDataMap.get("2"));
+ }
+
+ @Test
+ public void testgetRelationShipDataMap_WithInValidKey() {
+ Assert.assertEquals(null,relationShipDataMap.get("3"));
+ }
+
+ @Test
+ public void testGetRelationShipDataMap_Size() {
+ relationShipDataMap.put("3", "C");
+ relationShipDataMap.put("4", "D");
+ Assert.assertEquals(2, relationShipDataMap.size());
+ }
+
+ @Test
+ public void testGetRelatedProperties_IsEmpty() {
+ Assert.assertTrue(relationship.getRelatedProperties().isEmpty());
+ }
+
+ @Test
+ public void testGetRelatedProperties_With_Data() {
+ relatedProperties.put("1", "A");
+ Assert.assertTrue(relatedProperties.containsKey("1"));
+ }
+
+ @Test
+ public void testGetRelatedProperties_WithValidKey() {
+ relatedProperties.put("2", "B");
+ Assert.assertEquals("B",relatedProperties.get("2"));
+ }
+
+ @Test
+ public void testGetRelatedProperties_WithInValidKey() {
+ Assert.assertEquals(null,relatedProperties.get("3"));
+ }
+
+ @Test
+ public void testGetRelatedProperties_Size() {
+ relatedProperties.put("3", "C");
+ relatedProperties.put("4", "D");
+ Assert.assertEquals(2, relatedProperties.size());
+ }
+}