@Test public void testCreateShell() throws Exception { mockExecuteRequest(); PowerMockito.mockStatic(WSManUtils.class); Mockito.when(WSManUtils.isSpecificResponseAction(RESPONSE_BODY, CREATE_RESPONSE_ACTION)).thenReturn(true); PowerMockito.mockStatic(XMLUtils.class); Mockito.when(XMLUtils.parseXml(RESPONSE_BODY, CREATE_RESPONSE_SHELL_ID_XPATH)).thenReturn(SHELL_UUID); String result = Whitebox.invokeMethod(new WSManRemoteShellService(), CREATE_SHELL_METHOD, csHttpClientMock, httpClientInputsMock, wsManRequestInputs); assertEquals(SHELL_UUID, result); verifyStatic(); WSManUtils.isSpecificResponseAction(RESPONSE_BODY, CREATE_RESPONSE_ACTION); XMLUtils.parseXml(RESPONSE_BODY, CREATE_RESPONSE_SHELL_ID_XPATH); }
private String createShell(HttpClientService csHttpClient, HttpClientInputs httpClientInputs, WSManRequestInputs wsManRequestInputs) throws RuntimeException, IOException, URISyntaxException, XPathExpressionException, SAXException, ParserConfigurationException { String document = ResourceLoader.loadAsString(CREATE_SHELL_REQUEST_XML); document = createCreateShellRequestBody(document, httpClientInputs.getUrl(), String.valueOf(wsManRequestInputs.getMaxEnvelopeSize()), wsManRequestInputs.getWinrmLocale(), String.valueOf(wsManRequestInputs.getOperationTimeout())); Map<String, String> createShellResult = executeRequestWithBody(csHttpClient, httpClientInputs, document); return getResourceId(createShellResult.get(RETURN_RESULT), CREATE_RESPONSE_ACTION, CREATE_RESPONSE_SHELL_ID_XPATH, SHELL_ID_NOT_RETRIEVED); }
WSManRemoteShellService { private String createShell(HttpClientService csHttpClient, HttpClientInputs httpClientInputs, WSManRequestInputs wsManRequestInputs) throws RuntimeException, IOException, URISyntaxException, XPathExpressionException, SAXException, ParserConfigurationException { String document = ResourceLoader.loadAsString(CREATE_SHELL_REQUEST_XML); document = createCreateShellRequestBody(document, httpClientInputs.getUrl(), String.valueOf(wsManRequestInputs.getMaxEnvelopeSize()), wsManRequestInputs.getWinrmLocale(), String.valueOf(wsManRequestInputs.getOperationTimeout())); Map<String, String> createShellResult = executeRequestWithBody(csHttpClient, httpClientInputs, document); return getResourceId(createShellResult.get(RETURN_RESULT), CREATE_RESPONSE_ACTION, CREATE_RESPONSE_SHELL_ID_XPATH, SHELL_ID_NOT_RETRIEVED); } }
WSManRemoteShellService { private String createShell(HttpClientService csHttpClient, HttpClientInputs httpClientInputs, WSManRequestInputs wsManRequestInputs) throws RuntimeException, IOException, URISyntaxException, XPathExpressionException, SAXException, ParserConfigurationException { String document = ResourceLoader.loadAsString(CREATE_SHELL_REQUEST_XML); document = createCreateShellRequestBody(document, httpClientInputs.getUrl(), String.valueOf(wsManRequestInputs.getMaxEnvelopeSize()), wsManRequestInputs.getWinrmLocale(), String.valueOf(wsManRequestInputs.getOperationTimeout())); Map<String, String> createShellResult = executeRequestWithBody(csHttpClient, httpClientInputs, document); return getResourceId(createShellResult.get(RETURN_RESULT), CREATE_RESPONSE_ACTION, CREATE_RESPONSE_SHELL_ID_XPATH, SHELL_ID_NOT_RETRIEVED); } WSManRemoteShellService();  WSManRemoteShellService(PSEdition psEdition); }
WSManRemoteShellService { private String createShell(HttpClientService csHttpClient, HttpClientInputs httpClientInputs, WSManRequestInputs wsManRequestInputs) throws RuntimeException, IOException, URISyntaxException, XPathExpressionException, SAXException, ParserConfigurationException { String document = ResourceLoader.loadAsString(CREATE_SHELL_REQUEST_XML); document = createCreateShellRequestBody(document, httpClientInputs.getUrl(), String.valueOf(wsManRequestInputs.getMaxEnvelopeSize()), wsManRequestInputs.getWinrmLocale(), String.valueOf(wsManRequestInputs.getOperationTimeout())); Map<String, String> createShellResult = executeRequestWithBody(csHttpClient, httpClientInputs, document); return getResourceId(createShellResult.get(RETURN_RESULT), CREATE_RESPONSE_ACTION, CREATE_RESPONSE_SHELL_ID_XPATH, SHELL_ID_NOT_RETRIEVED); } WSManRemoteShellService();  WSManRemoteShellService(PSEdition psEdition); Map<String, String> runCommand(WSManRequestInputs wsManRequestInputs); }
WSManRemoteShellService { private String createShell(HttpClientService csHttpClient, HttpClientInputs httpClientInputs, WSManRequestInputs wsManRequestInputs) throws RuntimeException, IOException, URISyntaxException, XPathExpressionException, SAXException, ParserConfigurationException { String document = ResourceLoader.loadAsString(CREATE_SHELL_REQUEST_XML); document = createCreateShellRequestBody(document, httpClientInputs.getUrl(), String.valueOf(wsManRequestInputs.getMaxEnvelopeSize()), wsManRequestInputs.getWinrmLocale(), String.valueOf(wsManRequestInputs.getOperationTimeout())); Map<String, String> createShellResult = executeRequestWithBody(csHttpClient, httpClientInputs, document); return getResourceId(createShellResult.get(RETURN_RESULT), CREATE_RESPONSE_ACTION, CREATE_RESPONSE_SHELL_ID_XPATH, SHELL_ID_NOT_RETRIEVED); } WSManRemoteShellService();  WSManRemoteShellService(PSEdition psEdition); Map<String, String> runCommand(WSManRequestInputs wsManRequestInputs);  }