From 83559ddc77a0217391212f2abcdcba2c3ff56937 Mon Sep 17 00:00:00 2001 From: "Agarwal, Ruchira (ra1926)" Date: Tue, 5 Nov 2019 18:16:50 +0000 Subject: minor updates to clean up code clean up code to sync with internal Issue-ID: CCSDK-1873 Signed-off-by: Agarwal, Ruchira (ra1926) Change-Id: Idcc7186d5aaa783c527de3986e7a1ecd9bfcf651 --- aai-service/provider/pom.xml | 8 ++------ .../org/onap/ccsdk/sli/adaptors/aai/AAIClient.java | 5 ++++- .../ccsdk/sli/adaptors/aai/AAIDeclarations.java | 1 + .../ccsdk/sli/adaptors/aai/GenericRequest.java | 10 +++++++--- .../ccsdk/sli/adaptors/aai/EchoRequestTest.java | 22 ++++++++++++++++++++++ 5 files changed, 36 insertions(+), 10 deletions(-) (limited to 'aai-service/provider') diff --git a/aai-service/provider/pom.xml b/aai-service/provider/pom.xml index 9650087e5..f63bc424e 100755 --- a/aai-service/provider/pom.xml +++ b/aai-service/provider/pom.xml @@ -96,10 +96,6 @@ org.springframework spring-core test - - - org.apache.httpcomponents - httpcore org.apache.httpcomponents @@ -112,7 +108,7 @@ org.jvnet.jaxb2.maven2 maven-jaxb2-plugin - 0.13.1 + 0.14.0 gen-xjc @@ -139,7 +135,7 @@ org.jvnet.jaxb2_commons jaxb2-basics-annotate - 0.6.4 + 0.6.5 diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java index 4b4c439a9..28b4955a4 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIClient.java @@ -37,6 +37,9 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin; import org.onap.ccsdk.sli.core.sli.SvcLogicResource; import org.onap.ccsdk.sli.adaptors.aai.data.notify.NotifyEvent; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; + public interface AAIClient extends SvcLogicResource, SvcLogicJavaPlugin { public SearchResults requestServiceInstanceURL(String svcInstanceId) throws AAIServiceException; @@ -76,7 +79,7 @@ public interface AAIClient extends SvcLogicResource, SvcLogicJavaPlugin { public void logKeyError(String keys); - public QueryStatus processResponseData(String rv, String resource, AAIRequest request, String prefix, SvcLogicContext ctx, Map nameValues, String modifier) throws IOException, AAIServiceException ; + public QueryStatus processResponseData(String rv, String resource, AAIRequest request, String prefix, SvcLogicContext ctx, Map nameValues, String modifier) throws JsonParseException, JsonMappingException, IOException, AAIServiceException ; public String getPathTemplateForResource(String resoourceName, String join, SvcLogicContext ctx) throws MalformedURLException; public boolean isDeprecatedFormat(String resource, Map nameValues); diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java index c57b3a45d..8b8aaaab6 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java @@ -1636,6 +1636,7 @@ public abstract class AAIDeclarations implements AAIClient { try { obj = getMetadataMethod.invoke(instance); } catch (InvocationTargetException x) { + Throwable cause = x.getCause(); } } if(obj != null && obj instanceof Metadata){ diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequest.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequest.java index 7c6234e5c..7f15c03f5 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequest.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/GenericRequest.java @@ -189,9 +189,13 @@ public class GenericRequest extends AAIRequest { queryParams.put(splitKey[1], encodeQuery(value)); } else { - String token = String.format("%s/{%s}", splitKey[0], splitKey[1]); - String encoded_vnf = encodeQuery(value); - request_url = request_url.replace(token, String.format("%s/%s", splitKey[0], encoded_vnf)); + String encoded_vnf = encodeQuery(value); + if(!resourceName.equals(splitKey[0]) && resourceName.contains(splitKey[0])) { + queryParams.put(splitKey[1], encoded_vnf); + } else { + String token = String.format("%s/{%s}", splitKey[0], splitKey[1]); + request_url = request_url.replace(token, String.format("%s/%s", splitKey[0], encoded_vnf)); + } } } diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestTest.java index 69541301b..3e0a72f3a 100755 --- a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestTest.java +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/EchoRequestTest.java @@ -34,6 +34,8 @@ import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -111,4 +113,24 @@ public class EchoRequestTest { } } + +// @Test + public void EchoTest() { + LOG.info("----------------------- Test: " + new Object(){}.getClass().getEnclosingMethod().getName() + " -----------------------"); + try + { + SvcLogicContext ctx = new SvcLogicContext(); + + QueryStatus resp = null; + +// (String resource, boolean localOnly, String select, String key, String prefix, String orderBy, SvcLogicContext ctx) + resp = aaiService.query("echo", false, null, "", "aaidata", null, ctx); + assert(resp == QueryStatus.SUCCESS); + } + catch (Throwable e) + { + LOG.error("Caught exception", e); +// fail("Caught exception"); + } + } } -- cgit 1.2.3-korg