diff options
author | 2018-03-22 16:36:47 +0000 | |
---|---|---|
committer | 2018-03-26 16:28:38 +0100 | |
commit | f6a81de0fd84186d499c39fe5f2d75c20cb0e301 (patch) | |
tree | 3a3ecfafe9dbdc750c75122c9702b1aea1a1777d /controlloop/common/model-impl/aai/src/test/java | |
parent | 3508a11ff75f9def26bcc601bb758115487bd349 (diff) |
Removed checkstyle warnings
Removed checkstyle warnings from
policy/drools-applications/controlloop/common/model-impl/aai
including renaming classes:
AAI* -> Aai*
PNF* -> Pnf*
and renaming some methods in those classes
Issue-ID: POLICY-705
Change-Id: I2d59a668728aa58a2c9fbe78c44e924e6cfb4531
Signed-off-by: mmis <michael.morris@ericsson.com>
Diffstat (limited to 'controlloop/common/model-impl/aai/src/test/java')
46 files changed, 1932 insertions, 1845 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 deleted file mode 100644 index 9a4050f1a..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVnfResponseTest.java +++ /dev/null @@ -1,92 +0,0 @@ -/*- - * ============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; - -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AAIGETVnfResponseTest { - private static final Logger logger = LoggerFactory.getLogger(AAIGETVnfResponseTest.class); - - @Test - public void test() { - AAIGETVnfResponse response = new AAIGETVnfResponse(); - - 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("83f674e8-7555-44d7-9a39-bdc3770b0491", response.getVnfID()); - assertEquals("lll_vnf_010317", response.getVnfName()); - assertEquals("Basa-122216-Service/VidVsamp12BaseVolume 1", response.getVnfType()); - assertEquals("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", response.getServiceId()); - assertEquals("Created", response.getOrchestrationStatus()); - assertEquals("false", response.getInMaint()); - assertEquals("false", response.getIsClosedLoopDisabled()); - assertEquals("1494001988835", response.getResourceVersion()); - assertEquals("f18be3cd-d446-456e-9109-121d9b62feaa", response.getModelInvariantId()); - - RelationshipList relationshipList = new RelationshipList(); - Relationship relationship = new Relationship(); - RelationshipData relationshipData = new RelationshipData(); - RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - - relationshipDataItem.setRelationshipKey("customer.global-customer-id"); - relationshipDataItem.setRelationshipValue("MSO_1610_ST"); - relationshipData.getRelationshipData().add(relationshipDataItem); - - relationshipDataItem.setRelationshipKey("service-subscription.service-type"); - relationshipDataItem.setRelationshipValue("MSO-dev-service-type"); - relationshipData.getRelationshipData().add(relationshipDataItem); - - 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.setPropertyKey("service-instance.service-instance-name"); - item.setPropertyValue("lll_svc_010317"); - relatedToProperty.getRelatedTo().add(item); - assertEquals("service-instance.service-instance-name", item.getPropertyKey()); - assertEquals("lll_svc_010317", item.getPropertyValue()); - - 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.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 deleted file mode 100644 index 65c2cdc81..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIGETVserverResponseTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/*- - * ============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.assertEquals; -import static org.junit.Assert.assertNull; - -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AAIGETVserverResponseTest { - private static final Logger logger = LoggerFactory.getLogger(AAIGETVserverResponseTest.class); - - @Test - public void test() { - AAIGETVserverResponse response = new AAIGETVserverResponse(); - - 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"); - - assertEquals("d0668d4f-c25e-4a1b-87c4-83845c01efd8", response.getVserverID()); - assertEquals("USMSO1SX7NJ0103UJZZ01-vjunos0", response.getVserverName()); - assertEquals("vjunos0", response.getVserverName2()); - assertEquals("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.getVserverSelflink()); - assertEquals("false", response.getInMaint()); - assertEquals("false", response.getIsClosedLoopDisabled()); - assertEquals("1494001931513", response.getResourceVersion()); - - RelationshipList relationshipList = new RelationshipList(); - Relationship relationship = new Relationship(); - RelationshipData relationshipData = new RelationshipData(); - RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - - relationshipDataItem.setRelationshipKey("customer.global-customer-id"); - relationshipDataItem.setRelationshipValue("MSO_1610_ST"); - relationshipData.getRelationshipData().add(relationshipDataItem); - - relationshipDataItem.setRelationshipKey("service-subscription.service-type"); - relationshipDataItem.setRelationshipValue("MSO-dev-service-type"); - relationshipData.getRelationshipData().add(relationshipDataItem); - - 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.setPropertyKey("service-instance.service-instance-name"); - item.setPropertyValue("lll_svc_010317"); - relatedToProperty.getRelatedTo().add(item); - - 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.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 deleted file mode 100644 index 5e1351d13..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAIManagerTest.java +++ /dev/null @@ -1,142 +0,0 @@ -/*- - * ============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 deleted file mode 100644 index 5d1fe278c..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQCloudRegionTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.policy.aai; - -import static org.junit.Assert.*; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -public class AAINQCloudRegionTest { - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Test - public void test() { - AAINQCloudRegion aaiNQCloudRegion = new AAINQCloudRegion(); - aaiNQCloudRegion.setCloudOwner("Rackspace"); - aaiNQCloudRegion.setCloudRegionId("DFW"); - aaiNQCloudRegion.setCloudRegionVersion("v1"); - aaiNQCloudRegion.setComplexName("SharedNode"); - aaiNQCloudRegion.setResourceVersion("1504789196021"); - assertNotNull(aaiNQCloudRegion); - assertEquals("Rackspace", aaiNQCloudRegion.getCloudOwner()); - assertEquals("DFW", aaiNQCloudRegion.getCloudRegionId()); - assertEquals("v1", aaiNQCloudRegion.getCloudRegionVersion()); - assertEquals("SharedNode", aaiNQCloudRegion.getComplexName()); - assertEquals("1504789196021", aaiNQCloudRegion.getResourceVersion()); - } -} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertiesTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertiesTest.java deleted file mode 100644 index 148f5df4b..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertiesTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.policy.aai; - -import static org.junit.Assert.*; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -public class AAINQExtraPropertiesTest { - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Test - public void test() { - AAINQExtraProperties aaiNQExtraProperties = new AAINQExtraProperties(); - aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "service-instance")); - aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-version", "1.0")); - aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); - aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); - assertNotNull(aaiNQExtraProperties); - } - -} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQGenericVNFTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQGenericVNFTest.java deleted file mode 100644 index fba01bc22..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQGenericVNFTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.policy.aai; - -import static org.junit.Assert.*; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -public class AAINQGenericVNFTest { - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Test - public void test() { - AAINQGenericVNF aaiNQGenericVNF = new AAINQGenericVNF(); - aaiNQGenericVNF.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(true, aaiNQGenericVNF.getEncrypedAccessFlag()); - assertEquals(false, aaiNQGenericVNF.getInMaint()); - assertEquals("aa", aaiNQGenericVNF.getIpv4Loopback0Address()); - assertEquals("oamAddress", aaiNQGenericVNF.getIpv4OamAddress()); - assertEquals(false, aaiNQGenericVNF.getIsClosedLoopDisabled()); - assertEquals("653d2caa-7e47-4614-95b3-26c8d82755b8", aaiNQGenericVNF.getModelInvariantId()); - assertEquals("98f410f6-4c63-447b-97d2-42508437cec0", aaiNQGenericVNF.getModelVersionId()); - assertEquals("active", aaiNQGenericVNF.getOperationalState()); - assertEquals("653d2caa-7e47-4614-95b3-26c8d82755b8", aaiNQGenericVNF.getPersonaModelId()); - assertEquals("98f410f6-4c63-447b-97d2-42508437cec0", aaiNQGenericVNF.getPersonaModelVersion()); - assertEquals("complete", aaiNQGenericVNF.getProvStatus()); - assertEquals("1505056714553", aaiNQGenericVNF.getResourceVersion()); - assertEquals("e8cb8968-5411-478b-906a-f28747de72cd", aaiNQGenericVNF.getServiceId()); - assertEquals("ed8b2bce-6b27-4089-992c-4a2c66024bcd", aaiNQGenericVNF.getVnfID()); - assertEquals("vCPEInfraVNF14a", aaiNQGenericVNF.getVnfName()); - assertEquals("malumabb12", aaiNQGenericVNF.getVnfName2()); - assertEquals("vCPEInfraService10/vCPEInfraService10 0", aaiNQGenericVNF.getVnfType()); - } - -} 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 deleted file mode 100644 index 71f8cef60..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemTest.java +++ /dev/null @@ -1,162 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.policy.aai; - -import static org.junit.Assert.*; - -import java.util.LinkedList; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AAINQInventoryResponseItemTest { - private static final Logger logger = LoggerFactory.getLogger(AAINQInventoryResponseItemTest.class); - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Test - public void test() { - AAINQInventoryResponseItem aaiNQInventoryResponseItem = new AAINQInventoryResponseItem(); - aaiNQInventoryResponseItem.setModelName("service-instance"); - AAINQCloudRegion aaiNQCloudRegion = new 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")); - aaiNQExtraProperties.getExtraProperty().add(new AAINQExtraProperty("model.model-type", "widget")); - 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.setExtraProperties(aaiNQExtraProperties); - AAINQGenericVNF aaiNQGenericVNF = new 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.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.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.setItems(aaiNQInventoryResponseItems); - aaiNQInventoryResponseItem.setModelName("model-name"); - AAINQServiceInstance serviceInstance = new AAINQServiceInstance(); - 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.setTenantId("dhv-test-tenant"); - aaiNQTenant.setTenantName("dhv-test-tenant-name"); - aaiNQTenant.setResourceVersion("1485366334"); - aaiNQInventoryResponseItem.setTenant(aaiNQTenant); - AAINQVfModule aaiNQVfModule = new 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.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 deleted file mode 100644 index caeec7910..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQInventoryResponseItemsTest.java +++ /dev/null @@ -1,151 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.policy.aai; - -import static org.junit.Assert.*; - -import java.util.LinkedList; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AAINQInventoryResponseItemsTest { - private static final Logger logger = LoggerFactory.getLogger(AAINQInventoryResponseItemsTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Test - public void test() { - AAINQInventoryResponseItems aaiNQInventoryResponseItems = new AAINQInventoryResponseItems(); - AAINQInventoryResponseItem serviceItem = new AAINQInventoryResponseItem(); - serviceItem.setModelName("service-instance"); - assertEquals("service-instance", serviceItem.getModelName()); - - 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.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.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.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.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.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/AAINQRequestTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestTest.java deleted file mode 100644 index 64e722613..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQRequestTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ -package org.onap.policy.aai; - -import static org.junit.Assert.*; - -import java.util.UUID; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AAINQRequestTest { - private static final Logger logger = LoggerFactory.getLogger(AAINQRequestTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Test - public void test() { - AAINQRequest aaiNQRequest = new AAINQRequest(); - AAINQInstanceFilters aaiNQInstanceFilters = new AAINQInstanceFilters(); - AAINQQueryParameters aaiNQQueryParameters = new AAINQQueryParameters(); - - aaiNQRequest.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/AAINQResponseWrapperTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseWrapperTest.java deleted file mode 100644 index 8df71fce1..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQResponseWrapperTest.java +++ /dev/null @@ -1,163 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ -package org.onap.policy.aai; - -import static org.junit.Assert.*; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -import java.util.LinkedList; -import java.util.UUID; - -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AAINQResponseWrapperTest { - private static final Logger logger = LoggerFactory.getLogger(AAINQResponseWrapperTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Test - public void test() { - AAINQInventoryResponseItem serviceItem = new AAINQInventoryResponseItem(); - serviceItem.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.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.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.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.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.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); - AAINQResponseWrapper aaiNQResponseWarapper = new AAINQResponseWrapper(); - aaiNQResponseWarapper.setAainqresponse(aaiResponse); - 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 deleted file mode 100644 index 3b3d13c1e..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQServiceInstanceTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ -package org.onap.policy.aai; - -import static org.junit.Assert.*; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AAINQServiceInstanceTest { - private static final Logger logger = LoggerFactory.getLogger(AAINQServiceInstanceTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Test - public void test() { - AAINQServiceInstance aaiNQServiceInstance = new AAINQServiceInstance(); - aaiNQServiceInstance.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("dhv-test-vhnfportal-service-instance-id", aaiNQServiceInstance.getServiceInstanceID()); - assertEquals("dhv-test-service-instance-name1", aaiNQServiceInstance.getServiceInstanceName()); - assertEquals("82194af1-3c2c-485a-8f44-420e22a9eaa4", aaiNQServiceInstance.getPersonaModelId()); - assertEquals("1.0", aaiNQServiceInstance.getPersonaModelVersion()); - assertEquals("dhv-test-service-instance-location-id1", aaiNQServiceInstance.getServiceInstanceLocationId()); - assertEquals("1485366092", aaiNQServiceInstance.getResourceVersion()); - assertEquals("SomeID", aaiNQServiceInstance.getModelInvariantId()); - assertEquals("SomeVersion", aaiNQServiceInstance.getModelVersionId()); - logger.info(Serialization.gsonPretty.toJson(aaiNQServiceInstance)); - } - -} 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 deleted file mode 100644 index 556d82c2e..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVServerTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ -package org.onap.policy.aai; - -import static org.junit.Assert.*; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AAINQVServerTest { - private static final Logger logger = LoggerFactory.getLogger(AAINQVServerTest.class); - - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Test - public void test() { - AAINQVServer aaiNQVServer = new AAINQVServer(); - aaiNQVServer.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("dhv-test-vserver", aaiNQVServer.getVserverId()); - assertEquals("dhv-test-vserver-name", aaiNQVServer.getVserverName()); - assertEquals("dhv-test-vserver-name2", aaiNQVServer.getVserverName2()); - assertEquals("PREPROV", aaiNQVServer.getProvStatus()); - assertEquals("dhv-test-vserver-selflink", aaiNQVServer.getVserverSelflink()); - assertEquals(false, aaiNQVServer.getInMaint()); - assertEquals(false, aaiNQVServer.getIsClosedLoopDisabled()); - assertEquals("1485366417", aaiNQVServer.getResourceVersion()); - 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 deleted file mode 100644 index 7595f88cd..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQVfModuleTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.policy.aai; - -import static org.junit.Assert.*; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class AAINQVfModuleTest { - private static final Logger logger = LoggerFactory.getLogger(AAINQVfModuleTest.class); - - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Test - public void test() { - AAINQVfModule aaiNQVfModule = new AAINQVfModule(); - aaiNQVfModule.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("example-vf-module-id-val-49261", aaiNQVfModule.getVfModuleId()); - assertEquals("example-vf-module-name-val-73074", aaiNQVfModule.getVfModuleName()); - assertEquals("example-heat-stack-id-val-86300", aaiNQVfModule.getHeatStackId()); - assertEquals("example-orchestration-status-val-56523", aaiNQVfModule.getOrchestrationStatus()); - assertEquals(true, aaiNQVfModule.getIsBaseVfModule()); - assertEquals("1485366450", aaiNQVfModule.getResourceVersion()); - assertEquals("ef86f9c5-2165-44f3-8fc3-96018b609ea5", aaiNQVfModule.getPersonaModelId()); - assertEquals("1.0", aaiNQVfModule.getPersonaModelVersion()); - assertEquals("example-widget-model-id-val-92571", aaiNQVfModule.getWidgetModelId()); - assertEquals("example-widget-model-version-val-83317", aaiNQVfModule.getWidgetModelVersion()); - assertEquals("example-contrail-service-instance-fqdn-val-86796", aaiNQVfModule.getContrailServiceInstanceFqdn()); - assertEquals("SomeId", aaiNQVfModule.getModelInvariantId()); - assertEquals("SomeVersion", aaiNQVfModule.getModelVersionId()); - logger.info(Serialization.gsonPretty.toJson(aaiNQVfModule)); - } - -} 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 new file mode 100644 index 000000000..d78952111 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVnfResponseTest.java @@ -0,0 +1,94 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017-2018 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.assertEquals; + +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AaiGetVnfResponseTest { + private static final Logger logger = LoggerFactory.getLogger(AaiGetVnfResponseTest.class); + + @Test + public void test() { + AaiGetVnfResponse response = new AaiGetVnfResponse(); + + 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("83f674e8-7555-44d7-9a39-bdc3770b0491", response.getVnfId()); + assertEquals("lll_vnf_010317", response.getVnfName()); + assertEquals("Basa-122216-Service/VidVsamp12BaseVolume 1", response.getVnfType()); + assertEquals("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", response.getServiceId()); + assertEquals("Created", response.getOrchestrationStatus()); + assertEquals("false", response.getInMaint()); + assertEquals("false", response.getIsClosedLoopDisabled()); + assertEquals("1494001988835", response.getResourceVersion()); + assertEquals("f18be3cd-d446-456e-9109-121d9b62feaa", response.getModelInvariantId()); + + final RelationshipList relationshipList = new RelationshipList(); + final Relationship relationship = new Relationship(); + RelationshipData relationshipData = new RelationshipData(); + RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); + + relationshipDataItem.setRelationshipKey("customer.global-customer-id"); + relationshipDataItem.setRelationshipValue("MSO_1610_ST"); + relationshipData.getRelationshipData().add(relationshipDataItem); + + relationshipDataItem.setRelationshipKey("service-subscription.service-type"); + relationshipDataItem.setRelationshipValue("MSO-dev-service-type"); + relationshipData.getRelationshipData().add(relationshipDataItem); + + 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.setPropertyKey("service-instance.service-instance-name"); + item.setPropertyValue("lll_svc_010317"); + relatedToProperty.getRelatedTo().add(item); + assertEquals("service-instance.service-instance-name", item.getPropertyKey()); + assertEquals("lll_svc_010317", item.getPropertyValue()); + + 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.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 new file mode 100644 index 000000000..6962b31f4 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiGetVserverResponseTest.java @@ -0,0 +1,97 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017-2018 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.assertEquals; +import static org.junit.Assert.assertNull; + +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AaiGetVserverResponseTest { + private static final Logger logger = LoggerFactory.getLogger(AaiGetVserverResponseTest.class); + + @Test + public void test() { + AaiGetVserverResponse response = new AaiGetVserverResponse(); + + 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"); + + assertEquals("d0668d4f-c25e-4a1b-87c4-83845c01efd8", response.getVserverId()); + assertEquals("USMSO1SX7NJ0103UJZZ01-vjunos0", response.getVserverName()); + assertEquals("vjunos0", response.getVserverName2()); + assertEquals("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.getVserverSelflink()); + assertEquals("false", response.getInMaint()); + assertEquals("false", response.getIsClosedLoopDisabled()); + assertEquals("1494001931513", response.getResourceVersion()); + + final RelationshipList relationshipList = new RelationshipList(); + final Relationship relationship = new Relationship(); + RelationshipData relationshipData = new RelationshipData(); + RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); + + relationshipDataItem.setRelationshipKey("customer.global-customer-id"); + relationshipDataItem.setRelationshipValue("MSO_1610_ST"); + relationshipData.getRelationshipData().add(relationshipDataItem); + + relationshipDataItem.setRelationshipKey("service-subscription.service-type"); + relationshipDataItem.setRelationshipValue("MSO-dev-service-type"); + relationshipData.getRelationshipData().add(relationshipDataItem); + + 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.setPropertyKey("service-instance.service-instance-name"); + item.setPropertyValue("lll_svc_010317"); + relatedToProperty.getRelatedTo().add(item); + + 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.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..32a029560 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiManagerTest.java @@ -0,0 +1,169 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017-2018 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.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isNull; +import static org.mockito.ArgumentMatchers.startsWith; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +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; + + /** + * Set up test cases. + */ + @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 aaiNqNotOkResponse0 = aaiManager.postQuery("http://somewhere.over.the.rainbow", "Witch", "West", + aaiNqRequest, aaiNqRequestUuid); + assertNull(aaiNqNotOkResponse0); + + when(restManagerMock.post(startsWith("http://somewhere.under.the.rainbow"), eq("Witch"), eq("West"), anyMap(), + anyString(), anyString())).thenReturn(httpResponseErr1); + + AaiNqResponse aaiNqNotOkResponse1 = aaiManager.postQuery("http://somewhere.under.the.rainbow", "Witch", "West", + aaiNqRequest, aaiNqRequestUuid); + assertNull(aaiNqNotOkResponse1); + } + + @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 vserverNotOkResponse0 = aaiManager.getQueryByVserverName( + "http://somewhere.under.the.rainbow", "Witch", "West", vserverNameRequestId, "vserverName"); + assertNull(vserverNotOkResponse0); + } + + @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 new file mode 100644 index 000000000..dea981a0a --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqCloudRegionTest.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017-2018 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.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class AaiNqCloudRegionTest { + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Test + public void test() { + AaiNqCloudRegion aaiNqCloudRegion = new AaiNqCloudRegion(); + aaiNqCloudRegion.setCloudOwner("Rackspace"); + aaiNqCloudRegion.setCloudRegionId("DFW"); + aaiNqCloudRegion.setCloudRegionVersion("v1"); + aaiNqCloudRegion.setComplexName("SharedNode"); + aaiNqCloudRegion.setResourceVersion("1504789196021"); + assertNotNull(aaiNqCloudRegion); + assertEquals("Rackspace", aaiNqCloudRegion.getCloudOwner()); + assertEquals("DFW", aaiNqCloudRegion.getCloudRegionId()); + assertEquals("v1", aaiNqCloudRegion.getCloudRegionVersion()); + assertEquals("SharedNode", aaiNqCloudRegion.getComplexName()); + assertEquals("1504789196021", aaiNqCloudRegion.getResourceVersion()); + } +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertiesTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertiesTest.java new file mode 100644 index 000000000..adbd9379b --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertiesTest.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017-2018 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.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class AaiNqExtraPropertiesTest { + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Test + public void test() { + AaiNqExtraProperties aaiNqExtraProperties = new AaiNqExtraProperties(); + aaiNqExtraProperties.getExtraProperty().add(new AaiNqExtraProperty("model.model-name", "service-instance")); + aaiNqExtraProperties.getExtraProperty().add(new AaiNqExtraProperty("model.model-type", "widget")); + aaiNqExtraProperties.getExtraProperty().add(new AaiNqExtraProperty("model.model-version", "1.0")); + aaiNqExtraProperties.getExtraProperty() + .add(new AaiNqExtraProperty("model.model-id", "82194af1-3c2c-485a-8f44-420e22a9eaa4")); + aaiNqExtraProperties.getExtraProperty() + .add(new AaiNqExtraProperty("model.model-name", "46b92144-923a-4d20-b85a-3cbd847668a9")); + assertNotNull(aaiNqExtraProperties); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AAINQExtraPropertyTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqExtraPropertyTest.java index 78189c857..25f125945 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * aai * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -17,32 +17,32 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.aai; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -public class AAINQExtraPropertyTest { +public class AaiNqExtraPropertyTest { - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } + @BeforeClass + public static void setUpBeforeClass() throws Exception {} - @AfterClass - public static void tearDownAfterClass() throws Exception { - } + @AfterClass + public static void tearDownAfterClass() throws Exception {} - @Test - public void test() { - AAINQExtraProperty aaiNQExtraProperty = new AAINQExtraProperty(); - aaiNQExtraProperty.setPropertyName("model.model-name"); - aaiNQExtraProperty.setPropertyValue("service-instance"); - assertNotNull(aaiNQExtraProperty); + @Test + public void test() { + AaiNqExtraProperty aaiNqExtraProperty = new AaiNqExtraProperty(); + aaiNqExtraProperty.setPropertyName("model.model-name"); + aaiNqExtraProperty.setPropertyValue("service-instance"); + assertNotNull(aaiNqExtraProperty); - assertEquals("model.model-name", aaiNQExtraProperty.getPropertyName()); - assertEquals("service-instance", aaiNQExtraProperty.getPropertyValue()); - } + assertEquals("model.model-name", aaiNqExtraProperty.getPropertyName()); + assertEquals("service-instance", aaiNqExtraProperty.getPropertyValue()); + } } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqGenericVnfTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqGenericVnfTest.java new file mode 100644 index 000000000..680e66e7c --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqGenericVnfTest.java @@ -0,0 +1,79 @@ +/*- + * ============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.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class AaiNqGenericVnfTest { + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Test + public void test() { + AaiNqGenericVnf aaiNqGenericVnf = new AaiNqGenericVnf(); + aaiNqGenericVnf.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(true, aaiNqGenericVnf.getEncrypedAccessFlag()); + assertEquals(false, aaiNqGenericVnf.getInMaint()); + assertEquals("aa", aaiNqGenericVnf.getIpv4Loopback0Address()); + assertEquals("oamAddress", aaiNqGenericVnf.getIpv4OamAddress()); + assertEquals(false, aaiNqGenericVnf.getIsClosedLoopDisabled()); + assertEquals("653d2caa-7e47-4614-95b3-26c8d82755b8", aaiNqGenericVnf.getModelInvariantId()); + assertEquals("98f410f6-4c63-447b-97d2-42508437cec0", aaiNqGenericVnf.getModelVersionId()); + assertEquals("active", aaiNqGenericVnf.getOperationalState()); + assertEquals("653d2caa-7e47-4614-95b3-26c8d82755b8", aaiNqGenericVnf.getPersonaModelId()); + assertEquals("98f410f6-4c63-447b-97d2-42508437cec0", aaiNqGenericVnf.getPersonaModelVersion()); + assertEquals("complete", aaiNqGenericVnf.getProvStatus()); + assertEquals("1505056714553", aaiNqGenericVnf.getResourceVersion()); + assertEquals("e8cb8968-5411-478b-906a-f28747de72cd", aaiNqGenericVnf.getServiceId()); + assertEquals("ed8b2bce-6b27-4089-992c-4a2c66024bcd", aaiNqGenericVnf.getVnfId()); + assertEquals("vCPEInfraVNF14a", aaiNqGenericVnf.getVnfName()); + assertEquals("malumabb12", aaiNqGenericVnf.getVnfName2()); + assertEquals("vCPEInfraService10/vCPEInfraService10 0", aaiNqGenericVnf.getVnfType()); + } + +} 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 f3bceaa16..1508891b4 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 @@ -17,32 +17,31 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.aai; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -public class AAINQInstanceFiltersTest { - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Test - public void test() { - AAINQInstanceFilters aaiNQInstanceFilters = new AAINQInstanceFilters(); - assertNotNull(aaiNQInstanceFilters); - - aaiNQInstanceFilters.setInstanceFilter(aaiNQInstanceFilters.getInstanceFilter());; - assertNotNull(aaiNQInstanceFilters); - assertNotNull(aaiNQInstanceFilters.getInstanceFilter()); - } +public class AaiNqInstanceFiltersTest { + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Test + public void test() { + AaiNqInstanceFilters aaiNqInstanceFilters = new AaiNqInstanceFilters(); + assertNotNull(aaiNqInstanceFilters); + + 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 new file mode 100644 index 000000000..8b5265a00 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemTest.java @@ -0,0 +1,170 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017-2018 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.assertNotNull; + +import java.util.LinkedList; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AaiNqInventoryResponseItemTest { + private static final Logger logger = LoggerFactory.getLogger(AaiNqInventoryResponseItemTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Test + public void test() { + AaiNqInventoryResponseItem aaiNqInventoryResponseItem = new AaiNqInventoryResponseItem(); + aaiNqInventoryResponseItem.setModelName("service-instance"); + AaiNqCloudRegion aaiNqCloudRegion = new 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")); + aaiNqExtraProperties.getExtraProperty().add(new AaiNqExtraProperty("model.model-type", "widget")); + 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.setExtraProperties(aaiNqExtraProperties); + AaiNqGenericVnf aaiNqGenericVnf = new 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); + AaiNqInventoryResponseItem serviceItem = new AaiNqInventoryResponseItem(); + 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.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 aaiNqInventoryResponseItems = new AaiNqInventoryResponseItems(); + aaiNqInventoryResponseItems.getInventoryResponseItems().add(serviceItem); + aaiNqInventoryResponseItems.getInventoryResponseItems().add(vfModuleItem); + aaiNqInventoryResponseItem.setItems(aaiNqInventoryResponseItems); + aaiNqInventoryResponseItem.setModelName("model-name"); + AaiNqServiceInstance serviceInstance = new AaiNqServiceInstance(); + 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.setTenantId("dhv-test-tenant"); + aaiNqTenant.setTenantName("dhv-test-tenant-name"); + aaiNqTenant.setResourceVersion("1485366334"); + aaiNqInventoryResponseItem.setTenant(aaiNqTenant); + AaiNqVfModule aaiNqVfModule = new 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.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 new file mode 100644 index 000000000..99c6e5e92 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqInventoryResponseItemsTest.java @@ -0,0 +1,163 @@ +/*- + * ============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.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.LinkedList; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AaiNqInventoryResponseItemsTest { + private static final Logger logger = LoggerFactory.getLogger(AaiNqInventoryResponseItemsTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Test + public void test() { + AaiNqInventoryResponseItem serviceItem = new AaiNqInventoryResponseItem(); + serviceItem.setModelName("service-instance"); + assertEquals("service-instance", serviceItem.getModelName()); + + 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.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.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.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.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.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 aaiNqInventoryResponseItems = new AaiNqInventoryResponseItems(); + 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 510683387..2e65a843d 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * aai * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -17,9 +17,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.aai; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import java.util.UUID; @@ -27,22 +29,20 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -public class AAINQNamedQueryTest { +public class AaiNqNamedQueryTest { - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } + @BeforeClass + public static void setUpBeforeClass() throws Exception {} - @AfterClass - public static void tearDownAfterClass() throws Exception { - } + @AfterClass + public static void tearDownAfterClass() throws Exception {} - @Test - public void test() { - AAINQNamedQuery aaiNQNamedQuery = new AAINQNamedQuery(); - UUID uuid = UUID.randomUUID(); - aaiNQNamedQuery.setNamedQueryUUID(uuid); - assertNotNull(aaiNQNamedQuery); - assertEquals(aaiNQNamedQuery.getNamedQueryUUID(), uuid); - } + @Test + public void test() { + AaiNqNamedQuery aaiNqNamedQuery = new AaiNqNamedQuery(); + 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 0561fa690..1f0a8354a 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * aai * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -17,9 +17,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.aai; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import java.util.UUID; @@ -27,24 +29,22 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -public class AAINQQueryParametersTest { - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Test - public void test() { - AAINQQueryParameters aaiNQQueryParameters = new AAINQQueryParameters(); - AAINQNamedQuery aaiNQNamedQuery = new AAINQNamedQuery(); - aaiNQNamedQuery.setNamedQueryUUID(UUID.randomUUID()); - aaiNQQueryParameters.setNamedQuery(aaiNQNamedQuery); - assertNotNull(aaiNQNamedQuery); - assertEquals(aaiNQQueryParameters.getNamedQuery(), aaiNQNamedQuery); - } +public class AaiNqQueryParametersTest { + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Test + public void test() { + AaiNqQueryParameters aaiNqQueryParameters = new AaiNqQueryParameters(); + AaiNqNamedQuery aaiNqNamedQuery = new AaiNqNamedQuery(); + aaiNqNamedQuery.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 index d13689814..e943c0c01 100644 --- 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * aai * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -17,23 +17,25 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.aai; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import org.junit.Test; -public class AAINQRequestErrorTest { +public class AaiNqRequestErrorTest { + + @Test + public void test() { + AaiNqRequestError aainqRequestError = new AaiNqRequestError(); + AaiNqServiceExcept serviceExcept = new AaiNqServiceExcept(); + aainqRequestError.setServiceExcept(serviceExcept); + assertEquals(aainqRequestError.getServiceExcept(), serviceExcept); - @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()); - } + 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 new file mode 100644 index 000000000..1ac5e457b --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqRequestTest.java @@ -0,0 +1,68 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017-2018 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.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.UUID; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AaiNqRequestTest { + private static final Logger logger = LoggerFactory.getLogger(AaiNqRequestTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Test + public void test() { + AaiNqRequest aaiNqRequest = new AaiNqRequest(); + AaiNqInstanceFilters aaiNqInstanceFilters = new AaiNqInstanceFilters(); + + aaiNqRequest.setInstanceFilters(aaiNqInstanceFilters); + assertNotNull(aaiNqRequest.getInstanceFilters()); + AaiNqNamedQuery aaiNqNamedQuery = new AaiNqNamedQuery(); + UUID uuid = UUID.randomUUID(); + aaiNqNamedQuery.setNamedQueryUuid(uuid); + + AaiNqQueryParameters aaiNqQueryParameters = new AaiNqQueryParameters(); + 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 e481f0aca..c715a22c2 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * aai * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -17,6 +17,7 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.aai; import java.util.LinkedList; @@ -26,34 +27,42 @@ import org.onap.policy.aai.util.Serialization; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class AAINQResponseTest { - private static final Logger logger = LoggerFactory.getLogger(AAINQResponseTest.class); +public class AaiNqResponseTest { + private static final Logger logger = LoggerFactory.getLogger(AaiNqResponseTest.class); + + @Test + public void test() { + getAaiNqResponse(); + } - @Test - public void Test() { - getAAINQResponse(); - } - - public AAINQResponse getAAINQResponse() { - AAINQInventoryResponseItem serviceItem = new AAINQInventoryResponseItem(); + /** + * Get A&AI NQ response. + * + * @return the A&AI NG response + */ + public AaiNqResponse getAaiNqResponse() { + AaiNqInventoryResponseItem serviceItem = new AaiNqInventoryResponseItem(); serviceItem.setModelName("service-instance"); - serviceItem.setServiceInstance(new AAINQServiceInstance()); - serviceItem.getServiceInstance().setServiceInstanceID("dhv-test-vhnfportal-service-instance-id"); + 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")); + 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(); + AaiNqInventoryResponseItem vfModuleItem = new AaiNqInventoryResponseItem(); vfModuleItem.setModelName("vf-module"); - vfModuleItem.setVfModule(new AAINQVfModule()); + 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"); @@ -65,62 +74,70 @@ public class AAINQResponseTest { 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")); + 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.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 genericVnfItem = new AaiNqInventoryResponseItem(); + 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.setCloudRegion(new AAINQCloudRegion()); + AaiNqInventoryResponseItem cloudItem = new AaiNqInventoryResponseItem(); + 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.setTenant(new AAINQTenant()); + AaiNqInventoryResponseItem tenantItem = new AaiNqInventoryResponseItem(); + 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.setItems(new AaiNqInventoryResponseItems()); tenantItem.getItems().setInventoryResponseItems(new LinkedList<>()); tenantItem.getItems().getInventoryResponseItems().add(cloudItem); - AAINQInventoryResponseItem vserverItem = new AAINQInventoryResponseItem(); - vserverItem.setVserver(new AAINQVServer()); + AaiNqInventoryResponseItem vserverItem = new AaiNqInventoryResponseItem(); + vserverItem.setVserver(new AaiNqVServer()); vserverItem.getVserver().setVserverId("dhv-test-vserver"); vserverItem.getVserver().setVserverName("dhv-test-vserver-name"); vserverItem.getVserver().setVserverName2("dhv-test-vserver-name2"); @@ -129,15 +146,15 @@ public class AAINQResponseTest { vserverItem.getVserver().setInMaint(false); vserverItem.getVserver().setIsClosedLoopDisabled(false); vserverItem.getVserver().setResourceVersion("1485366417"); - vserverItem.setItems(new AAINQInventoryResponseItems()); + vserverItem.setItems(new AaiNqInventoryResponseItems()); vserverItem.getItems().setInventoryResponseItems(new LinkedList<>()); - vserverItem.getItems().getInventoryResponseItems().add(genericVNFItem); + vserverItem.getItems().getInventoryResponseItems().add(genericVnfItem); vserverItem.getItems().getInventoryResponseItems().add(tenantItem); - AAINQResponse aaiResponse = new AAINQResponse(); + 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 new file mode 100644 index 000000000..0d6a49361 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqResponseWrapperTest.java @@ -0,0 +1,172 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017-2018 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.assertNotNull; + +import java.util.LinkedList; +import java.util.UUID; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AaiNqResponseWrapperTest { + private static final Logger logger = LoggerFactory.getLogger(AaiNqResponseWrapperTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Test + public void test() { + AaiNqInventoryResponseItem serviceItem = new AaiNqInventoryResponseItem(); + serviceItem.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.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.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.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.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.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); + AaiNqResponseWrapper aaiNqResponseWarapper = new AaiNqResponseWrapper(); + aaiNqResponseWarapper.setAaiNqResponse(aaiResponse); + 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 new file mode 100644 index 000000000..add616dce --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqServiceInstanceTest.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017-2018 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.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AaiNqServiceInstanceTest { + private static final Logger logger = LoggerFactory.getLogger(AaiNqServiceInstanceTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Test + public void test() { + AaiNqServiceInstance aaiNqServiceInstance = new AaiNqServiceInstance(); + aaiNqServiceInstance.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("dhv-test-vhnfportal-service-instance-id", aaiNqServiceInstance.getServiceInstanceId()); + assertEquals("dhv-test-service-instance-name1", aaiNqServiceInstance.getServiceInstanceName()); + assertEquals("82194af1-3c2c-485a-8f44-420e22a9eaa4", aaiNqServiceInstance.getPersonaModelId()); + assertEquals("1.0", aaiNqServiceInstance.getPersonaModelVersion()); + assertEquals("dhv-test-service-instance-location-id1", aaiNqServiceInstance.getServiceInstanceLocationId()); + assertEquals("1485366092", aaiNqServiceInstance.getResourceVersion()); + assertEquals("SomeID", aaiNqServiceInstance.getModelInvariantId()); + assertEquals("SomeVersion", aaiNqServiceInstance.getModelVersionId()); + 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 b696c7bd4..c1755f9cb 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * aai * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -17,9 +17,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.aai; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -28,29 +30,27 @@ import org.onap.policy.aai.util.Serialization; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class AAINQTenantTest { - private static final Logger logger = LoggerFactory.getLogger(AAINQTenantTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Test - public void test() { - AAINQTenant aaiNQTenant = new AAINQTenant(); - aaiNQTenant.setTenantId("dhv-test-tenant"); - aaiNQTenant.setTenantName("dhv-test-tenant-name"); - aaiNQTenant.setResourceVersion("1485366334"); - assertNotNull(aaiNQTenant); - assertEquals("dhv-test-tenant", aaiNQTenant.getTenantId()); - assertEquals("dhv-test-tenant-name", aaiNQTenant.getTenantName()); - assertEquals("1485366334", aaiNQTenant.getResourceVersion()); - - logger.info(Serialization.gsonPretty.toJson(aaiNQTenant)); - } +public class AaiNqTenantTest { + private static final Logger logger = LoggerFactory.getLogger(AaiNqTenantTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Test + public void test() { + AaiNqTenant aaiNqTenant = new AaiNqTenant(); + aaiNqTenant.setTenantId("dhv-test-tenant"); + aaiNqTenant.setTenantName("dhv-test-tenant-name"); + aaiNqTenant.setResourceVersion("1485366334"); + assertNotNull(aaiNqTenant); + assertEquals("dhv-test-tenant", aaiNqTenant.getTenantId()); + assertEquals("dhv-test-tenant-name", aaiNqTenant.getTenantName()); + assertEquals("1485366334", aaiNqTenant.getResourceVersion()); + + logger.info(Serialization.gsonPretty.toJson(aaiNqTenant)); + } } diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVServerTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVServerTest.java new file mode 100644 index 000000000..9f49ecfef --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVServerTest.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017-2018 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.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AaiNqVServerTest { + private static final Logger logger = LoggerFactory.getLogger(AaiNqVServerTest.class); + + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Test + public void test() { + AaiNqVServer aaiNqVServer = new AaiNqVServer(); + aaiNqVServer.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("dhv-test-vserver", aaiNqVServer.getVserverId()); + assertEquals("dhv-test-vserver-name", aaiNqVServer.getVserverName()); + assertEquals("dhv-test-vserver-name2", aaiNqVServer.getVserverName2()); + assertEquals("PREPROV", aaiNqVServer.getProvStatus()); + assertEquals("dhv-test-vserver-selflink", aaiNqVServer.getVserverSelflink()); + assertEquals(false, aaiNqVServer.getInMaint()); + assertEquals(false, aaiNqVServer.getIsClosedLoopDisabled()); + assertEquals("1485366417", aaiNqVServer.getResourceVersion()); + logger.info(Serialization.gsonPretty.toJson(aaiNqVServer)); + } + +} diff --git a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVfModuleTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVfModuleTest.java new file mode 100644 index 000000000..1bbb711a5 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/AaiNqVfModuleTest.java @@ -0,0 +1,77 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017-2018 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.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AaiNqVfModuleTest { + private static final Logger logger = LoggerFactory.getLogger(AaiNqVfModuleTest.class); + + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Test + public void test() { + AaiNqVfModule aaiNqVfModule = new AaiNqVfModule(); + aaiNqVfModule.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("example-vf-module-id-val-49261", aaiNqVfModule.getVfModuleId()); + assertEquals("example-vf-module-name-val-73074", aaiNqVfModule.getVfModuleName()); + assertEquals("example-heat-stack-id-val-86300", aaiNqVfModule.getHeatStackId()); + assertEquals("example-orchestration-status-val-56523", aaiNqVfModule.getOrchestrationStatus()); + assertEquals(true, aaiNqVfModule.getIsBaseVfModule()); + assertEquals("1485366450", aaiNqVfModule.getResourceVersion()); + assertEquals("ef86f9c5-2165-44f3-8fc3-96018b609ea5", aaiNqVfModule.getPersonaModelId()); + assertEquals("1.0", aaiNqVfModule.getPersonaModelVersion()); + assertEquals("example-widget-model-id-val-92571", aaiNqVfModule.getWidgetModelId()); + assertEquals("example-widget-model-version-val-83317", aaiNqVfModule.getWidgetModelVersion()); + assertEquals("example-contrail-service-instance-fqdn-val-86796", + aaiNqVfModule.getContrailServiceInstanceFqdn()); + assertEquals("SomeId", aaiNqVfModule.getModelInvariantId()); + assertEquals("SomeVersion", aaiNqVfModule.getModelVersionId()); + 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 deleted file mode 100644 index b4a8a51eb..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFInstanceTest.java +++ /dev/null @@ -1,101 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ -package org.onap.policy.aai; - -import static org.junit.Assert.*; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class PNFInstanceTest { - private static final Logger logger = LoggerFactory.getLogger(PNFInstanceTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Test - public void test() { - PNFInstance pnfInstance = new PNFInstance(); - pnfInstance.setPNFInstanceName("pnf-instance-name-test"); - pnfInstance.setPNFName("pnf-name-test"); - pnfInstance.setPNFType(PNFType.ENODEB); - pnfInstance.setPNFSerial("pnf-serial-test"); - assertNotNull(pnfInstance); - assertEquals("pnf-instance-name-test", pnfInstance.getPNFInstanceName()); - - 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 deleted file mode 100644 index 86a037892..000000000 --- a/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PNFTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * aai - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= -*/ -package org.onap.policy.aai; - -import static org.junit.Assert.*; - -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; -import org.onap.policy.aai.util.Serialization; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class PNFTest { - private static final Logger logger = LoggerFactory.getLogger(PNFTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Test - public void test() { - PNF pnf = new PNF(); - pnf.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/PnfInstanceTest.java b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PnfInstanceTest.java new file mode 100644 index 000000000..495d9f134 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PnfInstanceTest.java @@ -0,0 +1,105 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017-2018 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.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PnfInstanceTest { + private static final Logger logger = LoggerFactory.getLogger(PnfInstanceTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Test + public void test() { + PnfInstance pnfInstance = new PnfInstance(); + pnfInstance.setPnfInstanceName("pnf-instance-name-test"); + pnfInstance.setPnfName("pnf-name-test"); + pnfInstance.setPnfType(PnfType.ENODEB); + pnfInstance.setPnfSerial("pnf-serial-test"); + assertNotNull(pnfInstance); + assertEquals("pnf-instance-name-test", pnfInstance.getPnfInstanceName()); + + 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 new file mode 100644 index 000000000..0380c15b0 --- /dev/null +++ b/controlloop/common/model-impl/aai/src/test/java/org/onap/policy/aai/PnfTest.java @@ -0,0 +1,77 @@ +/*- + * ============LICENSE_START======================================================= + * aai + * ================================================================================ + * Copyright (C) 2017-2018 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.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.policy.aai.util.Serialization; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PnfTest { + private static final Logger logger = LoggerFactory.getLogger(PnfTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Test + public void test() { + Pnf pnf = new Pnf(); + pnf.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 7081b0e7e..e62430ade 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * aai * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -17,9 +17,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.aai; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -28,24 +29,22 @@ import org.onap.policy.aai.util.Serialization; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class PNFTypeTest { - private static final Logger logger = LoggerFactory.getLogger(PNFTypeTest.class); +public class PnfTypeTest { + private static final Logger logger = LoggerFactory.getLogger(PnfTypeTest.class); - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } + @BeforeClass + public static void setUpBeforeClass() throws Exception {} - @AfterClass - public static void tearDownAfterClass() throws Exception { - } + @AfterClass + public static void tearDownAfterClass() throws Exception {} - @Test - public void test() { - PNFType pnfType = PNFType.ENODEB; - assertNotNull(pnfType); - assertNotNull(pnfType.toString()); - logger.info(Serialization.gsonPretty.toJson(pnfType)); - } + @Test + 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 a240570d3..57f6c7605 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * aai * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -17,9 +17,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.aai; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -29,23 +30,21 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class RelatedToPropertyItemTest { - private static final Logger logger = LoggerFactory.getLogger(RelatedToPropertyItemTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Test - public void test() { - RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); - relatedToPropertyItem.setPropertyKey("model.model-name"); - relatedToPropertyItem.setPropertyValue("service-instance"); - assertNotNull(relatedToPropertyItem); - logger.info(Serialization.gsonPretty.toJson(relatedToPropertyItem)); - } + private static final Logger logger = LoggerFactory.getLogger(RelatedToPropertyItemTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Test + public void test() { + RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); + relatedToPropertyItem.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 05b72ed6a..439c11dd2 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * aai * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -17,9 +17,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.aai; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -29,33 +30,31 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class RelatedToPropertyTest { - private static final Logger logger = LoggerFactory.getLogger(RelatedToPropertyTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Test - public void test() { - RelatedToProperty relatedToProperty = new RelatedToProperty(); - RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); - relatedToPropertyItem.setPropertyKey("model.model-name"); - relatedToPropertyItem.setPropertyValue("service-instance"); - relatedToProperty.getRelatedTo().add(relatedToPropertyItem); - RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem(); - relatedToPropertyItem2.setPropertyKey("model.model-name2"); - relatedToPropertyItem2.setPropertyValue("service-instance2"); - relatedToProperty.getRelatedTo().add(relatedToPropertyItem2); - assertNotNull(relatedToProperty); - - relatedToProperty.setRelatedTo(relatedToProperty.getRelatedTo()); - assertNotNull(relatedToProperty); - - logger.info(Serialization.gsonPretty.toJson(relatedToProperty)); - } + private static final Logger logger = LoggerFactory.getLogger(RelatedToPropertyTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Test + public void test() { + RelatedToProperty relatedToProperty = new RelatedToProperty(); + RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); + relatedToPropertyItem.setPropertyKey("model.model-name"); + relatedToPropertyItem.setPropertyValue("service-instance"); + relatedToProperty.getRelatedTo().add(relatedToPropertyItem); + RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem(); + relatedToPropertyItem2.setPropertyKey("model.model-name2"); + relatedToPropertyItem2.setPropertyValue("service-instance2"); + relatedToProperty.getRelatedTo().add(relatedToPropertyItem2); + 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 38727b7b5..5ad99f9a7 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * aai * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -17,9 +17,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.aai; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -27,20 +28,18 @@ import org.junit.Test; public class RelationshipDataItemTest { - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Test - public void test() { - RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - relationshipDataItem.setRelationshipKey("relationship-key"); - relationshipDataItem.setRelationshipValue("relationship-value"); - assertNotNull(relationshipDataItem); - } + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Test + public void test() { + RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); + 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 6b228f7a0..57543711d 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * aai * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -17,9 +17,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.aai; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -29,37 +31,35 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class RelationshipDataTest { - private static final Logger logger = LoggerFactory.getLogger(RelationshipDataTest.class); + private static final Logger logger = LoggerFactory.getLogger(RelationshipDataTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } + @Test + public void test() { + RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); + relationshipDataItem.setRelationshipKey("relationship-key"); + relationshipDataItem.setRelationshipValue("relationship-value"); + assertNotNull(relationshipDataItem); + assertEquals("relationship-key", relationshipDataItem.getRelationshipKey()); + assertEquals("relationship-value", relationshipDataItem.getRelationshipValue()); - @AfterClass - public static void tearDownAfterClass() throws Exception { - } + RelationshipData relationshipData = new RelationshipData(); + relationshipData.getRelationshipData().add(relationshipDataItem); + RelationshipDataItem relationshipDataItem2 = new RelationshipDataItem(); + relationshipDataItem2.setRelationshipKey("relationship-key2"); + relationshipDataItem2.setRelationshipValue("relationship-value2"); + relationshipData.getRelationshipData().add(relationshipDataItem2); + assertNotNull(relationshipData); - @Test - public void test() { - RelationshipData relationshipData = new RelationshipData(); - RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - relationshipDataItem.setRelationshipKey("relationship-key"); - relationshipDataItem.setRelationshipValue("relationship-value"); - assertNotNull(relationshipDataItem); - assertEquals("relationship-key", relationshipDataItem.getRelationshipKey()); - assertEquals("relationship-value", relationshipDataItem.getRelationshipValue()); + relationshipData.setRelationshipData(relationshipData.getRelationshipData()); + assertNotNull(relationshipData); - relationshipData.getRelationshipData().add(relationshipDataItem); - RelationshipDataItem relationshipDataItem2 = new RelationshipDataItem(); - relationshipDataItem2.setRelationshipKey("relationship-key2"); - relationshipDataItem2.setRelationshipValue("relationship-value2"); - relationshipData.getRelationshipData().add(relationshipDataItem2); - assertNotNull(relationshipData); - - relationshipData.setRelationshipData(relationshipData.getRelationshipData()); - assertNotNull(relationshipData); - - logger.info(Serialization.gsonPretty.toJson(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 625592e76..98445a2de 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * aai * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -17,9 +17,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.aai; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -29,29 +30,27 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class RelationshipItemTest { - private static final Logger logger = LoggerFactory.getLogger(RelationshipItemTest.class); - - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } - - @AfterClass - public static void tearDownAfterClass() throws Exception { - } - - @Test - public void test() { - RelationshipItem relationshipItem = new RelationshipItem(); - RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); - relatedToPropertyItem.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)); - } + private static final Logger logger = LoggerFactory.getLogger(RelationshipItemTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Test + public void test() { + RelationshipItem relationshipItem = new RelationshipItem(); + RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); + relatedToPropertyItem.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 7300fb87c..e7f207e6b 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * aai * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -17,9 +17,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.aai; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -29,49 +31,48 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class RelationshipListTest { - private static final Logger logger = LoggerFactory.getLogger(RelationshipListTest.class); + private static final Logger logger = LoggerFactory.getLogger(RelationshipListTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} + + @AfterClass + public static void tearDownAfterClass() throws Exception {} + + @Test + public void test() { + Relationship relationship = new Relationship(); + relationship.setRelatedLink("related-link"); + relationship.setRelatedTo("related-to"); + assertEquals("related-link", relationship.getRelatedLink()); + assertEquals("related-to", relationship.getRelatedTo()); - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } + RelatedToProperty relatedToProperty = new RelatedToProperty(); + RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); + relatedToPropertyItem.setPropertyKey("model.model-name"); + relatedToPropertyItem.setPropertyValue("service-instance"); + relatedToProperty.getRelatedTo().add(relatedToPropertyItem); + RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem(); + relatedToPropertyItem2.setPropertyKey("model.model-name2"); + relatedToPropertyItem2.setPropertyValue("service-instance2"); + relatedToProperty.getRelatedTo().add(relatedToPropertyItem2); + relationship.setRelatedToProperty(relatedToProperty); + RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); + relationshipDataItem.setRelationshipKey("relationship-key"); + relationshipDataItem.setRelationshipValue("relationship-value"); + RelationshipData relationshipData = new RelationshipData(); + relationshipData.getRelationshipData().add(relationshipDataItem); + relationship.setRelationshipData(relationshipData); - @AfterClass - public static void tearDownAfterClass() throws Exception { - } + RelationshipList relationshipList = new RelationshipList(); + relationshipList.getRelationshipList().add(relationship); - @Test - public void test() { - RelationshipList relationshipList = new RelationshipList(); - Relationship relationship = new Relationship(); - relationship.setRelatedLink("related-link"); - relationship.setRelatedTo("related-to"); - assertEquals("related-link", relationship.getRelatedLink()); - assertEquals("related-to", relationship.getRelatedTo()); + assertNotNull(relationshipList); - RelatedToProperty relatedToProperty = new RelatedToProperty(); - RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); - relatedToPropertyItem.setPropertyKey("model.model-name"); - relatedToPropertyItem.setPropertyValue("service-instance"); - relatedToProperty.getRelatedTo().add(relatedToPropertyItem); - RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem(); - relatedToPropertyItem2.setPropertyKey("model.model-name2"); - relatedToPropertyItem2.setPropertyValue("service-instance2"); - relatedToProperty.getRelatedTo().add(relatedToPropertyItem2); - relationship.setRelatedToProperty(relatedToProperty); - RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - relationshipDataItem.setRelationshipKey("relationship-key"); - relationshipDataItem.setRelationshipValue("relationship-value"); - RelationshipData relationshipData = new RelationshipData(); - relationshipData.getRelationshipData().add(relationshipDataItem); - relationship.setRelationshipData(relationshipData); - relationshipList.getRelationshipList().add(relationship); - - assertNotNull(relationshipList); - - relationshipList.setRelationshipList(relationshipList.getRelationshipList()); - assertNotNull(relationshipList); + relationshipList.setRelationshipList(relationshipList.getRelationshipList()); + assertNotNull(relationshipList); - logger.info(Serialization.gsonPretty.toJson(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 81ba0885c..526ff8a1f 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * aai * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 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. @@ -17,9 +17,11 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.aai; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -29,44 +31,42 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class RelationshipTest { - private static final Logger logger = LoggerFactory.getLogger(AAINQResponseWrapperTest.class); + private static final Logger logger = LoggerFactory.getLogger(AaiNqResponseWrapperTest.class); + + @BeforeClass + public static void setUpBeforeClass() throws Exception {} - @BeforeClass - public static void setUpBeforeClass() throws Exception { - } + @AfterClass + public static void tearDownAfterClass() throws Exception {} - @AfterClass - public static void tearDownAfterClass() throws Exception { - } + @Test + public void test() { + Relationship relationship = new Relationship(); + relationship.setRelatedLink("related-link"); + relationship.setRelatedTo("related-to"); + assertEquals("related-link", relationship.getRelatedLink()); + assertEquals("related-to", relationship.getRelatedTo()); - @Test - public void test() { - Relationship relationship = new Relationship(); - relationship.setRelatedLink("related-link"); - relationship.setRelatedTo("related-to"); - assertEquals("related-link", relationship.getRelatedLink()); - assertEquals("related-to", relationship.getRelatedTo()); - - RelatedToProperty relatedToProperty = new RelatedToProperty(); - RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); - relatedToPropertyItem.setPropertyKey("model.model-name"); - relatedToPropertyItem.setPropertyValue("service-instance"); - relatedToProperty.getRelatedTo().add(relatedToPropertyItem); - RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem(); - relatedToPropertyItem2.setPropertyKey("model.model-name2"); - relatedToPropertyItem2.setPropertyValue("service-instance2"); - relatedToProperty.getRelatedTo().add(relatedToPropertyItem2); - relationship.setRelatedToProperty(relatedToProperty); - assertEquals(relationship.getRelatedToProperty(), relatedToProperty); - RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); - relationshipDataItem.setRelationshipKey("relationship-key"); - relationshipDataItem.setRelationshipValue("relationship-value"); - RelationshipData relationshipData = new RelationshipData(); - relationshipData.getRelationshipData().add(relationshipDataItem); - relationship.setRelationshipData(relationshipData); - assertEquals(relationship.getRelationshipData(), relationshipData); - assertNotNull(relationship); - logger.info(Serialization.gsonPretty.toJson(relationship)); - } + RelatedToProperty relatedToProperty = new RelatedToProperty(); + RelatedToPropertyItem relatedToPropertyItem = new RelatedToPropertyItem(); + relatedToPropertyItem.setPropertyKey("model.model-name"); + relatedToPropertyItem.setPropertyValue("service-instance"); + relatedToProperty.getRelatedTo().add(relatedToPropertyItem); + RelatedToPropertyItem relatedToPropertyItem2 = new RelatedToPropertyItem(); + relatedToPropertyItem2.setPropertyKey("model.model-name2"); + relatedToPropertyItem2.setPropertyValue("service-instance2"); + relatedToProperty.getRelatedTo().add(relatedToPropertyItem2); + relationship.setRelatedToProperty(relatedToProperty); + assertEquals(relationship.getRelatedToProperty(), relatedToProperty); + RelationshipDataItem relationshipDataItem = new RelationshipDataItem(); + relationshipDataItem.setRelationshipKey("relationship-key"); + relationshipDataItem.setRelationshipValue("relationship-value"); + RelationshipData relationshipData = new RelationshipData(); + relationshipData.getRelationshipData().add(relationshipDataItem); + 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 index 2a7beb499..69004e7f3 100644 --- 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 @@ -17,23 +17,24 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.aai.util; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; import java.io.IOException; import org.junit.Test; -public class AAIExceptionTest { +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())); - } + @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())); + } } |