From c31787b52a9f9e02ade0c20c80cd2973f794e902 Mon Sep 17 00:00:00 2001 From: Joseph Chou Date: Mon, 25 Sep 2017 13:11:51 -0400 Subject: Create common object to consolidate AAI response Add Junit test to improve sonar coverage Change-Id: I32688dad756d2cba80559cd1d090e334ebf77aa3 Issue-ID: POLICY-228 Signed-off-by: Joseph Chou --- .../org/onap/policy/aai/AAINQCloudRegionTest.java | 48 ++++++ .../onap/policy/aai/AAINQExtraPropertiesTest.java | 49 +++++++ .../onap/policy/aai/AAINQExtraPropertyTest.java | 46 ++++++ .../org/onap/policy/aai/AAINQGenericVNFTest.java | 61 ++++++++ .../onap/policy/aai/AAINQInstanceFiltersTest.java | 44 ++++++ .../policy/aai/AAINQInventoryResponseItemTest.java | 162 +++++++++++++++++++++ .../aai/AAINQInventoryResponseItemsTest.java | 149 +++++++++++++++++++ .../org/onap/policy/aai/AAINQNamedQueryTest.java | 47 ++++++ .../onap/policy/aai/AAINQQueryParametersTest.java | 49 +++++++ .../java/org/onap/policy/aai/AAINQRequestTest.java | 60 ++++++++ .../onap/policy/aai/AAINQResponseWrapperTest.java | 155 ++++++++++++++++++++ .../onap/policy/aai/AAINQServiceInstanceTest.java | 55 +++++++ .../java/org/onap/policy/aai/AAINQTenantTest.java | 52 +++++++ .../java/org/onap/policy/aai/AAINQVServerTest.java | 58 ++++++++ .../org/onap/policy/aai/AAINQVfModuleTest.java | 61 ++++++++ .../java/org/onap/policy/aai/PNFInstanceTest.java | 52 +++++++ .../src/test/java/org/onap/policy/aai/PNFTest.java | 51 +++++++ .../test/java/org/onap/policy/aai/PNFTypeTest.java | 50 +++++++ .../onap/policy/aai/RelatedToPropertyItemTest.java | 51 +++++++ .../org/onap/policy/aai/RelatedToPropertyTest.java | 57 ++++++++ .../onap/policy/aai/RelationshipDataItemTest.java | 46 ++++++ .../org/onap/policy/aai/RelationshipDataTest.java | 58 ++++++++ .../org/onap/policy/aai/RelationshipItemTest.java | 53 +++++++ .../org/onap/policy/aai/RelationshipListTest.java | 70 +++++++++ .../java/org/onap/policy/aai/RelationshipTest.java | 67 +++++++++ 25 files changed, 1651 insertions(+) create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQCloudRegionTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertiesTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertyTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQGenericVNFTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInstanceFiltersTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemsTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQNamedQueryTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQQueryParametersTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseWrapperTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQServiceInstanceTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQTenantTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVServerTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVfModuleTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFInstanceTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTypeTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyItemTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataItemTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipItemTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java create mode 100644 controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java (limited to 'controlloop') diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQCloudRegionTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQCloudRegionTest.java new file mode 100644 index 000000000..4c04aa41d --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQCloudRegionTest.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class AAINQCloudRegionTest { + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + AAINQCloudRegion aaiNQCloudRegion = new AAINQCloudRegion(); + aaiNQCloudRegion.cloudOwner = "Rackspace"; + aaiNQCloudRegion.cloudRegionId = "DFW"; + aaiNQCloudRegion.cloudRegionVersion = "v1"; + aaiNQCloudRegion.complexName = "SharedNode"; + aaiNQCloudRegion.resourceVersion = "1504789196021"; + assertNotNull(aaiNQCloudRegion); + } +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertiesTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertiesTest.java new file mode 100644 index 000000000..d67f3dd11 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertiesTest.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class AAINQExtraPropertiesTest { + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + AAINQExtraProperties aaiNQExtraProperties = new AAINQExtraProperties(); + aaiNQExtraProperties.extraProperty.add(new AAINQExtraProperty("model.model-name", "service-instance")); + aaiNQExtraProperties.extraProperty.add(new AAINQExtraProperty("model.model-type", "widget")); + aaiNQExtraProperties.extraProperty.add(new AAINQExtraProperty("model.model-version", "1.0")); + aaiNQExtraProperties.extraProperty.add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); + aaiNQExtraProperties.extraProperty.add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); + assertNotNull(aaiNQExtraProperties); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertyTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertyTest.java new file mode 100644 index 000000000..f193a8de7 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertyTest.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class AAINQExtraPropertyTest { + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + AAINQExtraProperty aaiNQExtraProperty = new AAINQExtraProperty(); + aaiNQExtraProperty.propertyName = "model.model-name"; + aaiNQExtraProperty.propertyValue= "service-instance"; + assertNotNull(aaiNQExtraProperty); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQGenericVNFTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQGenericVNFTest.java new file mode 100644 index 000000000..c99c80e6d --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQGenericVNFTest.java @@ -0,0 +1,61 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class AAINQGenericVNFTest { + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + AAINQGenericVNF aaiNQGenericVNF = new AAINQGenericVNF(); + aaiNQGenericVNF.encrypedAccessFlag = true; + aaiNQGenericVNF.inMaint = false; + aaiNQGenericVNF.ipv4Loopback0Address = "aa"; + aaiNQGenericVNF.ipv4OamAddress = "oamAddress"; + aaiNQGenericVNF.isClosedLoopDisabled = false; + aaiNQGenericVNF.modelInvariantId = "653d2caa-7e47-4614-95b3-26c8d82755b8"; + aaiNQGenericVNF.modelVersionId = "98f410f6-4c63-447b-97d2-42508437cec0"; + aaiNQGenericVNF.operationalState = "active"; + aaiNQGenericVNF.personaModelId = "653d2caa-7e47-4614-95b3-26c8d82755b8"; + aaiNQGenericVNF.personaModelVersion = "98f410f6-4c63-447b-97d2-42508437cec0"; + aaiNQGenericVNF.provStatus = "complete"; + aaiNQGenericVNF.resourceVersion = "1505056714553"; + aaiNQGenericVNF.serviceId = "e8cb8968-5411-478b-906a-f28747de72cd"; + aaiNQGenericVNF.vnfID = "ed8b2bce-6b27-4089-992c-4a2c66024bcd"; + aaiNQGenericVNF.vnfName = "vCPEInfraVNF14a"; + aaiNQGenericVNF.vnfName2 = "malumabb12"; + aaiNQGenericVNF.vnfType = "vCPEInfraService10/vCPEInfraService10 0"; + assertNotNull(aaiNQGenericVNF); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInstanceFiltersTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInstanceFiltersTest.java new file mode 100644 index 000000000..0ca5326e3 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInstanceFiltersTest.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class AAINQInstanceFiltersTest { + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + AAINQInstanceFilters aaiNQInstanceFilters = new AAINQInstanceFilters(); + assertNotNull(aaiNQInstanceFilters); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemTest.java new file mode 100644 index 000000000..ac21a81d8 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemTest.java @@ -0,0 +1,162 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import java.util.LinkedList; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AAINQInventoryResponseItemTest { + private static final Logger logger = LoggerFactory.getLogger(AAINQInventoryResponseItemTest.class); + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + AAINQInventoryResponseItem aaiNQInventoryResponseItem = new AAINQInventoryResponseItem(); + aaiNQInventoryResponseItem.modelName = "service-instance"; + AAINQCloudRegion aaiNQCloudRegion = new AAINQCloudRegion(); + aaiNQCloudRegion.cloudOwner = "OWNER"; + aaiNQCloudRegion.cloudRegionId = "REGIONID"; + aaiNQCloudRegion.cloudRegionVersion = "2.5"; + aaiNQCloudRegion.complexName = "COMPLEXNAME"; + aaiNQCloudRegion.resourceVersion = "1485365988"; + aaiNQInventoryResponseItem.cloudRegion = aaiNQCloudRegion; + AAINQExtraProperties aaiNQExtraProperties = new AAINQExtraProperties(); + aaiNQExtraProperties.extraProperty = new LinkedList<>(); + aaiNQExtraProperties.extraProperty.add(new AAINQExtraProperty("model.model-name", "generic-vnf")); + aaiNQExtraProperties.extraProperty.add(new AAINQExtraProperty("model.model-type", "widget")); + aaiNQExtraProperties.extraProperty.add(new AAINQExtraProperty("model.model-version", "1.0")); + aaiNQExtraProperties.extraProperty.add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c")); + aaiNQExtraProperties.extraProperty.add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); + aaiNQInventoryResponseItem.extraProperties = aaiNQExtraProperties; + AAINQGenericVNF aaiNQGenericVNF = new AAINQGenericVNF(); + aaiNQGenericVNF.vnfID = "dhv-test-gvnf"; + aaiNQGenericVNF.vnfName = "dhv-test-gvnf-name"; + aaiNQGenericVNF.vnfName2 = "dhv-test-gvnf-name2"; + aaiNQGenericVNF.vnfType = "SW"; + aaiNQGenericVNF.serviceId = "d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4"; + aaiNQGenericVNF.provStatus = "PREPROV"; + aaiNQGenericVNF.operationalState = "dhv-test-operational-state"; + aaiNQGenericVNF.ipv4OamAddress = "dhv-test-gvnf-ipv4-oam-address"; + aaiNQGenericVNF.ipv4Loopback0Address = "dhv-test-gvnfipv4-loopback0-address"; + aaiNQGenericVNF.inMaint = false; + aaiNQGenericVNF.isClosedLoopDisabled = false; + aaiNQGenericVNF.resourceVersion = "1485366450"; + aaiNQGenericVNF.encrypedAccessFlag = true; + aaiNQGenericVNF.personaModelId = "acc6edd8-a8d4-4b93-afaa-0994068be14c"; + aaiNQGenericVNF.personaModelVersion = "1.0"; + aaiNQInventoryResponseItem.genericVNF = aaiNQGenericVNF; + AAINQInventoryResponseItems aaiNQInventoryResponseItems = new AAINQInventoryResponseItems(); + AAINQInventoryResponseItem serviceItem = new AAINQInventoryResponseItem(); + serviceItem.modelName = "service-instance"; + serviceItem.serviceInstance = new AAINQServiceInstance(); + serviceItem.serviceInstance.serviceInstanceID = "dhv-test-vhnfportal-service-instance-id"; + serviceItem.serviceInstance.serviceInstanceName = "dhv-test-service-instance-name1"; + serviceItem.serviceInstance.personaModelId = "82194af1-3c2c-485a-8f44-420e22a9eaa4"; + serviceItem.serviceInstance.personaModelVersion = "1.0"; + serviceItem.serviceInstance.serviceInstanceLocationId = "dhv-test-service-instance-location-id1"; + serviceItem.serviceInstance.resourceVersion = "1485366092"; + serviceItem.extraProperties = new AAINQExtraProperties(); + serviceItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-name", "service-instance")); + serviceItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-type", "widget")); + serviceItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-version", "1.0")); + serviceItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); + serviceItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); + + AAINQInventoryResponseItem vfModuleItem = new AAINQInventoryResponseItem(); + vfModuleItem.modelName = "vf-module"; + vfModuleItem.vfModule = new AAINQVfModule(); + vfModuleItem.vfModule.vfModuleId = "example-vf-module-id-val-49261"; + vfModuleItem.vfModule.vfModuleName = "example-vf-module-name-val-73074"; + vfModuleItem.vfModule.heatStackId = "example-heat-stack-id-val-86300"; + vfModuleItem.vfModule.orchestrationStatus = "example-orchestration-status-val-56523"; + vfModuleItem.vfModule.isBaseVfModule = true; + vfModuleItem.vfModule.resourceVersion = "1485366450"; + vfModuleItem.vfModule.personaModelId = "ef86f9c5-2165-44f3-8fc3-96018b609ea5"; + vfModuleItem.vfModule.personaModelVersion = "1.0"; + vfModuleItem.vfModule.widgetModelId = "example-widget-model-id-val-92571"; + vfModuleItem.vfModule.widgetModelVersion = "example-widget-model-version-val-83317"; + vfModuleItem.vfModule.contrailServiceInstanceFqdn = "example-contrail-service-instance-fqdn-val-86796"; + vfModuleItem.extraProperties = new AAINQExtraProperties(); + vfModuleItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-name", "vf-module")); + vfModuleItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-type", "widget")); + vfModuleItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-version", "1.0")); + vfModuleItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); + vfModuleItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a")); + + aaiNQInventoryResponseItems.inventoryResponseItems.add(serviceItem); + aaiNQInventoryResponseItems.inventoryResponseItems.add(vfModuleItem); + aaiNQInventoryResponseItem.items = aaiNQInventoryResponseItems; + aaiNQInventoryResponseItem.modelName = "model-name"; + AAINQServiceInstance serviceInstance = new AAINQServiceInstance(); + serviceInstance.serviceInstanceID = "dhv-test-vhnfportal-service-instance-id"; + serviceInstance.serviceInstanceName = "dhv-test-service-instance-name1"; + serviceInstance.personaModelId = "82194af1-3c2c-485a-8f44-420e22a9eaa4"; + serviceInstance.personaModelVersion = "1.0"; + serviceInstance.serviceInstanceLocationId = "dhv-test-service-instance-location-id1"; + serviceInstance.resourceVersion = "1485366092"; + aaiNQInventoryResponseItem.serviceInstance = serviceInstance; + AAINQTenant aaiNQTenant = new AAINQTenant(); + aaiNQTenant.tenantId = "dhv-test-tenant"; + aaiNQTenant.tenantName = "dhv-test-tenant-name"; + aaiNQTenant.resourceVersion = "1485366334"; + aaiNQInventoryResponseItem.tenant = aaiNQTenant; + AAINQVfModule aaiNQVfModule = new AAINQVfModule(); + aaiNQVfModule.vfModuleId = "example-vf-module-id-val-49261"; + aaiNQVfModule.vfModuleName = "example-vf-module-name-val-73074"; + aaiNQVfModule.heatStackId = "example-heat-stack-id-val-86300"; + aaiNQVfModule.orchestrationStatus = "example-orchestration-status-val-56523"; + aaiNQVfModule.isBaseVfModule = true; + aaiNQVfModule.resourceVersion = "1485366450"; + aaiNQVfModule.personaModelId = "ef86f9c5-2165-44f3-8fc3-96018b609ea5"; + aaiNQVfModule.personaModelVersion = "1.0"; + aaiNQVfModule.widgetModelId = "example-widget-model-id-val-92571"; + aaiNQVfModule.widgetModelVersion = "example-widget-model-version-val-83317"; + aaiNQVfModule.contrailServiceInstanceFqdn = "example-contrail-service-instance-fqdn-val-86796"; + aaiNQInventoryResponseItem.vfModule = aaiNQVfModule; + AAINQVServer aaiNQVServer = new AAINQVServer(); + aaiNQVServer.vserverId = "dhv-test-vserver"; + aaiNQVServer.vserverName = "dhv-test-vserver-name"; + aaiNQVServer.vserverName2 = "dhv-test-vserver-name2"; + aaiNQVServer.provStatus = "PREPROV"; + aaiNQVServer.vserverSelflink = "dhv-test-vserver-selflink"; + aaiNQVServer.inMaint = false; + aaiNQVServer.isClosedLoopDisabled = false; + aaiNQVServer.resourceVersion = "1485366417"; + aaiNQInventoryResponseItem.vserver = aaiNQVServer; + assertNotNull(aaiNQInventoryResponseItem); + + logger.info(Serialization.gsonPretty.toJson(aaiNQInventoryResponseItem)); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemsTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemsTest.java new file mode 100644 index 000000000..89ce586b6 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemsTest.java @@ -0,0 +1,149 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import java.util.LinkedList; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AAINQInventoryResponseItemsTest { + private static final Logger logger = LoggerFactory.getLogger(AAINQInventoryResponseItemsTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + AAINQInventoryResponseItems aaiNQInventoryResponseItems = new AAINQInventoryResponseItems(); + AAINQInventoryResponseItem serviceItem = new AAINQInventoryResponseItem(); + serviceItem.modelName = "service-instance"; + serviceItem.serviceInstance = new AAINQServiceInstance(); + serviceItem.serviceInstance.serviceInstanceID = "dhv-test-vhnfportal-service-instance-id"; + serviceItem.serviceInstance.serviceInstanceName = "dhv-test-service-instance-name1"; + serviceItem.serviceInstance.personaModelId = "82194af1-3c2c-485a-8f44-420e22a9eaa4"; + serviceItem.serviceInstance.personaModelVersion = "1.0"; + serviceItem.serviceInstance.serviceInstanceLocationId = "dhv-test-service-instance-location-id1"; + serviceItem.serviceInstance.resourceVersion = "1485366092"; + serviceItem.extraProperties = new AAINQExtraProperties(); + serviceItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-name", "service-instance")); + serviceItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-type", "widget")); + serviceItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-version", "1.0")); + serviceItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); + serviceItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); + + AAINQInventoryResponseItem vfModuleItem = new AAINQInventoryResponseItem(); + vfModuleItem.modelName = "vf-module"; + vfModuleItem.vfModule = new AAINQVfModule(); + vfModuleItem.vfModule.vfModuleId = "example-vf-module-id-val-49261"; + vfModuleItem.vfModule.vfModuleName = "example-vf-module-name-val-73074"; + vfModuleItem.vfModule.heatStackId = "example-heat-stack-id-val-86300"; + vfModuleItem.vfModule.orchestrationStatus = "example-orchestration-status-val-56523"; + vfModuleItem.vfModule.isBaseVfModule = true; + vfModuleItem.vfModule.resourceVersion = "1485366450"; + vfModuleItem.vfModule.personaModelId = "ef86f9c5-2165-44f3-8fc3-96018b609ea5"; + vfModuleItem.vfModule.personaModelVersion = "1.0"; + vfModuleItem.vfModule.widgetModelId = "example-widget-model-id-val-92571"; + vfModuleItem.vfModule.widgetModelVersion = "example-widget-model-version-val-83317"; + vfModuleItem.vfModule.contrailServiceInstanceFqdn = "example-contrail-service-instance-fqdn-val-86796"; + vfModuleItem.extraProperties = new AAINQExtraProperties(); + vfModuleItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-name", "vf-module")); + vfModuleItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-type", "widget")); + vfModuleItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-version", "1.0")); + vfModuleItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); + vfModuleItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a")); + + AAINQInventoryResponseItem genericVNFItem = new AAINQInventoryResponseItem(); + genericVNFItem.modelName = "generic-vnf"; + genericVNFItem.genericVNF = new AAINQGenericVNF(); + genericVNFItem.genericVNF.vnfID = "dhv-test-gvnf"; + genericVNFItem.genericVNF.vnfName = "dhv-test-gvnf-name"; + genericVNFItem.genericVNF.vnfName2 = "dhv-test-gvnf-name2"; + genericVNFItem.genericVNF.vnfType = "SW"; + genericVNFItem.genericVNF.serviceId = "d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4"; + genericVNFItem.genericVNF.provStatus = "PREPROV"; + genericVNFItem.genericVNF.operationalState = "dhv-test-operational-state"; + genericVNFItem.genericVNF.ipv4OamAddress = "dhv-test-gvnf-ipv4-oam-address"; + genericVNFItem.genericVNF.ipv4Loopback0Address = "dhv-test-gvnfipv4-loopback0-address"; + genericVNFItem.genericVNF.inMaint = false; + genericVNFItem.genericVNF.isClosedLoopDisabled = false; + genericVNFItem.genericVNF.resourceVersion = "1485366450"; + genericVNFItem.genericVNF.encrypedAccessFlag = true; + genericVNFItem.genericVNF.personaModelId = "acc6edd8-a8d4-4b93-afaa-0994068be14c"; + genericVNFItem.genericVNF.personaModelVersion = "1.0"; + genericVNFItem.extraProperties = new AAINQExtraProperties(); + genericVNFItem.extraProperties.extraProperty = new LinkedList<>(); + genericVNFItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-name", "generic-vnf")); + genericVNFItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-type", "widget")); + genericVNFItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-version", "1.0")); + genericVNFItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c")); + genericVNFItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); + genericVNFItem.items = new AAINQInventoryResponseItems(); + genericVNFItem.items.inventoryResponseItems = new LinkedList<>(); + genericVNFItem.items.inventoryResponseItems.add(serviceItem); + genericVNFItem.items.inventoryResponseItems.add(vfModuleItem); + + AAINQInventoryResponseItem cloudItem = new AAINQInventoryResponseItem(); + cloudItem.cloudRegion = new AAINQCloudRegion(); + cloudItem.cloudRegion.cloudOwner = "OWNER"; + cloudItem.cloudRegion.cloudRegionId = "REGIONID"; + cloudItem.cloudRegion.cloudRegionVersion = "2.5"; + cloudItem.cloudRegion.complexName = "COMPLEXNAME"; + cloudItem.cloudRegion.resourceVersion = "1485365988"; + + AAINQInventoryResponseItem tenantItem = new AAINQInventoryResponseItem(); + tenantItem.tenant = new AAINQTenant(); + tenantItem.tenant.tenantId = "dhv-test-tenant"; + tenantItem.tenant.tenantName = "dhv-test-tenant-name"; + tenantItem.tenant.resourceVersion = "1485366334"; + tenantItem.items = new AAINQInventoryResponseItems(); + tenantItem.items.inventoryResponseItems = new LinkedList<>(); + tenantItem.items.inventoryResponseItems.add(cloudItem); + AAINQInventoryResponseItem vserverItem = new AAINQInventoryResponseItem(); + vserverItem.vserver = new AAINQVServer(); + vserverItem.vserver.vserverId = "dhv-test-vserver"; + vserverItem.vserver.vserverName = "dhv-test-vserver-name"; + vserverItem.vserver.vserverName2 = "dhv-test-vserver-name2"; + vserverItem.vserver.provStatus = "PREPROV"; + vserverItem.vserver.vserverSelflink = "dhv-test-vserver-selflink"; + vserverItem.vserver.inMaint = false; + vserverItem.vserver.isClosedLoopDisabled = false; + vserverItem.vserver.resourceVersion = "1485366417"; + vserverItem.items = new AAINQInventoryResponseItems(); + vserverItem.items.inventoryResponseItems = new LinkedList<>(); + vserverItem.items.inventoryResponseItems.add(genericVNFItem); + vserverItem.items.inventoryResponseItems.add(tenantItem); + aaiNQInventoryResponseItems.inventoryResponseItems.add(vserverItem); + assertNotNull(aaiNQInventoryResponseItems); + logger.info(Serialization.gsonPretty.toJson(aaiNQInventoryResponseItems)); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQNamedQueryTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQNamedQueryTest.java new file mode 100644 index 000000000..5293d4373 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQNamedQueryTest.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import java.util.UUID; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class AAINQNamedQueryTest { + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + AAINQNamedQuery aaiNQNamedQuery = new AAINQNamedQuery(); + aaiNQNamedQuery.namedQueryUUID = UUID.randomUUID(); + assertNotNull(aaiNQNamedQuery); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQQueryParametersTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQQueryParametersTest.java new file mode 100644 index 000000000..7cfa67a2b --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQQueryParametersTest.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import java.util.UUID; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class AAINQQueryParametersTest { + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + AAINQQueryParameters aaiNQQueryParameters = new AAINQQueryParameters(); + AAINQNamedQuery aaiNQNamedQuery = new AAINQNamedQuery(); + aaiNQNamedQuery.namedQueryUUID = UUID.randomUUID(); + aaiNQQueryParameters.namedQuery = aaiNQNamedQuery; + assertNotNull(aaiNQNamedQuery); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestTest.java new file mode 100644 index 000000000..64d93bd95 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestTest.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import java.util.UUID; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AAINQRequestTest { + private static final Logger logger = LoggerFactory.getLogger(AAINQRequestTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + AAINQRequest aaiNQRequest = new AAINQRequest(); + AAINQInstanceFilters aaiNQInstanceFilters = new AAINQInstanceFilters(); + AAINQQueryParameters aaiNQQueryParameters = new AAINQQueryParameters(); + + aaiNQRequest.instanceFilters = aaiNQInstanceFilters; + AAINQNamedQuery aaiNQNamedQuery = new AAINQNamedQuery(); + aaiNQNamedQuery.namedQueryUUID = UUID.randomUUID(); + aaiNQQueryParameters.namedQuery = aaiNQNamedQuery; + aaiNQRequest.queryParameters = aaiNQQueryParameters; + + assertNotNull(aaiNQRequest); + logger.info(Serialization.gsonPretty.toJson(aaiNQRequest)); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseWrapperTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseWrapperTest.java new file mode 100644 index 000000000..ae578f00c --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseWrapperTest.java @@ -0,0 +1,155 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import java.util.LinkedList; +import java.util.UUID; + +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AAINQResponseWrapperTest { + private static final Logger logger = LoggerFactory.getLogger(AAINQResponseWrapperTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + AAINQInventoryResponseItem serviceItem = new AAINQInventoryResponseItem(); + serviceItem.modelName = "service-instance"; + serviceItem.serviceInstance = new AAINQServiceInstance(); + serviceItem.serviceInstance.serviceInstanceID = "dhv-test-vhnfportal-service-instance-id"; + serviceItem.serviceInstance.serviceInstanceName = "dhv-test-service-instance-name1"; + serviceItem.serviceInstance.personaModelId = "82194af1-3c2c-485a-8f44-420e22a9eaa4"; + serviceItem.serviceInstance.personaModelVersion = "1.0"; + serviceItem.serviceInstance.serviceInstanceLocationId = "dhv-test-service-instance-location-id1"; + serviceItem.serviceInstance.resourceVersion = "1485366092"; + serviceItem.extraProperties = new AAINQExtraProperties(); + serviceItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-name", "service-instance")); + serviceItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-type", "widget")); + serviceItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-version", "1.0")); + serviceItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); + serviceItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); + + AAINQInventoryResponseItem vfModuleItem = new AAINQInventoryResponseItem(); + vfModuleItem.modelName = "vf-module"; + vfModuleItem.vfModule = new AAINQVfModule(); + vfModuleItem.vfModule.vfModuleId = "example-vf-module-id-val-49261"; + vfModuleItem.vfModule.vfModuleName = "example-vf-module-name-val-73074"; + vfModuleItem.vfModule.heatStackId = "example-heat-stack-id-val-86300"; + vfModuleItem.vfModule.orchestrationStatus = "example-orchestration-status-val-56523"; + vfModuleItem.vfModule.isBaseVfModule = true; + vfModuleItem.vfModule.resourceVersion = "1485366450"; + vfModuleItem.vfModule.personaModelId = "ef86f9c5-2165-44f3-8fc3-96018b609ea5"; + vfModuleItem.vfModule.personaModelVersion = "1.0"; + vfModuleItem.vfModule.widgetModelId = "example-widget-model-id-val-92571"; + vfModuleItem.vfModule.widgetModelVersion = "example-widget-model-version-val-83317"; + vfModuleItem.vfModule.contrailServiceInstanceFqdn = "example-contrail-service-instance-fqdn-val-86796"; + vfModuleItem.extraProperties = new AAINQExtraProperties(); + vfModuleItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-name", "vf-module")); + vfModuleItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-type", "widget")); + vfModuleItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-version", "1.0")); + vfModuleItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); + vfModuleItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a")); + + AAINQInventoryResponseItem genericVNFItem = new AAINQInventoryResponseItem(); + genericVNFItem.modelName = "generic-vnf"; + genericVNFItem.genericVNF = new AAINQGenericVNF(); + genericVNFItem.genericVNF.vnfID = "dhv-test-gvnf"; + genericVNFItem.genericVNF.vnfName = "dhv-test-gvnf-name"; + genericVNFItem.genericVNF.vnfName2 = "dhv-test-gvnf-name2"; + genericVNFItem.genericVNF.vnfType = "SW"; + genericVNFItem.genericVNF.serviceId = "d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4"; + genericVNFItem.genericVNF.provStatus = "PREPROV"; + genericVNFItem.genericVNF.operationalState = "dhv-test-operational-state"; + genericVNFItem.genericVNF.ipv4OamAddress = "dhv-test-gvnf-ipv4-oam-address"; + genericVNFItem.genericVNF.ipv4Loopback0Address = "dhv-test-gvnfipv4-loopback0-address"; + genericVNFItem.genericVNF.inMaint = false; + genericVNFItem.genericVNF.isClosedLoopDisabled = false; + genericVNFItem.genericVNF.resourceVersion = "1485366450"; + genericVNFItem.genericVNF.encrypedAccessFlag = true; + genericVNFItem.genericVNF.personaModelId = "acc6edd8-a8d4-4b93-afaa-0994068be14c"; + genericVNFItem.genericVNF.personaModelVersion = "1.0"; + genericVNFItem.extraProperties = new AAINQExtraProperties(); + genericVNFItem.extraProperties.extraProperty = new LinkedList<>(); + genericVNFItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-name", "generic-vnf")); + genericVNFItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-type", "widget")); + genericVNFItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-version", "1.0")); + genericVNFItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c")); + genericVNFItem.extraProperties.extraProperty.add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); + genericVNFItem.items = new AAINQInventoryResponseItems(); + genericVNFItem.items.inventoryResponseItems = new LinkedList<>(); + genericVNFItem.items.inventoryResponseItems.add(serviceItem); + genericVNFItem.items.inventoryResponseItems.add(vfModuleItem); + + AAINQInventoryResponseItem cloudItem = new AAINQInventoryResponseItem(); + cloudItem.cloudRegion = new AAINQCloudRegion(); + cloudItem.cloudRegion.cloudOwner = "OWNER"; + cloudItem.cloudRegion.cloudRegionId = "REGIONID"; + cloudItem.cloudRegion.cloudRegionVersion = "2.5"; + cloudItem.cloudRegion.complexName = "COMPLEXNAME"; + cloudItem.cloudRegion.resourceVersion = "1485365988"; + + AAINQInventoryResponseItem tenantItem = new AAINQInventoryResponseItem(); + tenantItem.tenant = new AAINQTenant(); + tenantItem.tenant.tenantId = "dhv-test-tenant"; + tenantItem.tenant.tenantName = "dhv-test-tenant-name"; + tenantItem.tenant.resourceVersion = "1485366334"; + tenantItem.items = new AAINQInventoryResponseItems(); + tenantItem.items.inventoryResponseItems = new LinkedList<>(); + tenantItem.items.inventoryResponseItems.add(cloudItem); + + AAINQInventoryResponseItem vserverItem = new AAINQInventoryResponseItem(); + vserverItem.vserver = new AAINQVServer(); + vserverItem.vserver.vserverId = "dhv-test-vserver"; + vserverItem.vserver.vserverName = "dhv-test-vserver-name"; + vserverItem.vserver.vserverName2 = "dhv-test-vserver-name2"; + vserverItem.vserver.provStatus = "PREPROV"; + vserverItem.vserver.vserverSelflink = "dhv-test-vserver-selflink"; + vserverItem.vserver.inMaint = false; + vserverItem.vserver.isClosedLoopDisabled = false; + vserverItem.vserver.resourceVersion = "1485366417"; + vserverItem.items = new AAINQInventoryResponseItems(); + vserverItem.items.inventoryResponseItems = new LinkedList<>(); + vserverItem.items.inventoryResponseItems.add(genericVNFItem); + vserverItem.items.inventoryResponseItems.add(tenantItem); + + AAINQResponse aaiResponse = new AAINQResponse(); + aaiResponse.inventoryResponseItems.add(vserverItem); + AAINQResponseWrapper aaiNQResponseWarapper = new AAINQResponseWrapper(); + aaiNQResponseWarapper.aainqresponse = aaiResponse; + aaiNQResponseWarapper.requestID = UUID.randomUUID(); + assertNotNull(aaiNQResponseWarapper); + logger.info(Serialization.gsonPretty.toJson(aaiNQResponseWarapper)); + } +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQServiceInstanceTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQServiceInstanceTest.java new file mode 100644 index 000000000..3f04abc63 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQServiceInstanceTest.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AAINQServiceInstanceTest { + private static final Logger logger = LoggerFactory.getLogger(AAINQServiceInstanceTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + AAINQServiceInstance aaiNQServiceInstance = new AAINQServiceInstance(); + aaiNQServiceInstance.serviceInstanceID = "dhv-test-vhnfportal-service-instance-id"; + aaiNQServiceInstance.serviceInstanceName = "dhv-test-service-instance-name1"; + aaiNQServiceInstance.personaModelId = "82194af1-3c2c-485a-8f44-420e22a9eaa4"; + aaiNQServiceInstance.personaModelVersion = "1.0"; + aaiNQServiceInstance.serviceInstanceLocationId = "dhv-test-service-instance-location-id1"; + aaiNQServiceInstance.resourceVersion = "1485366092"; + assertNotNull(aaiNQServiceInstance); + logger.info(Serialization.gsonPretty.toJson(aaiNQServiceInstance)); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQTenantTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQTenantTest.java new file mode 100644 index 000000000..f803db889 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQTenantTest.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AAINQTenantTest { + private static final Logger logger = LoggerFactory.getLogger(AAINQTenantTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + AAINQTenant aaiNQTenant = new AAINQTenant(); + aaiNQTenant.tenantId = "dhv-test-tenant"; + aaiNQTenant.tenantName = "dhv-test-tenant-name"; + aaiNQTenant.resourceVersion = "1485366334"; + assertNotNull(aaiNQTenant); + logger.info(Serialization.gsonPretty.toJson(aaiNQTenant)); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVServerTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVServerTest.java new file mode 100644 index 000000000..e8c39e95e --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVServerTest.java @@ -0,0 +1,58 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AAINQVServerTest { + private static final Logger logger = LoggerFactory.getLogger(AAINQVServerTest.class); + + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + AAINQVServer aaiNQVServer = new AAINQVServer(); + aaiNQVServer.vserverId = "dhv-test-vserver"; + aaiNQVServer.vserverName = "dhv-test-vserver-name"; + aaiNQVServer.vserverName2 = "dhv-test-vserver-name2"; + aaiNQVServer.provStatus = "PREPROV"; + aaiNQVServer.vserverSelflink = "dhv-test-vserver-selflink"; + aaiNQVServer.inMaint = false; + aaiNQVServer.isClosedLoopDisabled = false; + aaiNQVServer.resourceVersion = "1485366417"; + assertNotNull(aaiNQVServer); + logger.info(Serialization.gsonPretty.toJson(aaiNQVServer)); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVfModuleTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVfModuleTest.java new file mode 100644 index 000000000..b4bde7022 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVfModuleTest.java @@ -0,0 +1,61 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AAINQVfModuleTest { + private static final Logger logger = LoggerFactory.getLogger(AAINQVfModuleTest.class); + + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + AAINQVfModule aaiNQVfModule = new AAINQVfModule(); + aaiNQVfModule.vfModuleId = "example-vf-module-id-val-49261"; + aaiNQVfModule.vfModuleName = "example-vf-module-name-val-73074"; + aaiNQVfModule.heatStackId = "example-heat-stack-id-val-86300"; + aaiNQVfModule.orchestrationStatus = "example-orchestration-status-val-56523"; + aaiNQVfModule.isBaseVfModule = true; + aaiNQVfModule.resourceVersion = "1485366450"; + aaiNQVfModule.personaModelId = "ef86f9c5-2165-44f3-8fc3-96018b609ea5"; + aaiNQVfModule.personaModelVersion = "1.0"; + aaiNQVfModule.widgetModelId = "example-widget-model-id-val-92571"; + aaiNQVfModule.widgetModelVersion = "example-widget-model-version-val-83317"; + aaiNQVfModule.contrailServiceInstanceFqdn = "example-contrail-service-instance-fqdn-val-86796"; + assertNotNull(aaiNQVfModule); + logger.info(Serialization.gsonPretty.toJson(aaiNQVfModule)); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFInstanceTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFInstanceTest.java new file mode 100644 index 000000000..4dccca852 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFInstanceTest.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PNFInstanceTest { + private static final Logger logger = LoggerFactory.getLogger(PNFInstanceTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + PNFInstance pnfInstance = new PNFInstance(); + pnfInstance.PNFInstanceName = "pnf-instance-name-test"; + pnfInstance.PNFName = "pnf-name-test"; + pnfInstance.PNFSerial = "pnf-serial-test"; + assertNotNull(pnfInstance); + logger.info(Serialization.gsonPretty.toJson(pnfInstance)); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTest.java new file mode 100644 index 000000000..e63250f3f --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTest.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PNFTest { + private static final Logger logger = LoggerFactory.getLogger(PNFTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + PNF pnf = new PNF(); + pnf.PNFName = "pnf-name-test"; + pnf.PNFType = PNFType.ENODEB; + assertNotNull(pnf); + logger.info(Serialization.gsonPretty.toJson(pnf)); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTypeTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTypeTest.java new file mode 100644 index 000000000..e4c5acc12 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTypeTest.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PNFTypeTest { + private static final Logger logger = LoggerFactory.getLogger(PNFTypeTest.class); + + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + PNFType pnfType = PNFType.ENODEB; + assertNotNull(pnfType); + logger.info(Serialization.gsonPretty.toJson(pnfType)); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyItemTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyItemTest.java new file mode 100644 index 000000000..8a35c42ab --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyItemTest.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class RelatedToPropertyItemTest { + private static final Logger logger = LoggerFactory.getLogger(RelatedToPropertyItemTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); + relatedToPropertyItem.propertyKey = "model.model-name"; + relatedToPropertyItem.propertyValue = "service-instance"; + assertNotNull(relatedToPropertyItem); + logger.info(Serialization.gsonPretty.toJson(relatedToPropertyItem)); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java new file mode 100644 index 000000000..9ead0cffa --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelatedToPropertyTest.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class RelatedToPropertyTest { + private static final Logger logger = LoggerFactory.getLogger(RelatedToPropertyTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + RelatedToProperty relatedToProperty = new RelatedToProperty(); + RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); + relatedToPropertyItem.propertyKey = "model.model-name"; + relatedToPropertyItem.propertyValue = "service-instance"; + relatedToProperty.relatedTo.add(relatedToPropertyItem); + RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem(); + relatedToPropertyItem2.propertyKey = "model.model-name2"; + relatedToPropertyItem2.propertyValue = "service-instance2"; + relatedToProperty.relatedTo.add(relatedToPropertyItem2); + assertNotNull(relatedToProperty); + logger.info(Serialization.gsonPretty.toJson(relatedToProperty)); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataItemTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataItemTest.java new file mode 100644 index 000000000..dbdce2515 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataItemTest.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class RelationshipDataItemTest { + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); + relationshipDataItem.relationshipKey = "relationship-key"; + relationshipDataItem.relationshipValue = "relationship-value"; + assertNotNull(relationshipDataItem); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java new file mode 100644 index 000000000..4a3d947c0 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipDataTest.java @@ -0,0 +1,58 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class RelationshipDataTest { + private static final Logger logger = LoggerFactory.getLogger(RelationshipDataTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + RelationshipData relationshipData = new RelationshipData(); + RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); + relationshipDataItem.relationshipKey = "relationship-key"; + relationshipDataItem.relationshipValue = "relationship-value"; + assertNotNull(relationshipDataItem); + relationshipData.relationshipData.add(relationshipDataItem); + RelationshipDataItem relationshipDataItem2 = new RelationshipDataItem(); + relationshipDataItem2.relationshipKey = "relationship-key2"; + relationshipDataItem2.relationshipValue = "relationship-value2"; + relationshipData.relationshipData.add(relationshipDataItem2); + assertNotNull(relationshipData); + logger.info(Serialization.gsonPretty.toJson(relationshipData)); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipItemTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipItemTest.java new file mode 100644 index 000000000..2102ebe04 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipItemTest.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class RelationshipItemTest { + private static final Logger logger = LoggerFactory.getLogger(RelationshipItemTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + RelationshipItem relationshipItem = new RelationshipItem(); + RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); + relatedToPropertyItem.propertyKey = "model.model-name"; + relatedToPropertyItem.propertyValue = "service-instance"; + relationshipItem.relatedToProperty.add(relatedToPropertyItem); + assertNotNull(relationshipItem); + logger.info(Serialization.gsonPretty.toJson(relationshipItem)); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java new file mode 100644 index 000000000..3eccb0bdb --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipListTest.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class RelationshipListTest { + private static final Logger logger = LoggerFactory.getLogger(RelationshipListTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + RelationshipList relationshipList = new RelationshipList(); + Relationship relationship = new Relationship(); + relationship.relatedLink = "related-link"; + relationship.relatedTo = "related-to"; + RelatedToProperty relatedToProperty = new RelatedToProperty(); + RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); + relatedToPropertyItem.propertyKey = "model.model-name"; + relatedToPropertyItem.propertyValue = "service-instance"; + relatedToProperty.relatedTo.add(relatedToPropertyItem); + RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem(); + relatedToPropertyItem2.propertyKey = "model.model-name2"; + relatedToPropertyItem2.propertyValue = "service-instance2"; + relatedToProperty.relatedTo.add(relatedToPropertyItem2); + relationship.relatedToProperty = relatedToProperty; + RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); + relationshipDataItem.relationshipKey = "relationship-key"; + relationshipDataItem.relationshipValue = "relationship-value"; + RelationshipData relationshipData = new RelationshipData(); + relationshipData.relationshipData.add(relationshipDataItem); + relationship.relationshipData = relationshipData; + relationshipList.relationshipList.add(relationship); + + assertNotNull(relationshipList); + logger.info(Serialization.gsonPretty.toJson(relationshipList)); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java new file mode 100644 index 000000000..76d3f306b --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/RelationshipTest.java @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.policy.aai; + +import static org.junit.Assert.*; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class RelationshipTest { + private static final Logger logger = LoggerFactory.getLogger(AAINQResponseWrapperTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception { + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + } + + @Test + public void test() { + Relationship relationship = new Relationship(); + relationship.relatedLink = "related-link"; + relationship.relatedTo = "related-to"; + RelatedToProperty relatedToProperty = new RelatedToProperty(); + RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); + relatedToPropertyItem.propertyKey = "model.model-name"; + relatedToPropertyItem.propertyValue = "service-instance"; + relatedToProperty.relatedTo.add(relatedToPropertyItem); + RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem(); + relatedToPropertyItem2.propertyKey = "model.model-name2"; + relatedToPropertyItem2.propertyValue = "service-instance2"; + relatedToProperty.relatedTo.add(relatedToPropertyItem2); + relationship.relatedToProperty = relatedToProperty; + RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); + relationshipDataItem.relationshipKey = "relationship-key"; + relationshipDataItem.relationshipValue = "relationship-value"; + RelationshipData relationshipData = new RelationshipData(); + relationshipData.relationshipData.add(relationshipDataItem); + relationship.relationshipData = relationshipData; + assertNotNull(relationship); + logger.info(Serialization.gsonPretty.toJson(relationship)); + } + +} -- cgit 1.2.3-korg