diff options
author | Agarwal, Ruchira (ra1926) <ra1926@att.com> | 2019-11-05 18:16:50 +0000 |
---|---|---|
committer | Agarwal, Ruchira (ra1926) <ra1926@att.com> | 2019-11-05 18:16:50 +0000 |
commit | 83559ddc77a0217391212f2abcdcba2c3ff56937 (patch) | |
tree | 4a74c900ba401be5099d08371d6e2c79967d0555 /aai-service | |
parent | 5c6b2000726e657eb6a1ed468ae14f95e9df0ce4 (diff) |
minor updates to clean up code
clean up code to sync with internal
Issue-ID: CCSDK-1873
Signed-off-by: Agarwal, Ruchira (ra1926) <ra1926@att.com>
Change-Id: Idcc7186d5aaa783c527de3986e7a1ecd9bfcf651
Diffstat (limited to 'aai-service')
5 files changed, 36 insertions, 10 deletions
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 @@ -97,10 +97,6 @@ <artifactId>spring-core</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>org.apache.httpcomponents</groupId> - <artifactId>httpcore</artifactId> - </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> @@ -112,7 +108,7 @@ <plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> - <version>0.13.1</version> + <version>0.14.0</version> <executions> <execution> <id>gen-xjc</id> @@ -139,7 +135,7 @@ <plugin> <groupId>org.jvnet.jaxb2_commons</groupId> <artifactId>jaxb2-basics-annotate</artifactId> - <version>0.6.4</version> + <version>0.6.5</version> </plugin> </plugins> </configuration> 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<String, String> nameValues, String modifier) throws IOException, AAIServiceException ; + public QueryStatus processResponseData(String rv, String resource, AAIRequest request, String prefix, SvcLogicContext ctx, Map<String, String> 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<String, String> 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"); + } + } } |