Browse Source

SONAR-20328 Upgrade sonar-orchestrator version and update affected tests from breaking changes.

tags/10.3.0.82913
Dimitris Kavvathas 7 months ago
parent
commit
7cfaffbe26

+ 2
- 2
build.gradle View File

@@ -404,7 +404,7 @@ subprojects {
dependency 'org.reflections:reflections:0.10.2'
dependency 'org.simpleframework:simple:5.1.6'
dependency 'org.sonarsource.git.blame:git-files-blame:1.0.2.275'
dependency 'org.sonarsource.orchestrator:sonar-orchestrator:3.42.0.312'
dependency 'org.sonarsource.orchestrator:sonar-orchestrator-junit4:4.1.0.495'
dependency 'org.sonarsource.update-center:sonar-update-center-common:1.30.0.1030'
dependency("org.springframework:spring-context:${springVersion}") {
exclude 'commons-logging:commons-logging'
@@ -664,7 +664,7 @@ subprojects {
bbtRuntimeOnly 'org.postgresql:postgresql'
bbtRuntimeOnly project(':plugins:sonar-xoo-plugin')

bbtImplementation 'org.sonarsource.orchestrator:sonar-orchestrator'
bbtImplementation 'org.sonarsource.orchestrator:sonar-orchestrator-junit4'
bbtImplementation project(":sonar-testing-harness")
bbtImplementation project(":private:it-common")
}

+ 1
- 1
server/sonar-db-dao/build.gradle View File

@@ -27,7 +27,7 @@ dependencies {
testImplementation 'org.assertj:assertj-core'
testImplementation 'org.assertj:assertj-guava'
testImplementation 'org.mockito:mockito-core'
testImplementation 'org.sonarsource.orchestrator:sonar-orchestrator'
testImplementation 'org.sonarsource.orchestrator:sonar-orchestrator-junit4'
testImplementation 'org.sonarsource.api.plugin:sonar-plugin-api-test-fixtures'
testImplementation project(':sonar-testing-harness')
testImplementation project(':sonar-plugin-api-impl')

+ 2
- 2
server/sonar-db-dao/src/testFixtures/java/org/sonar/db/OrchestratorSettingsUtils.java View File

@@ -37,7 +37,7 @@ public class OrchestratorSettingsUtils {
// prevents instantiation
}

public static void loadOrchestratorSettings(Settings settings) {
public static void loadOrchestratorRuleSettings(Settings settings) {
String url = settings.getString("orchestrator.configUrl");
if (isEmpty(url)) {
return;
@@ -68,7 +68,7 @@ public class OrchestratorSettingsUtils {
settings.setProperty(entry.getKey(), interpolatedValue);
}
} catch (Exception e) {
throw new IllegalStateException("Cannot load Orchestrator properties from:" + url, e);
throw new IllegalStateException("Cannot load OrchestratorRule properties from:" + url, e);
} finally {
IOUtils.closeQuietly(input);
}

+ 2
- 2
server/sonar-db-dao/src/testFixtures/java/org/sonar/db/TestDbImpl.java View File

@@ -56,7 +56,7 @@ class TestDbImpl extends CoreTestDb {
}

private void init(@Nullable String schemaPath, MyBatisConfExtension[] confExtensions) {
Consumer<Settings> loadOrchestratorSettings = OrchestratorSettingsUtils::loadOrchestratorSettings;
Consumer<Settings> loadOrchestratorRuleSettings = OrchestratorSettingsUtils::loadOrchestratorRuleSettings;
Function<Settings, Database> databaseCreator = settings -> {
String dialect = settings.getString("sonar.jdbc.dialect");
if (dialect != null && !"h2".equals(dialect)) {
@@ -77,7 +77,7 @@ class TestDbImpl extends CoreTestDb {
((SQDatabase) database).executeScript(schemaPath);
};
BiConsumer<Database, Boolean> createMyBatis = (db, created) -> myBatis = newMyBatis(db, confExtensions);
init(loadOrchestratorSettings, databaseCreator, schemaPathExecutor, createMyBatis);
init(loadOrchestratorRuleSettings, databaseCreator, schemaPathExecutor, createMyBatis);
}

private static MyBatis newMyBatis(Database db, MyBatisConfExtension[] extensions) {

+ 1
- 1
server/sonar-main/src/main/java/org/sonar/application/StopRequestWatcher.java View File

@@ -21,7 +21,7 @@ package org.sonar.application;

/**
* Background thread that checks if a stop request
* is sent, usually by Orchestrator
* is sent, usually by OrchestratorRule
*/
public interface StopRequestWatcher {


+ 1
- 1
server/sonar-process/src/main/java/org/sonar/process/ProcessProperties.java View File

@@ -180,7 +180,7 @@ public class ProcessProperties {
SONAR_UPDATECENTER_ACTIVATE("sonar.updatecenter.activate", "true"),

/**
* Used by Orchestrator to ask for shutdown of monitor process
* Used by OrchestratorRule to ask for shutdown of monitor process
*/
ENABLE_STOP_COMMAND("sonar.enableStopCommand"),


+ 1
- 1
server/sonar-webserver-auth/src/main/java/org/sonar/server/authentication/DefaultAdminCredentialsVerifierFilter.java View File

@@ -35,7 +35,7 @@ import static org.sonar.server.authentication.AuthenticationRedirection.redirect
public class DefaultAdminCredentialsVerifierFilter extends HttpFilter {
private static final String RESET_PASSWORD_PATH = "/account/reset_password";
private static final String CHANGE_ADMIN_PASSWORD_PATH = "/admin/change_admin_password";
// This property is used by Orchestrator to disable this force redirect. It should never be used in production, which
// This property is used by OrchestratorRule to disable this force redirect. It should never be used in production, which
// is why this is not defined in org.sonar.process.ProcessProperties.
private static final String SONAR_FORCE_REDIRECT_DEFAULT_ADMIN_CREDENTIALS = "sonar.forceRedirectOnDefaultAdminCredentials";


+ 1
- 1
sonar-ws-generator/build.gradle View File

@@ -13,7 +13,7 @@ dependencies {
api 'commons-collections:commons-collections:3.2.2'
api 'org.apache.velocity:velocity:1.7'
api 'org.slf4j:log4j-over-slf4j'
api 'org.sonarsource.orchestrator:sonar-orchestrator'
api 'org.sonarsource.orchestrator:sonar-orchestrator-junit4'

compileOnlyApi 'com.google.code.findbugs:jsr305'
}

+ 4
- 4
sonar-ws-generator/src/main/java/org/sonarqube/wsgenerator/ApiDefinitionDownloader.java View File

@@ -19,8 +19,8 @@
*/
package org.sonarqube.wsgenerator;

import com.sonar.orchestrator.Orchestrator;
import com.sonar.orchestrator.OrchestratorBuilder;
import com.sonar.orchestrator.junit4.OrchestratorRule;
import com.sonar.orchestrator.junit4.OrchestratorRuleBuilder;
import com.sonar.orchestrator.http.HttpCall;
import com.sonar.orchestrator.http.HttpResponse;
import com.sonar.orchestrator.locator.FileLocation;
@@ -35,12 +35,12 @@ public class ApiDefinitionDownloader {
}

public static String downloadApiDefinition() {
OrchestratorBuilder builder = Orchestrator.builderEnv()
OrchestratorRuleBuilder builder = OrchestratorRule.builderEnv()
.defaultForceAuthentication();
builder.setEdition(COMMUNITY);
builder.setZipFile(FileLocation.byWildcardMavenFilename(new File("../sonar-application/build/distributions"), "sonar-application-*.zip").getFile())
.setOrchestratorProperty("orchestrator.workspaceDir", "build");
Orchestrator orchestrator = builder.setServerProperty("sonar.forceAuthentication", "false")
OrchestratorRule orchestrator = builder.setServerProperty("sonar.forceAuthentication", "false")
.build();

orchestrator.start();

Loading…
Cancel
Save