]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7330 Remove old DbClient in server
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Fri, 26 Feb 2016 16:05:43 +0000 (17:05 +0100)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Mon, 29 Feb 2016 12:26:54 +0000 (13:26 +0100)
39 files changed:
server/sonar-server/src/main/java/org/sonar/server/db/DbClient.java [deleted file]
server/sonar-server/src/main/java/org/sonar/server/metric/DefaultMetricFinder.java
server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel1.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileExporters.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileProjectOperations.java
server/sonar-server/src/main/java/org/sonar/server/qualityprofile/RuleActivatorContextFactory.java
server/sonar-server/src/main/java/org/sonar/server/rule/RuleUpdater.java
server/sonar-server/src/main/java/org/sonar/server/search/BaseNormalizer.java
server/sonar-server/src/main/java/org/sonar/server/user/ws/GroupsAction.java
server/sonar-server/src/test/java/org/sonar/server/batch/BatchWsTest.java
server/sonar-server/src/test/java/org/sonar/server/component/ws/ComponentsWsTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/step/PurgeDatastoresStepTest.java
server/sonar-server/src/test/java/org/sonar/server/computation/step/SwitchSnapshotStepTest.java
server/sonar-server/src/test/java/org/sonar/server/duplication/ws/DuplicationsWsTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueAuthorizationIndexerTest.java
server/sonar-server/src/test/java/org/sonar/server/issue/index/IssueIndexerTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/CustomMeasuresWsTest.java
server/sonar-server/src/test/java/org/sonar/server/measure/custom/ws/SearchActionTest.java
server/sonar-server/src/test/java/org/sonar/server/metric/DefaultMetricFinderTest.java
server/sonar-server/src/test/java/org/sonar/server/metric/ws/DomainsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/metric/ws/MetricsWsTest.java
server/sonar-server/src/test/java/org/sonar/server/project/ws/ProjectsWsTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/BackupActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/CreateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ExportActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/ProjectsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/RenameActionTest.java
server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/SetDefaultActionTest.java
server/sonar-server/src/test/java/org/sonar/server/source/ws/SourcesWsTest.java
server/sonar-server/src/test/java/org/sonar/server/startup/RenameIssueWidgetsTest.java
server/sonar-server/src/test/java/org/sonar/server/ui/ws/GlobalNavigationActionTest.java
server/sonar-server/src/test/java/org/sonar/server/user/UserUpdaterTest.java
server/sonar-server/src/test/java/org/sonar/server/user/index/UserIndexerTest.java
server/sonar-server/src/test/java/org/sonar/server/user/ws/ChangePasswordActionTest.java
server/sonar-server/src/test/java/org/sonar/server/user/ws/CreateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/user/ws/DeactivateActionTest.java
server/sonar-server/src/test/java/org/sonar/server/user/ws/GroupsActionTest.java
server/sonar-server/src/test/java/org/sonar/server/user/ws/UsersWsTest.java
server/sonar-server/src/test/java/org/sonar/server/usergroups/ws/UserGroupsWsTest.java

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 (file)
index a47a99b..0000000
+++ /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<Class, Dao> daoByClass) {
-  }
-
-}
index 51f866dad9f5e10124ecc0f2b589f1c15f2c8f03..ca0edfebac8b6490b07268bf7359518293ccc326 100644 (file)
@@ -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;
 
index fecd7deff196a248083733865f947f70e75b0e3d..c4cf1b9e5b07784a1f4f9a911551f1e82900db91 100644 (file)
@@ -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;
index 2cefe47bbbe87ad2cb1407e15bfe9a9e725de6d4..4df3dbee1feab7786bf17714ac06dd3dbeb7fc27 100644 (file)
@@ -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]);
   }
 
index fbbf0a7617e49958953943f5d7c7c45ccae76349..3645542fceead09fe5754d8b610960eede9e36ca 100644 (file)
@@ -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;
 
index 02b8bcd808d965ebebc381af96c576d2f91c911a..ceaf8783141ff09bb9d2a655e627f4cf1cac5683 100644 (file)
@@ -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
index acaf69885231291011c4d8510fabd49ad1472bd2..0a30fcaaa02fe8f27ed6df713fd244204144c195 100644 (file)
@@ -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;
 
index 23ca128c30d97a082d0879f12f713474b8e1a3c8..55f03c2cb688aac2746e7534ef98a3917151b6b3 100644 (file)
  */
 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<DTO extends Dto<KEY>, KEY extends Serializable> {
 
index 8a29968d7fdf67eba517e612d12c55369cfbc42c..6cd2552d378a9bf3e187bac0d66003174cfd7077 100644 (file)
@@ -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;
 
index e9a5b5221c2592a123d629bb7eea21b8b9ae7fc0..074fde032dd0d39b1a0a075db27dc3162d8bc5fe 100644 (file)
@@ -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;
index 69f51fea5713d30a078c697ac5031dc89f5b8c2e..cd5792c53aaa555ee0212e799dc425736c3c60a3 100644 (file)
@@ -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;
 
index 11a0892e2ad00d97cb114dcf48ce16035dd45cfe..7e59ceae161a1d35b58499133e6f1fbe9fdafc81 100644 (file)
@@ -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;
index f0809ef19f9c7189488b2e821c4abdf26ce3a2e2..10d1cf4809f0748dc8d9776c204c3e97649c33d2 100644 (file)
@@ -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;
index d4c662449059d1d4706ea68f458c506af9989bb3..4672e4273f7c9e01f6b75cb193e75a1792a315ad 100644 (file)
@@ -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;
 
index 0131a873ccb5e9d07515469d476d0139436abea3..d7625e4842dcd42c5626917a72351cca5a28bcd7 100644 (file)
@@ -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;
 
index 2da207bbcd0a81fa324906bcc94a6eb3bd42e966..8dc6def6f347f71f87686200f76a05d8b6f7443f 100644 (file)
@@ -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;
 
index 0e204da76c24dec135443f2c337a391efe815877..d2795519be3cbcf77f00d522c6c99c72c76dab06 100644 (file)
@@ -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;
index be23ff67fbfec5174c7f0e3e4b3fa114944c0684..609262302a126faa2847560c77561d485ec70b83 100644 (file)
@@ -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;
index 9f4ac60974cf91e73f2116e0d7bde7215495fc09..bbb6b9e2b78d922fa235f636891dfe8051a089de 100644 (file)
@@ -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;
 
index 11d946f485acac3d39e20c8ab5fa36d5937d8677..8c404d4ea3b20f9c83cea774423a022a737e8559 100644 (file)
@@ -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;
index a4059ebd219f23b486723091de08ac2896cdf688..df49c94ffc9d0eba5982bbf04adf44b0f1df90c8 100644 (file)
@@ -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;
index 4f1593610e0d13b9e8e2bede3c7ffbe4bd55630c..fe2701d163bf173d5a3b7b5956e12d95cd0b00f4 100644 (file)
@@ -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;
 
index c8c34997297157a92ea3ac73d50b9054f709406a..a8cadafaa6e4be877c6ea5f6ceadf0b9b6514ed5 100644 (file)
@@ -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;
index 1ff538bb89064e6b711536b4b935dc6f37a82d11..c3e9d86c384c4e630f91d50272864fc75312bad3 100644 (file)
@@ -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;
index e66cd4a096d263e5c24059dc26124c90adcac0d8..8a47805ad47bbfae6dc51e3e0e7433609e8fc89a 100644 (file)
@@ -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.<ActiveRuleDoc>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
index 8dd16be47af718436b8ed2454cfb6602bc0bdbc2..c57f9dfadb65c677870f075ee0ac99a436eba409 100644 (file)
@@ -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;
index d0bbf2610527cf01d5e254dff49328553a64dde8..63a763166f6f26a2bfc3069eba903380a1c8ec99 100644 (file)
@@ -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;
index 0c22943d99730db187a6105a20370a316db09e68..66dfaeb90d36197a92e12db95015645ac1c91eac 100644 (file)
@@ -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;
index 9388fe0f01455d24f06ffd59c311016203ad6463..1cc68d05f69618da1fd5f9e9f91aa6a3e7457d3d 100644 (file)
@@ -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;
index 4830bb7b83f99347147eb31e1d8c1715c0966701..40faecfcf18f4b1301a3242c34727abf8a14474e 100644 (file)
@@ -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;
index fef1fa5e732d71c948319c69d5ab8eeecbc70d04..c9ba63f652d3e245bf9234c3af149474742bacad 100644 (file)
@@ -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;
index 585a72e5a275eb747bc122f4d1df061b6dd66c26..4d5ee091f5f7b5a620049395e82ed820976706f3 100644 (file)
@@ -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;
index 896c9675c3721dd04d38ea4bd8b8d3823974755c..a4ae7145a5d8a220f83cfbc9928b08faee0f3c7b 100644 (file)
@@ -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;
 
index fbf8f28a8780d7bbe7fbfaa2207cb4f8ccaec60a..30a4d75954291558cdf281b3af163b3bac874198 100644 (file)
@@ -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;
index 6d808226f15ce301d364d174867d683d0fa2bc30..bbb6374e95d8a6d93281b16676b9f49735530576 100644 (file)
@@ -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;
index 169918cf4ad2b8d2c3540cdae53a00c3a7477fa6..c313c7030de25882c106875cb5edb492f9ae7a00 100644 (file)
@@ -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;
index 650c5c05b12940b28b8e4a36d78036878a77db22..e6624f5a1cbd9fd6efeb255d13b70ead57145a66 100644 (file)
@@ -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 {
index 3de0d9220159ec6820b5591aa5cfaa52a7c7e084..bb6d4fa06e42408d094aea511fef984faf10c72f 100644 (file)
@@ -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;
index 715131d73ea776aa919372c7eba9fc448d919545..ba1a32bacd7c94346cd3e23fee6fb9ee3a45a507 100644 (file)
@@ -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;