diff options
author | Tait,Trevor(rt0435) <rtait@amdocs.com> | 2018-11-04 16:30:21 -0500 |
---|---|---|
committer | Tait,Trevor(rt0435) <rtait@amdocs.com> | 2018-11-04 16:30:44 -0500 |
commit | 3f5ba3e09c2056a83e7376c24b7c44ac3e6d32dd (patch) | |
tree | 3d2ca1183a550085f10b817d6d98834166972b45 /src/test | |
parent | 23b36e3c69f25d8322afb79d5e6bace519db7cd3 (diff) |
Attributes for GENERIC-RESOURCE-API and VNF-API
Extract Attributes for GENERIC-RESOURCE-API and VNF-API
Issue-ID: LOG-797
Change-Id: I6ae2727bd85069fc89d65c0083167ca69b343895
Signed-off-by: Tait,Trevor(rt0435) <rtait@amdocs.com>
Diffstat (limited to 'src/test')
5 files changed, 136 insertions, 6 deletions
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ImageTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ImageTest.java new file mode 100644 index 0000000..daa3dd7 --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/ImageTest.java @@ -0,0 +1,49 @@ +package org.onap.pomba.contextbuilder.sdnc.test;
+/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * 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=====================================================
+ */
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.Image;
+
+public class ImageTest {
+ @Test
+ public void testImageWithParameters() {
+ Image image = new Image("imageName");
+ assertEquals("imageName", image.getImageName());
+ }
+
+ @Test
+ public void testImage() {
+ Image image = new Image();
+ image.setImageName("imageName");
+ assertEquals("imageName", image.getImageName());
+ String imageString = image.toString();
+ assertTrue(imageString.contains("imageName"));
+ }
+
+ @Test
+ public void testImageIsEqual() {
+ Image image1 = new Image("imageName");
+ assertTrue(image1.equals(image1));
+ assertTrue(image1.hashCode() == -878349659);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/PserverTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/PserverTest.java new file mode 100644 index 0000000..4212334 --- /dev/null +++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/PserverTest.java @@ -0,0 +1,50 @@ +/*
+ * ============LICENSE_START===================================================
+ * Copyright (c) 2018 Amdocs
+ * ============================================================================
+ * 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.pomba.contextbuilder.sdnc.test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.Pserver;
+
+public class PserverTest {
+ @Test
+ public void testPserverWithParameters() {
+ Pserver pserver = new Pserver("hostname");
+ assertEquals("hostname", pserver.getHostname());
+ }
+
+ @Test
+ public void testPserver() {
+ Pserver pserver = new Pserver();
+ pserver.setHostname("hostname");
+ assertEquals("hostname", pserver.getHostname());
+ String pserverString = pserver.toString();
+ assertTrue(pserverString.contains("hostname"));
+ }
+
+ @Test
+ public void testPserverIsEqual() {
+ Pserver pserver1 = new Pserver("hostname");
+ assertTrue(pserver1.equals(pserver1));
+ assertTrue(pserver1.hashCode() == -299803566);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfTopologyIdentifierTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfTopologyIdentifierTest.java index a4a36f3..a311286 100644 --- a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfTopologyIdentifierTest.java +++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfTopologyIdentifierTest.java @@ -22,6 +22,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue;
import org.junit.Test;
+import org.onap.pomba.contextbuilder.sdnc.model.Image;
+import org.onap.pomba.contextbuilder.sdnc.model.Pserver;
import org.onap.pomba.contextbuilder.sdnc.model.VnfTopologyIdentifier;
public class VnfTopologyIdentifierTest {
@@ -31,12 +33,21 @@ public class VnfTopologyIdentifierTest { "serviceType",
"vnfName",
"genericVnfName",
- "vnfType");
+ "vnfType",
+ "inMaint",
+ "provStatus",
+ new Pserver(),
+ new Image());
assertEquals("genericVnfType", vnfTopologyIdentifier.getGenericVnfType());
assertEquals("serviceType", vnfTopologyIdentifier.getServiceType());
assertEquals("vnfName", vnfTopologyIdentifier.getVnfName());
assertEquals("genericVnfName", vnfTopologyIdentifier.getGenericVnfName());
assertEquals("vnfType", vnfTopologyIdentifier.getVnfType());
+ assertEquals("inMaint", vnfTopologyIdentifier.getInMaint());
+ assertEquals("provStatus", vnfTopologyIdentifier.getProvStatus());
+ assertEquals(new Pserver(), vnfTopologyIdentifier.getPserver());
+ assertEquals(new Image(), vnfTopologyIdentifier.getImage());
+
}
@Test
@@ -47,15 +58,23 @@ public class VnfTopologyIdentifierTest { vnfTopologyIdentifier.setVnfName("vnfName");
vnfTopologyIdentifier.setGenericVnfName("genericVnfName");
vnfTopologyIdentifier.setVnfType("vnfType");
+ vnfTopologyIdentifier.setInMaint("inMaint");
+ vnfTopologyIdentifier.setProvStatus("provStatus");
+ vnfTopologyIdentifier.setPserver(new Pserver());
+ vnfTopologyIdentifier.setImage(new Image());
assertEquals("genericVnfType", vnfTopologyIdentifier.getGenericVnfType());
assertEquals("serviceType", vnfTopologyIdentifier.getServiceType());
assertEquals("vnfName", vnfTopologyIdentifier.getVnfName());
assertEquals("genericVnfName", vnfTopologyIdentifier.getGenericVnfName());
assertEquals("vnfType", vnfTopologyIdentifier.getVnfType());
+ assertEquals("inMaint", vnfTopologyIdentifier.getInMaint());
+ assertEquals("provStatus", vnfTopologyIdentifier.getProvStatus());
+ assertEquals(new Pserver(), vnfTopologyIdentifier.getPserver());
+ assertEquals(new Image(), vnfTopologyIdentifier.getImage());
String vnfTopologyIdentifierString = vnfTopologyIdentifier.toString();
assertTrue(vnfTopologyIdentifierString
.contains("[genericVnfType=genericVnfType,serviceType=serviceType,vnfName=vnfName,"
- + "genericVnfName=genericVnfName,vnfType=vnfType]"));
+ + "genericVnfName=genericVnfName,vnfType=vnfType,inMaint=inMaint,provStatus=provStatus]"));
}
@Test
@@ -64,9 +83,13 @@ public class VnfTopologyIdentifierTest { "serviceType1",
"vnfName1",
"genericVnfName1",
- "vnfType1");
+ "vnfType1",
+ "inMaint",
+ "provStatus",
+ new Pserver(),
+ new Image());
assertTrue(vnfTopologyIdentifier1.equals(vnfTopologyIdentifier1));
- assertTrue(vnfTopologyIdentifier1.hashCode() == 1705030683);
+ assertTrue(vnfTopologyIdentifier1.hashCode() == -1409805056);
}
}
diff --git a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfTopologyInformationTest.java b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfTopologyInformationTest.java index f33d5c4..340e11c 100644 --- a/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfTopologyInformationTest.java +++ b/src/test/java/org/onap/pomba/contextbuilder/sdnc/test/VnfTopologyInformationTest.java @@ -56,7 +56,7 @@ public class VnfTopologyInformationTest { new VnfAssignments(),
new ArrayList<VnfParameter>());
assertTrue(vnfTopologyInformation1.equals(vnfTopologyInformation1));
- assertTrue(vnfTopologyInformation1.hashCode() == 917116897);
+ assertTrue(vnfTopologyInformation1.hashCode() == -1767338143);
}
}
diff --git a/src/test/resources/junit/vnfApiResponse.json b/src/test/resources/junit/vnfApiResponse.json index e3828a0..e1e4e51 100644 --- a/src/test/resources/junit/vnfApiResponse.json +++ b/src/test/resources/junit/vnfApiResponse.json @@ -147,7 +147,15 @@ "vnf-type": "VshakenIst09042018..base_alb..module-3",
"generic-vnf-name": "zdyh3bsflb0001v_01",
"generic-vnf-type": "vShaken_DNS_ns592n/vSHAKEN_IST_09042018 0",
- "vnf-name": "zdyh3bsflb0001v_base_module_01"
+ "vnf-name": "zdyh3bsflb0001v_base_module_01",
+ "inMaint":"no",
+ "pserver":{
+ "hostname": "somerandomserver.ottawa.com"
+ },
+ "image":{
+ "image-name": "cfad8f38-3d4c-4aec-8bd4-f83ad605acbe"
+ },
+ "prov-status": "Available"
}
},
"service-information": {
|