From d26f38d193e2cee5b502c7418f282dc69a029a3c Mon Sep 17 00:00:00 2001 From: "Tait,Trevor(rt0435)" Date: Fri, 17 Aug 2018 16:03:32 -0400 Subject: Version 1 Issue-ID: LOG-614 Change-Id: I894dd52b6592c9c09f10793a2f13a369081938a6 Signed-off-by: Tait,Trevor(rt0435) --- .../pomba/common/datatypes/AttributeTests.java | 43 ++++++++++++++++++++++ .../pomba/common/datatypes/DataQualityTests.java | 37 +++++++++++++++++++ .../pomba/common/datatypes/ModelContextTests.java | 20 ++++++++++ .../onap/pomba/common/datatypes/ServiceTests.java | 21 +++++++++-- .../onap/pomba/common/datatypes/VfModuleTests.java | 22 ++++++++++- .../org/onap/pomba/common/datatypes/VfTests.java | 15 ++++++++ .../org/onap/pomba/common/datatypes/VnfcTests.java | 18 ++++++++- 7 files changed, 170 insertions(+), 6 deletions(-) create mode 100644 src/test/java/org/onap/pomba/common/datatypes/AttributeTests.java create mode 100644 src/test/java/org/onap/pomba/common/datatypes/DataQualityTests.java (limited to 'src/test') diff --git a/src/test/java/org/onap/pomba/common/datatypes/AttributeTests.java b/src/test/java/org/onap/pomba/common/datatypes/AttributeTests.java new file mode 100644 index 0000000..2eb6a72 --- /dev/null +++ b/src/test/java/org/onap/pomba/common/datatypes/AttributeTests.java @@ -0,0 +1,43 @@ +/* + * ============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.assertTrue; + +import org.junit.Test; +import org.onap.pomba.common.datatypes.Attribute.Value; +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)); + DataQuality dataQuality = new DataQuality(); + dataQuality.setStatus(Status.error); + dataQuality.setErrorText("Test"); + attribute.setDataQuality(dataQuality); + assertTrue("Attribute data quality status doesn't match", attribute.getDataQuality().getStatus().equals(Status.error)); + assertTrue("Attribute data quality error text doesn't match", attribute.getDataQuality().getErrorText().equals("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 new file mode 100644 index 0000000..3a71cd8 --- /dev/null +++ b/src/test/java/org/onap/pomba/common/datatypes/DataQualityTests.java @@ -0,0 +1,37 @@ +/* + * ============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.assertTrue; + +import org.junit.Test; +import org.onap.pomba.common.datatypes.DataQuality.Status; + +public class DataQualityTests { + @Test + public void testDataQuality() { + DataQuality dataQuality = new DataQuality(); + dataQuality.setStatus(Status.ok); + assertTrue("DataQuality status doesn't match", dataQuality.getStatus().equals(Status.ok)); + dataQuality.setStatus(Status.error); + dataQuality.setErrorText("Test"); + assertTrue("DataQuality status doesn't match", dataQuality.getStatus().equals(Status.error)); + assertTrue("DataQuality error text doesn't match", dataQuality.getErrorText().equals("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 bad0523..85dbfc7 100644 --- a/src/test/java/org/onap/pomba/common/datatypes/ModelContextTests.java +++ b/src/test/java/org/onap/pomba/common/datatypes/ModelContextTests.java @@ -15,6 +15,7 @@ * limitations under the License. * ============LICENSE_END===================================================== */ + package org.onap.pomba.common.datatypes; import static org.junit.Assert.assertEquals; @@ -24,8 +25,27 @@ import java.util.ArrayList; import java.util.List; import org.junit.Test; +import org.onap.pomba.common.datatypes.DataQuality.Status; public class ModelContextTests { + @Test + public void testModelContext() { + ModelContext modelContext = new ModelContext(); + DataQuality dataQuality = new DataQuality(); + dataQuality.setStatus(Status.error); + dataQuality.setErrorText("Test"); + modelContext.setDataQuality(dataQuality); + 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"); + modelContext.addAttribute(attribute); + assertTrue("ModelContext attribute name doesn't match", modelContext.getAttribute().get(0).getName().equals("Attribute")); + List attributeList = modelContext.getAttribute(); + modelContext.setAttribute(attributeList); + assertEquals(modelContext.getAttribute().size(), 1); + } + @Test public void testSetService() { ModelContext modelContext = new ModelContext(); 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 1f7ba50..a4ebc74 100644 --- a/src/test/java/org/onap/pomba/common/datatypes/ServiceTests.java +++ b/src/test/java/org/onap/pomba/common/datatypes/ServiceTests.java @@ -15,11 +15,14 @@ * limitations under the License. * ============LICENSE_END===================================================== */ -package org.onap.pomba.common.datatypes; -import org.junit.Test; +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.DataQuality.Status; public class ServiceTests { @Test @@ -28,9 +31,21 @@ public class ServiceTests { aService.setName("new service"); aService.setInvariantUuid("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("Attribute"); + 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 attributeList = aService.getAttribute(); + aService.setAttribute(attributeList); + assertEquals(aService.getAttribute().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 afce299..3bb577c 100644 --- a/src/test/java/org/onap/pomba/common/datatypes/VfModuleTests.java +++ b/src/test/java/org/onap/pomba/common/datatypes/VfModuleTests.java @@ -15,25 +15,43 @@ * 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.DataQuality.Status; public class VfModuleTests { @Test public void testVFModule() { VFModule aVFModule = new VFModule(); + aVFModule.setName("Name"); aVFModule.setInvariantUuid("Invariant Uuid"); aVFModule.setUuid("Uuid"); + aVFModule.setNfNamingCode("Nf Naming Code"); aVFModule.setMaxInstances(10); aVFModule.setMinInstances(1); - + DataQuality dataQuality = new DataQuality(); + dataQuality.setStatus(Status.error); + dataQuality.setErrorText("Test"); + aVFModule.setDataQuality(dataQuality); + Attribute attribute = new Attribute(); + attribute.setName("Attribute"); + 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 Uuid doesn't match", aVFModule.getUuid().equals("Uuid")); + assertTrue("VFModule Nf Naming Code doesn't match", aVFModule.getNfNamingCode().equals("Nf Naming Code")); assertEquals(aVFModule.getMaxInstances(), 10); 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 attributeList = aVFModule.getAttribute(); + aVFModule.setAttribute(attributeList); + assertEquals(aVFModule.getAttribute().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 8b2a255..9c17589 100644 --- a/src/test/java/org/onap/pomba/common/datatypes/VfTests.java +++ b/src/test/java/org/onap/pomba/common/datatypes/VfTests.java @@ -15,6 +15,7 @@ * limitations under the License. * ============LICENSE_END===================================================== */ + package org.onap.pomba.common.datatypes; import static org.junit.Assert.assertEquals; @@ -24,6 +25,7 @@ import java.util.ArrayList; import java.util.List; import org.junit.Test; +import org.onap.pomba.common.datatypes.DataQuality.Status; public class VfTests { @Test @@ -34,11 +36,24 @@ public class VfTests { aVF.setInvariantUuid("Invariant Uuid"); aVF.setUuid("Uuid"); aVF.setNfNamingCode("NF Naming Code"); + DataQuality dataQuality = new DataQuality(); + dataQuality.setStatus(Status.error); + dataQuality.setErrorText("Test"); + aVF.setDataQuality(dataQuality); + Attribute attribute = new Attribute(); + attribute.setName("Attribute"); + 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 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 attributeList = aVF.getAttribute(); + aVF.setAttribute(attributeList); + assertEquals(aVF.getAttribute().size(), 1); } @Test 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 b1c1285..ea5ccc4 100644 --- a/src/test/java/org/onap/pomba/common/datatypes/VnfcTests.java +++ b/src/test/java/org/onap/pomba/common/datatypes/VnfcTests.java @@ -15,11 +15,14 @@ * 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.DataQuality.Status; public class VnfcTests { @Test @@ -29,9 +32,22 @@ public class VnfcTests { aVNFC.setInvariantUuid("Invariant Uuid"); aVNFC.setUuid("Uuid"); aVNFC.setNfcNamingCode("NFC Naming Code"); + DataQuality dataQuality = new DataQuality(); + dataQuality.setStatus(Status.error); + dataQuality.setErrorText("Test"); + aVNFC.setDataQuality(dataQuality); + Attribute attribute = new Attribute(); + attribute.setName("Attribute"); + 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 NFC Naming Code doesn't match", aVNFC.getNfcNamingCode().equals("NFC Naming Code")); 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 attributeList = aVNFC.getAttribute(); + aVNFC.setAttribute(attributeList); + assertEquals(aVNFC.getAttribute().size(), 1); } } -- cgit 1.2.3-korg