aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java
diff options
context:
space:
mode:
authorBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>2019-03-04 14:57:03 +0100
committerBartosz Gardziejewski <bartosz.gardziejewski@nokia.com>2019-03-11 09:13:24 +0100
commitaddf93c4f22bc4a2c4edcabeea3f36e0065cbb6c (patch)
treea91586acf99c24130bde55cfd44ebe3673241113 /vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java
parent7c64fbbaff5985acb3a6aea977c5c15b4f2f59e1 (diff)
Increasing test coverage for vid.mso.rest
Change-Id: Ie672d561c5f1c674cce979e0f640027bb6fc0fa7 Issue-ID: VID-387 Signed-off-by: Bartosz Gardziejewski <bartosz.gardziejewski@nokia.com>
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java18
1 files changed, 12 insertions, 6 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java b/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java
index ff12bb8bc..e14ac0e11 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/RestMsoImplementation.java
@@ -51,7 +51,7 @@ import static org.onap.vid.utils.Logging.*;
/**
* Created by pickjonathan on 26/06/2017.
*/
-public abstract class RestMsoImplementation implements RestInterface {
+public class RestMsoImplementation implements RestInterface {
/**
* The logger.
@@ -62,7 +62,7 @@ public abstract class RestMsoImplementation implements RestInterface {
/** The client. */
private Client client = null;
- @Autowired
+
protected HttpsAuthClient httpsAuthClient;
private static final String START_LOG = " start";
@@ -79,6 +79,11 @@ public abstract class RestMsoImplementation implements RestInterface {
* Instantiates a new mso rest interface.
*/
+ @Autowired
+ protected RestMsoImplementation(HttpsAuthClient httpsAuthClient){
+ this.httpsAuthClient=httpsAuthClient;
+ }
+
@SuppressWarnings("Duplicates")
protected MultivaluedHashMap<String, Object> initMsoClient()
{
@@ -139,7 +144,7 @@ public abstract class RestMsoImplementation implements RestInterface {
MultivaluedHashMap<String, Object> commonHeaders = initMsoClient();
Logging.logRequest(outgoingRequestsLogger, HttpMethod.GET, url);
- final Response cres = client.target(url)
+ final Response cres = client.target(url)
.request()
.accept(APPLICATION_JSON)
.headers(commonHeaders)
@@ -219,7 +224,8 @@ public abstract class RestMsoImplementation implements RestInterface {
.accept(APPLICATION_JSON)
.headers(commonHeaders)
//.entity(r)
- .build("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON)).invoke();
+ .build("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON))
+ .invoke();
Logging.logResponse(outgoingRequestsLogger, HttpMethod.DELETE, url, cres);
int status = cres.getStatus();
restObject.setStatusCode (status);
@@ -245,6 +251,7 @@ public abstract class RestMsoImplementation implements RestInterface {
catch ( Exception e ) {
logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + NO_RESPONSE_ENTITY_LOG
+ e.getMessage());
+ throw e;
}
}
@@ -252,7 +259,6 @@ public abstract class RestMsoImplementation implements RestInterface {
{
logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + WITH_URL_LOG +url+ EXCEPTION_LOG + e.toString());
throw e;
-
}
}
@@ -349,7 +355,6 @@ public abstract class RestMsoImplementation implements RestInterface {
restObject.setStatusCode (status);
return restObject;
-
}
@Override
@@ -383,6 +388,7 @@ public abstract class RestMsoImplementation implements RestInterface {
catch ( Exception e ) {
logger.debug(EELFLoggerDelegate.debugLogger,"<== " + methodName + NO_RESPONSE_ENTITY_LOG
+ e.getMessage());
+ throw e;
}
int status = cres.getStatus();