summaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/java/org
diff options
context:
space:
mode:
authorAmir Skalka <amir.skalka@intl.att.com>2019-11-05 11:19:37 +0200
committerAmir Skalka <amir.skalka@intl.att.com>2019-11-07 15:46:39 +0200
commita868f407c6b80ea0c533fc534d45b9e04e69521a (patch)
treecc79bece67c0a8bf029f59cee8269ab80d77d1f6 /vid-automation/src/main/java/org
parentb84d6332c492206cecf11d54a884c8a299ef1690 (diff)
Validations in different tests for audit log
ChangeManagementApi/UserApi to verify incoming requests in audit log. Refactor assert message and contains method for validation Add audit logging validation to Health Check test Refactor audit log validation according to code review comments Fix the test of Add audit logging validation to Health Check test Issue-ID: VID-253 Signed-off-by: Amir Skalka <amir.skalka@intl.att.com> Change-Id: I0379520054b65f2141745579a14690bdc4824655
Diffstat (limited to 'vid-automation/src/main/java/org')
-rw-r--r--vid-automation/src/main/java/org/onap/vid/api/BaseApiTest.java24
1 files changed, 14 insertions, 10 deletions
diff --git a/vid-automation/src/main/java/org/onap/vid/api/BaseApiTest.java b/vid-automation/src/main/java/org/onap/vid/api/BaseApiTest.java
index 3778e4b16..8492b9baa 100644
--- a/vid-automation/src/main/java/org/onap/vid/api/BaseApiTest.java
+++ b/vid-automation/src/main/java/org/onap/vid/api/BaseApiTest.java
@@ -77,9 +77,20 @@ public class BaseApiTest {
}
public void login(UserCredentials userCredentials) {
+ final List<ClientHttpRequestInterceptor> interceptors = loginWithChosenRESTClient(userCredentials, restTemplate);
+ restTemplateErrorAgnostic.setInterceptors(interceptors);
+ restTemplateErrorAgnostic.setErrorHandler(new DefaultResponseErrorHandler() {
+ @Override
+ public boolean hasError(ClientHttpResponse response) {
+ return false;
+ }
+ });
+ }
+
+ public List<ClientHttpRequestInterceptor> loginWithChosenRESTClient(UserCredentials userCredentials,RestTemplate givenRestTemplate) {
final List<ClientHttpRequestInterceptor> interceptors = singletonList(new CookieAndJsonHttpHeadersInterceptor(getUri(), userCredentials));
- restTemplate.setInterceptors(interceptors);
- restTemplate.setErrorHandler(new DefaultResponseErrorHandler() {
+ givenRestTemplate.setInterceptors(interceptors);
+ givenRestTemplate.setErrorHandler(new DefaultResponseErrorHandler() {
@Override
public void handleError(ClientHttpResponse response) throws IOException {
try {
@@ -90,14 +101,7 @@ public class BaseApiTest {
}
}
});
-
- restTemplateErrorAgnostic.setInterceptors(interceptors);
- restTemplateErrorAgnostic.setErrorHandler(new DefaultResponseErrorHandler() {
- @Override
- public boolean hasError(ClientHttpResponse response) {
- return false;
- }
- });
+ return interceptors;
}