From 017fde2c6e202682e1eef46363236dc13f84bbaf Mon Sep 17 00:00:00 2001 From: Teryk Bellahsene Date: Thu, 9 Feb 2017 21:14:23 +0100 Subject: [PATCH] SONAR-8637 IT to test functional version in a plugin --- .../access-secured-props-plugin/pom.xml | 4 +- .../src/test/java/it/Category3Suite.java | 2 + .../java/it/plugins/VersionPluginTest.java | 57 +++++++++++++++++++ it/it-tests/src/test/java/it/ui/UiTest.java | 2 +- 4 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 it/it-tests/src/test/java/it/plugins/VersionPluginTest.java diff --git a/it/it-plugins/access-secured-props-plugin/pom.xml b/it/it-plugins/access-secured-props-plugin/pom.xml index d55e326ae15..a028053ae41 100644 --- a/it/it-plugins/access-secured-props-plugin/pom.xml +++ b/it/it-plugins/access-secured-props-plugin/pom.xml @@ -10,7 +10,7 @@ access-secured-props-plugin sonar-plugin Plugins :: Access Secured Properties - 1.0-SNAPSHOT + 1.0.2.42 Access .secured properties @@ -27,7 +27,7 @@ org.sonarsource.sonar-packaging-maven-plugin sonar-packaging-maven-plugin - 1.15 + 1.18.0.372 true AccessSecuredPropsPlugin diff --git a/it/it-tests/src/test/java/it/Category3Suite.java b/it/it-tests/src/test/java/it/Category3Suite.java index d3f063fdde5..2c29472beca 100644 --- a/it/it-tests/src/test/java/it/Category3Suite.java +++ b/it/it-tests/src/test/java/it/Category3Suite.java @@ -35,6 +35,7 @@ import it.analysis.SettingsEncryptionTest; import it.analysis.TempFolderTest; import it.measure.DecimalScaleMetricTest; import it.organization.OrganizationIt; +import it.plugins.VersionPluginTest; import it.root.RootIt; import it.webhook.WebhooksTest; import org.junit.ClassRule; @@ -56,6 +57,7 @@ import static util.ItUtils.xooPlugin; IssueJsonReportTest.class, ScannerTest.class, IssuesModeTest.class, + VersionPluginTest.class, SettingsEncryptionTest.class, ReportDumpTest.class, SSLTest.class, diff --git a/it/it-tests/src/test/java/it/plugins/VersionPluginTest.java b/it/it-tests/src/test/java/it/plugins/VersionPluginTest.java new file mode 100644 index 00000000000..9caec8d9176 --- /dev/null +++ b/it/it-tests/src/test/java/it/plugins/VersionPluginTest.java @@ -0,0 +1,57 @@ +/* + * 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.plugins; + +import com.sonar.orchestrator.Orchestrator; +import it.Category3Suite; +import java.io.IOException; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; +import org.sonarqube.ws.client.GetRequest; +import org.sonarqube.ws.client.WsClient; + +import static org.assertj.core.api.Assertions.assertThat; +import static util.ItUtils.newAdminWsClient; + +public class VersionPluginTest { + + @ClassRule + public static Orchestrator orchestrator = Category3Suite.ORCHESTRATOR; + private static WsClient wsClient; + + @BeforeClass + public static void init_ws_cient() { + wsClient = newAdminWsClient(orchestrator); + } + + @Before + public void deleteData() throws IOException { + orchestrator.resetData(); + } + + @Test + public void check_functional_version() { + assertThat(wsClient.wsConnector().call(new GetRequest("api/plugins/installed")).content()).contains("1.0.2 (build 42)"); + + } +} diff --git a/it/it-tests/src/test/java/it/ui/UiTest.java b/it/it-tests/src/test/java/it/ui/UiTest.java index 3e80aa814bf..c5f77803396 100644 --- a/it/it-tests/src/test/java/it/ui/UiTest.java +++ b/it/it-tests/src/test/java/it/ui/UiTest.java @@ -56,7 +56,7 @@ public class UiTest { @Test public void footer_contains_version() { - WsResponse status = ItUtils.newAdminWsClient(ORCHESTRATOR).wsConnector().call(new GetRequest("api/system/status")); + WsResponse status = ItUtils.newAdminWsClient(ORCHESTRATOR).wsConnector().call(new GetRequest("api/navigation/global")); Map statusMap = ItUtils.jsonToMap(status.content()); nav.getFooter().should(hasText((String) statusMap.get("version"))); -- 2.39.5