[UI] Messages in Keywords
[validation.git] / ui / src / main / java / org / akraino / validation / ui / client / nexus / NexusExecutorClient.java
index 30206bf..685f1e8 100644 (file)
@@ -20,8 +20,6 @@ import java.net.HttpURLConnection;
 import java.net.InetSocketAddress;
 import java.net.Proxy;
 import java.net.URL;
-import java.security.KeyManagementException;
-import java.security.NoSuchAlgorithmException;
 import java.text.DateFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -38,10 +36,15 @@ import javax.annotation.Nonnull;
 import org.akraino.validation.ui.client.nexus.resources.RobotTestResult;
 import org.akraino.validation.ui.client.nexus.resources.Status;
 import org.akraino.validation.ui.client.nexus.resources.TestInfoYaml;
-import org.akraino.validation.ui.client.nexus.resources.ValidationNexusTestResult;
 import org.akraino.validation.ui.client.nexus.resources.WRobotNexusTestResult;
-import org.akraino.validation.ui.data.BlueprintLayer;
+import org.akraino.validation.ui.entity.Blueprint;
+import org.akraino.validation.ui.entity.BlueprintInstance;
+import org.akraino.validation.ui.entity.LabInfo;
+import org.akraino.validation.ui.entity.ValidationDbTestResult;
+import org.akraino.validation.ui.entity.WRobotDbTestResult;
+import org.akraino.validation.ui.service.DbAdapter;
 import org.apache.commons.httpclient.HttpException;
+import org.json.JSONException;
 import org.json.JSONObject;
 import org.json.XML;
 import org.jsoup.Jsoup;
@@ -50,18 +53,16 @@ import org.jsoup.nodes.Element;
 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
 import org.onap.portalsdk.core.onboarding.util.PortalApiProperties;
 import org.onap.portalsdk.core.web.support.UserUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
 import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.ClientHandlerException;
 import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.UniformInterfaceException;
 import com.sun.jersey.api.client.WebResource;
 import com.sun.jersey.api.client.config.ClientConfig;
 import com.sun.jersey.api.client.config.DefaultClientConfig;
@@ -72,6 +73,9 @@ import com.sun.jersey.client.urlconnection.URLConnectionClientHandler;
 @Service
 public final class NexusExecutorClient {
 
+    @Autowired
+    DbAdapter dbAdapter;
+
     private static final EELFLoggerDelegate LOGGER = EELFLoggerDelegate.getLogger(NexusExecutorClient.class);
 
     private final Client client;
@@ -105,8 +109,7 @@ public final class NexusExecutorClient {
     }
 
     public List<String> getResource(String endpoint)
-            throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
-            IOException, KeyManagementException, NoSuchAlgorithmException, ParseException {
+            throws IndexOutOfBoundsException, HttpException, NullPointerException {
         List<String> resources = new ArrayList<String>();
         String nexusUrl = this.baseurl;
         if (endpoint != null) {
@@ -132,24 +135,20 @@ public final class NexusExecutorClient {
     }
 
     public List<String> getResource(@Nonnull String endpoint1, @Nonnull String endpoint2)
-            throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
-            IOException, KeyManagementException, NoSuchAlgorithmException, ParseException {
+            throws IndexOutOfBoundsException, HttpException, NullPointerException {
         String endpoint = endpoint1 + "/" + endpoint2;
         return this.getResource(endpoint);
     }
 
     public List<String> getResource(@Nonnull String endpoint1, @Nonnull String endpoint2, @Nonnull String endpoint3)
-            throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
-            IOException, KeyManagementException, NoSuchAlgorithmException, ParseException {
+            throws IndexOutOfBoundsException, HttpException, NullPointerException {
         String endpoint = endpoint1 + "/" + endpoint2 + "/" + endpoint3;
         return this.getResource(endpoint);
     }
 
-    public ValidationNexusTestResult getResult(@Nonnull String name, @Nonnull String version, @Nonnull String siloText,
-            @Nonnull String timestamp)
-                    throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
-                    IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException {
-        String nexusUrl = this.baseurl + "/" + siloText + "/" + name + "/" + version;
+    public ValidationDbTestResult getResult(@Nonnull String name, @Nonnull String version, @Nonnull String siloText,
+            @Nonnull String timestamp) throws IndexOutOfBoundsException, HttpException, NullPointerException {
+        String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version;
         LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get validation nexus test result");
         WebResource webResource = this.client.resource(nexusUrl + "/");
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "Request URI of get: " + webResource.getURI().toString());
@@ -165,33 +164,54 @@ public final class NexusExecutorClient {
         if (element == null) {
             return null;
         }
-        ValidationNexusTestResult vNexusResult = new ValidationNexusTestResult();
-        vNexusResult.setBlueprintName(name);
-        vNexusResult.setSilo(siloText);
-        vNexusResult.setVersion(version);
-        vNexusResult.setTimestamp(timestamp);
+        ValidationDbTestResult vDbResult = new ValidationDbTestResult();
+        Blueprint blueprint = new Blueprint();
+        blueprint.setBlueprintName(name);
+        BlueprintInstance blueInst = new BlueprintInstance();
+        blueInst.setBlueprint(blueprint);
+        blueInst.setVersion(version);
+        vDbResult.setBlueprintInstance(blueInst);
+        LabInfo lab = new LabInfo();
+        lab.setSilo(siloText);
+        vDbResult.setLab(lab);
+        vDbResult.setTimestamp(timestamp);
         String lastModified = element.getElementsByTag("td").get(1).text();
-        vNexusResult.setDateOfStorage(lastModified);
+        vDbResult.setDateStorage(lastModified);
         TestInfoYaml testInfo = getTestInfo(webResource.getURI().toString() + timestamp);
         if (testInfo != null) {
             if (testInfo.gettest_info().getLayer().equals("all")) {
-                vNexusResult.setAllLayers(true);
+                vDbResult.setAllLayers(true);
             } else {
-                vNexusResult.setAllLayers(false);
+                vDbResult.setAllLayers(false);
             }
-            vNexusResult.setOptional(testInfo.gettest_info().getOptional());
+            vDbResult.setOptional(testInfo.gettest_info().getOptional());
         }
         List<WRobotNexusTestResult> wTestResults = getWRobotTestResults(name, version, siloText, timestamp);
-        vNexusResult.setwRobotNexusTestResults(wTestResults);
-        vNexusResult.setResult(determineResult(wTestResults));
-        return vNexusResult;
+        if (wTestResults.size() < 1) {
+            return null;
+        }
+        vDbResult.setResult(determineResult(wTestResults));
+        List<WRobotDbTestResult> wDbResults = new ArrayList<WRobotDbTestResult>();
+        for (WRobotNexusTestResult wTestResult : wTestResults) {
+            try {
+                WRobotDbTestResult wDbResult = new WRobotDbTestResult();
+                wDbResult.setLayer(wTestResult.getLayer());
+                ObjectMapper mapper = new ObjectMapper();
+                wDbResult.setRobotTestResults(mapper.writeValueAsString(wTestResult.getRobotNexusTestResults()));
+                wDbResults.add(wDbResult);
+            } catch (JsonProcessingException e) {
+                LOGGER.warn(EELFLoggerDelegate.auditLogger,
+                        "Exception occured while processing JSON. " + UserUtils.getStackTrace(e));
+            }
+        }
+        vDbResult.setWRobotDbTestResults(new HashSet<WRobotDbTestResult>(wDbResults));
+        return vDbResult;
     }
 
-    public List<ValidationNexusTestResult> getResults(@Nonnull String name, @Nonnull String version,
+    public List<ValidationDbTestResult> getResults(@Nonnull String name, @Nonnull String version,
             @Nonnull String siloText, int noOfLastElements)
-                    throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
-                    IOException, KeyManagementException, NoSuchAlgorithmException, ParseException {
-        String nexusUrl = this.baseurl + "/" + siloText + "/" + name + "/" + version;
+            throws IndexOutOfBoundsException, HttpException, NullPointerException {
+        String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version;
         LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get validation Nexus test results");
         WebResource webResource = this.client.resource(nexusUrl + "/");
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "Request URI of get: " + webResource.getURI().toString());
@@ -200,31 +220,51 @@ public final class NexusExecutorClient {
             throw new HttpException("Could not retrieve validation Nexus test results. HTTP error code : "
                     + response.getStatus() + " and message: " + response.getEntity(String.class));
         }
-        List<ValidationNexusTestResult> vNexusResults = new ArrayList<ValidationNexusTestResult>();
+        List<ValidationDbTestResult> vDbResults = new ArrayList<ValidationDbTestResult>();
         Document document = Jsoup.parse(response.getEntity(String.class));
         List<Element> elements = document.getElementsByTag("body").get(0).getElementsByTag("table").get(0)
                 .getElementsByTag("tbody").get(0).getElementsByTag("tr");
         elements = findLastElementsByDate(elements.subList(2, elements.size()), noOfLastElements);
         for (int i = 0; i < elements.size(); i++) {
+            String timestamp = null;
             try {
-                String timestamp = elements.get(i).getElementsByTag("td").get(0).getElementsByTag("a").get(0).text();
+                timestamp = elements.get(i).getElementsByTag("td").get(0).getElementsByTag("a").get(0).text();
                 timestamp = timestamp.substring(0, timestamp.length() - 1);
-                ValidationNexusTestResult vNexusResult = this.getResult(name, version, siloText, timestamp);
-                vNexusResults.add(vNexusResult);
-            } catch (HttpException ex) {
-                LOGGER.warn(EELFLoggerDelegate.auditLogger, "Exception occured while retrieving timestamp results");
-                continue;
+                ValidationDbTestResult vDbResult = dbAdapter.getValidationTestResult(siloText, timestamp);
+                if (vDbResult == null || vDbResult.getDateStorage() == null) {
+                    ValidationDbTestResult vDbResult2 = this.getResult(name, version, siloText, timestamp);
+                    if (vDbResult2 == null) {
+                        continue;
+                    }
+                    vDbResults.add(vDbResult2);
+                } else {
+                    // Just to avoid deletion of already received validation timestamp results
+                    vDbResult = new ValidationDbTestResult();
+                    Blueprint blueprint = new Blueprint();
+                    blueprint.setBlueprintName(name);
+                    BlueprintInstance blueInst = new BlueprintInstance();
+                    blueInst.setBlueprint(blueprint);
+                    blueInst.setVersion(version);
+                    vDbResult.setBlueprintInstance(blueInst);
+                    LabInfo lab = new LabInfo();
+                    lab.setSilo(siloText);
+                    vDbResult.setLab(lab);
+                    vDbResult.setTimestamp(timestamp);
+                    vDbResults.add(vDbResult);
+                }
+            } catch (HttpException | IndexOutOfBoundsException | NullPointerException ex) {
+                LOGGER.warn(EELFLoggerDelegate.auditLogger, "Exception occured while retrieving timestamp : "
+                        + timestamp + " result." + UserUtils.getStackTrace(ex));
             }
         }
-        return vNexusResults;
+        return vDbResults;
     }
 
-    public List<ValidationNexusTestResult> getResults(@Nonnull String name, @Nonnull String version,
+    public List<ValidationDbTestResult> getResults(@Nonnull String name, @Nonnull String version,
             @Nonnull String siloText, @Nonnull Date date)
-                    throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
-                    IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException {
-        String nexusUrl = this.baseurl + "/" + siloText + "/" + name + "/" + version;
-        LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get validation Nexus results based on date");
+            throws IndexOutOfBoundsException, HttpException, NullPointerException, ParseException {
+        String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version;
+        LOGGER.debug(EELFLoggerDelegate.applicationLogger, "Trying to get validation Nexus results based on date");
         WebResource webResource = this.client.resource(nexusUrl + "/");
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "Request URI of get: " + webResource.getURI().toString());
         ClientResponse response = webResource.get(ClientResponse.class);
@@ -232,7 +272,7 @@ public final class NexusExecutorClient {
             throw new HttpException("Could not retrieve validation Nexus results based on date. HTTP error code : "
                     + response.getStatus() + " and message: " + response.getEntity(String.class));
         }
-        List<ValidationNexusTestResult> vNexusResults = new ArrayList<ValidationNexusTestResult>();
+        List<ValidationDbTestResult> vDbResults = new ArrayList<ValidationDbTestResult>();
         Document document = Jsoup.parse(response.getEntity(String.class));
         List<Element> elements = document.getElementsByTag("body").get(0).getElementsByTag("table").get(0)
                 .getElementsByTag("tbody").get(0).getElementsByTag("tr");
@@ -241,21 +281,23 @@ public final class NexusExecutorClient {
             try {
                 String timestamp = elements.get(i).getElementsByTag("td").get(0).getElementsByTag("a").get(0).text();
                 timestamp = timestamp.substring(0, timestamp.length() - 1);
-                ValidationNexusTestResult vNexusResult = this.getResult(name, version, siloText, timestamp);
-                vNexusResults.add(vNexusResult);
-            } catch (HttpException ex) {
-                LOGGER.warn(EELFLoggerDelegate.auditLogger, "Exception occured while retrieving timestamp results");
-                continue;
+                ValidationDbTestResult vDbResult = this.getResult(name, version, siloText, timestamp);
+                if (vDbResult == null) {
+                    continue;
+                }
+                vDbResults.add(vDbResult);
+            } catch (HttpException | IndexOutOfBoundsException | NullPointerException ex) {
+                LOGGER.warn(EELFLoggerDelegate.auditLogger,
+                        "Exception occured while retrieving timestamp results. " + UserUtils.getStackTrace(ex));
             }
         }
-        return vNexusResults;
+        return vDbResults;
     }
 
-    public ValidationNexusTestResult getLastResultBasedOnOutcome(@Nonnull String name, @Nonnull String version,
-            @Nonnull String siloText, List<BlueprintLayer> layers, Boolean optional, boolean outcome)
-                    throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
-                    IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException {
-        String nexusUrl = this.baseurl + "/" + siloText + "/" + name + "/" + version;
+    public ValidationDbTestResult getLastResultBasedOnOutcome(@Nonnull String name, @Nonnull String version,
+            @Nonnull String siloText, List<String> layers, Boolean optional, boolean outcome)
+            throws IndexOutOfBoundsException, HttpException, NullPointerException {
+        String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version;
         LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get last result based on outcome");
         WebResource webResource = this.client.resource(nexusUrl + "/");
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "Request URI of get: " + webResource.getURI().toString());
@@ -289,37 +331,38 @@ public final class NexusExecutorClient {
             try {
                 String elementTimestamp = element.getElementsByTag("td").get(0).getElementsByTag("a").get(0).text();
                 elementTimestamp = elementTimestamp.substring(0, elementTimestamp.length() - 1);
-                ValidationNexusTestResult vNexusResult = this.getResult(name, version, siloText, elementTimestamp);
-                if (vNexusResult.getResult() != outcome) {
+                ValidationDbTestResult vDbResult = this.getResult(name, version, siloText, elementTimestamp);
+                if (vDbResult == null) {
                     continue;
                 }
-                if (optional != null && vNexusResult.getOptional() != optional) {
+                if (vDbResult.getResult() != outcome) {
+                    continue;
+                }
+                if (optional != null && vDbResult.getOptional() != optional) {
                     continue;
                 }
                 if (layers != null) {
-                    List<BlueprintLayer> storedLayers = new ArrayList<BlueprintLayer>();
-                    for (WRobotNexusTestResult wRobot : vNexusResult.getwRobotNexusTestResults()) {
-                        storedLayers.add(wRobot.getBlueprintLayer());
+                    List<String> storedLayers = new ArrayList<String>();
+                    for (WRobotDbTestResult wRobot : vDbResult.getWRobotDbTestResults()) {
+                        storedLayers.add(wRobot.getLayer());
                     }
                     if (!new HashSet<>(storedLayers).equals(new HashSet<>(layers))) {
                         continue;
                     }
                 }
-                return vNexusResult;
-            } catch (HttpException ex) {
+                return vDbResult;
+            } catch (HttpException | IndexOutOfBoundsException | NullPointerException ex) {
                 LOGGER.warn(EELFLoggerDelegate.auditLogger,
                         "Error when trying to retrieve results. " + UserUtils.getStackTrace(ex));
-                continue;
             }
         }
         return null;
     }
 
-    public ValidationNexusTestResult getLastResultBasedOnOutcome(@Nonnull String name, @Nonnull String version,
+    public ValidationDbTestResult getLastResultBasedOnOutcome(@Nonnull String name, @Nonnull String version,
             @Nonnull String siloText, Boolean allLayers, Boolean optional, boolean outcome)
-                    throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
-                    IOException, KeyManagementException, NoSuchAlgorithmException, ParseException, NullPointerException {
-        String nexusUrl = this.baseurl + "/" + siloText + "/" + name + "/" + version;
+            throws IndexOutOfBoundsException, HttpException, NullPointerException {
+        String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version;
         LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get last result based on outcome");
         WebResource webResource = this.client.resource(nexusUrl + "/");
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "Request URI of get: " + webResource.getURI().toString());
@@ -353,21 +396,23 @@ public final class NexusExecutorClient {
             try {
                 String elementTimestamp = element.getElementsByTag("td").get(0).getElementsByTag("a").get(0).text();
                 elementTimestamp = elementTimestamp.substring(0, elementTimestamp.length() - 1);
-                ValidationNexusTestResult vNexusResult = this.getResult(name, version, siloText, elementTimestamp);
-                if (vNexusResult.getResult() != outcome) {
+                ValidationDbTestResult vDbResult = this.getResult(name, version, siloText, elementTimestamp);
+                if (vDbResult == null) {
+                    continue;
+                }
+                if (vDbResult.getResult() != outcome) {
                     continue;
                 }
-                if (optional != null && vNexusResult.getOptional() != optional) {
+                if (optional != null && vDbResult.getOptional() != optional) {
                     continue;
                 }
-                if (allLayers != null && vNexusResult.getAllLayers() != allLayers) {
+                if (allLayers != null && vDbResult.getAllLayers() != allLayers) {
                     continue;
                 }
-                return vNexusResult;
-            } catch (HttpException ex) {
+                return vDbResult;
+            } catch (HttpException | IndexOutOfBoundsException | NullPointerException ex) {
                 LOGGER.warn(EELFLoggerDelegate.auditLogger,
                         "Error when trying to retrieve results. " + UserUtils.getStackTrace(ex));
-                continue;
             }
         }
         return null;
@@ -375,10 +420,10 @@ public final class NexusExecutorClient {
 
     public List<WRobotNexusTestResult> getWRobotTestResults(@Nonnull String name, @Nonnull String version,
             @Nonnull String siloText, @Nonnull String timestamp)
-                    throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
-                    IOException, KeyManagementException, NoSuchAlgorithmException {
-        String nexusUrl = this.baseurl + "/" + siloText + "/" + name + "/" + version + "/" + timestamp + "/results";
-        List<WRobotNexusTestResult> listOfwrappers = new ArrayList<WRobotNexusTestResult>();
+            throws IndexOutOfBoundsException, HttpException, NullPointerException {
+        String nexusUrl = this.baseurl + "/" + siloText + "/" + "bluval_results/" + name + "/" + version + "/"
+                + timestamp + "/results";
+        List<WRobotNexusTestResult> listOfWrappers = new ArrayList<WRobotNexusTestResult>();
         LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get the blueprint layers");
         WebResource webResource = this.client.resource(nexusUrl + "/");
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "Request URI of get: " + webResource.getURI().toString());
@@ -394,25 +439,27 @@ public final class NexusExecutorClient {
             try {
                 String layer = elements.get(i).getElementsByTag("td").get(0).getElementsByTag("a").get(0).text();
                 layer = layer.substring(0, layer.length() - 1);
-                if (layer.contains("test")) {
+                if (layer.contains("test") || layer.contains("service") || layer.contains("home")) {
                     continue;
                 }
                 List<RobotTestResult> robotTestResults = getRobotTestResults(nexusUrl + "/" + layer);
+                if (robotTestResults.size() < 1) {
+                    continue;
+                }
                 WRobotNexusTestResult wrapper = new WRobotNexusTestResult();
-                wrapper.setBlueprintLayer(BlueprintLayer.valueOf(layer));
-                wrapper.setRobotTestResults(robotTestResults);
-                listOfwrappers.add(wrapper);
-            } catch (HttpException | IllegalArgumentException ex) {
-                LOGGER.warn(EELFLoggerDelegate.auditLogger, "Exception occured while retrieving robot results");
-                continue;
+                wrapper.setLayer(layer);
+                wrapper.setRobotNexusTestResults(robotTestResults);
+                listOfWrappers.add(wrapper);
+            } catch (IndexOutOfBoundsException | HttpException | NullPointerException ex) {
+                LOGGER.warn(EELFLoggerDelegate.auditLogger,
+                        "Exception occured while retrieving wrapped robot results. " + UserUtils.getStackTrace(ex));
             }
         }
-        return listOfwrappers;
+        return listOfWrappers;
     }
 
     private List<RobotTestResult> getRobotTestResults(String resultsUrl)
-            throws ClientHandlerException, UniformInterfaceException, JsonParseException, JsonMappingException,
-            IOException, KeyManagementException, NoSuchAlgorithmException {
+            throws IndexOutOfBoundsException, HttpException, NullPointerException {
         List<RobotTestResult> rTestResults = new ArrayList<RobotTestResult>();
         LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get test suites results");
         WebResource webResource = this.client.resource(resultsUrl + "/");
@@ -426,24 +473,35 @@ public final class NexusExecutorClient {
         List<Element> elements = document.getElementsByTag("body").get(0).getElementsByTag("table").get(0)
                 .getElementsByTag("tbody").get(0).getElementsByTag("tr");
         for (int i = 2; i < elements.size(); i++) {
-            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);
+                try {
+                    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.error(EELFLoggerDelegate.errorLogger, "Exception occured while deserializing for resource "
+                            + resultsUrl + " " + UserUtils.getStackTrace(ex));
+                }
+            } catch (IOException | JSONException ex) {
+                LOGGER.warn(EELFLoggerDelegate.auditLogger, "Exception occured while retrieving robot results from "
+                        + resultsUrl + " . " + UserUtils.getStackTrace(ex));
             }
-            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);
         }
         return rTestResults;
     }
@@ -451,7 +509,7 @@ public final class NexusExecutorClient {
     private boolean determineResult(List<WRobotNexusTestResult> wTestResults) {
         boolean result = true;
         for (WRobotNexusTestResult wTestResult : wTestResults) {
-            for (RobotTestResult robotTestResult : wTestResult.getRobotTestResults()) {
+            for (RobotTestResult robotTestResult : wTestResult.getRobotNexusTestResults()) {
                 for (Status status : robotTestResult.getRobot().getStatistics().getTotal().getStat()) {
                     if (status.getContent().trim().equals("All Tests") && status.getFail() > 0) {
                         result = false;
@@ -507,22 +565,30 @@ public final class NexusExecutorClient {
         return desiredElements;
     }
 
-    private TestInfoYaml getTestInfo(String timestampUrl) throws JsonParseException, JsonMappingException, IOException {
+    private TestInfoYaml getTestInfo(String timestampUrl) {
         LOGGER.info(EELFLoggerDelegate.applicationLogger, "Trying to get test info");
         WebResource webResource = this.client.resource(timestampUrl + "/results/test_info.yaml");
         LOGGER.debug(EELFLoggerDelegate.debugLogger, "Request URI of get: " + webResource.getURI().toString());
         ClientResponse response = webResource.get(ClientResponse.class);
         if (response.getStatus() != 200) {
+            LOGGER.warn(EELFLoggerDelegate.auditLogger, "No test_info.yaml file was found");
+            return null;
+        }
+        try {
+            String testInfo = response.getEntity(String.class);
+            ObjectMapper yamlReader = new ObjectMapper(new YAMLFactory());
+            Object obj;
+            obj = yamlReader.readValue(testInfo, Object.class);
+            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);
+            ObjectMapper jsonWriter = new ObjectMapper();
+            return mapper.readValue(jsonWriter.writeValueAsString(obj), TestInfoYaml.class);
+        } catch (IOException e) {
+            LOGGER.error(EELFLoggerDelegate.errorLogger,
+                    "Error when parsing test_info.yaml file. " + UserUtils.getStackTrace(e));
             return null;
         }
-        String testInfo = response.getEntity(String.class);
-        ObjectMapper yamlReader = new ObjectMapper(new YAMLFactory());
-        Object obj = yamlReader.readValue(testInfo, Object.class);
-        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);
-        ObjectMapper jsonWriter = new ObjectMapper();
-        return mapper.readValue(jsonWriter.writeValueAsString(obj), TestInfoYaml.class);
     }
 }