diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-06-26 12:38:33 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-06-26 12:38:42 +0200 |
commit | a46930a27d21ada19805220f6e3ded05f1776efe (patch) | |
tree | f27d7a0ff36149aa3ef958fe251a2c16210bd775 /sonar-ws-client | |
parent | 2c7027bd9044452cb6d56c9bcb1178c4388c833c (diff) | |
download | sonarqube-a46930a27d21ada19805220f6e3ded05f1776efe.tar.gz sonarqube-a46930a27d21ada19805220f6e3ded05f1776efe.zip |
SONAR-4443 The wsclient class PropertyCreateQuery can not be used to create properties
Diffstat (limited to 'sonar-ws-client')
4 files changed, 7 insertions, 8 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/PropertyCreateQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/PropertyCreateQuery.java index 9572bb39616..406b5205b3e 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/PropertyCreateQuery.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/PropertyCreateQuery.java @@ -78,8 +78,7 @@ public class PropertyCreateQuery extends CreateQuery<Property> { public String getUrl() { StringBuilder url = new StringBuilder(); url.append(PropertyQuery.BASE_URL); - url.append("/").append(encode(key)); - url.append('?'); + url.append("?id=").append(encode(key)).append("&"); appendUrlParameter(url, "value", value); appendUrlParameter(url, "resource", resourceKeyOrId); return url.toString(); diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/PropertyQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/PropertyQuery.java index 5e2abc4547f..3fee1d82af9 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/PropertyQuery.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/PropertyQuery.java @@ -46,10 +46,10 @@ public class PropertyQuery extends Query<Property> { @Override public String getUrl() { StringBuilder url = new StringBuilder(BASE_URL); + url.append('?'); if (key != null) { - url.append("/").append(encode(key)); + url.append("id=").append(encode(key)).append("&"); } - url.append('?'); appendUrlParameter(url, "resource", resourceKeyOrId); return url.toString(); } diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/PropertyCreateQueryTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/PropertyCreateQueryTest.java index 7a4c710fd18..b72e2e86b87 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/PropertyCreateQueryTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/PropertyCreateQueryTest.java @@ -29,14 +29,14 @@ public class PropertyCreateQueryTest extends QueryTestCase { @Test public void create() { PropertyCreateQuery query = new PropertyCreateQuery("foo", "bar"); - assertThat(query.getUrl(), is("/api/properties/foo?value=bar&")); + assertThat(query.getUrl(), is("/api/properties?id=foo&value=bar&")); assertThat(query.getModelClass().getName(), is(Property.class.getName())); } @Test public void createForResource() { PropertyCreateQuery query = new PropertyCreateQuery("foo", "bar", "my:resource"); - assertThat(query.getUrl(), is("/api/properties/foo?value=bar&resource=my%3Aresource&")); + assertThat(query.getUrl(), is("/api/properties?id=foo&value=bar&resource=my%3Aresource&")); assertThat(query.getModelClass().getName(), is(Property.class.getName())); } }
\ No newline at end of file diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/PropertyQueryTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/PropertyQueryTest.java index fef66ec4658..52d51e16154 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/PropertyQueryTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/PropertyQueryTest.java @@ -43,14 +43,14 @@ public class PropertyQueryTest extends QueryTestCase { @Test public void test_global_property() { PropertyQuery query = PropertyQuery.createForKey("myprop"); - assertThat(query.getUrl(), is("/api/properties/myprop?")); + assertThat(query.getUrl(), is("/api/properties?id=myprop&")); assertThat(query.getModelClass().getName(), is(Property.class.getName())); } @Test public void test_project_property() { PropertyQuery query = PropertyQuery.createForResource("myprop", "my:resource"); - assertThat(query.getUrl(), is("/api/properties/myprop?resource=my%3Aresource&")); + assertThat(query.getUrl(), is("/api/properties?id=myprop&resource=my%3Aresource&")); assertThat(query.getModelClass().getName(), is(Property.class.getName())); } } |