aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation/src/test/java/org/onap/vid/more/RequestIdFilterInstalled.java
diff options
context:
space:
mode:
Diffstat (limited to 'vid-automation/src/test/java/org/onap/vid/more/RequestIdFilterInstalled.java')
-rw-r--r--vid-automation/src/test/java/org/onap/vid/more/RequestIdFilterInstalled.java44
1 files changed, 25 insertions, 19 deletions
diff --git a/vid-automation/src/test/java/org/onap/vid/more/RequestIdFilterInstalled.java b/vid-automation/src/test/java/org/onap/vid/more/RequestIdFilterInstalled.java
index 560538737..0a0045d4d 100644
--- a/vid-automation/src/test/java/org/onap/vid/more/RequestIdFilterInstalled.java
+++ b/vid-automation/src/test/java/org/onap/vid/more/RequestIdFilterInstalled.java
@@ -4,23 +4,22 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
+import org.junit.Assert;
+import org.onap.simulator.presetGenerator.presets.aaf.AAFGetBasicAuthPreset;
+import org.onap.simulator.presetGenerator.presets.aaf.AAFGetUrlServicePreset;
import org.onap.vid.api.BaseApiTest;
import org.onap.vid.api.OperationalEnvironmentControllerApiTest;
import org.onap.vid.api.ServiceInstanceMsoApiTest;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
+import org.springframework.http.*;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import vid.automation.test.services.SimulatorApi;
+import java.util.List;
import java.util.UUID;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.containsInAnyOrder;
-import static org.hamcrest.Matchers.nullValue;
import static org.onap.vid.api.CategoryParametersApiTest.GET_CATEGORY_PARAMETER_PROPERTIES;
import static org.onap.vid.api.pProbeMsoApiTest.MSO_CREATE_CONFIGURATION;
import static org.springframework.http.HttpHeaders.AUTHORIZATION;
@@ -49,7 +48,7 @@ public class RequestIdFilterInstalled extends BaseApiTest {
}
@Test
- public void frontendApi_doGET_RequestIdReceived() {
+ public void frontendApi_doGET_RequestIdReceived() throws InterruptedException {
final Pair<HttpEntity, String> responseAndUuid = makeRequest(
HttpMethod.GET,
@@ -62,7 +61,7 @@ public class RequestIdFilterInstalled extends BaseApiTest {
}
@Test
- public void frontendApi_doPOST_RequestIdReceived() {
+ public void frontendApi_doPOST_RequestIdReceived() throws InterruptedException {
final Pair<HttpEntity, String> responseAndUuid = makeRequest(
HttpMethod.POST,
@@ -87,14 +86,13 @@ public class RequestIdFilterInstalled extends BaseApiTest {
@Test(groups = { "worksOnlyWithLocalhostVID" })
- public void mopOwningEntityApi_doGET_RequestIdReceived() {
+ public void mopOwningEntityApi_doGET_RequestIdReceived() throws InterruptedException {
final Pair<HttpEntity, String> responseAndUuid = makeRequest(
HttpMethod.GET,
"/" + GET_CATEGORY_PARAMETER_PROPERTIES + "?familyName=PARAMETER_STANDARDIZATION",
null
);
-
assertThatUuidInResponseAndUuidIsInARecentLog(responseAndUuid);
/*
@@ -110,12 +108,18 @@ public class RequestIdFilterInstalled extends BaseApiTest {
}
@Test
- public void schedulerApi_doPOST_RequestIdReceived() {
+ public void schedulerApi_doPOST_RequestIdReceived() throws InterruptedException {
final String anyInstanceId = "any instance id";
SimulatorApi.registerExpectation(
"mso_in_place_software_update_ok.json",
ImmutableMap.of("SERVICE_INSTANCE_ID", anyInstanceId, "VNF_INSTANCE_ID", anyInstanceId), SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET);
+ SimulatorApi.registerExpectationFromPreset(
+ new AAFGetUrlServicePreset(),
+ SimulatorApi.RegistrationStrategy.APPEND);
+ SimulatorApi.registerExpectationFromPreset(
+ new AAFGetBasicAuthPreset(),
+ SimulatorApi.RegistrationStrategy.APPEND);
final Pair<HttpEntity, String> responseAndUuid = makeRequest(
HttpMethod.POST,
"/change-management/workflow/" + anyInstanceId,
@@ -126,7 +130,7 @@ public class RequestIdFilterInstalled extends BaseApiTest {
}
@Test
- public void healthcheck_doGET_RequestIdReceived(){
+ public void healthcheck_doGET_RequestIdReceived() {
final Pair<HttpEntity, String> responseAndUuid = makeRequest(
HttpMethod.GET, "/healthCheck", null
);
@@ -142,14 +146,16 @@ public class RequestIdFilterInstalled extends BaseApiTest {
// THIS TEST IS NOT JUST NICE TO HAVE, it also lets us know
// that the request/response ran through our "promise request
// id" filter, which is great!
- assertThat(response, not(nullValue()));
- assertThat(response.getHeaders().get(ECOMP_REQUEST_ID_ECHO), containsInAnyOrder(uuid));
+ Assert.assertNotNull(response);
+ List<String> ecompRequestIdHeaderValues = response.getHeaders().get(ECOMP_REQUEST_ID_ECHO);
+ Assert.assertNotNull(ecompRequestIdHeaderValues);
+ Assert.assertTrue(ecompRequestIdHeaderValues.contains(uuid));
}
private void assertThatTermIsInARecentLog(String uuid) {
final ImmutableList<String> logLines = ImmutableList.of(
- LoggerFormatTest.getLogLines("audit", 5, 0, restTemplate, uri),
- LoggerFormatTest.getLogLines("error", 5, 0, restTemplate, uri)
+ LoggerFormatTest.getLogLines("audit", 20, 0, restTemplate, uri),
+ LoggerFormatTest.getLogLines("error", 20, 0, restTemplate, uri)
);
// Assert that audit *OR* error has the uuid
@@ -164,13 +170,13 @@ public class RequestIdFilterInstalled extends BaseApiTest {
final String uuid = UUID.randomUUID().toString();
final HttpHeaders headers = new HttpHeaders();
headers.add(ECOMP_REQUEST_ID, uuid);
- headers.add(AUTHORIZATION, "Basic 123==");
+ headers.add(AUTHORIZATION, "Basic " + AAFGetBasicAuthPreset.VALID_AUTH_VALUE);
+ headers.setContentType(MediaType.APPLICATION_JSON);
- SimulatorApi.clearExpectations();
if (!StringUtils.isEmpty(expectationFilename)) {
SimulatorApi.registerExpectation(expectationFilename, APPEND);
}
- SimulatorApi.registerExpectation("aai_get_full_subscribers.json", APPEND);
+ SimulatorApi.registerExpectation("create_new_instance/aai_get_full_subscribers.json", APPEND);
SimulatorApi.registerExpectation("ecompportal_getSessionSlotCheckInterval.json", APPEND);
HttpEntity entity = new HttpEntity<>(body, headers);