diff options
author | Tait,Trevor(rt0435) <rtait@amdocs.com> | 2018-08-28 15:59:03 -0400 |
---|---|---|
committer | Tait,Trevor(rt0435) <rtait@amdocs.com> | 2018-08-28 15:59:39 -0400 |
commit | 54dec15de7897cc737c2daa5c8f904483215ef2e (patch) | |
tree | c650537a4bb00d1c7c357ba3a2df0d4097b71912 /src/test/java/org/onap | |
parent | d26f38d193e2cee5b502c7418f282dc69a029a3c (diff) |
Adding Network and VM
Issue-ID: LOG-614
Change-Id: I00b2f38ed0db1e1d8886732c1bbfd775704b60a4
Signed-off-by: Tait,Trevor(rt0435) <rtait@amdocs.com>
Diffstat (limited to 'src/test/java/org/onap')
9 files changed, 183 insertions, 38 deletions
diff --git a/src/test/java/org/onap/pomba/common/datatypes/AttributeTests.java b/src/test/java/org/onap/pomba/common/datatypes/AttributeTests.java index 2eb6a72..261b8a2 100644 --- a/src/test/java/org/onap/pomba/common/datatypes/AttributeTests.java +++ b/src/test/java/org/onap/pomba/common/datatypes/AttributeTests.java @@ -21,17 +21,17 @@ package org.onap.pomba.common.datatypes; import static org.junit.Assert.assertTrue;
import org.junit.Test;
-import org.onap.pomba.common.datatypes.Attribute.Value;
+import org.onap.pomba.common.datatypes.Attribute.Name;
import org.onap.pomba.common.datatypes.DataQuality.Status;
public class AttributeTests {
@Test
public void testAttribute() {
Attribute attribute = new Attribute();
- attribute.setName("Attribute");
- attribute.setValue(Value.adminState);
- assertTrue("Attribute name doesn't match", attribute.getName().equals("Attribute"));
- assertTrue("Attribute value doesn't match", attribute.getValue().equals(Value.adminState));
+ attribute.setName(Name.hostName);
+ attribute.setValue("Attribute");
+ assertTrue("Attribute name doesn't match", attribute.getName().equals(Name.hostName));
+ assertTrue("Attribute value doesn't match", attribute.getValue().equals("Attribute"));
DataQuality dataQuality = new DataQuality();
dataQuality.setStatus(Status.error);
dataQuality.setErrorText("Test");
diff --git a/src/test/java/org/onap/pomba/common/datatypes/DataQualityTests.java b/src/test/java/org/onap/pomba/common/datatypes/DataQualityTests.java index 3a71cd8..df0e808 100644 --- a/src/test/java/org/onap/pomba/common/datatypes/DataQualityTests.java +++ b/src/test/java/org/onap/pomba/common/datatypes/DataQualityTests.java @@ -18,6 +18,8 @@ package org.onap.pomba.common.datatypes;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
@@ -34,4 +36,16 @@ public class DataQualityTests { assertTrue("DataQuality status doesn't match", dataQuality.getStatus().equals(Status.error));
assertTrue("DataQuality error text doesn't match", dataQuality.getErrorText().equals("Test"));
}
+
+ @Test
+ public void dataQualityHelpers() {
+ DataQuality dataQuality = DataQuality.ok();
+ assertEquals(DataQuality.Status.ok, dataQuality.getStatus());
+ assertNull(dataQuality.getErrorText());
+
+ dataQuality = DataQuality.error("test");
+ assertEquals(DataQuality.Status.error, dataQuality.getStatus());
+ assertEquals("test", dataQuality.getErrorText());
+ assertTrue(dataQuality.toString().contains("test"));
+ }
}
diff --git a/src/test/java/org/onap/pomba/common/datatypes/ModelContextTests.java b/src/test/java/org/onap/pomba/common/datatypes/ModelContextTests.java index 85dbfc7..ee04a08 100644 --- a/src/test/java/org/onap/pomba/common/datatypes/ModelContextTests.java +++ b/src/test/java/org/onap/pomba/common/datatypes/ModelContextTests.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.List;
import org.junit.Test;
+import org.onap.pomba.common.datatypes.Attribute.Name;
import org.onap.pomba.common.datatypes.DataQuality.Status;
public class ModelContextTests {
@@ -38,12 +39,12 @@ public class ModelContextTests { assertTrue("ModelContext data quality status doesn't match", modelContext.getDataQuality().getStatus().equals(Status.error));
assertTrue("ModelContext data quality error text doesn't match", modelContext.getDataQuality().getErrorText().equals("Test"));
Attribute attribute = new Attribute();
- attribute.setName("Attribute");
+ attribute.setName(Name.hostName);
modelContext.addAttribute(attribute);
- assertTrue("ModelContext attribute name doesn't match", modelContext.getAttribute().get(0).getName().equals("Attribute"));
- List<Attribute> attributeList = modelContext.getAttribute();
- modelContext.setAttribute(attributeList);
- assertEquals(modelContext.getAttribute().size(), 1);
+ assertTrue("ModelContext attribute name doesn't match", modelContext.getAttributes().get(0).getName().equals(Name.hostName));
+ List<Attribute> attributeList = modelContext.getAttributes();
+ modelContext.setAttributes(attributeList);
+ assertEquals(modelContext.getAttributes().size(), 1);
}
@Test
@@ -63,8 +64,8 @@ public class ModelContextTests { VF aVF = new VF();
aVF.setName("VF name");
vfList.add(aVF);
- modelContext.setVf(vfList);
- assertEquals(modelContext.getVf().size(), 1);
+ modelContext.setVfs(vfList);
+ assertEquals(modelContext.getVfs().size(), 1);
}
@Test
@@ -73,8 +74,8 @@ public class ModelContextTests { VF aVF = new VF();
aVF.setName("VF name");
modelContext.addVf(aVF);
- assertEquals(modelContext.getVf().size(), 1);
- assertTrue("ModelContext VF name doesn't match", modelContext.getVf().get(0).getName().equals("VF name"));
+ assertEquals(modelContext.getVfs().size(), 1);
+ assertTrue("ModelContext VF name doesn't match", modelContext.getVfs().get(0).getName().equals("VF name"));
}
}
diff --git a/src/test/java/org/onap/pomba/common/datatypes/NetworkTests.java b/src/test/java/org/onap/pomba/common/datatypes/NetworkTests.java new file mode 100644 index 0000000..747bc7c --- /dev/null +++ b/src/test/java/org/onap/pomba/common/datatypes/NetworkTests.java @@ -0,0 +1,55 @@ +/*
+ * ============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.common.datatypes;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import java.util.List;
+import org.junit.Test;
+import org.onap.pomba.common.datatypes.Attribute.Name;
+import org.onap.pomba.common.datatypes.DataQuality.Status;
+
+public class NetworkTests {
+ @Test
+ public void testNetwork() {
+ Network aNetwork = new Network();
+ aNetwork.setName("Network name");
+ aNetwork.setInvariantUuid("Invariant Uuid");
+ aNetwork.setUuid("Uuid");
+ aNetwork.setNfcNamingCode("NFC Naming Code");
+ DataQuality dataQuality = new DataQuality();
+ dataQuality.setStatus(Status.error);
+ dataQuality.setErrorText("Test");
+ aNetwork.setDataQuality(dataQuality);
+ Attribute attribute = new Attribute();
+ attribute.setName(Name.hostName);
+ aNetwork.addAttribute(attribute);
+ assertTrue("Network name doesn't match", aNetwork.getName().equals("Network name"));
+ assertTrue("Network invariant uuid doesn't match", aNetwork.getInvariantUuid().equals("Invariant Uuid"));
+ assertTrue("Network NFC Naming Code doesn't match", aNetwork.getNfcNamingCode().equals("NFC Naming Code"));
+ assertTrue("Network uuid doesn't match", aNetwork.getUuid().equals("Uuid"));
+ assertTrue("Network data quality status doesn't match", aNetwork.getDataQuality().getStatus().equals(Status.error));
+ assertTrue("Network data quality error text doesn't match", aNetwork.getDataQuality().getErrorText().equals("Test"));
+ assertTrue("Network attribute name doesn't match", aNetwork.getAttributes().get(0).getName().equals(Name.hostName));
+ List<Attribute> attributeList = aNetwork.getAttributes();
+ aNetwork.setAttributes(attributeList);
+ assertEquals(aNetwork.getAttributes().size(), 1);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/common/datatypes/ServiceTests.java b/src/test/java/org/onap/pomba/common/datatypes/ServiceTests.java index a4ebc74..10f9339 100644 --- a/src/test/java/org/onap/pomba/common/datatypes/ServiceTests.java +++ b/src/test/java/org/onap/pomba/common/datatypes/ServiceTests.java @@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue;
import java.util.List;
import org.junit.Test;
+import org.onap.pomba.common.datatypes.Attribute.Name;
import org.onap.pomba.common.datatypes.DataQuality.Status;
public class ServiceTests {
@@ -36,16 +37,16 @@ public class ServiceTests { dataQuality.setErrorText("Test");
aService.setDataQuality(dataQuality);
Attribute attribute = new Attribute();
- attribute.setName("Attribute");
+ attribute.setName(Name.hostName);
aService.addAttribute(attribute);
assertTrue("Service Name doesn't match", aService.getName().equals("new service"));
assertTrue("Invariant Uuid doesn't match", aService.getInvariantUuid().equals("Invariant Uuid"));
assertTrue("Uuid doesn't match", aService.getUuid().equals("Uuid"));
assertTrue("Service data quality status doesn't match", aService.getDataQuality().getStatus().equals(Status.error));
assertTrue("Service data quality error text doesn't match", aService.getDataQuality().getErrorText().equals("Test"));
- assertTrue("Service attribute name doesn't match", aService.getAttribute().get(0).getName().equals("Attribute"));
- List<Attribute> attributeList = aService.getAttribute();
- aService.setAttribute(attributeList);
- assertEquals(aService.getAttribute().size(), 1);
+ assertTrue("Service attribute name doesn't match", aService.getAttributes().get(0).getName().equals(Name.hostName));
+ List<Attribute> attributeList = aService.getAttributes();
+ aService.setAttributes(attributeList);
+ assertEquals(aService.getAttributes().size(), 1);
}
}
diff --git a/src/test/java/org/onap/pomba/common/datatypes/VMTests.java b/src/test/java/org/onap/pomba/common/datatypes/VMTests.java new file mode 100644 index 0000000..0d74c00 --- /dev/null +++ b/src/test/java/org/onap/pomba/common/datatypes/VMTests.java @@ -0,0 +1,55 @@ +/*
+ * ============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.common.datatypes;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import java.util.List;
+import org.junit.Test;
+import org.onap.pomba.common.datatypes.Attribute.Name;
+import org.onap.pomba.common.datatypes.DataQuality.Status;
+
+public class VMTests {
+ @Test
+ public void testVM() {
+ VM aVM = new VM();
+ aVM.setName("VM name");
+ aVM.setInvariantUuid("Invariant Uuid");
+ aVM.setUuid("Uuid");
+ aVM.setNfcNamingCode("NFC Naming Code");
+ DataQuality dataQuality = new DataQuality();
+ dataQuality.setStatus(Status.error);
+ dataQuality.setErrorText("Test");
+ aVM.setDataQuality(dataQuality);
+ Attribute attribute = new Attribute();
+ attribute.setName(Name.hostName);
+ aVM.addAttribute(attribute);
+ assertTrue("VM name doesn't match", aVM.getName().equals("VM name"));
+ assertTrue("VM invariant uuid doesn't match", aVM.getInvariantUuid().equals("Invariant Uuid"));
+ assertTrue("VM NFC Naming Code doesn't match", aVM.getNfcNamingCode().equals("NFC Naming Code"));
+ assertTrue("VM uuid doesn't match", aVM.getUuid().equals("Uuid"));
+ assertTrue("VM data quality status doesn't match", aVM.getDataQuality().getStatus().equals(Status.error));
+ assertTrue("VM data quality error text doesn't match", aVM.getDataQuality().getErrorText().equals("Test"));
+ assertTrue("VM attribute name doesn't match", aVM.getAttributes().get(0).getName().equals(Name.hostName));
+ List<Attribute> attributeList = aVM.getAttributes();
+ aVM.setAttributes(attributeList);
+ assertEquals(aVM.getAttributes().size(), 1);
+ }
+
+}
diff --git a/src/test/java/org/onap/pomba/common/datatypes/VfModuleTests.java b/src/test/java/org/onap/pomba/common/datatypes/VfModuleTests.java index 3bb577c..3d46510 100644 --- a/src/test/java/org/onap/pomba/common/datatypes/VfModuleTests.java +++ b/src/test/java/org/onap/pomba/common/datatypes/VfModuleTests.java @@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue;
import java.util.List;
import org.junit.Test;
+import org.onap.pomba.common.datatypes.Attribute.Name;
import org.onap.pomba.common.datatypes.DataQuality.Status;
public class VfModuleTests {
@@ -39,7 +40,7 @@ public class VfModuleTests { dataQuality.setErrorText("Test");
aVFModule.setDataQuality(dataQuality);
Attribute attribute = new Attribute();
- attribute.setName("Attribute");
+ attribute.setName(Name.hostName);
aVFModule.addAttribute(attribute);
assertTrue("VFModule Name doesn't match", aVFModule.getName().equals("Name"));
assertTrue("VFModule Invariant Uuid doesn't match", aVFModule.getInvariantUuid().equals("Invariant Uuid"));
@@ -49,9 +50,25 @@ public class VfModuleTests { assertEquals(aVFModule.getMinInstances(), 1);
assertTrue("VFModule data quality status doesn't match", aVFModule.getDataQuality().getStatus().equals(Status.error));
assertTrue("VFModule data quality error text doesn't match", aVFModule.getDataQuality().getErrorText().equals("Test"));
- assertTrue("VFModule attribute name doesn't match", aVFModule.getAttribute().get(0).getName().equals("Attribute"));
- List<Attribute> attributeList = aVFModule.getAttribute();
- aVFModule.setAttribute(attributeList);
- assertEquals(aVFModule.getAttribute().size(), 1);
+ assertTrue("VFModule attribute name doesn't match", aVFModule.getAttributes().get(0).getName().equals(Name.hostName));
+ List<Attribute> attributeList = aVFModule.getAttributes();
+ aVFModule.setAttributes(attributeList);
+ assertEquals(aVFModule.getAttributes().size(), 1);
+ VM vm = new VM();
+ vm.setName("VM");
+ aVFModule.addVm(vm);
+ assertTrue("VFModule vm name doesn't match", aVFModule.getVms().get(0).getName().equals("VM"));
+ List<VM> vmList = aVFModule.getVms();
+ aVFModule.setVms(vmList);
+ assertEquals(aVFModule.getVms().size(), 1);
+ Network network = new Network();
+ network.setName("Network");
+ aVFModule.addNetwork(network);
+ assertTrue("VFModule network name doesn't match", aVFModule.getNetworks().get(0).getName().equals("Network"));
+ List<Network> networkList = aVFModule.getNetworks();
+ aVFModule.setNetworks(networkList);
+ assertEquals(aVFModule.getNetworks().size(), 1);
+
+
}
}
diff --git a/src/test/java/org/onap/pomba/common/datatypes/VfTests.java b/src/test/java/org/onap/pomba/common/datatypes/VfTests.java index 9c17589..464758e 100644 --- a/src/test/java/org/onap/pomba/common/datatypes/VfTests.java +++ b/src/test/java/org/onap/pomba/common/datatypes/VfTests.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.List;
import org.junit.Test;
+import org.onap.pomba.common.datatypes.Attribute.Name;
import org.onap.pomba.common.datatypes.DataQuality.Status;
public class VfTests {
@@ -41,7 +42,7 @@ public class VfTests { dataQuality.setErrorText("Test");
aVF.setDataQuality(dataQuality);
Attribute attribute = new Attribute();
- attribute.setName("Attribute");
+ attribute.setName(Name.hostName);
aVF.addAttribute(attribute);
assertTrue("VF name doesn't match", aVF.getName().equals("VF name"));
assertTrue("VF Type doesn't match", aVF.getType().equals("Type"));
@@ -50,10 +51,10 @@ public class VfTests { assertTrue("VF NF Naming Code doesn't match", aVF.getNfNamingCode().equals("NF Naming Code"));
assertTrue("VF data quality status doesn't match", aVF.getDataQuality().getStatus().equals(Status.error));
assertTrue("VF data quality error text doesn't match", aVF.getDataQuality().getErrorText().equals("Test"));
- assertTrue("VF attribute name doesn't match", aVF.getAttribute().get(0).getName().equals("Attribute"));
- List<Attribute> attributeList = aVF.getAttribute();
- aVF.setAttribute(attributeList);
- assertEquals(aVF.getAttribute().size(), 1);
+ assertTrue("VF attribute name doesn't match", aVF.getAttributes().get(0).getName().equals(Name.hostName));
+ List<Attribute> attributeList = aVF.getAttributes();
+ aVF.setAttributes(attributeList);
+ assertEquals(aVF.getAttributes().size(), 1);
}
@Test
@@ -111,17 +112,17 @@ public class VfTests { VNFC aVNFC = new VNFC();
aVNFC.setName("VNFC name");
vnfcList.add(aVNFC);
- aVF.setVnfc(vnfcList);
- assertTrue("VNFC list item doesn't match", aVF.getVnfc().get(0).getName().equals("VNFC name"));
+ aVF.setVnfcs(vnfcList);
+ assertTrue("VNFC list item doesn't match", aVF.getVnfcs().get(0).getName().equals("VNFC name"));
}
@Test
public void testAddVnfc() {
VF aVF = new VF();
- assertEquals(aVF.getVnfc().size(), 0);
+ assertEquals(aVF.getVnfcs().size(), 0);
VNFC aVNFC = new VNFC();
aVNFC.setName("VNFC name");
aVF.addVnfc(aVNFC);
- assertTrue("VNFC list item doesn't match", aVF.getVnfc().get(0).getName().equals("VNFC name"));
+ assertTrue("VNFC list item doesn't match", aVF.getVnfcs().get(0).getName().equals("VNFC name"));
}
}
diff --git a/src/test/java/org/onap/pomba/common/datatypes/VnfcTests.java b/src/test/java/org/onap/pomba/common/datatypes/VnfcTests.java index ea5ccc4..38d68fe 100644 --- a/src/test/java/org/onap/pomba/common/datatypes/VnfcTests.java +++ b/src/test/java/org/onap/pomba/common/datatypes/VnfcTests.java @@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue;
import java.util.List;
import org.junit.Test;
+import org.onap.pomba.common.datatypes.Attribute.Name;
import org.onap.pomba.common.datatypes.DataQuality.Status;
public class VnfcTests {
@@ -37,7 +38,7 @@ public class VnfcTests { dataQuality.setErrorText("Test");
aVNFC.setDataQuality(dataQuality);
Attribute attribute = new Attribute();
- attribute.setName("Attribute");
+ attribute.setName(Name.hostName);
aVNFC.addAttribute(attribute);
assertTrue("VNFC name doesn't match", aVNFC.getName().equals("VNFC name"));
assertTrue("VNFC invariant uuid doesn't match", aVNFC.getInvariantUuid().equals("Invariant Uuid"));
@@ -45,9 +46,9 @@ public class VnfcTests { assertTrue("VNFC uuid doesn't match", aVNFC.getUuid().equals("Uuid"));
assertTrue("VNFC data quality status doesn't match", aVNFC.getDataQuality().getStatus().equals(Status.error));
assertTrue("VNFC data quality error text doesn't match", aVNFC.getDataQuality().getErrorText().equals("Test"));
- assertTrue("VNFC attribute name doesn't match", aVNFC.getAttribute().get(0).getName().equals("Attribute"));
- List<Attribute> attributeList = aVNFC.getAttribute();
- aVNFC.setAttribute(attributeList);
- assertEquals(aVNFC.getAttribute().size(), 1);
+ assertTrue("VNFC attribute name doesn't match", aVNFC.getAttributes().get(0).getName().equals(Name.hostName));
+ List<Attribute> attributeList = aVNFC.getAttributes();
+ aVNFC.setAttributes(attributeList);
+ assertEquals(aVNFC.getAttributes().size(), 1);
}
}
|