aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/test/java
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2018-06-07 16:50:08 +0200
committerSonarTech <sonartech@sonarsource.com>2018-06-12 20:21:04 +0200
commitbf6c9991631f6303fb5905c1a0061f4bf8a9e2ee (patch)
tree186fda73a9cab42760599d49d9e0da0b1c919bed /tests/src/test/java
parent20aca2b3849c6ac8a5b0575cef1f2f03ae175e38 (diff)
downloadsonarqube-bf6c9991631f6303fb5905c1a0061f4bf8a9e2ee.tar.gz
sonarqube-bf6c9991631f6303fb5905c1a0061f4bf8a9e2ee.zip
SONAR-10690 make fake-governance-plugin a core extension
Diffstat (limited to 'tests/src/test/java')
-rw-r--r--tests/src/test/java/org/sonarqube/tests/Byteman.java12
-rw-r--r--tests/src/test/java/org/sonarqube/tests/Category1Suite.java30
-rw-r--r--tests/src/test/java/org/sonarqube/tests/Category3Suite.java35
-rw-r--r--tests/src/test/java/org/sonarqube/tests/Category4Suite.java23
-rw-r--r--tests/src/test/java/org/sonarqube/tests/Category6Suite.java22
-rw-r--r--tests/src/test/java/org/sonarqube/tests/analysis/AnalysisEsResilienceTest.java22
-rw-r--r--tests/src/test/java/org/sonarqube/tests/authorization/AuthorizationSuite.java21
-rw-r--r--tests/src/test/java/org/sonarqube/tests/authorization/SystemPasscodeTest.java2
-rw-r--r--tests/src/test/java/org/sonarqube/tests/ce/CeShutdownTest.java12
-rw-r--r--tests/src/test/java/org/sonarqube/tests/ce/CeWorkersTest.java19
-rw-r--r--tests/src/test/java/org/sonarqube/tests/component/ComponentSuite.java8
-rw-r--r--tests/src/test/java/org/sonarqube/tests/duplication/DuplicationSuite.java7
-rw-r--r--tests/src/test/java/org/sonarqube/tests/issue/ExternalIssueSuite.java8
-rw-r--r--tests/src/test/java/org/sonarqube/tests/issue/IssueCreationDatePluginChangedTest.java12
-rw-r--r--tests/src/test/java/org/sonarqube/tests/issue/IssueSuite.java17
-rw-r--r--tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssueSuite.java9
-rw-r--r--tests/src/test/java/org/sonarqube/tests/lite/LiteTest.java12
-rw-r--r--tests/src/test/java/org/sonarqube/tests/marketplace/UpdateCenterTest.java18
-rw-r--r--tests/src/test/java/org/sonarqube/tests/measure/MeasureSuite.java11
-rw-r--r--tests/src/test/java/org/sonarqube/tests/organization/OrganizationSuite.java13
-rw-r--r--tests/src/test/java/org/sonarqube/tests/performance/scanner/ScannerPerformanceSuite.java16
-rw-r--r--tests/src/test/java/org/sonarqube/tests/performance/server/ComputeEnginePerfTest.java14
-rw-r--r--tests/src/test/java/org/sonarqube/tests/performance/server/ServerPerfTest.java20
-rw-r--r--tests/src/test/java/org/sonarqube/tests/project/OrganizationProjectSuite.java23
-rw-r--r--tests/src/test/java/org/sonarqube/tests/project/ProjectSuite.java21
-rw-r--r--tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateSuite.java16
-rw-r--r--tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateSuite.java14
-rw-r--r--tests/src/test/java/org/sonarqube/tests/qualityModel/QualityModelSuite.java7
-rw-r--r--tests/src/test/java/org/sonarqube/tests/qualityProfile/ActiveRuleEsResilienceTest.java17
-rw-r--r--tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java35
-rw-r--r--tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfileUpdateTest.java9
-rw-r--r--tests/src/test/java/org/sonarqube/tests/rule/RuleEsResilienceTest.java16
-rw-r--r--tests/src/test/java/org/sonarqube/tests/rule/RuleReKeyingTest.java6
-rw-r--r--tests/src/test/java/org/sonarqube/tests/serverSystem/BlueGreenTest.java6
-rw-r--r--tests/src/test/java/org/sonarqube/tests/serverSystem/RestartTest.java6
-rw-r--r--tests/src/test/java/org/sonarqube/tests/serverSystem/ServerSystemRestartingOrchestrator.java22
-rw-r--r--tests/src/test/java/org/sonarqube/tests/serverSystem/SystemStateTest.java14
-rw-r--r--tests/src/test/java/org/sonarqube/tests/settings/SettingsSuite.java8
-rw-r--r--tests/src/test/java/org/sonarqube/tests/settings/SettingsTestRestartingOrchestrator.java16
-rw-r--r--tests/src/test/java/org/sonarqube/tests/source/SourceSuite.java8
-rw-r--r--tests/src/test/java/org/sonarqube/tests/startup/StartupIndexationTest.java18
-rw-r--r--tests/src/test/java/org/sonarqube/tests/telemetry/TelemetryOptOutTest.java6
-rw-r--r--tests/src/test/java/org/sonarqube/tests/telemetry/TelemetryUploadTest.java25
-rw-r--r--tests/src/test/java/org/sonarqube/tests/test/TestSuite.java7
-rw-r--r--tests/src/test/java/org/sonarqube/tests/ui/UiSuite.java12
-rw-r--r--tests/src/test/java/org/sonarqube/tests/upgrade/UpgradeTest.java10
-rw-r--r--tests/src/test/java/org/sonarqube/tests/user/HttpHeadersAuthenticationTest.java14
-rw-r--r--tests/src/test/java/org/sonarqube/tests/user/OnboardingTest.java2
-rw-r--r--tests/src/test/java/org/sonarqube/tests/user/RealmAuthenticationTest.java8
-rw-r--r--tests/src/test/java/org/sonarqube/tests/user/SonarCloudUserSuite.java23
-rw-r--r--tests/src/test/java/org/sonarqube/tests/user/UserEsResilienceTest.java16
-rw-r--r--tests/src/test/java/org/sonarqube/tests/user/UserSuite.java19
-rw-r--r--tests/src/test/java/org/sonarqube/tests/webhook/WebhooksSuite.java14
-rw-r--r--tests/src/test/java/util/ItUtils.java51
54 files changed, 440 insertions, 392 deletions
diff --git a/tests/src/test/java/org/sonarqube/tests/Byteman.java b/tests/src/test/java/org/sonarqube/tests/Byteman.java
index 26e21b4a31b..c6d4f1bf61f 100644
--- a/tests/src/test/java/org/sonarqube/tests/Byteman.java
+++ b/tests/src/test/java/org/sonarqube/tests/Byteman.java
@@ -35,7 +35,6 @@ import static java.lang.String.format;
public class Byteman {
private final int port;
- private final OrchestratorBuilder builder;
public enum Process {
WEB("sonar.web.javaAdditionalOpts"), CE("sonar.ce.javaAdditionalOpts");
@@ -47,10 +46,12 @@ public class Byteman {
}
}
- public Byteman(OrchestratorBuilder builder, Process process) {
- this.builder = builder;
- String jar = findBytemanJar();
+ public Byteman() {
port = NetworkUtils.getNextAvailablePort(InetAddress.getLoopbackAddress());
+ }
+
+ public void install(OrchestratorBuilder builder, Process process) {
+ String jar = findBytemanJar();
String bytemanArg = format("-javaagent:%s=boot:%s,port:%d", jar, jar, port);
builder.setServerProperty(process.argument, bytemanArg);
}
@@ -89,7 +90,4 @@ public class Byteman {
}
}
- public OrchestratorBuilder getOrchestratorBuilder() {
- return builder;
- }
}
diff --git a/tests/src/test/java/org/sonarqube/tests/Category1Suite.java b/tests/src/test/java/org/sonarqube/tests/Category1Suite.java
index 09e1edb94d4..0a22aa2353a 100644
--- a/tests/src/test/java/org/sonarqube/tests/Category1Suite.java
+++ b/tests/src/test/java/org/sonarqube/tests/Category1Suite.java
@@ -49,26 +49,26 @@ import static util.ItUtils.xooPlugin;
public class Category1Suite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- .setServerProperty("sonar.notifications.delay", "1")
- .addPlugin(pluginArtifact("property-sets-plugin"))
- .addPlugin(pluginArtifact("sonar-subcategories-plugin"))
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ .setServerProperty("sonar.notifications.delay", "1")
+ .addPlugin(pluginArtifact("property-sets-plugin"))
+ .addPlugin(pluginArtifact("sonar-subcategories-plugin"))
- // Used in SettingsTest.global_property_change_extension_point
- .addPlugin(pluginArtifact("global-property-change-plugin"))
+ // Used in SettingsTest.global_property_change_extension_point
+ .addPlugin(pluginArtifact("global-property-change-plugin"))
- // Used in SettingsTest.should_get_settings_default_value
- .addPlugin(pluginArtifact("server-plugin"))
+ // Used in SettingsTest.should_get_settings_default_value
+ .addPlugin(pluginArtifact("server-plugin"))
- // Used in I18nTest
- .addPlugin(pluginArtifact("l10n-fr-pack"))
+ // Used in I18nTest
+ .addPlugin(pluginArtifact("l10n-fr-pack"))
- // 1 second. Required for notification test.
- .setServerProperty("sonar.notifications.delay", "1")
+ // 1 second. Required for notification test.
+ .setServerProperty("sonar.notifications.delay", "1")
- .addPlugin(pluginArtifact("posttask-plugin"))
+ .addPlugin(pluginArtifact("posttask-plugin"))
- .addPlugin(xooPlugin())
- .build();
+ .addPlugin(xooPlugin()));
}
diff --git a/tests/src/test/java/org/sonarqube/tests/Category3Suite.java b/tests/src/test/java/org/sonarqube/tests/Category3Suite.java
index 6cec2f483b3..468dbf14999 100644
--- a/tests/src/test/java/org/sonarqube/tests/Category3Suite.java
+++ b/tests/src/test/java/org/sonarqube/tests/Category3Suite.java
@@ -73,29 +73,28 @@ import static util.ItUtils.xooPlugin;
public class Category3Suite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- .addPlugin(xooPlugin())
- .addPlugin(MavenLocation.of("org.sonarsource.java", "sonar-java-plugin", "LATEST_RELEASE"))
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(xooPlugin())
+ .addPlugin(MavenLocation.of("org.sonarsource.java", "sonar-java-plugin", "LATEST_RELEASE"))
- // Used by SettingsEncryptionTest
- .addPlugin(pluginArtifact("settings-encryption-plugin"))
+ // Used by SettingsEncryptionTest
+ .addPlugin(pluginArtifact("settings-encryption-plugin"))
- // Used by IssuesModeTest
- .addPlugin(pluginArtifact("access-secured-props-plugin"))
+ // Used by IssuesModeTest
+ .addPlugin(pluginArtifact("access-secured-props-plugin"))
- // used by TempFolderTest and DecimalScaleMetricTest
- .addPlugin(pluginArtifact("batch-plugin"))
+ // used by TempFolderTest and DecimalScaleMetricTest
+ .addPlugin(pluginArtifact("batch-plugin"))
- // used by ExtensionLifecycleTest
- .addPlugin(pluginArtifact("extension-lifecycle-plugin"))
+ // used by ExtensionLifecycleTest
+ .addPlugin(pluginArtifact("extension-lifecycle-plugin"))
- // used by ProjectBuilderTest
- .addPlugin(pluginArtifact("project-builder-plugin"))
+ // used by ProjectBuilderTest
+ .addPlugin(pluginArtifact("project-builder-plugin"))
- // used by ProjectWithoutSourceTest
- .addPlugin(pluginArtifact("save-measure-on-project-plugin"))
+ // used by ProjectWithoutSourceTest
+ .addPlugin(pluginArtifact("save-measure-on-project-plugin"))
- .setServerProperty("sonar.ce.javaAdditionalOpts", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005")
-
- .build();
+ .setServerProperty("sonar.ce.javaAdditionalOpts", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"));
}
diff --git a/tests/src/test/java/org/sonarqube/tests/Category4Suite.java b/tests/src/test/java/org/sonarqube/tests/Category4Suite.java
index 7e3ccedbc2a..b738d047fa7 100644
--- a/tests/src/test/java/org/sonarqube/tests/Category4Suite.java
+++ b/tests/src/test/java/org/sonarqube/tests/Category4Suite.java
@@ -35,8 +35,6 @@ import org.sonarqube.tests.serverSystem.LogsTest;
import org.sonarqube.tests.serverSystem.PingTest;
import org.sonarqube.tests.serverSystem.ServerSystemTest;
import org.sonarqube.tests.serverSystem.SystemInfoTest;
-import org.sonarqube.tests.ui.UiExtensionsTest;
-import org.sonarqube.tests.ui.UiTest;
import org.sonarqube.tests.ws.WsLocalCallTest;
import org.sonarqube.tests.ws.WsTest;
@@ -74,19 +72,18 @@ import static util.ItUtils.xooPlugin;
public class Category4Suite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- .addPlugin(xooPlugin())
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(xooPlugin())
- // Used in UiExtensionsTest
- .addPlugin(pluginArtifact("ui-extensions-plugin"))
+ // Used in UiExtensionsTest
+ .addPlugin(pluginArtifact("ui-extensions-plugin"))
- // Used by WsLocalCallTest
- .addPlugin(pluginArtifact("ws-plugin"))
+ // Used by WsLocalCallTest
+ .addPlugin(pluginArtifact("ws-plugin"))
- // Used by LogsTest
- .setServerProperty("sonar.web.accessLogs.pattern", LogsTest.ACCESS_LOGS_PATTERN)
+ // Used by LogsTest
+ .setServerProperty("sonar.web.accessLogs.pattern", LogsTest.ACCESS_LOGS_PATTERN)
- .setServerProperty("sonar.web.javaAdditionalOpts", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8001")
-
- .build();
+ .setServerProperty("sonar.web.javaAdditionalOpts", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8001"));
}
diff --git a/tests/src/test/java/org/sonarqube/tests/Category6Suite.java b/tests/src/test/java/org/sonarqube/tests/Category6Suite.java
index bcb9a3159f7..123ab4aeb6f 100644
--- a/tests/src/test/java/org/sonarqube/tests/Category6Suite.java
+++ b/tests/src/test/java/org/sonarqube/tests/Category6Suite.java
@@ -67,18 +67,16 @@ public class Category6Suite {
public static final int SEARCH_HTTP_PORT = NetworkUtils.getNextAvailablePort(InetAddress.getLoopbackAddress());
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ // for ES resiliency tests
+ .setServerProperty("sonar.search.httpPort", "" + SEARCH_HTTP_PORT)
+ .setServerProperty("sonar.search.recovery.delayInMs", "1000")
+ .setServerProperty("sonar.search.recovery.minAgeInMs", "3000")
+ .setServerProperty("sonar.notifications.delay", "1")
- // for ES resiliency tests
- .setServerProperty("sonar.search.httpPort", "" + SEARCH_HTTP_PORT)
- .setServerProperty("sonar.search.recovery.delayInMs", "1000")
- .setServerProperty("sonar.search.recovery.minAgeInMs", "3000")
- .setServerProperty("sonar.notifications.delay", "1")
+ .addPlugin(xooPlugin())
+ .addPlugin(pluginArtifact("ui-extensions-plugin"))
- .addPlugin(xooPlugin())
- .addPlugin(pluginArtifact("ui-extensions-plugin"))
-
- .setServerProperty("sonar.sonarcloud.enabled", "true")
-
- .build();
+ .setServerProperty("sonar.sonarcloud.enabled", "true"));
}
diff --git a/tests/src/test/java/org/sonarqube/tests/analysis/AnalysisEsResilienceTest.java b/tests/src/test/java/org/sonarqube/tests/analysis/AnalysisEsResilienceTest.java
index 9cb1c5d39dd..2829597e286 100644
--- a/tests/src/test/java/org/sonarqube/tests/analysis/AnalysisEsResilienceTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/analysis/AnalysisEsResilienceTest.java
@@ -64,13 +64,15 @@ public class AnalysisEsResilienceTest {
private static final int esHttpPort = NetworkUtils.getNextAvailablePort(InetAddress.getLoopbackAddress());
static {
- byteman = new Byteman(newOrchestratorBuilder(), CE);
- orchestrator = byteman
- .getOrchestratorBuilder()
- .addPlugin(ItUtils.xooPlugin())
- .setServerProperty("sonar.search.httpPort", "" + esHttpPort)
- .setServerProperty("sonar.sonarcloud.enabled", "true")
- .build();
+ byteman = new Byteman();
+ orchestrator = newOrchestratorBuilder(
+ builder -> {
+ byteman.install(builder, CE);
+ builder
+ .addPlugin(ItUtils.xooPlugin())
+ .setServerProperty("sonar.search.httpPort", "" + esHttpPort)
+ .setServerProperty("sonar.sonarcloud.enabled", "true");
+ });
}
@Rule
@@ -183,8 +185,7 @@ public class AnalysisEsResilienceTest {
tuple("CONFIRMED", 0L),
tuple("REOPENED", 0L),
tuple("RESOLVED", 0L),
- tuple("CLOSED", 0L)
- );
+ tuple("CLOSED", 0L));
tester.elasticsearch().unlockWrites("issues");
@@ -202,8 +203,7 @@ public class AnalysisEsResilienceTest {
tuple("CONFIRMED", 0L),
tuple("REOPENED", 0L),
tuple("RESOLVED", 0L),
- tuple("CLOSED", 0L)
- );
+ tuple("CLOSED", 0L));
}
@Test
diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/AuthorizationSuite.java b/tests/src/test/java/org/sonarqube/tests/authorization/AuthorizationSuite.java
index 7e0c8cb864c..2c92f49dfb7 100644
--- a/tests/src/test/java/org/sonarqube/tests/authorization/AuthorizationSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/authorization/AuthorizationSuite.java
@@ -24,8 +24,8 @@ import org.junit.ClassRule;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
+import static util.ItUtils.installCoreExtension;
import static util.ItUtils.newOrchestratorBuilder;
-import static util.ItUtils.pluginArtifact;
import static util.ItUtils.xooPlugin;
@RunWith(Suite.class)
@@ -42,13 +42,14 @@ import static util.ItUtils.xooPlugin;
public class AuthorizationSuite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- // for SystemPasscodeTest
- // this privileged plugin provides the WS api/system_passcode/check
- // that is used by the tests
- .addPlugin(pluginArtifact("fake-governance-plugin"))
- .setServerProperty("sonar.web.systemPasscode", SystemPasscodeTest.VALID_PASSCODE)
-
- .addPlugin(xooPlugin())
- .build();
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ .setServerProperty("sonar.web.systemPasscode", SystemPasscodeTest.VALID_PASSCODE)
+ .addPlugin(xooPlugin()),
+ server -> {
+ // for SystemPasscodeTest
+ // this core-extension provides the WS api/system_passcode/check
+ // that is used by the tests
+ installCoreExtension(server, "core-extension-it-tests");
+ });
}
diff --git a/tests/src/test/java/org/sonarqube/tests/authorization/SystemPasscodeTest.java b/tests/src/test/java/org/sonarqube/tests/authorization/SystemPasscodeTest.java
index 233c2662d20..fbdafe3697c 100644
--- a/tests/src/test/java/org/sonarqube/tests/authorization/SystemPasscodeTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/authorization/SystemPasscodeTest.java
@@ -22,7 +22,6 @@ package org.sonarqube.tests.authorization;
import com.sonar.orchestrator.Orchestrator;
import java.util.Arrays;
import org.junit.ClassRule;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.qa.util.Tester;
@@ -32,7 +31,6 @@ import org.sonarqube.ws.client.WsResponse;
import static org.assertj.core.api.Assertions.assertThat;
-@Ignore("FIXME IT disabled because it relies on a WS getting injected with core class, ie. a privileged plugin (fake-governance-plugin)")
public class SystemPasscodeTest {
static final String VALID_PASSCODE = "123456";
diff --git a/tests/src/test/java/org/sonarqube/tests/ce/CeShutdownTest.java b/tests/src/test/java/org/sonarqube/tests/ce/CeShutdownTest.java
index ce8678dc292..a2253f43bcc 100644
--- a/tests/src/test/java/org/sonarqube/tests/ce/CeShutdownTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/ce/CeShutdownTest.java
@@ -116,12 +116,12 @@ public class CeShutdownTest {
pauseFile = temp.newFile();
FileUtils.touch(pauseFile);
- orchestrator = newOrchestratorBuilder()
- .setServerProperty("sonar.ce.pauseTask.path", pauseFile.getAbsolutePath())
- .setServerProperty("sonar.ce.gracefulStopTimeOutInMs", "" + timeOutInMs)
- .addPlugin(ItUtils.xooPlugin())
- .addPlugin(ItUtils.pluginArtifact("server-plugin"))
- .build();
+ orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .setServerProperty("sonar.ce.pauseTask.path", pauseFile.getAbsolutePath())
+ .setServerProperty("sonar.ce.gracefulStopTimeOutInMs", "" + timeOutInMs)
+ .addPlugin(ItUtils.xooPlugin())
+ .addPlugin(ItUtils.pluginArtifact("server-plugin")));
orchestrator.start();
adminWsClient = ItUtils.newAdminWsClient(orchestrator);
logsTailer = LogsTailer.builder()
diff --git a/tests/src/test/java/org/sonarqube/tests/ce/CeWorkersTest.java b/tests/src/test/java/org/sonarqube/tests/ce/CeWorkersTest.java
index e70d3377bd9..2bfb2edbbb8 100644
--- a/tests/src/test/java/org/sonarqube/tests/ce/CeWorkersTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/ce/CeWorkersTest.java
@@ -21,7 +21,6 @@ package org.sonarqube.tests.ce;
import com.google.common.collect.ImmutableList;
import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.OrchestratorBuilder;
import com.sonar.orchestrator.build.SonarScanner;
import com.sonar.orchestrator.http.HttpMethod;
import java.io.File;
@@ -43,7 +42,6 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.sonarqube.ws.Ce;
@@ -57,12 +55,11 @@ import static java.lang.String.valueOf;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toSet;
import static org.assertj.core.api.Assertions.assertThat;
+import static util.ItUtils.installCoreExtension;
import static util.ItUtils.newAdminWsClient;
import static util.ItUtils.newOrchestratorBuilder;
-import static util.ItUtils.pluginArtifact;
import static util.ItUtils.xooPlugin;
-@Ignore("FIXME IT disabled because it relies on a privileged plugin (fake-governance-plugin)")
public class CeWorkersTest {
private static final int WAIT = 200; // ms
private static final int MAX_WAIT_LOOP = 5 * 60 * 5; // 5 minutes
@@ -84,13 +81,13 @@ public class CeWorkersTest {
public static void setUp() throws Exception {
sharedMemory = temporaryFolder.newFile();
- OrchestratorBuilder builder = newOrchestratorBuilder()
- .addPlugin(pluginArtifact("fake-governance-plugin"))
- .setServerProperty("fakeGoverance.workerLatch.sharedMemoryFile", sharedMemory.getAbsolutePath())
- // overwrite default value to display heap dump on OOM and reduce max heap
- .setServerProperty("sonar.ce.javaOpts", "-Xmx256m -Xms128m")
- .addPlugin(xooPlugin());
- orchestrator = builder.build();
+ orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .setServerProperty("itTests.workerLatch.sharedMemoryFile", sharedMemory.getAbsolutePath())
+ // overwrite default value to display heap dump on OOM and reduce max heap
+ .setServerProperty("sonar.ce.javaOpts", "-Xmx256m -Xms128m")
+ .addPlugin(xooPlugin()),
+ server -> installCoreExtension(server, "core-extension-it-tests"));
orchestrator.start();
adminWsClient = newAdminWsClient(orchestrator);
diff --git a/tests/src/test/java/org/sonarqube/tests/component/ComponentSuite.java b/tests/src/test/java/org/sonarqube/tests/component/ComponentSuite.java
index 9d08069bc36..cce0e2ad99b 100644
--- a/tests/src/test/java/org/sonarqube/tests/component/ComponentSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/component/ComponentSuite.java
@@ -37,8 +37,10 @@ import static util.ItUtils.xooPlugin;
public class ComponentSuite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = ItUtils.newOrchestratorBuilder()
- .addPlugin(xooPlugin())
- .build();
+ public static final Orchestrator ORCHESTRATOR = ItUtils.newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(xooPlugin())
+
+ );
}
diff --git a/tests/src/test/java/org/sonarqube/tests/duplication/DuplicationSuite.java b/tests/src/test/java/org/sonarqube/tests/duplication/DuplicationSuite.java
index e8c1833f402..e0f4bd3c9ba 100644
--- a/tests/src/test/java/org/sonarqube/tests/duplication/DuplicationSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/duplication/DuplicationSuite.java
@@ -37,8 +37,9 @@ import static util.ItUtils.xooPlugin;
})
public class DuplicationSuite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- .addPlugin(xooPlugin())
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(xooPlugin())
- .build();
+ );
}
diff --git a/tests/src/test/java/org/sonarqube/tests/issue/ExternalIssueSuite.java b/tests/src/test/java/org/sonarqube/tests/issue/ExternalIssueSuite.java
index c5aa35f5f54..e5d78462f05 100644
--- a/tests/src/test/java/org/sonarqube/tests/issue/ExternalIssueSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/issue/ExternalIssueSuite.java
@@ -36,7 +36,9 @@ import util.ItUtils;
public class ExternalIssueSuite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = ItUtils.newOrchestratorBuilder()
- .addPlugin(ItUtils.xooPlugin())
- .build();
+ public static final Orchestrator ORCHESTRATOR = ItUtils.newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(ItUtils.xooPlugin())
+
+ );
}
diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueCreationDatePluginChangedTest.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueCreationDatePluginChangedTest.java
index c085dfa1f72..fcd3d9e4d4d 100644
--- a/tests/src/test/java/org/sonarqube/tests/issue/IssueCreationDatePluginChangedTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueCreationDatePluginChangedTest.java
@@ -69,11 +69,13 @@ public class IssueCreationDatePluginChangedTest {
private static final String USER_EMAIL = "tester@example.org";
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- .addPlugin(xooPlugin())
- .addPlugin(ItUtils.pluginArtifact("backdating-plugin-v1"))
- .addPlugin(ItUtils.pluginArtifact("backdating-customplugin"))
- .build();
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(xooPlugin())
+ .addPlugin(ItUtils.pluginArtifact("backdating-plugin-v1"))
+ .addPlugin(ItUtils.pluginArtifact("backdating-customplugin"))
+
+ );
@Rule
public Tester tester = new Tester(ORCHESTRATOR);
diff --git a/tests/src/test/java/org/sonarqube/tests/issue/IssueSuite.java b/tests/src/test/java/org/sonarqube/tests/issue/IssueSuite.java
index cc6a0097e41..5d700760a77 100644
--- a/tests/src/test/java/org/sonarqube/tests/issue/IssueSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/issue/IssueSuite.java
@@ -53,16 +53,17 @@ import static util.ItUtils.xooPlugin;
public class IssueSuite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- .setServerProperty("sonar.search.httpPort", "9025")
- .addPlugin(xooPlugin())
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ .setServerProperty("sonar.search.httpPort", "9025")
+ .addPlugin(xooPlugin())
- // issue
- .addPlugin(pluginArtifact("issue-filter-plugin"))
+ // issue
+ .addPlugin(pluginArtifact("issue-filter-plugin"))
- // 1 second. Required for notification test.
- .setServerProperty("sonar.notifications.delay", "1")
+ // 1 second. Required for notification test.
+ .setServerProperty("sonar.notifications.delay", "1")
- .build();
+ );
}
diff --git a/tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssueSuite.java b/tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssueSuite.java
index 943657e0721..3cfc081c2ed 100644
--- a/tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssueSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/issue/OrganizationIssueSuite.java
@@ -34,11 +34,12 @@ import static util.ItUtils.xooPlugin;
public class OrganizationIssueSuite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- .addPlugin(xooPlugin())
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(xooPlugin())
- .setServerProperty("sonar.sonarcloud.enabled", "true")
+ .setServerProperty("sonar.sonarcloud.enabled", "true")
- .build();
+ );
}
diff --git a/tests/src/test/java/org/sonarqube/tests/lite/LiteTest.java b/tests/src/test/java/org/sonarqube/tests/lite/LiteTest.java
index 0c89f7cd8fe..87a49287b39 100644
--- a/tests/src/test/java/org/sonarqube/tests/lite/LiteTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/lite/LiteTest.java
@@ -25,14 +25,14 @@ import org.junit.ClassRule;
import org.junit.Test;
import org.junit.rules.RuleChain;
import org.sonarqube.qa.util.Tester;
-import org.sonarqube.ws.Issues;
import org.sonarqube.ws.Components;
+import org.sonarqube.ws.Issues;
import org.sonarqube.ws.Measures;
import org.sonarqube.ws.client.components.TreeRequest;
import org.sonarqube.ws.client.issues.IssuesService;
import org.sonarqube.ws.client.issues.SearchRequest;
-import org.sonarqube.ws.client.measures.ComponentTreeRequest;
import org.sonarqube.ws.client.measures.ComponentRequest;
+import org.sonarqube.ws.client.measures.ComponentTreeRequest;
import org.sonarqube.ws.client.measures.MeasuresService;
import static java.util.Arrays.asList;
@@ -46,10 +46,10 @@ public class LiteTest {
private static final String PROJECT_KEY = "com.sonarsource.it.samples:multi-modules-sample";
- private static Orchestrator orchestrator = newOrchestratorBuilder()
- .setOrchestratorProperty("sonar.web.context", "/sonarqube")
- .addPlugin(xooPlugin())
- .build();
+ private static Orchestrator orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .setOrchestratorProperty("sonar.web.context", "/sonarqube")
+ .addPlugin(xooPlugin()));
private static Tester tester = new Tester(orchestrator);
diff --git a/tests/src/test/java/org/sonarqube/tests/marketplace/UpdateCenterTest.java b/tests/src/test/java/org/sonarqube/tests/marketplace/UpdateCenterTest.java
index 8e50a080451..e64590cb23e 100644
--- a/tests/src/test/java/org/sonarqube/tests/marketplace/UpdateCenterTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/marketplace/UpdateCenterTest.java
@@ -37,10 +37,12 @@ import static util.ItUtils.pluginArtifact;
public class UpdateCenterTest {
@ClassRule
- public static final Orchestrator orchestrator = newOrchestratorBuilder()
- .setServerProperty("sonar.updatecenter.url", UpdateCenterTest.class.getResource("/marketplace/UpdateCenterTest/update-center.properties").toString())
- .addPlugin(pluginArtifact("sonar-fake-plugin"))
- .build();
+ public static final Orchestrator orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .setServerProperty("sonar.updatecenter.url", UpdateCenterTest.class.getResource("/marketplace/UpdateCenterTest/update-center.properties").toString())
+ .addPlugin(pluginArtifact("sonar-fake-plugin"))
+
+ );
@Rule
public UserRule userRule = UserRule.from(orchestrator);
@@ -57,10 +59,10 @@ public class UpdateCenterTest {
MarketplacePage page = nav.logIn().submitCredentials(userRule.createAdminUser()).openMarketplace();
page
.hasPluginsCount(2)
- .hasPluginWithText("Fake","installed")
- .hasPluginWithText("Fake","Uninstall")
- .hasPluginWithText("Fake","Licensed under GNU LGPL 3")
- .hasPluginWithText("Fake","Developed by SonarSource");
+ .hasPluginWithText("Fake", "installed")
+ .hasPluginWithText("Fake", "Uninstall")
+ .hasPluginWithText("Fake", "Licensed under GNU LGPL 3")
+ .hasPluginWithText("Fake", "Developed by SonarSource");
page
.searchPlugin("fa")
diff --git a/tests/src/test/java/org/sonarqube/tests/measure/MeasureSuite.java b/tests/src/test/java/org/sonarqube/tests/measure/MeasureSuite.java
index ea6ad5d0e7f..ee937ed3658 100644
--- a/tests/src/test/java/org/sonarqube/tests/measure/MeasureSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/measure/MeasureSuite.java
@@ -45,12 +45,13 @@ import static util.ItUtils.xooPlugin;
public class MeasureSuite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- .addPlugin(xooPlugin())
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(xooPlugin())
- // used by DecimalScaleMetricTest
- .addPlugin(pluginArtifact("batch-plugin"))
+ // used by DecimalScaleMetricTest
+ .addPlugin(pluginArtifact("batch-plugin"))
- .build();
+ );
}
diff --git a/tests/src/test/java/org/sonarqube/tests/organization/OrganizationSuite.java b/tests/src/test/java/org/sonarqube/tests/organization/OrganizationSuite.java
index 0e77d7c2854..a2b6c311e43 100644
--- a/tests/src/test/java/org/sonarqube/tests/organization/OrganizationSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/organization/OrganizationSuite.java
@@ -41,13 +41,14 @@ import static util.ItUtils.xooPlugin;
public class OrganizationSuite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
- .addPlugin(xooPlugin())
- .addPlugin(pluginArtifact("fake-billing-plugin"))
- .addPlugin(pluginArtifact("ui-extensions-plugin"))
+ .addPlugin(xooPlugin())
+ .addPlugin(pluginArtifact("fake-billing-plugin"))
+ .addPlugin(pluginArtifact("ui-extensions-plugin"))
- .setServerProperty("sonar.sonarcloud.enabled", "true")
+ .setServerProperty("sonar.sonarcloud.enabled", "true")
- .build();
+ );
}
diff --git a/tests/src/test/java/org/sonarqube/tests/performance/scanner/ScannerPerformanceSuite.java b/tests/src/test/java/org/sonarqube/tests/performance/scanner/ScannerPerformanceSuite.java
index 24eab925762..e7143961452 100644
--- a/tests/src/test/java/org/sonarqube/tests/performance/scanner/ScannerPerformanceSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/performance/scanner/ScannerPerformanceSuite.java
@@ -43,14 +43,14 @@ import static util.ItUtils.xooPlugin;
public class ScannerPerformanceSuite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- .addPlugin(xooPlugin())
- // should not be so high, but required as long embedded h2 is used -> requires more memory on server
- .setServerProperty("sonar.web.javaOpts", "-Xmx1G -XX:+HeapDumpOnOutOfMemoryError")
- // Needed by DuplicationTest::hugeJavaFile
- .addPlugin(MavenLocation.of("org.sonarsource.java", "sonar-java-plugin", "LATEST_RELEASE"))
- .restoreProfileAtStartup(FileLocation.ofClasspath("/one-xoo-issue-per-line.xml"))
- .build();
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(xooPlugin())
+ // should not be so high, but required as long embedded h2 is used -> requires more memory on server
+ .setServerProperty("sonar.web.javaOpts", "-Xmx1G -XX:+HeapDumpOnOutOfMemoryError")
+ // Needed by DuplicationTest::hugeJavaFile
+ .addPlugin(MavenLocation.of("org.sonarsource.java", "sonar-java-plugin", "LATEST_RELEASE"))
+ .restoreProfileAtStartup(FileLocation.ofClasspath("/one-xoo-issue-per-line.xml")));
@BeforeClass
public static void setUp() {
diff --git a/tests/src/test/java/org/sonarqube/tests/performance/server/ComputeEnginePerfTest.java b/tests/src/test/java/org/sonarqube/tests/performance/server/ComputeEnginePerfTest.java
index f6e15a279a1..864aba6512a 100644
--- a/tests/src/test/java/org/sonarqube/tests/performance/server/ComputeEnginePerfTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/performance/server/ComputeEnginePerfTest.java
@@ -44,13 +44,13 @@ public class ComputeEnginePerfTest extends AbstractPerfTest {
public static TemporaryFolder temp = new TemporaryFolder();
@ClassRule
- public static Orchestrator orchestrator = newOrchestratorBuilder()
- .addPlugin(xooPlugin())
- .setServerProperty(
- "sonar.web.javaOpts",
- String.format("-Xms%dm -Xmx%dm -XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true", MAX_HEAP_SIZE_IN_MEGA, MAX_HEAP_SIZE_IN_MEGA))
- .restoreProfileAtStartup(FileLocation.ofClasspath("/one-xoo-issue-per-line.xml"))
- .build();
+ public static Orchestrator orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(xooPlugin())
+ .setServerProperty(
+ "sonar.web.javaOpts",
+ String.format("-Xms%dm -Xmx%dm -XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true", MAX_HEAP_SIZE_IN_MEGA, MAX_HEAP_SIZE_IN_MEGA))
+ .restoreProfileAtStartup(FileLocation.ofClasspath("/one-xoo-issue-per-line.xml")));
private static File bigProjectBaseDir;
diff --git a/tests/src/test/java/org/sonarqube/tests/performance/server/ServerPerfTest.java b/tests/src/test/java/org/sonarqube/tests/performance/server/ServerPerfTest.java
index 2d147551db5..0b99aeaa36d 100644
--- a/tests/src/test/java/org/sonarqube/tests/performance/server/ServerPerfTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/performance/server/ServerPerfTest.java
@@ -20,8 +20,6 @@
package org.sonarqube.tests.performance.server;
import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.locator.FileLocation;
-import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.Date;
@@ -46,15 +44,17 @@ public class ServerPerfTest extends AbstractPerfTest {
@Test
public void server_startup_and_shutdown() throws Exception {
String defaultWebJavaOptions = "-Xmx768m -XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true -Dfile.encoding=UTF-8";
- Orchestrator orchestrator = newOrchestratorBuilder()
- .addPlugin(xooPlugin())
+ Orchestrator orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(xooPlugin())
- // See http://wiki.apache.org/tomcat/HowTo/FasterStartUp
- // Sometimes source of entropy is too small and Tomcat spends ~20 seconds on the step :
- // "Creation of SecureRandom instance for session ID generation using [SHA1PRNG]"
- // Using /dev/urandom fixes the issue on linux
- .setServerProperty("sonar.web.javaOpts", defaultWebJavaOptions + " -Djava.security.egd=file:/dev/./urandom")
- .build();
+ // See http://wiki.apache.org/tomcat/HowTo/FasterStartUp
+ // Sometimes source of entropy is too small and Tomcat spends ~20 seconds on the step :
+ // "Creation of SecureRandom instance for session ID generation using [SHA1PRNG]"
+ // Using /dev/urandom fixes the issue on linux
+ .setServerProperty("sonar.web.javaOpts", defaultWebJavaOptions + " -Djava.security.egd=file:/dev/./urandom")
+
+ );
try {
ServerLogs.clear(orchestrator);
orchestrator.start();
diff --git a/tests/src/test/java/org/sonarqube/tests/project/OrganizationProjectSuite.java b/tests/src/test/java/org/sonarqube/tests/project/OrganizationProjectSuite.java
index 75dc194bac2..7aae5bd8be3 100644
--- a/tests/src/test/java/org/sonarqube/tests/project/OrganizationProjectSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/project/OrganizationProjectSuite.java
@@ -52,20 +52,21 @@ public class OrganizationProjectSuite {
static final int SEARCH_HTTP_PORT = NetworkUtils.getNextAvailablePort(InetAddress.getLoopbackAddress());
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- // for ES resiliency tests
- .setServerProperty("sonar.search.httpPort", "" + SEARCH_HTTP_PORT)
- .setServerProperty("sonar.search.recovery.delayInMs", "1000")
- .setServerProperty("sonar.search.recovery.minAgeInMs", "3000")
- .setServerProperty("sonar.notifications.delay", "1")
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ // for ES resiliency tests
+ .setServerProperty("sonar.search.httpPort", "" + SEARCH_HTTP_PORT)
+ .setServerProperty("sonar.search.recovery.delayInMs", "1000")
+ .setServerProperty("sonar.search.recovery.minAgeInMs", "3000")
+ .setServerProperty("sonar.notifications.delay", "1")
- .setServerProperty("sonar.sonarcloud.enabled", "true")
+ .setServerProperty("sonar.sonarcloud.enabled", "true")
- .addPlugin(xooPlugin())
+ .addPlugin(xooPlugin())
- // for ProjectSettingsTest
- .addPlugin(pluginArtifact("sonar-subcategories-plugin"))
+ // for ProjectSettingsTest
+ .addPlugin(pluginArtifact("sonar-subcategories-plugin"))
- .build();
+ );
}
diff --git a/tests/src/test/java/org/sonarqube/tests/project/ProjectSuite.java b/tests/src/test/java/org/sonarqube/tests/project/ProjectSuite.java
index b469378dce4..79975d34715 100644
--- a/tests/src/test/java/org/sonarqube/tests/project/ProjectSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/project/ProjectSuite.java
@@ -40,18 +40,19 @@ public class ProjectSuite {
static final int SEARCH_HTTP_PORT = NetworkUtils.getNextAvailablePort(InetAddress.getLoopbackAddress());
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- // for ES resiliency tests
- .setServerProperty("sonar.search.httpPort", "" + SEARCH_HTTP_PORT)
- .setServerProperty("sonar.search.recovery.delayInMs", "1000")
- .setServerProperty("sonar.search.recovery.minAgeInMs", "3000")
- .setServerProperty("sonar.notifications.delay", "1")
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ // for ES resiliency tests
+ .setServerProperty("sonar.search.httpPort", "" + SEARCH_HTTP_PORT)
+ .setServerProperty("sonar.search.recovery.delayInMs", "1000")
+ .setServerProperty("sonar.search.recovery.minAgeInMs", "3000")
+ .setServerProperty("sonar.notifications.delay", "1")
- .addPlugin(xooPlugin())
+ .addPlugin(xooPlugin())
- // for ProjectSettingsTest
- .addPlugin(pluginArtifact("sonar-subcategories-plugin"))
+ // for ProjectSettingsTest
+ .addPlugin(pluginArtifact("sonar-subcategories-plugin"))
- .build();
+ );
}
diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateSuite.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateSuite.java
index f91b9cdfbba..d3c1a816e6a 100644
--- a/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/OrganizationQualityGateSuite.java
@@ -37,13 +37,15 @@ import static util.ItUtils.xooPlugin;
public class OrganizationQualityGateSuite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- // required for notification tests
- .setServerProperty("sonar.notifications.delay", "1")
- .setServerProperty("sonar.sonarcloud.enabled", "true")
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ // required for notification tests
+ .setServerProperty("sonar.notifications.delay", "1")
+ .setServerProperty("sonar.sonarcloud.enabled", "true")
- .addPlugin(pluginArtifact("posttask-plugin"))
- .addPlugin(xooPlugin())
- .build();
+ .addPlugin(pluginArtifact("posttask-plugin"))
+ .addPlugin(xooPlugin())
+
+ );
}
diff --git a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateSuite.java b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateSuite.java
index 910144e75cb..3cb1b8a9205 100644
--- a/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/qualityGate/QualityGateSuite.java
@@ -39,12 +39,14 @@ import static util.ItUtils.xooPlugin;
public class QualityGateSuite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- // required for notification tests
- .setServerProperty("sonar.notifications.delay", "1")
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ // required for notification tests
+ .setServerProperty("sonar.notifications.delay", "1")
- .addPlugin(pluginArtifact("posttask-plugin"))
- .addPlugin(xooPlugin())
- .build();
+ .addPlugin(pluginArtifact("posttask-plugin"))
+ .addPlugin(xooPlugin())
+
+ );
}
diff --git a/tests/src/test/java/org/sonarqube/tests/qualityModel/QualityModelSuite.java b/tests/src/test/java/org/sonarqube/tests/qualityModel/QualityModelSuite.java
index b796cfe6b84..ee286940e76 100644
--- a/tests/src/test/java/org/sonarqube/tests/qualityModel/QualityModelSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/qualityModel/QualityModelSuite.java
@@ -41,9 +41,10 @@ import static util.ItUtils.xooPlugin;
public class QualityModelSuite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- .addPlugin(xooPlugin())
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(xooPlugin())
- .build();
+ );
}
diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/ActiveRuleEsResilienceTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/ActiveRuleEsResilienceTest.java
index 1320f6447fe..9ba5c3505c7 100644
--- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/ActiveRuleEsResilienceTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/ActiveRuleEsResilienceTest.java
@@ -48,14 +48,15 @@ public class ActiveRuleEsResilienceTest {
private static final Byteman byteman;
static {
- byteman = new Byteman(newOrchestratorBuilder(), WEB);
- orchestrator = byteman
- .getOrchestratorBuilder()
- .setServerProperty("sonar.search.recovery.delayInMs", "1000")
- .setServerProperty("sonar.search.recovery.minAgeInMs", "3000")
- .setServerProperty("sonar.sonarcloud.enabled", "true")
- .addPlugin(ItUtils.xooPlugin())
- .build();
+ byteman = new Byteman();
+ orchestrator = newOrchestratorBuilder(
+ builder -> {
+ byteman.install(builder, WEB);
+ builder.setServerProperty("sonar.search.recovery.delayInMs", "1000")
+ .setServerProperty("sonar.search.recovery.minAgeInMs", "3000")
+ .setServerProperty("sonar.sonarcloud.enabled", "true")
+ .addPlugin(ItUtils.xooPlugin());
+ });
}
@Before
diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java
index 91b687b2d94..4001581cc8f 100644
--- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/BuiltInQualityProfilesNotificationTest.java
@@ -68,11 +68,11 @@ public class BuiltInQualityProfilesNotificationTest {
@Test
public void does_not_send_mail_if_no_quality_profile_is_updated() throws Exception {
- orchestrator = newOrchestratorBuilder()
- .addPlugin(pluginArtifact("foo-plugin-v1"))
- .setServerProperty("email.smtp_host.secured", "localhost")
- .setServerProperty("email.smtp_port.secured", Integer.toString(smtpServer.getServer().getPort()))
- .build();
+ orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(pluginArtifact("foo-plugin-v1"))
+ .setServerProperty("email.smtp_host.secured", "localhost")
+ .setServerProperty("email.smtp_port.secured", Integer.toString(smtpServer.getServer().getPort())));
orchestrator.start();
userRule = UserRule.from(orchestrator);
Users.CreateWsResponse.User profileAdmin1 = userRule.generate();
@@ -87,12 +87,12 @@ public class BuiltInQualityProfilesNotificationTest {
@Test
public void send_mail_if_quality_profile_is_updated() throws Exception {
- orchestrator = newOrchestratorBuilder()
- .addPlugin(pluginArtifact("foo-plugin-v1"))
- .setServerProperty("sonar.notifications.delay", "1")
- .setServerProperty("email.smtp_host.secured", "localhost")
- .setServerProperty("email.smtp_port.secured", Integer.toString(smtpServer.getServer().getPort()))
- .build();
+ orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(pluginArtifact("foo-plugin-v1"))
+ .setServerProperty("sonar.notifications.delay", "1")
+ .setServerProperty("email.smtp_host.secured", "localhost")
+ .setServerProperty("email.smtp_port.secured", Integer.toString(smtpServer.getServer().getPort())));
orchestrator.start();
userRule = UserRule.from(orchestrator);
@@ -143,7 +143,6 @@ public class BuiltInQualityProfilesNotificationTest {
"This is a good time to review your quality profiles and update them to benefit from the latest evolutions: " + url + "/profiles")
.isEqualTo(messages.get(1).getMimeMessage().getContent().toString());
-
// uninstall plugin V2
wsClient.wsConnector().call(new PostRequest("api/plugins/uninstall").setParam("key", "foo")).failIfNotSuccessful();
// install plugin V1
@@ -175,12 +174,12 @@ public class BuiltInQualityProfilesNotificationTest {
@Test
public void do_not_send_mail_if_notifications_are_disabled_in_settings() throws Exception {
- orchestrator = newOrchestratorBuilder()
- .addPlugin(pluginArtifact("foo-plugin-v1"))
- .setServerProperty("sonar.builtInQualityProfiles.disableNotificationOnUpdate", "true")
- .setServerProperty("email.smtp_host.secured", "localhost")
- .setServerProperty("email.smtp_port.secured", Integer.toString(smtpServer.getServer().getPort()))
- .build();
+ orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(pluginArtifact("foo-plugin-v1"))
+ .setServerProperty("sonar.builtInQualityProfiles.disableNotificationOnUpdate", "true")
+ .setServerProperty("email.smtp_host.secured", "localhost")
+ .setServerProperty("email.smtp_port.secured", Integer.toString(smtpServer.getServer().getPort())));
orchestrator.start();
userRule = UserRule.from(orchestrator);
Users.CreateWsResponse.User profileAdmin1 = userRule.generate();
diff --git a/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfileUpdateTest.java b/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfileUpdateTest.java
index be34df9fccd..f0a66d8ca5e 100644
--- a/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfileUpdateTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/qualityProfile/QualityProfileUpdateTest.java
@@ -54,10 +54,11 @@ public class QualityProfileUpdateTest {
@Test
// SONAR-10363
public void updating_an_analyzer_must_update_default_quality_profile() {
- orchestrator = newOrchestratorBuilder()
- .addPlugin(pluginArtifact("foo-plugin-v1"))
-// .setServerProperty("sonar.sonarcloud.enabled", "true")
- .build();
+ orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(pluginArtifact("foo-plugin-v1"))
+ // .setServerProperty("sonar.sonarcloud.enabled", "true"))
+ );
orchestrator.start();
tester = new Tester(orchestrator);
tester.before();
diff --git a/tests/src/test/java/org/sonarqube/tests/rule/RuleEsResilienceTest.java b/tests/src/test/java/org/sonarqube/tests/rule/RuleEsResilienceTest.java
index 1163564bbba..4749cb89790 100644
--- a/tests/src/test/java/org/sonarqube/tests/rule/RuleEsResilienceTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/rule/RuleEsResilienceTest.java
@@ -47,13 +47,15 @@ public class RuleEsResilienceTest {
private static final Byteman byteman;
static {
- byteman = new Byteman(newOrchestratorBuilder(), WEB);
- orchestrator = byteman
- .getOrchestratorBuilder()
- .setServerProperty("sonar.search.recovery.delayInMs", "1000")
- .setServerProperty("sonar.search.recovery.minAgeInMs", "3000")
- .addPlugin(ItUtils.xooPlugin())
- .build();
+ byteman = new Byteman();
+ orchestrator = newOrchestratorBuilder(
+ builder -> {
+ byteman.install(builder, WEB);
+ builder
+ .setServerProperty("sonar.search.recovery.delayInMs", "1000")
+ .setServerProperty("sonar.search.recovery.minAgeInMs", "3000")
+ .addPlugin(ItUtils.xooPlugin());
+ });
}
@Before
diff --git a/tests/src/test/java/org/sonarqube/tests/rule/RuleReKeyingTest.java b/tests/src/test/java/org/sonarqube/tests/rule/RuleReKeyingTest.java
index db88a57a092..7508cdd8a37 100644
--- a/tests/src/test/java/org/sonarqube/tests/rule/RuleReKeyingTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/rule/RuleReKeyingTest.java
@@ -61,9 +61,9 @@ public class RuleReKeyingTest {
@Test
public void rules_are_re_keyed_when_upgrading_and_downgrading_plugin() {
- orchestrator = newOrchestratorBuilder()
- .addPlugin(pluginArtifact("foo-plugin-v1"))
- .build();
+ orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(pluginArtifact("foo-plugin-v1")));
orchestrator.start();
tester = new Tester(orchestrator);
diff --git a/tests/src/test/java/org/sonarqube/tests/serverSystem/BlueGreenTest.java b/tests/src/test/java/org/sonarqube/tests/serverSystem/BlueGreenTest.java
index 5a9c01d65fe..041bc71e128 100644
--- a/tests/src/test/java/org/sonarqube/tests/serverSystem/BlueGreenTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/serverSystem/BlueGreenTest.java
@@ -69,10 +69,10 @@ public class BlueGreenTest {
@Test
public void upgrade_analyzer_when_analysis_is_pending_in_compute_engine_queue() throws Exception {
- orchestrator = newOrchestratorBuilder()
+ orchestrator = newOrchestratorBuilder(
+ builder -> builder
.addPlugin(pluginArtifact("blue-green-plugin-v1"))
- .addPlugin(xooPlugin())
- .build();
+ .addPlugin(xooPlugin()));
tester = new Tester(orchestrator).disableOrganizations();
orchestrator.start();
tester.before();
diff --git a/tests/src/test/java/org/sonarqube/tests/serverSystem/RestartTest.java b/tests/src/test/java/org/sonarqube/tests/serverSystem/RestartTest.java
index 532925b7c50..52d45e81933 100644
--- a/tests/src/test/java/org/sonarqube/tests/serverSystem/RestartTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/serverSystem/RestartTest.java
@@ -64,9 +64,9 @@ public class RestartTest {
public void restart_in_prod_mode_requires_sysadmin_permission_and_restarts() throws Exception {
// server classloader locks Jar files on Windows
if (!SystemUtils.IS_OS_WINDOWS) {
- orchestrator = newOrchestratorBuilder()
- .setOrchestratorProperty("orchestrator.keepWorkspace", "true")
- .build();
+ orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .setOrchestratorProperty("orchestrator.keepWorkspace", "true"));
orchestrator.start();
verifyFailWith403(() -> newWsClient(orchestrator).system().restart());
diff --git a/tests/src/test/java/org/sonarqube/tests/serverSystem/ServerSystemRestartingOrchestrator.java b/tests/src/test/java/org/sonarqube/tests/serverSystem/ServerSystemRestartingOrchestrator.java
index ed4fd75d914..593a06215e3 100644
--- a/tests/src/test/java/org/sonarqube/tests/serverSystem/ServerSystemRestartingOrchestrator.java
+++ b/tests/src/test/java/org/sonarqube/tests/serverSystem/ServerSystemRestartingOrchestrator.java
@@ -20,7 +20,6 @@
package org.sonarqube.tests.serverSystem;
import com.sonar.orchestrator.Orchestrator;
-import com.sonar.orchestrator.locator.FileLocation;
import java.io.File;
import org.apache.commons.io.FileUtils;
import org.junit.After;
@@ -32,6 +31,7 @@ import util.ItUtils;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
+import static util.ItUtils.locationOf;
import static util.ItUtils.newAdminWsClient;
import static util.ItUtils.newOrchestratorBuilder;
@@ -58,9 +58,9 @@ public class ServerSystemRestartingOrchestrator {
@Test
public void check_minimal_sonar_version_at_startup() throws Exception {
try {
- orchestrator = newOrchestratorBuilder()
- .addPlugin(FileLocation.of(new File(ServerSystemRestartingOrchestrator.class.getResource("/serverSystem/ServerSystemTest/incompatible-plugin-1.0.jar").toURI())))
- .build();
+ orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(locationOf(ServerSystemRestartingOrchestrator.class.getResource("/serverSystem/ServerSystemTest/incompatible-plugin-1.0.jar"))));
orchestrator.start();
fail();
} catch (Exception e) {
@@ -73,9 +73,9 @@ public class ServerSystemRestartingOrchestrator {
public void support_install_dir_with_whitespaces() throws Exception {
String dirName = "build/distributions/has space";
FileUtils.deleteDirectory(new File(dirName));
- orchestrator = newOrchestratorBuilder()
- .setOrchestratorProperty("orchestrator.workspaceDir", dirName)
- .build();
+ orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .setOrchestratorProperty("orchestrator.workspaceDir", dirName));
orchestrator.start();
assertThat(newAdminWsClient(orchestrator).system().status().getStatus()).isEqualTo(System.Status.UP);
@@ -84,10 +84,10 @@ public class ServerSystemRestartingOrchestrator {
// SONAR-4748
@Test
public void should_create_in_temp_folder() throws Exception {
- orchestrator = newOrchestratorBuilder()
- .addPlugin(ItUtils.pluginArtifact("server-plugin"))
- .setServerProperty("sonar.createTempFiles", "true")
- .build();
+ orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(ItUtils.pluginArtifact("server-plugin"))
+ .setServerProperty("sonar.createTempFiles", "true"));
orchestrator.start();
File tempDir = new File(orchestrator.getServer().getHome(), "temp/tmp");
diff --git a/tests/src/test/java/org/sonarqube/tests/serverSystem/SystemStateTest.java b/tests/src/test/java/org/sonarqube/tests/serverSystem/SystemStateTest.java
index 7a2ee2e42a5..14cf8137b5f 100644
--- a/tests/src/test/java/org/sonarqube/tests/serverSystem/SystemStateTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/serverSystem/SystemStateTest.java
@@ -129,13 +129,13 @@ public class SystemStateTest {
void start(Lock lock) {
checkState(orchestrator == null);
- orchestrator = newOrchestratorBuilder()
- .addPlugin(pluginArtifact("server-plugin"))
- .setServerProperty("sonar.web.startupLock.path", lock.webFile.getAbsolutePath())
- .setServerProperty("sonar.ce.startupLock.path", lock.ceFile.getAbsolutePath())
- .setServerProperty("sonar.search.httpPort", "" + esHttpPort)
- .setServerProperty("sonar.web.systemPasscode", systemPassCode)
- .build();
+ orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(pluginArtifact("server-plugin"))
+ .setServerProperty("sonar.web.startupLock.path", lock.webFile.getAbsolutePath())
+ .setServerProperty("sonar.ce.startupLock.path", lock.ceFile.getAbsolutePath())
+ .setServerProperty("sonar.search.httpPort", "" + esHttpPort)
+ .setServerProperty("sonar.web.systemPasscode", systemPassCode));
elasticsearch = new Elasticsearch(esHttpPort);
starter = new Thread(orchestrator::start);
diff --git a/tests/src/test/java/org/sonarqube/tests/settings/SettingsSuite.java b/tests/src/test/java/org/sonarqube/tests/settings/SettingsSuite.java
index 0b73df2a436..d987479b1d0 100644
--- a/tests/src/test/java/org/sonarqube/tests/settings/SettingsSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/settings/SettingsSuite.java
@@ -34,10 +34,8 @@ import static util.ItUtils.xooPlugin;
public class SettingsSuite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = ItUtils.newOrchestratorBuilder()
-
- .addPlugin(xooPlugin())
-
- .build();
+ public static final Orchestrator ORCHESTRATOR = ItUtils.newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(xooPlugin()));
}
diff --git a/tests/src/test/java/org/sonarqube/tests/settings/SettingsTestRestartingOrchestrator.java b/tests/src/test/java/org/sonarqube/tests/settings/SettingsTestRestartingOrchestrator.java
index 1c4f5a88e3e..5360e463b55 100644
--- a/tests/src/test/java/org/sonarqube/tests/settings/SettingsTestRestartingOrchestrator.java
+++ b/tests/src/test/java/org/sonarqube/tests/settings/SettingsTestRestartingOrchestrator.java
@@ -60,11 +60,11 @@ public class SettingsTestRestartingOrchestrator {
@Test
public void test_settings() {
URL secretKeyUrl = getClass().getResource("/settings/SettingsTest/sonar-secret.txt");
- orchestrator = newOrchestratorBuilder()
- .addPlugin(pluginArtifact("settings-plugin"))
- .addPlugin(pluginArtifact("license-plugin"))
- .setServerProperty("sonar.secretKeyPath", secretKeyUrl.getFile())
- .build();
+ orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(pluginArtifact("settings-plugin"))
+ .addPlugin(pluginArtifact("license-plugin"))
+ .setServerProperty("sonar.secretKeyPath", secretKeyUrl.getFile()));
startOrchestrator();
String adminUser = userRule.createAdminUser();
@@ -86,11 +86,11 @@ public class SettingsTestRestartingOrchestrator {
@Test
public void property_relocation() {
- orchestrator = newOrchestratorBuilder()
+ orchestrator = newOrchestratorBuilder(
+ builder -> builder
.addPlugin(pluginArtifact("property-relocation-plugin"))
.addPlugin(xooPlugin())
- .setServerProperty("sonar.deprecatedKey", "true")
- .build();
+ .setServerProperty("sonar.deprecatedKey", "true"));
startOrchestrator();
SonarScanner withDeprecatedKey = SonarScanner.create(projectDir("shared/xoo-sample"))
diff --git a/tests/src/test/java/org/sonarqube/tests/source/SourceSuite.java b/tests/src/test/java/org/sonarqube/tests/source/SourceSuite.java
index 11b0f7f8a6d..075ffdf6d64 100644
--- a/tests/src/test/java/org/sonarqube/tests/source/SourceSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/source/SourceSuite.java
@@ -39,9 +39,9 @@ import static util.ItUtils.xooPlugin;
public class SourceSuite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- .addPlugin(xooPlugin())
- .addPlugin(MavenLocation.of("org.sonarsource.scm.git", "sonar-scm-git-plugin", "LATEST_RELEASE"))
- .build();
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(xooPlugin())
+ .addPlugin(MavenLocation.of("org.sonarsource.scm.git", "sonar-scm-git-plugin", "LATEST_RELEASE")));
}
diff --git a/tests/src/test/java/org/sonarqube/tests/startup/StartupIndexationTest.java b/tests/src/test/java/org/sonarqube/tests/startup/StartupIndexationTest.java
index f654949bd26..47a5eb16fe6 100644
--- a/tests/src/test/java/org/sonarqube/tests/startup/StartupIndexationTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/startup/StartupIndexationTest.java
@@ -50,8 +50,8 @@ public class StartupIndexationTest {
@Test
public void elasticsearch_error_at_startup_must_shutdown_node() throws Exception {
try (SonarQube sonarQube = new SonarQube();
- LogsTailer.Watch failedInitialization = sonarQube.logsTailer.watch("Background initialization failed. Stopping SonarQube");
- LogsTailer.Watch stopWatcher = sonarQube.logsTailer.watch("SonarQube is stopped")) {
+ LogsTailer.Watch failedInitialization = sonarQube.logsTailer.watch("Background initialization failed. Stopping SonarQube");
+ LogsTailer.Watch stopWatcher = sonarQube.logsTailer.watch("SonarQube is stopped")) {
sonarQube.lockAllElasticsearchWrites();
sonarQube.resume();
stopWatcher.waitForLog(10, TimeUnit.SECONDS);
@@ -61,7 +61,7 @@ public class StartupIndexationTest {
// Restarting is recreating the indexes
try (SonarQube sonarQube = new SonarQube();
- LogsTailer.Watch sonarQubeIsUpWatcher = sonarQube.logsTailer.watch("SonarQube is up")) {
+ LogsTailer.Watch sonarQubeIsUpWatcher = sonarQube.logsTailer.watch("SonarQube is up")) {
sonarQube.resume();
sonarQubeIsUpWatcher.waitForLog(20, TimeUnit.SECONDS);
SearchRequest searchRequest = new SearchRequest().setQ("admin");
@@ -82,12 +82,12 @@ public class StartupIndexationTest {
pauseFile = temp.newFile();
FileUtils.touch(pauseFile);
- orchestrator = newOrchestratorBuilder()
- .setServerProperty("sonar.web.pause.path", pauseFile.getAbsolutePath())
- .addPlugin(pluginArtifact("wait-at-platform-level4-plugin"))
- .setStartupLogWatcher(l -> l.contains("PlatformLevel4 initialization phase is paused"))
- .setServerProperty("sonar.search.httpPort", "" + esHttpPort)
- .build();
+ orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .setServerProperty("sonar.web.pause.path", pauseFile.getAbsolutePath())
+ .addPlugin(pluginArtifact("wait-at-platform-level4-plugin"))
+ .setStartupLogWatcher(l -> l.contains("PlatformLevel4 initialization phase is paused"))
+ .setServerProperty("sonar.search.httpPort", "" + esHttpPort));
tester = new Tester(orchestrator);
orchestrator.start();
diff --git a/tests/src/test/java/org/sonarqube/tests/telemetry/TelemetryOptOutTest.java b/tests/src/test/java/org/sonarqube/tests/telemetry/TelemetryOptOutTest.java
index a827baa6282..120e4e55f3d 100644
--- a/tests/src/test/java/org/sonarqube/tests/telemetry/TelemetryOptOutTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/telemetry/TelemetryOptOutTest.java
@@ -39,12 +39,12 @@ public class TelemetryOptOutTest {
public static MockWebServer server = new MockWebServer();
- private static Orchestrator orchestrator = newOrchestratorBuilder()
+ private static Orchestrator orchestrator = newOrchestratorBuilder(
+ builder -> builder
.addPlugin(xooPlugin())
.setServerProperty("sonar.telemetry.enable", "false")
.setServerProperty("sonar.telemetry.url", server.url("").toString())
- .setServerProperty("sonar.telemetry.frequencyInSeconds", "1")
- .build();
+ .setServerProperty("sonar.telemetry.frequencyInSeconds", "1"));
private static Tester tester = new Tester(orchestrator);
@ClassRule
diff --git a/tests/src/test/java/org/sonarqube/tests/telemetry/TelemetryUploadTest.java b/tests/src/test/java/org/sonarqube/tests/telemetry/TelemetryUploadTest.java
index 5257a8847cf..56790db2bdb 100644
--- a/tests/src/test/java/org/sonarqube/tests/telemetry/TelemetryUploadTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/telemetry/TelemetryUploadTest.java
@@ -61,13 +61,14 @@ public class TelemetryUploadTest {
@Test
public void sent_telemetry_data() throws Exception {
telemetryServer.enqueue(new MockResponse().setResponseCode(200));
- orchestrator = newOrchestratorBuilder()
- .addPlugin(xooPlugin())
- .setServerProperty("sonar.telemetry.url", telemetryServer.url("").toString())
- // increase frequency so that payload is sent quickly after startup
- .setServerProperty("sonar.telemetry.frequencyInSeconds", "1")
- //.setServerProperty("sonar.web.javaAdditionalOpts", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8001")
- .build();
+ orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(xooPlugin())
+ .setServerProperty("sonar.telemetry.url", telemetryServer.url("").toString())
+ // increase frequency so that payload is sent quickly after startup
+ .setServerProperty("sonar.telemetry.frequencyInSeconds", "1")
+ // .setServerProperty("sonar.web.javaAdditionalOpts", "-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8001")
+ );
orchestrator.start();
// Consume request to no block the telemetry daemon
telemetryServer.takeRequest();
@@ -104,10 +105,10 @@ public class TelemetryUploadTest {
@Test
public void does_not_send_telemetry_data_right_away_by_Default() {
- orchestrator = newOrchestratorBuilder()
- .addPlugin(xooPlugin())
- .setServerProperty("sonar.telemetry.url", telemetryServer.url("").toString())
- .build();
+ orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(xooPlugin())
+ .setServerProperty("sonar.telemetry.url", telemetryServer.url("").toString()));
// by default telemetry payload is sent 6 hours after startup, once a week
orchestrator.start();
@@ -127,7 +128,7 @@ public class TelemetryUploadTest {
return (int) Math.round(value);
}
- private void resetTelemetryLastPing(){
+ private void resetTelemetryLastPing() {
try (PreparedStatement preparedStatement = orchestrator.getDatabase().openConnection().prepareStatement("delete from internal_properties where kee='telemetry.lastPing'");) {
preparedStatement.execute();
preparedStatement.close();
diff --git a/tests/src/test/java/org/sonarqube/tests/test/TestSuite.java b/tests/src/test/java/org/sonarqube/tests/test/TestSuite.java
index 9afbbfa2de9..e4177ca8ab1 100644
--- a/tests/src/test/java/org/sonarqube/tests/test/TestSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/test/TestSuite.java
@@ -37,9 +37,8 @@ import static util.ItUtils.xooPlugin;
public class TestSuite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- .addPlugin(xooPlugin())
-
- .build();
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(xooPlugin()));
}
diff --git a/tests/src/test/java/org/sonarqube/tests/ui/UiSuite.java b/tests/src/test/java/org/sonarqube/tests/ui/UiSuite.java
index e35917afc69..31338ac3031 100644
--- a/tests/src/test/java/org/sonarqube/tests/ui/UiSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/ui/UiSuite.java
@@ -37,11 +37,9 @@ import static util.ItUtils.xooPlugin;
public class UiSuite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- .addPlugin(xooPlugin())
-
- // Used in UiExtensionsTest
- .addPlugin(pluginArtifact("ui-extensions-plugin"))
-
- .build();
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(xooPlugin())
+ // Used in UiExtensionsTest
+ .addPlugin(pluginArtifact("ui-extensions-plugin")));
}
diff --git a/tests/src/test/java/org/sonarqube/tests/upgrade/UpgradeTest.java b/tests/src/test/java/org/sonarqube/tests/upgrade/UpgradeTest.java
index 8f8977c4707..2ec884365d3 100644
--- a/tests/src/test/java/org/sonarqube/tests/upgrade/UpgradeTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/upgrade/UpgradeTest.java
@@ -156,11 +156,11 @@ public class UpgradeTest {
}
private void startAndUpgradeDevServer() {
- OrchestratorBuilder builder = newOrchestratorBuilder()
- .setOrchestratorProperty("orchestrator.keepDatabase", "true")
- .keepBundledPlugins()
- .setStartupLogWatcher(log -> log.contains("Database must be upgraded"));
- orchestrator = builder.build();
+ orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .setOrchestratorProperty("orchestrator.keepDatabase", "true")
+ .keepBundledPlugins()
+ .setStartupLogWatcher(log -> log.contains("Database must be upgraded")));
orchestrator.start();
initSelenide(orchestrator);
diff --git a/tests/src/test/java/org/sonarqube/tests/user/HttpHeadersAuthenticationTest.java b/tests/src/test/java/org/sonarqube/tests/user/HttpHeadersAuthenticationTest.java
index 300c60c0f60..61659c545d5 100644
--- a/tests/src/test/java/org/sonarqube/tests/user/HttpHeadersAuthenticationTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/user/HttpHeadersAuthenticationTest.java
@@ -55,13 +55,13 @@ public class HttpHeadersAuthenticationTest {
private static final String GROUPS_HEADER = "H-Groups";
@ClassRule
- public static final Orchestrator orchestrator = newOrchestratorBuilder()
- .setServerProperty("sonar.web.sso.enable", "true")
- .setServerProperty("sonar.web.sso.loginHeader", LOGIN_HEADER)
- .setServerProperty("sonar.web.sso.nameHeader", NAME_HEADER)
- .setServerProperty("sonar.web.sso.emailHeader", EMAIL_HEADER)
- .setServerProperty("sonar.web.sso.groupsHeader", GROUPS_HEADER)
- .build();
+ public static final Orchestrator orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .setServerProperty("sonar.web.sso.enable", "true")
+ .setServerProperty("sonar.web.sso.loginHeader", LOGIN_HEADER)
+ .setServerProperty("sonar.web.sso.nameHeader", NAME_HEADER)
+ .setServerProperty("sonar.web.sso.emailHeader", EMAIL_HEADER)
+ .setServerProperty("sonar.web.sso.groupsHeader", GROUPS_HEADER));
@Rule
public Tester tester = new Tester(orchestrator).disableOrganizations();
diff --git a/tests/src/test/java/org/sonarqube/tests/user/OnboardingTest.java b/tests/src/test/java/org/sonarqube/tests/user/OnboardingTest.java
index 440e0d4bba6..515f813f2de 100644
--- a/tests/src/test/java/org/sonarqube/tests/user/OnboardingTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/user/OnboardingTest.java
@@ -37,7 +37,7 @@ public class OnboardingTest {
private static final String ONBOARDING_TUTORIAL_SHOW_TO_NEW_USERS = "sonar.onboardingTutorial.showToNewUsers";
@ClassRule
- public static final Orchestrator orchestrator = newOrchestratorBuilder().build();
+ public static final Orchestrator orchestrator = newOrchestratorBuilder();
@Rule
public Tester tester = new Tester(orchestrator).disableOrganizations();
diff --git a/tests/src/test/java/org/sonarqube/tests/user/RealmAuthenticationTest.java b/tests/src/test/java/org/sonarqube/tests/user/RealmAuthenticationTest.java
index e34e6371168..45f5c23eb97 100644
--- a/tests/src/test/java/org/sonarqube/tests/user/RealmAuthenticationTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/user/RealmAuthenticationTest.java
@@ -57,10 +57,10 @@ public class RealmAuthenticationTest {
public ExpectedException thrown = ExpectedException.none();
@ClassRule
- public static final Orchestrator orchestrator = newOrchestratorBuilder()
- .addPlugin(pluginArtifact("security-plugin"))
- .setServerProperty("sonar.security.realm", "FakeRealm")
- .build();
+ public static final Orchestrator orchestrator = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(pluginArtifact("security-plugin"))
+ .setServerProperty("sonar.security.realm", "FakeRealm"));
@Rule
public Tester tester = new Tester(orchestrator).disableOrganizations();
diff --git a/tests/src/test/java/org/sonarqube/tests/user/SonarCloudUserSuite.java b/tests/src/test/java/org/sonarqube/tests/user/SonarCloudUserSuite.java
index fa2d492d6ee..45c3e1436cd 100644
--- a/tests/src/test/java/org/sonarqube/tests/user/SonarCloudUserSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/user/SonarCloudUserSuite.java
@@ -40,21 +40,22 @@ import static util.ItUtils.xooPlugin;
public class SonarCloudUserSuite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- .addPlugin(xooPlugin())
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(xooPlugin())
- // Used by OrganizationBaseIdentityProviderTest
- .addPlugin(pluginArtifact("base-auth-plugin"))
+ // Used by OrganizationBaseIdentityProviderTest
+ .addPlugin(pluginArtifact("base-auth-plugin"))
- // Used in OrganizationOAuth2IdentityProviderTest
- .addPlugin(pluginArtifact("oauth2-auth-plugin"))
+ // Used in OrganizationOAuth2IdentityProviderTest
+ .addPlugin(pluginArtifact("oauth2-auth-plugin"))
- .setServerProperty("sonar.sonarcloud.enabled", "true")
- .setServerProperty("sonar.organizations.createPersonalOrg", "true")
+ .setServerProperty("sonar.sonarcloud.enabled", "true")
+ .setServerProperty("sonar.organizations.createPersonalOrg", "true")
- // reduce memory for Elasticsearch
- .setServerProperty("sonar.search.javaOpts", "-Xms128m -Xmx128m")
+ // reduce memory for Elasticsearch
+ .setServerProperty("sonar.search.javaOpts", "-Xms128m -Xmx128m")
- .build();
+ );
}
diff --git a/tests/src/test/java/org/sonarqube/tests/user/UserEsResilienceTest.java b/tests/src/test/java/org/sonarqube/tests/user/UserEsResilienceTest.java
index 92ff670f0e3..c0205324ebf 100644
--- a/tests/src/test/java/org/sonarqube/tests/user/UserEsResilienceTest.java
+++ b/tests/src/test/java/org/sonarqube/tests/user/UserEsResilienceTest.java
@@ -48,13 +48,15 @@ public class UserEsResilienceTest {
private static final Byteman byteman;
static {
- byteman = new Byteman(newOrchestratorBuilder(), WEB);
- orchestrator = byteman
- .getOrchestratorBuilder()
- .setServerProperty("sonar.search.recovery.delayInMs", "1000")
- .setServerProperty("sonar.search.recovery.minAgeInMs", "3000")
- .addPlugin(ItUtils.xooPlugin())
- .build();
+ byteman = new Byteman();
+ orchestrator = newOrchestratorBuilder(
+ builder -> {
+ byteman.install(builder, WEB);
+ builder
+ .setServerProperty("sonar.search.recovery.delayInMs", "1000")
+ .setServerProperty("sonar.search.recovery.minAgeInMs", "3000")
+ .addPlugin(ItUtils.xooPlugin());
+ });
}
@Before
diff --git a/tests/src/test/java/org/sonarqube/tests/user/UserSuite.java b/tests/src/test/java/org/sonarqube/tests/user/UserSuite.java
index e4e1b1c94f8..8e07ffe8404 100644
--- a/tests/src/test/java/org/sonarqube/tests/user/UserSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/user/UserSuite.java
@@ -46,18 +46,19 @@ import static util.ItUtils.xooPlugin;
public class UserSuite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- .addPlugin(xooPlugin())
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(xooPlugin())
- // Used in BaseIdentityProviderTest
- .addPlugin(pluginArtifact("base-auth-plugin"))
+ // Used in BaseIdentityProviderTest
+ .addPlugin(pluginArtifact("base-auth-plugin"))
- // Used in OAuth2IdentityProviderTest
- .addPlugin(pluginArtifact("oauth2-auth-plugin"))
+ // Used in OAuth2IdentityProviderTest
+ .addPlugin(pluginArtifact("oauth2-auth-plugin"))
- // reduce memory for Elasticsearch
- .setServerProperty("sonar.search.javaOpts", "-Xms128m -Xmx128m")
+ // reduce memory for Elasticsearch
+ .setServerProperty("sonar.search.javaOpts", "-Xms128m -Xmx128m")
- .build();
+ );
}
diff --git a/tests/src/test/java/org/sonarqube/tests/webhook/WebhooksSuite.java b/tests/src/test/java/org/sonarqube/tests/webhook/WebhooksSuite.java
index 8e8d0023081..ae1048dc5eb 100644
--- a/tests/src/test/java/org/sonarqube/tests/webhook/WebhooksSuite.java
+++ b/tests/src/test/java/org/sonarqube/tests/webhook/WebhooksSuite.java
@@ -35,13 +35,13 @@ import static util.ItUtils.xooPlugin;
public class WebhooksSuite {
@ClassRule
- public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder()
- .addPlugin(xooPlugin())
+ public static final Orchestrator ORCHESTRATOR = newOrchestratorBuilder(
+ builder -> builder
+ .addPlugin(xooPlugin())
- // reduce memory for Elasticsearch
- .setServerProperty("sonar.search.javaOpts", "-Xms128m -Xmx128m")
+ // reduce memory for Elasticsearch
+ .setServerProperty("sonar.search.javaOpts", "-Xms128m -Xmx128m")
- .setServerProperty("sonar.sonarcloud.enabled", "true")
-
- .build();
+ .setServerProperty("sonar.sonarcloud.enabled", "true")
+ );
}
diff --git a/tests/src/test/java/util/ItUtils.java b/tests/src/test/java/util/ItUtils.java
index d7451c66776..6daaeefcfd6 100644
--- a/tests/src/test/java/util/ItUtils.java
+++ b/tests/src/test/java/util/ItUtils.java
@@ -44,6 +44,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
+import java.util.function.Consumer;
import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -99,9 +100,22 @@ public class ItUtils {
private ItUtils() {
}
- public static OrchestratorBuilder newOrchestratorBuilder() {
- OrchestratorBuilder builder = Orchestrator.builderEnv();
- builder.setEdition(COMMUNITY);
+ public static Orchestrator newOrchestratorBuilder() {
+ return newOrchestratorBuilder(t -> {}, server -> {});
+ }
+
+ public static Orchestrator newOrchestratorBuilder(Consumer<OrchestratorBuilder> beforeInstall) {
+ return newOrchestratorBuilder(beforeInstall, server -> {
+ });
+ }
+
+ public static Orchestrator newOrchestratorBuilder(Consumer<OrchestratorBuilder> beforeInstall, Consumer<Server> afterInstall) {
+ OrchestratorBuilder builder = Orchestrator.builderEnv()
+ .setEdition(COMMUNITY)
+ // reduce memory for Elasticsearch
+ .setServerProperty("sonar.search.javaOpts", "-Xms128m -Xmx128m")
+ .setOrchestratorProperty("orchestrator.workspaceDir", "build/it");
+
String version = System.getProperty("sonar.runtimeVersion");
if (StringUtils.isEmpty(version)) {
Location zip = FileLocation.byWildcardMavenFilename(new File("../sonar-application/build/distributions"), "sonar-application-*.zip");
@@ -109,10 +123,33 @@ public class ItUtils {
} else {
builder.setSonarVersion(version);
}
- return builder
- // reduce memory for Elasticsearch
- .setServerProperty("sonar.search.javaOpts", "-Xms128m -Xmx128m")
- .setOrchestratorProperty("orchestrator.workspaceDir", "build/it");
+
+ beforeInstall.accept(builder);
+
+ Orchestrator orchestrator = builder.build();
+
+ Server server = orchestrator.install();
+ afterInstall.accept(server);
+
+ return orchestrator;
+ }
+
+ public static void installCoreExtension(Server server, String coreExtensionDirName) {
+ File coreExtensionFile = pluginArtifact(coreExtensionDirName).getFile();
+ File libDir = new File(server.getHome(), "lib/common");
+ try {
+ FileUtils.copyFile(coreExtensionFile, new File(libDir, coreExtensionFile.getName()));
+ } catch (IOException e) {
+ throw new IllegalStateException("Failed to install core extension", e);
+ }
+ }
+
+ public static Location locationOf(URL url) {
+ try {
+ return FileLocation.of(new File(url.toURI()));
+ } catch (URISyntaxException e) {
+ throw new IllegalStateException("File does not exist", e);
+ }
}
public static FileLocation xooPlugin() {