diff options
Diffstat (limited to 'aai-service')
4 files changed, 25 insertions, 22 deletions
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 04a0c593..f1663d2d 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 @@ -281,7 +281,7 @@ public abstract class AAIDeclarations implements AAIClient { } catch (AAIServiceException aaiexc) { ctx.setAttribute(prefix + ".error.message", aaiexc.getMessage()); if (aaiexc.getReturnCode() >= 300) { - ctx.setAttribute(prefix + ".error.http.response-code", "" + aaiexc.getReturnCode()); + ctx.setAttribute(prefix + ".error.http" + "" + ".response-code", Integer.toString(aaiexc.getReturnCode())); } if (aaiexc.getReturnCode() == 404) @@ -303,7 +303,7 @@ public abstract class AAIDeclarations implements AAIClient { } catch (AAIServiceException aaiexc) { ctx.setAttribute(prefix + ".error.message", aaiexc.getMessage()); if (aaiexc.getReturnCode() >= 300) { - ctx.setAttribute(prefix + ".error.http.response-code", "" + aaiexc.getReturnCode()); + ctx.setAttribute(prefix + ".error.http" + ".response-code", Integer.toString(aaiexc.getReturnCode())); } if (aaiexc.getReturnCode() == 404) @@ -521,7 +521,7 @@ public abstract class AAIDeclarations implements AAIClient { if(exc instanceof AAIServiceException) { AAIServiceException aaiexc = (AAIServiceException)exc; if(aaiexc.getReturnCode() >= 300) { - ctx.setAttribute(prefix + ".error.http.response-code", "" + aaiexc.getReturnCode()); + ctx.setAttribute(prefix + ".error.http" + ".response-code", Integer.toString(aaiexc.getReturnCode())); } if(aaiexc.getReturnCode() == 404) { @@ -710,22 +710,19 @@ public abstract class AAIDeclarations implements AAIClient { return QueryStatus.FAILURE; } } else { - String resoourceName = resource; + String resourceName = resource; String identifier = null; - if(resoourceName == null) - return QueryStatus.FAILURE; - - if(resoourceName.contains(":")) { - String[] tokens = resoourceName.split(":"); + if(resourceName.contains(":")) { + String[] tokens = resourceName.split(":"); if(tokens != null && tokens.length > 0) { - resoourceName = tokens[0]; + resourceName = tokens[0]; identifier = tokens[1]; } } if("relationship-list".equals(identifier) || "relationshipList".equals(identifier)) { // RelationshipRequest relationshipRequest = new RelationshipRequest(); - if("generic-vnf".equals(resoourceName)){ + if("generic-vnf".equals(resourceName)){ String vnfId = nameValues.get("vnf_id"); String relatedTo = nameValues.get("related_to"); vnfId = vnfId.trim().replace("'", "").replace("$", "").replace("'", ""); @@ -1583,8 +1580,8 @@ public abstract class AAIDeclarations implements AAIClient { j++; } AAIRequest rlRequest = AAIRequest.createRequest(relatedTo, relParams); - for(String key : relParams.keySet()) { - rlRequest.addRequestProperty(key, relParams.get(key)); + for(Map.Entry<String,String> entry : relParams.entrySet()) { + rlRequest.addRequestProperty(entry.getKey(), entry.getValue()); } String path = rlRequest.updatePathDataValues(null); relationship.setRelatedLink(path); diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java index 840062e7..d3d57eaa 100755 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java @@ -290,12 +290,11 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe ctx = SSLContext.getInstance("TLS"); KeyManagerFactory kmf = null; - try { + try (FileInputStream fin = new FileInputStream(keystore_path)){ String def = "SunX509"; String storeType = "PKCS12"; def = KeyStore.getDefaultType(); kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); - FileInputStream fin = new FileInputStream(keystore_path); String extension = keystore_path.substring(keystore_path.lastIndexOf(".") + 1); if("JKS".equalsIgnoreCase(extension)) { diff --git a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/r1607/R1607AutoGeneratedTest.java b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/r1607/R1607AutoGeneratedTest.java index b0345157..e0f20123 100644..100755 --- a/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/r1607/R1607AutoGeneratedTest.java +++ b/aai-service/provider/src/test/java/org/onap/ccsdk/sli/adaptors/aai/r1607/R1607AutoGeneratedTest.java @@ -3,7 +3,7 @@ * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights - * reserved. + * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,9 +48,8 @@ import org.apache.commons.lang.StringUtils; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.FixMethodOrder; +import org.junit.Test; import org.junit.runners.MethodSorters; -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicResource.QueryStatus; import org.onap.ccsdk.sli.adaptors.aai.AAIClient; import org.onap.ccsdk.sli.adaptors.aai.AAIDeclarations; import org.onap.ccsdk.sli.adaptors.aai.AAIRequest; @@ -58,6 +57,8 @@ import org.onap.ccsdk.sli.adaptors.aai.AAIService; import org.onap.ccsdk.sli.adaptors.aai.data.AAIDatum; import org.openecomp.aai.inventory.v11.GenericVnf; import org.openecomp.aai.inventory.v11.InventoryResponseItems; +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; @@ -79,7 +80,7 @@ public class R1607AutoGeneratedTest { public static void setUp() throws Exception { // super.setUp(); URL url = AAIService.class.getResource(AAIService.AAICLIENT_PROPERTIES); - client = new AAIService(url); +// client = new AAIService(url); LOG.info("\nTaicAAIResourceTest.setUp\n"); } @@ -476,7 +477,8 @@ public class R1607AutoGeneratedTest { } } -static class MySchemaOutputResolver extends SchemaOutputResolver { + + static class MySchemaOutputResolver extends SchemaOutputResolver { public Result createOutput(String namespaceURI, String suggestedFileName) throws IOException { File file = new File(suggestedFileName); diff --git a/aai-service/provider/src/test/resources/aaiclient.properties b/aai-service/provider/src/test/resources/aaiclient.properties index e615fc12..c09be3a4 100755 --- a/aai-service/provider/src/test/resources/aaiclient.properties +++ b/aai-service/provider/src/test/resources/aaiclient.properties @@ -3,7 +3,7 @@ # openECOMP : SDN-C # ================================================================================ # Copyright (C) 2017 AT&T Intellectual Property. All rights -# reserved. +# reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -40,8 +40,13 @@ org.onap.ccsdk.sli.adaptors.aai.application=CCSDK # # Configuration file for A&AI Client # -#org.onap.ccsdk.sli.adaptors.aai.uri=https://localhost:8443 +#org.onap.ccsdk.sli.adaptors.aai.uri=https://aai-ext1.test.att.com:8443 +#org.onap.ccsdk.sli.adaptors.aai.uri=https://aai-int1.test.att.com:8443 +#org.onap.ccsdk.sli.adaptors.aai.uri=https://mtanjv9aaas40.aic.cip.att.com:8443 org.onap.ccsdk.sli.adaptors.aai.uri=https://aai-int2.test.att.com:8443 +# +connection.timeout=60000 +read.timeout=60000 # query org.onap.ccsdk.sli.adaptors.aai.path.query=/aai/v11/search/sdn-zone-query |