aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws-client
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2011-08-01 10:55:26 +0200
committerSimon Brandhof <simon.brandhof@gmail.com>2011-08-01 10:55:50 +0200
commit8b1ee3cccfaff3852d44b84588e13c2bb90f0ce1 (patch)
treed76225b35a2496360f2559d471a7ea65a37353b2 /sonar-ws-client
parent570028a3b3be614e04a0329d33dbda532c875977 (diff)
downloadsonarqube-8b1ee3cccfaff3852d44b84588e13c2bb90f0ce1.tar.gz
sonarqube-8b1ee3cccfaff3852d44b84588e13c2bb90f0ce1.zip
Manual Measures WS : add ManualMeasureDeleteQuery to ws-client
Diffstat (limited to 'sonar-ws-client')
-rw-r--r--sonar-ws-client/src/main/java/org/sonar/wsclient/services/ManualMeasureDeleteQuery.java60
-rw-r--r--sonar-ws-client/src/test/java/org/sonar/wsclient/services/ManualMeasureDeleteQueryTest.java34
2 files changed, 94 insertions, 0 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ManualMeasureDeleteQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ManualMeasureDeleteQuery.java
new file mode 100644
index 00000000000..1384eb9b6ce
--- /dev/null
+++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/ManualMeasureDeleteQuery.java
@@ -0,0 +1,60 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2011 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.wsclient.services;
+
+/**
+ * @since 2.10
+ */
+public class ManualMeasureDeleteQuery extends DeleteQuery<ManualMeasure> {
+
+ private String resourceKey;
+ private String metricKey;
+
+ private ManualMeasureDeleteQuery(String resourceKey, String metricKey) {
+ this.resourceKey = resourceKey;
+ this.metricKey = metricKey;
+ }
+
+ public static ManualMeasureDeleteQuery create(String resourceKey, String metricKey) {
+ return new ManualMeasureDeleteQuery(resourceKey, metricKey);
+ }
+
+ public String getResourceKey() {
+ return resourceKey;
+ }
+
+ public String getMetricKey() {
+ return metricKey;
+ }
+
+ @Override
+ public String getUrl() {
+ StringBuilder url = new StringBuilder();
+ url.append(ManualMeasureQuery.BASE_URL);
+ appendUrlParameter(url, "resource", resourceKey);
+ appendUrlParameter(url, "metric", metricKey);
+ return url.toString();
+ }
+
+ @Override
+ public String toString() {
+ return getUrl();
+ }
+}
diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ManualMeasureDeleteQueryTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ManualMeasureDeleteQueryTest.java
new file mode 100644
index 00000000000..bea0be9deeb
--- /dev/null
+++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ManualMeasureDeleteQueryTest.java
@@ -0,0 +1,34 @@
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2011 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * Sonar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.wsclient.services;
+
+import org.junit.Test;
+
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+public class ManualMeasureDeleteQueryTest extends QueryTestCase {
+
+ @Test
+ public void delete() {
+ ManualMeasureDeleteQuery query = ManualMeasureDeleteQuery.create("foo", "team_size");
+ assertThat(query.getUrl(), is("/api/manual_measures?resource=foo&metric=team_size&"));
+ }
+} \ No newline at end of file