From: Simon Brandhof Date: Mon, 11 Jun 2018 11:35:30 +0000 (+0200) Subject: Fix integration test PluginWithoutBuiltinQualityProfile X-Git-Tag: 7.5~992 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a19f87349dc27938288ebfb8f50078704956581c;p=sonarqube.git Fix integration test PluginWithoutBuiltinQualityProfile --- diff --git a/tests/plugins/foo-plugin-without-qprofile/build.gradle b/tests/plugins/foo-plugin-without-qprofile/build.gradle index a1eed2ef89e..789f3dd33d5 100644 --- a/tests/plugins/foo-plugin-without-qprofile/build.gradle +++ b/tests/plugins/foo-plugin-without-qprofile/build.gradle @@ -3,9 +3,6 @@ sonarqube { } dependencies { - compile 'com.google.guava:guava' - compile 'commons-io:commons-io' - compile 'commons-lang:commons-lang' compileOnly 'com.google.code.findbugs:jsr305' compileOnly project(path: ':sonar-plugin-api', configuration: 'shadow') } @@ -23,7 +20,4 @@ jar { 'Plugin-License': 'GNU LGPL 3' ) } - into('META-INF/lib') { - from configurations.compile - } } diff --git a/tests/src/test/java/org/sonarqube/tests/Category5Suite.java b/tests/src/test/java/org/sonarqube/tests/Category5Suite.java index bf1b19e2517..64cea9d35a3 100644 --- a/tests/src/test/java/org/sonarqube/tests/Category5Suite.java +++ b/tests/src/test/java/org/sonarqube/tests/Category5Suite.java @@ -28,7 +28,7 @@ import org.sonarqube.tests.issue.IssueCreationDatePluginChangedTest; import org.sonarqube.tests.marketplace.UpdateCenterTest; import org.sonarqube.tests.qualityProfile.ActiveRuleEsResilienceTest; import org.sonarqube.tests.qualityProfile.BuiltInQualityProfilesNotificationTest; -import org.sonarqube.tests.qualityProfile.PluginWithoutBuiltinQualityProfile; +import org.sonarqube.tests.qualityProfile.PluginWithoutBuiltinQualityProfileTest; import org.sonarqube.tests.rule.RuleEsResilienceTest; import org.sonarqube.tests.serverSystem.BlueGreenTest; import org.sonarqube.tests.serverSystem.RestartTest; @@ -65,7 +65,7 @@ import org.sonarqube.tests.user.UserEsResilienceTest; HttpHeadersAuthenticationTest.class, OnboardingTest.class, BuiltInQualityProfilesNotificationTest.class, - PluginWithoutBuiltinQualityProfile.class, + PluginWithoutBuiltinQualityProfileTest.class, ActiveRuleEsResilienceTest.class, AnalysisEsResilienceTest.class, RuleEsResilienceTest.class, diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/PluginWithoutBuiltinQualityProfile.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/PluginWithoutBuiltinQualityProfile.java deleted file mode 100644 index 37fc1767534..00000000000 --- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/PluginWithoutBuiltinQualityProfile.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 SonarSource SA - * mailto:info 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 org.sonarqube.tests.qualityProfile; - -import com.sonar.orchestrator.Orchestrator; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import org.apache.commons.io.FileUtils; -import org.junit.After; -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.fail; -import static util.ItUtils.newOrchestratorBuilder; -import static util.ItUtils.pluginArtifact; - -public class PluginWithoutBuiltinQualityProfile { - private static Orchestrator orchestrator; - - @Test - public void should_fail_if_plugin_defines_language_and_no_builtin_qprofile() throws IOException { - orchestrator = newOrchestratorBuilder() - .addPlugin(pluginArtifact("foo-plugin-without-qprofile")) - .build(); - - try { - orchestrator.start(); - fail("Expected to fail to start"); - } catch (IllegalStateException e) { - String logs = FileUtils.readFileToString(orchestrator.getServer().getWebLogs(), StandardCharsets.UTF_8); - assertThat(logs).contains("java.lang.IllegalStateException: The following languages have no built-in quality profiles: foo"); - } - } - - @After - public void after() { - if (orchestrator != null) { - orchestrator.stop(); - } - } -} diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/PluginWithoutBuiltinQualityProfileTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/PluginWithoutBuiltinQualityProfileTest.java new file mode 100644 index 00000000000..f6ed25067fe --- /dev/null +++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/PluginWithoutBuiltinQualityProfileTest.java @@ -0,0 +1,56 @@ +/* + * SonarQube + * Copyright (C) 2009-2018 SonarSource SA + * mailto:info 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 org.sonarqube.tests.qualityProfile; + +import com.sonar.orchestrator.Orchestrator; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import org.apache.commons.io.FileUtils; +import org.junit.After; +import org.junit.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.fail; +import static util.ItUtils.newOrchestratorBuilder; +import static util.ItUtils.pluginArtifact; + +public class PluginWithoutBuiltinQualityProfileTest { + private static Orchestrator orchestrator; + + @Test + public void should_fail_if_plugin_defines_language_and_no_builtin_qprofile() throws IOException { + orchestrator = newOrchestratorBuilder(b -> b.addPlugin(pluginArtifact("foo-plugin-without-qprofile"))); + + try { + orchestrator.start(); + fail("Expected to fail to start"); + } catch (IllegalStateException e) { + String logs = FileUtils.readFileToString(orchestrator.getServer().getWebLogs(), StandardCharsets.UTF_8); + assertThat(logs).contains("java.lang.IllegalStateException: The following languages have no built-in quality profiles: foo"); + } + } + + @After + public void after() { + if (orchestrator != null) { + orchestrator.stop(); + } + } +}