aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws
diff options
context:
space:
mode:
authorTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2017-07-03 18:03:09 +0200
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-07-13 14:34:17 +0200
commit6d24aaa1516a0a1b5d92eceb2495b92ccbc7182c (patch)
treebc7a956f8105dc51af9605c55838d6a29c7ba9a3 /sonar-ws
parentba96a0fbd5d10c0923be4760cf8aae251f43bb7c (diff)
downloadsonarqube-6d24aaa1516a0a1b5d92eceb2495b92ccbc7182c.tar.gz
sonarqube-6d24aaa1516a0a1b5d92eceb2495b92ccbc7182c.zip
SONAR-9476 Add from and to params in api/project_analyses/search
Diffstat (limited to 'sonar-ws')
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/ProjectAnalysesWsParameters.java2
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/SearchRequest.java26
-rw-r--r--sonar-ws/src/test/java/org/sonarqube/ws/client/projectanalysis/SearchRequestTest.java4
3 files changed, 32 insertions, 0 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/ProjectAnalysesWsParameters.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/ProjectAnalysesWsParameters.java
index 24c180e113c..2e7e42e1a0d 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/ProjectAnalysesWsParameters.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/ProjectAnalysesWsParameters.java
@@ -25,6 +25,8 @@ public class ProjectAnalysesWsParameters {
public static final String PARAM_NAME = "name";
public static final String PARAM_EVENT = "event";
public static final String PARAM_PROJECT = "project";
+ public static final String PARAM_FROM = "from";
+ public static final String PARAM_TO = "to";
private ProjectAnalysesWsParameters() {
// static access only
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/SearchRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/SearchRequest.java
index e1fbbd175cc..c067a12621c 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/SearchRequest.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/projectanalysis/SearchRequest.java
@@ -33,12 +33,16 @@ public class SearchRequest {
private final EventCategory category;
private final int page;
private final int pageSize;
+ private final String from;
+ private final String to;
private SearchRequest(Builder builder) {
this.project = builder.project;
this.category = builder.category;
this.page = builder.page;
this.pageSize = builder.pageSize;
+ this.from = builder.from;
+ this.to = builder.to;
}
public String getProject() {
@@ -58,6 +62,16 @@ public class SearchRequest {
return pageSize;
}
+ @CheckForNull
+ public String getFrom() {
+ return from;
+ }
+
+ @CheckForNull
+ public String getTo() {
+ return to;
+ }
+
public static Builder builder() {
return new Builder();
}
@@ -67,6 +81,8 @@ public class SearchRequest {
private EventCategory category;
private int page = 1;
private int pageSize = DEFAULT_PAGE_SIZE;
+ private String from;
+ private String to;
private Builder() {
// enforce static factory method
@@ -92,6 +108,16 @@ public class SearchRequest {
return this;
}
+ public Builder setFrom(@Nullable String from) {
+ this.from = from;
+ return this;
+ }
+
+ public Builder setTo(@Nullable String to) {
+ this.to = to;
+ return this;
+ }
+
public SearchRequest build() {
requireNonNull(project, "Project is required");
checkArgument(pageSize <= MAX_SIZE, "Page size must be lower than or equal to " + MAX_SIZE);
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/projectanalysis/SearchRequestTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/projectanalysis/SearchRequestTest.java
index d36b8393273..355fd27e5e8 100644
--- a/sonar-ws/src/test/java/org/sonarqube/ws/client/projectanalysis/SearchRequestTest.java
+++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/projectanalysis/SearchRequestTest.java
@@ -39,12 +39,16 @@ public class SearchRequestTest {
.setCategory(QUALITY_GATE)
.setPage(2)
.setPageSize(500)
+ .setFrom("2016-01-01")
+ .setTo("2017-07-01")
.build();
assertThat(result.getProject()).isEqualTo("P1");
assertThat(result.getPage()).isEqualTo(2);
assertThat(result.getPageSize()).isEqualTo(500);
assertThat(result.getCategory()).isEqualTo(QUALITY_GATE);
+ assertThat(result.getFrom()).isEqualTo("2016-01-01");
+ assertThat(result.getTo()).isEqualTo("2017-07-01");
}
@Test