aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2010-11-08 15:01:53 +0000
committersimonbrandhof <simon.brandhof@gmail.com>2010-11-08 15:01:53 +0000
commita51158f4665202f6b7603e9fad8caee05f6ae5d4 (patch)
treebafc15516b6f3708790490a0b32957a2289835aa /tests
parent7ccbbfdbd03d7960d2fa3b62072b730b3968d9be (diff)
downloadsonarqube-a51158f4665202f6b7603e9fad8caee05f6ae5d4.tar.gz
sonarqube-a51158f4665202f6b7603e9fad8caee05f6ae5d4.zip
SONAR-1897 the WS must be available to anonymous users + add IT
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/tests/src/it/java/org/sonar/tests/integration/UpdateCenterTest.java59
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/integration/tests/src/it/java/org/sonar/tests/integration/UpdateCenterTest.java b/tests/integration/tests/src/it/java/org/sonar/tests/integration/UpdateCenterTest.java
new file mode 100644
index 00000000000..f49ad613b52
--- /dev/null
+++ b/tests/integration/tests/src/it/java/org/sonar/tests/integration/UpdateCenterTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.tests.integration;
+
+import org.apache.commons.lang.StringUtils;
+import org.junit.Test;
+import org.sonar.wsclient.Sonar;
+import org.sonar.wsclient.services.Plugin;
+import org.sonar.wsclient.services.UpdateCenterQuery;
+
+import java.util.List;
+
+import static junit.framework.Assert.assertNotNull;
+import static org.hamcrest.Matchers.startsWith;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.number.OrderingComparisons.greaterThan;
+import static org.junit.Assert.assertThat;
+
+public class UpdateCenterTest {
+
+ @Test
+ public void shouldGetInstalledPlugins() {
+ Sonar sonar = Sonar.create("http://localhost:9000");
+ List<Plugin> plugins = sonar.findAll(UpdateCenterQuery.createForInstalledPlugins());
+ assertThat(plugins.size(), greaterThan(0));
+
+ Plugin referencePlugin = findReferencePlugin(plugins, "itreference");
+ assertNotNull(referencePlugin);
+ assertThat(referencePlugin.getName(), is("Sonar :: Integration Tests :: Reference Plugin"));
+ assertThat(referencePlugin.getVersion(), startsWith("2."));
+ }
+
+ private Plugin findReferencePlugin(List<Plugin> plugins, String pluginKey) {
+ for (Plugin plugin : plugins) {
+ if (StringUtils.equals(pluginKey, plugin.getKey())) {
+ return plugin;
+ }
+ }
+ return null;
+ }
+
+}