@Test public void testDeleteShell() throws Exception { mockExecuteRequest(); PowerMockito.mockStatic(WSManUtils.class); Mockito.when(WSManUtils.isSpecificResponseAction(RESPONSE_BODY, DELETE_RESPONSE_ACTION)).thenReturn(true); Whitebox.invokeMethod(wsManRemoteShellServiceSpy, WSManRemoteShellServiceTest.DELETE_SHELL_METHOD, csHttpClientMock, httpClientInputsMock, SHELL_UUID, wsManRequestInputs); verifyStatic(); WSManUtils.isSpecificResponseAction(RESPONSE_BODY, DELETE_RESPONSE_ACTION); }
private void deleteShell(HttpClientService csHttpClient, HttpClientInputs httpClientInputs, String shellId, WSManRequestInputs wsManRequestInputs) throws RuntimeException, IOException, URISyntaxException, TransformerException, XPathExpressionException, SAXException, ParserConfigurationException { String documentStr = ResourceLoader.loadAsString(DELETE_SHELL_REQUEST_XML); documentStr = createDeleteShellRequestBody(documentStr, httpClientInputs.getUrl(), shellId, String.valueOf(wsManRequestInputs.getMaxEnvelopeSize()), wsManRequestInputs.getWinrmLocale(), String.valueOf(wsManRequestInputs.getOperationTimeout())); Map<String, String> deleteShellResult = executeRequestWithBody(csHttpClient, httpClientInputs, documentStr); if (WSManUtils.isSpecificResponseAction(deleteShellResult.get(RETURN_RESULT), DELETE_RESPONSE_ACTION)) { return; } else if (WSManUtils.isFaultResponse(deleteShellResult.get(RETURN_RESULT))) { throw new RuntimeException(WSManUtils.getResponseFault(deleteShellResult.get(RETURN_RESULT))); } else { throw new RuntimeException(UNEXPECTED_SERVICE_RESPONSE + deleteShellResult.get(RETURN_RESULT)); } }
WSManRemoteShellService { private void deleteShell(HttpClientService csHttpClient, HttpClientInputs httpClientInputs, String shellId, WSManRequestInputs wsManRequestInputs) throws RuntimeException, IOException, URISyntaxException, TransformerException, XPathExpressionException, SAXException, ParserConfigurationException { String documentStr = ResourceLoader.loadAsString(DELETE_SHELL_REQUEST_XML); documentStr = createDeleteShellRequestBody(documentStr, httpClientInputs.getUrl(), shellId, String.valueOf(wsManRequestInputs.getMaxEnvelopeSize()), wsManRequestInputs.getWinrmLocale(), String.valueOf(wsManRequestInputs.getOperationTimeout())); Map<String, String> deleteShellResult = executeRequestWithBody(csHttpClient, httpClientInputs, documentStr); if (WSManUtils.isSpecificResponseAction(deleteShellResult.get(RETURN_RESULT), DELETE_RESPONSE_ACTION)) { return; } else if (WSManUtils.isFaultResponse(deleteShellResult.get(RETURN_RESULT))) { throw new RuntimeException(WSManUtils.getResponseFault(deleteShellResult.get(RETURN_RESULT))); } else { throw new RuntimeException(UNEXPECTED_SERVICE_RESPONSE + deleteShellResult.get(RETURN_RESULT)); } } }
WSManRemoteShellService { private void deleteShell(HttpClientService csHttpClient, HttpClientInputs httpClientInputs, String shellId, WSManRequestInputs wsManRequestInputs) throws RuntimeException, IOException, URISyntaxException, TransformerException, XPathExpressionException, SAXException, ParserConfigurationException { String documentStr = ResourceLoader.loadAsString(DELETE_SHELL_REQUEST_XML); documentStr = createDeleteShellRequestBody(documentStr, httpClientInputs.getUrl(), shellId, String.valueOf(wsManRequestInputs.getMaxEnvelopeSize()), wsManRequestInputs.getWinrmLocale(), String.valueOf(wsManRequestInputs.getOperationTimeout())); Map<String, String> deleteShellResult = executeRequestWithBody(csHttpClient, httpClientInputs, documentStr); if (WSManUtils.isSpecificResponseAction(deleteShellResult.get(RETURN_RESULT), DELETE_RESPONSE_ACTION)) { return; } else if (WSManUtils.isFaultResponse(deleteShellResult.get(RETURN_RESULT))) { throw new RuntimeException(WSManUtils.getResponseFault(deleteShellResult.get(RETURN_RESULT))); } else { throw new RuntimeException(UNEXPECTED_SERVICE_RESPONSE + deleteShellResult.get(RETURN_RESULT)); } } WSManRemoteShellService();  WSManRemoteShellService(PSEdition psEdition); }
WSManRemoteShellService { private void deleteShell(HttpClientService csHttpClient, HttpClientInputs httpClientInputs, String shellId, WSManRequestInputs wsManRequestInputs) throws RuntimeException, IOException, URISyntaxException, TransformerException, XPathExpressionException, SAXException, ParserConfigurationException { String documentStr = ResourceLoader.loadAsString(DELETE_SHELL_REQUEST_XML); documentStr = createDeleteShellRequestBody(documentStr, httpClientInputs.getUrl(), shellId, String.valueOf(wsManRequestInputs.getMaxEnvelopeSize()), wsManRequestInputs.getWinrmLocale(), String.valueOf(wsManRequestInputs.getOperationTimeout())); Map<String, String> deleteShellResult = executeRequestWithBody(csHttpClient, httpClientInputs, documentStr); if (WSManUtils.isSpecificResponseAction(deleteShellResult.get(RETURN_RESULT), DELETE_RESPONSE_ACTION)) { return; } else if (WSManUtils.isFaultResponse(deleteShellResult.get(RETURN_RESULT))) { throw new RuntimeException(WSManUtils.getResponseFault(deleteShellResult.get(RETURN_RESULT))); } else { throw new RuntimeException(UNEXPECTED_SERVICE_RESPONSE + deleteShellResult.get(RETURN_RESULT)); } } WSManRemoteShellService();  WSManRemoteShellService(PSEdition psEdition); Map<String, String> runCommand(WSManRequestInputs wsManRequestInputs); }
WSManRemoteShellService { private void deleteShell(HttpClientService csHttpClient, HttpClientInputs httpClientInputs, String shellId, WSManRequestInputs wsManRequestInputs) throws RuntimeException, IOException, URISyntaxException, TransformerException, XPathExpressionException, SAXException, ParserConfigurationException { String documentStr = ResourceLoader.loadAsString(DELETE_SHELL_REQUEST_XML); documentStr = createDeleteShellRequestBody(documentStr, httpClientInputs.getUrl(), shellId, String.valueOf(wsManRequestInputs.getMaxEnvelopeSize()), wsManRequestInputs.getWinrmLocale(), String.valueOf(wsManRequestInputs.getOperationTimeout())); Map<String, String> deleteShellResult = executeRequestWithBody(csHttpClient, httpClientInputs, documentStr); if (WSManUtils.isSpecificResponseAction(deleteShellResult.get(RETURN_RESULT), DELETE_RESPONSE_ACTION)) { return; } else if (WSManUtils.isFaultResponse(deleteShellResult.get(RETURN_RESULT))) { throw new RuntimeException(WSManUtils.getResponseFault(deleteShellResult.get(RETURN_RESULT))); } else { throw new RuntimeException(UNEXPECTED_SERVICE_RESPONSE + deleteShellResult.get(RETURN_RESULT)); } } WSManRemoteShellService();  WSManRemoteShellService(PSEdition psEdition); Map<String, String> runCommand(WSManRequestInputs wsManRequestInputs);  }