summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJennie Jia <Jennie.Jia@amdocs.com>2018-09-19 19:22:56 +0000
committerJennie Jia <Jennie.Jia@amdocs.com>2018-09-19 20:08:46 +0000
commit976c37263f4087ae3c12e704a66fe78c81b142ed (patch)
tree10ef26608a473bbc2aa62ac2fcb43413d6b18a64 /src
parent39d422e9d7995f4ad04b93773da95158d111c4e4 (diff)
Fix the AAI Ctx Builder start up issue
Issue-ID: LOG-661 Change-Id: I3dd6739dba45bfdf75ada98640b907dfe56f8ff5 Signed-off-by: Jennie Jia <Jennie.Jia@amdocs.com>
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/common/LogMessages.java2
-rw-r--r--src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java17
2 files changed, 12 insertions, 7 deletions
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/common/LogMessages.java b/src/main/java/org/onap/pomba/contextbuilder/aai/common/LogMessages.java
index 762543c..d027d4a 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/aai/common/LogMessages.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/common/LogMessages.java
@@ -21,7 +21,7 @@ public class LogMessages {
private LogMessages() {}
- public static final String AAI_CONTEXT_BUILDER_URL = "AAI Context Builder URL: ";
+ public static final String AAI_CONTEXT_BUILDER_URL = "AAI Context Builder URL: {}";
public static final String HEADER_MESSAGE = "Header {} not present in request, generating new value: {}";
public static final String NOT_FOUND = "{} {} is not found from AAI";
public static final String NUMBER_OF_API_CALLS = "The number of API calls for {} is {}";
diff --git a/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java b/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java
index 19de411..c0ae25c 100644
--- a/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java
+++ b/src/main/java/org/onap/pomba/contextbuilder/aai/util/RestUtil.java
@@ -14,7 +14,7 @@
package org.onap.pomba.contextbuilder.aai.util;
-import com.sun.jersey.core.util.MultivaluedMapImpl;
+
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -26,7 +26,7 @@ import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.MultivaluedHashMap;
import javax.ws.rs.core.Response.Status;
import org.json.JSONArray;
import org.json.JSONException;
@@ -62,9 +62,6 @@ public class RestUtil {
private static Logger log = LoggerFactory.getLogger(RestUtil.class);
// Parameters for Query AAI Model Data API
private static final String SERVICE_INSTANCE_ID = "serviceInstanceId";
- private static final String MODEL_VERSION_ID = "modelVersionId";
- private static final String MODEL_INVARIANT_ID = "modelInvariantId";
-
// HTTP headers
private static final String TRANSACTION_ID = "X-TransactionId";
@@ -179,6 +176,14 @@ public class RestUtil {
// Obtain resource-link based on resource-type = service-Instance
String resourceLink = obtainResouceLinkBasedOnServiceInstanceFromAAI(aaiClient, baseURL, aaiPathToSearchNodeQuery, serviceInstanceId, transactionId, aaiBasicAuthorization);
+
+ // Handle the case if the service instance is not found in AAI
+ if (resourceLink==null) {
+ // return the empty Json on the root level. i.e service instance
+ return null;
+ }
+
+ // Build URl to get ServiceInstance Payload
String url = baseURL + resourceLink;
// Response from service instance API call
@@ -669,7 +674,7 @@ public class RestUtil {
}
private static Map<String, List<String>> buildHeaders(String aaiBasicAuthorization, String transactionId) {
- MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
+ MultivaluedHashMap<String, String> headers = new MultivaluedHashMap<String, String>();
headers.put(TRANSACTION_ID, Collections.singletonList(transactionId));
headers.put(FROM_APP_ID, Collections.singletonList(APP_NAME));
headers.put(AUTHORIZATION, Collections.singletonList(aaiBasicAuthorization));