|
1 | 1 | package org.ihtsdo.rvf.core.service;
|
2 | 2 |
|
3 |
| -import org.apache.commons.lang3.exception.ExceptionUtils; |
| 3 | + |
4 | 4 | import org.ihtsdo.otf.rest.client.RestClientException;
|
5 | 5 | import org.ihtsdo.otf.rest.exception.BusinessServiceException;
|
| 6 | +import org.ihtsdo.otf.utils.ExceptionUtils; |
6 | 7 | import org.ihtsdo.rvf.core.data.model.*;
|
7 | 8 | import org.ihtsdo.rvf.core.service.config.MysqlExecutionConfig;
|
8 | 9 | import org.ihtsdo.rvf.core.service.config.ValidationRunConfig;
|
@@ -76,25 +77,30 @@ public ValidationStatusReport runRF2MysqlValidations(ValidationRunConfig validat
|
76 | 77 | }
|
77 | 78 |
|
78 | 79 | String reportStorage = validationConfig.getStorageLocation();
|
| 80 | + String lastItemLoadAttempted = "Item Unknown"; |
79 | 81 | try {
|
80 | 82 | // prepare release data for testing
|
| 83 | + lastItemLoadAttempted = "Previous Release - " + executionConfig.getPreviousVersion(); |
81 | 84 | releaseVersionLoader.loadPreviousVersion(executionConfig);
|
82 | 85 | if (releaseVersionLoader.isUnknownVersion(executionConfig.getPreviousVersion())) {
|
83 | 86 | statusReport.addFailureMessage("Failed to load previous release " + executionConfig.getPreviousVersion());
|
84 | 87 | }
|
85 | 88 |
|
86 | 89 | // load dependency release
|
87 | 90 | releaseVersionLoader.loadDependencyVersion(executionConfig);
|
| 91 | + lastItemLoadAttempted = "Dependency Release - " + executionConfig.getExtensionDependencyVersion(); |
88 | 92 | if (releaseVersionLoader.isUnknownVersion(executionConfig.getExtensionDependencyVersion())) {
|
89 | 93 | statusReport.addFailureMessage("Failed to load dependency release " + executionConfig.getExtensionDependencyVersion());
|
90 | 94 | }
|
91 | 95 | // load prospective version
|
| 96 | + lastItemLoadAttempted = "Prospective Release - " + executionConfig.getProspectiveVersion(); |
92 | 97 | releaseVersionLoader.loadProspectiveVersion(statusReport, executionConfig, validationConfig);
|
93 | 98 | } catch (Exception e) {
|
94 |
| - String errorMsg = String.format("Failed to load data into MySql due to %s", ExceptionUtils.getRootCauseMessage(e)); |
95 |
| - LOGGER.error(errorMsg, e); |
96 |
| - statusReport.addFailureMessage(errorMsg); |
97 |
| - statusReport.getReportSummary().put(TestType.SQL.name(), errorMsg); |
| 99 | + String errorMsg = String.format("Failed to load data (%s) into MySql", lastItemLoadAttempted); |
| 100 | + String errorMsgWithCause = ExceptionUtils.getExceptionCause(errorMsg, e); |
| 101 | + LOGGER.error(errorMsgWithCause, e); |
| 102 | + statusReport.addFailureMessage(errorMsgWithCause); |
| 103 | + statusReport.getReportSummary().put(TestType.SQL.name(), errorMsgWithCause); |
98 | 104 | return statusReport;
|
99 | 105 | }
|
100 | 106 | if (executionConfig.isExtensionValidation()) {
|
@@ -138,10 +144,10 @@ private void runExtensionReleaseValidation(ValidationStatusReport statusReport,
|
138 | 144 | releaseVersionLoader.combineCurrentExtensionWithDependencySnapshot(executionConfig, validationConfig);
|
139 | 145 | this.legacyProspectiveVersions.add(executionConfig.getProspectiveVersion());
|
140 | 146 | } catch (BusinessServiceException e) {
|
141 |
| - String msg = String.format("Failed to prepare data for extension testing due to error %s", ExceptionUtils.getRootCauseMessage(e)); |
142 |
| - statusReport.addFailureMessage(msg); |
143 |
| - LOGGER.error(msg, e); |
144 |
| - statusReport.getReportSummary().put(TestType.SQL.name(), msg); |
| 147 | + String errMsg = ExceptionUtils.getExceptionCause("Failed to prepare data for extension testing", e); |
| 148 | + statusReport.addFailureMessage(errMsg); |
| 149 | + LOGGER.error(errMsg, e); |
| 150 | + statusReport.getReportSummary().put(TestType.SQL.name(), errMsg); |
145 | 151 | }
|
146 | 152 | }
|
147 | 153 | testItems.addAll(runAssertionTests(executionConfig, noneReleaseTypeAssertions, reportStorage, true));
|
@@ -289,7 +295,7 @@ private void constructTestReport(ValidationStatusReport statusReport, MysqlExecu
|
289 | 295 | report.addFailedAssertions(Collections.emptyList());
|
290 | 296 | report.addWarningAssertions(Collections.emptyList());
|
291 | 297 | report.addPassedAssertions(Collections.emptyList());
|
292 |
| - statusReport.addFailureMessage(String.format("Failed to extract test results caused by %s", ExceptionUtils.getRootCauseMessage(exception))); |
| 298 | + statusReport.addFailureMessage(ExceptionUtils.getExceptionCause("Failed to extract test results",exception)); |
293 | 299 | }
|
294 | 300 |
|
295 | 301 | final long timeEnd = System.currentTimeMillis();
|
|
0 commit comments