diff options
Diffstat (limited to 'controlloop/common/model-impl/aai/src/test')
30 files changed, 934 insertions, 495 deletions
diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java index 534dd4791..b5de93ccb 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java @@ -20,7 +20,10 @@ package org.onap.policy.aai; +import static org.junit.Assert.*; + import org.junit.Test; + import org.onap.policy.aai.util.Serialization; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,46 +35,57 @@ public class AAIGETVnfResponseTest { public void test() { AAIGETVnfResponse response = new AAIGETVnfResponse(); - response.vnfID = "83f674e8-7555-44d7-9a39-bdc3770b0491"; - response.vnfName = "lll_vnf_010317"; - response.vnfType = "Basa-122216-Service/VidVsamp12BaseVolume 1"; - response.serviceId = "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"; - response.orchestrationStatus = "Created"; - response.inMaint = "false"; - response.isClosedLoopDisabled = "false"; - response.resourceVersion = "1494001988835"; - response.modelInvariantId = "f18be3cd-d446-456e-9109-121d9b62feaa"; + response.setVnfID("83f674e8-7555-44d7-9a39-bdc3770b0491"); + response.setVnfName("lll_vnf_010317"); + response.setVnfType("Basa-122216-Service/VidVsamp12BaseVolume 1"); + response.setServiceId("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); + response.setOrchestrationStatus("Created"); + response.setInMaint("false"); + response.setIsClosedLoopDisabled("false"); + response.setResourceVersion("1494001988835"); + response.setModelInvariantId("f18be3cd-d446-456e-9109-121d9b62feaa"); + assertEquals(response.getVnfID(), "83f674e8-7555-44d7-9a39-bdc3770b0491"); + assertEquals(response.getVnfName(), "lll_vnf_010317"); + assertEquals(response.getVnfType(), "Basa-122216-Service/VidVsamp12BaseVolume 1"); + assertEquals(response.getServiceId(), "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); + assertEquals(response.getOrchestrationStatus(), "Created"); + assertEquals(response.getInMaint(), "false"); + assertEquals(response.getIsClosedLoopDisabled(), "false"); + assertEquals(response.getResourceVersion(), "1494001988835"); + assertEquals(response.getModelInvariantId(), "f18be3cd-d446-456e-9109-121d9b62feaa"); RelationshipList relationshipList = new RelationshipList(); Relationship relationship = new Relationship(); RelationshipData relationshipData = new RelationshipData(); RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - relationshipDataItem.relationshipKey = "customer.global-customer-id"; - relationshipDataItem.relationshipValue = "MSO_1610_ST"; + relationshipDataItem.setRelationshipKey("customer.global-customer-id"); + relationshipDataItem.setRelationshipValue("MSO_1610_ST"); relationshipData.getRelationshipData().add(relationshipDataItem); - relationshipDataItem.relationshipKey = "service-subscription.service-type"; - relationshipDataItem.relationshipValue = "MSO-dev-service-type"; + relationshipDataItem.setRelationshipKey("service-subscription.service-type"); + relationshipDataItem.setRelationshipValue("MSO-dev-service-type"); relationshipData.getRelationshipData().add(relationshipDataItem); - relationshipDataItem.relationshipKey = "service-instance.service-instance-id"; - relationshipDataItem.relationshipValue = "e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"; + relationshipDataItem.setRelationshipKey("service-instance.service-instance-id"); + relationshipDataItem.setRelationshipValue("e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"); relationshipData.getRelationshipData().add(relationshipDataItem); RelatedToProperty relatedToProperty = new RelatedToProperty(); RelatedToPropertyItem item = new RelatedToPropertyItem(); - item.propertyKey = "service-instance.service-instance-name"; - item.propertyValue = "lll_svc_010317"; + item.setPropertyKey("service-instance.service-instance-name"); + item.setPropertyValue("lll_svc_010317"); relatedToProperty.getRelatedTo().add(item); + assertEquals(item.getPropertyKey(), "service-instance.service-instance-name"); + assertEquals(item.getPropertyValue(), "lll_svc_010317"); - relationship.relatedTo = "service-instance"; - relationship.relatedLink = "/aai/v11/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"; - relationship.relationshipData = relationshipData; - relationship.relatedToProperty = relatedToProperty; + relationship.setRelatedTo("service-instance"); + relationship.setRelatedLink("/aai/v11/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"); + relationship.setRelationshipData(relationshipData); + relationship.setRelatedToProperty(relatedToProperty); relationshipList.getRelationshipList().add(relationship); - response.relationshipList = relationshipList; + response.setRelationshipList(relationshipList); logger.info(Serialization.gsonPretty.toJson(response)); } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java index 1221557dd..7cf0696b5 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java @@ -20,6 +20,9 @@ package org.onap.policy.aai; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + import org.junit.Test; import org.onap.policy.aai.util.Serialization; import org.slf4j.Logger; @@ -32,44 +35,55 @@ public class AAIGETVserverResponseTest { public void test() { AAIGETVserverResponse response = new AAIGETVserverResponse(); - response.vserverID = "d0668d4f-c25e-4a1b-87c4-83845c01efd8"; - response.vserverName = "USMSO1SX7NJ0103UJZZ01-vjunos0"; - response.vserverName2 = "vjunos0"; - response.vserverSelflink = "https://aai-ext1.test.aaa.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/aaa-aic/AAIAIC25/tenants/tenant/USMSO1SX7NJ0103UJZZ01%3A%3AuCPE-VMS/vservers/vserver/d0668d4f-c25e-4a1b-87c4-83845c01efd8"; - response.inMaint = "false"; - response.isClosedLoopDisabled = "false"; - response.resourceVersion = "1494001931513"; + response.setVserverID("d0668d4f-c25e-4a1b-87c4-83845c01efd8"); + response.setVserverName("USMSO1SX7NJ0103UJZZ01-vjunos0"); + response.setVserverName2("vjunos0"); + response.setVserverSelflink("https://aai-ext1.test.aaa.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/aaa-aic/AAIAIC25/tenants/tenant/USMSO1SX7NJ0103UJZZ01%3A%3AuCPE-VMS/vservers/vserver/d0668d4f-c25e-4a1b-87c4-83845c01efd8"); + response.setInMaint("false"); + response.setIsClosedLoopDisabled("false"); + response.setResourceVersion("1494001931513"); - RelationshipList relationshipList = new RelationshipList(); + assertEquals(response.getVserverID(), "d0668d4f-c25e-4a1b-87c4-83845c01efd8"); + assertEquals(response.getVserverName(), "USMSO1SX7NJ0103UJZZ01-vjunos0"); + assertEquals(response.getVserverName2(), "vjunos0"); + assertEquals(response.getVserverSelflink(), "https://aai-ext1.test.aaa.com:8443/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/aaa-aic/AAIAIC25/tenants/tenant/USMSO1SX7NJ0103UJZZ01%3A%3AuCPE-VMS/vservers/vserver/d0668d4f-c25e-4a1b-87c4-83845c01efd8"); + assertEquals(response.getInMaint(), "false"); + assertEquals(response.getIsClosedLoopDisabled(), "false"); + assertEquals(response.getResourceVersion(), "1494001931513"); + + RelationshipList relationshipList = new RelationshipList(); Relationship relationship = new Relationship(); RelationshipData relationshipData = new RelationshipData(); RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - relationshipDataItem.relationshipKey = "customer.global-customer-id"; - relationshipDataItem.relationshipValue = "MSO_1610_ST"; + relationshipDataItem.setRelationshipKey("customer.global-customer-id"); + relationshipDataItem.setRelationshipValue("MSO_1610_ST"); relationshipData.getRelationshipData().add(relationshipDataItem); - relationshipDataItem.relationshipKey = "service-subscription.service-type"; - relationshipDataItem.relationshipValue = "MSO-dev-service-type"; + relationshipDataItem.setRelationshipKey("service-subscription.service-type"); + relationshipDataItem.setRelationshipValue("MSO-dev-service-type"); relationshipData.getRelationshipData().add(relationshipDataItem); - relationshipDataItem.relationshipKey = "service-instance.service-instance-id"; - relationshipDataItem.relationshipValue = "e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"; + relationshipDataItem.setRelationshipKey("service-instance.service-instance-id"); + relationshipDataItem.setRelationshipValue("e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"); relationshipData.getRelationshipData().add(relationshipDataItem); RelatedToProperty relatedToProperty = new RelatedToProperty(); RelatedToPropertyItem item = new RelatedToPropertyItem(); - item.propertyKey = "service-instance.service-instance-name"; - item.propertyValue = "lll_svc_010317"; + item.setPropertyKey("service-instance.service-instance-name"); + item.setPropertyValue("lll_svc_010317"); relatedToProperty.getRelatedTo().add(item); - relationship.relatedTo = "service-instance"; - relationship.relatedLink = "/aai/v11/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"; - relationship.relationshipData = relationshipData; - relationship.relatedToProperty = relatedToProperty; + relationship.setRelatedTo("service-instance"); + relationship.setRelatedLink("/aai/v11/business/customers/customer/MSO_1610_ST/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/e1e9c97c-02c0-4919-9b4c-eb5d5ef68970"); + relationship.setRelationshipData(relationshipData); + relationship.setRelatedToProperty(relatedToProperty); relationshipList.getRelationshipList().add(relationship); - response.relationshipList = relationshipList; + response.setRelationshipList(relationshipList); + assertEquals(response.getRelationshipList(), relationshipList); + response.setRequestError(null); + assertNull(response.getRequestError()); logger.info(Serialization.gsonPretty.toJson(response)); } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIManagerTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIManagerTest.java new file mode 100644 index 000000000..5e1351d13 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIManagerTest.java @@ -0,0 +1,142 @@ +/*- + * ============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 static org.mockito.Mockito.*; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import org.junit.Before; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.onap.policy.rest.RESTManager; +import org.onap.policy.rest.RESTManager.Pair; + +public class AAIManagerTest { + RESTManager restManagerMock; + UUID aaiNQRequestUUID = UUID.randomUUID(); + Pair<Integer, String> httpResponseOK; + Pair<Integer, String> httpResponseErr0; + Pair<Integer, String> httpResponseErr1; + Pair<Integer, String> httpResponseWait; + + @Before + public void beforeTestAAIManager() { + restManagerMock = mock(RESTManager.class); + + Map<String, String> expectedHeaders = new HashMap<>(); + expectedHeaders.put("X-FromAppId", "POLICY"); + expectedHeaders.put("X-TransactionId", aaiNQRequestUUID.toString()); + expectedHeaders.put("Accept", "application/json"); + + AAINQResponse aaiNQResponse = new AAINQResponseTest().getAAINQResponse(); + httpResponseOK = restManagerMock.new Pair<>(200, Serialization.gsonPretty.toJson(aaiNQResponse)); + httpResponseErr0 = restManagerMock.new Pair<>(200, null); + httpResponseErr1 = restManagerMock.new Pair<>(200, "{"); + httpResponseWait = restManagerMock.new Pair<>(503, null); + } + + @Test + public void testAAIManagerAAINQRequest() { + + AAIManager aaiManager = new AAIManager(restManagerMock); + assertNotNull(aaiManager); + + UUID aaiNQUUID = UUID.randomUUID(); + + AAINQQueryParameters aaiNQQueryParameters = new AAINQQueryParameters(); + AAINQNamedQuery aaiNQNamedQuery = new AAINQNamedQuery(); + aaiNQNamedQuery.setNamedQueryUUID(aaiNQUUID); + aaiNQQueryParameters.setNamedQuery(aaiNQNamedQuery); + + AAINQRequest aaiNQRequest = new AAINQRequest(); + aaiNQRequest.setQueryParameters(aaiNQQueryParameters); + + when(restManagerMock.post(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Gale"), anyMap(), anyString(), anyString())).thenReturn(httpResponseOK); + + AAINQResponse aaiNQOKResponse = aaiManager.postQuery("http://somewhere.over.the.rainbow", "Dorothy", "Gale", aaiNQRequest, aaiNQRequestUUID); + assertNotNull(aaiNQOKResponse); + + when(restManagerMock.post(isNull(), eq("Dorothy"), anyString(), anyMap(), anyString(), anyString())).thenReturn(null); + + AAINQResponse aaiNQNullResponse = aaiManager.postQuery(null, "Dorothy", "Gale", null, aaiNQRequestUUID); + assertNull(aaiNQNullResponse); + + when(restManagerMock.post(startsWith("http://somewhere.over.the.rainbow"), eq("Witch"), eq("West"), anyMap(), anyString(), anyString())).thenReturn(httpResponseErr0); + + AAINQResponse aaiNQNOKResponse0 = aaiManager.postQuery("http://somewhere.over.the.rainbow", "Witch", "West", aaiNQRequest, aaiNQRequestUUID); + assertNull(aaiNQNOKResponse0); + + when(restManagerMock.post(startsWith("http://somewhere.under.the.rainbow"), eq("Witch"), eq("West"), anyMap(), anyString(), anyString())).thenReturn(httpResponseErr1); + + AAINQResponse aaiNQNOKResponse1 = aaiManager.postQuery("http://somewhere.under.the.rainbow", "Witch", "West", aaiNQRequest, aaiNQRequestUUID); + assertNull(aaiNQNOKResponse1); + } + + @Test + public void testAAIManagerQueryByVserverName() { + AAIManager aaiManager = new AAIManager(restManagerMock); + assertNotNull(aaiManager); + + UUID vserverNameRequestId = UUID.randomUUID(); + + when(restManagerMock.get(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Gale"), anyMap())).thenReturn(httpResponseOK); + + AAIGETVserverResponse vserverResponse = aaiManager.getQueryByVserverName("http://somewhere.over.the.rainbow", "Dorothy", "Gale", vserverNameRequestId, "vserverName"); + assertNotNull(vserverResponse); + + AAIGETVserverResponse vserverNullResponse = aaiManager.getQueryByVserverName(null, "Dorothy", "Gale", vserverNameRequestId, "vserverName"); + assertNull(vserverNullResponse); + + when(restManagerMock.get(startsWith("http://somewhere.under.the.rainbow"), eq("Witch"), eq("West"), anyMap())).thenReturn(httpResponseErr0); + + AAIGETVserverResponse vserverNOKResponse0 = aaiManager.getQueryByVserverName("http://somewhere.under.the.rainbow", "Witch", "West", vserverNameRequestId, "vserverName"); + assertNull(vserverNOKResponse0); + } + + @Test + public void testAAIManagerQueryByVNFId() { + AAIManager aaiManager = new AAIManager(restManagerMock); + assertNotNull(aaiManager); + + UUID vserverNameRequestId = UUID.randomUUID(); + + when(restManagerMock.get(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Gale"), anyMap())).thenReturn(httpResponseOK); + + AAIGETVnfResponse vnfResponse = aaiManager.getQueryByVnfID("http://somewhere.over.the.rainbow", "Dorothy", "Gale", vserverNameRequestId, "vnfID"); + assertNotNull(vnfResponse); + } + + @Test + public void testAAIManagerQueryByVNFName() { + AAIManager aaiManager = new AAIManager(restManagerMock); + assertNotNull(aaiManager); + + UUID vserverNameRequestId = UUID.randomUUID(); + + when(restManagerMock.get(startsWith("http://somewhere.over.the.rainbow"), eq("Dorothy"), eq("Gale"), anyMap())).thenReturn(httpResponseOK); + + AAIGETVnfResponse vnfResponse = aaiManager.getQueryByVnfID("http://somewhere.over.the.rainbow", "Dorothy", "Gale", vserverNameRequestId, "vnfName"); + assertNotNull(vnfResponse); + } +} 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 index 4c04aa41d..f5c594088 100644 --- 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 @@ -38,11 +38,16 @@ public class AAINQCloudRegionTest { @Test public void test() { AAINQCloudRegion aaiNQCloudRegion = new AAINQCloudRegion(); - aaiNQCloudRegion.cloudOwner = "Rackspace"; - aaiNQCloudRegion.cloudRegionId = "DFW"; - aaiNQCloudRegion.cloudRegionVersion = "v1"; - aaiNQCloudRegion.complexName = "SharedNode"; - aaiNQCloudRegion.resourceVersion = "1504789196021"; + aaiNQCloudRegion.setCloudOwner("Rackspace"); + aaiNQCloudRegion.setCloudRegionId("DFW"); + aaiNQCloudRegion.setCloudRegionVersion("v1"); + aaiNQCloudRegion.setComplexName("SharedNode"); + aaiNQCloudRegion.setResourceVersion("1504789196021"); assertNotNull(aaiNQCloudRegion); + assertEquals(aaiNQCloudRegion.getCloudOwner(), "Rackspace"); + assertEquals(aaiNQCloudRegion.getCloudRegionId(), "DFW"); + assertEquals(aaiNQCloudRegion.getCloudRegionVersion(), "v1"); + assertEquals(aaiNQCloudRegion.getComplexName(), "SharedNode"); + assertEquals(aaiNQCloudRegion.getResourceVersion(), "1504789196021"); } } 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 index f193a8de7..2b6dc7452 100644 --- 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 @@ -38,9 +38,11 @@ public class AAINQExtraPropertyTest { @Test public void test() { AAINQExtraProperty aaiNQExtraProperty = new AAINQExtraProperty(); - aaiNQExtraProperty.propertyName = "model.model-name"; - aaiNQExtraProperty.propertyValue= "service-instance"; + aaiNQExtraProperty.setPropertyName("model.model-name"); + aaiNQExtraProperty.setPropertyValue("service-instance"); assertNotNull(aaiNQExtraProperty); - } + assertEquals(aaiNQExtraProperty.getPropertyName(), "model.model-name"); + assertEquals(aaiNQExtraProperty.getPropertyValue(), "service-instance"); + } } 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 index c99c80e6d..7bd7d0270 100644 --- 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 @@ -38,24 +38,42 @@ public class AAINQGenericVNFTest { @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"; + aaiNQGenericVNF.setEncrypedAccessFlag(true); + aaiNQGenericVNF.setInMaint(false); + aaiNQGenericVNF.setIpv4Loopback0Address("aa"); + aaiNQGenericVNF.setIpv4OamAddress("oamAddress"); + aaiNQGenericVNF.setIsClosedLoopDisabled(false); + aaiNQGenericVNF.setModelInvariantId("653d2caa-7e47-4614-95b3-26c8d82755b8"); + aaiNQGenericVNF.setModelVersionId("98f410f6-4c63-447b-97d2-42508437cec0"); + aaiNQGenericVNF.setOperationalState("active"); + aaiNQGenericVNF.setPersonaModelId("653d2caa-7e47-4614-95b3-26c8d82755b8"); + aaiNQGenericVNF.setPersonaModelVersion("98f410f6-4c63-447b-97d2-42508437cec0"); + aaiNQGenericVNF.setProvStatus("complete"); + aaiNQGenericVNF.setResourceVersion("1505056714553"); + aaiNQGenericVNF.setServiceId("e8cb8968-5411-478b-906a-f28747de72cd"); + aaiNQGenericVNF.setVnfID("ed8b2bce-6b27-4089-992c-4a2c66024bcd"); + aaiNQGenericVNF.setVnfName("vCPEInfraVNF14a"); + aaiNQGenericVNF.setVnfName2("malumabb12"); + aaiNQGenericVNF.setVnfType("vCPEInfraService10/vCPEInfraService10 0"); assertNotNull(aaiNQGenericVNF); + + assertEquals(aaiNQGenericVNF.getEncrypedAccessFlag(), true); + assertEquals(aaiNQGenericVNF.getInMaint(), false); + assertEquals(aaiNQGenericVNF.getIpv4Loopback0Address(), "aa"); + assertEquals(aaiNQGenericVNF.getIpv4OamAddress(), "oamAddress"); + assertEquals(aaiNQGenericVNF.getIsClosedLoopDisabled(), false); + assertEquals(aaiNQGenericVNF.getModelInvariantId(), "653d2caa-7e47-4614-95b3-26c8d82755b8"); + assertEquals(aaiNQGenericVNF.getModelVersionId(), "98f410f6-4c63-447b-97d2-42508437cec0"); + assertEquals(aaiNQGenericVNF.getOperationalState(), "active"); + assertEquals(aaiNQGenericVNF.getPersonaModelId(), "653d2caa-7e47-4614-95b3-26c8d82755b8"); + assertEquals(aaiNQGenericVNF.getPersonaModelVersion(), "98f410f6-4c63-447b-97d2-42508437cec0"); + assertEquals(aaiNQGenericVNF.getProvStatus(), "complete"); + assertEquals(aaiNQGenericVNF.getResourceVersion(), "1505056714553"); + assertEquals(aaiNQGenericVNF.getServiceId(), "e8cb8968-5411-478b-906a-f28747de72cd"); + assertEquals(aaiNQGenericVNF.getVnfID(), "ed8b2bce-6b27-4089-992c-4a2c66024bcd"); + assertEquals(aaiNQGenericVNF.getVnfName(), "vCPEInfraVNF14a"); + assertEquals(aaiNQGenericVNF.getVnfName2(), "malumabb12"); + assertEquals(aaiNQGenericVNF.getVnfType(), "vCPEInfraService10/vCPEInfraService10 0"); } } 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 index 0ca5326e3..f3bceaa16 100644 --- 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 @@ -39,6 +39,10 @@ public class AAINQInstanceFiltersTest { public void test() { AAINQInstanceFilters aaiNQInstanceFilters = new AAINQInstanceFilters(); assertNotNull(aaiNQInstanceFilters); + + aaiNQInstanceFilters.setInstanceFilter(aaiNQInstanceFilters.getInstanceFilter());; + assertNotNull(aaiNQInstanceFilters); + assertNotNull(aaiNQInstanceFilters.getInstanceFilter()); } } 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 index 9dd686409..71f8cef60 100644 --- 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 @@ -43,14 +43,14 @@ public class AAINQInventoryResponseItemTest { @Test public void test() { AAINQInventoryResponseItem aaiNQInventoryResponseItem = new AAINQInventoryResponseItem(); - aaiNQInventoryResponseItem.modelName = "service-instance"; + aaiNQInventoryResponseItem.setModelName("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; + aaiNQCloudRegion.setCloudOwner("OWNER"); + aaiNQCloudRegion.setCloudRegionId("REGIONID"); + aaiNQCloudRegion.setCloudRegionVersion("2.5"); + aaiNQCloudRegion.setComplexName("COMPLEXNAME"); + aaiNQCloudRegion.setResourceVersion("1485365988"); + aaiNQInventoryResponseItem.setCloudRegion(aaiNQCloudRegion); AAINQExtraProperties aaiNQExtraProperties = new AAINQExtraProperties(); aaiNQExtraProperties.setExtraProperty(new LinkedList<>()); aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "generic-vnf")); @@ -58,102 +58,102 @@ public class AAINQInventoryResponseItemTest { aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c")); aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); - aaiNQInventoryResponseItem.extraProperties = aaiNQExtraProperties; + aaiNQInventoryResponseItem.setExtraProperties(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; + aaiNQGenericVNF.setVnfID("dhv-test-gvnf"); + aaiNQGenericVNF.setVnfName("dhv-test-gvnf-name"); + aaiNQGenericVNF.setVnfName2("dhv-test-gvnf-name2"); + aaiNQGenericVNF.setVnfType("SW"); + aaiNQGenericVNF.setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4"); + aaiNQGenericVNF.setProvStatus("PREPROV"); + aaiNQGenericVNF.setOperationalState("dhv-test-operational-state"); + aaiNQGenericVNF.setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address"); + aaiNQGenericVNF.setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address"); + aaiNQGenericVNF.setInMaint(false); + aaiNQGenericVNF.setIsClosedLoopDisabled(false); + aaiNQGenericVNF.setResourceVersion("1485366450"); + aaiNQGenericVNF.setEncrypedAccessFlag(true); + aaiNQGenericVNF.setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c"); + aaiNQGenericVNF.setPersonaModelVersion("1.0"); + aaiNQInventoryResponseItem.setGenericVNF(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.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); + serviceItem.setModelName("service-instance"); + serviceItem.setServiceInstance(new AAINQServiceInstance()); + serviceItem.getServiceInstance().setServiceInstanceID("dhv-test-vhnfportal-service-instance-id"); + serviceItem.getServiceInstance().setServiceInstanceName("dhv-test-service-instance-name1"); + serviceItem.getServiceInstance().setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4"); + serviceItem.getServiceInstance().setPersonaModelVersion("1.0"); + serviceItem.getServiceInstance().setServiceInstanceLocationId("dhv-test-service-instance-location-id1"); + serviceItem.getServiceInstance().setResourceVersion("1485366092"); + serviceItem.setExtraProperties(new AAINQExtraProperties()); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); + serviceItem.getExtraProperties().getExtraProperty().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.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a")); + vfModuleItem.setModelName("vf-module"); + vfModuleItem.setVfModule(new AAINQVfModule()); + vfModuleItem.getVfModule().setVfModuleId("example-vf-module-id-val-49261"); + vfModuleItem.getVfModule().setVfModuleName("example-vf-module-name-val-73074"); + vfModuleItem.getVfModule().setHeatStackId("example-heat-stack-id-val-86300"); + vfModuleItem.getVfModule().setOrchestrationStatus("example-orchestration-status-val-56523"); + vfModuleItem.getVfModule().setIsBaseVfModule(true); + vfModuleItem.getVfModule().setResourceVersion("1485366450"); + vfModuleItem.getVfModule().setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5"); + vfModuleItem.getVfModule().setPersonaModelVersion("1.0"); + vfModuleItem.getVfModule().setWidgetModelId("example-widget-model-id-val-92571"); + vfModuleItem.getVfModule().setWidgetModelVersion("example-widget-model-version-val-83317"); + vfModuleItem.getVfModule().setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796"); + vfModuleItem.setExtraProperties(new AAINQExtraProperties()); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a")); aaiNQInventoryResponseItems.getInventoryResponseItems().add(serviceItem); aaiNQInventoryResponseItems.getInventoryResponseItems().add(vfModuleItem); - aaiNQInventoryResponseItem.items = aaiNQInventoryResponseItems; - aaiNQInventoryResponseItem.modelName = "model-name"; + aaiNQInventoryResponseItem.setItems(aaiNQInventoryResponseItems); + aaiNQInventoryResponseItem.setModelName("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; + serviceInstance.setServiceInstanceID("dhv-test-vhnfportal-service-instance-id"); + serviceInstance.setServiceInstanceName("dhv-test-service-instance-name1"); + serviceInstance.setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4"); + serviceInstance.setPersonaModelVersion("1.0"); + serviceInstance.setServiceInstanceLocationId("dhv-test-service-instance-location-id1"); + serviceInstance.setResourceVersion("1485366092"); + aaiNQInventoryResponseItem.setServiceInstance(serviceInstance); AAINQTenant aaiNQTenant = new AAINQTenant(); - aaiNQTenant.tenantId = "dhv-test-tenant"; - aaiNQTenant.tenantName = "dhv-test-tenant-name"; - aaiNQTenant.resourceVersion = "1485366334"; - aaiNQInventoryResponseItem.tenant = aaiNQTenant; + aaiNQTenant.setTenantId("dhv-test-tenant"); + aaiNQTenant.setTenantName("dhv-test-tenant-name"); + aaiNQTenant.setResourceVersion("1485366334"); + aaiNQInventoryResponseItem.setTenant(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; + aaiNQVfModule.setVfModuleId("example-vf-module-id-val-49261"); + aaiNQVfModule.setVfModuleName("example-vf-module-name-val-73074"); + aaiNQVfModule.setHeatStackId("example-heat-stack-id-val-86300"); + aaiNQVfModule.setOrchestrationStatus("example-orchestration-status-val-56523"); + aaiNQVfModule.setIsBaseVfModule(true); + aaiNQVfModule.setResourceVersion("1485366450"); + aaiNQVfModule.setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5"); + aaiNQVfModule.setPersonaModelVersion("1.0"); + aaiNQVfModule.setWidgetModelId("example-widget-model-id-val-92571"); + aaiNQVfModule.setWidgetModelVersion("example-widget-model-version-val-83317"); + aaiNQVfModule.setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796"); + aaiNQInventoryResponseItem.setVfModule(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; + aaiNQVServer.setVserverId("dhv-test-vserver"); + aaiNQVServer.setVserverName("dhv-test-vserver-name"); + aaiNQVServer.setVserverName2("dhv-test-vserver-name2"); + aaiNQVServer.setProvStatus("PREPROV"); + aaiNQVServer.setVserverSelflink("dhv-test-vserver-selflink"); + aaiNQVServer.setInMaint(false); + aaiNQVServer.setIsClosedLoopDisabled(false); + aaiNQVServer.setResourceVersion("1485366417"); + aaiNQInventoryResponseItem.setVserver(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 index df6b19959..422824330 100644 --- 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 @@ -45,102 +45,104 @@ public class AAINQInventoryResponseItemsTest { 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.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); + serviceItem.setModelName("service-instance"); + assertEquals(serviceItem.getModelName(), "service-instance"); + + serviceItem.setServiceInstance(new AAINQServiceInstance()); + serviceItem.getServiceInstance().setServiceInstanceID("dhv-test-vhnfportal-service-instance-id"); + serviceItem.getServiceInstance().setServiceInstanceName("dhv-test-service-instance-name1"); + serviceItem.getServiceInstance().setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4"); + serviceItem.getServiceInstance().setPersonaModelVersion("1.0"); + serviceItem.getServiceInstance().setServiceInstanceLocationId("dhv-test-service-instance-location-id1"); + serviceItem.getServiceInstance().setResourceVersion("1485366092"); + serviceItem.setExtraProperties(new AAINQExtraProperties()); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); + serviceItem.getExtraProperties().getExtraProperty().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.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a")); + vfModuleItem.setModelName("vf-module"); + vfModuleItem.setVfModule(new AAINQVfModule()); + vfModuleItem.getVfModule().setVfModuleId("example-vf-module-id-val-49261"); + vfModuleItem.getVfModule().setVfModuleName("example-vf-module-name-val-73074"); + vfModuleItem.getVfModule().setHeatStackId("example-heat-stack-id-val-86300"); + vfModuleItem.getVfModule().setOrchestrationStatus("example-orchestration-status-val-56523"); + vfModuleItem.getVfModule().setIsBaseVfModule(true); + vfModuleItem.getVfModule().setResourceVersion("1485366450"); + vfModuleItem.getVfModule().setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5"); + vfModuleItem.getVfModule().setPersonaModelVersion("1.0"); + vfModuleItem.getVfModule().setWidgetModelId("example-widget-model-id-val-92571"); + vfModuleItem.getVfModule().setWidgetModelVersion("example-widget-model-version-val-83317"); + vfModuleItem.getVfModule().setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796"); + vfModuleItem.setExtraProperties(new AAINQExtraProperties()); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); + vfModuleItem.getExtraProperties().getExtraProperty().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.setExtraProperty(new LinkedList<>()); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "generic-vnf")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); - genericVNFItem.items = new AAINQInventoryResponseItems(); - genericVNFItem.items.setInventoryResponseItems(new LinkedList<>()); - genericVNFItem.items.getInventoryResponseItems().add(serviceItem); - genericVNFItem.items.getInventoryResponseItems().add(vfModuleItem); + genericVNFItem.setModelName("generic-vnf"); + genericVNFItem.setGenericVNF(new AAINQGenericVNF()); + genericVNFItem.getGenericVNF().setVnfID("dhv-test-gvnf"); + genericVNFItem.getGenericVNF().setVnfName("dhv-test-gvnf-name"); + genericVNFItem.getGenericVNF().setVnfName2("dhv-test-gvnf-name2"); + genericVNFItem.getGenericVNF().setVnfType("SW"); + genericVNFItem.getGenericVNF().setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4"); + genericVNFItem.getGenericVNF().setProvStatus("PREPROV"); + genericVNFItem.getGenericVNF().setOperationalState("dhv-test-operational-state"); + genericVNFItem.getGenericVNF().setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address"); + genericVNFItem.getGenericVNF().setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address"); + genericVNFItem.getGenericVNF().setInMaint(false); + genericVNFItem.getGenericVNF().setIsClosedLoopDisabled(false); + genericVNFItem.getGenericVNF().setResourceVersion("1485366450"); + genericVNFItem.getGenericVNF().setEncrypedAccessFlag(true); + genericVNFItem.getGenericVNF().setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c"); + genericVNFItem.getGenericVNF().setPersonaModelVersion("1.0"); + genericVNFItem.setExtraProperties(new AAINQExtraProperties()); + genericVNFItem.getExtraProperties().setExtraProperty(new LinkedList<>()); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "generic-vnf")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); + genericVNFItem.setItems(new AAINQInventoryResponseItems()); + genericVNFItem.getItems().setInventoryResponseItems(new LinkedList<>()); + genericVNFItem.getItems().getInventoryResponseItems().add(serviceItem); + genericVNFItem.getItems().getInventoryResponseItems().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"; + cloudItem.setCloudRegion(new AAINQCloudRegion()); + cloudItem.getCloudRegion().setCloudOwner("OWNER"); + cloudItem.getCloudRegion().setCloudRegionId("REGIONID"); + cloudItem.getCloudRegion().setCloudRegionVersion("2.5"); + cloudItem.getCloudRegion().setComplexName("COMPLEXNAME"); + cloudItem.getCloudRegion().setResourceVersion("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.setInventoryResponseItems(new LinkedList<>()); - tenantItem.items.getInventoryResponseItems().add(cloudItem); + tenantItem.setTenant(new AAINQTenant()); + tenantItem.getTenant().setTenantId("dhv-test-tenant"); + tenantItem.getTenant().setTenantName("dhv-test-tenant-name"); + tenantItem.getTenant().setResourceVersion("1485366334"); + tenantItem.setItems(new AAINQInventoryResponseItems()); + tenantItem.getItems().setInventoryResponseItems(new LinkedList<>()); + tenantItem.getItems().getInventoryResponseItems().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.setInventoryResponseItems(new LinkedList<>()); - vserverItem.items.getInventoryResponseItems().add(genericVNFItem); - vserverItem.items.getInventoryResponseItems().add(tenantItem); + vserverItem.setVserver(new AAINQVServer()); + vserverItem.getVserver().setVserverId("dhv-test-vserver"); + vserverItem.getVserver().setVserverName("dhv-test-vserver-name"); + vserverItem.getVserver().setVserverName2("dhv-test-vserver-name2"); + vserverItem.getVserver().setProvStatus("PREPROV"); + vserverItem.getVserver().setVserverSelflink("dhv-test-vserver-selflink"); + vserverItem.getVserver().setInMaint(false); + vserverItem.getVserver().setIsClosedLoopDisabled(false); + vserverItem.getVserver().setResourceVersion("1485366417"); + vserverItem.setItems(new AAINQInventoryResponseItems()); + vserverItem.getItems().setInventoryResponseItems(new LinkedList<>()); + vserverItem.getItems().getInventoryResponseItems().add(genericVNFItem); + vserverItem.getItems().getInventoryResponseItems().add(tenantItem); aaiNQInventoryResponseItems.getInventoryResponseItems().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 index 5293d4373..510683387 100644 --- 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 @@ -40,8 +40,9 @@ public class AAINQNamedQueryTest { @Test public void test() { AAINQNamedQuery aaiNQNamedQuery = new AAINQNamedQuery(); - aaiNQNamedQuery.namedQueryUUID = UUID.randomUUID(); + UUID uuid = UUID.randomUUID(); + aaiNQNamedQuery.setNamedQueryUUID(uuid); assertNotNull(aaiNQNamedQuery); + assertEquals(aaiNQNamedQuery.getNamedQueryUUID(), uuid); } - } 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 index 7cfa67a2b..0561fa690 100644 --- 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 @@ -41,9 +41,10 @@ public class AAINQQueryParametersTest { public void test() { AAINQQueryParameters aaiNQQueryParameters = new AAINQQueryParameters(); AAINQNamedQuery aaiNQNamedQuery = new AAINQNamedQuery(); - aaiNQNamedQuery.namedQueryUUID = UUID.randomUUID(); - aaiNQQueryParameters.namedQuery = aaiNQNamedQuery; + aaiNQNamedQuery.setNamedQueryUUID(UUID.randomUUID()); + aaiNQQueryParameters.setNamedQuery(aaiNQNamedQuery); assertNotNull(aaiNQNamedQuery); + assertEquals(aaiNQQueryParameters.getNamedQuery(), aaiNQNamedQuery); } } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestErrorTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestErrorTest.java new file mode 100644 index 000000000..d13689814 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestErrorTest.java @@ -0,0 +1,39 @@ +/*- + * ============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.Test; + +public class AAINQRequestErrorTest { + + @Test + public void test() { + AAINQRequestError aainqRequestError = new AAINQRequestError(); + AAINQServiceExcept serviceExcept = new AAINQServiceExcept(); + aainqRequestError.setServiceExcept(serviceExcept); + assertEquals(aainqRequestError.getServiceExcept(), serviceExcept); + + assertNull(serviceExcept.getMessageId()); + assertNull(serviceExcept.getText()); + assertNull(serviceExcept.getVariables()); + } +} 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 index 64d93bd95..64e722613 100644 --- 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 @@ -47,13 +47,20 @@ public class AAINQRequestTest { 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; + aaiNQRequest.setInstanceFilters(aaiNQInstanceFilters); + assertNotNull(aaiNQRequest.getInstanceFilters()); + AAINQNamedQuery aaiNQNamedQuery = new AAINQNamedQuery(); + UUID uuid = UUID.randomUUID(); + aaiNQNamedQuery.setNamedQueryUUID(uuid); + aaiNQQueryParameters.setNamedQuery(aaiNQNamedQuery); + aaiNQRequest.setQueryParameters(aaiNQQueryParameters); assertNotNull(aaiNQRequest); + + assertEquals(aaiNQNamedQuery.getNamedQueryUUID(), uuid); + assertEquals(aaiNQQueryParameters.getNamedQuery(), aaiNQNamedQuery); + assertEquals(aaiNQRequest.getQueryParameters(), aaiNQQueryParameters); + logger.info(Serialization.gsonPretty.toJson(aaiNQRequest)); } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseTest.java index 5e59429c2..e481f0aca 100644 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseTest.java +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseTest.java @@ -31,107 +31,113 @@ public class AAINQResponseTest { @Test public void Test() { + getAAINQResponse(); + } + + public AAINQResponse getAAINQResponse() { 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.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); + serviceItem.setModelName("service-instance"); + serviceItem.setServiceInstance(new AAINQServiceInstance()); + serviceItem.getServiceInstance().setServiceInstanceID("dhv-test-vhnfportal-service-instance-id"); + serviceItem.getServiceInstance().setServiceInstanceName("dhv-test-service-instance-name1"); + serviceItem.getServiceInstance().setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4"); + serviceItem.getServiceInstance().setPersonaModelVersion("1.0"); + serviceItem.getServiceInstance().setServiceInstanceLocationId("dhv-test-service-instance-location-id1"); + serviceItem.getServiceInstance().setResourceVersion("1485366092"); + serviceItem.setExtraProperties(new AAINQExtraProperties()); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); + serviceItem.getExtraProperties().getExtraProperty().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.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a")); + vfModuleItem.setModelName("vf-module"); + vfModuleItem.setVfModule(new AAINQVfModule()); + vfModuleItem.getVfModule().setVfModuleId("example-vf-module-id-val-49261"); + vfModuleItem.getVfModule().setVfModuleName("example-vf-module-name-val-73074"); + vfModuleItem.getVfModule().setHeatStackId("example-heat-stack-id-val-86300"); + vfModuleItem.getVfModule().setOrchestrationStatus("example-orchestration-status-val-56523"); + vfModuleItem.getVfModule().setIsBaseVfModule(true); + vfModuleItem.getVfModule().setResourceVersion("1485366450"); + vfModuleItem.getVfModule().setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5"); + vfModuleItem.getVfModule().setPersonaModelVersion("1.0"); + vfModuleItem.getVfModule().setWidgetModelId("example-widget-model-id-val-92571"); + vfModuleItem.getVfModule().setWidgetModelVersion("example-widget-model-version-val-83317"); + vfModuleItem.getVfModule().setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796"); + vfModuleItem.setExtraProperties(new AAINQExtraProperties()); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); + vfModuleItem.getExtraProperties().getExtraProperty().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.setExtraProperty(new LinkedList<>()); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "generic-vnf")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); - genericVNFItem.items = new AAINQInventoryResponseItems(); - genericVNFItem.items.setInventoryResponseItems(new LinkedList<>()); - genericVNFItem.items.getInventoryResponseItems().add(serviceItem); - genericVNFItem.items.getInventoryResponseItems().add(vfModuleItem); + genericVNFItem.setModelName("generic-vnf"); + genericVNFItem.setGenericVNF(new AAINQGenericVNF()); + genericVNFItem.getGenericVNF().setVnfID("dhv-test-gvnf"); + genericVNFItem.getGenericVNF().setVnfName("dhv-test-gvnf-name"); + genericVNFItem.getGenericVNF().setVnfName2("dhv-test-gvnf-name2"); + genericVNFItem.getGenericVNF().setVnfType("SW"); + genericVNFItem.getGenericVNF().setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4"); + genericVNFItem.getGenericVNF().setProvStatus("PREPROV"); + genericVNFItem.getGenericVNF().setOperationalState("dhv-test-operational-state"); + genericVNFItem.getGenericVNF().setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address"); + genericVNFItem.getGenericVNF().setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address"); + genericVNFItem.getGenericVNF().setInMaint(false); + genericVNFItem.getGenericVNF().setIsClosedLoopDisabled(false); + genericVNFItem.getGenericVNF().setResourceVersion("1485366450"); + genericVNFItem.getGenericVNF().setEncrypedAccessFlag(true); + genericVNFItem.getGenericVNF().setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c"); + genericVNFItem.getGenericVNF().setPersonaModelVersion("1.0"); + genericVNFItem.setExtraProperties(new AAINQExtraProperties()); + genericVNFItem.getExtraProperties().setExtraProperty(new LinkedList<>()); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "generic-vnf")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); + genericVNFItem.setItems(new AAINQInventoryResponseItems()); + genericVNFItem.getItems().setInventoryResponseItems(new LinkedList<>()); + genericVNFItem.getItems().getInventoryResponseItems().add(serviceItem); + genericVNFItem.getItems().getInventoryResponseItems().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"; + cloudItem.setCloudRegion(new AAINQCloudRegion()); + cloudItem.getCloudRegion().setCloudOwner("OWNER"); + cloudItem.getCloudRegion().setCloudRegionId("REGIONID"); + cloudItem.getCloudRegion().setCloudRegionVersion("2.5"); + cloudItem.getCloudRegion().setComplexName("COMPLEXNAME"); + cloudItem.getCloudRegion().setResourceVersion("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.setInventoryResponseItems(new LinkedList<>()); - tenantItem.items.getInventoryResponseItems().add(cloudItem); + tenantItem.setTenant(new AAINQTenant()); + tenantItem.getTenant().setTenantId("dhv-test-tenant"); + tenantItem.getTenant().setTenantName("dhv-test-tenant-name"); + tenantItem.getTenant().setResourceVersion("1485366334"); + tenantItem.setItems(new AAINQInventoryResponseItems()); + tenantItem.getItems().setInventoryResponseItems(new LinkedList<>()); + tenantItem.getItems().getInventoryResponseItems().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.setInventoryResponseItems(new LinkedList<>()); - vserverItem.items.getInventoryResponseItems().add(genericVNFItem); - vserverItem.items.getInventoryResponseItems().add(tenantItem); + vserverItem.setVserver(new AAINQVServer()); + vserverItem.getVserver().setVserverId("dhv-test-vserver"); + vserverItem.getVserver().setVserverName("dhv-test-vserver-name"); + vserverItem.getVserver().setVserverName2("dhv-test-vserver-name2"); + vserverItem.getVserver().setProvStatus("PREPROV"); + vserverItem.getVserver().setVserverSelflink("dhv-test-vserver-selflink"); + vserverItem.getVserver().setInMaint(false); + vserverItem.getVserver().setIsClosedLoopDisabled(false); + vserverItem.getVserver().setResourceVersion("1485366417"); + vserverItem.setItems(new AAINQInventoryResponseItems()); + vserverItem.getItems().setInventoryResponseItems(new LinkedList<>()); + vserverItem.getItems().getInventoryResponseItems().add(genericVNFItem); + vserverItem.getItems().getInventoryResponseItems().add(tenantItem); AAINQResponse aaiResponse = new AAINQResponse(); aaiResponse.getInventoryResponseItems().add(vserverItem); logger.info(Serialization.gsonPretty.toJson(aaiResponse)); + + return aaiResponse; } } 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 index 9c4bfafa8..8df71fce1 100644 --- 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 @@ -46,103 +46,103 @@ public class AAINQResponseWrapperTest { @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.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); - serviceItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); + serviceItem.setModelName("service-instance"); + serviceItem.setServiceInstance(new AAINQServiceInstance()); + serviceItem.getServiceInstance().setServiceInstanceID("dhv-test-vhnfportal-service-instance-id"); + serviceItem.getServiceInstance().setServiceInstanceName("dhv-test-service-instance-name1"); + serviceItem.getServiceInstance().setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4"); + serviceItem.getServiceInstance().setPersonaModelVersion("1.0"); + serviceItem.getServiceInstance().setServiceInstanceLocationId("dhv-test-service-instance-location-id1"); + serviceItem.getServiceInstance().setResourceVersion("1485366092"); + serviceItem.setExtraProperties(new AAINQExtraProperties()); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + serviceItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); + serviceItem.getExtraProperties().getExtraProperty().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.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); - vfModuleItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "c00563ae-812b-4e62-8330-7c4d0f47088a")); + vfModuleItem.setModelName("vf-module"); + vfModuleItem.setVfModule(new AAINQVfModule()); + vfModuleItem.getVfModule().setVfModuleId("example-vf-module-id-val-49261"); + vfModuleItem.getVfModule().setVfModuleName("example-vf-module-name-val-73074"); + vfModuleItem.getVfModule().setHeatStackId("example-heat-stack-id-val-86300"); + vfModuleItem.getVfModule().setOrchestrationStatus("example-orchestration-status-val-56523"); + vfModuleItem.getVfModule().setIsBaseVfModule(true); + vfModuleItem.getVfModule().setResourceVersion("1485366450"); + vfModuleItem.getVfModule().setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5"); + vfModuleItem.getVfModule().setPersonaModelVersion("1.0"); + vfModuleItem.getVfModule().setWidgetModelId("example-widget-model-id-val-92571"); + vfModuleItem.getVfModule().setWidgetModelVersion("example-widget-model-version-val-83317"); + vfModuleItem.getVfModule().setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796"); + vfModuleItem.setExtraProperties(new AAINQExtraProperties()); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "vf-module")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + vfModuleItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "ef86f9c5-2165-44f3-8fc3-96018b609ea5")); + vfModuleItem.getExtraProperties().getExtraProperty().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.setExtraProperty(new LinkedList<>()); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "generic-vnf")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c")); - genericVNFItem.extraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); - genericVNFItem.items = new AAINQInventoryResponseItems(); - genericVNFItem.items.setInventoryResponseItems(new LinkedList<>()); - genericVNFItem.items.getInventoryResponseItems().add(serviceItem); - genericVNFItem.items.getInventoryResponseItems().add(vfModuleItem); + genericVNFItem.setModelName("generic-vnf"); + genericVNFItem.setGenericVNF(new AAINQGenericVNF()); + genericVNFItem.getGenericVNF().setVnfID("dhv-test-gvnf"); + genericVNFItem.getGenericVNF().setVnfName("dhv-test-gvnf-name"); + genericVNFItem.getGenericVNF().setVnfName2("dhv-test-gvnf-name2"); + genericVNFItem.getGenericVNF().setVnfType("SW"); + genericVNFItem.getGenericVNF().setServiceId("d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4"); + genericVNFItem.getGenericVNF().setProvStatus("PREPROV"); + genericVNFItem.getGenericVNF().setOperationalState("dhv-test-operational-state"); + genericVNFItem.getGenericVNF().setIpv4OamAddress("dhv-test-gvnf-ipv4-oam-address"); + genericVNFItem.getGenericVNF().setIpv4Loopback0Address("dhv-test-gvnfipv4-loopback0-address"); + genericVNFItem.getGenericVNF().setInMaint(false); + genericVNFItem.getGenericVNF().setIsClosedLoopDisabled(false); + genericVNFItem.getGenericVNF().setResourceVersion("1485366450"); + genericVNFItem.getGenericVNF().setEncrypedAccessFlag(true); + genericVNFItem.getGenericVNF().setPersonaModelId("acc6edd8-a8d4-4b93-afaa-0994068be14c"); + genericVNFItem.getGenericVNF().setPersonaModelVersion("1.0"); + genericVNFItem.setExtraProperties(new AAINQExtraProperties()); + genericVNFItem.getExtraProperties().setExtraProperty(new LinkedList<>()); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name", "generic-vnf")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-id", "acc6edd8-a8d4-4b93-afaa-0994068be14c")); + genericVNFItem.getExtraProperties().getExtraProperty().add(new AAINQExtraProperty("model.model-name-version-id", "93a6166f-b3d5-4f06-b4ba-aed48d009ad9")); + genericVNFItem.setItems(new AAINQInventoryResponseItems()); + genericVNFItem.getItems().setInventoryResponseItems(new LinkedList<>()); + genericVNFItem.getItems().getInventoryResponseItems().add(serviceItem); + genericVNFItem.getItems().getInventoryResponseItems().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"; + cloudItem.setCloudRegion(new AAINQCloudRegion()); + cloudItem.getCloudRegion().setCloudOwner("OWNER"); + cloudItem.getCloudRegion().setCloudRegionId("REGIONID"); + cloudItem.getCloudRegion().setCloudRegionVersion("2.5"); + cloudItem.getCloudRegion().setComplexName("COMPLEXNAME"); + cloudItem.getCloudRegion().setResourceVersion("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.setInventoryResponseItems(new LinkedList<>()); - tenantItem.items.getInventoryResponseItems().add(cloudItem); + tenantItem.setTenant(new AAINQTenant()); + tenantItem.getTenant().setTenantId("dhv-test-tenant"); + tenantItem.getTenant().setTenantName("dhv-test-tenant-name"); + tenantItem.getTenant().setResourceVersion("1485366334"); + tenantItem.setItems(new AAINQInventoryResponseItems()); + tenantItem.getItems().setInventoryResponseItems(new LinkedList<>()); + tenantItem.getItems().getInventoryResponseItems().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.setInventoryResponseItems(new LinkedList<>()); - vserverItem.items.getInventoryResponseItems().add(genericVNFItem); - vserverItem.items.getInventoryResponseItems().add(tenantItem); + vserverItem.setVserver(new AAINQVServer()); + vserverItem.getVserver().setVserverId("dhv-test-vserver"); + vserverItem.getVserver().setVserverName("dhv-test-vserver-name"); + vserverItem.getVserver().setVserverName2("dhv-test-vserver-name2"); + vserverItem.getVserver().setProvStatus("PREPROV"); + vserverItem.getVserver().setVserverSelflink("dhv-test-vserver-selflink"); + vserverItem.getVserver().setInMaint(false); + vserverItem.getVserver().setIsClosedLoopDisabled(false); + vserverItem.getVserver().setResourceVersion("1485366417"); + vserverItem.setItems(new AAINQInventoryResponseItems()); + vserverItem.getItems().setInventoryResponseItems(new LinkedList<>()); + vserverItem.getItems().getInventoryResponseItems().add(genericVNFItem); + vserverItem.getItems().getInventoryResponseItems().add(tenantItem); AAINQResponse aaiResponse = new AAINQResponse(); aaiResponse.getInventoryResponseItems().add(vserverItem); @@ -151,5 +151,13 @@ public class AAINQResponseWrapperTest { aaiNQResponseWarapper.setRequestID(UUID.randomUUID()); assertNotNull(aaiNQResponseWarapper); logger.info(Serialization.gsonPretty.toJson(aaiNQResponseWarapper)); + + AAINQResponse aaiResponse2 = new AAINQResponse(); + aaiResponse2.getInventoryResponseItems().add(vserverItem); + AAINQResponseWrapper aaiNQResponseWarapper2 = new AAINQResponseWrapper(UUID.randomUUID(), aaiResponse); + assertNotNull(aaiNQResponseWarapper2); + assertNotNull(aaiNQResponseWarapper2.getRequestID()); + assertNotNull(aaiNQResponseWarapper2.getAainqresponse()); + logger.info(Serialization.gsonPretty.toJson(aaiNQResponseWarapper2)); } } 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 index 3f04abc63..dcb19a4ef 100644 --- 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 @@ -42,13 +42,23 @@ public class AAINQServiceInstanceTest { @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"; + aaiNQServiceInstance.setServiceInstanceID("dhv-test-vhnfportal-service-instance-id"); + aaiNQServiceInstance.setServiceInstanceName("dhv-test-service-instance-name1"); + aaiNQServiceInstance.setPersonaModelId("82194af1-3c2c-485a-8f44-420e22a9eaa4"); + aaiNQServiceInstance.setPersonaModelVersion("1.0"); + aaiNQServiceInstance.setServiceInstanceLocationId("dhv-test-service-instance-location-id1"); + aaiNQServiceInstance.setResourceVersion("1485366092"); + aaiNQServiceInstance.setModelInvariantId("SomeID"); + aaiNQServiceInstance.setModelVersionId("SomeVersion"); assertNotNull(aaiNQServiceInstance); + assertEquals(aaiNQServiceInstance.getServiceInstanceID(), "dhv-test-vhnfportal-service-instance-id"); + assertEquals(aaiNQServiceInstance.getServiceInstanceName(), "dhv-test-service-instance-name1"); + assertEquals(aaiNQServiceInstance.getPersonaModelId(), "82194af1-3c2c-485a-8f44-420e22a9eaa4"); + assertEquals(aaiNQServiceInstance.getPersonaModelVersion(), "1.0"); + assertEquals(aaiNQServiceInstance.getServiceInstanceLocationId(), "dhv-test-service-instance-location-id1"); + assertEquals(aaiNQServiceInstance.getResourceVersion(), "1485366092"); + assertEquals(aaiNQServiceInstance.getModelInvariantId(), "SomeID"); + assertEquals(aaiNQServiceInstance.getModelVersionId(), "SomeVersion"); 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 index f803db889..c40a46246 100644 --- 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 @@ -42,11 +42,15 @@ public class AAINQTenantTest { @Test public void test() { AAINQTenant aaiNQTenant = new AAINQTenant(); - aaiNQTenant.tenantId = "dhv-test-tenant"; - aaiNQTenant.tenantName = "dhv-test-tenant-name"; - aaiNQTenant.resourceVersion = "1485366334"; + aaiNQTenant.setTenantId("dhv-test-tenant"); + aaiNQTenant.setTenantName("dhv-test-tenant-name"); + aaiNQTenant.setResourceVersion("1485366334"); assertNotNull(aaiNQTenant); - logger.info(Serialization.gsonPretty.toJson(aaiNQTenant)); + assertEquals(aaiNQTenant.getTenantId(), "dhv-test-tenant"); + assertEquals(aaiNQTenant.getTenantName(), "dhv-test-tenant-name"); + assertEquals(aaiNQTenant.getResourceVersion(), "1485366334"); + + 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 index e8c39e95e..b928e86a6 100644 --- 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 @@ -43,15 +43,23 @@ public class AAINQVServerTest { @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"; + aaiNQVServer.setVserverId("dhv-test-vserver"); + aaiNQVServer.setVserverName("dhv-test-vserver-name"); + aaiNQVServer.setVserverName2("dhv-test-vserver-name2"); + aaiNQVServer.setProvStatus("PREPROV"); + aaiNQVServer.setVserverSelflink("dhv-test-vserver-selflink"); + aaiNQVServer.setInMaint(false); + aaiNQVServer.setIsClosedLoopDisabled(false); + aaiNQVServer.setResourceVersion("1485366417"); assertNotNull(aaiNQVServer); + assertEquals(aaiNQVServer.getVserverId(), "dhv-test-vserver"); + assertEquals(aaiNQVServer.getVserverName(), "dhv-test-vserver-name"); + assertEquals(aaiNQVServer.getVserverName2(), "dhv-test-vserver-name2"); + assertEquals(aaiNQVServer.getProvStatus(), "PREPROV"); + assertEquals(aaiNQVServer.getVserverSelflink(), "dhv-test-vserver-selflink"); + assertEquals(aaiNQVServer.getInMaint(), false); + assertEquals(aaiNQVServer.getIsClosedLoopDisabled(), false); + assertEquals(aaiNQVServer.getResourceVersion(), "1485366417"); 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 index b4bde7022..21f13d5e8 100644 --- 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 @@ -43,18 +43,33 @@ public class AAINQVfModuleTest { @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"; + aaiNQVfModule.setVfModuleId("example-vf-module-id-val-49261"); + aaiNQVfModule.setVfModuleName("example-vf-module-name-val-73074"); + aaiNQVfModule.setHeatStackId("example-heat-stack-id-val-86300"); + aaiNQVfModule.setOrchestrationStatus("example-orchestration-status-val-56523"); + aaiNQVfModule.setIsBaseVfModule(true); + aaiNQVfModule.setResourceVersion("1485366450"); + aaiNQVfModule.setPersonaModelId("ef86f9c5-2165-44f3-8fc3-96018b609ea5"); + aaiNQVfModule.setPersonaModelVersion("1.0"); + aaiNQVfModule.setWidgetModelId("example-widget-model-id-val-92571"); + aaiNQVfModule.setWidgetModelVersion("example-widget-model-version-val-83317"); + aaiNQVfModule.setContrailServiceInstanceFqdn("example-contrail-service-instance-fqdn-val-86796"); + aaiNQVfModule.setModelInvariantId("SomeId"); + aaiNQVfModule.setModelVersionId("SomeVersion"); assertNotNull(aaiNQVfModule); + assertEquals(aaiNQVfModule.getVfModuleId(), "example-vf-module-id-val-49261"); + assertEquals(aaiNQVfModule.getVfModuleName(), "example-vf-module-name-val-73074"); + assertEquals(aaiNQVfModule.getHeatStackId(), "example-heat-stack-id-val-86300"); + assertEquals(aaiNQVfModule.getOrchestrationStatus(), "example-orchestration-status-val-56523"); + assertEquals(aaiNQVfModule.getIsBaseVfModule(), true); + assertEquals(aaiNQVfModule.getResourceVersion(), "1485366450"); + assertEquals(aaiNQVfModule.getPersonaModelId(), "ef86f9c5-2165-44f3-8fc3-96018b609ea5"); + assertEquals(aaiNQVfModule.getPersonaModelVersion(), "1.0"); + assertEquals(aaiNQVfModule.getWidgetModelId(), "example-widget-model-id-val-92571"); + assertEquals(aaiNQVfModule.getWidgetModelVersion(), "example-widget-model-version-val-83317"); + assertEquals(aaiNQVfModule.getContrailServiceInstanceFqdn(), "example-contrail-service-instance-fqdn-val-86796"); + assertEquals(aaiNQVfModule.getModelInvariantId(), "SomeId"); + assertEquals(aaiNQVfModule.getModelVersionId(), "SomeVersion"); 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 index 31243b8d9..a280f546c 100644 --- 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 @@ -44,8 +44,57 @@ public class PNFInstanceTest { PNFInstance pnfInstance = new PNFInstance(); pnfInstance.setPNFInstanceName("pnf-instance-name-test"); pnfInstance.setPNFName("pnf-name-test"); + pnfInstance.setPNFType(PNFType.ENODEB); pnfInstance.setPNFSerial("pnf-serial-test"); assertNotNull(pnfInstance); + assertEquals(pnfInstance.getPNFInstanceName(), "pnf-instance-name-test"); + + PNFInstance pnfInstanceNull = new PNFInstance(null); + assertNotNull(pnfInstanceNull); + + PNFInstance pnfInstanceClone = new PNFInstance(pnfInstance); + assertNotNull(pnfInstanceClone); + + assertEquals("pnf-name-test", pnfInstanceClone.getPNFName()); + assertEquals(PNFType.ENODEB, pnfInstanceClone.getPNFType()); + assertEquals("pnf-serial-test", pnfInstanceClone.getPNFSerial()); + + assertEquals("PNFInstance [PNFName=pnf-name-test, PNFInstanceName=pnf-instance-name-test, PNFType=eNodeB, PNFSerial=pnf-serial-test]", pnfInstanceClone.toString()); + assertNotEquals(0, pnfInstanceClone.hashCode()); + assertNotEquals(0, new PNF().hashCode()); + + PNFInstance pnfInstanceOther0 = new PNFInstance(); + pnfInstanceOther0.setPNFName("pnf-name-test"); + + PNFInstance pnfInstanceOther1 = new PNFInstance(pnfInstance); + pnfInstanceOther1.setPNFName("pnf-name-test-diff"); + + PNFInstance pnfInstanceOther2 = new PNFInstance(pnfInstance); + pnfInstanceOther2.setPNFInstanceName("pnf-instance-name-test-diff"); + + PNFInstance pnfInstanceOther3 = new PNFInstance(pnfInstance); + pnfInstanceOther3.setPNFName(null); + + PNFInstance pnfInstanceOther4 = new PNFInstance(pnfInstance); + pnfInstanceOther4.setPNFSerial(null); + + PNFInstance pnfInstanceOther5 = new PNFInstance(pnfInstance); + pnfInstanceOther5.setPNFSerial("pnf-serial-test-diff"); + + assertTrue(pnfInstance.equals(pnfInstance)); + assertFalse(pnfInstance.equals(null)); + assertFalse(pnfInstance.equals("hello")); + assertTrue(pnfInstance.equals(pnfInstanceClone)); + assertFalse(pnfInstance.equals(new PNF())); + assertFalse(new PNF().equals(pnfInstance)); + assertFalse(new PNF().equals(pnfInstanceOther0)); + assertFalse(pnfInstanceOther0.equals(pnfInstance)); + assertFalse(pnfInstanceOther1.equals(pnfInstance)); + assertFalse(pnfInstanceOther2.equals(pnfInstance)); + assertFalse(pnfInstanceOther3.equals(pnfInstance)); + assertFalse(pnfInstanceOther4.equals(pnfInstance)); + assertFalse(pnfInstanceOther5.equals(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 index da3593f01..86a037892 100644 --- 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 @@ -45,6 +45,29 @@ public class PNFTest { pnf.setPNFName("pnf-name-test"); pnf.setPNFType(PNFType.ENODEB); assertNotNull(pnf); + + PNF pnfClone = new PNF(pnf); + assertNotNull(pnfClone); + + assertEquals("pnf-name-test", pnfClone.getPNFName()); + assertEquals(PNFType.ENODEB, pnfClone.getPNFType()); + + assertEquals("PNF [PNFName=pnf-name-test, PNFType=eNodeB]", pnfClone.toString()); + assertNotEquals(0, pnfClone.hashCode()); + assertNotEquals(0, new PNF().hashCode()); + + PNF pnfOther = new PNF(); + pnfOther.setPNFName("pnf-name-test"); + + assertTrue(pnf.equals(pnf)); + assertFalse(pnf.equals(null)); + assertFalse(pnf.equals("hello")); + assertTrue(pnf.equals(pnfClone)); + assertFalse(pnf.equals(new PNF())); + assertFalse(new PNF().equals(pnf)); + assertFalse(new PNF().equals(pnfOther)); + assertFalse(pnfOther.equals(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 index e4c5acc12..7081b0e7e 100644 --- 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 @@ -44,6 +44,7 @@ public class PNFTypeTest { public void test() { PNFType pnfType = PNFType.ENODEB; assertNotNull(pnfType); + assertNotNull(pnfType.toString()); 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 index 8a35c42ab..a240570d3 100644 --- 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 @@ -42,8 +42,8 @@ public class RelatedToPropertyItemTest { @Test public void test() { RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); - relatedToPropertyItem.propertyKey = "model.model-name"; - relatedToPropertyItem.propertyValue = "service-instance"; + relatedToPropertyItem.setPropertyKey("model.model-name"); + relatedToPropertyItem.setPropertyValue("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 index 1b0692944..05b72ed6a 100644 --- 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 @@ -43,14 +43,18 @@ public class RelatedToPropertyTest { public void test() { RelatedToProperty relatedToProperty = new RelatedToProperty(); RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); - relatedToPropertyItem.propertyKey = "model.model-name"; - relatedToPropertyItem.propertyValue = "service-instance"; + relatedToPropertyItem.setPropertyKey("model.model-name"); + relatedToPropertyItem.setPropertyValue("service-instance"); relatedToProperty.getRelatedTo().add(relatedToPropertyItem); RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem(); - relatedToPropertyItem2.propertyKey = "model.model-name2"; - relatedToPropertyItem2.propertyValue = "service-instance2"; + relatedToPropertyItem2.setPropertyKey("model.model-name2"); + relatedToPropertyItem2.setPropertyValue("service-instance2"); relatedToProperty.getRelatedTo().add(relatedToPropertyItem2); - assertNotNull(relatedToProperty); + assertNotNull(relatedToProperty); + + relatedToProperty.setRelatedTo(relatedToProperty.getRelatedTo()); + 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 index dbdce2515..38727b7b5 100644 --- 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 @@ -38,8 +38,8 @@ public class RelationshipDataItemTest { @Test public void test() { RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - relationshipDataItem.relationshipKey = "relationship-key"; - relationshipDataItem.relationshipValue = "relationship-value"; + relationshipDataItem.setRelationshipKey("relationship-key"); + relationshipDataItem.setRelationshipValue("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 index 5498caeac..b25d3e473 100644 --- 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 @@ -43,15 +43,22 @@ public class RelationshipDataTest { public void test() { RelationshipData relationshipData = new RelationshipData(); RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - relationshipDataItem.relationshipKey = "relationship-key"; - relationshipDataItem.relationshipValue = "relationship-value"; + relationshipDataItem.setRelationshipKey("relationship-key"); + relationshipDataItem.setRelationshipValue("relationship-value"); assertNotNull(relationshipDataItem); + assertEquals(relationshipDataItem.getRelationshipKey(), "relationship-key"); + assertEquals(relationshipDataItem.getRelationshipValue(), "relationship-value"); + relationshipData.getRelationshipData().add(relationshipDataItem); RelationshipDataItem relationshipDataItem2 = new RelationshipDataItem(); - relationshipDataItem2.relationshipKey = "relationship-key2"; - relationshipDataItem2.relationshipValue = "relationship-value2"; + relationshipDataItem2.setRelationshipKey("relationship-key2"); + relationshipDataItem2.setRelationshipValue("relationship-value2"); relationshipData.getRelationshipData().add(relationshipDataItem2); - assertNotNull(relationshipData); + assertNotNull(relationshipData); + + relationshipData.setRelationshipData(relationshipData.getRelationshipData()); + 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 index 4313e0605..625592e76 100644 --- 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 @@ -43,10 +43,14 @@ public class RelationshipItemTest { public void test() { RelationshipItem relationshipItem = new RelationshipItem(); RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); - relatedToPropertyItem.propertyKey = "model.model-name"; - relatedToPropertyItem.propertyValue = "service-instance"; + relatedToPropertyItem.setPropertyKey("model.model-name"); + relatedToPropertyItem.setPropertyValue("service-instance"); relationshipItem.getRelatedToProperty().add(relatedToPropertyItem); assertNotNull(relationshipItem); + + relationshipItem.setRelatedToProperty(relationshipItem.getRelatedToProperty()); + 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 index 3d06b0e6b..a5a7d90d0 100644 --- 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 @@ -43,27 +43,34 @@ public class RelationshipListTest { public void test() { RelationshipList relationshipList = new RelationshipList(); Relationship relationship = new Relationship(); - relationship.relatedLink = "related-link"; - relationship.relatedTo = "related-to"; + relationship.setRelatedLink("related-link"); + relationship.setRelatedTo("related-to"); + assertEquals(relationship.getRelatedLink(), "related-link"); + assertEquals(relationship.getRelatedTo(), "related-to"); + RelatedToProperty relatedToProperty = new RelatedToProperty(); RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); - relatedToPropertyItem.propertyKey = "model.model-name"; - relatedToPropertyItem.propertyValue = "service-instance"; + relatedToPropertyItem.setPropertyKey("model.model-name"); + relatedToPropertyItem.setPropertyValue("service-instance"); relatedToProperty.getRelatedTo().add(relatedToPropertyItem); RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem(); - relatedToPropertyItem2.propertyKey = "model.model-name2"; - relatedToPropertyItem2.propertyValue = "service-instance2"; + relatedToPropertyItem2.setPropertyKey("model.model-name2"); + relatedToPropertyItem2.setPropertyValue("service-instance2"); relatedToProperty.getRelatedTo().add(relatedToPropertyItem2); - relationship.relatedToProperty = relatedToProperty; + relationship.setRelatedToProperty(relatedToProperty); RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - relationshipDataItem.relationshipKey = "relationship-key"; - relationshipDataItem.relationshipValue = "relationship-value"; + relationshipDataItem.setRelationshipKey("relationship-key"); + relationshipDataItem.setRelationshipValue("relationship-value"); RelationshipData relationshipData = new RelationshipData(); relationshipData.getRelationshipData().add(relationshipDataItem); - relationship.relationshipData = relationshipData; + relationship.setRelationshipData(relationshipData); relationshipList.getRelationshipList().add(relationship); - assertNotNull(relationshipList); + assertNotNull(relationshipList); + + relationshipList.setRelationshipList(relationshipList.getRelationshipList()); + 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 index ec55069ca..3f899eb9b 100644 --- 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 @@ -42,24 +42,29 @@ public class RelationshipTest { @Test public void test() { Relationship relationship = new Relationship(); - relationship.relatedLink = "related-link"; - relationship.relatedTo = "related-to"; + relationship.setRelatedLink("related-link"); + relationship.setRelatedTo("related-to"); + assertEquals(relationship.getRelatedLink(), "related-link"); + assertEquals(relationship.getRelatedTo(), "related-to"); + RelatedToProperty relatedToProperty = new RelatedToProperty(); RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); - relatedToPropertyItem.propertyKey = "model.model-name"; - relatedToPropertyItem.propertyValue = "service-instance"; + relatedToPropertyItem.setPropertyKey("model.model-name"); + relatedToPropertyItem.setPropertyValue("service-instance"); relatedToProperty.getRelatedTo().add(relatedToPropertyItem); RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem(); - relatedToPropertyItem2.propertyKey = "model.model-name2"; - relatedToPropertyItem2.propertyValue = "service-instance2"; + relatedToPropertyItem2.setPropertyKey("model.model-name2"); + relatedToPropertyItem2.setPropertyValue("service-instance2"); relatedToProperty.getRelatedTo().add(relatedToPropertyItem2); - relationship.relatedToProperty = relatedToProperty; + relationship.setRelatedToProperty(relatedToProperty); + assertEquals(relationship.getRelatedToProperty(), relatedToProperty); RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - relationshipDataItem.relationshipKey = "relationship-key"; - relationshipDataItem.relationshipValue = "relationship-value"; + relationshipDataItem.setRelationshipKey("relationship-key"); + relationshipDataItem.setRelationshipValue("relationship-value"); RelationshipData relationshipData = new RelationshipData(); relationshipData.getRelationshipData().add(relationshipDataItem); - relationship.relationshipData = relationshipData; + relationship.setRelationshipData(relationshipData); + assertEquals(relationship.getRelationshipData(), relationshipData); assertNotNull(relationship); logger.info(Serialization.gsonPretty.toJson(relationship)); } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/util/AAIExceptionTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/util/AAIExceptionTest.java new file mode 100644 index 000000000..2a7beb499 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/util/AAIExceptionTest.java @@ -0,0 +1,39 @@ +/*- + * ============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.util; + +import static org.junit.Assert.*; + +import java.io.IOException; + +import org.junit.Test; + +public class AAIExceptionTest { + + @Test + public void test() { + assertNotNull(new AAIException()); + assertNotNull(new AAIException("message")); + assertNotNull(new AAIException("message", new IOException())); + assertNotNull(new AAIException("message", new IOException(), true, false)); + assertNotNull(new AAIException(new IOException())); + } + +} |