aboutsummaryrefslogtreecommitdiffstats
path: root/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test')
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/AaiSimulatorControllerTest.java6
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/BusinessControllerTest.java118
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/ProjectControllerTest.java148
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/TestUtils.java73
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/configuration/TestRestTemplateConfigration.java71
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/resources/test-data/business-project-relation-ship.json3
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/resources/test-data/business-project.json3
7 files changed, 340 insertions, 82 deletions
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/AaiSimulatorControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/AaiSimulatorControllerTest.java
index bde46f42..59d3a556 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/AaiSimulatorControllerTest.java
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/AaiSimulatorControllerTest.java
@@ -22,7 +22,7 @@ package org.onap.so.aai.simulator.controller;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.onap.so.aai.simulator.utils.Constant;
+import org.onap.so.aai.simulator.utils.Constants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
@@ -54,11 +54,11 @@ public class AaiSimulatorControllerTest {
final String url = getBaseUrl() + "/healthcheck";
final ResponseEntity<String> object = restTemplate.getForEntity(url, String.class);
- assertEquals(Constant.HEALTHY, object.getBody());
+ assertEquals(Constants.HEALTHY, object.getBody());
}
private String getBaseUrl() {
- return "http://localhost:" + port + Constant.BASE_URL;
+ return "https://localhost:" + port + Constants.BASE_URL;
}
}
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/BusinessControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/BusinessControllerTest.java
index d317e6b6..341c1b38 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/BusinessControllerTest.java
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/BusinessControllerTest.java
@@ -23,9 +23,12 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.onap.so.aai.simulator.controller.TestUtils.getFile;
+import static org.onap.so.aai.simulator.controller.TestUtils.getJsonString;
+import static org.onap.so.aai.simulator.controller.TestUtils.getObjectFromFile;
import java.io.File;
import java.io.IOException;
-import java.util.Base64;
+import java.nio.file.Files;
import java.util.Optional;
import java.util.UUID;
import org.junit.After;
@@ -35,8 +38,8 @@ import org.onap.aai.domain.yang.Customer;
import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.aai.domain.yang.ServiceInstances;
import org.onap.aai.domain.yang.ServiceSubscription;
-import org.onap.so.aai.simulator.service.providers.CacheServiceProvider;
-import org.onap.so.aai.simulator.utils.Constant;
+import org.onap.so.aai.simulator.service.providers.CustomerCacheServiceProvider;
+import org.onap.so.aai.simulator.utils.Constants;
import org.onap.so.aai.simulator.utils.RequestError;
import org.onap.so.aai.simulator.utils.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
@@ -46,7 +49,6 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.context.annotation.Configuration;
-import org.springframework.core.io.ClassPathResource;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
@@ -54,8 +56,6 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
/**
* @author waqas.ikram@ericsson.com
@@ -83,9 +83,7 @@ public class BusinessControllerTest {
private static final String GLOBAL_CUSTOMER_ID = "DemoCustomer";
- private static final String CUSTOMERS_URL = Constant.BUSINESS_URL + "customers/customer/" + GLOBAL_CUSTOMER_ID;
-
- private static final String PASSWORD = "aai.onap.org:demo123456!";
+ private static final String CUSTOMERS_URL = Constants.CUSTOMER_URL + GLOBAL_CUSTOMER_ID;
@LocalServerPort
private int port;
@@ -97,7 +95,7 @@ public class BusinessControllerTest {
private String username;
@Autowired
- private CacheServiceProvider cacheServiceProvider;
+ private CustomerCacheServiceProvider cacheServiceProvider;
@After
public void after() {
@@ -106,8 +104,7 @@ public class BusinessControllerTest {
@Test
public void test_putCustomer_successfullyAddedToCache() throws Exception {
- final Customer customer = getCustomer(getFile("test-data/business-customer.json"));
- final ResponseEntity<Void> actual = invokeHttpPut(getCustomerEndPointUrl(), customer);
+ final ResponseEntity<Void> actual = invokeHttpPut(getCustomerEndPointUrl(), getCustomer());
assertEquals(HttpStatus.ACCEPTED, actual.getStatusCode());
assertTrue(cacheServiceProvider.getCustomer(GLOBAL_CUSTOMER_ID).isPresent());
@@ -115,10 +112,9 @@ public class BusinessControllerTest {
@Test
public void test_getCustomer_ableToRetrieveCustomer() throws Exception {
- final Customer customer = getCustomer(getFile("test-data/business-customer.json"));
final String url = getCustomerEndPointUrl();
- invokeHttpPut(url, customer);
+ invokeHttpPut(url, getCustomer());
final ResponseEntity<Customer> actual =
restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(getHttpHeaders()), Customer.class);
@@ -145,18 +141,17 @@ public class BusinessControllerTest {
final ServiceException serviceException = actualError.getServiceException();
assertNotNull(serviceException);
- assertEquals(Constant.ERROR_MESSAGE_ID, serviceException.getMessageId());
- assertEquals(Constant.ERROR_MESSAGE, serviceException.getText());
+ assertEquals(Constants.ERROR_MESSAGE_ID, serviceException.getMessageId());
+ assertEquals(Constants.ERROR_MESSAGE, serviceException.getText());
assertTrue(serviceException.getVariables().contains(HttpMethod.GET.toString()));
}
@Test
public void test_getServiceSubscription_ableToRetrieveServiceSubscriptionFromCache() throws Exception {
- final Customer customer = getCustomer(getFile("test-data/business-customer.json"));
final String url = getCustomerEndPointUrl() + SERVICE_SUBSCRIPTIONS_URL;
- invokeHttpPut(getCustomerEndPointUrl(), customer);
+ invokeHttpPut(getCustomerEndPointUrl(), getCustomer());
final ResponseEntity<ServiceSubscription> actual = restTemplate.exchange(url, HttpMethod.GET,
new HttpEntity<>(getHttpHeaders()), ServiceSubscription.class);
@@ -172,18 +167,14 @@ public class BusinessControllerTest {
@Test
public void test_putSericeInstance_ableToRetrieveServiceInstanceFromCache() throws Exception {
- final Customer customer = getCustomer(getFile("test-data/business-customer.json"));
final String url = getCustomerEndPointUrl() + SERVICE_SUBSCRIPTIONS_URL + SERVICE_INSTANCE_URL;
- final ResponseEntity<Void> response = invokeHttpPut(getCustomerEndPointUrl(), customer);
+ final ResponseEntity<Void> response = invokeHttpPut(getCustomerEndPointUrl(), getCustomer());
assertEquals(HttpStatus.ACCEPTED, response.getStatusCode());
- final ServiceInstance serviceInstance =
- getObjectFromFile(getFile("test-data/service-instance.json"), ServiceInstance.class);
-
- invokeHttpPut(url, serviceInstance);
+ invokeHttpPut(url, getServiceInstance());
final Optional<ServiceInstance> actual =
cacheServiceProvider.getServiceInstance(GLOBAL_CUSTOMER_ID, SERVICE_TYPE, SERVICE_INSTANCE_ID);
@@ -199,18 +190,14 @@ public class BusinessControllerTest {
@Test
public void test_getSericeInstance_usingServiceInstanceName_ableToRetrieveServiceInstanceFromCache()
throws Exception {
- final Customer customer = getCustomer(getFile("test-data/business-customer.json"));
final String url = getCustomerEndPointUrl() + SERVICE_SUBSCRIPTIONS_URL + SERVICE_INSTANCE_URL;
- final ResponseEntity<Void> response = invokeHttpPut(getCustomerEndPointUrl(), customer);
+ final ResponseEntity<Void> response = invokeHttpPut(getCustomerEndPointUrl(), getCustomer());
assertEquals(HttpStatus.ACCEPTED, response.getStatusCode());
- final ServiceInstance serviceInstance =
- getObjectFromFile(getFile("test-data/service-instance.json"), ServiceInstance.class);
-
- invokeHttpPut(url, serviceInstance);
+ invokeHttpPut(url, getServiceInstance());
final String serviceInstanceUrl = getCustomerEndPointUrl() + SERVICE_SUBSCRIPTIONS_URL + SERVICE_INSTANCES_URL
+ "?service-instance-name=" + SERVICE_NAME;
@@ -231,18 +218,14 @@ public class BusinessControllerTest {
@Test
public void test_getSericeInstance_usingServiceInstanceId_ableToRetrieveServiceInstanceFromCache()
throws Exception {
- final Customer customer = getCustomer(getFile("test-data/business-customer.json"));
final String url = getCustomerEndPointUrl() + SERVICE_SUBSCRIPTIONS_URL + SERVICE_INSTANCE_URL;
- final ResponseEntity<Void> response = invokeHttpPut(getCustomerEndPointUrl(), customer);
+ final ResponseEntity<Void> response = invokeHttpPut(getCustomerEndPointUrl(), getCustomer());
assertEquals(HttpStatus.ACCEPTED, response.getStatusCode());
- final ServiceInstance serviceInstance =
- getObjectFromFile(getFile("test-data/service-instance.json"), ServiceInstance.class);
-
- invokeHttpPut(url, serviceInstance);
+ invokeHttpPut(url, getServiceInstance());
final ResponseEntity<ServiceInstance> actual =
restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(getHttpHeaders()), ServiceInstance.class);
@@ -259,21 +242,17 @@ public class BusinessControllerTest {
@Test
public void test_getSericeInstance_usinginvalidServiceInstanceId_shouldReturnError() throws Exception {
- final Customer customer = getCustomer(getFile("test-data/business-customer.json"));
final String url = getCustomerEndPointUrl() + SERVICE_SUBSCRIPTIONS_URL + SERVICE_INSTANCE_URL;
- final ResponseEntity<Void> response = invokeHttpPut(getCustomerEndPointUrl(), customer);
+ final ResponseEntity<Void> response = invokeHttpPut(getCustomerEndPointUrl(), getCustomer());
assertEquals(HttpStatus.ACCEPTED, response.getStatusCode());
- final ServiceInstance serviceInstance =
- getObjectFromFile(getFile("test-data/service-instance.json"), ServiceInstance.class);
+ invokeHttpPut(url, getServiceInstance());
- invokeHttpPut(url, serviceInstance);
-
- String invalidServiceInstanceUrl = getCustomerEndPointUrl() + SERVICE_SUBSCRIPTIONS_URL + SERVICE_INSTANCES_URL
- + "/service-instance/" + UUID.randomUUID();
+ final String invalidServiceInstanceUrl = getCustomerEndPointUrl() + SERVICE_SUBSCRIPTIONS_URL
+ + SERVICE_INSTANCES_URL + "/service-instance/" + UUID.randomUUID();
final ResponseEntity<RequestError> actual = restTemplate.exchange(invalidServiceInstanceUrl, HttpMethod.GET,
new HttpEntity<>(getHttpHeaders()), RequestError.class);
@@ -284,26 +263,24 @@ public class BusinessControllerTest {
final ServiceException serviceException = actualError.getServiceException();
assertNotNull(serviceException);
- assertEquals(Constant.ERROR_MESSAGE_ID, serviceException.getMessageId());
- assertEquals(Constant.ERROR_MESSAGE, serviceException.getText());
+ assertEquals(Constants.ERROR_MESSAGE_ID, serviceException.getMessageId());
+ assertEquals(Constants.ERROR_MESSAGE, serviceException.getText());
assertTrue(serviceException.getVariables().contains(HttpMethod.GET.toString()));
}
@Test
- public void test_getSericeInstance_usinginvalidServiceInstanceName_shouldReturnError() throws Exception {
- final Customer customer = getCustomer(getFile("test-data/business-customer.json"));
+ public void test_getSericeInstance_usingInvalidServiceInstanceName_shouldReturnError() throws Exception {
final String url = getCustomerEndPointUrl() + SERVICE_SUBSCRIPTIONS_URL + SERVICE_INSTANCE_URL;
- final ResponseEntity<Void> response = invokeHttpPut(getCustomerEndPointUrl(), customer);
+ final ResponseEntity<Void> response = invokeHttpPut(getCustomerEndPointUrl(), getCustomer());
assertEquals(HttpStatus.ACCEPTED, response.getStatusCode());
- final ServiceInstance serviceInstance =
- getObjectFromFile(getFile("test-data/service-instance.json"), ServiceInstance.class);
+ final ResponseEntity<Void> putRequestReponse = invokeHttpPut(url, getServiceInstance());
+ assertEquals(HttpStatus.ACCEPTED, putRequestReponse.getStatusCode());
- invokeHttpPut(url, serviceInstance);
final String serviceInstanceUrl = getCustomerEndPointUrl() + SERVICE_SUBSCRIPTIONS_URL + SERVICE_INSTANCES_URL
+ "?service-instance-name=Dummy&depth=2";
@@ -317,14 +294,18 @@ public class BusinessControllerTest {
final ServiceException serviceException = actualError.getServiceException();
assertNotNull(serviceException);
- assertEquals(Constant.ERROR_MESSAGE_ID, serviceException.getMessageId());
- assertEquals(Constant.ERROR_MESSAGE, serviceException.getText());
+ assertEquals(Constants.ERROR_MESSAGE_ID, serviceException.getMessageId());
+ assertEquals(Constants.ERROR_MESSAGE, serviceException.getText());
assertTrue(serviceException.getVariables().contains(HttpMethod.GET.toString()));
}
+ private String getCustomer() throws Exception, IOException {
+ return getJsonString("test-data/business-customer.json");
+ }
+
private String getCustomerEndPointUrl() {
- return getBaseUrl() + CUSTOMERS_URL;
+ return TestUtils.getBaseUrl(port) + CUSTOMERS_URL;
}
private ResponseEntity<Void> invokeHttpPut(final String url, final Object obj) {
@@ -337,32 +318,11 @@ public class BusinessControllerTest {
}
private HttpHeaders getHttpHeaders() {
- final HttpHeaders requestHeaders = new HttpHeaders();
- requestHeaders.add("Authorization", getBasicAuth());
- return requestHeaders;
- }
-
- private File getFile(final String file) throws IOException {
- return new ClassPathResource(file).getFile();
- }
-
- private Customer getCustomer(final File file) throws Exception {
- return getObjectFromFile(file, Customer.class);
- }
-
- private <T> T getObjectFromFile(final File file, final Class<T> clazz) throws Exception {
- final ObjectMapper mapper = new ObjectMapper();
- mapper.registerModule(new JaxbAnnotationModule());
-
- return mapper.readValue(file, clazz);
- }
-
- private String getBasicAuth() {
- return "Basic " + new String(Base64.getEncoder().encodeToString((username + ":" + PASSWORD).getBytes()));
+ return TestUtils.getHttpHeaders(username);
}
- private String getBaseUrl() {
- return "http://localhost:" + port;
+ private String getServiceInstance() throws Exception, IOException {
+ return getJsonString("test-data/service-instance.json");
}
}
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/ProjectControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/ProjectControllerTest.java
new file mode 100644
index 00000000..73fdb2c5
--- /dev/null
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/ProjectControllerTest.java
@@ -0,0 +1,148 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.aai.simulator.controller;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.onap.so.aai.simulator.controller.TestUtils.getFile;
+import static org.onap.so.aai.simulator.controller.TestUtils.getHttpHeaders;
+import static org.onap.so.aai.simulator.controller.TestUtils.getJsonString;
+import java.io.IOException;
+import java.nio.file.Files;
+import org.junit.After;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.aai.domain.yang.Project;
+import org.onap.so.aai.simulator.service.providers.ProjectCacheServiceProvider;
+import org.onap.so.aai.simulator.utils.Constants;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+/**
+ * @author waqas.ikram@ericsson.com
+ *
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ActiveProfiles("test")
+@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
+@Configuration
+public class ProjectControllerTest {
+
+ private static final String RELATIONSHIP_URL = "/relationship-list/relationship";
+
+ private static final String BUSINESS_PROJECT_JSON_FILE = "test-data/business-project.json";
+
+ private static final String PROJECT_RELATION_SHIP_JSON_FILE = "test-data/business-project-relation-ship.json";
+
+ private static final String PROJECT_NAME_VALUE = "PROJECT_NAME_VALUE";
+
+ @LocalServerPort
+ private int port;
+
+ @Autowired
+ private TestRestTemplate restTemplate;
+
+ @Value("${spring.security.username}")
+ private String username;
+
+ @Autowired
+ private ProjectCacheServiceProvider cacheServiceProvider;
+
+ @After
+ public void after() {
+ cacheServiceProvider.clearAll();
+ }
+
+ @Test
+ public void test_putProject_successfullyAddedToCache() throws Exception {
+ final String url = getProjectEndPointUrl() + "/" + PROJECT_NAME_VALUE;
+ final String body = new String(Files.readAllBytes(getFile(BUSINESS_PROJECT_JSON_FILE).toPath()));
+ final ResponseEntity<Void> actual = invokeHttpPut(url, body);
+
+ assertEquals(HttpStatus.ACCEPTED, actual.getStatusCode());
+
+ final ResponseEntity<Project> actualResponse = invokeHttpGet(url, Project.class);
+
+ assertEquals(HttpStatus.OK, actualResponse.getStatusCode());
+ assertTrue(actualResponse.hasBody());
+ final Project actualProject = actualResponse.getBody();
+ assertEquals(PROJECT_NAME_VALUE, actualProject.getProjectName());
+ assertNotNull(actualProject.getResourceVersion());
+
+ }
+
+ @Test
+ public void test_putProjectRelationShip_successfullyAddedToCache() throws Exception {
+ final String url = getProjectEndPointUrl() + "/" + PROJECT_NAME_VALUE;
+ final ResponseEntity<Void> actual = invokeHttpPut(url, getJsonString(BUSINESS_PROJECT_JSON_FILE));
+ assertEquals(HttpStatus.ACCEPTED, actual.getStatusCode());
+
+ final String projectRelationshipUrl = url + RELATIONSHIP_URL;
+
+ final ResponseEntity<Void> putResponse = invokeHttpPut(projectRelationshipUrl, getRelationship());
+
+ assertEquals(HttpStatus.ACCEPTED, putResponse.getStatusCode());
+
+ final ResponseEntity<Project> actualResponse = invokeHttpGet(url, Project.class);
+
+ assertEquals(HttpStatus.OK, actualResponse.getStatusCode());
+ assertTrue(actualResponse.hasBody());
+ final Project actualProject = actualResponse.getBody();
+ assertEquals(PROJECT_NAME_VALUE, actualProject.getProjectName());
+ assertNotNull(actualProject.getRelationshipList());
+ assertFalse(actualProject.getRelationshipList().getRelationship().isEmpty());
+ assertNotNull(actualProject.getRelationshipList().getRelationship().get(0));
+
+ }
+
+ private <T> ResponseEntity<T> invokeHttpGet(final String url, final Class<T> clazz) {
+ return restTemplate.exchange(url, HttpMethod.GET, new HttpEntity<>(getHttpHeaders(username)), clazz);
+ }
+
+ private ResponseEntity<Void> invokeHttpPut(final String url, final Object obj) {
+ final HttpEntity<?> httpEntity = getHttpEntity(obj);
+ return restTemplate.exchange(url, HttpMethod.PUT, httpEntity, Void.class);
+ }
+
+ private HttpEntity<?> getHttpEntity(final Object obj) {
+ return new HttpEntity<>(obj, getHttpHeaders(username));
+ }
+
+ private String getProjectEndPointUrl() {
+ return TestUtils.getBaseUrl(port) + Constants.PROJECT_URL;
+ }
+
+ private String getRelationship() throws IOException, Exception {
+ return TestUtils.getJsonString(PROJECT_RELATION_SHIP_JSON_FILE);
+ }
+}
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/TestUtils.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/TestUtils.java
new file mode 100644
index 00000000..c03f5ceb
--- /dev/null
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/TestUtils.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.aai.simulator.controller;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.util.Base64;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
+
+/**
+ * @author waqas.ikram@ericsson.com
+ *
+ */
+
+public class TestUtils {
+
+ private static final String PASSWORD = "aai.onap.org:demo123456!";
+
+ public static HttpHeaders getHttpHeaders(final String username) {
+ final HttpHeaders requestHeaders = new HttpHeaders();
+ requestHeaders.add("Authorization", getBasicAuth(username));
+ requestHeaders.setContentType(MediaType.APPLICATION_JSON);
+ return requestHeaders;
+ }
+
+ public static File getFile(final String file) throws IOException {
+ return new ClassPathResource(file).getFile();
+ }
+
+ public static String getJsonString(final String file) throws IOException {
+ return new String(Files.readAllBytes(getFile(file).toPath()));
+ }
+
+ public static <T> T getObjectFromFile(final File file, final Class<T> clazz) throws Exception {
+ final ObjectMapper mapper = new ObjectMapper();
+ mapper.registerModule(new JaxbAnnotationModule());
+
+ return mapper.readValue(file, clazz);
+ }
+
+ public static String getBasicAuth(final String username) {
+ return "Basic " + new String(Base64.getEncoder().encodeToString((username + ":" + PASSWORD).getBytes()));
+ }
+
+ public static String getBaseUrl(final int port) {
+ return "https://localhost:" + port;
+ }
+
+ private TestUtils() {}
+
+}
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/configuration/TestRestTemplateConfigration.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/configuration/TestRestTemplateConfigration.java
new file mode 100644
index 00000000..6e8ccac6
--- /dev/null
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aai/simulator/controller/configuration/TestRestTemplateConfigration.java
@@ -0,0 +1,71 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.aai.simulator.controller.configuration;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.SSLSession;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.conn.ssl.TrustStrategy;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.ssl.SSLContexts;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.test.web.client.TestRestTemplate;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+
+/**
+ * @author waqas.ikram@ericsson.com
+ *
+ */
+@Configuration
+public class TestRestTemplateConfigration {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(TestRestTemplateConfigration.class);
+
+ @Bean
+ public TestRestTemplate testRestTemplate() throws Exception {
+
+ final TestRestTemplate testRestTemplate = new TestRestTemplate();
+ ((HttpComponentsClientHttpRequestFactory) testRestTemplate.getRestTemplate().getRequestFactory())
+ .setHttpClient(httpClient());
+ return testRestTemplate;
+
+ }
+
+ private CloseableHttpClient httpClient() throws Exception {
+ final TrustStrategy acceptingTrustStrategy = (cert, authType) -> true;
+
+ final SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(
+ SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build(), new HostnameVerifier() {
+ @Override
+ public boolean verify(final String hostname, final SSLSession session) {
+ LOGGER.warn("Skiping hostname verification ... ");
+ return true;
+ }
+
+ });
+
+ return HttpClients.custom().setSSLSocketFactory(csf).build();
+ }
+
+}
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/resources/test-data/business-project-relation-ship.json b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/resources/test-data/business-project-relation-ship.json
new file mode 100644
index 00000000..9f6e5f35
--- /dev/null
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/resources/test-data/business-project-relation-ship.json
@@ -0,0 +1,3 @@
+{
+ "related-link": "/aai/v15/business/customers/customer/NordixDemoCustomer/service-subscriptions/service-subscription/vCPE/service-instances/service-instance/ae93f2d8-7d06-4eeb-8712-93a2bdb776f6"
+}
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/resources/test-data/business-project.json b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/resources/test-data/business-project.json
new file mode 100644
index 00000000..f78ddfaf
--- /dev/null
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/resources/test-data/business-project.json
@@ -0,0 +1,3 @@
+{
+ "project-name": "PROJECT_NAME_VALUE"
+}