aboutsummaryrefslogtreecommitdiffstats
path: root/it
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2016-05-18 18:59:26 +0200
committerJulien Lancelot <julien.lancelot@sonarsource.com>2016-05-19 10:53:46 +0200
commitb70f2903e70aad17ed54153f11dc0ab7e325e930 (patch)
tree8e32904a0861662b797b4813be73f7a1be74c45d /it
parent1172095459cf80678e3532c7b7862aeaced58785 (diff)
downloadsonarqube-b70f2903e70aad17ed54153f11dc0ab7e325e930.tar.gz
sonarqube-b70f2903e70aad17ed54153f11dc0ab7e325e930.zip
SONAR-7484 Add ITs
Diffstat (limited to 'it')
-rw-r--r--it/it-tests/src/test/java/it/Category4Suite.java4
-rw-r--r--it/it-tests/src/test/java/it/ws/WsTest.java63
2 files changed, 66 insertions, 1 deletions
diff --git a/it/it-tests/src/test/java/it/Category4Suite.java b/it/it-tests/src/test/java/it/Category4Suite.java
index bb75f2473f0..ea5ecc1175e 100644
--- a/it/it-tests/src/test/java/it/Category4Suite.java
+++ b/it/it-tests/src/test/java/it/Category4Suite.java
@@ -42,6 +42,7 @@ import it.user.LocalAuthenticationTest;
import it.user.MyAccountPageTest;
import it.user.OAuth2IdentityProviderTest;
import it.ws.WsLocalCallTest;
+import it.ws.WsTest;
import org.junit.ClassRule;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@@ -85,7 +86,8 @@ import static util.ItUtils.xooPlugin;
UiTest.class,
// ui extensions
UiExtensionsTest.class,
- WsLocalCallTest.class
+ WsLocalCallTest.class,
+ WsTest.class
})
public class Category4Suite {
diff --git a/it/it-tests/src/test/java/it/ws/WsTest.java b/it/it-tests/src/test/java/it/ws/WsTest.java
new file mode 100644
index 00000000000..84760bd99f9
--- /dev/null
+++ b/it/it-tests/src/test/java/it/ws/WsTest.java
@@ -0,0 +1,63 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program 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.
+ *
+ * This program 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 this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package it.ws;
+
+import com.sonar.orchestrator.Orchestrator;
+import it.Category4Suite;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonarqube.ws.client.GetRequest;
+import org.sonarqube.ws.client.WsResponse;
+
+import static java.net.HttpURLConnection.HTTP_BAD_REQUEST;
+import static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.newWsClient;
+
+public class WsTest {
+
+ @ClassRule
+ public static final Orchestrator orchestrator = Category4Suite.ORCHESTRATOR;
+
+ @Test
+ public void gets_protobuf() {
+ WsResponse response = newWsClient(orchestrator).wsConnector().call(new GetRequest("api/issues/search.protobuf"));
+ assertThat(response.isSuccessful()).isTrue();
+ assertThat(response.contentType()).contains("application/x-protobuf");
+ }
+
+ @Test
+ public void gets_json() {
+ WsResponse response = newWsClient(orchestrator).wsConnector().call(new GetRequest("api/issues/search.json"));
+ assertThat(response.isSuccessful()).isTrue();
+ assertThat(response.contentType()).contains("application/json");
+ }
+
+ /**
+ * SONAR-7484
+ */
+ @Test
+ public void fail_on_unknown_extension() {
+ WsResponse response = newWsClient(orchestrator).wsConnector().call(new GetRequest("api/issues/search.unknown"));
+ assertThat(response.isSuccessful()).isFalse();
+ assertThat(response.code()).isEqualTo(HTTP_BAD_REQUEST);
+ }
+
+}