aboutsummaryrefslogtreecommitdiffstats
path: root/ansible-adapter/ansible-adapter-bundle/src/test/java/org/onap/ccsdk/adapter/ansible/impl/TestConnectionBuilder.java
diff options
context:
space:
mode:
Diffstat (limited to 'ansible-adapter/ansible-adapter-bundle/src/test/java/org/onap/ccsdk/adapter/ansible/impl/TestConnectionBuilder.java')
-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 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());
+ }
+
}