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) --- pom.xml | 2 +- .../org/onap/pomba/common/datatypes/Attribute.java | 67 ++++++++++++++++++++++ .../onap/pomba/common/datatypes/DataQuality.java | 52 +++++++++++++++++ .../onap/pomba/common/datatypes/ModelContext.java | 39 ++++++++++--- .../org/onap/pomba/common/datatypes/Service.java | 26 ++++++++- .../java/org/onap/pomba/common/datatypes/VF.java | 31 ++++++++-- .../org/onap/pomba/common/datatypes/VFModule.java | 49 +++++++++++++++- .../java/org/onap/pomba/common/datatypes/VNFC.java | 28 ++++++++- .../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 +++++- 15 files changed, 444 insertions(+), 26 deletions(-) create mode 100644 src/main/java/org/onap/pomba/common/datatypes/Attribute.java create mode 100644 src/main/java/org/onap/pomba/common/datatypes/DataQuality.java 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 diff --git a/pom.xml b/pom.xml index 895894f..8ba7d35 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.onap.logging-analytics.pomba pomba-audit-common - 1.3.0-SNAPSHOT + 1.3.1-SNAPSHOT jar diff --git a/src/main/java/org/onap/pomba/common/datatypes/Attribute.java b/src/main/java/org/onap/pomba/common/datatypes/Attribute.java new file mode 100644 index 0000000..d73435e --- /dev/null +++ b/src/main/java/org/onap/pomba/common/datatypes/Attribute.java @@ -0,0 +1,67 @@ +/* + * ============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 com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class Attribute { + @Expose + @SerializedName("name") + private String name; + @Expose + @SerializedName("value") + private Value value; + @Expose + @SerializedName("dataQuality") + private DataQuality dataQuality = new DataQuality(); + + public enum Value { + adminState, + ipAddress, + hostName, + lockedBoolean, + macAddress, + networkType, + networkTechnology, + physicalNetworkName, + sharedNetworkBoolean, + networkRole, + routerExternalBoolean + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public Value getValue() { + return value; + } + public void setValue(Value value) { + this.value = value; + } + public DataQuality getDataQuality() { + return dataQuality; + } + public void setDataQuality(DataQuality dataQuality) { + this.dataQuality = dataQuality; + } + +} diff --git a/src/main/java/org/onap/pomba/common/datatypes/DataQuality.java b/src/main/java/org/onap/pomba/common/datatypes/DataQuality.java new file mode 100644 index 0000000..111fd94 --- /dev/null +++ b/src/main/java/org/onap/pomba/common/datatypes/DataQuality.java @@ -0,0 +1,52 @@ +/* + * ============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 com.google.gson.annotations.Expose; +import com.google.gson.annotations.SerializedName; + +public class DataQuality { + @Expose + @SerializedName("status") + private Status status; + @Expose + @SerializedName("errorText") + private String errorText; + + public enum Status { + ok, + error + } + + public Status getStatus() { + return this.status; + } + + public void setStatus(Status status) { + this.status = status; + } + + public String getErrorText() { + return this.errorText; + } + + public void setErrorText(String errorText) { + this.errorText = errorText; + } +} diff --git a/src/main/java/org/onap/pomba/common/datatypes/ModelContext.java b/src/main/java/org/onap/pomba/common/datatypes/ModelContext.java index 6e5c0bb..523ed52 100644 --- a/src/main/java/org/onap/pomba/common/datatypes/ModelContext.java +++ b/src/main/java/org/onap/pomba/common/datatypes/ModelContext.java @@ -15,13 +15,13 @@ * limitations under the License. * ============LICENSE_END===================================================== */ -package org.onap.pomba.common.datatypes; -import java.util.ArrayList; -import java.util.List; +package org.onap.pomba.common.datatypes; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; +import java.util.ArrayList; +import java.util.List; public class ModelContext { @@ -29,8 +29,14 @@ public class ModelContext { @SerializedName("service") private Service service; @Expose - @SerializedName("vf-list") - private List vf = new ArrayList<>(); + @SerializedName("dataQuality") + private DataQuality dataQuality = new DataQuality(); + @Expose + @SerializedName("attributeList") + private List attributeList = new ArrayList<>(); + @Expose + @SerializedName("vfList") + private List vfList = new ArrayList<>(); public Service getService() { return service; @@ -38,13 +44,28 @@ public class ModelContext { public void setService(Service service) { this.service = service; } + public DataQuality getDataQuality() { + return dataQuality; + } + public void setDataQuality(DataQuality dataQuality) { + this.dataQuality = dataQuality; + } + public List getAttribute() { + return attributeList; + } + public void setAttribute(List attributeList) { + this.attributeList = attributeList; + } + public void addAttribute(Attribute attribute) { + this.attributeList.add(attribute); + } public List getVf() { - return vf; + return vfList; } - public void setVf(List vf) { - this.vf = vf; + public void setVf(List vfList) { + this.vfList = vfList; } public void addVf(VF vf) { - this.vf.add(vf); + this.vfList.add(vf); } } diff --git a/src/main/java/org/onap/pomba/common/datatypes/Service.java b/src/main/java/org/onap/pomba/common/datatypes/Service.java index e52e82e..1fde805 100644 --- a/src/main/java/org/onap/pomba/common/datatypes/Service.java +++ b/src/main/java/org/onap/pomba/common/datatypes/Service.java @@ -15,10 +15,13 @@ * limitations under the License. * ============LICENSE_END===================================================== */ + package org.onap.pomba.common.datatypes; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; +import java.util.ArrayList; +import java.util.List; public class Service { @@ -26,11 +29,17 @@ public class Service { @SerializedName("name") private String name; @Expose - @SerializedName("invariant-id") + @SerializedName("invariantUUID") private String invariantUuid; @Expose @SerializedName("uuid") private String uuid; + @Expose + @SerializedName("dataQuality") + private DataQuality dataQuality = new DataQuality(); + @Expose + @SerializedName("attributeList") + private List attributeList = new ArrayList<>(); public String getName() { return name; @@ -50,4 +59,19 @@ public class Service { public void setUuid(String uuid) { this.uuid = uuid; } + public DataQuality getDataQuality() { + return dataQuality; + } + public void setDataQuality(DataQuality dataQuality) { + this.dataQuality = dataQuality; + } + public List getAttribute() { + return attributeList; + } + public void setAttribute(List attributeList) { + this.attributeList = attributeList; + } + public void addAttribute(Attribute attribute) { + this.attributeList.add(attribute); + } } diff --git a/src/main/java/org/onap/pomba/common/datatypes/VF.java b/src/main/java/org/onap/pomba/common/datatypes/VF.java index 83cf37d..05fb9ec 100644 --- a/src/main/java/org/onap/pomba/common/datatypes/VF.java +++ b/src/main/java/org/onap/pomba/common/datatypes/VF.java @@ -15,7 +15,9 @@ * limitations under the License. * ============LICENSE_END===================================================== */ + package org.onap.pomba.common.datatypes; + import java.util.ArrayList; import java.util.List; @@ -31,19 +33,25 @@ public class VF { @SerializedName("type") private String type; @Expose - @SerializedName("invariant-id") + @SerializedName("invariantUUID") private String invariantUuid; @Expose @SerializedName("uuid") private String uuid; @Expose - @SerializedName("nf-naming-code") + @SerializedName("nfNamingCode") private String nfNamingCode; @Expose - @SerializedName("vf-module-list") + @SerializedName("dataQuality") + private DataQuality dataQuality = new DataQuality(); + @Expose + @SerializedName("attributeList") + private List attributeList = new ArrayList<>(); + @Expose + @SerializedName("vfModuleList") private List vfModules = new ArrayList<>(); @Expose - @SerializedName("vnfc-list") + @SerializedName("vnfcList") private List vnfc = new ArrayList<>(); public String getName() { @@ -94,4 +102,19 @@ public class VF { public void addVnfc(VNFC vnfc) { this.vnfc.add(vnfc); } + public List getAttribute() { + return attributeList; + } + public void setAttribute(List attributeList) { + this.attributeList = attributeList; + } + public void addAttribute(Attribute attribute) { + this.attributeList.add(attribute); + } + public DataQuality getDataQuality() { + return dataQuality; + } + public void setDataQuality(DataQuality dataQuality) { + this.dataQuality = dataQuality; + } } diff --git a/src/main/java/org/onap/pomba/common/datatypes/VFModule.java b/src/main/java/org/onap/pomba/common/datatypes/VFModule.java index 7e3b0b1..1c82801 100644 --- a/src/main/java/org/onap/pomba/common/datatypes/VFModule.java +++ b/src/main/java/org/onap/pomba/common/datatypes/VFModule.java @@ -15,26 +15,48 @@ * limitations under the License. * ============LICENSE_END===================================================== */ + package org.onap.pomba.common.datatypes; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; +import java.util.ArrayList; +import java.util.List; public class VFModule { @Expose - @SerializedName("invariant-id") + @SerializedName("name") + private String name; + @Expose + @SerializedName("invariantUUID") private String invariantUuid; @Expose @SerializedName("uuid") private String uuid; @Expose - @SerializedName("max-instances") + @SerializedName("nfNamingCode") + private String nfNamingCode; + @Expose + @SerializedName("maxInstances") private int maxInstances; @Expose - @SerializedName("min-instances") + @SerializedName("minInstances") private int minInstances; + @Expose + @SerializedName("dataQuality") + private DataQuality dataQuality = new DataQuality(); + @Expose + @SerializedName("attributeList") + private List attributeList = new ArrayList<>(); + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } public String getInvariantUuid() { return invariantUuid; } @@ -47,6 +69,12 @@ public class VFModule { public void setUuid(String uuid) { this.uuid = uuid; } + public String getNfNamingCode() { + return nfNamingCode; + } + public void setNfNamingCode(String nfNamingCode) { + this.nfNamingCode = nfNamingCode; + } public int getMaxInstances() { return maxInstances; } @@ -59,4 +87,19 @@ public class VFModule { public void setMinInstances(int minInstances) { this.minInstances = minInstances; } + public List getAttribute() { + return attributeList; + } + public void setAttribute(List attributeList) { + this.attributeList = attributeList; + } + public void addAttribute(Attribute attribute) { + this.attributeList.add(attribute); + } + public DataQuality getDataQuality() { + return dataQuality; + } + public void setDataQuality(DataQuality dataQuality) { + this.dataQuality = dataQuality; + } } diff --git a/src/main/java/org/onap/pomba/common/datatypes/VNFC.java b/src/main/java/org/onap/pomba/common/datatypes/VNFC.java index 6eaee0d..1302b6f 100644 --- a/src/main/java/org/onap/pomba/common/datatypes/VNFC.java +++ b/src/main/java/org/onap/pomba/common/datatypes/VNFC.java @@ -15,10 +15,13 @@ * limitations under the License. * ============LICENSE_END===================================================== */ + package org.onap.pomba.common.datatypes; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; +import java.util.ArrayList; +import java.util.List; public class VNFC { @@ -26,14 +29,20 @@ public class VNFC { @SerializedName("name") private String name; @Expose - @SerializedName("invariant-id") + @SerializedName("invariantUUID") private String invariantUuid; @Expose @SerializedName("uuid") private String uuid; @Expose - @SerializedName("nfc-naming-code") + @SerializedName("nfNamingCode") private String nfcNamingCode; + @Expose + @SerializedName("dataQuality") + private DataQuality dataQuality = new DataQuality(); + @Expose + @SerializedName("attributeList") + private List attributeList = new ArrayList<>(); public String getName() { return name; @@ -59,4 +68,19 @@ public class VNFC { public void setNfcNamingCode(String nfcType) { this.nfcNamingCode = nfcType; } + public List getAttribute() { + return attributeList; + } + public void setAttribute(List attributeList) { + this.attributeList = attributeList; + } + public void addAttribute(Attribute attribute) { + this.attributeList.add(attribute); + } + public DataQuality getDataQuality() { + return dataQuality; + } + public void setDataQuality(DataQuality dataQuality) { + this.dataQuality = dataQuality; + } } 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