aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGodin <mandrikov@gmail.com>2010-12-14 00:56:54 +0000
committerGodin <mandrikov@gmail.com>2010-12-14 00:56:54 +0000
commitc7c69b5dc02c35401e9ade1a7293e8199fbead77 (patch)
treec6def0ca8c1eda433ce5583860cf97b968bcd1f3
parenta8ec3720bba2b343d1f9046f4c93a2262e1b1a41 (diff)
downloadsonarqube-c7c69b5dc02c35401e9ade1a7293e8199fbead77.tar.gz
sonarqube-c7c69b5dc02c35401e9ade1a7293e8199fbead77.zip
SONAR-833: New Web Service to get history of measures (time machine)
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/services/TimeMachineQuery.java10
-rw-r--r--tests/integration/tests/src/it/java/org/sonar/tests/integration/ViolationsTimemachineTest.java2
2 files changed, 9 insertions, 3 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/TimeMachineQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/TimeMachineQuery.java
index 04f2019d490..b92722c2708 100644
--- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/TimeMachineQuery.java
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/TimeMachineQuery.java
@@ -72,8 +72,14 @@ public class TimeMachineQuery extends Query<TimeMachineData> {
return TimeMachineData.class;
}
- public static TimeMachineQuery create(String resourceKeyOrId) {
- return new TimeMachineQuery(resourceKeyOrId);
+ public static TimeMachineQuery createForMetrics(String resourceKeyOrId, String... metricKeys) {
+ return new TimeMachineQuery(resourceKeyOrId)
+ .setMetrics(metricKeys);
+ }
+
+ public static TimeMachineQuery createForResource(Resource resource, String... metricKeys) {
+ return new TimeMachineQuery(resource.getId().toString())
+ .setMetrics(metricKeys);
}
}
diff --git a/tests/integration/tests/src/it/java/org/sonar/tests/integration/ViolationsTimemachineTest.java b/tests/integration/tests/src/it/java/org/sonar/tests/integration/ViolationsTimemachineTest.java
index 13ab6f68aa6..f834de08ab1 100644
--- a/tests/integration/tests/src/it/java/org/sonar/tests/integration/ViolationsTimemachineTest.java
+++ b/tests/integration/tests/src/it/java/org/sonar/tests/integration/ViolationsTimemachineTest.java
@@ -32,7 +32,7 @@ public class ViolationsTimemachineTest {
@Test
public void timemachine() {
- TimeMachineQuery query = TimeMachineQuery.create(PROJECT).setMetrics(
+ TimeMachineQuery query = TimeMachineQuery.createForMetrics(PROJECT,
CoreMetrics.BLOCKER_VIOLATIONS_KEY,
CoreMetrics.CRITICAL_VIOLATIONS_KEY,
CoreMetrics.MAJOR_VIOLATIONS_KEY,