aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-webserver-core
diff options
context:
space:
mode:
authorDuarte Meneses <duarte.meneses@sonarsource.com>2022-02-01 15:16:25 -0600
committersonartech <sonartech@sonarsource.com>2022-02-22 20:02:46 +0000
commit60c1a4038e041a342dda9810e6fd761d66b01bdb (patch)
tree0e76b4252e4d7d257cf4ddcb6f081996bb1e03ab /server/sonar-webserver-core
parent9694d4113bf401b84e86e0223dbea8f5339388d8 (diff)
downloadsonarqube-60c1a4038e041a342dda9810e6fd761d66b01bdb.tar.gz
sonarqube-60c1a4038e041a342dda9810e6fd761d66b01bdb.zip
SONAR-15994 Migrate Sonarqube IOC framework from Pico to Spring
Diffstat (limited to 'server/sonar-webserver-core')
-rw-r--r--server/sonar-webserver-core/build.gradle1
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/notification/NotificationDaemon.java2
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/platform/ClusterVerification.java5
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DatabaseServerCompatibility.java2
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DefaultServerUpgradeStatus.java2
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/CheckDatabaseCharsetAtStartup.java2
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/EmbeddedDatabase.java2
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/EmbeddedDatabaseFactory.java2
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/migration/AutoDbMigration.java2
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/BaseSectionMBean.java2
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/platform/serverid/ServerIdManager.java2
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/qualitygate/ProjectsInWarningDaemon.java2
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java2
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RuleDefinitionsLoader.java3
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/startup/LogServerId.java2
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterMetrics.java5
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterPermissionTemplates.java2
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RenameDeprecatedPropertyKeys.java2
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/startup/UpgradeSuggestionsCleaner.java2
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDaemon.java2
-rw-r--r--server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDataLoaderImpl.java7
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/ce/CeModuleTest.java10
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationModuleTest.java7
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/platform/SystemInfoWriterModuleTest.java25
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/platform/WebCoreExtensionsInstallerTest.java17
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/platform/serverid/ServerIdModuleTest.java10
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/platform/web/requestid/HttpRequestIdModuleTest.java11
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/qualitygate/ProjectsInWarningModuleTest.java9
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java3
-rw-r--r--server/sonar-webserver-core/src/test/java/org/sonar/server/updatecenter/UpdateCenterModuleTest.java7
30 files changed, 63 insertions, 89 deletions
diff --git a/server/sonar-webserver-core/build.gradle b/server/sonar-webserver-core/build.gradle
index 9aba24d6f0c..3c76f65098e 100644
--- a/server/sonar-webserver-core/build.gradle
+++ b/server/sonar-webserver-core/build.gradle
@@ -29,7 +29,6 @@ dependencies {
compile 'org.apache.logging.log4j:log4j-api'
compile 'org.apache.tomcat.embed:tomcat-embed-core'
compile 'org.apache.commons:commons-dbcp2'
- compile 'org.picocontainer:picocontainer'
compile 'org.slf4j:jul-to-slf4j'
compile 'org.slf4j:slf4j-api'
compile 'org.sonarsource.update-center:sonar-update-center-common'
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/notification/NotificationDaemon.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/notification/NotificationDaemon.java
index 31311378be9..7e5e9f2aadb 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/notification/NotificationDaemon.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/notification/NotificationDaemon.java
@@ -24,7 +24,7 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
-import org.picocontainer.Startable;
+import org.sonar.api.Startable;
import org.sonar.api.Properties;
import org.sonar.api.Property;
import org.sonar.api.config.Configuration;
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/ClusterVerification.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/ClusterVerification.java
index 98731483b89..25a8e4c1ce0 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/ClusterVerification.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/ClusterVerification.java
@@ -19,11 +19,13 @@
*/
package org.sonar.server.platform;
-import javax.annotation.Nullable;
import org.sonar.api.Startable;
import org.sonar.api.server.ServerSide;
import org.sonar.api.utils.MessageException;
+import javax.annotation.Nullable;
+import javax.inject.Inject;
+
@ServerSide
public class ClusterVerification implements Startable {
@@ -31,6 +33,7 @@ public class ClusterVerification implements Startable {
@Nullable
private final ClusterFeature feature;
+ @Inject
public ClusterVerification(WebServer server, @Nullable ClusterFeature feature) {
this.server = server;
this.feature = feature;
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DatabaseServerCompatibility.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DatabaseServerCompatibility.java
index 060c8fee4ff..350358dee54 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DatabaseServerCompatibility.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DatabaseServerCompatibility.java
@@ -20,7 +20,7 @@
package org.sonar.server.platform;
import java.util.Optional;
-import org.picocontainer.Startable;
+import org.sonar.api.Startable;
import org.sonar.api.config.Configuration;
import org.sonar.api.utils.MessageException;
import org.sonar.api.utils.log.Logger;
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DefaultServerUpgradeStatus.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DefaultServerUpgradeStatus.java
index 432e55dc694..10755afccaa 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DefaultServerUpgradeStatus.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/DefaultServerUpgradeStatus.java
@@ -22,7 +22,7 @@ package org.sonar.server.platform;
import java.util.Optional;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
-import org.picocontainer.Startable;
+import org.sonar.api.Startable;
import org.sonar.api.config.Configuration;
import org.sonar.api.platform.ServerUpgradeStatus;
import org.sonar.process.ProcessProperties;
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/CheckDatabaseCharsetAtStartup.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/CheckDatabaseCharsetAtStartup.java
index b25aa42ea1f..50140f61be2 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/CheckDatabaseCharsetAtStartup.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/CheckDatabaseCharsetAtStartup.java
@@ -19,7 +19,7 @@
*/
package org.sonar.server.platform.db;
-import org.picocontainer.Startable;
+import org.sonar.api.Startable;
import org.sonar.api.platform.ServerUpgradeStatus;
import org.sonar.server.platform.db.migration.charset.DatabaseCharsetChecker;
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/EmbeddedDatabase.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/EmbeddedDatabase.java
index a31e30d8493..f53945274ed 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/EmbeddedDatabase.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/EmbeddedDatabase.java
@@ -25,7 +25,7 @@ import java.sql.DriverManager;
import java.sql.SQLException;
import org.h2.Driver;
import org.h2.tools.Server;
-import org.picocontainer.Startable;
+import org.sonar.api.Startable;
import org.sonar.api.config.Configuration;
import org.sonar.api.utils.System2;
import org.sonar.api.utils.log.Logger;
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/EmbeddedDatabaseFactory.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/EmbeddedDatabaseFactory.java
index 255c5b744f4..f052b57ad70 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/EmbeddedDatabaseFactory.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/EmbeddedDatabaseFactory.java
@@ -20,7 +20,7 @@
package org.sonar.server.platform.db;
import com.google.common.annotations.VisibleForTesting;
-import org.picocontainer.Startable;
+import org.sonar.api.Startable;
import org.sonar.api.config.Configuration;
import org.sonar.api.utils.System2;
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/migration/AutoDbMigration.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/migration/AutoDbMigration.java
index 4c68c16faf9..140f4f297b7 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/migration/AutoDbMigration.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/db/migration/AutoDbMigration.java
@@ -19,7 +19,7 @@
*/
package org.sonar.server.platform.db.migration;
-import org.picocontainer.Startable;
+import org.sonar.api.Startable;
import org.sonar.api.utils.log.Loggers;
import org.sonar.server.platform.DefaultServerUpgradeStatus;
import org.sonar.server.platform.db.migration.engine.MigrationEngine;
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/BaseSectionMBean.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/BaseSectionMBean.java
index ad2ee011800..b5afeaff0e2 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/BaseSectionMBean.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/monitoring/BaseSectionMBean.java
@@ -19,7 +19,7 @@
*/
package org.sonar.server.platform.monitoring;
-import org.picocontainer.Startable;
+import org.sonar.api.Startable;
import org.sonar.process.Jmx;
import org.sonar.process.systeminfo.SystemInfoSection;
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/serverid/ServerIdManager.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/serverid/ServerIdManager.java
index 87052b55224..86ecd608095 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/serverid/ServerIdManager.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/platform/serverid/ServerIdManager.java
@@ -20,7 +20,7 @@
package org.sonar.server.platform.serverid;
import java.util.Optional;
-import org.picocontainer.Startable;
+import org.sonar.api.Startable;
import org.sonar.api.SonarQubeSide;
import org.sonar.api.SonarRuntime;
import org.sonar.api.utils.log.Logger;
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/qualitygate/ProjectsInWarningDaemon.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/qualitygate/ProjectsInWarningDaemon.java
index c4373e7ad6e..0bf0a72adf1 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/qualitygate/ProjectsInWarningDaemon.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/qualitygate/ProjectsInWarningDaemon.java
@@ -25,7 +25,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
-import org.picocontainer.Startable;
+import org.sonar.api.Startable;
import org.sonar.api.config.Configuration;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java
index a5c63e36b70..5309cbb697f 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java
@@ -37,7 +37,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import org.apache.commons.lang.StringUtils;
-import org.picocontainer.Startable;
+import org.sonar.api.Startable;
import org.sonar.api.resources.Languages;
import org.sonar.api.rule.RuleKey;
import org.sonar.api.rule.RuleScope;
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RuleDefinitionsLoader.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RuleDefinitionsLoader.java
index 795100eb921..c3571946f31 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RuleDefinitionsLoader.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RuleDefinitionsLoader.java
@@ -22,6 +22,7 @@ package org.sonar.server.rule;
import org.sonar.api.server.rule.RulesDefinition;
import org.sonar.api.impl.server.RulesDefinitionContext;
import org.sonar.server.plugins.ServerPluginRepository;
+import org.springframework.beans.factory.annotation.Autowired;
/**
* Loads all instances of {@link RulesDefinition}. Used during server startup
@@ -33,6 +34,7 @@ public class RuleDefinitionsLoader {
private final RulesDefinition[] pluginDefs;
private final ServerPluginRepository serverPluginRepository;
+ @Autowired(required = false)
public RuleDefinitionsLoader(CommonRuleDefinitions coreCommonDefs, ServerPluginRepository serverPluginRepository, RulesDefinition[] pluginDefs) {
this.coreCommonDefs = coreCommonDefs;
this.serverPluginRepository = serverPluginRepository;
@@ -42,6 +44,7 @@ public class RuleDefinitionsLoader {
/**
* Used when no definitions at all.
*/
+ @Autowired(required = false)
public RuleDefinitionsLoader(CommonRuleDefinitions coreCommonDefs, ServerPluginRepository serverPluginRepository) {
this(coreCommonDefs, serverPluginRepository, new RulesDefinition[0]);
}
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/LogServerId.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/LogServerId.java
index 056a68d482f..96fe41c24b6 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/LogServerId.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/LogServerId.java
@@ -19,7 +19,7 @@
*/
package org.sonar.server.startup;
-import org.picocontainer.Startable;
+import org.sonar.api.Startable;
import org.sonar.api.platform.Server;
import org.sonar.api.utils.log.Loggers;
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterMetrics.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterMetrics.java
index 6a07999d5c1..57122ba35b6 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterMetrics.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterMetrics.java
@@ -23,7 +23,7 @@ import com.google.common.annotations.VisibleForTesting;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import org.picocontainer.Startable;
+import org.sonar.api.Startable;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.measures.Metric;
import org.sonar.api.measures.Metrics;
@@ -38,6 +38,7 @@ import org.sonar.server.metric.MetricToDto;
import static com.google.common.collect.FluentIterable.concat;
import static com.google.common.collect.Lists.newArrayList;
+import org.springframework.beans.factory.annotation.Autowired;
public class RegisterMetrics implements Startable {
@@ -47,6 +48,7 @@ public class RegisterMetrics implements Startable {
private final UuidFactory uuidFactory;
private final Metrics[] metricsRepositories;
+ @Autowired(required = false)
public RegisterMetrics(DbClient dbClient, UuidFactory uuidFactory, Metrics[] metricsRepositories) {
this.dbClient = dbClient;
this.uuidFactory = uuidFactory;
@@ -56,6 +58,7 @@ public class RegisterMetrics implements Startable {
/**
* Used when no plugin is defining Metrics
*/
+ @Autowired(required = false)
public RegisterMetrics(DbClient dbClient, UuidFactory uuidFactory) {
this(dbClient, uuidFactory, new Metrics[] {});
}
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterPermissionTemplates.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterPermissionTemplates.java
index faf8d24af05..8a9732a738e 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterPermissionTemplates.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterPermissionTemplates.java
@@ -21,7 +21,7 @@ package org.sonar.server.startup;
import java.util.Date;
import java.util.Optional;
-import org.picocontainer.Startable;
+import org.sonar.api.Startable;
import org.sonar.api.security.DefaultGroups;
import org.sonar.api.utils.System2;
import org.sonar.api.utils.log.Logger;
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RenameDeprecatedPropertyKeys.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RenameDeprecatedPropertyKeys.java
index 05b41f65867..fc7c89f216a 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RenameDeprecatedPropertyKeys.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RenameDeprecatedPropertyKeys.java
@@ -20,7 +20,7 @@
package org.sonar.server.startup;
import com.google.common.base.Strings;
-import org.picocontainer.Startable;
+import org.sonar.api.Startable;
import org.sonar.api.config.PropertyDefinition;
import org.sonar.api.config.PropertyDefinitions;
import org.sonar.api.utils.log.Loggers;
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/UpgradeSuggestionsCleaner.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/UpgradeSuggestionsCleaner.java
index 9d2497cc544..414c6de5c36 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/UpgradeSuggestionsCleaner.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/UpgradeSuggestionsCleaner.java
@@ -19,7 +19,7 @@
*/
package org.sonar.server.startup;
-import org.picocontainer.Startable;
+import org.sonar.api.Startable;
import org.sonar.api.SonarEdition;
import org.sonar.api.SonarRuntime;
import org.sonar.api.server.ServerSide;
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDaemon.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDaemon.java
index 89dbeaa01a4..8880b874b73 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDaemon.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDaemon.java
@@ -28,7 +28,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
-import org.picocontainer.Startable;
+import org.sonar.api.Startable;
import org.sonar.api.config.Configuration;
import org.sonar.api.server.ServerSide;
import org.sonar.api.utils.System2;
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDataLoaderImpl.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDataLoaderImpl.java
index ab9ec5daaa6..8caa743ca16 100644
--- a/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDataLoaderImpl.java
+++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/telemetry/TelemetryDataLoaderImpl.java
@@ -29,6 +29,7 @@ import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.CheckForNull;
import javax.annotation.Nullable;
+import javax.inject.Inject;
import org.sonar.api.config.Configuration;
import org.sonar.api.platform.Server;
import org.sonar.api.server.ServerSide;
@@ -75,11 +76,7 @@ public class TelemetryDataLoaderImpl implements TelemetryDataLoader {
@CheckForNull
private final LicenseReader licenseReader;
- public TelemetryDataLoaderImpl(Server server, DbClient dbClient, PluginRepository pluginRepository, UserIndex userIndex, ProjectMeasuresIndex projectMeasuresIndex,
- PlatformEditionProvider editionProvider, InternalProperties internalProperties, Configuration configuration, DockerSupport dockerSupport) {
- this(server, dbClient, pluginRepository, userIndex, projectMeasuresIndex, editionProvider, internalProperties, configuration, dockerSupport, null);
- }
-
+ @Inject
public TelemetryDataLoaderImpl(Server server, DbClient dbClient, PluginRepository pluginRepository, UserIndex userIndex, ProjectMeasuresIndex projectMeasuresIndex,
PlatformEditionProvider editionProvider, InternalProperties internalProperties, Configuration configuration,
DockerSupport dockerSupport, @Nullable LicenseReader licenseReader) {
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/ce/CeModuleTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/ce/CeModuleTest.java
index 537822c47db..0bfece6f850 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/ce/CeModuleTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/ce/CeModuleTest.java
@@ -20,19 +20,15 @@
package org.sonar.server.ce;
import org.junit.Test;
-import org.sonar.core.platform.ComponentContainer;
+import org.sonar.core.platform.ListContainer;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonar.core.platform.ComponentContainer.COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER;
public class CeModuleTest {
-
@Test
public void verify_count_of_added_components() {
- ComponentContainer container = new ComponentContainer();
+ ListContainer container = new ListContainer();
new CeModule().configure(container);
- assertThat(container.size()).isEqualTo(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 3);
+ assertThat(container.getAddedObjects()).hasSize(3);
}
-
-
}
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationModuleTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationModuleTest.java
index dc7bea41056..680768120e3 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationModuleTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/notification/NotificationModuleTest.java
@@ -20,16 +20,15 @@
package org.sonar.server.notification;
import org.junit.Test;
-import org.sonar.core.platform.ComponentContainer;
+import org.sonar.core.platform.ListContainer;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonar.core.platform.ComponentContainer.COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER;
public class NotificationModuleTest {
@Test
public void verify_count_of_added_components() {
- ComponentContainer container = new ComponentContainer();
+ ListContainer container = new ListContainer();
new NotificationModule().configure(container);
- assertThat(container.size()).isEqualTo(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 5);
+ assertThat(container.getAddedObjects()).hasSize(5);
}
}
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/SystemInfoWriterModuleTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/SystemInfoWriterModuleTest.java
index 1d586a9ac43..21f300bd07b 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/SystemInfoWriterModuleTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/SystemInfoWriterModuleTest.java
@@ -19,42 +19,31 @@
*/
package org.sonar.server.platform;
-import java.util.Collection;
import org.junit.Test;
-import org.picocontainer.ComponentAdapter;
-import org.sonar.core.platform.ComponentContainer;
+import org.sonar.core.platform.ListContainer;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import static org.sonar.core.platform.ComponentContainer.COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER;
public class SystemInfoWriterModuleTest {
- private WebServer webServer = mock(WebServer.class);
- private SystemInfoWriterModule underTest = new SystemInfoWriterModule(webServer);
+ private final WebServer webServer = mock(WebServer.class);
+ private final SystemInfoWriterModule underTest = new SystemInfoWriterModule(webServer);
@Test
public void verify_system_info_configuration_in_cluster_mode() {
when(webServer.isStandalone()).thenReturn(false);
- ComponentContainer container = new ComponentContainer();
-
+ ListContainer container = new ListContainer();
underTest.configure(container);
-
- Collection<ComponentAdapter<?>> adapters = container.getPicoContainer().getComponentAdapters();
- assertThat(adapters)
- .hasSize(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 20);
+ assertThat(container.getAddedObjects()).hasSize(20);
}
@Test
public void verify_system_info_configuration_in_standalone_mode() {
when(webServer.isStandalone()).thenReturn(true);
- ComponentContainer container = new ComponentContainer();
+ ListContainer container = new ListContainer();
underTest.configure(container);
-
- Collection<ComponentAdapter<?>> adapters = container.getPicoContainer().getComponentAdapters();
- assertThat(adapters)
- .hasSize(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 14);
+ assertThat(container.getAddedObjects()).hasSize(14);
}
-
}
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/WebCoreExtensionsInstallerTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/WebCoreExtensionsInstallerTest.java
index 58799305fa0..0b4df5dcbf7 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/WebCoreExtensionsInstallerTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/WebCoreExtensionsInstallerTest.java
@@ -32,7 +32,7 @@ import org.sonar.api.ce.ComputeEngineSide;
import org.sonar.api.server.ServerSide;
import org.sonar.core.extension.CoreExtension;
import org.sonar.core.extension.CoreExtensionRepository;
-import org.sonar.core.platform.ComponentContainer;
+import org.sonar.core.platform.ListContainer;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
@@ -41,10 +41,9 @@ import static org.sonar.core.extension.CoreExtensionsInstaller.noAdditionalSideF
import static org.sonar.core.extension.CoreExtensionsInstaller.noExtensionFilter;
public class WebCoreExtensionsInstallerTest {
- private SonarRuntime sonarRuntime = mock(SonarRuntime.class);
- private CoreExtensionRepository coreExtensionRepository = mock(CoreExtensionRepository.class);
-
- private WebCoreExtensionsInstaller underTest = new WebCoreExtensionsInstaller(sonarRuntime, coreExtensionRepository);
+ private final SonarRuntime sonarRuntime = mock(SonarRuntime.class);
+ private final CoreExtensionRepository coreExtensionRepository = mock(CoreExtensionRepository.class);
+ private final WebCoreExtensionsInstaller underTest = new WebCoreExtensionsInstaller(sonarRuntime, coreExtensionRepository);
@Test
public void install_only_adds_ServerSide_annotated_extension_to_container() {
@@ -61,14 +60,10 @@ public class WebCoreExtensionsInstallerTest {
NoAnnotationClass.class, OtherAnnotationClass.class, MultipleAnnotationClass.class);
}
}));
- ComponentContainer container = new ComponentContainer();
-
+ ListContainer container = new ListContainer();
underTest.install(container, noExtensionFilter(), noAdditionalSideFilter());
- assertThat(container.getPicoContainer().getComponentAdapters())
- .hasSize(ComponentContainer.COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 2);
- assertThat(container.getComponentByType(WebServerClass.class)).isNotNull();
- assertThat(container.getComponentByType(MultipleAnnotationClass.class)).isNotNull();
+ assertThat(container.getAddedObjects()).containsOnly(WebServerClass.class, MultipleAnnotationClass.class);
}
@ComputeEngineSide
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/serverid/ServerIdModuleTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/serverid/ServerIdModuleTest.java
index 394f2c5669d..9bf681d74aa 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/serverid/ServerIdModuleTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/serverid/ServerIdModuleTest.java
@@ -20,19 +20,17 @@
package org.sonar.server.platform.serverid;
import org.junit.Test;
-import org.sonar.core.platform.ComponentContainer;
+import org.sonar.core.platform.ListContainer;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonar.core.platform.ComponentContainer.COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER;
public class ServerIdModuleTest {
- private ServerIdModule underTest = new ServerIdModule();
+ private final ServerIdModule underTest = new ServerIdModule();
@Test
public void verify_count_of_added_components() {
- ComponentContainer container = new ComponentContainer();
+ ListContainer container = new ListContainer();
underTest.configure(container);
- assertThat(container.size()).isEqualTo(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 4);
+ assertThat(container.getAddedObjects()).hasSize(4);
}
-
}
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/web/requestid/HttpRequestIdModuleTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/web/requestid/HttpRequestIdModuleTest.java
index 0036b24f104..ba1be304225 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/web/requestid/HttpRequestIdModuleTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/platform/web/requestid/HttpRequestIdModuleTest.java
@@ -20,20 +20,17 @@
package org.sonar.server.platform.web.requestid;
import org.junit.Test;
-import org.sonar.core.platform.ComponentContainer;
+import org.sonar.core.platform.ListContainer;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonar.core.platform.ComponentContainer.COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER;
public class HttpRequestIdModuleTest {
- private HttpRequestIdModule underTest = new HttpRequestIdModule();
+ private final HttpRequestIdModule underTest = new HttpRequestIdModule();
@Test
public void count_components_in_module() {
- ComponentContainer container = new ComponentContainer();
+ ListContainer container = new ListContainer();
underTest.configure(container);
-
- assertThat(container.getPicoContainer().getComponentAdapters())
- .hasSize(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 3);
+ assertThat(container.getAddedObjects()).hasSize(3);
}
}
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/qualitygate/ProjectsInWarningModuleTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/qualitygate/ProjectsInWarningModuleTest.java
index f2f6e3a11dd..e2615268469 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/qualitygate/ProjectsInWarningModuleTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/qualitygate/ProjectsInWarningModuleTest.java
@@ -20,18 +20,15 @@
package org.sonar.server.qualitygate;
import org.junit.Test;
-import org.sonar.core.platform.ComponentContainer;
+import org.sonar.core.platform.ListContainer;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonar.core.platform.ComponentContainer.COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER;
public class ProjectsInWarningModuleTest {
-
@Test
public void verify_count_of_added_components() {
- ComponentContainer container = new ComponentContainer();
+ ListContainer container = new ListContainer();
new ProjectsInWarningModule().configure(container);
- assertThat(container.size()).isEqualTo(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 2);
+ assertThat(container.getAddedObjects()).hasSize(2);
}
-
}
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java
index 0ba187b2971..1d3fac27fe6 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/telemetry/TelemetryDataLoaderImplTest.java
@@ -41,7 +41,6 @@ import org.sonar.server.measure.index.ProjectMeasuresIndexer;
import org.sonar.server.platform.DockerSupport;
import org.sonar.server.property.InternalProperties;
import org.sonar.server.property.MapInternalProperties;
-import org.sonar.server.pushapi.sonarlint.SonarLintClientsRegistry;
import org.sonar.server.user.index.UserIndex;
import org.sonar.server.user.index.UserIndexer;
import org.sonar.updatecenter.common.Version;
@@ -86,7 +85,7 @@ public class TelemetryDataLoaderImplTest {
private final LicenseReader licenseReader = mock(LicenseReader.class);
private final TelemetryDataLoader communityUnderTest = new TelemetryDataLoaderImpl(server, db.getDbClient(), pluginRepository, new UserIndex(es.client(), system2),
- new ProjectMeasuresIndex(es.client(), null, system2), editionProvider, internalProperties, configuration, dockerSupport);
+ new ProjectMeasuresIndex(es.client(), null, system2), editionProvider, internalProperties, configuration, dockerSupport, null);
private final TelemetryDataLoader commercialUnderTest = new TelemetryDataLoaderImpl(server, db.getDbClient(), pluginRepository, new UserIndex(es.client(), system2),
new ProjectMeasuresIndex(es.client(), null, system2), editionProvider, internalProperties, configuration, dockerSupport, licenseReader);
diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/updatecenter/UpdateCenterModuleTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/updatecenter/UpdateCenterModuleTest.java
index 796d2eacd63..4f72c5df932 100644
--- a/server/sonar-webserver-core/src/test/java/org/sonar/server/updatecenter/UpdateCenterModuleTest.java
+++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/updatecenter/UpdateCenterModuleTest.java
@@ -20,16 +20,15 @@
package org.sonar.server.updatecenter;
import org.junit.Test;
-import org.sonar.core.platform.ComponentContainer;
+import org.sonar.core.platform.ListContainer;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.sonar.core.platform.ComponentContainer.COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER;
public class UpdateCenterModuleTest {
@Test
public void verify_count_of_added_components() {
- ComponentContainer container = new ComponentContainer();
+ ListContainer container = new ListContainer();
new UpdateCenterModule().configure(container);
- assertThat(container.size()).isEqualTo(COMPONENTS_IN_EMPTY_COMPONENT_CONTAINER + 2);
+ assertThat(container.getAddedObjects()).hasSize(2);
}
}