summaryrefslogtreecommitdiffstats
path: root/ansible-adapter/ansible-adapter-bundle/src/test/java/org
diff options
context:
space:
mode:
authorGanesh Chandrasekaran <ganesh.c@samsung.com>2018-09-07 13:20:40 +0900
committerGanesh Chandrasekaran <ganesh.c@samsung.com>2018-09-07 04:38:52 +0000
commit751994b3d0b67fbebd83d97ef4faa8ce8bc10505 (patch)
tree585a1e69cf153d1ca47c8454e23abceb9b697f53 /ansible-adapter/ansible-adapter-bundle/src/test/java/org
parent4d8f734e4b9c6c3814d1843cd78b6507f6847cc6 (diff)
Ansible ConnectionBuilder cert based test
Issue-ID: CCSDK-521 Change-Id: I5c1b4b86ff8c23c3c8a96bf2f217dd8d86b8261f Signed-off-by: Ganesh Chandrasekaran <ganesh.c@samsung.com>
Diffstat (limited to 'ansible-adapter/ansible-adapter-bundle/src/test/java/org')
-rw-r--r--ansible-adapter/ansible-adapter-bundle/src/test/java/org/onap/ccsdk/adapter/ansible/impl/TestConnectionBuilder.java38
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 2a60adbc0..c94655f56 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());
+ }
+
}