- String testSuiteName = elements.get(i).getElementsByTag("td").get(0).getElementsByTag("a").get(0).text();
- testSuiteName = testSuiteName.substring(0, testSuiteName.length() - 1);
- webResource = this.client.resource(resultsUrl + "/" + testSuiteName + "/output.xml");
- LOGGER.debug(EELFLoggerDelegate.debugLogger, "Request URI of get: " + webResource.getURI().toString());
- response = webResource.get(ClientResponse.class);
- if (response.getStatus() != 200) {
- throw new HttpException("Could not retrieve test suite result from Nexus. HTTP error code : "
- + response.getStatus() + " and message: " + response.getEntity(String.class));
+ try {
+ String testSuiteName = elements.get(i).getElementsByTag("td").get(0).getElementsByTag("a").get(0)
+ .text();
+ testSuiteName = testSuiteName.substring(0, testSuiteName.length() - 1);
+ webResource = this.client.resource(resultsUrl + "/" + testSuiteName + "/output.xml");
+ LOGGER.debug(EELFLoggerDelegate.debugLogger, "Request URI of get: " + webResource.getURI().toString());
+ response = webResource.get(ClientResponse.class);
+ if (response.getStatus() != 200) {
+ throw new HttpException("Could not retrieve test suite result from Nexus. HTTP error code : "
+ + response.getStatus() + " and message: " + response.getEntity(String.class));
+ }
+ String result = response.getEntity(String.class);
+ JSONObject xmlJSONObj = XML.toJSONObject(result);
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
+ mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
+ mapper.setSerializationInclusion(Include.NON_NULL);
+ RobotTestResult robotTestResult = mapper.readValue(xmlJSONObj.toString(), RobotTestResult.class);
+ robotTestResult.setName(testSuiteName);
+ rTestResults.add(robotTestResult);
+ } catch (Exception ex) {
+ LOGGER.warn(EELFLoggerDelegate.auditLogger,
+ "Exception occured while retrieving robot results. " + UserUtils.getStackTrace(ex));
+ continue;