HadoopLaunchHandler { int retrieveNoOfRunningTasks() throws IOException, ParserConfigurationException, SAXException, XPathExpressionException { final HttpClient httpClient = new HttpClient(); final DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); final XPathFactory xPathfactory = XPathFactory.newInstance(); String masterHost = configuration.get("yarn.resourcemanager.hostname", "cdt1"); final String searchUrl = "http: final GetMethod metricsRequest = new GetMethod(searchUrl); metricsRequest.setRequestHeader("Accept", "application/xml"); final int statusCode = httpClient.executeMethod(metricsRequest); if (statusCode > 299) { throw new IOException("search error: " + metricsRequest.getResponseBodyAsString() + " query: " + metricsRequest.getQueryString()); } InputStream response = metricsRequest.getResponseBodyAsStream(); DocumentBuilder builder = docFactory.newDocumentBuilder(); Document doc = builder.parse(response); XPath xpath = xPathfactory.newXPath(); XPathExpression expr = xpath.compile("/clusterMetrics/allocatedVirtualCores"); String coresString = (String) expr.evaluate(doc, XPathConstants.STRING); return Integer.parseInt(coresString); } HadoopLaunchHandler(Configuration configuration);  HadoopLaunchHandler(HadoopProcessingService hadoopProcessingService, Configuration configuration); void queueWorkflowItem(HadoopWorkflowItem workflowItem);  }
@Ignore @Test public void testRetrieveNoOfRunningTasks() throws ParserConfigurationException, SAXException, XPathExpressionException, IOException { Configuration configuration = new Configuration(); configuration.set("calvalus.xxx.master", "80.158.5.3"); assertEquals("", 0, new HadoopLaunchHandler(configuration).retrieveNoOfRunningTasks()); }