From 7f930aa08f9dee83dc6031b9a22895989242df92 Mon Sep 17 00:00:00 2001 From: Elliot Hillary Date: Wed, 5 Jul 2023 16:36:20 +1000 Subject: [PATCH] !! Bump sonar-orchestrator version --- dependencies-lock.json | 28 ++++------ pom.xml | 8 ++- .../plugins/delphi/DelphiCpdExecutorIT.java | 12 ++--- .../plugins/delphi/IntegrationTestSuite.java | 13 +++-- .../extension/OrchestratorExtension.java | 52 ------------------- 5 files changed, 32 insertions(+), 81 deletions(-) delete mode 100644 src/it/java/org/sonar/plugins/delphi/extension/OrchestratorExtension.java diff --git a/dependencies-lock.json b/dependencies-lock.json index 7dcc272bd..0df422f08 100644 --- a/dependencies-lock.json +++ b/dependencies-lock.json @@ -2,13 +2,13 @@ "dependencies" : [ { "groupId" : "ch.qos.logback", "artifactId" : "logback-classic", - "version" : "1.2.0", + "version" : "1.2.9", "scope" : "test", "type" : "jar" }, { "groupId" : "ch.qos.logback", "artifactId" : "logback-core", - "version" : "1.2.0", + "version" : "1.2.9", "scope" : "test", "type" : "jar" }, { @@ -128,7 +128,7 @@ }, { "groupId" : "commons-codec", "artifactId" : "commons-codec", - "version" : "1.11", + "version" : "1.13", "scope" : "test", "type" : "jar" }, { @@ -149,12 +149,6 @@ "version" : "1.3.2", "scope" : "compile", "type" : "jar" - }, { - "groupId" : "junit", - "artifactId" : "junit", - "version" : "4.12", - "scope" : "test", - "type" : "jar" }, { "groupId" : "net.bytebuddy", "artifactId" : "byte-buddy-agent", @@ -258,16 +252,10 @@ "version" : "3.12.0", "scope" : "compile", "type" : "jar" - }, { - "groupId" : "org.hamcrest", - "artifactId" : "hamcrest-core", - "version" : "1.3", - "scope" : "test", - "type" : "jar" }, { "groupId" : "org.jacoco", "artifactId" : "org.jacoco.agent", - "version" : "0.8.4", + "version" : "0.8.10", "scope" : "test", "type" : "jar", "classifier" : "runtime" @@ -391,10 +379,16 @@ "version" : "1.25.0.1003", "scope" : "compile", "type" : "jar" + }, { + "groupId" : "org.sonarsource.orchestrator", + "artifactId" : "sonar-orchestrator-junit5", + "version" : "4.0.0.404", + "scope" : "test", + "type" : "jar" }, { "groupId" : "org.sonarsource.orchestrator", "artifactId" : "sonar-orchestrator", - "version" : "3.40.0.183", + "version" : "4.0.0.404", "scope" : "test", "type" : "jar" }, { diff --git a/pom.xml b/pom.xml index f113fb4b8..20fec2a9c 100644 --- a/pom.xml +++ b/pom.xml @@ -101,7 +101,7 @@ 7.9 7.9 1.25.0.1003 - 3.40.0.183 + 4.0.0.404 3.5.3 1.10.0 6.18.0 @@ -266,6 +266,12 @@ ${sonar-orchestrator.version} test + + org.sonarsource.orchestrator + sonar-orchestrator-junit5 + ${sonar-orchestrator.version} + test + diff --git a/src/it/java/org/sonar/plugins/delphi/DelphiCpdExecutorIT.java b/src/it/java/org/sonar/plugins/delphi/DelphiCpdExecutorIT.java index 359846ecb..8ef03ff76 100644 --- a/src/it/java/org/sonar/plugins/delphi/DelphiCpdExecutorIT.java +++ b/src/it/java/org/sonar/plugins/delphi/DelphiCpdExecutorIT.java @@ -22,9 +22,9 @@ import static org.sonar.plugins.delphi.IntegrationTestSuite.createScanner; import static org.sonar.plugins.delphi.IntegrationTestSuite.getProjectMeasureAsDouble; +import com.sonar.orchestrator.junit5.OrchestratorExtension; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; -import org.sonar.plugins.delphi.extension.OrchestratorExtension; class DelphiCpdExecutorIT { private static final String SIMPLE_PROJECT_KEY = "delphi-cpd-simple-test"; @@ -36,25 +36,21 @@ class DelphiCpdExecutorIT { @Test void testShouldDetectDuplicates() { - ORCHESTRATOR.getOrchestrator().executeBuild(createScanner("cpd-simple", SIMPLE_PROJECT_KEY)); + ORCHESTRATOR.executeBuild(createScanner("cpd-simple", SIMPLE_PROJECT_KEY)); assertThat(getProjectMeasureAsDouble("duplicated_lines", SIMPLE_PROJECT_KEY)).isEqualTo(26.0); assertThat(getProjectMeasureAsDouble("duplicated_blocks", SIMPLE_PROJECT_KEY)).isEqualTo(2.0); } @Test void testShouldDetectDuplicatesByNormalizingLiterals() { - ORCHESTRATOR - .getOrchestrator() - .executeBuild(createScanner("cpd-literals", LITERALS_PROJECT_KEY)); + ORCHESTRATOR.executeBuild(createScanner("cpd-literals", LITERALS_PROJECT_KEY)); assertThat(getProjectMeasureAsDouble("duplicated_lines", LITERALS_PROJECT_KEY)).isEqualTo(26.0); assertThat(getProjectMeasureAsDouble("duplicated_blocks", LITERALS_PROJECT_KEY)).isEqualTo(2.0); } @Test void testShouldDetectDuplicatesByIgnoringWhitespace() { - ORCHESTRATOR - .getOrchestrator() - .executeBuild(createScanner("cpd-whitespace", WHITESPACE_PROJECT_KEY)); + ORCHESTRATOR.executeBuild(createScanner("cpd-whitespace", WHITESPACE_PROJECT_KEY)); assertThat(getProjectMeasureAsDouble("duplicated_lines", WHITESPACE_PROJECT_KEY)) .isEqualTo(33.0); assertThat(getProjectMeasureAsDouble("duplicated_blocks", WHITESPACE_PROJECT_KEY)) diff --git a/src/it/java/org/sonar/plugins/delphi/IntegrationTestSuite.java b/src/it/java/org/sonar/plugins/delphi/IntegrationTestSuite.java index 1e98268ed..eeffeaff1 100644 --- a/src/it/java/org/sonar/plugins/delphi/IntegrationTestSuite.java +++ b/src/it/java/org/sonar/plugins/delphi/IntegrationTestSuite.java @@ -27,7 +27,7 @@ import org.junit.jupiter.api.extension.RegisterExtension; import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; -import org.sonar.plugins.delphi.extension.OrchestratorExtension; +import com.sonar.orchestrator.junit5.OrchestratorExtension; import org.sonar.plugins.delphi.utils.DelphiUtils; import org.sonarqube.ws.Measures.ComponentWsResponse; import org.sonarqube.ws.Measures.Measure; @@ -42,8 +42,15 @@ class IntegrationTestSuite { private static final String PROJECTS_PATH = "src/it/projects/"; private static final String BDS_PATH = DelphiUtils.getResource("/org/sonar/plugins/delphi/bds").getAbsolutePath(); + private static final FileLocation PLUGIN_LOCATION = + FileLocation.byWildcardMavenFilename(new File("target"), "sonar-delphi-plugin-*.jar"); - @RegisterExtension static final OrchestratorExtension ORCHESTRATOR = new OrchestratorExtension(); + + @RegisterExtension static final OrchestratorExtension ORCHESTRATOR = OrchestratorExtension.builderEnv() + .useDefaultAdminCredentialsForBuilds(true) + .setSonarVersion(System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE")) + .addPlugin(PLUGIN_LOCATION) + .build(); private IntegrationTestSuite() { // Hide public constructor @@ -53,7 +60,7 @@ private static WsClient newWsClient() { return WsClientFactories.getDefault() .newClient( HttpConnector.newBuilder() - .url(ORCHESTRATOR.getOrchestrator().getServer().getUrl()) + .url(ORCHESTRATOR.getServer().getUrl()) .build()); } diff --git a/src/it/java/org/sonar/plugins/delphi/extension/OrchestratorExtension.java b/src/it/java/org/sonar/plugins/delphi/extension/OrchestratorExtension.java deleted file mode 100644 index 19274f735..000000000 --- a/src/it/java/org/sonar/plugins/delphi/extension/OrchestratorExtension.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Sonar Delphi Plugin - * Copyright (C) 2019-2022 Integrated Application Development - * - * 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 02 - */ -package org.sonar.plugins.delphi.extension; - -import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.locator.FileLocation; -import java.io.File; -import org.junit.jupiter.api.extension.AfterAllCallback; -import org.junit.jupiter.api.extension.BeforeAllCallback; -import org.junit.jupiter.api.extension.ExtensionContext; - -public class OrchestratorExtension implements BeforeAllCallback, AfterAllCallback { - private static final FileLocation PLUGIN_LOCATION = - FileLocation.byWildcardMavenFilename(new File("target"), "sonar-delphi-plugin-*.jar"); - - private final Orchestrator orchestrator = - Orchestrator.builderEnv() - .useDefaultAdminCredentialsForBuilds(true) - .setSonarVersion(System.getProperty("sonar.runtimeVersion", "LATEST_RELEASE")) - .addPlugin(PLUGIN_LOCATION) - .build(); - - @Override - public void beforeAll(ExtensionContext context) { - orchestrator.start(); - } - - @Override - public void afterAll(ExtensionContext context) { - orchestrator.stop(); - } - - public Orchestrator getOrchestrator() { - return this.orchestrator; - } -}