Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
JENKINS-28659 - Add proper migration of test result path settings for…
… existing projects.
  • Loading branch information
stolp committed May 31, 2015
1 parent c056393 commit 8ef8f77
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/main/java/hudson/plugins/klaros/KlarosTestResultPublisher.java
Expand Up @@ -94,7 +94,7 @@ public class KlarosTestResultPublisher extends Recorder implements Serializable

/**
* The path test results.
*
*
* @deprecated since 1.5
*/
private String pathTestResults;
Expand Down Expand Up @@ -138,12 +138,8 @@ public KlarosTestResultPublisher(final String config, final String iteration, fi
this.env = env;
this.sut = sut;
this.createTestSuite = createTestSuite;
this.pathTestResults = pathTestResults;
this.resultSets = resultSets;
// Migrate old settings
if (StringUtils.isNotEmpty(pathTestResults)) {
this.resultSets = new ResultSet[]{new ResultSet(StringUtils.trim(pathTestResults)) };
}
migratePathTestResults();
this.url = url;
this.username = username;
this.password = password;
Expand Down Expand Up @@ -328,7 +324,18 @@ public String getPathTestResults() {
*/
public void setPathTestResults(final String value) {

pathTestResults = StringUtils.trim(value);
migratePathTestResults();
}

/**
* Migrate deprecated path test results setting.
*/
private void migratePathTestResults() {

if (StringUtils.isNotEmpty(pathTestResults)) {
resultSets = new ResultSet[]{new ResultSet(StringUtils.trim(pathTestResults)) };
pathTestResults = null;
}
}

/**
Expand All @@ -338,6 +345,7 @@ public void setPathTestResults(final String value) {
*/
public ResultSet[] getResultSets() {

migratePathTestResults();
return resultSets;
}

Expand Down

0 comments on commit 8ef8f77

Please sign in to comment.