summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Zi <li.zi30@zte.com.cn>2018-03-02 08:24:17 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-02 08:24:17 +0000
commit36f3f5388cdc979f9bcb6d07e31ef817d85fdda1 (patch)
tree7a70bbd290d0ce44352de3890becb70368aa7922
parentcb6a81d520e2a7176baaff46f71d24c6edaeb1d2 (diff)
parent59a95d6dfa955aa13dade154233431550e48d1ac (diff)
Merge "Add unit test for the newly entity classes."
-rw-r--r--esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/ComplexListTest.java36
-rw-r--r--esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/ComplexTest.java37
-rw-r--r--esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/RelationshipDataTest.java37
-rw-r--r--esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/RelationshipTest.java51
4 files changed, 161 insertions, 0 deletions
diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/ComplexListTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/ComplexListTest.java
new file mode 100644
index 0000000..44d907d
--- /dev/null
+++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/ComplexListTest.java
@@ -0,0 +1,36 @@
+/**
+ * Copyright 2018 ZTE Corporation.
+ *
+ * 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.
+ */
+package org.onap.aai.esr.entity.aai;
+
+import static org.junit.Assert.assertEquals;
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Test;
+
+public class ComplexListTest {
+
+ @Test
+ public void getterAndSetter4complex() {
+ ComplexList complexlist = new ComplexList();
+ List<Complex> complexes = new ArrayList<>();
+ Complex complex = new Complex();
+ complex.setComplexName("test");
+ complex.setPhysicalLocationId("123");
+ complexes.add(complex);
+ complexlist.setComplex(complexes);
+ assertEquals(complexlist.getComplex(), complexes);
+ }
+}
diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/ComplexTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/ComplexTest.java
new file mode 100644
index 0000000..9cb543d
--- /dev/null
+++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/ComplexTest.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright 2018 ZTE Corporation.
+ *
+ * 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.
+ */
+package org.onap.aai.esr.entity.aai;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+public class ComplexTest {
+ @Test
+ public void getterAndSetter4physicalLocationId() {
+ final String physicalLocationId = "123";
+ Complex complex = new Complex();
+ complex.setPhysicalLocationId(physicalLocationId);
+ assertEquals(complex.getPhysicalLocationId(), physicalLocationId);
+ }
+
+ @Test
+ public void getterAndSetter4complexName() {
+ final String complexName = "complex-test";
+ Complex complex = new Complex();
+ complex.setComplexName(complexName);
+ assertEquals(complex.getComplexName(), complexName);
+ }
+}
diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/RelationshipDataTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/RelationshipDataTest.java
new file mode 100644
index 0000000..fad6610
--- /dev/null
+++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/RelationshipDataTest.java
@@ -0,0 +1,37 @@
+/**
+ * Copyright 2018 ZTE Corporation.
+ *
+ * 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.
+ */
+package org.onap.aai.esr.entity.aai;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+public class RelationshipDataTest {
+ @Test
+ public void getterAndSetter4relationshipKey() {
+ final String relationshipKey = "relationship-key";
+ RelationshipData relationshipData = new RelationshipData();
+ relationshipData.setRelationshipKey(relationshipKey);
+ assertEquals(relationshipData.getRelationshipKey(), relationshipKey);
+ }
+
+ @Test
+ public void getterAndSetter4relationshipValue() {
+ final String relationshipValue = "123";
+ RelationshipData relationshipData = new RelationshipData();
+ relationshipData.setRelationshipValue(relationshipValue);
+ assertEquals(relationshipData.getRelationshipValue(), relationshipValue);
+ }
+}
diff --git a/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/RelationshipTest.java b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/RelationshipTest.java
new file mode 100644
index 0000000..f691b36
--- /dev/null
+++ b/esr-mgr/src/test/java/org/onap/aai/esr/entity/aai/RelationshipTest.java
@@ -0,0 +1,51 @@
+/**
+ * Copyright 2018 ZTE Corporation.
+ *
+ * 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.
+ */
+package org.onap.aai.esr.entity.aai;
+
+import static org.junit.Assert.assertEquals;
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Test;
+
+public class RelationshipTest {
+ @Test
+ public void getterAndSetter4relatedTo() {
+ final String relatedTo = "relationship-key";
+ Relationship relationship = new Relationship();
+ relationship.setRelatedTo(relatedTo);
+ assertEquals(relationship.getRelatedTo(), relatedTo);
+ }
+
+ @Test
+ public void getterAndSetter4relatedLink() {
+ final String relatedLink = "123";
+ Relationship relationship = new Relationship();
+ relationship.setRelatedLink(relatedLink);
+ assertEquals(relationship.getRelatedLink(), relatedLink);
+ }
+
+ @Test
+ public void getterAndSetter4relationshipData() {
+ Relationship relationship = new Relationship();
+ List<RelationshipData> relationshipDatas = new ArrayList<>();
+ RelationshipData relationshipData = new RelationshipData();
+ relationshipData.setRelationshipKey("relationship-key");
+ relationshipData.setRelationshipValue("123");
+ relationshipDatas.add(relationshipData);
+ relationship.setRelationshipData(relationshipDatas);
+ assertEquals(relationship.getRelationshipData(), relationshipDatas);
+ }
+}