diff options
author | Dan Timoney <dt5972@att.com> | 2018-09-07 12:36:18 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-09-07 12:36:18 +0000 |
commit | 09b802a72b4bd7fbac2084a8abbe7c207c4f9b7e (patch) | |
tree | 7bd91599ff3f8640d95a2cd45e7da9a94e26ee11 /ansible-adapter/ansible-adapter-bundle/src/test/java | |
parent | 84a5f5a0791a8d8d3ca5958c8a6962014416b174 (diff) | |
parent | 751994b3d0b67fbebd83d97ef4faa8ce8bc10505 (diff) |
Merge "Ansible ConnectionBuilder cert based test"
Diffstat (limited to 'ansible-adapter/ansible-adapter-bundle/src/test/java')
-rw-r--r-- | ansible-adapter/ansible-adapter-bundle/src/test/java/org/onap/ccsdk/adapter/ansible/impl/TestConnectionBuilder.java | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/ansible-adapter/ansible-adapter-bundle/src/test/java/org/onap/ccsdk/adapter/ansible/impl/TestConnectionBuilder.java b/ansible-adapter/ansible-adapter-bundle/src/test/java/org/onap/ccsdk/adapter/ansible/impl/TestConnectionBuilder.java index 2a60adbc..c94655f5 100644 --- a/ansible-adapter/ansible-adapter-bundle/src/test/java/org/onap/ccsdk/adapter/ansible/impl/TestConnectionBuilder.java +++ b/ansible-adapter/ansible-adapter-bundle/src/test/java/org/onap/ccsdk/adapter/ansible/impl/TestConnectionBuilder.java @@ -99,7 +99,7 @@ public class TestConnectionBuilder { } @Test (expected = FileNotFoundException.class) - public void testGetModeCert() + public void testGetModeNoCert() throws KeyStoreException, CertificateException, IOException, KeyManagementException, NoSuchAlgorithmException, SvcLogicException { String user = "testUser"; @@ -116,4 +116,40 @@ public class TestConnectionBuilder { assertEquals("UNKNOWN", result.getResults()); } + @Test + public void testGetModeCert() + throws KeyStoreException, CertificateException, IOException, + KeyManagementException, NoSuchAlgorithmException, SvcLogicException { + String user = "testUser"; + String pass = "testPassword"; + String agentUrl = "test/server.com"; + String certFile = "src/test/resources/cert"; + + builder = new ConnectionBuilder(certFile); + builder.setHttpContext(user, pass); + AnsibleResult result = builder.get(agentUrl); + + assertEquals(611, result.getStatusCode()); + assertEquals(null, result.getStatusMessage()); + assertEquals("UNKNOWN", result.getResults()); + } + + @Test (expected = IOException.class) + public void testGetModeStore() + throws KeyStoreException, CertificateException, IOException, + KeyManagementException, NoSuchAlgorithmException, SvcLogicException { + String user = "testUser"; + String pass = "testPassword"; + String agentUrl = "test/server.com"; + String store = "src/test/resources/cert"; + + builder = new ConnectionBuilder(store, new char['t'] ); + builder.setHttpContext(user, pass); + AnsibleResult result = builder.get(agentUrl); + + assertEquals(611, result.getStatusCode()); + assertEquals(null, result.getStatusMessage()); + assertEquals("UNKNOWN", result.getResults()); + } + } |