Title: [41351] trunk/hudson/plugins/klaros-testmanagement/src/main/java/hudson/plugins/klaros/KlarosTestResultPublisher.java: JENKINS-28659 - Add proper migration of test result path settings for existing projects.
Revision
41351
Author
stolp
Date
2015-05-31 16:59:50 -0400 (Sun, 31 May 2015)

Log Message

JENKINS-28659 - Add proper migration of test result path settings for existing projects.

Modified Paths

Diff

Modified: trunk/hudson/plugins/klaros-testmanagement/src/main/java/hudson/plugins/klaros/KlarosTestResultPublisher.java (41350 => 41351)


--- trunk/hudson/plugins/klaros-testmanagement/src/main/java/hudson/plugins/klaros/KlarosTestResultPublisher.java	2015-05-30 15:23:34 UTC (rev 41350)
+++ trunk/hudson/plugins/klaros-testmanagement/src/main/java/hudson/plugins/klaros/KlarosTestResultPublisher.java	2015-05-31 20:59:50 UTC (rev 41351)
@@ -94,7 +94,7 @@
 
     /**
      * The path test results.
-     * 
+     *
      * @deprecated since 1.5
      */
     private String pathTestResults;
@@ -138,12 +138,8 @@
         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 = ""
         this.username = username;
         this.password = password;
@@ -328,16 +324,28 @@
      */
     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;
+        }
+    }
+
+    /**
      * Gets the result sets.
      *
      * @return the result sets
      */
     public ResultSet[] getResultSets() {
 
+        migratePathTestResults();
         return resultSets;
     }
 

--
You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to