aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/java
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2019-11-07 14:17:41 +0000
committerGerrit Code Review <gerrit@onap.org>2019-11-07 14:17:41 +0000
commitebef5249cb9d282ace976feac8517a7b44add450 (patch)
tree42eec74e3d514f093861abfe94be176acf1fdae6 /vid-automation/src/main/java
parent31e625a118836d02a95b18ff806903ed23deb25d (diff)
parenta868f407c6b80ea0c533fc534d45b9e04e69521a (diff)
Merge "Validations in different tests for audit log"
Diffstat (limited to 'vid-automation/src/main/java')
-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 060976ae4..bfd4782f9 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;
}