aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWojciech Sliwka <wojciech.sliwka@nokia.com>2018-08-27 09:22:56 +0200
committerWojciech Sliwka <wojciech.sliwka@nokia.com>2018-08-27 10:11:37 +0200
commitdda8ed0393f3fc096a44e84b48c821d33ad99177 (patch)
treed9b2992c3fd7a09462616da73ff9920f8a8226be
parentba59d129d90f4a0b97f06d8da1594f29819c01fe (diff)
Change url to AAI
Change-Id: I7dbaee5df1233362cc6d60aeb80037446771e9e0 Issue-ID: VID-295 Signed-off-by: Wojciech Sliwka <wojciech.sliwka@nokia.com>
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/util/AAIRestInterface.java4
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/util/SystemPropertyHelper.java8
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/aai/util/SingleAAIRestInterfaceTest.java1
3 files changed, 11 insertions, 2 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/util/AAIRestInterface.java b/vid-app-common/src/main/java/org/onap/vid/aai/util/AAIRestInterface.java
index 6b17c932a..f5625ce21 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/util/AAIRestInterface.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/util/AAIRestInterface.java
@@ -309,7 +309,7 @@ public class AAIRestInterface {
*/
public Response RestPost(String fromAppId, String path, String payload, boolean xml) {
String methodName = "RestPost";
- String url=systemPropertyHelper.getFullServicePath(path);
+ String url=systemPropertyHelper.getServiceBasePath(path);
String transId = UUID.randomUUID().toString();
logger.debug(EELFLoggerDelegate.debugLogger, methodName + START_STRING);
@@ -317,7 +317,7 @@ public class AAIRestInterface {
try {
initRestClient();
Logging.logRequest(outgoingRequestsLogger, HttpMethod.POST, url, payload);
- response = authenticateRequest(client.target(systemPropertyHelper.getFullServicePath(path))
+ response = authenticateRequest(client.target(systemPropertyHelper.getServiceBasePath(path))
.request()
.accept(xml ? MediaType.APPLICATION_XML : MediaType.APPLICATION_JSON)
.header(TRANSACTION_ID_HEADER, transId)
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/util/SystemPropertyHelper.java b/vid-app-common/src/main/java/org/onap/vid/aai/util/SystemPropertyHelper.java
index ebf39c409..4d43d3ba2 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/util/SystemPropertyHelper.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/util/SystemPropertyHelper.java
@@ -38,6 +38,10 @@ public class SystemPropertyHelper {
return getSystemProperty(AAIProperties.AAI_SERVER_URL);
}
+ public Optional<String> getAAIServerBaseUrl(){
+ return getSystemProperty(AAIProperties.AAI_SERVER_URL_BASE);
+ }
+
public Optional<String> getAAIVIDUsername(){
return getSystemProperty(AAIProperties.AAI_VID_USERNAME);
}
@@ -70,6 +74,10 @@ public class SystemPropertyHelper {
return getAAIServerUrl().orElse("") + path;
}
+ public String getServiceBasePath(String path) {
+ return getAAIServerBaseUrl().orElse("") + path;
+ }
+
public String getEncodedCredentials() throws InvalidPropertyException, UnsupportedEncodingException {
String vidUsername = getAAIVIDUsername().orElseThrow(InvalidPropertyException::new);
String vidPassword = Password.deobfuscate(getAAIVIDPasswd().orElseThrow(InvalidPropertyException::new));
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/util/SingleAAIRestInterfaceTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/util/SingleAAIRestInterfaceTest.java
index 288b891c0..cd2b8ff28 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/util/SingleAAIRestInterfaceTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/util/SingleAAIRestInterfaceTest.java
@@ -302,6 +302,7 @@ public class SingleAAIRestInterfaceTest {
when(systemPropertyHelper.getAAIVIDUsername()).thenReturn(Optional.of("user"));
when(systemPropertyHelper.getEncodedCredentials()).thenReturn("someCredentials");
when(systemPropertyHelper.getFullServicePath(Mockito.anyString())).thenReturn("http://localhost/path");
+ when(systemPropertyHelper.getServiceBasePath(Mockito.anyString())).thenReturn("http://localhost/path");
}
} \ No newline at end of file