diff options
author | Julien HENRY <henryju@yahoo.fr> | 2011-01-19 02:44:34 +0800 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-01-20 05:24:23 +0800 |
commit | 1fbdcfbd155563691ded8f80d4fe2d03f754c897 (patch) | |
tree | fda45b0a815197a5882aaded09670b6726be6368 /sonar-ws-client/src/test | |
parent | 94c86319caf6c3a1fd3d6c617f8f702b5c0c4fcb (diff) | |
download | sonarqube-1fbdcfbd155563691ded8f80d4fe2d03f754c897.tar.gz sonarqube-1fbdcfbd155563691ded8f80d4fe2d03f754c897.zip |
SONAR-1664: Add access to project settings/properties
Diffstat (limited to 'sonar-ws-client/src/test')
4 files changed, 89 insertions, 1 deletions
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 new file mode 100644 index 00000000000..c465af21b5e --- /dev/null +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/PropertyCreateQueryTest.java @@ -0,0 +1,42 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2009 SonarSource SA + * 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 PropertyCreateQueryTest { + + @Test + public void create() { + PropertyCreateQuery query = new PropertyCreateQuery("foo", "bar"); + assertThat(query.getUrl(), is("/api/properties/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:resource&")); + 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/PropertyDeleteQueryTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/PropertyDeleteQueryTest.java new file mode 100644 index 00000000000..d55babe0831 --- /dev/null +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/PropertyDeleteQueryTest.java @@ -0,0 +1,40 @@ +/* + * Sonar, open source software quality management tool. + * Copyright (C) 2009 SonarSource SA + * 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 PropertyDeleteQueryTest { + + @Test + public void delete() { + PropertyDeleteQuery query = new PropertyDeleteQuery("foo"); + assertThat(query.getUrl(), is("/api/properties/foo?")); + } + + @Test + public void deleteResourceProp() { + PropertyDeleteQuery query = new PropertyDeleteQuery("foo", "my:resource"); + assertThat(query.getUrl(), is("/api/properties/foo?resource=my:resource&")); + } +}
\ 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 8becf06df5a..66e6f6e3b29 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 @@ -37,4 +37,10 @@ public class PropertyQueryTest { assertThat(PropertyQuery.createForKey("myprop").getUrl(), is("/api/properties/myprop?")); assertThat(PropertyQuery.createForKey("myprop").getModelClass().getName(), is(Property.class.getName())); } + + @Test + public void byKeyAndResource() { + assertThat(PropertyQuery.createForResource("myprop", "my:resource").getUrl(), is("/api/properties/myprop?resource=my:resource&")); + assertThat(PropertyQuery.createForResource("myprop", "my:resource").getModelClass().getName(), is(Property.class.getName())); + } } diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/UserPropertyDeleteQueryTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/UserPropertyDeleteQueryTest.java index 3d4b5df474b..f29462123d6 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/UserPropertyDeleteQueryTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/UserPropertyDeleteQueryTest.java @@ -27,7 +27,7 @@ import static org.junit.Assert.assertThat; public class UserPropertyDeleteQueryTest { @Test - public void create() { + public void delete() { UserPropertyDeleteQuery query = new UserPropertyDeleteQuery("foo"); assertThat(query.getUrl(), is("/api/user_properties/foo")); } |