aboutsummaryrefslogtreecommitdiffstats
path: root/plans/so/integration-etsi-testing
diff options
context:
space:
mode:
authorDaniel Rose <dr695h@att.com>2019-10-15 16:50:35 +0000
committerGerrit Code Review <gerrit@onap.org>2019-10-15 16:50:35 +0000
commit4d49e7b724ec9ddfec53c11cfacfeca61a542a51 (patch)
treebd1a1d41fce23b47d7c4eca38dfa5a2c08f1a114 /plans/so/integration-etsi-testing
parent179d6fc0411bdf3d7a3dd64e65ba151797939d22 (diff)
parented699535fcc68dce55fb92c67ffb53515bfc587b (diff)
Merge "Making enhancements in aai simulator"
Diffstat (limited to 'plans/so/integration-etsi-testing')
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/Constants.java2
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/HttpServiceUtils.java25
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/AaiSimulatorControllerTest.java3
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/CloudRegionsControllerTest.java34
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/ExternalSystemEsrControllerTest.java4
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/GenericVnfsControllerTest.java15
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/LinesOfBusinessControllerTest.java10
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/NodesControllerTest.java10
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/OwningEntityControllerTest.java9
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/PlatformControllerTest.java8
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/ProjectControllerTest.java11
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/utils/TestConstants.java27
-rw-r--r--plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/resources/test-data/generic-vnf-relationship.json2
13 files changed, 99 insertions, 61 deletions
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/Constants.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/Constants.java
index 297f4525..4099c2a0 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/Constants.java
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/Constants.java
@@ -25,7 +25,7 @@ package org.onap.so.aaisimulator.utils;
*/
public class Constants {
- public static final String BASE_URL = "/aai/v15";
+ public static final String BASE_URL = "/aai/v{version:\\d+}";
public static final String NODES_URL = BASE_URL + "/nodes";
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/HttpServiceUtils.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/HttpServiceUtils.java
index 10c1f258..81781025 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/HttpServiceUtils.java
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/HttpServiceUtils.java
@@ -19,13 +19,14 @@
*/
package org.onap.so.aaisimulator.utils;
-import static org.onap.so.aaisimulator.utils.Constants.BASE_URL;
import static org.onap.so.aaisimulator.utils.Constants.BI_DIRECTIONAL_RELATIONSHIP_LIST_URL;
import static org.onap.so.aaisimulator.utils.Constants.RELATIONSHIP_LIST_RELATIONSHIP_URL;
import static org.springframework.http.MediaType.APPLICATION_XML;
import java.net.URI;
import java.util.Arrays;
import java.util.Enumeration;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
@@ -37,12 +38,30 @@ import org.springframework.web.util.UriComponentsBuilder;
*/
public class HttpServiceUtils {
+ private static final String START_WITH_FORWARD_SLASH = "(^/.*?)";
+ private static final String ALPHANUMERIC = "((?:v+[a-z0-9]*)/)";
+ private static final String REGEX = START_WITH_FORWARD_SLASH + ALPHANUMERIC;
+ private static final Pattern PATTERN = Pattern.compile(REGEX, Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
+
private HttpServiceUtils() {}
public static URI getBaseUrl(final HttpServletRequest request) {
final StringBuffer url = request.getRequestURL();
final String uri = request.getRequestURI();
- return UriComponentsBuilder.fromHttpUrl(url.substring(0, url.indexOf(uri))).path(BASE_URL).build().toUri();
+ return UriComponentsBuilder.fromHttpUrl(url.substring(0, url.indexOf(uri))).path(getBaseUrl(uri)).build()
+ .toUri();
+ }
+
+ private static String getBaseUrl(final String uri) {
+ final Matcher matcher = PATTERN.matcher(uri);
+ if (matcher.find()) {
+ final StringBuilder builder = new StringBuilder();
+ for (int index = 0; index < matcher.groupCount() - 1; index++) {
+ builder.append(matcher.group(index));
+ }
+ return builder.toString();
+ }
+ return uri;
}
public static URI getBaseUrl(final StringBuffer requestUrl, final String requestUri) {
@@ -58,7 +77,7 @@ public class HttpServiceUtils {
return getHeaders(request, APPLICATION_XML);
}
- public static HttpHeaders getHeaders(final HttpServletRequest request, MediaType mediaType) {
+ public static HttpHeaders getHeaders(final HttpServletRequest request, final MediaType mediaType) {
final HttpHeaders headers = new HttpHeaders();
for (final Enumeration<String> enumeration = request.getHeaderNames(); enumeration.hasMoreElements();) {
final String headerName = enumeration.nextElement();
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/AaiSimulatorControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/AaiSimulatorControllerTest.java
index 610aaa70..4fe5c403 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/AaiSimulatorControllerTest.java
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/AaiSimulatorControllerTest.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.aaisimulator.utils.Constants;
+import org.onap.so.aaisimulator.utils.TestConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
@@ -58,7 +59,7 @@ public class AaiSimulatorControllerTest {
}
private String getBaseUrl() {
- return "https://localhost:" + port + Constants.BASE_URL;
+ return "https://localhost:" + port + TestConstants.BASE_URL_V17;
}
}
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/CloudRegionsControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/CloudRegionsControllerTest.java
index f8e7bf74..1b967596 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/CloudRegionsControllerTest.java
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/CloudRegionsControllerTest.java
@@ -100,7 +100,7 @@ public class CloudRegionsControllerTest extends AbstractSpringBootTest {
@Test
public void test_putCloudRegion_successfullyAddedToCache() throws Exception {
- final String url = getUrl(Constants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);
+ final String url = getUrl(TestConstants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);
invokeCloudRegionHttpPutEndPointAndAssertResponse(url);
@@ -119,7 +119,7 @@ public class CloudRegionsControllerTest extends AbstractSpringBootTest {
@Test
public void test_getCloudRegionWithDepthValue_shouldReturnMatchedCloudRegion() throws Exception {
- final String url = getUrl(Constants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);
+ final String url = getUrl(TestConstants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);
invokeCloudRegionHttpPutEndPointAndAssertResponse(url);
@@ -140,11 +140,11 @@ public class CloudRegionsControllerTest extends AbstractSpringBootTest {
@Test
public void test_putGenericVnfRelationShipToPlatform_successfullyAddedToCache() throws Exception {
- final String url = getUrl(Constants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);
+ final String url = getUrl(TestConstants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);
invokeCloudRegionHttpPutEndPointAndAssertResponse(url);
- final String relationShipUrl = getUrl(Constants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME,
+ final String relationShipUrl = getUrl(TestConstants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME,
BI_DIRECTIONAL_RELATIONSHIP_LIST_URL);
final ResponseEntity<Relationship> responseEntity = testRestTemplateService.invokeHttpPut(relationShipUrl,
@@ -178,12 +178,12 @@ public class CloudRegionsControllerTest extends AbstractSpringBootTest {
@Test
public void test_putTenant_successfullyAddedToCache() throws Exception {
- final String cloudRegionUrl = getUrl(Constants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);
+ final String cloudRegionUrl = getUrl(TestConstants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);
invokeCloudRegionHttpPutEndPointAndAssertResponse(cloudRegionUrl);
- final String tenantUrl =
- getUrl(Constants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME + TENANTS_TENANT + TENANT_ID);
+ final String tenantUrl = getUrl(TestConstants.CLOUD_REGIONS, CLOUD_OWNER_NAME,
+ "/" + CLOUD_REGION_NAME + TENANTS_TENANT + TENANT_ID);
addTenantAndAssertResponse(tenantUrl);
final ResponseEntity<Tenant> response = testRestTemplateService.invokeHttpGet(tenantUrl, Tenant.class);
@@ -204,15 +204,15 @@ public class CloudRegionsControllerTest extends AbstractSpringBootTest {
addCustomerServiceAndGenericVnf();
- final String cloudRegionUrl = getUrl(Constants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);
+ final String cloudRegionUrl = getUrl(TestConstants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);
invokeCloudRegionHttpPutEndPointAndAssertResponse(cloudRegionUrl);
- final String tenantUrl =
- getUrl(Constants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME, TENANTS_TENANT + TENANT_ID);
+ final String tenantUrl = getUrl(TestConstants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME,
+ TENANTS_TENANT + TENANT_ID);
addTenantAndAssertResponse(tenantUrl);
- final String tenantRelationShipUrl = getUrl(Constants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME,
- TENANTS_TENANT + TENANT_ID, RELATIONSHIP_LIST_RELATIONSHIP_URL);
+ final String tenantRelationShipUrl = getUrl(TestConstants.CLOUD_REGIONS, CLOUD_OWNER_NAME,
+ "/" + CLOUD_REGION_NAME, TENANTS_TENANT + TENANT_ID, RELATIONSHIP_LIST_RELATIONSHIP_URL);
final ResponseEntity<Void> tenantRelationShipResponse = testRestTemplateService
.invokeHttpPut(tenantRelationShipUrl, TestUtils.getGenericVnfRelatedLink(), Void.class);
@@ -262,12 +262,12 @@ public class CloudRegionsControllerTest extends AbstractSpringBootTest {
@Test
public void test_putEsrSystemInfo_successfullyAddedToCache() throws Exception {
- final String url = getUrl(Constants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);
+ final String url = getUrl(TestConstants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);
invokeCloudRegionHttpPutEndPointAndAssertResponse(url);
- final String esrSystemInfoListUrl =
- getUrl(Constants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME, ESR_SYSTEM_INFO_LIST_URL);
+ final String esrSystemInfoListUrl = getUrl(TestConstants.CLOUD_REGIONS, CLOUD_OWNER_NAME,
+ "/" + CLOUD_REGION_NAME, ESR_SYSTEM_INFO_LIST_URL);
final String esrSystemInfoUrl = esrSystemInfoListUrl + "/esr-system-info/" + ESR_SYSTEM_INFO_ID;
final ResponseEntity<Void> esrSystemInfoResponse =
@@ -298,7 +298,7 @@ public class CloudRegionsControllerTest extends AbstractSpringBootTest {
@Test
public void test_putVServer_successfullyAddedToCache() throws Exception {
- final String url = getUrl(Constants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);
+ final String url = getUrl(TestConstants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);
invokeCloudRegionHttpPutEndPointAndAssertResponse(url);
addCustomerServiceAndGenericVnf();
@@ -359,7 +359,7 @@ public class CloudRegionsControllerTest extends AbstractSpringBootTest {
@Test
public void test_deleteVServer_successfullyRemoveFromCache() throws Exception {
- final String url = getUrl(Constants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);
+ final String url = getUrl(TestConstants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);
invokeCloudRegionHttpPutEndPointAndAssertResponse(url);
addCustomerServiceAndGenericVnf();
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/ExternalSystemEsrControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/ExternalSystemEsrControllerTest.java
index fe656dda..2fd5f7b8 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/ExternalSystemEsrControllerTest.java
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/ExternalSystemEsrControllerTest.java
@@ -23,7 +23,6 @@ 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.aaisimulator.utils.Constants.EXTERNAL_SYSTEM_ESR_VNFM_LIST_URL;
import static org.onap.so.aaisimulator.utils.Constants.RELATIONSHIP_LIST_RELATIONSHIP_URL;
import static org.onap.so.aaisimulator.utils.TestConstants.CUSTOMERS_URL;
import static org.onap.so.aaisimulator.utils.TestConstants.ESR_PASSWORD;
@@ -58,6 +57,7 @@ import org.onap.aai.domain.yang.RelationshipList;
import org.onap.so.aaisimulator.service.providers.ExternalSystemCacheServiceProvider;
import org.onap.so.aaisimulator.service.providers.GenericVnfCacheServiceProvider;
import org.onap.so.aaisimulator.utils.Constants;
+import org.onap.so.aaisimulator.utils.TestConstants;
import org.onap.so.aaisimulator.utils.TestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@@ -103,7 +103,7 @@ public class ExternalSystemEsrControllerTest extends AbstractSpringBootTest {
final String esrVnfmUrl = getUrl(ESR_VNFM_URL, ESR_VNFM_ID);
addEsrVnfmAndAssertResponse(esrVnfmUrl);
- final String esrVnfmListUrl = getUrl(EXTERNAL_SYSTEM_ESR_VNFM_LIST_URL);
+ final String esrVnfmListUrl = getUrl(TestConstants.EXTERNAL_SYSTEM_ESR_VNFM_LIST_URL);
final ResponseEntity<EsrVnfmList> response =
testRestTemplateService.invokeHttpGet(esrVnfmListUrl, EsrVnfmList.class);
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/GenericVnfsControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/GenericVnfsControllerTest.java
index dca7f669..8b6ec8c7 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/GenericVnfsControllerTest.java
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/GenericVnfsControllerTest.java
@@ -57,6 +57,7 @@ import org.onap.so.aaisimulator.service.providers.GenericVnfCacheServiceProvider
import org.onap.so.aaisimulator.service.providers.LinesOfBusinessCacheServiceProvider;
import org.onap.so.aaisimulator.service.providers.PlatformCacheServiceProvider;
import org.onap.so.aaisimulator.utils.Constants;
+import org.onap.so.aaisimulator.utils.TestConstants;
import org.onap.so.aaisimulator.utils.TestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
@@ -188,7 +189,7 @@ public class GenericVnfsControllerTest extends AbstractSpringBootTest {
public void test_putGenericVnfRelationToPlatform_successfullyAddedToCache() throws Exception {
addCustomerServiceAndGenericVnf();
- final String platformUrl = getUrl(Constants.PLATFORMS_URL, PLATFORM_NAME);
+ final String platformUrl = getUrl(TestConstants.PLATFORMS_URL, PLATFORM_NAME);
final ResponseEntity<Void> platformResponse =
testRestTemplateService.invokeHttpPut(platformUrl, TestUtils.getPlatform(), Void.class);
assertEquals(HttpStatus.ACCEPTED, platformResponse.getStatusCode());
@@ -211,7 +212,7 @@ public class GenericVnfsControllerTest extends AbstractSpringBootTest {
assertEquals(Constants.USES, relationship.getRelationshipLabel());
assertFalse(relationship.getRelationshipData().isEmpty());
assertEquals(1, relationship.getRelationshipData().size());
- assertEquals(Constants.PLATFORMS_URL + PLATFORM_NAME, relationship.getRelatedLink());
+ assertEquals(TestConstants.PLATFORMS_URL + PLATFORM_NAME, relationship.getRelatedLink());
final List<RelationshipData> relationshipData = relationship.getRelationshipData();
@@ -227,7 +228,7 @@ public class GenericVnfsControllerTest extends AbstractSpringBootTest {
public void test_putGenericVnfRelationToLineOfBusiness_successfullyAddedToCache() throws Exception {
addCustomerServiceAndGenericVnf();
- final String url = getUrl(Constants.LINES_OF_BUSINESS_URL, LINE_OF_BUSINESS_NAME);
+ final String url = getUrl(TestConstants.LINES_OF_BUSINESS_URL, LINE_OF_BUSINESS_NAME);
final ResponseEntity<Void> responseEntity =
testRestTemplateService.invokeHttpPut(url, TestUtils.getLineOfBusiness(), Void.class);
assertEquals(HttpStatus.ACCEPTED, responseEntity.getStatusCode());
@@ -248,7 +249,7 @@ public class GenericVnfsControllerTest extends AbstractSpringBootTest {
final Relationship relationship = relationshipList.getRelationship().get(0);
assertEquals(Constants.USES, relationship.getRelationshipLabel());
- assertEquals(Constants.LINES_OF_BUSINESS_URL + LINE_OF_BUSINESS_NAME, relationship.getRelatedLink());
+ assertEquals(TestConstants.LINES_OF_BUSINESS_URL + LINE_OF_BUSINESS_NAME, relationship.getRelatedLink());
assertFalse(relationship.getRelationshipData().isEmpty());
assertEquals(1, relationship.getRelationshipData().size());
@@ -266,7 +267,7 @@ public class GenericVnfsControllerTest extends AbstractSpringBootTest {
public void test_putGenericVnfRelationToCloudRegion_successfullyAddedToCache() throws Exception {
addCustomerServiceAndGenericVnf();
- final String url = getUrl(Constants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);
+ final String url = getUrl(TestConstants.CLOUD_REGIONS, CLOUD_OWNER_NAME, "/" + CLOUD_REGION_NAME);
final ResponseEntity<Void> responseEntity =
testRestTemplateService.invokeHttpPut(url, TestUtils.getCloudRegion(), Void.class);
@@ -288,7 +289,7 @@ public class GenericVnfsControllerTest extends AbstractSpringBootTest {
final Relationship relationship = relationshipList.getRelationship().get(0);
assertEquals(Constants.LOCATED_IN, relationship.getRelationshipLabel());
- assertEquals(Constants.CLOUD_REGIONS + CLOUD_OWNER_NAME + "/" + CLOUD_REGION_NAME,
+ assertEquals(TestConstants.CLOUD_REGIONS + CLOUD_OWNER_NAME + "/" + CLOUD_REGION_NAME,
relationship.getRelatedLink());
assertFalse(relationship.getRelationshipData().isEmpty());
@@ -373,7 +374,7 @@ public class GenericVnfsControllerTest extends AbstractSpringBootTest {
addCustomerServiceAndGenericVnf();
final String selfLink = "http://localhost:9921/generic-vnf/" + VNF_ID;
- final String url = getUrl(Constants.GENERIC_VNFS_URL) + "?selflink=" + selfLink;
+ final String url = getUrl(TestConstants.GENERIC_VNFS_URL_1) + "?selflink=" + selfLink;
final ResponseEntity<GenericVnfs> response = testRestTemplateService.invokeHttpGet(url, GenericVnfs.class);
assertEquals(HttpStatus.OK, response.getStatusCode());
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/LinesOfBusinessControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/LinesOfBusinessControllerTest.java
index 111993ce..30b3d279 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/LinesOfBusinessControllerTest.java
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/LinesOfBusinessControllerTest.java
@@ -62,7 +62,7 @@ public class LinesOfBusinessControllerTest extends AbstractSpringBootTest {
@Test
public void test_putLineOfBusiness_successfullyAddedToCache() throws Exception {
- final String url = getUrl(Constants.LINES_OF_BUSINESS_URL, LINE_OF_BUSINESS_NAME);
+ final String url = getUrl(TestConstants.LINES_OF_BUSINESS_URL, LINE_OF_BUSINESS_NAME);
final ResponseEntity<Void> lineOfBusinessResponse =
testRestTemplateService.invokeHttpPut(url, TestUtils.getLineOfBusiness(), Void.class);
assertEquals(HttpStatus.ACCEPTED, lineOfBusinessResponse.getStatusCode());
@@ -82,7 +82,7 @@ public class LinesOfBusinessControllerTest extends AbstractSpringBootTest {
@Test
public void test_getLineOfBusinessWithFormatCount() throws Exception {
- final String url = getUrl(Constants.LINES_OF_BUSINESS_URL, LINE_OF_BUSINESS_NAME);
+ final String url = getUrl(TestConstants.LINES_OF_BUSINESS_URL, LINE_OF_BUSINESS_NAME);
final ResponseEntity<Void> lineOfBusinessResponse =
testRestTemplateService.invokeHttpPut(url, TestUtils.getLineOfBusiness(), Void.class);
assertEquals(HttpStatus.ACCEPTED, lineOfBusinessResponse.getStatusCode());
@@ -103,13 +103,13 @@ public class LinesOfBusinessControllerTest extends AbstractSpringBootTest {
@Test
public void test_putGenericVnfRelationShipToPlatform_successfullyAddedToCache() throws Exception {
- final String url = getUrl(Constants.LINES_OF_BUSINESS_URL, LINE_OF_BUSINESS_NAME);
+ final String url = getUrl(TestConstants.LINES_OF_BUSINESS_URL, LINE_OF_BUSINESS_NAME);
final ResponseEntity<Void> response =
testRestTemplateService.invokeHttpPut(url, TestUtils.getLineOfBusiness(), Void.class);
assertEquals(HttpStatus.ACCEPTED, response.getStatusCode());
- final String relationShipUrl =
- getUrl(Constants.LINES_OF_BUSINESS_URL, LINE_OF_BUSINESS_NAME, BI_DIRECTIONAL_RELATIONSHIP_LIST_URL);
+ final String relationShipUrl = getUrl(TestConstants.LINES_OF_BUSINESS_URL, LINE_OF_BUSINESS_NAME,
+ BI_DIRECTIONAL_RELATIONSHIP_LIST_URL);
final ResponseEntity<Relationship> responseEntity = testRestTemplateService.invokeHttpPut(relationShipUrl,
TestUtils.getGenericVnfRelationShip(), Relationship.class);
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/NodesControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/NodesControllerTest.java
index 315f4fbb..378d77df 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/NodesControllerTest.java
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/NodesControllerTest.java
@@ -23,7 +23,6 @@ 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.aaisimulator.utils.Constants.NODES_URL;
import static org.onap.so.aaisimulator.utils.Constants.RESOURCE_LINK;
import static org.onap.so.aaisimulator.utils.Constants.RESOURCE_TYPE;
import static org.onap.so.aaisimulator.utils.Constants.SERVICE_RESOURCE_TYPE;
@@ -47,7 +46,7 @@ import org.onap.so.aaisimulator.models.Format;
import org.onap.so.aaisimulator.models.Results;
import org.onap.so.aaisimulator.service.providers.CustomerCacheServiceProvider;
import org.onap.so.aaisimulator.service.providers.NodesCacheServiceProvider;
-import org.onap.so.aaisimulator.utils.Constants;
+import org.onap.so.aaisimulator.utils.TestConstants;
import org.onap.so.aaisimulator.utils.TestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@@ -78,7 +77,7 @@ public class NodesControllerTest extends AbstractSpringBootTest {
invokeCustomerandServiceInstanceUrls();
final ResponseEntity<ServiceInstance> actual = testRestTemplateService
- .invokeHttpGet(getUrl(Constants.NODES_URL, SERVICE_INSTANCE_URL), ServiceInstance.class);
+ .invokeHttpGet(getUrl(TestConstants.NODES_URL, SERVICE_INSTANCE_URL), ServiceInstance.class);
assertEquals(HttpStatus.OK, actual.getStatusCode());
assertTrue(actual.hasBody());
@@ -97,7 +96,7 @@ public class NodesControllerTest extends AbstractSpringBootTest {
invokeCustomerandServiceInstanceUrls();
final ResponseEntity<Results> actual = testRestTemplateService.invokeHttpGet(
- getUrl(Constants.NODES_URL, SERVICE_INSTANCE_URL) + "?format=" + Format.PATHED.getValue(),
+ getUrl(TestConstants.NODES_URL, SERVICE_INSTANCE_URL) + "?format=" + Format.PATHED.getValue(),
Results.class);
assertEquals(HttpStatus.OK, actual.getStatusCode());
@@ -123,7 +122,8 @@ public class NodesControllerTest extends AbstractSpringBootTest {
testRestTemplateService.invokeHttpPut(genericVnfUrl, TestUtils.getGenericVnf(), Void.class);
assertEquals(HttpStatus.ACCEPTED, genericVnfResponse.getStatusCode());
- final String nodeGenericVnfsUrl = getUrl(NODES_URL, GENERIC_VNFS_URL) + "?vnf-name=" + GENERIC_VNF_NAME;
+ final String nodeGenericVnfsUrl =
+ getUrl(TestConstants.NODES_URL, GENERIC_VNFS_URL) + "?vnf-name=" + GENERIC_VNF_NAME;
final ResponseEntity<GenericVnfs> actual =
testRestTemplateService.invokeHttpGet(nodeGenericVnfsUrl, GenericVnfs.class);
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/OwningEntityControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/OwningEntityControllerTest.java
index f4fcadeb..015994a5 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/OwningEntityControllerTest.java
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/OwningEntityControllerTest.java
@@ -44,6 +44,7 @@ import org.onap.so.aaisimulator.models.Results;
import org.onap.so.aaisimulator.service.providers.CustomerCacheServiceProvider;
import org.onap.so.aaisimulator.service.providers.OwnEntityCacheServiceProvider;
import org.onap.so.aaisimulator.utils.Constants;
+import org.onap.so.aaisimulator.utils.TestConstants;
import org.onap.so.aaisimulator.utils.TestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@@ -72,7 +73,7 @@ public class OwningEntityControllerTest extends AbstractSpringBootTest {
@Test
public void test_putOwningEntity_successfullyAddedToCache() throws Exception {
- final String url = getUrl(Constants.OWNING_ENTITY_URL, OWN_ENTITY_ID_VALUE);
+ final String url = getUrl(TestConstants.OWNING_ENTITY_URL, OWN_ENTITY_ID_VALUE);
final ResponseEntity<Void> actual =
testRestTemplateService.invokeHttpPut(url, TestUtils.getOwningEntity(), Void.class);
@@ -92,7 +93,7 @@ public class OwningEntityControllerTest extends AbstractSpringBootTest {
@Test
public void test_getOwningEntityCount_correctResult() throws Exception {
- final String url = getUrl(Constants.OWNING_ENTITY_URL, OWN_ENTITY_ID_VALUE);
+ final String url = getUrl(TestConstants.OWNING_ENTITY_URL, OWN_ENTITY_ID_VALUE);
final ResponseEntity<Void> actual =
testRestTemplateService.invokeHttpPut(url, TestUtils.getOwningEntity(), Void.class);
@@ -113,7 +114,7 @@ public class OwningEntityControllerTest extends AbstractSpringBootTest {
public void test_putOwningEntityRelationShip_successfullyAddedToCache() throws Exception {
addCustomerAndServiceInstance();
- final String url = getUrl(Constants.OWNING_ENTITY_URL, OWN_ENTITY_ID_VALUE);
+ final String url = getUrl(TestConstants.OWNING_ENTITY_URL, OWN_ENTITY_ID_VALUE);
final ResponseEntity<Void> actual =
testRestTemplateService.invokeHttpPut(url, TestUtils.getOwningEntity(), Void.class);
assertEquals(HttpStatus.ACCEPTED, actual.getStatusCode());
@@ -170,7 +171,7 @@ public class OwningEntityControllerTest extends AbstractSpringBootTest {
assertEquals(1, serviceRelationshipList.size());
final Relationship relationship = serviceRelationshipList.get(0);
assertEquals(Constants.BELONGS_TO, relationship.getRelationshipLabel());
- assertEquals(Constants.OWNING_ENTITY_URL + OWN_ENTITY_ID_VALUE, relationship.getRelatedLink());
+ assertEquals(TestConstants.OWNING_ENTITY_URL + OWN_ENTITY_ID_VALUE, relationship.getRelatedLink());
final List<RelationshipData> serviceRelationshipDataList = serviceRelationshipList.get(0).getRelationshipData();
assertFalse(serviceRelationshipDataList.isEmpty());
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/PlatformControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/PlatformControllerTest.java
index 331d9726..7e88eec5 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/PlatformControllerTest.java
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/PlatformControllerTest.java
@@ -62,7 +62,7 @@ public class PlatformControllerTest extends AbstractSpringBootTest {
@Test
public void test_putPlatform_successfullyAddedToCache() throws Exception {
- final String platformUrl = getUrl(Constants.PLATFORMS_URL, PLATFORM_NAME);
+ final String platformUrl = getUrl(TestConstants.PLATFORMS_URL, PLATFORM_NAME);
final ResponseEntity<Void> platformResponse =
testRestTemplateService.invokeHttpPut(platformUrl, TestUtils.getPlatform(), Void.class);
assertEquals(HttpStatus.ACCEPTED, platformResponse.getStatusCode());
@@ -81,7 +81,7 @@ public class PlatformControllerTest extends AbstractSpringBootTest {
@Test
public void test_getPlatformWithFormatCount() throws Exception {
- final String platformUrl = getUrl(Constants.PLATFORMS_URL, PLATFORM_NAME);
+ final String platformUrl = getUrl(TestConstants.PLATFORMS_URL, PLATFORM_NAME);
final ResponseEntity<Void> platformResponse =
testRestTemplateService.invokeHttpPut(platformUrl, TestUtils.getPlatform(), Void.class);
@@ -103,13 +103,13 @@ public class PlatformControllerTest extends AbstractSpringBootTest {
@Test
public void test_putGenericVnfRelationShipToPlatform_successfullyAddedToCache() throws Exception {
- final String platformUrl = getUrl(Constants.PLATFORMS_URL, PLATFORM_NAME);
+ final String platformUrl = getUrl(TestConstants.PLATFORMS_URL, PLATFORM_NAME);
final ResponseEntity<Void> platformResponse =
testRestTemplateService.invokeHttpPut(platformUrl, TestUtils.getPlatform(), Void.class);
assertEquals(HttpStatus.ACCEPTED, platformResponse.getStatusCode());
final String platformRelationShipUrl =
- getUrl(Constants.PLATFORMS_URL, PLATFORM_NAME, BI_DIRECTIONAL_RELATIONSHIP_LIST_URL);
+ getUrl(TestConstants.PLATFORMS_URL, PLATFORM_NAME, BI_DIRECTIONAL_RELATIONSHIP_LIST_URL);
final ResponseEntity<Relationship> responseEntity = testRestTemplateService
.invokeHttpPut(platformRelationShipUrl, TestUtils.getGenericVnfRelationShip(), Relationship.class);
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/ProjectControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/ProjectControllerTest.java
index ecda94e3..678d417b 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/ProjectControllerTest.java
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/ProjectControllerTest.java
@@ -43,6 +43,7 @@ import org.onap.so.aaisimulator.models.Results;
import org.onap.so.aaisimulator.service.providers.CustomerCacheServiceProvider;
import org.onap.so.aaisimulator.service.providers.ProjectCacheServiceProvider;
import org.onap.so.aaisimulator.utils.Constants;
+import org.onap.so.aaisimulator.utils.TestConstants;
import org.onap.so.aaisimulator.utils.TestRestTemplateService;
import org.onap.so.aaisimulator.utils.TestUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -78,7 +79,7 @@ public class ProjectControllerTest extends AbstractSpringBootTest {
@Test
public void test_putProject_successfullyAddedToCache() throws Exception {
- final String url = getUrl(Constants.PROJECT_URL, PROJECT_NAME_VALUE);
+ final String url = getUrl(TestConstants.PROJECT_URL, PROJECT_NAME_VALUE);
final ResponseEntity<Void> actual =
testRestTemplateService.invokeHttpPut(url, TestUtils.getBusinessProject(), Void.class);
@@ -98,13 +99,13 @@ public class ProjectControllerTest extends AbstractSpringBootTest {
public void test_putProjectRelationShip_successfullyAddedToCache() throws Exception {
addCustomerAndServiceInstance();
- final String url = getUrl(Constants.PROJECT_URL, PROJECT_NAME_VALUE);
+ final String url = getUrl(TestConstants.PROJECT_URL, PROJECT_NAME_VALUE);
final ResponseEntity<Void> actual =
testRestTemplateService.invokeHttpPut(url, TestUtils.getBusinessProject(), Void.class);
assertEquals(HttpStatus.ACCEPTED, actual.getStatusCode());
final String projectRelationshipUrl =
- getUrl(Constants.PROJECT_URL, PROJECT_NAME_VALUE, RELATIONSHIP_LIST_RELATIONSHIP_URL);
+ getUrl(TestConstants.PROJECT_URL, PROJECT_NAME_VALUE, RELATIONSHIP_LIST_RELATIONSHIP_URL);
final ResponseEntity<Void> putResponse = testRestTemplateService.invokeHttpPut(projectRelationshipUrl,
TestUtils.getBusinessProjectRelationship(), Void.class);
@@ -155,7 +156,7 @@ public class ProjectControllerTest extends AbstractSpringBootTest {
assertEquals(1, serviceRelationshipList.size());
final Relationship relationship = serviceRelationshipList.get(0);
assertEquals(Constants.USES, relationship.getRelationshipLabel());
- assertEquals(Constants.PROJECT_URL + PROJECT_NAME_VALUE, relationship.getRelatedLink());
+ assertEquals(TestConstants.PROJECT_URL + PROJECT_NAME_VALUE, relationship.getRelatedLink());
final List<RelationshipData> serviceRelationshipDataList = serviceRelationshipList.get(0).getRelationshipData();
@@ -171,7 +172,7 @@ public class ProjectControllerTest extends AbstractSpringBootTest {
@Test
public void test_getProjectCount_correctResult() throws Exception {
- final String url = getUrl(Constants.PROJECT_URL, PROJECT_NAME_VALUE);
+ final String url = getUrl(TestConstants.PROJECT_URL, PROJECT_NAME_VALUE);
final ResponseEntity<Void> actual =
testRestTemplateService.invokeHttpPut(url, TestUtils.getBusinessProject(), Void.class);
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/utils/TestConstants.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/utils/TestConstants.java
index 79bf624a..b5758690 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/utils/TestConstants.java
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/utils/TestConstants.java
@@ -19,15 +19,14 @@
*/
package org.onap.so.aaisimulator.utils;
-import static org.onap.so.aaisimulator.utils.Constants.EXTERNAL_SYSTEM_ESR_VNFM_LIST_URL;
-import org.onap.so.aaisimulator.utils.Constants;
-
/**
* @author waqas.ikram@ericsson.com
*
*/
public class TestConstants {
+ public static final String BASE_URL_V17 = "/aai/v17";
+
public static final String SERVICE_INSTANCES_URL = "/service-instances";
public static final String SERVICE_NAME = "ServiceTest";
@@ -44,13 +43,13 @@ public class TestConstants {
public static final String GLOBAL_CUSTOMER_ID = "DemoCustomer";
- public static final String CUSTOMERS_URL = Constants.CUSTOMER_URL + GLOBAL_CUSTOMER_ID;
+ public static final String CUSTOMERS_URL = BASE_URL_V17 + "/business/customers/customer/" + GLOBAL_CUSTOMER_ID;
public static final String VNF_ID = "dfd02fb5-d7fb-4aac-b3c4-cd6b60058701";
public static final String GENERIC_VNF_NAME = "EsyVnfInstantiationTest2";
- public static final String GENERIC_VNF_URL = Constants.GENERIC_VNFS_URL + "/generic-vnf/";
+ public static final String GENERIC_VNF_URL = BASE_URL_V17 + "/network/generic-vnfs/generic-vnf/";
public static final String GENERIC_VNFS_URL = "/generic-vnfs";
@@ -68,7 +67,9 @@ public class TestConstants {
public static final String TENANTS_TENANT = "/tenants/tenant/";
- public static final String ESR_VNFM_URL = EXTERNAL_SYSTEM_ESR_VNFM_LIST_URL + "/esr-vnfm/";
+ public static final String ESR_VNFM_URL = BASE_URL_V17 + "/external-system/esr-vnfm-list/esr-vnfm/";
+
+ public static final String EXTERNAL_SYSTEM_ESR_VNFM_LIST_URL = BASE_URL_V17 + "/external-system/esr-vnfm-list";
public static final String ESR_VNFM_ID = "c5e99cee-1996-4606-b697-838d51d4e1a3";
@@ -98,6 +99,20 @@ public class TestConstants {
public static final String VSERVER_ID = "f84fdb9b-ad7c-49db-a08f-e443b4cbd033";
+ public static final String OWNING_ENTITY_URL = BASE_URL_V17 + "/business/owning-entities/owning-entity/";
+
+ public static final String LINES_OF_BUSINESS_URL = BASE_URL_V17 + "/business/lines-of-business/line-of-business/";
+
+ public static final String PLATFORMS_URL = BASE_URL_V17 + "/business/platforms/platform/";
+
+ public static final String CLOUD_REGIONS = BASE_URL_V17 + "/cloud-infrastructure/cloud-regions/cloud-region/";
+
+ public static final String GENERIC_VNFS_URL_1 = BASE_URL_V17 + "/network/generic-vnfs";
+
+ public static final String NODES_URL = BASE_URL_V17 + "/nodes";
+
+ public static final String PROJECT_URL = BASE_URL_V17 + "/business/projects/project/";
+
private TestConstants() {}
}
diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/resources/test-data/generic-vnf-relationship.json b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/resources/test-data/generic-vnf-relationship.json
index a53ffa9c..25f317a5 100644
--- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/resources/test-data/generic-vnf-relationship.json
+++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/resources/test-data/generic-vnf-relationship.json
@@ -1,7 +1,7 @@
{
"related-to": "generic-vnf",
"relationship-label": "org.onap.relationships.inventory.Uses",
- "related-link": "/aai/v15/network/generic-vnfs/generic-vnf/dfd02fb5-d7fb-4aac-b3c4-cd6b60058701",
+ "related-link": "/aai/v17/network/generic-vnfs/generic-vnf/dfd02fb5-d7fb-4aac-b3c4-cd6b60058701",
"relationship-data": [{
"relationship-key": "generic-vnf.vnf-id",
"relationship-value": "dfd02fb5-d7fb-4aac-b3c4-cd6b60058701"