From 12f0eb045f34d8d2d7627f3cca1e89195784d41c Mon Sep 17 00:00:00 2001 From: nireeshT Date: Mon, 22 Mar 2021 13:41:57 -0400 Subject: [PATCH] Logging changes for ClientReference / associate build to TestResult : null check for buildUrl (#199) --- pom.xml | 2 +- .../service/TestResultServiceImpl.java | 26 ++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 9aa37f67..e1c9a5f4 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ api jar ${project.groupId}:${project.artifactId} - 3.4.8-SNAPSHOT + 3.4.9-SNAPSHOT Hygieia Rest API Layer https://github.com/Hygieia/api diff --git a/src/main/java/com/capitalone/dashboard/service/TestResultServiceImpl.java b/src/main/java/com/capitalone/dashboard/service/TestResultServiceImpl.java index bc30ef13..293dc307 100644 --- a/src/main/java/com/capitalone/dashboard/service/TestResultServiceImpl.java +++ b/src/main/java/com/capitalone/dashboard/service/TestResultServiceImpl.java @@ -627,18 +627,20 @@ private TestResult createTestCucumber(CollectorItem collectorItem, CucumberJsonR } private void associateBuildToTestResult(String buildUrl, String clientReference, TestResult testResult){ - Build build = buildRepository.findByBuildUrl(buildUrl); - if(Objects.nonNull(build)){ - build.setClientReference(clientReference); - testResult.setBuildId(build.getId()); - buildRepository.save(build); - }else{ - Build baseBuild = new Build(); - baseBuild.setBuildUrl(buildUrl); - baseBuild.setBuildStatus(BuildStatus.InProgress); - baseBuild.setClientReference(clientReference); - baseBuild = buildRepository.save(baseBuild); - testResult.setBuildId(baseBuild.getId()); + if(Objects.nonNull(buildUrl)){ + Build build = buildRepository.findByBuildUrl(buildUrl); + if(Objects.nonNull(build)){ + build.setClientReference(clientReference); + testResult.setBuildId(build.getId()); + buildRepository.save(build); + }else{ + Build baseBuild = new Build(); + baseBuild.setBuildUrl(buildUrl); + baseBuild.setBuildStatus(BuildStatus.InProgress); + baseBuild.setClientReference(clientReference); + baseBuild = buildRepository.save(baseBuild); + testResult.setBuildId(baseBuild.getId()); + } } }