aboutsummaryrefslogtreecommitdiffstats
path: root/common/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/test')
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIClientResponseExceptionMapperTest.java68
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIConfigurationClientTest.java156
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIErrorFormatterTest.java104
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java91
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIPServerTest.java52
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java150
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java308
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java121
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java76
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java140
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java174
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIURITest.java41
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIUpdatorImplTest.java53
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIUpdatorTest.java60
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java113
-rw-r--r--common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java149
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java110
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java56
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java43
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java76
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java133
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java68
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java54
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java69
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java301
-rw-r--r--common/src/test/java/org/onap/so/client/aai/objects/CustomAAIObjectType.java42
-rw-r--r--common/src/test/java/org/onap/so/client/defaultproperties/DefaultAAIPropertiesImpl.java95
-rw-r--r--common/src/test/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverterTest.java118
-rw-r--r--common/src/test/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImplTest.java47
-rw-r--r--common/src/test/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadExceptionTest.java40
-rw-r--r--common/src/test/java/org/onap/so/client/sdno/SDNOHealthCheckClientTest.java94
-rw-r--r--common/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java56
-rw-r--r--common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java120
-rw-r--r--common/src/test/resources/__files/aai/bulkprocess/response-failure.json32
-rw-r--r--common/src/test/resources/__files/aai/bulkprocess/response-success.json32
-rw-r--r--common/src/test/resources/__files/aai/bulkprocess/test-request-small.json10
-rw-r--r--common/src/test/resources/__files/aai/bulkprocess/test-request.json26
-rw-r--r--common/src/test/resources/__files/aai/error-message.json1
-rw-r--r--common/src/test/resources/__files/aai/pserver.json14
-rw-r--r--common/src/test/resources/__files/aai/query/pathed-result.json12
-rw-r--r--common/src/test/resources/__files/aai/query/single-query-result.json80
-rw-r--r--common/src/test/resources/__files/aai/resources/e2e-complex.json660
-rw-r--r--common/src/test/resources/__files/aai/resources/empty-query-result.json3
-rw-r--r--common/src/test/resources/__files/aai/resources/mockObject.json10
-rw-r--r--common/src/test/resources/__files/aai/resources/service-instance-pathed-query.json8
-rw-r--r--common/src/test/resources/__files/aai/singletransaction/sample-request.json32
-rw-r--r--common/src/test/resources/__files/aai/singletransaction/sample-response-failure.json30
-rw-r--r--common/src/test/resources/__files/aai/singletransaction/sample-response.json22
-rw-r--r--common/src/test/resources/aai.properties3
-rw-r--r--common/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-post-check-request.json27
-rw-r--r--common/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-pre-check-request.json27
-rw-r--r--common/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-post-check-request.json23
-rw-r--r--common/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-pre-check-request.json23
-rw-r--r--common/src/test/resources/org/onap/so/client/sdno/output-failure.json25
-rw-r--r--common/src/test/resources/org/onap/so/client/sdno/output-success.json22
-rw-r--r--common/src/test/resources/org/onap/so/client/sdno/response.json17
56 files changed, 0 insertions, 4517 deletions
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIClientResponseExceptionMapperTest.java b/common/src/test/java/org/onap/so/client/aai/AAIClientResponseExceptionMapperTest.java
deleted file mode 100644
index 7af36b0bdd..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/AAIClientResponseExceptionMapperTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai;
-
-import static org.junit.Assert.assertEquals;
-import java.util.Arrays;
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.so.client.aai.entities.AAIError;
-import org.onap.so.client.aai.entities.RequestError;
-import org.onap.so.client.aai.entities.ServiceException;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class AAIClientResponseExceptionMapperTest {
-
- AAIClientResponseExceptionMapper mapper;
- String errorMsg;
-
- @Before
- public void before() {
- mapper = new AAIClientResponseExceptionMapper();
- errorMsg = "Error calling A&AI. Request-Id=" + mapper.getRequestId() + " ";
- }
-
- @Test
- public void testExtractMessageWithEntity() throws JsonProcessingException {
- ServiceException svcException = new ServiceException();
- svcException.setText("test %1 message - %2");
- svcException.setVariables(Arrays.asList("error", "service exception %1 test"));
-
- RequestError requestError = new RequestError();
- requestError.setServiceException(svcException);
-
- AAIError error = new AAIError();
- error.setRequestError(requestError);
-
- ObjectMapper objMapper = new ObjectMapper();
- String strRequestError = objMapper.writeValueAsString(error);
-
- assertEquals(errorMsg + "test error message - service exception error test",
- mapper.extractMessage(strRequestError).get());
- }
-
- @Test
- public void testExtractMessageWithoutEntity() {
- assertEquals(errorMsg, mapper.extractMessage("").get());
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIConfigurationClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIConfigurationClientTest.java
deleted file mode 100644
index cf87355ec7..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/AAIConfigurationClientTest.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.isA;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import java.util.Optional;
-import java.util.UUID;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.client.aai.entities.Configuration;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.serviceinstancebeans.ModelInfo;
-import org.onap.so.serviceinstancebeans.RequestDetails;
-
-@RunWith(MockitoJUnitRunner.class)
-public class AAIConfigurationClientTest {
-
- @Mock
- AAIResourcesClient aaiClient;
-
- @InjectMocks
- AAIConfigurationClient aaiConfigurationClient = new AAIConfigurationClient();
-
- @Test
- public void verifyCreate() {
- ModelInfo modelInfo = new ModelInfo();
- modelInfo.setModelInvariantId("testInvariantID");
- modelInfo.setModelVersionId("testVersionID");
- modelInfo.setModelCustomizationId("testCustomizationID");
-
- RequestDetails requestDetails = new RequestDetails();
- requestDetails.setModelInfo(modelInfo);
-
- String configurationId = UUID.randomUUID().toString();
- String configurationType = "test";
- String configurationSubType = "test";
-
- // Test Create Configuration
- doNothing().when(aaiClient).create(isA(AAIResourceUri.class), isA(Object.class));
- aaiConfigurationClient.createConfiguration(requestDetails, configurationId, configurationType,
- configurationSubType);
- verify(aaiClient, times(1)).create(isA(AAIResourceUri.class), isA(Object.class));
- }
-
- @Test
- public void verifyConfigurePayload() {
- ModelInfo modelInfo = new ModelInfo();
- modelInfo.setModelInvariantId("testInvariantID");
- modelInfo.setModelVersionId("testVersionID");
- modelInfo.setModelCustomizationId("testCustomizationID");
-
- RequestDetails requestDetails = new RequestDetails();
- requestDetails.setModelInfo(modelInfo);
-
- String configurationId = UUID.randomUUID().toString();
- String configurationType = "test";
- String configurationSubType = "test";
- AAIResourceUri uri = aaiConfigurationClient.getConfigurationURI(configurationId);
-
- Configuration payload = aaiConfigurationClient.configurePayload(requestDetails, configurationId,
- configurationType, configurationSubType);
-
- assertEquals(configurationId, payload.getConfigurationId());
- assertEquals(configurationType, payload.getConfigurationType());
- assertEquals(configurationSubType, payload.getConfigurationSubType());
- assertEquals(uri.build().getPath(), payload.getConfigurationSelflink());
- assertEquals("PreCreated", payload.getOrchestrationStatus());
- assertEquals("", payload.getOperationalStatus());
- assertEquals(modelInfo.getModelVersionId(), payload.getModelVersionId());
- assertEquals(modelInfo.getModelInvariantId(), payload.getModelInvariantId());
- assertEquals(modelInfo.getModelCustomizationId(), payload.getModelCustomizationId());
- }
-
- @Test
- public void testDeleteConfiguration() {
- String uuid = UUID.randomUUID().toString();
- doNothing().when(aaiClient).delete(isA(AAIResourceUri.class));
- aaiConfigurationClient.deleteConfiguration(uuid);
- verify(aaiClient, times(1)).delete(aaiConfigurationClient.getConfigurationURI(uuid));
- }
-
- @Test
- public void testUpdateOrchestrationStatus() {
- String uuid = UUID.randomUUID().toString();
- doNothing().when(aaiClient).update(isA(AAIResourceUri.class), isA(Object.class));
- aaiConfigurationClient.updateOrchestrationStatus(uuid, "testPayload");
- verify(aaiClient, times(1)).update(aaiConfigurationClient.getConfigurationURI(uuid), "testPayload");
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testGetConfiguration() {
- String uuid = UUID.randomUUID().toString();
- Optional<Configuration> expectedConfiguration = Optional.of(new Configuration());
- expectedConfiguration.get().setConfigurationId(uuid);
-
- doReturn(expectedConfiguration).when(aaiClient).get(isA(Class.class), isA(AAIResourceUri.class));
- Configuration actualConfiguration = aaiConfigurationClient.getConfiguration(uuid);
- verify(aaiClient, times(1)).get(Configuration.class, aaiConfigurationClient.getConfigurationURI(uuid));
- assertEquals(expectedConfiguration.get(), actualConfiguration);
- }
-
- @Test
- public void testConfigurationExists() {
- String uuid = UUID.randomUUID().toString();
- AAIResourceUri uri = aaiConfigurationClient.getConfigurationURI(uuid);
- boolean expectedResult;
- boolean actualResult;
-
- expectedResult = true;
- doReturn(expectedResult).when(aaiClient).exists(isA(AAIResourceUri.class));
- actualResult = aaiConfigurationClient.configurationExists(uuid);
- assertEquals(expectedResult, actualResult);
-
- expectedResult = false;
- doReturn(expectedResult).when(aaiClient).exists(isA(AAIResourceUri.class));
- actualResult = aaiConfigurationClient.configurationExists(uuid);
- assertEquals(expectedResult, actualResult);
-
- verify(aaiClient, times(2)).exists(uri);
- }
-
- @Test
- public void testGetConfigurationURI() {
- String uuid = UUID.randomUUID().toString();
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, uuid);
- assertEquals(uri, aaiConfigurationClient.getConfigurationURI(uuid));
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIErrorFormatterTest.java b/common/src/test/java/org/onap/so/client/aai/AAIErrorFormatterTest.java
deleted file mode 100644
index 3587c71de0..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/AAIErrorFormatterTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.doReturn;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.onap.so.client.aai.entities.AAIError;
-import org.onap.so.client.aai.entities.RequestError;
-import org.onap.so.client.aai.entities.ServiceException;
-
-public class AAIErrorFormatterTest {
-
- @Mock
- private AAIError errorObj;
-
- @Before
- public void init() {
- MockitoAnnotations.initMocks(this);
- }
-
- @Test
- public void testFillInTemplateWithReplace() {
- String error = "Error %1 on %2";
- List<String> list = Arrays.asList("PUT", "hello %1");
- AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj);
- String result = formatter.fillInTemplate(error, list);
- assertEquals("equal", "Error PUT on hello PUT", result);
-
- }
-
- @Test
- public void testFillInTemplateWithoutReplace() {
- String error = "Error";
- List<String> list = new ArrayList<>();
- AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj);
- String result = formatter.fillInTemplate(error, list);
- assertEquals("equal", "Error", result);
- }
-
- @Test
- public void testGetMessage() {
- ServiceException svcException = new ServiceException();
- svcException.setText("test %1 message - %2");
- svcException.setVariables(Arrays.asList("error", "service exception %1 test"));
-
- RequestError requestError = new RequestError();
- requestError.setServiceException(svcException);
-
- doReturn(requestError).when(errorObj).getRequestError();
-
- AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj);
- String result = formatter.getMessage();
- assertEquals("equal", "test error message - service exception error test", result);
- }
-
- @Test
- public void errorMessageOnPercentEncodedTest() {
- ServiceException svcException = new ServiceException();
- svcException.setText("test my%20Test %1 message - %2");
- svcException.setVariables(Arrays.asList("error", "service exception %1 test"));
-
- RequestError requestError = new RequestError();
- requestError.setServiceException(svcException);
-
- doReturn(requestError).when(errorObj).getRequestError();
-
- AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj);
- String result = formatter.getMessage();
- assertEquals("equal", "test my%20Test error message - service exception error test", result);
- }
-
- @Test
- public void testGetMessageNoParsable() {
- errorObj.setRequestError(null);
- AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj);
- String result = formatter.getMessage();
- assertEquals("equal", "no parsable error message found", result);
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java b/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java
deleted file mode 100644
index 20a6678386..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai;
-
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-
-public class AAIObjectTypeTest {
-
-
- @Test
- public void fromTypeNameTest() throws IllegalArgumentException, IllegalAccessException, InstantiationException {
- AAIObjectType type = AAIObjectType.fromTypeName("allotted-resource");
- assertEquals("allotted-resource", type.typeName());
-
- }
-
- @Test
- public void customTypeTest() throws IllegalArgumentException, IllegalAccessException, InstantiationException {
- AAIObjectType type = AAIObjectType.fromTypeName("my-custom-name");
- assertEquals("my-custom-name", type.typeName());
-
- }
-
- @Test
- public void verifyDefaultCase() {
- assertEquals("default removed for tenant", "tenant", AAIObjectType.DEFAULT_TENANT.typeName());
- assertEquals("default removed for cloud-region", "cloud-region", AAIObjectType.DEFAULT_CLOUD_REGION.typeName());
- }
-
- @Test
- public void verifyRegularCase() {
- assertEquals("default removed for tenant", "allotted-resource", AAIObjectType.ALLOTTED_RESOURCE.typeName());
- }
-
- @Test
- public void instanceGroupObjectTypeTest() {
- final String id = "test1";
- AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, id);
- assertEquals("/network/instance-groups/instance-group/test1", aaiUri.build().toString());
- }
-
- @Test
- public void collectionObjectTypeTest() {
- final String id = "test1";
- AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, id);
- assertEquals("/network/collections/collection/test1", aaiUri.build().toString());
- }
-
- @Test
- public void genericVnfTest() {
- AAIObjectType type = AAIObjectType.GENERIC_VNF;
- assertEquals("/network/generic-vnfs/generic-vnf/{vnf-id}", type.uriTemplate());
- assertEquals("/generic-vnfs/generic-vnf/{vnf-id}", type.partialUri());
- }
-
- @Test
- public void pInterfaceTest() {
- AAIObjectType type = AAIObjectType.P_INTERFACE;
- assertEquals("/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}",
- type.uriTemplate());
- assertEquals("/p-interfaces/p-interface/{interface-name}", type.partialUri());
- }
-
- @Test
- public void networkPolicyObjectTypeTest() {
- final String id = "test1";
- AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, id);
- assertEquals("/network/network-policies/network-policy/test1", aaiUri.build().toString());
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIPServerTest.java b/common/src/test/java/org/onap/so/client/aai/AAIPServerTest.java
deleted file mode 100644
index 4b3b7e9881..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/AAIPServerTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai;
-
-import static org.junit.Assert.assertEquals;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.List;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.onap.aai.domain.yang.Pserver;
-
-public class AAIPServerTest {
-
- @Test
- public void pserverTest() throws IOException {
- AAIRestClientImpl client = new AAIRestClientImpl();
- String json = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/aai/pserver.json")));
- List<Pserver> list = client.getListOfPservers(json);
-
- assertEquals("", list.get(0).getHostname(), "test");
- assertEquals("", list.size(), 2);
- }
-
- @Test
- @Ignore // IGNORED FOR 1710 MERGE TO ONAP
- public void pserverActualTest() throws IOException {
- AAIRestClientImpl client = new AAIRestClientImpl();
- List<Pserver> list = client.getPhysicalServerByVnfId("d946afed-8ebe-4c5d-9665-54fcc043b8e7");
- assertEquals("", list.size(), 0);
- }
-
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java
deleted file mode 100644
index c70f16eb83..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.ArgumentMatchers.isA;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-import javax.ws.rs.core.GenericType;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Spy;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.aai.domain.yang.Complex;
-import org.onap.so.client.RestClient;
-import org.onap.so.client.aai.entities.AAIResultWrapper;
-import org.onap.so.client.aai.entities.CustomQuery;
-import org.onap.so.client.aai.entities.Results;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.graphinventory.Format;
-import org.onap.so.client.graphinventory.GraphInventoryClient;
-import org.onap.so.client.graphinventory.GraphInventorySubgraphType;
-import org.onap.so.client.graphinventory.entities.Pathed;
-import org.onap.so.client.graphinventory.entities.ResourceAndUrl;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-
-@RunWith(MockitoJUnitRunner.class)
-public class AAIQueryClientTest {
-
- @Mock
- private RestClient restClient;
-
- @Mock
- private GraphInventoryClient client;
-
- @InjectMocks
- @Spy
- private AAIQueryClient aaiQueryClient = new AAIQueryClient();
-
- private String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/query/";
-
- private ObjectMapper mapper = new ObjectMapper();
-
- @Test
- public void testQuery() {
- List<AAIResourceUri> uris = Arrays.asList(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY));
-
- Format format = Format.SIMPLE;
- CustomQuery query = new CustomQuery(uris);
-
- doReturn(restClient).when(client).createClient(isA(AAIResourceUri.class));
- aaiQueryClient.query(format, query);
- verify(client, times(1))
- .createClient(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY).format(format));
- verify(restClient, times(1)).put(query, String.class);
- }
-
- @Test
- public void testCreateClient() {
- String depth = "testDepth";
- GraphInventorySubgraphType subgraph = GraphInventorySubgraphType.STAR;
-
- aaiQueryClient.depth(depth);
- aaiQueryClient.nodesOnly();
- aaiQueryClient.subgraph(subgraph);
-
- AAIResourceUri aaiUri = spy(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY));
- doReturn(aaiUri).when(aaiUri).clone();
- aaiQueryClient.setupQueryParams(aaiUri);
-
- verify(aaiUri, times(1)).queryParam("depth", depth);
- verify(aaiUri, times(1)).queryParam("nodesOnly", "");
- verify(aaiUri, times(1)).queryParam("subgraph", subgraph.toString());
- }
-
- @Test
- public void querySingleResourceTest() throws IOException {
- doReturn(getJson("single-query-result.json")).when(aaiQueryClient).query(eq(Format.RESOURCE_AND_URL),
- any(CustomQuery.class));
- List<Complex> result = aaiQueryClient.querySingleResource(
- new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(AAIObjectType.COMPLEX, "test"))),
- Complex.class);
- assertEquals(2, result.size());
- assertEquals("complex-id-15100-jc689q2", result.get(1).getPhysicalLocationId());
- }
-
- @Test
- public void getResourceAndUrlTest() throws IOException {
- doReturn(getJson("single-query-result.json")).when(aaiQueryClient).query(eq(Format.RESOURCE_AND_URL),
- any(CustomQuery.class));
- List<ResourceAndUrl<AAIResultWrapper>> result = aaiQueryClient.getResourceAndUrl(
- new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(AAIObjectType.COMPLEX, "test"))));
- assertEquals(2, result.size());
-
- assertEquals(1,
- result.get(1).getWrapper().getRelationships().get().getRelatedUris(AAIObjectType.PSERVER).size());
- }
-
- @Test
- public void querySingleTypeTest() throws IOException {
- when(client.createClient(isA(AAIResourceUri.class))).thenReturn(restClient);
- when(restClient.put(any(Object.class), any(GenericType.class))).thenReturn(
- mapper.readValue(getJson("pathed-result.json"), new TypeReference<Results<Map<String, Object>>>() {}));
-
-
- List<Pathed> results = aaiQueryClient.queryPathed(
- new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(AAIObjectType.COMPLEX, "test"))));
-
- assertEquals(2, results.size());
- assertEquals("service-instance", results.get(1).getResourceType());
- }
-
- private String getJson(String filename) throws IOException {
- return new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + filename)));
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
deleted file mode 100644
index a7fd6e904e..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.delete;
-import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import java.util.Optional;
-import javax.ws.rs.BadRequestException;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Spy;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.aai.domain.yang.GenericVnf;
-import org.onap.aai.domain.yang.GenericVnfs;
-import org.onap.aai.domain.yang.Relationship;
-import org.onap.so.client.RestClient;
-import org.onap.so.client.aai.entities.AAIEdgeLabel;
-import org.onap.so.client.aai.entities.AAIResultWrapper;
-import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl;
-import org.onap.so.client.graphinventory.exceptions.GraphInventoryMultipleItemsException;
-import com.github.tomakehurst.wiremock.admin.NotFoundException;
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-
-@RunWith(MockitoJUnitRunner.class)
-public class AAIResourcesClientTest {
-
-
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
-
- @Spy
- public AAIClient client;
-
- @InjectMocks
- public AAIResourcesClient aaiClient = new AAIResourcesClient();
-
- private String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/query/";
-
- @Before
- public void beforeTest() {
- doReturn(new DefaultAAIPropertiesImpl(wireMockRule.port())).when(client).getRestProperties();
- }
-
- @Test
- public void verifyNotExists() {
- AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test");
- wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build()))
- .willReturn(aResponse().withHeader("Content-Type", "text/plain").withBody("hello").withStatus(404)));
- AAIResourcesClient client = aaiClient;
- boolean result = client.exists(path);
- assertEquals("path not found", false, result);
- }
-
- @Test
- public void verifyDelete() {
- AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2");
- wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build()))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBodyFile("aai/resources/mockObject.json").withStatus(200)));
- wireMockRule.stubFor(delete(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build()))
- .withQueryParam("resource-version", equalTo("1234")).willReturn(aResponse().withStatus(204)));
- AAIResourcesClient client = aaiClient;
- client.delete(path);
- }
-
- @Test
- public void verifyBasicAuth() {
- AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3");
- wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build().toString()))
- .withHeader("Authorization", equalTo("Basic dGVzdDp0ZXN0"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBodyFile("aai/resources/mockObject.json").withStatus(200)));
- AAIResourcesClient client = aaiClient;
- client.get(path);
- }
-
- @Test
- public void verifyConnect() {
- AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2");
- AAIResourceUri path2 = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3");
- wireMockRule.stubFor(
- put(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build() + "/relationship-list/relationship"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(200)));
-
- AAIResourceUri pathClone = path.clone();
- AAIResourcesClient client = aaiClient;
- client.connect(path, path2);
- assertEquals("uri not modified", pathClone.build().toString(), path.build().toString());
- }
-
- @Test
- public void verifyDisconnect() {
- AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2");
- AAIResourceUri path2 = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3");
-
- wireMockRule.stubFor(
- delete(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build() + "/relationship-list/relationship"))
- .willReturn(aResponse().withStatus(204)));
-
- AAIResourceUri pathClone = path.clone();
- AAIResourcesClient client = aaiClient;
- client.disconnect(path, path2);
- assertEquals("uri not modified", pathClone.build().toString(), path.build().toString());
- }
-
- @Test
- public void verifyPatch() {
- AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2");
-
- wireMockRule.stubFor(post(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build()))
- .willReturn(aResponse().withStatus(200)));
-
- AAIResourcesClient client = aaiClient;
-
- client.update(path, "{}");
- }
-
- @Test
- public void verifyNotExistsGet() {
- AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test");
- wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build()))
- .willReturn(aResponse().withHeader("Content-Type", "text/plain").withBody("hello").withStatus(404)));
- AAIResourcesClient client = aaiClient;
- AAIResultWrapper result = client.get(path);
- assertEquals("is empty", true, result.isEmpty());
- }
-
- @Test
- public void verifyNotExistsGetException() {
- AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test");
- wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build()))
- .willReturn(aResponse().withHeader("Content-Type", "text/plain").withBody("hello").withStatus(404)));
- AAIResourcesClient client = aaiClient;
- thrown.expect(NotFoundException.class);
- thrown.expectMessage(containsString(path.build() + " not found in A&AI"));
- AAIResultWrapper result = client.get(path, NotFoundException.class);
- }
-
- @Test
- public void verifyFailedCallException() {
- AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test");
- wireMockRule.stubFor(get(urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build())).willReturn(aResponse()
- .withHeader("Content-Type", "text/plain").withBodyFile("aai/error-message.json").withStatus(400)));
- AAIResourcesClient client = aaiClient;
-
- thrown.expect(BadRequestException.class);
- thrown.expectMessage(containsString(
- "Invalid input performing PUT on url (msg=Precondition Required:resource-version not passed for update of url"));
- AAIResultWrapper result = client.get(path);
- }
-
- @Test
- public void buildRelationshipTest() {
- AAIResourcesClient client = aaiClient;
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test");
- Relationship relationship = new Relationship();
- relationship.setRelatedLink(uri.build().toString());
- Relationship actual = client.buildRelationship(uri);
- assertThat("expect equal no label", actual, sameBeanAs(relationship));
-
- relationship.setRelationshipLabel(AAIEdgeLabel.USES.toString());
- actual = client.buildRelationship(uri, AAIEdgeLabel.USES);
- assertThat("expect equal has label", actual, sameBeanAs(relationship));
-
- }
-
- @Test
- public void testGetOne() {
- GenericVnf vnf = new GenericVnf();
- vnf.setVnfId("my-vnf-id");
- GenericVnfs vnfs = new GenericVnfs();
- vnfs.getGenericVnf().add(vnf);
- AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
- RestClient restClientMock = mock(RestClient.class);
- doReturn(restClientMock).when(client).createClient(uri);
- when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.of(vnfs));
-
- Optional<GenericVnf> result = aaiClient.getOne(GenericVnfs.class, GenericVnf.class, uri);
-
- assertEquals("my-vnf-id", result.get().getVnfId());
- }
-
- @Test
- public void testGetOneMultipleResults() {
- GenericVnf vnf = new GenericVnf();
- vnf.setVnfId("my-vnf-id");
- GenericVnf vnf2 = new GenericVnf();
- vnf.setVnfId("my-vnf-id2");
- GenericVnfs vnfs = new GenericVnfs();
- vnfs.getGenericVnf().add(vnf);
- vnfs.getGenericVnf().add(vnf2);
- AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
- RestClient restClientMock = mock(RestClient.class);
- doReturn(restClientMock).when(client).createClient(uri);
- when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.of(vnfs));
-
- thrown.expect(GraphInventoryMultipleItemsException.class);
- aaiClient.getOne(GenericVnfs.class, GenericVnf.class, uri);
- }
-
- @Test
- public void testGetFirstMultipleResults() {
- GenericVnf vnf = new GenericVnf();
- vnf.setVnfId("my-vnf-id");
- GenericVnf vnf2 = new GenericVnf();
- vnf2.setVnfId("my-vnf-id2");
- GenericVnfs vnfs = new GenericVnfs();
- vnfs.getGenericVnf().add(vnf);
- vnfs.getGenericVnf().add(vnf2);
- AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
- RestClient restClientMock = mock(RestClient.class);
- doReturn(restClientMock).when(client).createClient(uri);
- when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.of(vnfs));
-
- Optional<GenericVnf> result = aaiClient.getFirst(GenericVnfs.class, GenericVnf.class, uri);
-
- assertEquals("my-vnf-id", result.get().getVnfId());
- }
-
- @Test
- public void testGetOneNoResults() {
- GenericVnf vnf = new GenericVnf();
- vnf.setVnfId("my-vnf-id");
- GenericVnfs vnfs = new GenericVnfs();
- vnfs.getGenericVnf().add(vnf);
- AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
- RestClient restClientMock = mock(RestClient.class);
- doReturn(restClientMock).when(client).createClient(uri);
- when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.empty());
-
- Optional<GenericVnf> result = aaiClient.getOne(GenericVnfs.class, GenericVnf.class, uri);
-
- assertFalse(result.isPresent());
- }
-
- @Test
- public void testGetFirstNoResults() {
- GenericVnf vnf = new GenericVnf();
- vnf.setVnfId("my-vnf-id");
- GenericVnfs vnfs = new GenericVnfs();
- vnfs.getGenericVnf().add(vnf);
- AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
- RestClient restClientMock = mock(RestClient.class);
- doReturn(restClientMock).when(client).createClient(uri);
- when(restClientMock.get(GenericVnfs.class)).thenReturn(Optional.empty());
-
- Optional<GenericVnf> result = aaiClient.getFirst(GenericVnfs.class, GenericVnf.class, uri);
-
- assertFalse(result.isPresent());
- }
-
- @Test
- public void testGetFirstWrongPluralClass() {
- GenericVnf vnf = new GenericVnf();
- AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
- RestClient restClientMock = mock(RestClient.class);
- doReturn(restClientMock).when(client).createClient(uri);
- when(restClientMock.get(GenericVnf.class)).thenReturn(Optional.of(vnf));
-
- Optional<GenericVnf> result = aaiClient.getFirst(GenericVnf.class, GenericVnf.class, uri);
-
- assertFalse(result.isPresent());
- }
-
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java
deleted file mode 100644
index 55da6e7d52..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
-import java.util.List;
-import java.util.Optional;
-import javax.ws.rs.core.GenericType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Spy;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.client.aai.entities.AAIResultWrapper;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.aai.entities.uri.ServiceInstanceUri;
-import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl;
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-
-@RunWith(MockitoJUnitRunner.class)
-public class AAIResourcesClientWithServiceInstanceUriTest {
-
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Spy
- public AAIClient client;
-
- @InjectMocks
- public AAIResourcesClient aaiClient = new AAIResourcesClient();
-
- private ServiceInstanceUri uri;
-
- @Before
- public void setUp() {
- doReturn(new DefaultAAIPropertiesImpl(wireMockRule.port())).when(client).getRestProperties();
- wireMockRule.stubFor(get(urlMatching("/aai/v[0-9]+/nodes.*")).willReturn(
- aResponse().withStatus(404).withHeader("Content-Type", "application/json").withHeader("Mock", "true")));
-
- uri = spy((ServiceInstanceUri) AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "id"));
- doReturn(aaiClient).when(uri).getResourcesClient();
- }
-
- @Test
- public void getWithClass() {
- AAIResourcesClient client = aaiClient;
- Optional<String> result = client.get(String.class, uri);
-
- assertThat(result.isPresent(), equalTo(false));
- }
-
- @Test
- public void getFullResponse() {
- AAIResourcesClient client = aaiClient;
- Response result = client.getFullResponse(uri);
- assertThat(result.getStatus(), equalTo(Status.NOT_FOUND.getStatusCode()));
- }
-
- @Test
- public void getWithGenericType() {
- AAIResourcesClient client = aaiClient;
- Optional<List<String>> result = client.get(new GenericType<List<String>>() {}, uri);
- assertThat(result.isPresent(), equalTo(false));
- }
-
- @Test
- public void getAAIWrapper() {
- AAIResourcesClient client = aaiClient;
- AAIResultWrapper result = client.get(uri);
- assertThat(result.isEmpty(), equalTo(true));
- }
-
- @Test
- public void getWithException() {
- AAIResourcesClient client = aaiClient;
- this.thrown.expect(IllegalArgumentException.class);
- AAIResultWrapper result = client.get(uri, IllegalArgumentException.class);
- }
-
- @Test
- public void existsTest() {
- AAIResourcesClient client = aaiClient;
- doReturn(uri).when(uri).clone();
- boolean result = client.exists(uri);
- assertThat(result, equalTo(false));
- }
-
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java
deleted file mode 100644
index 2f551fecc4..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/AAIRestClientTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import java.net.URI;
-import java.net.URISyntaxException;
-import javax.ws.rs.core.Response;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.client.RestClientSSL;
-import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
-import org.onap.so.client.graphinventory.exceptions.GraphInventoryPatchDepthExceededException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-@RunWith(MockitoJUnitRunner.class)
-public class AAIRestClientTest {
-
- @Mock
- private AAIProperties props;
-
- private ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper();
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Test
- public void failPatchOnComplexObject() throws URISyntaxException {
- AAIRestClient client = new AAIRestClient(props, new URI(""));
- this.thrown.expect(GraphInventoryPatchDepthExceededException.class);
- this.thrown.expectMessage(containsString("Object exceeds allowed depth for update action"));
- client.patch(
- "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"relationship-list\" : [{\"key\" : \"value\"}], \"nested\" : { \"key\" : \"value\" }}");
- }
-
- @Test
- public void verifyPatchValidation() throws URISyntaxException {
- AAIRestClient client = new AAIRestClient(props, new URI(""));
- AAIRestClient spy = spy(client);
- GraphInventoryPatchConverter patchValidatorMock = mock(GraphInventoryPatchConverter.class);
- doReturn(patchValidatorMock).when(spy).getPatchConverter();
- String payload = "{}";
- doReturn(Response.ok().build()).when(spy).method(eq("PATCH"), any());
- spy.patch(payload);
- verify(patchValidatorMock, times(1)).convertPatchFormat(eq((Object) payload));
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java
deleted file mode 100644
index b07d893adb..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/AAISingleTransactionClientTest.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.Matchers.greaterThan;
-import static org.junit.Assert.assertThat;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-import javax.ws.rs.core.GenericType;
-import org.json.JSONException;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Spy;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.aai.domain.yang.Pserver;
-import org.onap.aai.domain.yang.v9.Complex;
-import org.onap.so.client.aai.entities.singletransaction.SingleTransactionRequest;
-import org.onap.so.client.aai.entities.singletransaction.SingleTransactionResponse;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
-import org.skyscreamer.jsonassert.JSONAssert;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-
-@RunWith(MockitoJUnitRunner.class)
-public class AAISingleTransactionClientTest {
-
- private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/singletransaction/";
- AAIResourceUri uriA = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "pserver-hostname");
- AAIResourceUri uriB = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, "my-complex");
- AAIResourceUri uriC = AAIUriFactory.createResourceUri(AAIObjectType.COMPLEX, "my-complex2");
-
- ObjectMapper mapper;
-
- public AAIClient client = new AAIClient();
-
- @Spy
- public AAIResourcesClient aaiClient = new AAIResourcesClient();
-
- @Before
- public void before() throws JsonParseException, JsonMappingException, IOException {
- mapper = new AAICommonObjectMapperProvider().getMapper();
- mapper.enable(SerializationFeature.INDENT_OUTPUT);
- }
-
- @Test
- public void testRequest() throws JSONException, IOException {
- Pserver pserver = new Pserver();
- pserver.setHostname("pserver-hostname");
- pserver.setFqdn("pserver-bulk-process-single-transactions-multiple-actions-1-fqdn");
- Pserver pserver2 = new Pserver();
- pserver2.setFqdn("patched-fqdn");
- Complex complex = new Complex();
- complex.setCity("my-city");
- Map<String, Object> map = new HashMap<>();
- map.put("resource-version", "1234");
- doReturn(Optional.of(map)).when(aaiClient).get(any(GenericType.class), eq(uriC));
- AAISingleTransactionClient singleTransaction = aaiClient.beginSingleTransaction().create(uriA, pserver)
- .update(uriA, pserver2).create(uriB, complex).delete(uriC);
-
- SingleTransactionRequest actual = singleTransaction.getRequest();
-
- SingleTransactionRequest expected =
- mapper.readValue(this.getJson("sample-request.json"), SingleTransactionRequest.class);
-
- JSONAssert.assertEquals(mapper.writeValueAsString(expected), mapper.writeValueAsString(actual), false);
- }
-
- @Test
- public void testFailure() throws IOException {
- AAISingleTransactionClient singleTransaction = aaiClient.beginSingleTransaction();
- SingleTransactionResponse expected =
- mapper.readValue(this.getJson("sample-response-failure.json"), SingleTransactionResponse.class);
- Optional<String> errorMessage = singleTransaction.locateErrorMessages(expected);
-
- assertThat(expected.getOperationResponses().size(), greaterThan(0));
- assertThat(errorMessage.isPresent(), equalTo(true));
-
- }
-
- @Test
- public void testSuccessResponse() throws IOException {
- AAISingleTransactionClient singleTransaction = aaiClient.beginSingleTransaction();
- SingleTransactionResponse expected =
- mapper.readValue(this.getJson("sample-response.json"), SingleTransactionResponse.class);
- Optional<String> errorMessage = singleTransaction.locateErrorMessages(expected);
-
- assertThat(expected.getOperationResponses().size(), greaterThan(0));
- assertThat(errorMessage.isPresent(), equalTo(false));
-
- }
-
- @Test
- public void confirmPatchFormat() {
- AAISingleTransactionClient singleTransaction = spy(new AAISingleTransactionClient(aaiClient, client));
- GraphInventoryPatchConverter mock = mock(GraphInventoryPatchConverter.class);
- doReturn(mock).when(singleTransaction).getPatchConverter();
- singleTransaction.update(uriA, "{}");
- verify(mock, times(1)).convertPatchFormat(any());
- }
-
- private String getJson(String filename) throws IOException {
- return new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + filename)));
- }
-
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java b/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
deleted file mode 100644
index cbcb60513b..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/AAITransactionalClientTest.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import javax.ws.rs.core.GenericType;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Spy;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.aai.domain.yang.Relationship;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-
-@RunWith(MockitoJUnitRunner.class)
-public class AAITransactionalClientTest {
-
- private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/bulkprocess/";
- AAIResourceUri uriA = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1");
- AAIResourceUri uriB = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test2");
- AAIResourceUri uriC = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3");
- AAIResourceUri uriD = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test4");
- AAIResourceUri uriE = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test5");
- AAIResourceUri uriF = AAIUriFactory.createResourceUri(AAIObjectType.PSERVER, "test6");
- AAIResourceUri uriG = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test7");
-
- ObjectMapper mapper;
-
- public AAIClient client = new AAIClient();
-
- @Spy
- public AAIResourcesClient aaiClient = new AAIResourcesClient();
-
- @Before
- public void before() throws JsonParseException, JsonMappingException, IOException {
- mapper = new AAICommonObjectMapperProvider().getMapper();
- mapper.enable(SerializationFeature.INDENT_OUTPUT);
- }
-
- @Test
- public void testCreate() throws IOException {
- final Relationship body = new Relationship();
- body.setRelatedLink(uriB.build().toString());
-
- AAITransactionalClient transactions = aaiClient.beginTransaction().create(uriA.clone().relationshipAPI(), body);
-
- String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions());
- Map<String, Object> actual =
- mapper.readValue(serializedTransactions, new TypeReference<Map<String, Object>>() {});
- Map<String, Object> expected =
- mapper.readValue(getJson("test-request-small.json"), new TypeReference<Map<String, Object>>() {});
-
- assertEquals(actual, expected);
- }
-
- @Test
- public void testConnect() throws IOException {
- List<AAIResourceUri> uris = new ArrayList<>();
- uris.add(uriB);
-
- Map<String, Object> map = new HashMap<>();
- map.put("resource-version", "1234");
- doReturn(Optional.of(map)).when(aaiClient).get(any(GenericType.class), eq(uriG));
- AAIResourceUri uriAClone = uriA.clone();
- AAITransactionalClient transactions = aaiClient.beginTransaction().connect(uriA, uris).connect(uriC, uriD)
- .beginNewTransaction().connect(uriE, uriF).beginNewTransaction().delete(uriG);
-
- String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions());
- Map<String, Object> actual =
- mapper.readValue(serializedTransactions, new TypeReference<Map<String, Object>>() {});
- Map<String, Object> expected =
- mapper.readValue(getJson("test-request.json"), new TypeReference<Map<String, Object>>() {});
-
- assertEquals(actual, expected);
- assertEquals("uri not manipulated", uriAClone.build().toString(), uriA.build().toString());
- }
-
- @Test
- public void testDisconnect() throws IOException {
- List<AAIResourceUri> uris = new ArrayList<>();
- uris.add(uriB);
-
- AAITransactionalClient transactions = aaiClient.beginTransaction().disconnect(uriA, uris);
-
- String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions());
- Map<String, Object> actual =
- mapper.readValue(serializedTransactions, new TypeReference<Map<String, Object>>() {});
- Map<String, Object> expected = mapper.readValue(getJson("test-request-small.json").replace("put", "delete"),
- new TypeReference<Map<String, Object>>() {});
-
- assertEquals(actual, expected);
- }
-
- @Test
- public void testUpdate() throws IOException {
- final Relationship body = new Relationship();
- body.setRelatedLink(uriB.build().toString());
-
- AAIResourceUri uriAClone = uriA.clone().relationshipAPI();
- AAITransactionalClient transactions = aaiClient.beginTransaction().update(uriAClone, body);
-
- String serializedTransactions = mapper.writeValueAsString(transactions.getTransactions());
- Map<String, Object> actual =
- mapper.readValue(serializedTransactions, new TypeReference<Map<String, Object>>() {});
- Map<String, Object> expected = mapper.readValue(getJson("test-request-small.json").replace("put", "patch"),
- new TypeReference<Map<String, Object>>() {});
-
- assertEquals(actual, expected);
- }
-
- @Test
- public void verifyResponse() throws IOException {
- AAITransactionalClient transactions = aaiClient.beginTransaction();
-
- assertEquals("success status", Optional.empty(),
- transactions.locateErrorMessages(getJson("response-success.json")));
- assertEquals(transactions.locateErrorMessages(getJson("response-failure.json")).get(),
- "another error message\nmy great error");
- }
-
- @Test
- public void confirmPatchFormat() {
- AAITransactionalClient transactionClient = spy(new AAITransactionalClient(aaiClient, client));
- GraphInventoryPatchConverter mock = mock(GraphInventoryPatchConverter.class);
- doReturn(mock).when(transactionClient).getPatchConverter();
- transactionClient.update(uriA, "{}");
- verify(mock, times(1)).convertPatchFormat(any());
- }
-
- private String getJson(String filename) throws IOException {
- return new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + filename)));
- }
-
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIURITest.java b/common/src/test/java/org/onap/so/client/aai/AAIURITest.java
deleted file mode 100644
index 8971f91602..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/AAIURITest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai;
-
-import static org.junit.Assert.assertEquals;
-import javax.ws.rs.core.UriBuilder;
-import org.junit.Test;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-
-public class AAIURITest {
-
-
-
- @Test
- public void verifyTemplateReplacement() {
- final String id = "test1";
- AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, id);
- String manualReplace = AAIObjectType.CONFIGURATION.toString().replaceAll("\\{configuration-id\\}", id);
- assertEquals("uri template replaced", aaiUri.build(), UriBuilder.fromPath(manualReplace).build());
-
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIUpdatorImplTest.java b/common/src/test/java/org/onap/so/client/aai/AAIUpdatorImplTest.java
deleted file mode 100644
index fdfe41f12a..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/AAIUpdatorImplTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Huawei 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.so.client.aai;
-
-import org.junit.Test;
-
-public class AAIUpdatorImplTest {
-
- AAIUpdatorImpl test = new AAIUpdatorImpl();
-
- protected AAIRestClientI client;
-
- @Test
- public void getClientTest() throws Exception {
- test.getClient();
- }
-
- @Test
- public void setClientTest() throws Exception {
- test.setClient(client);
- }
-
-
- @Test(expected = NullPointerException.class)
- public void updateVnfToLockedTest() throws Exception {
- test.updateVnfToLocked("vnfId");
- }
-
-
- @Test(expected = NullPointerException.class)
- public void updateVnfToUnLockedTest() throws Exception {
- test.updateVnfToUnLocked("vnfId");
- }
-
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIUpdatorTest.java b/common/src/test/java/org/onap/so/client/aai/AAIUpdatorTest.java
deleted file mode 100644
index d18dbec944..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/AAIUpdatorTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai;
-
-import static org.mockito.ArgumentMatchers.isA;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-
-@RunWith(MockitoJUnitRunner.class)
-public class AAIUpdatorTest {
-
- @Mock
- protected AAIRestClientI client;
- String vnfName = "testVnf";
- AAIUpdatorImpl updator;
-
- @Before
- public void init() {
- updator = new AAIUpdatorImpl();
- updator.setClient(client);
- }
-
- @Test
- public void testUpdateVnfToLocked() throws Exception {
- doNothing().when(client).updateMaintenceFlagVnfId(isA(String.class), isA(Boolean.class));
- updator.updateVnfToLocked(vnfName);
- verify(client, times(1)).updateMaintenceFlagVnfId(vnfName, true);
- }
-
- @Test
- public void testUpdateVnfToUnLocked() throws Exception {
- doNothing().when(client).updateMaintenceFlagVnfId(isA(String.class), isA(Boolean.class));
- updator.updateVnfToUnLocked(vnfName);
- verify(client, times(1)).updateMaintenceFlagVnfId(vnfName, false);
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java b/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java
deleted file mode 100644
index b91d0e705a..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.when;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.aai.domain.yang.GenericVnf;
-import org.onap.aai.domain.yang.Pserver;
-
-@RunWith(MockitoJUnitRunner.class)
-public class AAIValidatorTest {
-
- @Mock
- protected AAIRestClientI client;
- String vnfName = "testVnf";
- String uuid = "UUID";
- AAIValidatorImpl validator;
-
- @Before
- public void init() {
- validator = new AAIValidatorImpl();
- validator.setClient(client);
- }
-
- public List<Pserver> getPserversLocked() {
- Pserver pserver1 = new Pserver();
- pserver1.setInMaint(true);
- Pserver pserver2 = new Pserver();
- pserver2.setInMaint(false);
- List<Pserver> pservers = new ArrayList<Pserver>();
- pservers.add(pserver1);
- pservers.add(pserver2);
- return pservers;
- }
-
- public List<Pserver> getPserversNotLocked() {
- Pserver pserver1 = new Pserver();
- pserver1.setInMaint(false);
- Pserver pserver2 = new Pserver();
- pserver2.setInMaint(false);
- List<Pserver> pservers = new ArrayList<Pserver>();
- pservers.add(pserver1);
- pservers.add(pserver2);
- return pservers;
- }
-
- public GenericVnf createGenericVnfs(boolean locked) {
- GenericVnf genericVnf = new GenericVnf();
- genericVnf.setInMaint(locked);
- return genericVnf;
- }
-
- @Test
- public void test_IsPhysicalServerLocked_True() throws IOException {
- when(client.getPhysicalServerByVnfId(vnfName)).thenReturn(getPserversLocked());
- boolean locked = validator.isPhysicalServerLocked(vnfName);
- assertEquals(true, locked);
- }
-
- @Test
- public void test_IsPhysicalServerLocked_False() throws IOException {
- when(client.getPhysicalServerByVnfId(vnfName)).thenReturn(getPserversNotLocked());
- boolean locked = validator.isPhysicalServerLocked(vnfName);
- assertEquals(false, locked);
- }
-
- @Test
- public void test_IsPhysicalServerLocked_NoServers_False() throws IOException {
- when(client.getPhysicalServerByVnfId(vnfName)).thenReturn(null);
- boolean locked = validator.isPhysicalServerLocked(vnfName);
- assertEquals(false, locked);
- }
-
- @Test
- public void test_IsVNFLocked_False() {
- when(client.getVnfByName(vnfName)).thenReturn(createGenericVnfs(false));
- boolean locked = validator.isVNFLocked(vnfName);
- assertEquals(false, locked);
- }
-
- @Test
- public void test_IsVNFLocked_True() {
- when(client.getVnfByName(vnfName)).thenReturn(createGenericVnfs(true));
- boolean locked = validator.isVNFLocked(vnfName);
- assertEquals(true, locked);
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java b/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java
deleted file mode 100644
index 1a1a7d124e..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2019 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.so.client.aai;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import org.junit.Test;
-import org.onap.so.client.graphinventory.entities.DSLNodeKey;
-import org.onap.so.client.graphinventory.entities.DSLQueryBuilder;
-import org.onap.so.client.graphinventory.entities.DSLStartNode;
-import org.onap.so.client.graphinventory.entities.Output;
-import org.onap.so.client.graphinventory.entities.Start;
-import org.onap.so.client.graphinventory.entities.TraversalBuilder;
-import org.onap.so.client.graphinventory.entities.__;
-
-public class DSLQueryBuilderTest {
-
- @Test
- public void whereTest() {
- DSLQueryBuilder<Start, Start> builder = TraversalBuilder.fragment(new DSLStartNode(AAIObjectType.CLOUD_REGION,
- __.key("cloud-owner", "att-nc"), __.key("cloud-region-id", "test")));
-
- builder.to(__.node(AAIObjectType.VLAN_TAG))
- .where(__.node(AAIObjectType.OWNING_ENTITY, __.key("owning-entity-name", "name")))
- .to(__.node(AAIObjectType.VLAN_TAG, __.key("vlan-id-outer", "108")).output());
-
- assertEquals("cloud-region('cloud-owner', 'att-nc')('cloud-region-id', 'test') > "
- + "vlan-tag (> owning-entity('owning-entity-name', 'name')) > " + "vlan-tag*('vlan-id-outer', '108')",
- builder.build().get());
- }
-
- @Test
- public void unionTest() {
- DSLQueryBuilder<Output, Output> builder = TraversalBuilder
- .traversal(new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
-
- builder.union(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()),
- __.node(AAIObjectType.VSERVER)
- .to(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output())));
-
- assertEquals(
- "generic-vnf*('vnf-id', 'vnfId') > " + "[ pserver* > complex*, " + "vserver > pserver* > complex* ]",
- builder.build().get());
- }
-
- @Test
- public void whereUnionTest() {
- DSLQueryBuilder<Output, Output> builder = TraversalBuilder
- .traversal(new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
-
- builder.where(__.union(__.node(AAIObjectType.PSERVER, __.key("hostname", "hostname1")),
- __.node(AAIObjectType.VSERVER).to(__.node(AAIObjectType.PSERVER, __.key("hostname", "hostname1")))));
-
- assertEquals("generic-vnf*('vnf-id', 'vnfId') (> [ pserver('hostname', 'hostname1'), "
- + "vserver > pserver('hostname', 'hostname1') ])", builder.build().get());
- }
-
- @Test
- public void notNullTest() {
- DSLQueryBuilder<Output, Output> builder = TraversalBuilder.traversal(
- new DSLStartNode(AAIObjectType.CLOUD_REGION, __.key("cloud-owner", "", "null").not()).output());
-
- assertEquals("cloud-region* !('cloud-owner', ' ', ' null ')", builder.build().get());
- }
-
- @Test
- public void shortCutToTest() {
- DSLQueryBuilder<Output, Output> builder = TraversalBuilder
- .traversal(new DSLStartNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output());
-
- builder.to(AAIObjectType.P_INTERFACE).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id"));
- assertEquals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id')",
- builder.build().get());
- }
-
- @Test
- public void limitTest() {
- DSLQueryBuilder<Output, Output> builder = TraversalBuilder
- .traversal(new DSLStartNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output());
-
- builder.to(AAIObjectType.P_INTERFACE).limit(2).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id"));
- assertEquals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id') LIMIT 2",
- builder.build().get());
- }
-
- @Test
- public void equalsTest() {
- DSLQueryBuilder<Output, Output> builder = TraversalBuilder
- .traversal(new DSLStartNode(AAIObjectType.PSERVER, __.key("hostname", "my-hostname")).output());
-
- builder.to(AAIObjectType.P_INTERFACE).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id"));
- assertTrue(
- builder.equals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id')"));
- assertTrue(builder.equals(builder));
- }
-
- @Test
- public void mixedTypeTest() {
- DSLQueryBuilder<Start, Start> builder = TraversalBuilder.fragment(new DSLStartNode(AAIObjectType.CLOUD_REGION,
- __.key("cloud-owner", "owner"), __.key("cloud-region-id", "id")));
- builder.to(__.node(AAIObjectType.VLAN_TAG, __.key("vlan-id-outer", 167), __.key("my-boolean", true)).output());
- assertTrue(builder.equals(
- "cloud-region('cloud-owner', 'owner')('cloud-region-id', 'id') > vlan-tag*('vlan-id-outer', 167)('my-boolean', true)"));
- }
-
- @Test
- public void outputOnNodeLambdasTest() {
- DSLQueryBuilder<Start, Start> builder = TraversalBuilder
- .fragment(new DSLStartNode(AAIObjectType.L_INTERFACE, new DSLNodeKey("interface-id", "myId")));
-
- builder.to(AAIObjectType.VSERVER, __.key("vserver-name", "myName")).output().to(AAIObjectType.P_INTERFACE)
- .output();
- assertEquals("l-interface('interface-id', 'myId') > vserver*('vserver-name', 'myName') > p-interface*",
- builder.build().get());
- }
-
- @Test
- public void skipOutputOnUnionTest() {
- DSLQueryBuilder<Output, Output> builder = TraversalBuilder
- .traversal(new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", "vnfId")).output());
-
- builder.union(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output()),
- __.node(AAIObjectType.VSERVER)
- .to(__.node(AAIObjectType.PSERVER).output().to(__.node(AAIObjectType.COMPLEX).output())))
- .output();
-
- assertEquals(
- "generic-vnf*('vnf-id', 'vnfId') > " + "[ pserver* > complex*, " + "vserver > pserver* > complex* ]",
- builder.build().get());
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java b/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java
deleted file mode 100644
index 157109c119..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai.entities;
-
-import static org.junit.Assert.assertEquals;
-import java.io.IOException;
-import java.io.Serializable;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.aai.domain.yang.GenericVnf;
-import org.onap.so.client.aai.AAICommonObjectMapperProvider;
-import org.springframework.util.SerializationUtils;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-@RunWith(MockitoJUnitRunner.class)
-public class AAIResultWrapperTest {
- String json;
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- AAIResultWrapper aaiResultWrapper;
- AAIResultWrapper aaiResultWrapperEmpty;
-
- @Before
- public void init() throws IOException {
- final String RESOURCE_PATH = "src/test/resources/__files/aai/resources/";
- json = new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "e2e-complex.json")));
-
- aaiResultWrapper = new AAIResultWrapper(json);
- aaiResultWrapperEmpty = new AAIResultWrapper("{}");
- }
-
- @Test
- public void testAAIResultWrapperIsSerializable() throws IOException {
- AAIResultWrapper original = new AAIResultWrapper("");
- byte[] serialized = SerializationUtils.serialize(original);
- AAIResultWrapper deserialized = (AAIResultWrapper) SerializationUtils.deserialize(serialized);
- assertEquals(deserialized.getJson(), original.getJson());
- }
-
- @Test
- public void testGetRelationshipsEmpty() {
- Optional<Relationships> relationships = aaiResultWrapperEmpty.getRelationships();
- assertEquals("Compare relationships", Optional.empty(), relationships);
- }
-
- @Test
- public void testAsMap() throws JsonParseException, JsonMappingException, IOException {
- ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper();
- Map<String, Object> expected = mapper.readValue(json, new TypeReference<Map<String, Object>>() {});
-
- Map<String, Object> actual = aaiResultWrapper.asMap();
- assertEquals(expected, actual);
- }
-
- @Test
- public void testAsMapEmpty() {
- Map<String, Object> actual = aaiResultWrapperEmpty.asMap();
- assertEquals(new HashMap<>(), actual);
- }
-
- @Test
- public void nullCases() {
-
- AAIResultWrapper wrapper = new AAIResultWrapper(null);
-
- assertEquals(Optional.empty(), wrapper.getRelationships());
- assertEquals("{}", wrapper.getJson());
- assertEquals(Optional.empty(), wrapper.asBean(GenericVnf.class));
- assertEquals(true, wrapper.asMap().isEmpty());
- assertEquals("{}", wrapper.toString());
-
- }
-
- @Test
- public void objectConstructor() {
- AAIResultWrapper wrapper = new AAIResultWrapper(new GenericVnf());
- assertEquals("{}", wrapper.getJson());
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java b/common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java
deleted file mode 100644
index 039bbb3614..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai.entities;
-
-import static org.junit.Assert.assertTrue;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.Arrays;
-import java.util.List;
-import org.junit.Test;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-
-public class RelationshipsTest {
-
- private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/resources/";
-
- @Test
- public void run() throws IOException {
- final String content = new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "e2e-complex.json")));
-
- AAIResultWrapper wrapper = new AAIResultWrapper(content);
- Relationships relationships = wrapper.getRelationships().get();
-
- List<AAIResourceUri> test = relationships.getRelatedUris(AAIObjectType.VCE);
- List<AAIResourceUri> uris = Arrays.asList(
- AAIUriFactory.createResourceUri(AAIObjectType.VCE, "a9fec18e-1ea3-40e4-a6c0-a89b3de07053"),
- AAIUriFactory.createResourceUri(AAIObjectType.VCE, "8ae1e5f8-61f1-4c71-913a-b40cc4593cb9"),
- AAIUriFactory.createResourceUri(AAIObjectType.VCE, "a2935fa9-b743-49f4-9813-a127f13c4e93"),
- AAIUriFactory.createResourceUri(AAIObjectType.VCE, "c7fe7698-8063-4e26-8bd3-ca3edde0b0d4"));
-
- assertTrue(uris.containsAll(test) && test.containsAll(uris));
-
- }
-
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java
deleted file mode 100644
index 0249bea794..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromParentUriTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 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.so.client.aai.entities.uri;
-
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-import org.onap.so.client.aai.AAIObjectType;
-
-public class AAISimpleUriFromParentUriTest {
-
-
- @Test
- public void appendChildren() {
-
- AAIResourceUri parentUri =
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "key1", "key2", "key3");
-
- AAIResourceUri uri = new AAISimpleUri(parentUri, AAIObjectType.ALLOTTED_RESOURCE, "key4");
-
- assertEquals("path appended",
- "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4",
- uri.build().toString());
-
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java
deleted file mode 100644
index 6bf67ffce8..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriFromUriTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai.entities.uri;
-
-import static org.junit.Assert.assertEquals;
-import javax.ws.rs.core.UriBuilder;
-import org.junit.Test;
-import org.onap.so.client.aai.AAIObjectType;
-
-public class AAISimpleUriFromUriTest {
-
-
-
- @Test
- public void removeHost() {
-
- AAIResourceUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN,
- UriBuilder
- .fromUri("https://localhost:8443/aai/v9/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053")
- .build());
-
- assertEquals("root and version removed", "/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053",
- uri.build().toString());
-
- }
-
- @Test
- public void noChange() {
-
- AAIResourceUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN,
- UriBuilder.fromUri("/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053").build());
-
- assertEquals("no change", "/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053", uri.build().toString());
-
- }
-
- @Test
- public void encodingPreserved() {
-
- AAIResourceUri uri = new AAISimpleUri(AAIObjectType.UNKNOWN,
- UriBuilder.fromUri("/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053").build());
-
- assertEquals("encoding preserved", "/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053",
- uri.build().toString());
-
- }
-
- @Test
- public void beforeBuildEquality() {
-
- AAIResourceUri uri = new AAISimpleUri(AAIObjectType.VCE,
- UriBuilder.fromUri("/network/vces/vce/a9f%20%20ec18e-1ea3-40e4-a6c0-a89b3de07053").build());
-
- AAIResourceUri uri2 = new AAISimpleUri(AAIObjectType.VCE, "a9f ec18e-1ea3-40e4-a6c0-a89b3de07053");
- assertEquals("are equal", uri2, uri);
-
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java
deleted file mode 100644
index 6c1b3d69a2..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai.entities.uri;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.Map;
-import org.junit.Test;
-import org.onap.so.client.aai.AAIObjectPlurals;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.graphinventory.entities.uri.Depth;
-
-public class AAISimpleUriTest {
-
-
-
- @Test
- public void relatedToTestPlural() {
- AAIPluralResourceUri uri =
- AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1").relatedTo(AAIObjectPlurals.PSERVER);
- String uriOutput = uri.build().toString();
- assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers", uriOutput);
- }
-
- @Test
- public void relatedToTestSingular() {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1")
- .relatedTo(AAIObjectType.PSERVER, "test2");
- String uriOutput = uri.build().toString();
- assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers/pserver/test2", uriOutput);
- }
-
- @Test
- public void cloneTestSingular() {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1");
- AAIResourceUri cloned = uri.clone();
- assertEquals("/network/generic-vnfs/generic-vnf/test1", cloned.build().toString());
-
- cloned.limit(2);
-
- assertNotEquals(uri.build().toString(), cloned.build().toString());
- }
-
- @Test
- public void cloneTestPlural() {
- AAISimplePluralUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF);
- AAISimplePluralUri cloned = uri.clone();
- assertEquals("/network/generic-vnfs", cloned.build().toString());
- }
-
- @Test
- public void cloneTestWithRelatedTo() {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1")
- .relatedTo(AAIObjectType.PSERVER, "test2");
- String uriOutput = uri.clone().build().toString();
- assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers/pserver/test2", uriOutput);
- }
-
- @Test
- public void cloneTestPluralWithRelatedTo() {
- AAIPluralResourceUri uri =
- AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1").relatedTo(AAIObjectPlurals.PSERVER);
- String uriOutput = uri.clone().build().toString();
- assertEquals("/network/generic-vnfs/generic-vnf/test1/related-to/pservers", uriOutput);
- }
-
- @Test
- public void getKeysTest() {
- AAIResourceUri uri =
- AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, "cloud1", "cloud2", "tenant1", "vserver1");
- Map<String, String> keys = uri.getURIKeys();
- System.out.println(keys);
- System.out.println(uri.build());
- assertEquals("vserver1", keys.get("vserver-id"));
- }
-
- @Test
- public void getEncodedKeyTest() {
- AAIResourceUri uri =
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "test1", "my value", "test3");
- Map<String, String> keys = uri.getURIKeys();
-
- assertEquals("my value", keys.get("service-type"));
- }
-
- @Test
- public void serializeTest() throws IOException, ClassNotFoundException {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1");
-
- uri.depth(Depth.ONE);
- uri.limit(1);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
-
- ObjectOutputStream objectOutputStream = new ObjectOutputStream(bos);
- objectOutputStream.writeObject(uri);
- objectOutputStream.flush();
- objectOutputStream.close();
-
- ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
-
- ObjectInputStream objectInputStream = new ObjectInputStream(bis);
- AAIResourceUri e2 = (AAIResourceUri) objectInputStream.readObject();
- objectInputStream.close();
-
- uri.queryParam("test", "value");
- e2.queryParam("test", "value");
-
- assertEquals(e2.build().toString(), uri.build().toString());
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java
deleted file mode 100644
index 8a203f6439..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/AAIUriFactoryTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai.entities.uri;
-
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-import org.onap.so.client.aai.AAIObjectPlurals;
-import org.onap.so.client.aai.AAIObjectType;
-
-public class AAIUriFactoryTest {
-
- @Test
- public void testCreateResourceUri() {
-
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
-
- String expected = "/network/generic-vnfs/generic-vnf/VIP%28VelocitytoIP%29";
- assertEquals(expected, uri.build().toString());
- }
-
- @Test
- public void testCreateNodesUri() {
-
- AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
-
- String expected = "/nodes/generic-vnfs/generic-vnf/VIP%28VelocitytoIP%29";
- assertEquals(expected, uri.build().toString());
- }
-
- @Test
- public void testCreateResourceFromExistingURI() {
-
- AAIResourceUri uri = new AAISimpleUri(AAIObjectType.GENERIC_VNF, "VIP(VelocitytoIP)");
- AAIResourceUri uri2 = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.GENERIC_VNF, uri.build());
-
- String expected = "/network/generic-vnfs/generic-vnf/VIP%28VelocitytoIP%29";
- assertEquals(expected, uri2.build().toString());
- }
-
- @Test
- public void testCreateResourceURIForPluralsWithValues() {
-
- AAIPluralResourceUri uri =
- AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, "customerId", "serviceType");
-
- String expected =
- "/business/customers/customer/customerId/service-subscriptions/service-subscription/serviceType/service-instances";
- assertEquals(expected, uri.build().toString());
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java
deleted file mode 100644
index a92a7c3c1a..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUriTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai.entities.uri;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import javax.ws.rs.core.UriBuilder;
-import org.junit.Test;
-import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadException;
-import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriNotFoundException;
-
-public class AllottedResourceLookupUriTest {
-
- @Test
- public void oneKey()
- throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
-
- AllottedResourceLookupUri instance = new AllottedResourceLookupUri("key1");
- AllottedResourceLookupUri spy = spy(instance);
- doReturn(
- "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4")
- .when(spy).getObjectById(any(Object.class));
-
- final URI result = spy.locateAndBuild();
- final URI expected = UriBuilder.fromPath(
- "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/allotted-resources/allotted-resource/key4")
- .build();
- assertEquals("result is equal", expected, result);
-
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java
deleted file mode 100644
index 3fbbc7c110..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/IncorrectNumberOfUriKeysTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2019 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.so.client.aai.entities.uri;
-
-import static org.hamcrest.CoreMatchers.equalTo;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onap.so.client.aai.AAIObjectPlurals;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.graphinventory.exceptions.IncorrectNumberOfUriKeys;
-
-public class IncorrectNumberOfUriKeysTest {
-
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Test
- public void verifyIncorrectNumberOfKeysSingle() {
-
- thrown.expect(IncorrectNumberOfUriKeys.class);
- thrown.expectMessage(equalTo("Expected 3 variables: [cloud-owner, cloud-region-id, volume-group-id]"));
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, "volume-group-id");
-
- }
-
- @Test
- public void verifyIncorrectNumberOfKeysPlural() {
-
- thrown.expect(IncorrectNumberOfUriKeys.class);
- AAISimplePluralUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, "my-cloud-owner");
-
- }
-
- @Test
- public void verifyIncorrectNumberOfKeysFromParent() {
-
- thrown.expect(IncorrectNumberOfUriKeys.class);
- AAIResourceUri parentUri =
- AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, "my-cloud-owner", "my-cloud-region-id");
- AAIResourceUri uri = AAIUriFactory.createResourceFromParentURI(parentUri, AAIObjectType.VOLUME_GROUP);
- }
-
- @Test
- public void verifyIncorrectNumberOfKeysHttpAware() {
-
- thrown.expect(IncorrectNumberOfUriKeys.class);
- AAIResourceUri uri =
- AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, "customer-id", "subscription-id");
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
deleted file mode 100644
index 71d65b6f45..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.aai.entities.uri;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.Optional;
-import javax.ws.rs.NotFoundException;
-import javax.ws.rs.core.UriBuilder;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.mockito.ArgumentMatchers;
-import org.mockito.InjectMocks;
-import org.mockito.Spy;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.client.aai.AAIClient;
-import org.onap.so.client.aai.AAIObjectPlurals;
-import org.onap.so.client.aai.AAIResourcesClient;
-import org.onap.so.client.aai.entities.AAIResultWrapper;
-import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl;
-import org.onap.so.client.graphinventory.entities.uri.HttpAwareUri;
-import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadException;
-import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException;
-import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriNotFoundException;
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-
-@RunWith(MockitoJUnitRunner.class)
-public class ServiceInstanceUriTest {
-
- private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/resources/";
-
- @Rule
- public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
-
- @Rule
- public final ExpectedException exception = ExpectedException.none();
-
- @Spy
- public AAIClient client;
-
- @InjectMocks
- public AAIResourcesClient aaiClient = new AAIResourcesClient();
-
- @Before
- public void beforeTest() {
- doReturn(new DefaultAAIPropertiesImpl(wireMockRule.port())).when(client).getRestProperties();
- }
-
- @Test
- public void found() throws IOException {
- final String content = new String(
- Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "service-instance-pathed-query.json")));
-
- ServiceInstanceUri instance = new ServiceInstanceUri("key3");
- final Optional<String> result = instance.extractRelatedLink(content);
- final String expected =
- "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3";
- assertEquals("result is equal", expected, result.get());
-
- }
-
- @Test
- public void oneKey()
- throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
-
- ServiceInstanceUri instance = new ServiceInstanceUri("key1");
- ServiceInstanceUri spy = spy(instance);
- doReturn(
- "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3")
- .when(spy).getObjectById(any(Object.class));
-
- final URI result = spy.locateAndBuild();
- final URI expected = UriBuilder.fromPath(
- "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3")
- .build();
- assertEquals("result is equal", expected, result);
-
- }
-
- @Test
- public void oneKeyQueryParams()
- throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
-
- ServiceInstanceUri instance = new ServiceInstanceUri("key1");
- ServiceInstanceUri spy = spy(instance);
- doReturn(
- "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3")
- .when(spy).getObjectById(any(Object.class));
-
- final URI result = ((HttpAwareUri) spy.resourceVersion("1234")).locateAndBuild();
- final URI expected = UriBuilder.fromUri(
- "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3?resource-version=1234")
- .build();
- assertEquals("result is equal", expected, result);
-
- }
-
- @Test
- public void oneKeyEncoded()
- throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
-
- ServiceInstanceUri instance = new ServiceInstanceUri("key1");
- ServiceInstanceUri spy = spy(instance);
- doReturn(
- "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space")
- .when(spy).getObjectById(any(Object.class));
-
- final URI result = spy.locateAndBuild();
- final URI expected = UriBuilder.fromUri(
- "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space")
- .build();
- assertEquals("result is equal", expected, result);
-
- }
-
- @Test
- public void oneKeyGetKeys()
- throws IOException, URISyntaxException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
-
- ServiceInstanceUri instance = new ServiceInstanceUri("key1");
- ServiceInstanceUri spy = spy(instance);
- doReturn(
- "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%28space")
- .when(spy).getObjectById(any(Object.class));
-
- assertThat(spy.getURIKeys().values(), contains("key1", "key2", "key3(space"));
-
- }
-
- @Test
- public void oneKeyClone() throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
- ServiceInstanceUri instance = new ServiceInstanceUri("key1");
- ServiceInstanceUri spy = spy(instance);
- String uri =
- "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3";
- doReturn(Optional.of(uri)).when(spy).getCachedValue();
- final URI result = ((HttpAwareUri) spy.resourceVersion("1234").clone()).locateAndBuild();
- final URI expected = UriBuilder.fromUri(
- "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3?resource-version=1234")
- .build();
- assertEquals("result is equal", expected, result);
- }
-
- @Test
- public void threeKey() throws IOException {
-
- ServiceInstanceUri instance = new ServiceInstanceUri("key1", "key2", "key3");
- final URI result = instance.build();
- final URI expected = UriBuilder.fromPath(
- "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3")
- .build();
- assertEquals("result is equal", expected, result);
-
- }
-
- @Test
- public void notfound() throws IOException, GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
- final String content =
- new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "empty-query-result.json")));
-
- ServiceInstanceUri instance = new ServiceInstanceUri("key3");
- ServiceInstanceUri spy = spy(instance);
- AAIResourcesClient mockResourcesClient = mock(AAIResourcesClient.class);
- AAIResultWrapper wrapper = mock(AAIResultWrapper.class);
- when(mockResourcesClient.get(ArgumentMatchers.<AAIResourceUri>any(AAIResourceUri.class),
- ArgumentMatchers.<Class<NotFoundException>>any())).thenReturn(wrapper);
- when(wrapper.getJson()).thenReturn(content);
- when(spy.getResourcesClient()).thenReturn(mockResourcesClient);
- exception.expect(GraphInventoryUriComputationException.class);
- spy.locateAndBuild();
-
- }
-
- @Test
- public void cloneTest() {
- ServiceInstanceUri instance = new ServiceInstanceUri("key1", "key2", "key3");
- final URI result = instance.build();
- final URI result2 = instance.clone().queryParam("something", "new").build();
- assertEquals("uris are not equal", false, result.toString().equals(result2.toString()));
-
- }
-
- @Test
- public void noVertexFound() throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
- ServiceInstanceUri instance = new ServiceInstanceUri("key3");
- ServiceInstanceUri spy = spy(instance);
- AAIResourcesClient client = aaiClient;
- doReturn(client).when(spy).getResourcesClient();
- wireMockRule
- .stubFor(get(urlPathMatching("/aai/v[0-9]+/nodes/service-instances/service-instance/key3")).willReturn(
- aResponse().withStatus(404).withHeader("Content-Type", "application/json").withBodyFile("")));
- exception.expect(NotFoundException.class);
- spy.locateAndBuild();
- }
-
- @Test
- public void serializeTest() throws IOException, ClassNotFoundException, GraphInventoryUriNotFoundException,
- GraphInventoryPayloadException {
- ServiceInstanceUri instance = new ServiceInstanceUri("key3");
- final String content = new String(
- Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "service-instance-pathed-query.json")));
-
- ServiceInstanceUri spy = spy(instance);
- AAIResourcesClient mockResourcesClient = mock(AAIResourcesClient.class);
- AAIResultWrapper wrapper = mock(AAIResultWrapper.class);
- when(mockResourcesClient.get(ArgumentMatchers.<AAIResourceUri>any(AAIResourceUri.class),
- ArgumentMatchers.<Class<NotFoundException>>any())).thenReturn(wrapper);
- when(wrapper.getJson()).thenReturn(content);
- when(spy.getResourcesClient()).thenReturn(mockResourcesClient);
- spy.locateAndBuild();
- instance = spy.clone();
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
-
- ObjectOutputStream objectOutputStream = new ObjectOutputStream(bos);
- objectOutputStream.writeObject(instance);
- objectOutputStream.flush();
- objectOutputStream.close();
-
- ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
-
- ObjectInputStream objectInputStream = new ObjectInputStream(bis);
- ServiceInstanceUri e2 = (ServiceInstanceUri) objectInputStream.readObject();
- objectInputStream.close();
-
- ServiceInstanceUri spy2 = spy(e2);
-
- assertEquals(spy2.build().toString(), instance.build().toString());
-
- // use the cached value do not call out to external system
- verify(spy2, times(0)).getResourcesClient();
- }
-
- @Test
- public void relatedToTest() throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
- ServiceInstanceUri instance = new ServiceInstanceUri("key1");
- ServiceInstanceUri spy = spy(instance);
- doReturn(
- "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3")
- .when(spy).getObjectById(any(Object.class));
-
- final URI result = spy.relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "my-vnf-name").build();
- final URI expected = UriBuilder.fromUri(
- "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3/related-to/generic-vnfs?vnf-name=my-vnf-name")
- .build();
- assertEquals("result is equal", expected, result);
- }
-
- @Test
- public void relatedToEqualityTestBeforeBuildTest()
- throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
- ServiceInstanceUri instance = new ServiceInstanceUri("key1");
- ServiceInstanceUri spy = spy(instance);
-
- final AAIPluralResourceUri result =
- spy.relatedTo(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "my-vnf-name");
-
- assertEquals("result is equal", result, result);
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/objects/CustomAAIObjectType.java b/common/src/test/java/org/onap/so/client/aai/objects/CustomAAIObjectType.java
deleted file mode 100644
index f437197f71..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/objects/CustomAAIObjectType.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2019 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.so.client.aai.objects;
-
-import org.onap.so.client.aai.AAINamespaceConstants;
-import org.onap.so.client.aai.AAIObjectType;
-
-public class CustomAAIObjectType extends AAIObjectType {
-
- private static final long serialVersionUID = 1919729212831978098L;
-
- public static final AAIObjectType CUSTOM =
- new CustomAAIObjectType(AAINamespaceConstants.NETWORK, "my-url", "my-custom-name");
-
- /* Default constructor automatically called by AAIObjectType */
- public CustomAAIObjectType() {
- super();
- }
-
- protected CustomAAIObjectType(String parent, String uri, String name) {
- super(parent, uri, name);
- }
-
-}
diff --git a/common/src/test/java/org/onap/so/client/defaultproperties/DefaultAAIPropertiesImpl.java b/common/src/test/java/org/onap/so/client/defaultproperties/DefaultAAIPropertiesImpl.java
deleted file mode 100644
index 7789386667..0000000000
--- a/common/src/test/java/org/onap/so/client/defaultproperties/DefaultAAIPropertiesImpl.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.defaultproperties;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import org.onap.so.client.aai.AAIProperties;
-import org.onap.so.client.aai.AAIVersion;
-
-public class DefaultAAIPropertiesImpl implements AAIProperties {
-
-
- final Map<Object, Object> props;
-
- public DefaultAAIPropertiesImpl() {
- File initialFile = new File("src/test/resources/aai.properties");
- Map<Object, Object> temp;
- try (InputStream targetStream = new FileInputStream(initialFile)) {
- Properties properties = new Properties();
- properties.load(targetStream);
- temp = properties;
- } catch (IOException e) {
- temp = new HashMap<>();
- }
- this.props = temp;
-
- }
-
- public DefaultAAIPropertiesImpl(int port) {
- File initialFile = new File("src/test/resources/aai.properties");
- Map<Object, Object> temp;
- try (InputStream targetStream = new FileInputStream(initialFile)) {
- Properties properties = new Properties();
- properties.load(targetStream);
- temp = properties;
- } catch (IOException e) {
- temp = new HashMap<>();
- }
- this.props = temp;
- this.props.put("aai.endpoint", this.props.get("aai.endpoint").toString().replaceFirst(":\\d+", ":" + port));
-
- }
-
- @Override
- public URL getEndpoint() throws MalformedURLException {
- return new URL(props.get("aai.endpoint").toString());
- }
-
- @Override
- public String getSystemName() {
- return "MSO";
- }
-
- @Override
- public AAIVersion getDefaultVersion() {
- return AAIVersion.LATEST;
- }
-
- @Override
- public String getAuth() {
- Object value = props.get("aai.auth");
- return value == null ? null : value.toString();
- }
-
- @Override
- public String getKey() {
- Object value = props.get("mso.msoKey");
- return value == null ? null : value.toString();
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverterTest.java b/common/src/test/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverterTest.java
deleted file mode 100644
index 1f047b3b36..0000000000
--- a/common/src/test/java/org/onap/so/client/graphinventory/GraphInventoryPatchConverterTest.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.graphinventory;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.aai.domain.yang.GenericVnf;
-import org.onap.so.client.aai.AAICommonObjectMapperProvider;
-import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-
-@RunWith(MockitoJUnitRunner.class)
-public class GraphInventoryPatchConverterTest {
-
- private ObjectMapper mapper = new AAICommonObjectMapperProvider().getMapper();
-
- @Test
- public void convertObjectToPatchFormatTest()
- throws URISyntaxException, JsonParseException, JsonMappingException, IOException {
- GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter();
- GenericVnf vnf = new GenericVnf();
- vnf.setIpv4Loopback0Address("");
- String result = validator.marshallObjectToPatchFormat(vnf);
- GenericVnf resultObj = mapper.readValue(result.toString(), GenericVnf.class);
- assertTrue("expect object to become a String to prevent double marshalling", result instanceof String);
- assertNull("expect null because of custom mapper", resultObj.getIpv4Loopback0Address());
-
- }
-
- @Test
- public void convertStringToPatchFormatTest()
- throws URISyntaxException, JsonParseException, JsonMappingException, IOException {
- GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter();
- String payload = "{\"ipv4-loopback0-address\":\"\"}";
- String result = validator.marshallObjectToPatchFormat(payload);
-
- assertEquals("expect no change", payload, result);
- }
-
- @Test
- public void convertStringToPatchFormatNull_Test()
- throws URISyntaxException, JsonParseException, JsonMappingException, IOException {
- GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter();
- String payload = "{\"ipv4-loopback0-address\": null}";
- String result = validator.marshallObjectToPatchFormat(payload);
- System.out.println(result);
- assertEquals("expect no change", payload, result);
- }
-
- @Test
- public void convertMapToPatchFormatTest()
- throws URISyntaxException, JsonParseException, JsonMappingException, IOException {
- GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter();
- HashMap<String, String> map = new HashMap<>();
- map.put("ipv4-loopback0-address", "");
- map.put("ipv4-loopback1-address", "192.168.1.1");
- String result = validator.marshallObjectToPatchFormat(map);
-
- assertEquals("expect string", "{\"ipv4-loopback1-address\":\"192.168.1.1\"}", result);
- }
-
- @Test
- public void hasComplexObjectTest() {
- GraphInventoryPatchConverter validator = new GraphInventoryPatchConverter();
- String hasNesting = "{ \"hello\" : \"world\", \"nested\" : { \"key\" : \"value\" } }";
- String noNesting = "{ \"hello\" : \"world\" }";
- String arrayCase =
- "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"nestedComplex\" : [{\"key\" : \"value\"}]}";
- String empty = "{}";
- String arrayCaseSimpleOnly = "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"]}";
- String relationshipListCaseNesting =
- "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"relationship-list\" : [{\"key\" : \"value\"}], \"nested\" : { \"key\" : \"value\" }}";
- String relationshipListCase =
- "{ \"hello\" : \"world\", \"nestedSimple\" : [\"value1\" , \"value2\"], \"relationship-list\" : [{\"key\" : \"value\"}]}";
- String nothing = "";
-
- assertTrue("expect has nesting", validator.hasComplexObject(hasNesting));
- assertFalse("expect no nesting", validator.hasComplexObject(noNesting));
- assertTrue("expect has nesting", validator.hasComplexObject(arrayCase));
- assertFalse("expect no nesting", validator.hasComplexObject(empty));
- assertFalse("expect no nesting", validator.hasComplexObject(arrayCaseSimpleOnly));
- assertFalse("expect no nesting", validator.hasComplexObject(relationshipListCase));
- assertTrue("expect has nesting", validator.hasComplexObject(relationshipListCaseNesting));
- assertFalse("expect no nesting", validator.hasComplexObject(nothing));
- }
-
-}
diff --git a/common/src/test/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImplTest.java b/common/src/test/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImplTest.java
deleted file mode 100644
index fb26e1870e..0000000000
--- a/common/src/test/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImplTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.graphinventory.entities.uri.parsers;
-
-import static org.junit.Assert.assertEquals;
-import java.util.Map;
-import org.junit.Test;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.graphinventory.entities.uri.parsers.UriParser;
-import org.onap.so.client.graphinventory.entities.uri.parsers.UriParserSpringImpl;
-
-public class UriParserSpringImplTest {
-
-
-
- @Test
- public void reverseTemplate() {
- final UriParser parser = new UriParserSpringImpl(AAIObjectType.SERVICE_INSTANCE.toString());
- final String uri =
- "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3";
-
- Map<String, String> result = parser.parse(uri);
-
- assertEquals("found customer-id", "key1", result.get("global-customer-id"));
- assertEquals("found service-type", "key2", result.get("service-type"));
- assertEquals("found service-instance-id", "key3", result.get("service-instance-id"));
-
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadExceptionTest.java b/common/src/test/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadExceptionTest.java
deleted file mode 100644
index 6b23cbbe86..0000000000
--- a/common/src/test/java/org/onap/so/client/graphinventory/exceptions/GraphInventoryPayloadExceptionTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Huawei 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.so.client.graphinventory.exceptions;
-
-import org.junit.Test;
-import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadException;
-
-public class GraphInventoryPayloadExceptionTest {
-
- Throwable t = new Throwable();
-
- @Test
- public void callConstructorTest() throws Exception {
-
- GraphInventoryPayloadException test1 = new GraphInventoryPayloadException("testing");
-
- GraphInventoryPayloadException test2 = new GraphInventoryPayloadException("testing", t);
-
- GraphInventoryPayloadException test3 = new GraphInventoryPayloadException(t);
- }
-
-}
diff --git a/common/src/test/java/org/onap/so/client/sdno/SDNOHealthCheckClientTest.java b/common/src/test/java/org/onap/so/client/sdno/SDNOHealthCheckClientTest.java
deleted file mode 100644
index 750e578558..0000000000
--- a/common/src/test/java/org/onap/so/client/sdno/SDNOHealthCheckClientTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.sdno;
-
-import static org.junit.Assert.assertEquals;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.Optional;
-import org.junit.Test;
-import org.onap.so.client.sdno.beans.SDNO;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class SDNOHealthCheckClientTest {
-
-
-
- private final String fileLocation = "src/test/resources/org/onap/so/client/sdno/health-check/";
- private static final String userId = "test-user";
- private static final Optional<String> clliCode = Optional.of("test-clli");
- private static final String requestId = "test-request-id";
- private static final String configurationId = "test-configuration-id";
- private static final String interfaceId = "test-interface-id";
-
- @Test
- public void verfyLPortMirrorPreCheckRequest() throws IOException {
- String content = this.getJson("custom-lport-mirror-pre-check-request.json");
- ObjectMapper mapper = new ObjectMapper();
- SDNO expected = mapper.readValue(content, SDNO.class);
- SDNOHealthCheckClient client = new SDNOHealthCheckClient();
- String actual =
- client.buildLPortMirrorCheckPreRequest(userId, requestId, clliCode, configurationId, interfaceId);
- assertEquals("payloads are equal", mapper.writeValueAsString(expected), actual);
- }
-
- @Test
- public void verfyLPortMirrorPostCheckRequest() throws IOException {
- String content = this.getJson("custom-lport-mirror-post-check-request.json");
- ObjectMapper mapper = new ObjectMapper();
- SDNO expected = mapper.readValue(content, SDNO.class);
- SDNOHealthCheckClient client = new SDNOHealthCheckClient();
- String actual =
- client.buildLPortMirrorCheckPostRequest(userId, requestId, clliCode, configurationId, interfaceId);
- assertEquals("payloads are equal", mapper.writeValueAsString(expected), actual);
- }
-
-
- @Test
- public void verifyPortMirrorPostCheckRequest() throws IOException {
- String content = this.getJson("custom-port-mirror-post-check-request.json");
- ObjectMapper mapper = new ObjectMapper();
- SDNO expected = mapper.readValue(content, SDNO.class);
- SDNOHealthCheckClient client = new SDNOHealthCheckClient();
- String actual = client.buildPortMirrorPostCheckRequest(userId, requestId, clliCode, configurationId);
-
- assertEquals("payloads are equal", mapper.writeValueAsString(expected), actual);
-
- }
-
- @Test
- public void verifyPortMirrorPreCheckRequest() throws IOException {
- String content = this.getJson("custom-port-mirror-pre-check-request.json");
- ObjectMapper mapper = new ObjectMapper();
- SDNO expected = mapper.readValue(content, SDNO.class);
- SDNOHealthCheckClient client = new SDNOHealthCheckClient();
- String actual = client.buildPortMirrorPreCheckRequest(userId, requestId, clliCode, configurationId);
-
- assertEquals("payloads are equal", mapper.writeValueAsString(expected), actual);
-
- }
-
- private String getJson(String filename) throws IOException {
- return new String(Files.readAllBytes(Paths.get(fileLocation + filename)));
- }
-
-}
diff --git a/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java b/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java
deleted file mode 100644
index c2278c26f9..0000000000
--- a/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.sdno;
-
-import static org.junit.Assert.assertEquals;
-import java.util.UUID;
-import org.junit.Test;
-import org.onap.aai.domain.yang.GenericVnf;
-import org.onap.so.client.sdno.beans.RequestHealthDiagnostic;
-import org.onap.so.client.sdno.beans.SDNO;
-
-public class SDNOValidatorImplTest {
-
- @Test
- public void buildRequestDiagnosticTest() throws Exception {
- SDNOValidatorImpl validator = new SDNOValidatorImpl();
- UUID uuid = UUID.randomUUID();
- GenericVnf vnf = new GenericVnf();
- vnf.setVnfName("VNFNAME");
- vnf.setVnfId("test");
- vnf.setIpv4OamAddress("1.2.3.4");
- vnf.setNfRole("VPE");
- SDNO request = validator.buildRequestDiagnostic(vnf, uuid, "mechid");
- assertEquals(request.getNodeType(), "VPE");
- assertEquals(request.getOperation(), "health-diagnostic");
-
- RequestHealthDiagnostic innerRequest = request.getBody().getInput().getRequestHealthDiagnostic();
- assertEquals(innerRequest.getRequestClientName(), "MSO");
- assertEquals(innerRequest.getRequestNodeName(), "VNFNAME");
- assertEquals(innerRequest.getRequestNodeUuid(), "test");
- assertEquals(innerRequest.getRequestNodeType(), "VPE");
- assertEquals(innerRequest.getRequestNodeIp(), "1.2.3.4");
- assertEquals(innerRequest.getRequestUserId(), "mechid");
- assertEquals(innerRequest.getRequestId(), uuid.toString());
- assertEquals(innerRequest.getHealthDiagnosticCode(), "default");
-
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java b/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java
deleted file mode 100644
index 18b9be0983..0000000000
--- a/common/src/test/java/org/onap/so/client/sdno/SDNOValidatorTest.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * 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.so.client.sdno;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.Arrays;
-import java.util.UUID;
-import org.hamcrest.core.StringContains;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.mockito.Spy;
-import org.onap.aai.domain.yang.GenericVnf;
-import org.onap.so.client.dmaap.Consumer;
-import org.onap.so.client.dmaap.exceptions.DMaaPConsumerFailure;
-import org.onap.so.client.exceptions.SDNOException;
-import org.onap.so.client.sdno.beans.SDNO;
-import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-
-public class SDNOValidatorTest {
-
-
- @Mock
- private Consumer mrConsumer;
- @Spy
- private SDNOHealthCheckDmaapConsumer dmaapConsumer;
- private final String fileLocation = "src/test/resources/org/onap/so/client/sdno/";
- private final String uuid = "xyz123";
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Before
- public void setUpTests() {
- MockitoAnnotations.initMocks(this);
- }
-
- @Test
- public void success() throws IOException, Exception {
- when(dmaapConsumer.getConsumer()).thenReturn(mrConsumer);
- when(mrConsumer.fetch())
- .thenReturn(Arrays.asList(new String[] {getJson("response.json"), getJson("output-success.json")}));
-
- SDNOValidatorImpl validator = new SDNOValidatorImpl();
- SDNOValidatorImpl spy = spy(validator);
- when(dmaapConsumer.getRequestId()).thenReturn("xyz123");
- doReturn(dmaapConsumer).when(spy).getConsumer(any(String.class));
- boolean result = spy.pollForResponse("xyz123");
- assertEquals("result is true", result, true);
- }
-
- @Test
- public void failure() throws IOException, Exception {
- when(dmaapConsumer.getConsumer()).thenReturn(mrConsumer);
- when(mrConsumer.fetch())
- .thenReturn(Arrays.asList(new String[] {getJson("response.json"), getJson("output-failure.json")}));
-
- SDNOValidatorImpl validator = new SDNOValidatorImpl();
- SDNOValidatorImpl spy = spy(validator);
- when(dmaapConsumer.getRequestId()).thenReturn("xyz123");
- doReturn(dmaapConsumer).when(spy).getConsumer(any(String.class));
- thrown.expect(SDNOException.class);
- thrown.expectMessage(new StringContains("my error message"));
- boolean result = spy.pollForResponse("xyz123");
-
- }
-
- @Ignore
- @Test
- public void run() throws Exception {
- SDNOValidatorImpl validator = new SDNOValidatorImpl();
- UUID uuid = UUID.randomUUID();
- GenericVnf vnf = new GenericVnf();
- vnf.setVnfId("test");
- vnf.setIpv4OamAddress("1.2.3.4");
- vnf.setNfRole("VPE");
- SDNO request = validator.buildRequestDiagnostic(vnf, uuid, "mechid");
- ObjectMapper mapper = new ObjectMapper();
- String json = mapper.writeValueAsString(request);
- validator.submitRequest(json);
- thrown.expect(DMaaPConsumerFailure.class);
- boolean result = validator.pollForResponse(uuid.toString());
- System.out.println(json);
-
- }
-
- private String getJson(String filename) throws IOException {
- return new String(Files.readAllBytes(Paths.get(fileLocation + filename)));
- }
-}
diff --git a/common/src/test/resources/__files/aai/bulkprocess/response-failure.json b/common/src/test/resources/__files/aai/bulkprocess/response-failure.json
deleted file mode 100644
index bbc2c38b76..0000000000
--- a/common/src/test/resources/__files/aai/bulkprocess/response-failure.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "transaction": [
- {
- "put": [
- {
- "body": {
- "401": "{\"requestError\": {\"serviceException\": {\"messageId\": \"SVC3003\",\"text\": \"another error message\",\"variables\": []}}}"
- }
- },
- {
- "body": {
- "200": "test2"
- }
- }
- ]
- },
- {
- "put": [
- {
- "body": {
- "400": "{\"requestError\": {\"serviceException\": {\"messageId\": \"SVC3003\",\"text\": \"my great error\",\"variables\": []}}}"
- }
- },
- {
- "body": {
- "200": "test4"
- }
- }
- ]
- }
- ]
-} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/bulkprocess/response-success.json b/common/src/test/resources/__files/aai/bulkprocess/response-success.json
deleted file mode 100644
index 7dae38335a..0000000000
--- a/common/src/test/resources/__files/aai/bulkprocess/response-success.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "transaction": [
- {
- "put": [
- {
- "body": {
- "201": "test"
- }
- },
- {
- "body": {
- "200": "test2"
- }
- }
- ]
- },
- {
- "put": [
- {
- "body": {
- "201": "test3"
- }
- },
- {
- "body": {
- "200": "test4"
- }
- }
- ]
- }
- ]
-}
diff --git a/common/src/test/resources/__files/aai/bulkprocess/test-request-small.json b/common/src/test/resources/__files/aai/bulkprocess/test-request-small.json
deleted file mode 100644
index 973928108f..0000000000
--- a/common/src/test/resources/__files/aai/bulkprocess/test-request-small.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "transactions" : [ {
- "put" : [ {
- "uri" : "/network/generic-vnfs/generic-vnf/test1/relationship-list/relationship",
- "body" : {
- "related-link" : "/cloud-infrastructure/pservers/pserver/test2"
- }
- } ]
- } ]
-} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/bulkprocess/test-request.json b/common/src/test/resources/__files/aai/bulkprocess/test-request.json
deleted file mode 100644
index 5a2953c632..0000000000
--- a/common/src/test/resources/__files/aai/bulkprocess/test-request.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "transactions" : [ {
- "put" : [ {
- "uri" : "/network/generic-vnfs/generic-vnf/test1/relationship-list/relationship",
- "body" : {
- "related-link" : "/cloud-infrastructure/pservers/pserver/test2"
- }
- }, {
- "uri" : "/network/generic-vnfs/generic-vnf/test3/relationship-list/relationship",
- "body" : {
- "related-link" : "/cloud-infrastructure/pservers/pserver/test4"
- }
- } ]
- }, {
- "put" : [ {
- "uri" : "/network/generic-vnfs/generic-vnf/test5/relationship-list/relationship",
- "body" : {
- "related-link" : "/cloud-infrastructure/pservers/pserver/test6"
- }
- } ]
- }, {
- "delete" : [ {
- "uri" : "/network/generic-vnfs/generic-vnf/test7?resource-version=1234"
- } ]
- }]
-} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/error-message.json b/common/src/test/resources/__files/aai/error-message.json
deleted file mode 100644
index 155232294a..0000000000
--- a/common/src/test/resources/__files/aai/error-message.json
+++ /dev/null
@@ -1 +0,0 @@
-{"requestError":{"serviceException":{"messageId":"SVC3000","text":"Invalid input performing %1 on %2 (msg=%3) (ec=%4)","variables":["PUT","url","Precondition Required:resource-version not passed for update of url","ERR.5.4.6130"]}}} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/pserver.json b/common/src/test/resources/__files/aai/pserver.json
deleted file mode 100644
index 1a3f40aac3..0000000000
--- a/common/src/test/resources/__files/aai/pserver.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "results": [
- {
- "pserver": {
- "hostname": "test"
- }
- },
- {
- "pserver": {
- "hostname": "test2"
- }
- }
- ]
-} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/query/pathed-result.json b/common/src/test/resources/__files/aai/query/pathed-result.json
deleted file mode 100644
index e9a3e65c73..0000000000
--- a/common/src/test/resources/__files/aai/query/pathed-result.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "results": [
- {
- "resource-type": "service-instance",
- "resource-link": "https://localhost:8443/aai/v9/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3"
- },
- {
- "resource-type": "service-instance",
- "resource-link": "https://localhost:8443/aai/v9/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3"
- }
- ]
-} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/query/single-query-result.json b/common/src/test/resources/__files/aai/query/single-query-result.json
deleted file mode 100644
index eb12deae80..0000000000
--- a/common/src/test/resources/__files/aai/query/single-query-result.json
+++ /dev/null
@@ -1,80 +0,0 @@
-{
- "results": [
- {
- "url": "/aai/v14/cloud-infrastructure/complexes/complex/complex-id-15100-jc689q",
- "complex": {
- "physical-location-id": "complex-id-15100-jc689q",
- "resource-version": "1541786379243",
- "physical-location-type": "lvXHWJC",
- "street1": "uAAi5qjc1",
- "street2": "vkK6XQjc2",
- "city": "3Ec8JSW0JC",
- "state": "COczHmeJC",
- "postal-code": "D4J1",
- "country": "K0JC1",
- "region": "JzHqJC1",
- "relationship-list": {
- "relationship": [
- {
- "related-to": "pserver",
- "relationship-label": "org.onap.relationships.inventory.LocatedIn",
- "related-link": "/aai/v14/cloud-infrastructure/pservers/pserver/pserver-15100-jc689q",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "pserver-15100-jc689q"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- },
- {
- "property-key": "pserver.fqdn"
- }
- ]
- }
- ]
- }
- }
- },
- {
- "url": "/aai/v14/cloud-infrastructure/complexes/complex/complex-id-15100-jc689q2",
- "complex": {
- "physical-location-id": "complex-id-15100-jc689q2",
- "resource-version": "1541786379243",
- "physical-location-type": "lvXHWJC",
- "street1": "uAAi5qjc1",
- "street2": "vkK6XQjc2",
- "city": "3Ec8JSW0JC",
- "state": "COczHmeJC",
- "postal-code": "D4J1",
- "country": "K0JC1",
- "region": "JzHqJC1",
- "relationship-list": {
- "relationship": [
- {
- "related-to": "pserver",
- "relationship-label": "org.onap.relationships.inventory.LocatedIn",
- "related-link": "/aai/v14/cloud-infrastructure/pservers/pserver/pserver-15100-jc689q",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "pserver-15100-jc689q"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- },
- {
- "property-key": "pserver.fqdn"
- }
- ]
- }
- ]
- }
- }
- }
- ]
-} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/resources/e2e-complex.json b/common/src/test/resources/__files/aai/resources/e2e-complex.json
deleted file mode 100644
index e3d830e978..0000000000
--- a/common/src/test/resources/__files/aai/resources/e2e-complex.json
+++ /dev/null
@@ -1,660 +0,0 @@
-{
- "physical-location-id": "MTCWNJA4DCP",
- "complex-name": "mtcnj",
- "resource-version": "1498188613044",
- "physical-location-type": "Mobility",
- "street1": "200 S. Laurel Ave, Rm A4-3C30",
- "city": "Middletown",
- "state": "NJ",
- "postal-code": "07748",
- "country": "USA",
- "region": "US",
- "latitude": "40.39596",
- "longitude": "-74.135342",
- "lata": "224",
- "ctag-pools": {
- "ctag-pool": [
- {
- "target-pe": "sfcca301vr1",
- "availability-zone-name": "mtcnj-esx-az01",
- "ctag-pool-purpose": "IPAG",
- "ctag-values": "2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025",
- "resource-version": "1494254946087",
- "relationship-list": {
- "relationship": [
- {
- "related-to": "vpls-pe",
- "related-link": "https://localhost:8443/aai/v9/network/vpls-pes/vpls-pe/sfcca301vr1",
- "relationship-data": [
- {
- "relationship-key": "vpls-pe.equipment-name",
- "relationship-value": "sfcca301vr1"
- }
- ]
- }
- ]
- }
- },
- {
- "target-pe": "VPESAT-mtcnj401me6",
- "availability-zone-name": "mtcnj-esx-az01",
- "ctag-pool-purpose": "VPE",
- "ctag-values": "3001,3002,3003,3004,3005,3006,3007,3008,3009,3010,3011,3012,3013,3014,3015,3016,3017,3018,3019,3020,3021,3022,3023,3024,3025,3026,3027,3028,3029,3030,3031,3032,3033,3034,3035,3036,3037,3038,3039,3040,3041,3042,3043,3044,3045,3046,3047,3048,3049,3050",
- "resource-version": "1494254975977"
- }
- ]
- },
- "relationship-list": {
- "relationship": [
- {
- "related-to": "vce",
- "related-link": "https://localhost:8443/aai/v9/network/vces/vce/a9fec18e-1ea3-40e4-a6c0-a89b3de07053",
- "relationship-data": [
- {
- "relationship-key": "vce.vnf-id",
- "relationship-value": "a9fec18e-1ea3-40e4-a6c0-a89b3de07053"
- }
- ],
- "related-to-property": [
- {
- "property-key": "vce.vnf-name",
- "property-value": "mtcnj411vbc"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj104snd",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj104snd"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj105snd",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj105snd"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/compute_host",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "compute_host"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj106snd",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj106snd"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj126sd9",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj126sd9"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "vce",
- "related-link": "https://localhost:8443/aai/v9/network/vces/vce/8ae1e5f8-61f1-4c71-913a-b40cc4593cb9",
- "relationship-data": [
- {
- "relationship-key": "vce.vnf-id",
- "relationship-value": "8ae1e5f8-61f1-4c71-913a-b40cc4593cb9"
- }
- ],
- "related-to-property": [
- {
- "property-key": "vce.vnf-name",
- "property-value": "mtcnj411vbc"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj102sta",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj102sta"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnjtax102",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnjtax102"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj107snd",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj107snd"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj118snd",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj118snd"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj110snd",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj110snd"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj109snd",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj109snd"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj114snd",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj114snd"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj119snd",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj119snd"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj116snd",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj116snd"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "vce",
- "related-link": "https://localhost:8443/aai/v9/network/vces/vce/a2935fa9-b743-49f4-9813-a127f13c4e93",
- "relationship-data": [
- {
- "relationship-key": "vce.vnf-id",
- "relationship-value": "a2935fa9-b743-49f4-9813-a127f13c4e93"
- }
- ],
- "related-to-property": [
- {
- "property-key": "vce.vnf-name",
- "property-value": "mtcnj410vbc"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj108snd",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj108snd"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj123sd9",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj123sd9"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj101snd",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj101snd"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj102snd",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj102snd"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnjtax101",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnjtax101"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj113snd",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj113snd"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj111snd",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj111snd"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj103snd",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj103snd"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj117snd",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj117snd"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj101sta",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj101sta"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "vce",
- "related-link": "https://localhost:8443/aai/v9/network/vces/vce/c7fe7698-8063-4e26-8bd3-ca3edde0b0d4",
- "relationship-data": [
- {
- "relationship-key": "vce.vnf-id",
- "relationship-value": "c7fe7698-8063-4e26-8bd3-ca3edde0b0d4"
- }
- ],
- "related-to-property": [
- {
- "property-key": "vce.vnf-name",
- "property-value": "mtcnj412vbc"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj120snd",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj120snd"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj124sd9",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj124sd9"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj125sd9",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj125sd9"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj112snd",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj112snd"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "pserver",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/pservers/pserver/mtcnj115snd",
- "relationship-data": [
- {
- "relationship-key": "pserver.hostname",
- "relationship-value": "mtcnj115snd"
- }
- ],
- "related-to-property": [
- {
- "property-key": "pserver.pserver-name2"
- }
- ]
- },
- {
- "related-to": "cloud-region",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/mtcnj2",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "CloudOwner"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "mtcnj2"
- }
- ],
- "related-to-property": [
- {
- "property-key": "cloud-region.owner-defined-type",
- "property-value": "lcp"
- }
- ]
- },
- {
- "related-to": "oam-network",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/oam-networks/oam-network/f9263cat-4eaa-43a0-bea4-adcf6e123456",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "CloudOwner"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "AAIAIC25"
- },
- {
- "relationship-key": "oam-network.network-uuid",
- "relationship-value": "f9263cat-4eaa-43a0-bea4-adcf6e123456"
- }
- ],
- "related-to-property": [
- {
- "property-key": "oam-network.network-name",
- "property-value": "VLAN-OAM-1323"
- }
- ]
- },
- {
- "related-to": "oam-network",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/oam-networks/oam-network/b9263fab-4eaa-43a0-bea4-adcf6e999999",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "CloudOwner"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "AAIAIC25"
- },
- {
- "relationship-key": "oam-network.network-uuid",
- "relationship-value": "b9263fab-4eaa-43a0-bea4-adcf6e999999"
- }
- ],
- "related-to-property": [
- {
- "property-key": "oam-network.network-name",
- "property-value": "VLAN-OAM-1323"
- }
- ]
- },
- {
- "related-to": "oam-network",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/oam-networks/oam-network/cf33dc95-c5d2-48fd-8078-fd949363f63b",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "CloudOwner"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "AAIAIC25"
- },
- {
- "relationship-key": "oam-network.network-uuid",
- "relationship-value": "cf33dc95-c5d2-48fd-8078-fd949363f63b"
- }
- ],
- "related-to-property": [
- {
- "property-key": "oam-network.network-name",
- "property-value": "VLAN-OAM-1323"
- }
- ]
- },
- {
- "related-to": "availability-zone",
- "related-link": "https://localhost:8443/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/availability-zones/availability-zone/mtcnj-esx-az01",
- "relationship-data": [
- {
- "relationship-key": "cloud-region.cloud-owner",
- "relationship-value": "CloudOwner"
- },
- {
- "relationship-key": "cloud-region.cloud-region-id",
- "relationship-value": "AAIAIC25"
- },
- {
- "relationship-key": "availability-zone.availability-zone-name",
- "relationship-value": "mtcnj-esx-az01"
- }
- ]
- }
- ]
- }
- } \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/resources/empty-query-result.json b/common/src/test/resources/__files/aai/resources/empty-query-result.json
deleted file mode 100644
index 914332edba..0000000000
--- a/common/src/test/resources/__files/aai/resources/empty-query-result.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "results": []
-} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/resources/mockObject.json b/common/src/test/resources/__files/aai/resources/mockObject.json
deleted file mode 100644
index 2f97b47dd3..0000000000
--- a/common/src/test/resources/__files/aai/resources/mockObject.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "id" : "something",
- "resource-version" : "1234",
- "plural" : {
- "singular" : [{
- "id" : "something2",
- "resource-version" : "5678"
- }]
- }
-} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/resources/service-instance-pathed-query.json b/common/src/test/resources/__files/aai/resources/service-instance-pathed-query.json
deleted file mode 100644
index 0fa9515820..0000000000
--- a/common/src/test/resources/__files/aai/resources/service-instance-pathed-query.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "results": [
- {
- "resource-type": "service-instance",
- "resource-link": "https://localhost:8443/aai/v9/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3"
- }
- ]
-} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/singletransaction/sample-request.json b/common/src/test/resources/__files/aai/singletransaction/sample-request.json
deleted file mode 100644
index 69024dca83..0000000000
--- a/common/src/test/resources/__files/aai/singletransaction/sample-request.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "operations": [
- {
- "action": "put",
- "uri": "/cloud-infrastructure/pservers/pserver/pserver-hostname",
- "body": {
- "hostname": "pserver-hostname",
- "fqdn": "pserver-bulk-process-single-transactions-multiple-actions-1-fqdn"
- }
- },
- {
- "action": "patch",
- "uri": "/cloud-infrastructure/pservers/pserver/pserver-hostname",
- "body": {
- "fqdn": "patched-fqdn"
- }
- },
- {
- "action": "put",
- "uri": "/cloud-infrastructure/complexes/complex/my-complex",
- "body": {
- "city": "my-city"
- }
- },
- {
- "action": "delete",
- "uri": "/cloud-infrastructure/complexes/complex/my-complex2?resource-version=1234",
- "body" : {
- }
- }
- ]
-} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/singletransaction/sample-response-failure.json b/common/src/test/resources/__files/aai/singletransaction/sample-response-failure.json
deleted file mode 100644
index d0b0e39924..0000000000
--- a/common/src/test/resources/__files/aai/singletransaction/sample-response-failure.json
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "operation-responses": [
- {
- "action": "put",
- "uri": "/cloud-infrastructure/pservers/pserver/pserver-hostname",
- "response-status-code": 201,
- "response-body": null
- },
- {
- "action": "patch",
- "uri": "/cloud-infrastructure/pservers/pserver/pserver-hostname",
- "response-status-code": 200,
- "response-body": null
- },
- {
- "action": "put",
- "uri": "/cloud-infrastructure/complexes/complex/my-complex",
- "response-status-code": 400,
- "response-body": {
- "requestError": {
- "serviceException": {
- "messageId": "SVC3003",
- "text": "another error message",
- "variables": []
- }
- }
- }
- }
- ]
-} \ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/singletransaction/sample-response.json b/common/src/test/resources/__files/aai/singletransaction/sample-response.json
deleted file mode 100644
index a5b322ee2e..0000000000
--- a/common/src/test/resources/__files/aai/singletransaction/sample-response.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "operation-responses": [
- {
- "action": "put",
- "uri": "/cloud-infrastructure/pservers/pserver/pserver-hostname",
- "response-status-code": 201,
- "response-body": null
- },
- {
- "action": "patch",
- "uri": "/cloud-infrastructure/pservers/pserver/pserver-hostname",
- "response-status-code": 200,
- "response-body": null
- },
- {
- "action": "put",
- "uri": "/cloud-infrastructure/complexes/complex/my-complex",
- "response-status-code": 201,
- "response-body": null
- }
- ]
-} \ No newline at end of file
diff --git a/common/src/test/resources/aai.properties b/common/src/test/resources/aai.properties
deleted file mode 100644
index 2936e841bb..0000000000
--- a/common/src/test/resources/aai.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-aai.endpoint=http://localhost:8443
-aai.auth=5E12ACACBD552A415E081E29F2C4772F9835792A51C766CCFDD7433DB5220B59969CB2798C
-mso.msoKey=07a7159d3bf51a0e53be7a8f89699be7 \ No newline at end of file
diff --git a/common/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-post-check-request.json b/common/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-post-check-request.json
deleted file mode 100644
index 2c46b5a8cb..0000000000
--- a/common/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-post-check-request.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "body": {
- "input": {
- "request-hd-custom": {
- "request-client-name": "MSO",
- "request-user-id": "test-user",
- "request-id": "test-request-id",
- "health-diagnostic-code": "VROUTER000004",
- "operation-type": "lport_mirroring_check",
- "send-detailed-cmd-response": "false",
- "aai-param-list": [
- {
- "key": "configuration-id",
- "value": "test-configuration-id"
- },
- {
- "key": "interface-id",
- "value": "test-interface-id"
- }
- ]
- }
- }
- },
- "operation": "health-diagnostic-custom",
- "nodeLoc": "test-clli",
- "nodeType": "VROUTER"
-} \ No newline at end of file
diff --git a/common/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-pre-check-request.json b/common/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-pre-check-request.json
deleted file mode 100644
index bf168b0028..0000000000
--- a/common/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-pre-check-request.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "body": {
- "input": {
- "request-hd-custom": {
- "request-client-name": "MSO",
- "request-user-id": "test-user",
- "request-id": "test-request-id",
- "health-diagnostic-code": "VROUTER000003",
- "operation-type": "lport_mirroring_check",
- "send-detailed-cmd-response": "false",
- "aai-param-list": [
- {
- "key": "configuration-id",
- "value": "test-configuration-id"
- },
- {
- "key": "interface-id",
- "value": "test-interface-id"
- }
- ]
- }
- }
- },
- "operation": "health-diagnostic-custom",
- "nodeLoc": "test-clli",
- "nodeType": "VROUTER"
-} \ No newline at end of file
diff --git a/common/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-post-check-request.json b/common/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-post-check-request.json
deleted file mode 100644
index 89e505e7d0..0000000000
--- a/common/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-post-check-request.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "body": {
- "input": {
- "request-hd-custom": {
- "request-client-name": "MSO",
- "request-user-id": "test-user",
- "request-id": "test-request-id",
- "health-diagnostic-code": "VROUTER000004",
- "operation-type": "mirroring_check",
- "send-detailed-cmd-response": "false",
- "aai-param-list": [
- {
- "key": "configuration-id",
- "value": "test-configuration-id"
- }
- ]
- }
- }
- },
- "operation": "health-diagnostic-custom",
- "nodeLoc": "test-clli",
- "nodeType": "VROUTER"
-} \ No newline at end of file
diff --git a/common/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-pre-check-request.json b/common/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-pre-check-request.json
deleted file mode 100644
index 86897c8a1f..0000000000
--- a/common/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-pre-check-request.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "body": {
- "input": {
- "request-hd-custom": {
- "request-client-name": "MSO",
- "request-user-id": "test-user",
- "request-id": "test-request-id",
- "health-diagnostic-code": "VROUTER000003",
- "operation-type": "mirroring_check",
- "send-detailed-cmd-response": "false",
- "aai-param-list": [
- {
- "key": "configuration-id",
- "value": "test-configuration-id"
- }
- ]
- }
- }
- },
- "operation": "health-diagnostic-custom",
- "nodeLoc": "test-clli",
- "nodeType": "VROUTER"
-}
diff --git a/common/src/test/resources/org/onap/so/client/sdno/output-failure.json b/common/src/test/resources/org/onap/so/client/sdno/output-failure.json
deleted file mode 100644
index 8cf0a820cd..0000000000
--- a/common/src/test/resources/org/onap/so/client/sdno/output-failure.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "body": {
- "output": {
- "response-hd-custom": {
- "response-status": "Failure",
- "cached-data": "false",
- "response-interface-type": "ansible",
- "response-id": "191bf423-8473-4f7c-9fbb-e5dcbb40a12b",
- "remote_end_time": "2017-10-13T14:51:53.490+0000",
- "response-client-name": "MSO",
- "user_id": "xxxxxx",
- "remote_start_time": "2017-10-13T14:51:53.173+0000",
- "error-message": "my error message",
- "connection-failure-msg": "SDNO was unable to connect to an Ansible REST API server; Please ensure Ansible REST server is running"
- }
- }
- },
- "result-info": {
- "code": "200",
- "status": "SUCCESS",
- "request-id": "xyz123",
- "client-name": "MSO",
- "processing-host": "sdno-sdno-mtsnjv9sdno01"
- }
-} \ No newline at end of file
diff --git a/common/src/test/resources/org/onap/so/client/sdno/output-success.json b/common/src/test/resources/org/onap/so/client/sdno/output-success.json
deleted file mode 100644
index a6794327d8..0000000000
--- a/common/src/test/resources/org/onap/so/client/sdno/output-success.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "body": {
- "output": {
- "response-healthdiagnostic": {
- "response-node-ip": "192.20.127.76",
- "response-id": "xyz123",
- "response-node-name": "mtvnjv9aads11",
- "response-status": "Success",
- "response-interface-type": "ssh",
- "response-details-json": "result",
- "cached-data": "false"
- }
- }
- },
- "result-info": {
- "client-name": "MSO",
- "code": "200",
- "processing-host": "sdno1-host01",
- "request-id": "xyz123",
- "status": "SUCCESS"
- }
-} \ No newline at end of file
diff --git a/common/src/test/resources/org/onap/so/client/sdno/response.json b/common/src/test/resources/org/onap/so/client/sdno/response.json
deleted file mode 100644
index 2355e86938..0000000000
--- a/common/src/test/resources/org/onap/so/client/sdno/response.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
-
- "result-info": {
-
- "client-name": "MSO",
-
- "code": "202",
-
- "processing-host": "sdno1-host01",
-
- "request-id": "xyz123",
-
- "status": "ACCEPTED"
-
- }
-
-} \ No newline at end of file