diff options
Diffstat (limited to 'appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/test/java/org/onap/appc/adapter/ansible/impl/TestAnsibleAdapterImpl.java')
-rw-r--r-- | appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/test/java/org/onap/appc/adapter/ansible/impl/TestAnsibleAdapterImpl.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/test/java/org/onap/appc/adapter/ansible/impl/TestAnsibleAdapterImpl.java b/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/test/java/org/onap/appc/adapter/ansible/impl/TestAnsibleAdapterImpl.java index 02048aee3..8e13a66ea 100644 --- a/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/test/java/org/onap/appc/adapter/ansible/impl/TestAnsibleAdapterImpl.java +++ b/appc-adapters/appc-ansible-adapter/appc-ansible-adapter-bundle/src/test/java/org/onap/appc/adapter/ansible/impl/TestAnsibleAdapterImpl.java @@ -60,8 +60,8 @@ public class TestAnsibleAdapterImpl { private static final String STATUS_CODE = "StatusCode"; private static final String STATUS_MESSAGE = "StatusMessage"; private static final String PENDING = "100"; - private static final String SUCCESS = "200"; - + private static final String SUCCESS = "SUCCESS"; + private static final String MESSAGE_ATTRIBUTE_NAME = "SUCCESS"; private AnsibleAdapterImpl adapter; private boolean testMode = true; private Map<String, String> params; @@ -109,6 +109,7 @@ public class TestAnsibleAdapterImpl { result = new AnsibleResult(); result.setStatusMessage("Success"); result.setResults("Success"); + result.setOutput("{}"); Whitebox.setInternalState(adapter, "messageProcessor", messageProcessor); spyAdapter = Mockito.spy(adapter); } @@ -150,16 +151,15 @@ public class TestAnsibleAdapterImpl { * @throws APPCException * If the request cannot be processed for some reason */ - @Test + @Test(expected = SvcLogicException.class) public void reqExecResult_shouldSetSuccess() throws SvcLogicException, APPCException { params.put("Id", "100"); - result.setStatusCode(Integer.valueOf(SUCCESS)); + result.setStatusMessage(SUCCESS); when(messageProcessor.reqUriResult(params)).thenReturn(agentUrl); when(messageProcessor.parseGetResponse(anyString())).thenReturn(result); spyAdapter.reqExecResult(params, svcContext); - assertEquals("400", svcContext.getAttribute(RESULT_CODE_ATTRIBUTE_NAME)); + assertEquals(SUCCESS, svcContext.getAttribute(MESSAGE_ATTRIBUTE_NAME)); } - /** * This test case is used to test the Failure of the request * @@ -174,6 +174,10 @@ public class TestAnsibleAdapterImpl { params.put("Id", "100"); result.setStatusCode(100); result.setStatusMessage("Failed"); + JSONObject cData = new JSONObject(); + cData.put("GatewayInfo", "Radius"); + result.setconfigData(cData.toString()); + result.setOutput(cData.toString()); when(messageProcessor.reqUriResult(params)).thenReturn(agentUrl); when(messageProcessor.parseGetResponse(anyString())).thenReturn(result); adapter.reqExecResult(params, svcContext); |