Skip to content
Permalink
Browse files
Merge pull request #273 from engycz/JENKINS-31800
Fix projectListRefreshInterval zero value after upgrade from 2.13.0 to 2.14.0
  • Loading branch information
rsandell committed Jan 5, 2016
2 parents 82faa6e + 78f4c5c commit ba1c6cb7712f4544df31cada3b4f83b181b428d7
Showing 4 changed files with 18 additions and 15 deletions.
@@ -1260,19 +1260,6 @@ public FormValidation doDynamicConfigRefreshCheck(
return FormValidation.ok();
}

/**
* Checks that the provided parameter is an integer, not negative.
*
* @param value the value.
* @return {@link FormValidation#validatePositiveInteger(String)}
*/
public FormValidation doProjectListFetchDelayCheck(
@QueryParameter("value")
final String value) {

return FormValidation.validateNonNegativeInteger(value);
}

/**
* Checks that the provided parameter is an integer.
* @param value the value.
@@ -644,6 +644,9 @@ public int getProjectListFetchDelay() {

@Override
public int getProjectListRefreshInterval() {
if (projectListRefreshInterval == 0) {
projectListRefreshInterval = DEFAULT_PROJECT_LIST_REFRESH_INTERVAL;
}
return projectListRefreshInterval;
}

@@ -251,7 +251,7 @@
<f:textbox name="projectListFetchDelay"
value="${it.config.projectListFetchDelay}"
default="${com.sonyericsson.gerrithudsontrigger.config.Config.DEFAULT_PROJECT_LIST_FETCH_DELAY}"
checkUrl="'${rootURL}/${serverURL}/projectListFetchDelayCheck?value='+escape(this.value)"
checkUrl="'${rootURL}/${serverURL}/nonNegativeIntegerCheck?value='+escape(this.value)"
style="max-width: 100px;"/>
</div>
</div>
@@ -263,7 +263,7 @@
<f:textbox name="projectListRefreshInterval"
value="${it.config.projectListRefreshInterval}"
default="${com.sonyericsson.gerrithudsontrigger.config.Config.DEFAULT_PROJECT_LIST_REFRESH_INTERVAL}"
checkUrl="'${rootURL}/${serverURL}/projectListFetchDelayCheck?value='+escape(this.value)"
checkUrl="'${rootURL}/${serverURL}/positiveIntegerCheck?value='+escape(this.value)"
style="max-width: 100px;"/>
</div>
</div>
@@ -139,6 +139,19 @@ public void testSetValues() {

//CS IGNORE MagicNumber FOR NEXT 100 LINES. REASON: Mocks tests.

/**
* Test ProjectListRefreshInterval zero value after upgrade from gerrit-trigger version 2.13.0 to 2.14.0.
*/
@Test
public void testProjectListRefreshIntervalZeroValue() {
String formString = "{\"projectListRefreshInterval\":\"0\"}";
JSONObject form = (JSONObject)JSONSerializer.toJSON(formString);
Config config = new Config(form);
assertEquals(config.DEFAULT_PROJECT_LIST_REFRESH_INTERVAL, config.getProjectListRefreshInterval());
}

//CS IGNORE MagicNumber FOR NEXT 100 LINES. REASON: Mocks tests.

/**
* Test creation of a config object from an existing one.
*/

0 comments on commit ba1c6cb

Please sign in to comment.