diff options
19 files changed, 821 insertions, 41 deletions
@@ -4,7 +4,7 @@ <groupId>org.onap.logging-analytics.pomba</groupId>
<artifactId>pomba-audit-common</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.3.1-SNAPSHOT</version>
<packaging>jar</packaging>
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..6a1f7b3 --- /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 Name name;
+ @Expose
+ @SerializedName("value")
+ private String value;
+ @Expose
+ @SerializedName("dataQuality")
+ private DataQuality dataQuality = new DataQuality();
+
+ public enum Name {
+ adminState,
+ ipAddress,
+ hostName,
+ lockedBoolean,
+ macAddress,
+ networkType,
+ networkTechnology,
+ physicalNetworkName,
+ sharedNetworkBoolean,
+ networkRole,
+ routerExternalBoolean
+ }
+ public Name getName() {
+ return name;
+ }
+ public void setName(Name name) {
+ this.name = name;
+ }
+ public String getValue() {
+ return value;
+ }
+ public void setValue(String 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..9c442e0 --- /dev/null +++ b/src/main/java/org/onap/pomba/common/datatypes/DataQuality.java @@ -0,0 +1,73 @@ +/*
+ * ============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;
+ }
+
+ public static DataQuality ok() {
+ // as a non-mutable class, it is not safe to define a constant for this
+ DataQuality result = new DataQuality();
+ result.setStatus(Status.ok);
+ return result;
+ }
+
+ public static DataQuality error(String text) {
+ // as a non-mutable class, it is not safe to define a constant for this
+ DataQuality result = new DataQuality();
+ result.setStatus(Status.error);
+ result.setErrorText(text);
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "DataQuality [status=" + this.status + ", errorText=" + this.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..592d68a 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> vf = new ArrayList<>();
+ @SerializedName("dataQuality")
+ private DataQuality dataQuality = new DataQuality();
+ @Expose
+ @SerializedName("attributeList")
+ private List<Attribute> attributeList = new ArrayList<>();
+ @Expose
+ @SerializedName("vfList")
+ private List<VF> vfList = new ArrayList<>();
public Service getService() {
return service;
@@ -38,13 +44,28 @@ public class ModelContext { public void setService(Service service) {
this.service = service;
}
- public List<VF> getVf() {
- return vf;
+ public DataQuality getDataQuality() {
+ return dataQuality;
+ }
+ public void setDataQuality(DataQuality dataQuality) {
+ this.dataQuality = dataQuality;
+ }
+ public List<Attribute> getAttributes() {
+ return attributeList;
+ }
+ public void setAttributes(List<Attribute> attributeList) {
+ this.attributeList = attributeList;
+ }
+ public void addAttribute(Attribute attribute) {
+ this.attributeList.add(attribute);
+ }
+ public List<VF> getVfs() {
+ return vfList;
}
- public void setVf(List<VF> vf) {
- this.vf = vf;
+ public void setVfs(List<VF> 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/Network.java b/src/main/java/org/onap/pomba/common/datatypes/Network.java new file mode 100644 index 0000000..19c286c --- /dev/null +++ b/src/main/java/org/onap/pomba/common/datatypes/Network.java @@ -0,0 +1,86 @@ +/*
+ * ============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;
+import java.util.ArrayList;
+import java.util.List;
+
+public class Network {
+ @Expose
+ @SerializedName("name")
+ private String name;
+ @Expose
+ @SerializedName("invariantUUID")
+ private String invariantUuid;
+ @Expose
+ @SerializedName("uuid")
+ private String uuid;
+ @Expose
+ @SerializedName("nfNamingCode")
+ private String nfcNamingCode;
+ @Expose
+ @SerializedName("dataQuality")
+ private DataQuality dataQuality = new DataQuality();
+ @Expose
+ @SerializedName("attributeList")
+ private List<Attribute> attributeList = new ArrayList<>();
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getInvariantUuid() {
+ return invariantUuid;
+ }
+ public void setInvariantUuid(String invariantUuid) {
+ this.invariantUuid = invariantUuid;
+ }
+ public String getUuid() {
+ return uuid;
+ }
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+ public String getNfcNamingCode() {
+ return nfcNamingCode;
+ }
+ public void setNfcNamingCode(String nfcType) {
+ this.nfcNamingCode = nfcType;
+ }
+ public List<Attribute> getAttributes() {
+ return attributeList;
+ }
+ public void setAttributes(List<Attribute> 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/Service.java b/src/main/java/org/onap/pomba/common/datatypes/Service.java index e52e82e..b225b6a 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<Attribute> 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<Attribute> getAttributes() {
+ return attributeList;
+ }
+ public void setAttributes(List<Attribute> 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..7bbb962 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,20 +33,26 @@ 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<Attribute> attributeList = new ArrayList<>();
+ @Expose
+ @SerializedName("vfModuleList")
private List<VFModule> vfModules = new ArrayList<>();
@Expose
- @SerializedName("vnfc-list")
- private List<VNFC> vnfc = new ArrayList<>();
+ @SerializedName("vnfcList")
+ private List<VNFC> vnfcs = new ArrayList<>();
public String getName() {
return name;
@@ -85,13 +93,28 @@ public class VF { public void addVfModule(VFModule vfModule) {
this.vfModules.add(vfModule);
}
- public List<VNFC> getVnfc() {
- return vnfc;
+ public List<VNFC> getVnfcs() {
+ return vnfcs;
}
- public void setVnfc(List<VNFC> vnfc) {
- this.vnfc = vnfc;
+ public void setVnfcs(List<VNFC> vnfc) {
+ this.vnfcs = vnfc;
}
public void addVnfc(VNFC vnfc) {
- this.vnfc.add(vnfc);
+ this.vnfcs.add(vnfc);
+ }
+ public List<Attribute> getAttributes() {
+ return attributeList;
+ }
+ public void setAttributes(List<Attribute> 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..876f6b2 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,54 @@ * 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<Attribute> attributeList = new ArrayList<>();
+ @Expose
+ @SerializedName("vmList")
+ private List<VM> vms = new ArrayList<>();
+ @Expose
+ @SerializedName("networkList")
+ private List<Network> networks = new ArrayList<>();
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
public String getInvariantUuid() {
return invariantUuid;
}
@@ -47,6 +75,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 +93,37 @@ public class VFModule { public void setMinInstances(int minInstances) {
this.minInstances = minInstances;
}
+ public List<VM> getVms() {
+ return vms;
+ }
+ public void setVms(List<VM> vms) {
+ this.vms = vms;
+ }
+ public void addVm(VM vm) {
+ this.vms.add(vm);
+ }
+ public List<Network> getNetworks() {
+ return networks;
+ }
+ public void setNetworks(List<Network> network) {
+ this.networks = network;
+ }
+ public void addNetwork(Network vnfc) {
+ this.networks.add(vnfc);
+ }
+ public List<Attribute> getAttributes() {
+ return attributeList;
+ }
+ public void setAttributes(List<Attribute> 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/VM.java b/src/main/java/org/onap/pomba/common/datatypes/VM.java new file mode 100644 index 0000000..29f4c29 --- /dev/null +++ b/src/main/java/org/onap/pomba/common/datatypes/VM.java @@ -0,0 +1,86 @@ +/*
+ * ============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;
+import java.util.ArrayList;
+import java.util.List;
+
+public class VM {
+ @Expose
+ @SerializedName("name")
+ private String name;
+ @Expose
+ @SerializedName("invariantUUID")
+ private String invariantUuid;
+ @Expose
+ @SerializedName("uuid")
+ private String uuid;
+ @Expose
+ @SerializedName("nfNamingCode")
+ private String nfcNamingCode;
+ @Expose
+ @SerializedName("dataQuality")
+ private DataQuality dataQuality = new DataQuality();
+ @Expose
+ @SerializedName("attributeList")
+ private List<Attribute> attributeList = new ArrayList<>();
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getInvariantUuid() {
+ return invariantUuid;
+ }
+ public void setInvariantUuid(String invariantUuid) {
+ this.invariantUuid = invariantUuid;
+ }
+ public String getUuid() {
+ return uuid;
+ }
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+ public String getNfcNamingCode() {
+ return nfcNamingCode;
+ }
+ public void setNfcNamingCode(String nfcType) {
+ this.nfcNamingCode = nfcType;
+ }
+ public List<Attribute> getAttributes() {
+ return attributeList;
+ }
+ public void setAttributes(List<Attribute> 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..66c852a 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<Attribute> 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<Attribute> getAttributes() {
+ return attributeList;
+ }
+ public void setAttributes(List<Attribute> 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..261b8a2 --- /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.Name;
+import org.onap.pomba.common.datatypes.DataQuality.Status;
+
+public class AttributeTests {
+ @Test
+ public void testAttribute() {
+ Attribute attribute = new Attribute();
+ 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");
+ 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..df0e808 --- /dev/null +++ b/src/test/java/org/onap/pomba/common/datatypes/DataQualityTests.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 static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+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"));
+ }
+
+ @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 bad0523..ee04a08 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,9 +25,29 @@ 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 {
@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(Name.hostName);
+ modelContext.addAttribute(attribute);
+ 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
public void testSetService() {
ModelContext modelContext = new ModelContext();
Service aService = new Service();
@@ -43,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
@@ -53,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 1f7ba50..10f9339 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,15 @@ * 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.Attribute.Name;
+import org.onap.pomba.common.datatypes.DataQuality.Status;
public class ServiceTests {
@Test
@@ -28,9 +32,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(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.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 afce299..3d46510 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,60 @@ * 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 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(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 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.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 8b2a255..464758e 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,8 @@ 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
@@ -34,11 +37,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(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 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.getAttributes().get(0).getName().equals(Name.hostName));
+ List<Attribute> attributeList = aVF.getAttributes();
+ aVF.setAttributes(attributeList);
+ assertEquals(aVF.getAttributes().size(), 1);
}
@Test
@@ -96,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 b1c1285..38d68fe 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,15 @@ * 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 VnfcTests {
@Test
@@ -29,9 +33,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(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 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.getAttributes().get(0).getName().equals(Name.hostName));
+ List<Attribute> attributeList = aVNFC.getAttributes();
+ aVNFC.setAttributes(attributeList);
+ assertEquals(aVNFC.getAttributes().size(), 1);
}
}
|