diff options
Diffstat (limited to 'src/test')
13 files changed, 440 insertions, 156 deletions
diff --git a/src/test/java/org/onap/pomba/common/datatypes/LInterfaceTests.java b/src/test/java/org/onap/pomba/common/datatypes/LInterfaceTests.java new file mode 100644 index 0000000..6b277a6 --- /dev/null +++ b/src/test/java/org/onap/pomba/common/datatypes/LInterfaceTests.java @@ -0,0 +1,51 @@ +/* + * ============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 org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class LInterfaceTests { + + @Test + public void testLInterface() { + LInterface aLinterface = new LInterface(); + aLinterface.setName("LInterface name"); + aLinterface.setUuid("Uuid"); + Port aPort = new Port(); + aPort.setName("port name"); + aLinterface.setPort(aPort); + DataQuality dataQuality = new DataQuality(); + dataQuality.setStatus(DataQuality.Status.error); + dataQuality.setErrorText("Test"); + aLinterface.setDataQuality(dataQuality); + Attribute attribute = new Attribute(); + attribute.setName(Attribute.Name.hostName); + aLinterface.addAttribute(attribute); + assertTrue("LInterface name doesn't match", aLinterface.getName().equals("LInterface name")); + assertTrue("LInterface uuid doesn't match", aLinterface.getUuid().equals("Uuid")); + assertTrue("LInterface port name doesn't match", aLinterface.getPort().getName().equals("port name")); + assertTrue("LInterface data quality status doesn't match", aLinterface.getDataQuality().getStatus().equals(DataQuality.Status.error)); + assertTrue("LInterface data quality error text doesn't match", aLinterface.getDataQuality().getErrorText().equals("Test")); + assertTrue("LInterface attribute name doesn't match", aLinterface.getAttributes().get(0).getName().equals(Attribute.Name.hostName)); + assertEquals(aLinterface.getAttributes().size(), 1); + } +} + diff --git a/src/test/java/org/onap/pomba/common/datatypes/LogicalLinkTests.java b/src/test/java/org/onap/pomba/common/datatypes/LogicalLinkTests.java new file mode 100644 index 0000000..d851a17 --- /dev/null +++ b/src/test/java/org/onap/pomba/common/datatypes/LogicalLinkTests.java @@ -0,0 +1,49 @@ +/* + * ============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 org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class LogicalLinkTests { + + @Test + public void testLogicalLink() { + LogicalLink aLogicalLink = new LogicalLink(); + aLogicalLink.setName("LogicalLink name"); + aLogicalLink.setUuid("Uuid"); + DataQuality dataQuality = new DataQuality(); + dataQuality.setStatus(DataQuality.Status.error); + dataQuality.setErrorText("Test"); + aLogicalLink.setDataQuality(dataQuality); + Attribute attribute = new Attribute(); + attribute.setName(Attribute.Name.hostName); + aLogicalLink.addAttribute(attribute); + assertTrue("LogicalLink name doesn't match", aLogicalLink.getName().equals("LogicalLink name")); + assertTrue("LogicalLink uuid doesn't match", aLogicalLink.getUuid().equals("Uuid")); + assertTrue("LogicalLink data quality status doesn't match", aLogicalLink.getDataQuality().getStatus().equals(DataQuality.Status.error)); + assertTrue("LogicalLink data quality error text doesn't match", aLogicalLink.getDataQuality().getErrorText().equals("Test")); + assertTrue("LogicalLink attribute name doesn't match", aLogicalLink.getAttributes().get(0).getName().equals(Attribute.Name.hostName)); + assertEquals(aLogicalLink.getAttributes().size(), 1); + } +} + + + 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 ee04a08..b028018 100644 --- a/src/test/java/org/onap/pomba/common/datatypes/ModelContextTests.java +++ b/src/test/java/org/onap/pomba/common/datatypes/ModelContextTests.java @@ -60,22 +60,22 @@ public class ModelContextTests { @Test
public void testSetVf() {
ModelContext modelContext = new ModelContext();
- List<VF> vfList = new ArrayList<VF>();
- VF aVF = new VF();
+ List<VNF> vfList = new ArrayList<VNF>();
+ VNF aVF = new VNF();
aVF.setName("VF name");
vfList.add(aVF);
- modelContext.setVfs(vfList);
- assertEquals(modelContext.getVfs().size(), 1);
+ modelContext.setVnfs(vfList);
+ assertEquals(modelContext.getVnfs().size(), 1);
}
@Test
public void testAddVf() {
ModelContext modelContext = new ModelContext();
- VF aVF = new VF();
+ VNF aVF = new VNF();
aVF.setName("VF name");
modelContext.addVf(aVF);
- assertEquals(modelContext.getVfs().size(), 1);
- assertTrue("ModelContext VF name doesn't match", modelContext.getVfs().get(0).getName().equals("VF name"));
+ assertEquals(modelContext.getVnfs().size(), 1);
+ assertTrue("ModelContext VF name doesn't match", modelContext.getVnfs().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 index cfc6129..79b6bc1 100644 --- a/src/test/java/org/onap/pomba/common/datatypes/NetworkTests.java +++ b/src/test/java/org/onap/pomba/common/datatypes/NetworkTests.java @@ -30,9 +30,8 @@ public class NetworkTests { public void testNetwork() {
Network aNetwork = new Network();
aNetwork.setName("Network name");
- aNetwork.setInvariantUuid("Invariant Uuid");
+ aNetwork.setModelInvariantUUID("Invariant Uuid");
aNetwork.setUuid("Uuid");
- aNetwork.setType("Type");
DataQuality dataQuality = new DataQuality();
dataQuality.setStatus(Status.error);
dataQuality.setErrorText("Test");
@@ -41,9 +40,8 @@ public class NetworkTests { 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 invariant uuid doesn't match", aNetwork.getModelInvariantUUID().equals("Invariant Uuid"));
assertTrue("Network uuid doesn't match", aNetwork.getUuid().equals("Uuid"));
- assertTrue("Network type doesn't match", aNetwork.getType().equals("Type"));
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));
diff --git a/src/test/java/org/onap/pomba/common/datatypes/PInterfaceTests.java b/src/test/java/org/onap/pomba/common/datatypes/PInterfaceTests.java new file mode 100644 index 0000000..c4c2d55 --- /dev/null +++ b/src/test/java/org/onap/pomba/common/datatypes/PInterfaceTests.java @@ -0,0 +1,51 @@ +/* + * ============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 org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class PInterfaceTests { + + @Test + public void testPInterface() { + PInterface aPinterface = new PInterface(); + aPinterface.setName("Pinterface name"); + aPinterface.setUuid("Uuid"); + Port aPort = new Port(); + aPort.setName("port name"); + aPinterface.setPort(aPort); + DataQuality dataQuality = new DataQuality(); + dataQuality.setStatus(DataQuality.Status.error); + dataQuality.setErrorText("Test"); + aPinterface.setDataQuality(dataQuality); + Attribute attribute = new Attribute(); + attribute.setName(Attribute.Name.hostName); + aPinterface.addAttribute(attribute); + assertTrue("PInterface name doesn't match", aPinterface.getName().equals("Pinterface name")); + assertTrue("PInterface uuid doesn't match", aPinterface.getUuid().equals("Uuid")); + assertTrue("PInterface port name doesn't match", aPinterface.getPort().getName().equals("port name")); + assertTrue("PInterface data quality status doesn't match", aPinterface.getDataQuality().getStatus().equals(DataQuality.Status.error)); + assertTrue("PInterface data quality error text doesn't match", aPinterface.getDataQuality().getErrorText().equals("Test")); + assertTrue("PInterface attribute name doesn't match", aPinterface.getAttributes().get(0).getName().equals(Attribute.Name.hostName)); + assertEquals(aPinterface.getAttributes().size(), 1); + } +} + diff --git a/src/test/java/org/onap/pomba/common/datatypes/PNFTests.java b/src/test/java/org/onap/pomba/common/datatypes/PNFTests.java new file mode 100644 index 0000000..0f0af29 --- /dev/null +++ b/src/test/java/org/onap/pomba/common/datatypes/PNFTests.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.common.datatypes; + +import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class PNFTests { + + @Test + public void testPNF() { + PNF aPNF = new PNF(); + aPNF.setName("PNF name"); + aPNF.setUuid("Uuid"); + aPNF.setModelVersionID("a-123456"); + aPNF.setModelInvariantUUID("b-12345"); + DataQuality dataQuality = new DataQuality(); + dataQuality.setStatus(DataQuality.Status.error); + dataQuality.setErrorText("Test"); + aPNF.setDataQuality(dataQuality); + Attribute attribute = new Attribute(); + attribute.setName(Attribute.Name.hostName); + aPNF.addAttribute(attribute); + assertTrue("PNF name doesn't match", aPNF.getName().equals("PNF name")); + assertTrue("PNF uuid doesn't match", aPNF.getUuid().equals("Uuid")); + assertTrue("PNF model version id doesn't match", aPNF.getModelVersionID().equals("a-123456")); + assertTrue("PNF model invariant uuid doesn't match", aPNF.getModelInvariantUUID().equals("b-12345")); + assertTrue("PNF data quality status doesn't match", aPNF.getDataQuality().getStatus().equals(DataQuality.Status.error)); + assertTrue("PNF data quality error text doesn't match", aPNF.getDataQuality().getErrorText().equals("Test")); + assertTrue("PNF attribute name doesn't match", aPNF.getAttributes().get(0).getName().equals(Attribute.Name.hostName)); + assertEquals(aPNF.getAttributes().size(), 1); + } +} diff --git a/src/test/java/org/onap/pomba/common/datatypes/PhysicalLinkTests.java b/src/test/java/org/onap/pomba/common/datatypes/PhysicalLinkTests.java new file mode 100644 index 0000000..b973656 --- /dev/null +++ b/src/test/java/org/onap/pomba/common/datatypes/PhysicalLinkTests.java @@ -0,0 +1,48 @@ +/* + * ============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 org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class PhysicalLinkTests { + + @Test + public void testPhysicalLink() { + PhysicalLink aPhysicalLink = new PhysicalLink(); + aPhysicalLink.setName("PhysicalLink name"); + aPhysicalLink.setUuid("Uuid"); + DataQuality dataQuality = new DataQuality(); + dataQuality.setStatus(DataQuality.Status.error); + dataQuality.setErrorText("Test"); + aPhysicalLink.setDataQuality(dataQuality); + Attribute attribute = new Attribute(); + attribute.setName(Attribute.Name.hostName); + aPhysicalLink.addAttribute(attribute); + assertTrue("PhysicalLink name doesn't match", aPhysicalLink.getName().equals("PhysicalLink name")); + assertTrue("PhysicalLink uuid doesn't match", aPhysicalLink.getUuid().equals("Uuid")); + assertTrue("PhysicalLink data quality status doesn't match", aPhysicalLink.getDataQuality().getStatus().equals(DataQuality.Status.error)); + assertTrue("PhysicalLink data quality error text doesn't match", aPhysicalLink.getDataQuality().getErrorText().equals("Test")); + assertTrue("PhysicalLink attribute name doesn't match", aPhysicalLink.getAttributes().get(0).getName().equals(Attribute.Name.hostName)); + assertEquals(aPhysicalLink.getAttributes().size(), 1); + } +} + + diff --git a/src/test/java/org/onap/pomba/common/datatypes/PserverTests.java b/src/test/java/org/onap/pomba/common/datatypes/PserverTests.java new file mode 100644 index 0000000..335011f --- /dev/null +++ b/src/test/java/org/onap/pomba/common/datatypes/PserverTests.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.common.datatypes; + +import org.junit.Test; + +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +public class PserverTests { + + @Test + public void testPserver() { + Pserver aPserver = new Pserver(); + aPserver.setName("Pserver name"); + aPserver.setUuid("Uuid"); + DataQuality dataQuality = new DataQuality(); + dataQuality.setStatus(DataQuality.Status.error); + dataQuality.setErrorText("Test"); + aPserver.setDataQuality(dataQuality); + Attribute attribute = new Attribute(); + attribute.setName(Attribute.Name.hostName); + aPserver.addAttribute(attribute); + assertTrue("Pserver name doesn't match", aPserver.getName().equals("Pserver name")); + assertTrue("Pserver uuid doesn't match", aPserver.getUuid().equals("Uuid")); + assertTrue("Pserver data quality status doesn't match", aPserver.getDataQuality().getStatus().equals(DataQuality.Status.error)); + assertTrue("Pserver data quality error text doesn't match", aPserver.getDataQuality().getErrorText().equals("Test")); + assertTrue("Pserver attribute name doesn't match", aPserver.getAttributes().get(0).getName().equals(Attribute.Name.hostName)); + List<Attribute> attributeList = aPserver.getAttributes(); + assertEquals(aPserver.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 10f9339..61a158f 100644 --- a/src/test/java/org/onap/pomba/common/datatypes/ServiceTests.java +++ b/src/test/java/org/onap/pomba/common/datatypes/ServiceTests.java @@ -30,23 +30,16 @@ public class ServiceTests { public void testService() {
Service aService = new Service();
aService.setName("new service");
- aService.setInvariantUuid("Invariant Uuid");
+ aService.setModelInvariantUUID("Invariant Uuid");
aService.setUuid("Uuid");
DataQuality dataQuality = new DataQuality();
dataQuality.setStatus(Status.error);
dataQuality.setErrorText("Test");
aService.setDataQuality(dataQuality);
- Attribute attribute = new 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("Invariant Uuid doesn't match", aService.getModelInvariantUUID().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.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 index 0d74c00..97ad658 100644 --- a/src/test/java/org/onap/pomba/common/datatypes/VMTests.java +++ b/src/test/java/org/onap/pomba/common/datatypes/VMTests.java @@ -30,9 +30,7 @@ public class VMTests { 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");
@@ -41,8 +39,6 @@ public class VMTests { 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"));
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 d4840d2..d415fd8 100644 --- a/src/test/java/org/onap/pomba/common/datatypes/VfModuleTests.java +++ b/src/test/java/org/onap/pomba/common/datatypes/VfModuleTests.java @@ -30,7 +30,7 @@ public class VfModuleTests { public void testVFModule() {
VFModule aVFModule = new VFModule();
aVFModule.setName("Name");
- aVFModule.setInvariantUuid("Invariant Uuid");
+ aVFModule.setModelInvariantUUID("Invariant Uuid");
aVFModule.setUuid("Uuid");
aVFModule.setMaxInstances(10);
aVFModule.setMinInstances(1);
@@ -42,7 +42,7 @@ public class VfModuleTests { 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"));
+ assertTrue("VFModule Invariant Uuid doesn't match", aVFModule.getModelInvariantUUID().equals("Invariant Uuid"));
assertTrue("VFModule Uuid doesn't match", aVFModule.getUuid().equals("Uuid"));
assertEquals(aVFModule.getMaxInstances(), 10);
assertEquals(aVFModule.getMinInstances(), 1);
diff --git a/src/test/java/org/onap/pomba/common/datatypes/VfTests.java b/src/test/java/org/onap/pomba/common/datatypes/VnfTests.java index 11978f7..720a89f 100644 --- a/src/test/java/org/onap/pomba/common/datatypes/VfTests.java +++ b/src/test/java/org/onap/pomba/common/datatypes/VnfTests.java @@ -1,126 +1,126 @@ -/*
- * ============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.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 {
- @Test
- public void testVF() {
- VF aVF = new VF();
- aVF.setName("VF name");
- aVF.setType("Type");
- aVF.setInvariantUuid("Invariant Uuid");
- aVF.setUuid("Uuid");
- DataQuality dataQuality = new DataQuality();
- dataQuality.setStatus(Status.error);
- dataQuality.setErrorText("Test");
- aVF.setDataQuality(dataQuality);
- Attribute attribute = new 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"));
- assertTrue("VF Invariant Uuid doesn't match", aVF.getInvariantUuid().equals("Invariant Uuid"));
- assertTrue("VF Uuid doesn't match", aVF.getUuid().equals("Uuid"));
- 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.getAttributes().get(0).getName().equals(Name.hostName));
- List<Attribute> attributeList = aVF.getAttributes();
- aVF.setAttributes(attributeList);
- assertEquals(aVF.getAttributes().size(), 1);
- }
-
- @Test
- public void testSetVFModuleList() {
- VF aVF = new VF();
- List<VFModule> vfModuleList = new ArrayList<VFModule>();
- assertEquals(vfModuleList.size(), 0);
- VFModule vfModule = new VFModule();
- vfModule.setInvariantUuid("Invariant Uuid");
- vfModule.setMaxInstances(10);
- vfModule.setMinInstances(1);
- vfModule.setUuid("Uuid");
- vfModuleList.add(vfModule);
- aVF.setVfModules(vfModuleList);
- assertEquals(vfModuleList.size(), 1);
- }
-
- @Test
- public void testAddVfModule() {
- VF aVF = new VF();
- List<VFModule> vfModuleList = new ArrayList<VFModule>();
- assertEquals(vfModuleList.size(), 0);
- VFModule vfModule = new VFModule();
- vfModule.setInvariantUuid("Invariant Uuid");
- vfModule.setMaxInstances(10);
- vfModule.setMinInstances(1);
- vfModule.setUuid("Uuid");
- vfModuleList.add(vfModule);
- aVF.addVfModule(vfModule);
- assertEquals(vfModuleList.size(), 1);
- }
-
- @Test
- public void testGetVfModules() {
- VF aVF = new VF();
- List<VFModule> vfModuleList = new ArrayList<VFModule>();
- assertEquals(vfModuleList.size(), 0);
- VFModule vfModule = new VFModule();
- vfModule.setInvariantUuid("Invariant Uuid");
- vfModule.setMaxInstances(10);
- vfModule.setMinInstances(1);
- vfModule.setUuid("Uuid");
- vfModuleList.add(vfModule);
- aVF.addVfModule(vfModule);
- List<VFModule> resultVFModules = aVF.getVfModules();
- assertTrue("VF Modules doesn't match",
- ((VFModule) resultVFModules.get(0)).getInvariantUuid().equals("Invariant Uuid"));
- }
-
- @Test
- public void testSetVnfc() {
- VF aVF = new VF();
- List<VNFC> vnfcList = new ArrayList<VNFC>();
- assertEquals(vnfcList.size(), 0);
- VNFC aVNFC = new VNFC();
- aVNFC.setName("VNFC name");
- vnfcList.add(aVNFC);
- 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.getVnfcs().size(), 0);
- VNFC aVNFC = new VNFC();
- aVNFC.setName("VNFC name");
- aVF.addVnfc(aVNFC);
- assertTrue("VNFC list item doesn't match", aVF.getVnfcs().get(0).getName().equals("VNFC name"));
- }
-}
+/* + * ============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.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 VnfTests { + @Test + public void testVF() { + VNF aVF = new VNF(); + aVF.setName("VF name"); + aVF.setType("Type"); + aVF.setModelInvariantUUID("Invariant Uuid"); + aVF.setUuid("Uuid"); + DataQuality dataQuality = new DataQuality(); + dataQuality.setStatus(Status.error); + dataQuality.setErrorText("Test"); + aVF.setDataQuality(dataQuality); + Attribute attribute = new 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")); + assertTrue("VF Invariant Uuid doesn't match", aVF.getModelInvariantUUID().equals("Invariant Uuid")); + assertTrue("VF Uuid doesn't match", aVF.getUuid().equals("Uuid")); + 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.getAttributes().get(0).getName().equals(Name.hostName)); + List<Attribute> attributeList = aVF.getAttributes(); + aVF.setAttributes(attributeList); + assertEquals(aVF.getAttributes().size(), 1); + } + + @Test + public void testSetVFModuleList() { + VNF aVF = new VNF(); + List<VFModule> vfModuleList = new ArrayList<VFModule>(); + assertEquals(vfModuleList.size(), 0); + VFModule vfModule = new VFModule(); + vfModule.setModelInvariantUUID("Invariant Uuid"); + vfModule.setMaxInstances(10); + vfModule.setMinInstances(1); + vfModule.setUuid("Uuid"); + vfModuleList.add(vfModule); + aVF.setVfModules(vfModuleList); + assertEquals(vfModuleList.size(), 1); + } + + @Test + public void testAddVfModule() { + VNF aVF = new VNF(); + List<VFModule> vfModuleList = new ArrayList<VFModule>(); + assertEquals(vfModuleList.size(), 0); + VFModule vfModule = new VFModule(); + vfModule.setModelInvariantUUID("Invariant Uuid"); + vfModule.setMaxInstances(10); + vfModule.setMinInstances(1); + vfModule.setUuid("Uuid"); + vfModuleList.add(vfModule); + aVF.addVfModule(vfModule); + assertEquals(vfModuleList.size(), 1); + } + + @Test + public void testGetVfModules() { + VNF aVF = new VNF(); + List<VFModule> vfModuleList = new ArrayList<VFModule>(); + assertEquals(vfModuleList.size(), 0); + VFModule vfModule = new VFModule(); + vfModule.setModelInvariantUUID("Invariant Uuid"); + vfModule.setMaxInstances(10); + vfModule.setMinInstances(1); + vfModule.setUuid("Uuid"); + vfModuleList.add(vfModule); + aVF.addVfModule(vfModule); + List<VFModule> resultVFModules = aVF.getVfModules(); + assertTrue("VF Modules doesn't match", + ((VFModule) resultVFModules.get(0)).getModelInvariantUUID().equals("Invariant Uuid")); + } + + @Test + public void testSetVnfc() { + VNF aVF = new VNF(); + List<VNFC> vnfcList = new ArrayList<VNFC>(); + assertEquals(vnfcList.size(), 0); + VNFC aVNFC = new VNFC(); + aVNFC.setName("VNFC name"); + vnfcList.add(aVNFC); + aVF.setVnfcs(vnfcList); + assertTrue("VNFC list item doesn't match", aVF.getVnfcs().get(0).getName().equals("VNFC name")); + } + + @Test + public void testAddVnfc() { + VNF aVF = new VNF(); + assertEquals(aVF.getVnfcs().size(), 0); + VNFC aVNFC = new VNFC(); + aVNFC.setName("VNFC name"); + aVF.addVnfc(aVNFC); + 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 628c646..37712a3 100644 --- a/src/test/java/org/onap/pomba/common/datatypes/VnfcTests.java +++ b/src/test/java/org/onap/pomba/common/datatypes/VnfcTests.java @@ -30,9 +30,8 @@ public class VnfcTests { public void testVNFC() {
VNFC aVNFC = new VNFC();
aVNFC.setName("VNFC name");
- aVNFC.setInvariantUuid("Invariant Uuid");
+ aVNFC.setModelInvariantUUID("Invariant Uuid");
aVNFC.setUuid("Uuid");
- aVNFC.setType("Type");
DataQuality dataQuality = new DataQuality();
dataQuality.setStatus(Status.error);
dataQuality.setErrorText("Test");
@@ -41,9 +40,8 @@ public class VnfcTests { 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"));
+ assertTrue("VNFC invariant uuid doesn't match", aVNFC.getModelInvariantUUID().equals("Invariant Uuid"));
assertTrue("VNFC uuid doesn't match", aVNFC.getUuid().equals("Uuid"));
- assertTrue("VNFC type doesn't match", aVNFC.getType().equals("Type"));
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.getAttributes().get(0).getName().equals(Name.hostName));
|