summaryrefslogtreecommitdiffstats
path: root/saltstack-adapter/saltstack-adapter-provider/src/test/java
diff options
context:
space:
mode:
authorGanesh Chandrasekaran <ganesh.c@samsung.com>2018-07-17 11:02:17 +0900
committerGanesh Chandrasekaran <ganesh.c@samsung.com>2018-07-17 11:19:50 +0900
commitb08a1b8cf2440fac7fc3d7eb7580a58d977524a2 (patch)
treee87f032dfc96ff1ced3204d610a9453e961b1412 /saltstack-adapter/saltstack-adapter-provider/src/test/java
parentaeeba1d69f0498808252d5555b06b8fb6cae9269 (diff)
saltstack adaptor DGs addition
Issue-ID: CCSDK-368 Change-Id: I5f66693109c14eb64e4576caeeb84440a940fffa Signed-off-by: Ganesh Chandrasekaran <ganesh.c@samsung.com>
Diffstat (limited to 'saltstack-adapter/saltstack-adapter-provider/src/test/java')
-rw-r--r--saltstack-adapter/saltstack-adapter-provider/src/test/java/org/onap/ccsdk/adapter/impl/TestSaltstackAdapterImpl.java44
1 files changed, 36 insertions, 8 deletions
diff --git a/saltstack-adapter/saltstack-adapter-provider/src/test/java/org/onap/ccsdk/adapter/impl/TestSaltstackAdapterImpl.java b/saltstack-adapter/saltstack-adapter-provider/src/test/java/org/onap/ccsdk/adapter/impl/TestSaltstackAdapterImpl.java
index 48f5c20b..98137a8b 100644
--- a/saltstack-adapter/saltstack-adapter-provider/src/test/java/org/onap/ccsdk/adapter/impl/TestSaltstackAdapterImpl.java
+++ b/saltstack-adapter/saltstack-adapter-provider/src/test/java/org/onap/ccsdk/adapter/impl/TestSaltstackAdapterImpl.java
@@ -278,7 +278,7 @@ public class TestSaltstackAdapterImpl {
adapter.reqExecCommand(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
- assertEquals("250", status);
+ assertEquals("200", status);
assertEquals(TestId, "test1");
}
@@ -339,7 +339,7 @@ public class TestSaltstackAdapterImpl {
adapter.reqExecCommand(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
- assertEquals("250", status);
+ assertEquals("200", status);
assertEquals(TestId, "txt");
}
@@ -360,7 +360,7 @@ public class TestSaltstackAdapterImpl {
adapter.reqExecCommand(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
- assertEquals("250", status);
+ assertEquals("200", status);
assertEquals(TestId, "txt");
}
@@ -381,7 +381,7 @@ public class TestSaltstackAdapterImpl {
adapter.reqExecCommand(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
- assertEquals("250", status);
+ assertEquals("200", status);
}
@Test(expected = SvcLogicException.class)
@@ -415,7 +415,7 @@ public class TestSaltstackAdapterImpl {
adapter.reqExecCommand(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
- assertEquals("250", status);
+ assertEquals("200", status);
}
@Test
@@ -817,7 +817,7 @@ public class TestSaltstackAdapterImpl {
adapter.reqExecCommand(params, svcContext);
String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
- assertEquals("250", status);
+ assertEquals("200", status);
assertEquals(TestId, "test1");
} catch (Exception e){
//if local ssh is not enabled
@@ -826,6 +826,34 @@ public class TestSaltstackAdapterImpl {
}
@Test
+ public void reqExecCommand_shouldSetSuccessRealSLSCommand() throws SvcLogicException,
+ IllegalStateException, IllegalArgumentException {
+
+ params.put("HostName", "<IP>");
+ params.put("Port", "2222");
+ params.put("User", "root");
+ params.put("Password", "vagrant");
+ params.put("Id", "test1");
+ params.put("cmd", "salt '*' test.ping --out=json --static");
+ params.put("slsExec", "false");
+ params.put("execTimeout", "12000");
+
+ adapter = new SaltstackAdapterImpl();
+ try {
+ adapter.reqExecCommand(params, svcContext);
+ String status = svcContext.getAttribute("org.onap.appc.adapter.saltstack.result.code");
+ TestId = svcContext.getAttribute("org.onap.appc.adapter.saltstack.Id");
+ assertEquals("200", status);
+ assertEquals(TestId, "test1");
+ TestId = svcContext.getAttribute("test1.minion1");
+ assertEquals(TestId, "true");
+ } catch (Exception e){
+ //if saltstack ssh IP is not enabled
+ return;
+ }
+ }
+
+ @Test
public void reqExecCommand_shouldSetSuccessRealCommand() throws SvcLogicException,
IllegalStateException, IllegalArgumentException {
@@ -855,7 +883,7 @@ public class TestSaltstackAdapterImpl {
public void reqExecCommand_shouldSetSuccessRealSSL() throws SvcLogicException,
IllegalStateException, IllegalArgumentException {
- params.put("HostName", "10.251.92.17");
+ params.put("HostName", "<IP>");
params.put("Port", "2222");
params.put("User", "root");
params.put("Password", "vagrant");
@@ -881,7 +909,7 @@ public class TestSaltstackAdapterImpl {
public void reqExecCommand_shouldSetSuccessSSLFile() throws SvcLogicException,
IllegalStateException, IllegalArgumentException {
- params.put("HostName", "10.251.92.17");
+ params.put("HostName", "<IP>");
params.put("Port", "2222");
params.put("User", "root");
params.put("Password", "vagrant");