]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-833: New Web Service to get history of measures (time machine)
authorGodin <mandrikov@gmail.com>
Tue, 14 Dec 2010 00:56:54 +0000 (00:56 +0000)
committerGodin <mandrikov@gmail.com>
Tue, 14 Dec 2010 00:56:54 +0000 (00:56 +0000)
sonar-ws-client/src/main/java/org/sonar/wsclient/services/TimeMachineQuery.java
tests/integration/tests/src/it/java/org/sonar/tests/integration/ViolationsTimemachineTest.java

index 04f2019d490671ebb070dd7fd965fbd78a997273..b92722c27085fa48073ceb69ef8a493ca0857b75 100644 (file)
@@ -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);
   }
 
 }
index 13ab6f68aa6dde5da46f1aa56cc12b835f2a64d3..f834de08ab13adebc9c5294426035f515bebc66a 100644 (file)
@@ -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,