From: Julien Lancelot Date: Fri, 26 Feb 2016 16:05:43 +0000 (+0100) Subject: SONAR-7330 Remove old DbClient in server X-Git-Tag: 5.5-M6~50 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5b6b5bd5e02efb1232e5dd318e4284c210173492;p=sonarqube.git SONAR-7330 Remove old DbClient in server --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/db/DbClient.java b/server/sonar-server/src/main/java/org/sonar/server/db/DbClient.java deleted file mode 100644 index a47a99bb4f3..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/db/DbClient.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2016 SonarSource SA - * mailto:contact AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.server.db; - -import java.util.Map; -import org.sonar.db.Dao; -import org.sonar.db.Database; -import org.sonar.db.MyBatis; - -/** - * Should be replaced by {@link org.sonar.db.DbClient}, but some DAOs - * still depend on other sonar-server classes. - * @deprecated since 5.2 - should be removed as soon as the remaining daos are moved to sonar-db - */ -@Deprecated -public class DbClient extends org.sonar.db.DbClient { - - public DbClient(Database database, MyBatis myBatis, Dao... daos) { - super(database, myBatis, daos); - } - - @Override - protected void doOnLoad(Map daoByClass) { - } - -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/metric/DefaultMetricFinder.java b/server/sonar-server/src/main/java/org/sonar/server/metric/DefaultMetricFinder.java index 51f866dad9f..ca0edfebac8 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/metric/DefaultMetricFinder.java +++ b/server/sonar-server/src/main/java/org/sonar/server/metric/DefaultMetricFinder.java @@ -27,10 +27,10 @@ import java.util.List; import javax.annotation.Nonnull; import org.sonar.api.measures.Metric; import org.sonar.api.measures.MetricFinder; -import org.sonar.db.metric.MetricDto; +import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.MyBatis; -import org.sonar.server.db.DbClient; +import org.sonar.db.metric.MetricDto; import static com.google.common.collect.FluentIterable.from; diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java index fecd7deff19..c4cf1b9e5b0 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java @@ -27,13 +27,13 @@ import org.sonar.core.config.CorePropertyDefinitions; import org.sonar.core.util.UuidFactoryImpl; import org.sonar.db.DaoModule; import org.sonar.db.DatabaseChecker; +import org.sonar.db.DbClient; import org.sonar.db.DefaultDatabase; import org.sonar.db.purge.PurgeProfiler; import org.sonar.db.semaphore.SemaphoresImpl; import org.sonar.db.version.DatabaseVersion; import org.sonar.db.version.MigrationStepModule; import org.sonar.server.computation.property.CePropertyDefinitions; -import org.sonar.server.db.DbClient; import org.sonar.server.db.EmbeddedDatabaseFactory; import org.sonar.server.issue.index.IssueIndex; import org.sonar.server.platform.DatabaseServerCompatibility; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileExporters.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileExporters.java index 2cefe47bbbe..4df3dbee1fe 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileExporters.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileExporters.java @@ -69,21 +69,21 @@ public class QProfileExporters { /** * Used by Pico if no {@link ProfileImporter} is found */ - public QProfileExporters(QProfileLoader loader, RuleFinder ruleFinder, RuleActivator ruleActivator, ProfileExporter[] exporters, DbClient dbClient) { + public QProfileExporters(DbClient dbClient, QProfileLoader loader, RuleFinder ruleFinder, RuleActivator ruleActivator, ProfileExporter[] exporters) { this(dbClient, loader, ruleFinder, ruleActivator, exporters, new ProfileImporter[0]); } /** * Used by Pico if no {@link ProfileExporter} is found */ - public QProfileExporters(QProfileLoader loader, RuleFinder ruleFinder, RuleActivator ruleActivator, ProfileImporter[] importers, DbClient dbClient) { + public QProfileExporters(DbClient dbClient, QProfileLoader loader, RuleFinder ruleFinder, RuleActivator ruleActivator, ProfileImporter[] importers) { this(dbClient, loader, ruleFinder, ruleActivator, new ProfileExporter[0], importers); } /** * Used by Pico if no {@link ProfileImporter} nor {@link ProfileExporter} is found */ - public QProfileExporters(QProfileLoader loader, RuleFinder ruleFinder, RuleActivator ruleActivator, DbClient dbClient) { + public QProfileExporters(DbClient dbClient, QProfileLoader loader, RuleFinder ruleFinder, RuleActivator ruleActivator) { this(dbClient, loader, ruleFinder, ruleActivator, new ProfileExporter[0], new ProfileImporter[0]); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileProjectOperations.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileProjectOperations.java index fbbf0a7617e..3645542fcee 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileProjectOperations.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileProjectOperations.java @@ -22,11 +22,11 @@ package org.sonar.server.qualityprofile; import org.sonar.api.server.ServerSide; import org.sonar.api.web.UserRole; import org.sonar.core.permission.GlobalPermissions; +import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.MyBatis; import org.sonar.db.component.ComponentDto; import org.sonar.db.qualityprofile.QualityProfileDto; -import org.sonar.server.db.DbClient; import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.user.UserSession; diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivatorContextFactory.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivatorContextFactory.java index 02b8bcd808d..ceaf8783141 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivatorContextFactory.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivatorContextFactory.java @@ -23,13 +23,13 @@ import com.google.common.base.Optional; import java.util.Collection; import org.sonar.api.rule.RuleKey; import org.sonar.api.server.ServerSide; +import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.qualityprofile.ActiveRuleDto; import org.sonar.db.qualityprofile.ActiveRuleKey; import org.sonar.db.qualityprofile.ActiveRuleParamDto; import org.sonar.db.qualityprofile.QualityProfileDto; import org.sonar.db.rule.RuleDto; -import org.sonar.server.db.DbClient; import org.sonar.server.exceptions.BadRequestException; @ServerSide diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleUpdater.java b/server/sonar-server/src/main/java/org/sonar/server/rule/RuleUpdater.java index acaf6988523..0a30fcaaa02 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleUpdater.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/RuleUpdater.java @@ -36,12 +36,12 @@ import org.sonar.api.rule.Severity; import org.sonar.api.server.ServerSide; import org.sonar.api.server.debt.DebtRemediationFunction; import org.sonar.api.utils.System2; +import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.qualityprofile.ActiveRuleDto; import org.sonar.db.qualityprofile.ActiveRuleParamDto; import org.sonar.db.rule.RuleDto; import org.sonar.db.rule.RuleParamDto; -import org.sonar.server.db.DbClient; import org.sonar.server.rule.index.RuleIndexer; import org.sonar.server.user.UserSession; diff --git a/server/sonar-server/src/main/java/org/sonar/server/search/BaseNormalizer.java b/server/sonar-server/src/main/java/org/sonar/server/search/BaseNormalizer.java index 23ca128c30d..55f03c2cb68 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/search/BaseNormalizer.java +++ b/server/sonar-server/src/main/java/org/sonar/server/search/BaseNormalizer.java @@ -19,16 +19,15 @@ */ package org.sonar.server.search; -import org.elasticsearch.action.update.UpdateRequest; -import org.sonar.db.Dto; -import org.sonar.server.db.DbClient; - import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; +import org.elasticsearch.action.update.UpdateRequest; +import org.sonar.db.DbClient; +import org.sonar.db.Dto; public abstract class BaseNormalizer, KEY extends Serializable> { diff --git a/server/sonar-server/src/main/java/org/sonar/server/user/ws/GroupsAction.java b/server/sonar-server/src/main/java/org/sonar/server/user/ws/GroupsAction.java index 8a29968d7fd..6cd2552d378 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/user/ws/GroupsAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/user/ws/GroupsAction.java @@ -29,11 +29,11 @@ import org.sonar.api.server.ws.WebService.SelectionMode; import org.sonar.api.utils.Paging; import org.sonar.api.utils.text.JsonWriter; import org.sonar.core.permission.GlobalPermissions; +import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.user.GroupMembershipDto; import org.sonar.db.user.GroupMembershipQuery; import org.sonar.db.user.UserDto; -import org.sonar.server.db.DbClient; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.user.UserSession; diff --git a/server/sonar-server/src/test/java/org/sonar/server/batch/BatchWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/batch/BatchWsTest.java index e9a5b5221c2..074fde032dd 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/batch/BatchWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/batch/BatchWsTest.java @@ -29,9 +29,9 @@ import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; +import org.sonar.db.DbClient; import org.sonar.db.property.PropertiesDao; import org.sonar.server.component.ComponentFinder; -import org.sonar.server.db.DbClient; import org.sonar.server.issue.index.IssueIndex; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.WsTester; diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentsWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentsWsTest.java index 69f51fea571..cd5792c53aa 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentsWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentsWsTest.java @@ -29,8 +29,8 @@ import org.sonar.api.resources.ResourceTypes; import org.sonar.api.server.ws.RailsHandler; import org.sonar.api.server.ws.WebService; import org.sonar.api.utils.Durations; +import org.sonar.db.DbClient; import org.sonar.server.component.ComponentFinder; -import org.sonar.server.db.DbClient; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.WsTester; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PurgeDatastoresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PurgeDatastoresStepTest.java index 11a0892e2ad..7e59ceae161 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PurgeDatastoresStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PurgeDatastoresStepTest.java @@ -30,6 +30,7 @@ import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; import org.sonar.api.config.Settings; +import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.purge.IdUuidPair; import org.sonar.server.computation.batch.TreeRootHolderRule; @@ -39,7 +40,6 @@ import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.component.SettingsRepository; import org.sonar.server.computation.component.ViewsComponent; import org.sonar.server.computation.dbcleaner.ProjectCleaner; -import org.sonar.server.db.DbClient; import org.sonar.server.util.WrapInSingleElementArray; import static java.util.Arrays.asList; diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/SwitchSnapshotStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/SwitchSnapshotStepTest.java index f0809ef19f9..10d1cf4809f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/SwitchSnapshotStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/SwitchSnapshotStepTest.java @@ -25,13 +25,13 @@ import org.junit.Test; import org.junit.experimental.categories.Category; import org.sonar.api.utils.DateUtils; import org.sonar.api.utils.System2; +import org.sonar.db.DbClient; import org.sonar.db.DbTester; import org.sonar.db.component.SnapshotDao; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; import org.sonar.server.computation.component.DbIdsRepositoryImpl; import org.sonar.server.computation.component.ReportComponent; -import org.sonar.server.db.DbClient; import org.sonar.test.DbTests; import static org.mockito.Mockito.mock; diff --git a/server/sonar-server/src/test/java/org/sonar/server/duplication/ws/DuplicationsWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/duplication/ws/DuplicationsWsTest.java index d4c66244905..4672e4273f7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/duplication/ws/DuplicationsWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/duplication/ws/DuplicationsWsTest.java @@ -22,9 +22,9 @@ package org.sonar.server.duplication.ws; import org.junit.Rule; import org.junit.Test; import org.sonar.api.server.ws.WebService; +import org.sonar.db.DbClient; import org.sonar.db.measure.MeasureDao; import org.sonar.server.component.ComponentFinder; -import org.sonar.server.db.DbClient; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.WsTester; diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationIndexerTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationIndexerTest.java index 0131a873ccb..d7625e4842d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationIndexerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationIndexerTest.java @@ -30,8 +30,8 @@ import org.junit.Test; import org.junit.experimental.categories.Category; import org.sonar.api.config.Settings; import org.sonar.api.utils.System2; +import org.sonar.db.DbClient; import org.sonar.db.DbTester; -import org.sonar.server.db.DbClient; import org.sonar.server.es.EsTester; import org.sonar.test.DbTests; diff --git a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java index 2da207bbcd0..8dc6def6f34 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java @@ -29,8 +29,8 @@ import org.junit.experimental.categories.Category; import org.sonar.api.config.Settings; import org.sonar.api.rule.RuleKey; import org.sonar.api.utils.System2; +import org.sonar.db.DbClient; import org.sonar.db.DbTester; -import org.sonar.server.db.DbClient; import org.sonar.server.es.EsTester; import org.sonar.test.DbTests; diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/CustomMeasuresWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/CustomMeasuresWsTest.java index 0e204da76c2..d2795519be3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/CustomMeasuresWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/CustomMeasuresWsTest.java @@ -23,8 +23,8 @@ import org.junit.Before; import org.junit.Test; import org.sonar.api.server.ws.WebService; import org.sonar.api.utils.System2; +import org.sonar.db.DbClient; import org.sonar.server.component.ComponentFinder; -import org.sonar.server.db.DbClient; import org.sonar.server.user.UserSession; import org.sonar.server.user.index.UserIndex; import org.sonar.server.ws.WsTester; diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/SearchActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/SearchActionTest.java index be23ff67fbf..609262302a1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/SearchActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/SearchActionTest.java @@ -35,22 +35,22 @@ import org.sonar.api.utils.DateUtils; import org.sonar.api.utils.System2; import org.sonar.api.web.UserRole; import org.sonar.core.permission.GlobalPermissions; +import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.DbTester; import org.sonar.db.component.ComponentDao; import org.sonar.db.component.ComponentDto; +import org.sonar.db.component.ComponentTesting; import org.sonar.db.component.SnapshotDao; +import org.sonar.db.component.SnapshotTesting; +import org.sonar.db.measure.custom.CustomMeasureDao; import org.sonar.db.measure.custom.CustomMeasureDto; +import org.sonar.db.metric.MetricDao; import org.sonar.db.metric.MetricDto; import org.sonar.server.component.ComponentFinder; -import org.sonar.db.component.ComponentTesting; -import org.sonar.db.component.SnapshotTesting; -import org.sonar.server.db.DbClient; import org.sonar.server.es.EsTester; import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.exceptions.NotFoundException; -import org.sonar.db.measure.custom.CustomMeasureDao; -import org.sonar.db.metric.MetricDao; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.user.index.UserDoc; import org.sonar.server.user.index.UserIndex; diff --git a/server/sonar-server/src/test/java/org/sonar/server/metric/DefaultMetricFinderTest.java b/server/sonar-server/src/test/java/org/sonar/server/metric/DefaultMetricFinderTest.java index 9f4ac60974c..bbb6b9e2b78 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/metric/DefaultMetricFinderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/metric/DefaultMetricFinderTest.java @@ -25,8 +25,8 @@ import org.junit.Rule; import org.junit.Test; import org.junit.experimental.categories.Category; import org.sonar.api.utils.System2; +import org.sonar.db.DbClient; import org.sonar.db.DbTester; -import org.sonar.server.db.DbClient; import org.sonar.db.metric.MetricDao; import org.sonar.test.DbTests; diff --git a/server/sonar-server/src/test/java/org/sonar/server/metric/ws/DomainsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/metric/ws/DomainsActionTest.java index 11d946f485a..8c404d4ea3b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/metric/ws/DomainsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/metric/ws/DomainsActionTest.java @@ -25,11 +25,11 @@ import org.junit.Rule; import org.junit.Test; import org.junit.experimental.categories.Category; import org.sonar.api.utils.System2; +import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.DbTester; -import org.sonar.db.metric.MetricDto; -import org.sonar.server.db.DbClient; import org.sonar.db.metric.MetricDao; +import org.sonar.db.metric.MetricDto; import org.sonar.server.ws.WsTester; import org.sonar.test.DbTests; import org.sonar.test.JsonAssert; diff --git a/server/sonar-server/src/test/java/org/sonar/server/metric/ws/MetricsWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/metric/ws/MetricsWsTest.java index a4059ebd219..df49c94ffc9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/metric/ws/MetricsWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/metric/ws/MetricsWsTest.java @@ -22,7 +22,7 @@ package org.sonar.server.metric.ws; import org.junit.Before; import org.junit.Test; import org.sonar.api.server.ws.WebService; -import org.sonar.server.db.DbClient; +import org.sonar.db.DbClient; import org.sonar.server.ruby.RubyBridge; import org.sonar.server.user.UserSession; import org.sonar.server.ws.WsTester; diff --git a/server/sonar-server/src/test/java/org/sonar/server/project/ws/ProjectsWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/project/ws/ProjectsWsTest.java index 4f1593610e0..fe2701d163b 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/project/ws/ProjectsWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/project/ws/ProjectsWsTest.java @@ -23,8 +23,8 @@ import org.junit.Before; import org.junit.Test; import org.sonar.api.server.ws.RailsHandler; import org.sonar.api.server.ws.WebService; +import org.sonar.db.DbClient; import org.sonar.server.component.ComponentCleanerService; -import org.sonar.server.db.DbClient; import org.sonar.server.user.UserSession; import org.sonar.server.ws.WsTester; diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/BackupActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/BackupActionTest.java index c8c34997297..a8cadafaa6e 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/BackupActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/BackupActionTest.java @@ -30,8 +30,8 @@ import org.mockito.invocation.InvocationOnMock; import org.mockito.runners.MockitoJUnitRunner; import org.mockito.stubbing.Answer; import org.sonar.api.utils.System2; +import org.sonar.db.DbClient; import org.sonar.db.DbTester; -import org.sonar.server.db.DbClient; import org.sonar.server.language.LanguageTesting; import org.sonar.server.qualityprofile.QProfileBackuper; import org.sonar.server.qualityprofile.QProfileFactory; diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/CreateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/CreateActionTest.java index 1ff538bb890..c3e9d86c384 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/CreateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/CreateActionTest.java @@ -23,16 +23,16 @@ import org.junit.Rule; import org.junit.Test; import org.sonar.api.utils.System2; import org.sonar.core.permission.GlobalPermissions; +import org.sonar.db.DbClient; import org.sonar.db.DbTester; import org.sonar.db.qualityprofile.QualityProfileDao; -import org.sonar.server.db.DbClient; import org.sonar.server.language.LanguageTesting; -import org.sonarqube.ws.MediaTypes; import org.sonar.server.qualityprofile.QProfileFactory; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ws.TestResponse; import org.sonar.server.ws.WsActionTester; import org.sonar.test.JsonAssert; +import org.sonarqube.ws.MediaTypes; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ExportActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ExportActionTest.java index e66cd4a096d..8a47805ad47 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ExportActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ExportActionTest.java @@ -23,7 +23,6 @@ import com.google.common.collect.Sets; import java.io.IOException; import java.io.Writer; import org.apache.commons.lang.StringUtils; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -34,11 +33,11 @@ import org.sonar.api.profiles.ProfileExporter; import org.sonar.api.profiles.RulesProfile; import org.sonar.api.server.ws.WebService.Action; import org.sonar.api.utils.System2; +import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.DbTester; import org.sonar.db.qualityprofile.QualityProfileDao; import org.sonar.db.qualityprofile.QualityProfileDto; -import org.sonar.server.db.DbClient; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.language.LanguageTesting; import org.sonar.server.qualityprofile.QProfileBackuper; @@ -64,11 +63,11 @@ public class ExportActionTest { WsTester wsTester; - QualityProfileDao qualityProfileDao; + DbClient dbClient = db.getDbClient(); - DbClient dbClient; + DbSession session = db.getSession(); - DbSession session; + QualityProfileDao qualityProfileDao = dbClient.qualityProfileDao(); QProfileBackuper backuper; @@ -76,8 +75,6 @@ public class ExportActionTest { @Before public void before() { - qualityProfileDao = new QualityProfileDao(db.myBatis(), mock(System2.class)); - dbClient = new DbClient(db.database(), db.myBatis(), qualityProfileDao); session = dbClient.openSession(false); backuper = mock(QProfileBackuper.class); @@ -89,18 +86,14 @@ public class ExportActionTest { ActiveRuleIndex activeRuleIndex = mock(ActiveRuleIndex.class); when(activeRuleIndex.findByProfile(Matchers.anyString())).thenReturn(Sets.newHashSet().iterator()); - exporters = new QProfileExporters(dbClient, new QProfileLoader(dbClient, activeRuleIndex, mock(RuleIndex.class)), null, null, new ProfileExporter[] {exporter1, exporter2}, null); + exporters = new QProfileExporters(dbClient, new QProfileLoader(dbClient, activeRuleIndex, mock(RuleIndex.class)), null, null, new ProfileExporter[] {exporter1, exporter2}, + null); wsTester = new WsTester(new QProfilesWs(mock(RuleActivationActions.class), mock(BulkRuleActivationActions.class), mock(ProjectAssociationActions.class), new ExportAction(dbClient, new QProfileFactory(dbClient), backuper, exporters, LanguageTesting.newLanguages("xoo")))); } - @After - public void after() { - session.close(); - } - private ProfileExporter newExporter(final String key) { return new ProfileExporter(key, StringUtils.capitalize(key)) { @Override diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProjectsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProjectsActionTest.java index 8dd16be47af..c57f9dfadb6 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProjectsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProjectsActionTest.java @@ -26,23 +26,23 @@ import org.junit.Test; import org.junit.experimental.categories.Category; import org.sonar.api.utils.System2; import org.sonar.api.web.UserRole; +import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.DbTester; import org.sonar.db.component.ComponentDao; import org.sonar.db.component.ComponentDto; +import org.sonar.db.component.ComponentTesting; import org.sonar.db.qualityprofile.QualityProfileDao; import org.sonar.db.qualityprofile.QualityProfileDto; import org.sonar.db.user.AuthorizationDao; import org.sonar.db.user.GroupRoleDto; import org.sonar.db.user.RoleDao; +import org.sonar.db.user.UserDao; import org.sonar.db.user.UserDto; import org.sonar.db.user.UserRoleDto; -import org.sonar.db.component.ComponentTesting; -import org.sonar.server.db.DbClient; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.qualityprofile.QProfileTesting; import org.sonar.server.tester.UserSessionRule; -import org.sonar.db.user.UserDao; import org.sonar.server.ws.WsTester; import org.sonar.server.ws.WsTester.TestRequest; import org.sonar.test.DbTests; diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/RenameActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/RenameActionTest.java index d0bbf261052..63a763166f6 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/RenameActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/RenameActionTest.java @@ -25,11 +25,11 @@ import org.junit.Rule; import org.junit.Test; import org.sonar.api.utils.System2; import org.sonar.core.permission.GlobalPermissions; +import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.DbTester; import org.sonar.db.qualityprofile.QualityProfileDao; import org.sonar.db.qualityprofile.QualityProfileDto; -import org.sonar.server.db.DbClient; import org.sonar.server.exceptions.BadRequestException; import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.exceptions.NotFoundException; diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SetDefaultActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SetDefaultActionTest.java index 0c22943d997..66dfaeb90d3 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SetDefaultActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SetDefaultActionTest.java @@ -26,11 +26,11 @@ import org.junit.Rule; import org.junit.Test; import org.sonar.api.utils.System2; import org.sonar.core.permission.GlobalPermissions; +import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.DbTester; import org.sonar.db.qualityprofile.QualityProfileDao; import org.sonar.db.qualityprofile.QualityProfileDto; -import org.sonar.server.db.DbClient; import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.language.LanguageTesting; diff --git a/server/sonar-server/src/test/java/org/sonar/server/source/ws/SourcesWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/source/ws/SourcesWsTest.java index 9388fe0f014..1cc68d05f69 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/source/ws/SourcesWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/source/ws/SourcesWsTest.java @@ -22,8 +22,8 @@ package org.sonar.server.source.ws; import org.junit.Rule; import org.junit.Test; import org.sonar.api.server.ws.WebService; +import org.sonar.db.DbClient; import org.sonar.server.component.ComponentFinder; -import org.sonar.server.db.DbClient; import org.sonar.server.source.HtmlSourceDecorator; import org.sonar.server.source.SourceService; import org.sonar.server.tester.UserSessionRule; diff --git a/server/sonar-server/src/test/java/org/sonar/server/startup/RenameIssueWidgetsTest.java b/server/sonar-server/src/test/java/org/sonar/server/startup/RenameIssueWidgetsTest.java index 4830bb7b83f..40faecfcf18 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/startup/RenameIssueWidgetsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/startup/RenameIssueWidgetsTest.java @@ -27,13 +27,13 @@ import org.junit.Test; import org.junit.experimental.categories.Category; import org.sonar.api.utils.DateUtils; import org.sonar.api.utils.System2; +import org.sonar.db.DbClient; import org.sonar.db.DbTester; import org.sonar.db.dashboard.DashboardDao; import org.sonar.db.dashboard.WidgetDao; import org.sonar.db.dashboard.WidgetPropertyDao; import org.sonar.db.issue.IssueFilterDao; import org.sonar.db.loadedtemplate.LoadedTemplateDao; -import org.sonar.server.db.DbClient; import org.sonar.test.DbTests; import static org.assertj.core.api.Assertions.assertThat; diff --git a/server/sonar-server/src/test/java/org/sonar/server/ui/ws/GlobalNavigationActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ui/ws/GlobalNavigationActionTest.java index fef1fa5e732..c9ba63f652d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ui/ws/GlobalNavigationActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ui/ws/GlobalNavigationActionTest.java @@ -33,17 +33,17 @@ import org.sonar.api.web.Page; import org.sonar.api.web.UserRole; import org.sonar.api.web.View; import org.sonar.core.permission.GlobalPermissions; +import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.DbTester; import org.sonar.db.dashboard.ActiveDashboardDao; import org.sonar.db.dashboard.ActiveDashboardDto; import org.sonar.db.dashboard.DashboardDao; import org.sonar.db.dashboard.DashboardDto; +import org.sonar.db.user.UserDao; import org.sonar.db.user.UserDto; -import org.sonar.server.db.DbClient; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.ui.Views; -import org.sonar.db.user.UserDao; import org.sonar.server.ws.WsTester; import static org.mockito.Mockito.mock; diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/UserUpdaterTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/UserUpdaterTest.java index 585a72e5a27..4d5ee091f5f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/UserUpdaterTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/UserUpdaterTest.java @@ -31,6 +31,7 @@ import org.mockito.ArgumentCaptor; import org.sonar.api.config.Settings; import org.sonar.api.platform.NewUserHandler; import org.sonar.api.utils.System2; +import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.DbTester; import org.sonar.db.user.GroupDao; @@ -41,7 +42,6 @@ import org.sonar.db.user.UserDao; import org.sonar.db.user.UserDto; import org.sonar.db.user.UserGroupDao; import org.sonar.db.user.UserTokenDao; -import org.sonar.server.db.DbClient; import org.sonar.server.es.EsTester; import org.sonar.server.exceptions.BadRequestException; import org.sonar.server.exceptions.Message; diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/index/UserIndexerTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/index/UserIndexerTest.java index 896c9675c37..a4ae7145a5d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/index/UserIndexerTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/index/UserIndexerTest.java @@ -27,8 +27,8 @@ import org.junit.Test; import org.junit.experimental.categories.Category; import org.sonar.api.config.Settings; import org.sonar.api.utils.System2; +import org.sonar.db.DbClient; import org.sonar.db.DbTester; -import org.sonar.server.db.DbClient; import org.sonar.server.es.EsTester; import org.sonar.test.DbTests; diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/ChangePasswordActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/ChangePasswordActionTest.java index fbf8f28a878..30a4d759542 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/ChangePasswordActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/ChangePasswordActionTest.java @@ -28,13 +28,13 @@ import org.sonar.api.config.Settings; import org.sonar.api.server.ws.WebService; import org.sonar.api.utils.System2; import org.sonar.core.permission.GlobalPermissions; +import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.DbTester; import org.sonar.db.user.GroupDao; import org.sonar.db.user.GroupDto; import org.sonar.db.user.UserDao; import org.sonar.db.user.UserGroupDao; -import org.sonar.server.db.DbClient; import org.sonar.server.es.EsTester; import org.sonar.server.exceptions.BadRequestException; import org.sonar.server.exceptions.ForbiddenException; diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/CreateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/CreateActionTest.java index 6d808226f15..bbb6374e95d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/CreateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/CreateActionTest.java @@ -31,6 +31,7 @@ import org.sonar.api.i18n.I18n; import org.sonar.api.server.ws.WebService; import org.sonar.api.utils.System2; import org.sonar.core.permission.GlobalPermissions; +import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.DbTester; import org.sonar.db.user.GroupDao; @@ -38,7 +39,6 @@ import org.sonar.db.user.GroupDto; import org.sonar.db.user.UserDao; import org.sonar.db.user.UserGroupDao; import org.sonar.db.user.UserTesting; -import org.sonar.server.db.DbClient; import org.sonar.server.es.EsTester; import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.tester.UserSessionRule; diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/DeactivateActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/DeactivateActionTest.java index 169918cf4ad..c313c7030de 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/DeactivateActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/DeactivateActionTest.java @@ -28,13 +28,13 @@ import org.sonar.api.config.Settings; import org.sonar.api.server.ws.WebService; import org.sonar.api.utils.System2; import org.sonar.core.permission.GlobalPermissions; +import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.DbTester; import org.sonar.db.user.GroupMembershipDao; import org.sonar.db.user.UserDao; import org.sonar.db.user.UserDto; import org.sonar.db.user.UserTokenDao; -import org.sonar.server.db.DbClient; import org.sonar.server.es.EsTester; import org.sonar.server.exceptions.BadRequestException; import org.sonar.server.exceptions.ForbiddenException; diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/GroupsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/GroupsActionTest.java index 650c5c05b12..e6624f5a1cb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/GroupsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/GroupsActionTest.java @@ -27,19 +27,19 @@ import org.sonar.api.server.ws.WebService.Param; import org.sonar.api.server.ws.WebService.SelectionMode; import org.sonar.api.utils.System2; import org.sonar.core.permission.GlobalPermissions; +import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.DbTester; +import org.sonar.db.user.GroupDao; import org.sonar.db.user.GroupDto; import org.sonar.db.user.GroupMembershipDao; +import org.sonar.db.user.UserDao; import org.sonar.db.user.UserDto; import org.sonar.db.user.UserGroupDao; import org.sonar.db.user.UserGroupDto; -import org.sonar.server.db.DbClient; import org.sonar.server.exceptions.ForbiddenException; import org.sonar.server.exceptions.NotFoundException; import org.sonar.server.tester.UserSessionRule; -import org.sonar.db.user.GroupDao; -import org.sonar.db.user.UserDao; import org.sonar.server.ws.WsTester; public class GroupsActionTest { diff --git a/server/sonar-server/src/test/java/org/sonar/server/user/ws/UsersWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/user/ws/UsersWsTest.java index 3de0d922015..bb6d4fa06e4 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/user/ws/UsersWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/user/ws/UsersWsTest.java @@ -24,7 +24,7 @@ import org.junit.Rule; import org.junit.Test; import org.sonar.api.i18n.I18n; import org.sonar.api.server.ws.WebService; -import org.sonar.server.db.DbClient; +import org.sonar.db.DbClient; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.user.UserUpdater; import org.sonar.server.user.index.UserIndex; diff --git a/server/sonar-server/src/test/java/org/sonar/server/usergroups/ws/UserGroupsWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/usergroups/ws/UserGroupsWsTest.java index 715131d73ea..ba1a32bacd7 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/usergroups/ws/UserGroupsWsTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/usergroups/ws/UserGroupsWsTest.java @@ -23,7 +23,7 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.sonar.api.server.ws.WebService; -import org.sonar.server.db.DbClient; +import org.sonar.db.DbClient; import org.sonar.server.tester.UserSessionRule; import org.sonar.server.user.UserSession; import org.sonar.server.ws.WsTester;