diff options
author | 2018-05-15 16:48:03 +0200 | |
---|---|---|
committer | 2018-05-15 16:48:03 +0200 | |
commit | d65298c77307675e3d133753cad2f14cd8b5fbbd (patch) | |
tree | 28b82868e7aa4d6eb7d6b7fc3c535af56f861a4a | |
parent | 0a42016657086debbf41eba82d9f8cc0da6b7d80 (diff) |
Correction of AAI Client configuration loading
Change-Id: I42d5dcd2d2e65db9e4eb3cf324ed127ddd882f41
Issue-ID: DCAEGEN2-509
Signed-off-by: wejs <maciej.wejs@nokia.com>
6 files changed, 37 insertions, 36 deletions
diff --git a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/service/AAIClientImpl.java b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/service/AAIClientImpl.java index f58919e5..785ff972 100644 --- a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/service/AAIClientImpl.java +++ b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/service/AAIClientImpl.java @@ -41,20 +41,20 @@ import java.security.NoSuchAlgorithmException; public class AAIClientImpl implements AAIClient { - Logger logger = LoggerFactory.getLogger(AAIClientImpl.class); + private Logger logger = LoggerFactory.getLogger(AAIClientImpl.class); - private AAIClientConfiguration aaiHttpClientConfig; + private AAIClientConfiguration aaiClientConfig; - public AAIClientImpl(AAIClientConfiguration aaiHttpClientConfiguration) { - this.aaiHttpClientConfig = aaiHttpClientConfiguration; + public AAIClientImpl(AAIClientConfiguration aaiClientConfiguration) { + this.aaiClientConfig = aaiClientConfiguration; } @Override public CloseableHttpClient getAAIHttpClient() { final HttpClientBuilder httpClientBuilder = HttpClients.custom().useSystemProperties(); - final boolean aaiIgnoreSSLCertificateErrors = aaiHttpClientConfig.aaiIgnoreSSLCertificateErrors(); + final boolean aaiIgnoreSSLCertificateErrors = aaiClientConfig.aaiIgnoreSSLCertificateErrors(); TrustStrategy acceptingTrustStrategy = (cert, authType) -> true; @@ -72,14 +72,14 @@ public class AAIClientImpl implements AAIClient { httpClientBuilder.setSSLHostnameVerifier(NoopHostnameVerifier.INSTANCE); } - final String aaiUserName = aaiHttpClientConfig.aaiUserName(); + final String aaiUserName = aaiClientConfig.aaiUserName(); final CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); if (aaiUserName != null) { - final String aaiHost = aaiHttpClientConfig.aaiHost(); - final Integer aaiHostPortNumber = aaiHttpClientConfig.aaiHostPortNumber(); - final String aaiUserPassword = aaiHttpClientConfig.aaiUserPassword(); + final String aaiHost = aaiClientConfig.aaiHost(); + final Integer aaiHostPortNumber = aaiClientConfig.aaiHostPortNumber(); + final String aaiUserPassword = aaiClientConfig.aaiUserPassword(); final AuthScope aaiHostPortAuthScope = new AuthScope(aaiHost, aaiHostPortNumber); final Credentials aaiCredentials = new UsernamePasswordCredentials(aaiUserName, aaiUserPassword); credentialsProvider.setCredentials(aaiHostPortAuthScope, aaiCredentials); diff --git a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/service/AAIConsumerClient.java b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/service/AAIConsumerClient.java index ffaf1aff..1bc7770c 100644 --- a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/service/AAIConsumerClient.java +++ b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/service/AAIConsumerClient.java @@ -52,13 +52,13 @@ public class AAIConsumerClient { private final Map<String,String> aaiHeaders; - public AAIConsumerClient(AAIClientConfiguration aaiHttpClientConfiguration) { - closeableHttpClient = new AAIClientImpl(aaiHttpClientConfiguration).getAAIHttpClient(); - aaiHost = aaiHttpClientConfiguration.aaiHost(); - aaiProtocol = aaiHttpClientConfiguration.aaiProtocol(); - aaiHostPortNumber = aaiHttpClientConfiguration.aaiHostPortNumber(); - aaiPath = aaiHttpClientConfiguration.aaiBasePath() + aaiHttpClientConfiguration.aaiPnfPath(); - aaiHeaders = aaiHttpClientConfiguration.aaiHeaders(); + public AAIConsumerClient(AAIClientConfiguration aaiClientConfiguration) { + closeableHttpClient = new AAIClientImpl(aaiClientConfiguration).getAAIHttpClient(); + aaiHost = aaiClientConfiguration.aaiHost(); + aaiProtocol = aaiClientConfiguration.aaiProtocol(); + aaiHostPortNumber = aaiClientConfiguration.aaiHostPortNumber(); + aaiPath = aaiClientConfiguration.aaiBasePath() + aaiClientConfiguration.aaiPnfPath(); + aaiHeaders = aaiClientConfiguration.aaiHeaders(); } public Optional<String> getHttpResponse(ConsumerDmaapModel consumerDmaapModel) throws IOException { diff --git a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/service/AAIProducerClient.java b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/service/AAIProducerClient.java index 788d997e..7f38d9ed 100644 --- a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/service/AAIProducerClient.java +++ b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/service/AAIProducerClient.java @@ -55,13 +55,13 @@ public class AAIProducerClient implements AAIExtendedHttpClient { private final Map<String,String> aaiHeaders; - public AAIProducerClient(AAIClientConfiguration aaiHttpClientConfiguration) { - closeableHttpClient = new AAIClientImpl(aaiHttpClientConfiguration).getAAIHttpClient(); - aaiHost = aaiHttpClientConfiguration.aaiHost(); - aaiProtocol = aaiHttpClientConfiguration.aaiProtocol(); - aaiHostPortNumber = aaiHttpClientConfiguration.aaiHostPortNumber(); - aaiPath = aaiHttpClientConfiguration.aaiBasePath() + aaiHttpClientConfiguration.aaiPnfPath(); - aaiHeaders = aaiHttpClientConfiguration.aaiHeaders(); + public AAIProducerClient(AAIClientConfiguration aaiClientConfiguration) { + closeableHttpClient = new AAIClientImpl(aaiClientConfiguration).getAAIHttpClient(); + aaiHost = aaiClientConfiguration.aaiHost(); + aaiProtocol = aaiClientConfiguration.aaiProtocol(); + aaiHostPortNumber = aaiClientConfiguration.aaiHostPortNumber(); + aaiPath = aaiClientConfiguration.aaiBasePath() + aaiClientConfiguration.aaiPnfPath(); + aaiHeaders = aaiClientConfiguration.aaiHeaders(); } diff --git a/prh-app-server/config/prh_endpoints.json b/prh-app-server/config/prh_endpoints.json index 1a3ebad5..72d66640 100644 --- a/prh-app-server/config/prh_endpoints.json +++ b/prh-app-server/config/prh_endpoints.json @@ -25,8 +25,8 @@ } }, "aai": { - "aaiHttpClientConfiguration": { - "aaiHost": "", + "aaiClientConfiguration": { + "aaiHost": "localhost", "aaiHostPortNumber": 8080, "aaiProtocol": "https", "aaiUserName": "admin", diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java index 92fb666c..a6014c4b 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java @@ -88,28 +88,28 @@ public class AppConfig extends PrhAppConfig { @Value("${dmaap.dmaapProducerConfiguration.dmaapContentType:}") public String producerDmaapContentType; - @Value("${aai.aaiHttpClientConfiguration.aaiHost:}") + @Value("${aai.aaiClientConfiguration.aaiHost:}") public String aaiHost; - @Value("${aai.aaiHttpClientConfiguration.aaiHostPortNumber:}") + @Value("${aai.aaiClientConfiguration.aaiHostPortNumber:}") public Integer aaiHostPortNumber; - @Value("${aai.aaiHttpClientConfiguration.aaiProtocol:}") + @Value("${aai.aaiClientConfiguration.aaiProtocol:}") public String aaiProtocol; - @Value("${aai.aaiHttpClientConfiguration.aaiUserName:}") + @Value("${aai.aaiClientConfiguration.aaiUserName:}") public String aaiUserName; - @Value("${aai.aaiHttpClientConfiguration.aaiUserPassword:}") + @Value("${aai.aaiClientConfiguration.aaiUserPassword:}") public String aaiUserPassword; - @Value("${aai.aaiHttpClientConfiguration.aaiIgnoreSSLCertificateErrors:}") + @Value("${aai.aaiClientConfiguration.aaiIgnoreSSLCertificateErrors:}") public Boolean aaiIgnoreSSLCertificateErrors; - @Value("${aai.aaiHttpClientConfiguration.aaiBasePath:}") + @Value("${aai.aaiClientConfiguration.aaiBasePath:}") public String aaiBasePath; - @Value("${aai.aaiHttpClientConfiguration.aaiPnfPath:}") + @Value("${aai.aaiClientConfiguration.aaiPnfPath:}") public String aaiPnfPath; @Override diff --git a/prh-app-server/src/test/resources/prh_endpoints.json b/prh-app-server/src/test/resources/prh_endpoints.json index a67ee02b..0fe4b276 100644 --- a/prh-app-server/src/test/resources/prh_endpoints.json +++ b/prh-app-server/src/test/resources/prh_endpoints.json @@ -1,8 +1,8 @@ { "configs": { "aai": { - "aaiHttpClientConfiguration": { - "aaiHost": "", + "aaiClientConfiguration": { + "aaiHost": "localhost", "aaiHostPortNumber": 8080, "aaiIgnoreSSLCertificateErrors": true, "aaiProtocol": "https", @@ -14,7 +14,8 @@ "X-FromAppId": "prh", "X-TransactionId": "9999", "Accept": "application/json", - "Real-Time": "true" + "Real-Time": "true", + "Authorization": "Basic QUFJOkFBSQ==" } } }, |