diff options
author | 2019-04-23 09:29:36 +0530 | |
---|---|---|
committer | 2019-04-23 09:29:36 +0530 | |
commit | 93c91c2fc80a31585c8f902c86bc4e1faf5b966d (patch) | |
tree | cb41f5684abf249d0dfdcc20172aaa475b92acbe /restconf-client/provider/src/main | |
parent | 31785e54cb0bdee86b57e0cdde4480dfac61aa85 (diff) |
Test coverage imporvement and code refactoring of restconf discovery node.
Test coverage imporvement and code refactoring of restconf discovery node.
Issue-ID: CCSDK-1236
Change-Id: Ic44899d71b92be3d7b88be3abb0feb311e6ad8c0
Signed-off-by: Vidyashree Rama <vidyashree.rama@huawei.com>
Diffstat (limited to 'restconf-client/provider/src/main')
-rw-r--r-- | restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/RestconfDiscoveryNode.java | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/RestconfDiscoveryNode.java b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/RestconfDiscoveryNode.java index 5c7d695d..cf69d7a3 100644 --- a/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/RestconfDiscoveryNode.java +++ b/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfdiscovery/RestconfDiscoveryNode.java @@ -141,7 +141,7 @@ public class RestconfDiscoveryNode implements SvcLogicDiscoveryPlugin { WebTarget target = null; try { RestapiCallNode restapi = restconfApiCallNode.getRestapiCallNode(); - p = restapi.getParameters(paramMap, new Parameters()); + p = RestapiCallNode.getParameters(paramMap, new Parameters()); Client client = ignoreSslClient().register(SseFeature.class); target = restapi.addAuthType(client, p).target(url); } catch (SvcLogicException e) { @@ -166,37 +166,37 @@ public class RestconfDiscoveryNode implements SvcLogicDiscoveryPlugin { eventSource.close(); log.info("Closed connection to SSE source"); } - } - - private Client ignoreSslClient() { - SSLContext sslcontext = null; - try { - sslcontext = SSLContext.getInstance("TLS"); - sslcontext.init(null, new TrustManager[]{new X509TrustManager() { - @Override - public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { - } + private Client ignoreSslClient() { + SSLContext sslcontext = null; - @Override - public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { - } + try { + sslcontext = SSLContext.getInstance("TLS"); + sslcontext.init(null, new TrustManager[]{new X509TrustManager() { + @Override + public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { + } + + @Override + public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + return new X509Certificate[0]; + } + } }, new java.security.SecureRandom()); + } catch (NoSuchAlgorithmException | KeyManagementException e) { + throw new IllegalStateException(e); + } - @Override - public X509Certificate[] getAcceptedIssuers() { - return new X509Certificate[0]; - } - } }, new java.security.SecureRandom()); - } catch (NoSuchAlgorithmException | KeyManagementException e) { - throw new IllegalStateException(e); + return ClientBuilder.newBuilder().sslContext(sslcontext).hostnameVerifier((s1, s2) -> true).build(); } - - return ClientBuilder.newBuilder().sslContext(sslcontext).hostnameVerifier((s1, s2) -> true).build(); } protected String getTokenId(String customHttpHeaders) { if (customHttpHeaders.contains("=")) { - String s[] = customHttpHeaders.split("="); + String[] s = customHttpHeaders.split("="); return s[1]; } return customHttpHeaders; |