From c9b849fd78b6c18a1531c5c1fd17b394878799e2 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Wed, 4 Apr 2018 14:45:19 +0200 Subject: [PATCH] Delete deprecated PropertiesDao --- .../container/ComputeEngineContainerImpl.java | 7 ++-- .../sonar/ce/db/ReadOnlyPropertiesDao.java | 7 +--- .../ce/db/ReadOnlyPropertiesDaoTest.java | 14 +------ .../core/permission/ProjectPermissions.java | 3 +- .../org/sonar/core/persistence/MyBatis.java | 36 ---------------- .../sonar/core/persistence/package-info.java | 24 ----------- .../sonar/core/properties/PropertiesDao.java | 40 ------------------ .../sonar/core/properties/PropertyDto.java | 41 ------------------- .../sonar/core/properties/package-info.java | 24 ----------- .../platformlevel/PlatformLevel1.java | 11 ++--- 10 files changed, 10 insertions(+), 197 deletions(-) delete mode 100644 server/sonar-db-dao/src/main/java/org/sonar/core/persistence/MyBatis.java delete mode 100644 server/sonar-db-dao/src/main/java/org/sonar/core/persistence/package-info.java delete mode 100644 server/sonar-db-dao/src/main/java/org/sonar/core/properties/PropertiesDao.java delete mode 100644 server/sonar-db-dao/src/main/java/org/sonar/core/properties/PropertyDto.java delete mode 100644 server/sonar-db-dao/src/main/java/org/sonar/core/properties/package-info.java diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java index fab459bc449..58c0c97ec50 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java @@ -73,6 +73,7 @@ import org.sonar.db.DaoModule; import org.sonar.db.DatabaseChecker; import org.sonar.db.DbClient; import org.sonar.db.DefaultDatabase; +import org.sonar.db.MyBatis; import org.sonar.db.purge.PurgeProfiler; import org.sonar.process.NetworkUtilsImpl; import org.sonar.process.Props; @@ -84,6 +85,7 @@ import org.sonar.server.computation.task.projectanalysis.ProjectAnalysisTaskModu import org.sonar.server.config.ConfigurationProvider; import org.sonar.server.debt.DebtModelPluginRepository; import org.sonar.server.debt.DebtRulesXMLImporter; +import org.sonar.server.es.EsModule; import org.sonar.server.es.ProjectIndexersImpl; import org.sonar.server.event.NewAlerts; import org.sonar.server.favorite.FavoriteUpdater; @@ -146,7 +148,6 @@ import org.sonar.server.rule.DefaultRuleFinder; import org.sonar.server.rule.DeprecatedRulesDefinitionLoader; import org.sonar.server.rule.RuleDefinitionsLoader; import org.sonar.server.rule.index.RuleIndex; -import org.sonar.server.es.EsModule; import org.sonar.server.setting.DatabaseSettingLoader; import org.sonar.server.setting.DatabaseSettingsEnabler; import org.sonar.server.setting.ThreadLocalSettings; @@ -250,9 +251,7 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer { LogbackHelper.class, DefaultDatabase.class, DatabaseChecker.class, - // must instantiate deprecated class in 5.2 and only this one (and not its replacement) - // to avoid having two SqlSessionFactory instances - org.sonar.core.persistence.MyBatis.class, + MyBatis.class, PurgeProfiler.class, ServerFileSystemImpl.class, new TempFolderProvider(), diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/db/ReadOnlyPropertiesDao.java b/server/sonar-ce/src/main/java/org/sonar/ce/db/ReadOnlyPropertiesDao.java index d4e2c26b95c..d7b6f8c18cb 100644 --- a/server/sonar-ce/src/main/java/org/sonar/ce/db/ReadOnlyPropertiesDao.java +++ b/server/sonar-ce/src/main/java/org/sonar/ce/db/ReadOnlyPropertiesDao.java @@ -21,9 +21,9 @@ package org.sonar.ce.db; import java.util.Map; import org.sonar.api.utils.System2; -import org.sonar.core.properties.PropertiesDao; import org.sonar.db.DbSession; import org.sonar.db.MyBatis; +import org.sonar.db.property.PropertiesDao; import org.sonar.db.property.PropertyDto; /** @@ -90,9 +90,4 @@ public class ReadOnlyPropertiesDao extends PropertiesDao { // do nothing } - @Override - public void setProperty(org.sonar.core.properties.PropertyDto property) { - // do nothing - } - } diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/db/ReadOnlyPropertiesDaoTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/db/ReadOnlyPropertiesDaoTest.java index d8e7e342cca..c986d009d8d 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/db/ReadOnlyPropertiesDaoTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/db/ReadOnlyPropertiesDaoTest.java @@ -32,7 +32,7 @@ public class ReadOnlyPropertiesDaoTest { private MyBatis myBatis = mock(MyBatis.class); private DbSession dbSession = mock(DbSession.class); private PropertyDto propertyDto = mock(PropertyDto.class); - private org.sonar.core.properties.PropertyDto oldPropertyDto = mock(org.sonar.core.properties.PropertyDto.class); + private PropertyDto oldPropertyDto = mock(PropertyDto.class); private ReadOnlyPropertiesDao underTest = new ReadOnlyPropertiesDao(myBatis, System2.INSTANCE); @Test @@ -78,7 +78,6 @@ public class ReadOnlyPropertiesDaoTest { underTest.deleteProjectProperties(null, null, dbSession); assertNoInteraction(); - } @Test @@ -86,7 +85,6 @@ public class ReadOnlyPropertiesDaoTest { underTest.deleteGlobalProperty(null); assertNoInteraction(); - } @Test @@ -94,7 +92,6 @@ public class ReadOnlyPropertiesDaoTest { underTest.deleteGlobalProperty(null, dbSession); assertNoInteraction(); - } @Test @@ -102,7 +99,6 @@ public class ReadOnlyPropertiesDaoTest { underTest.saveGlobalProperties(null); assertNoInteraction(); - } @Test @@ -110,7 +106,6 @@ public class ReadOnlyPropertiesDaoTest { underTest.renamePropertyKey(null, null); assertNoInteraction(); - } @Test @@ -120,13 +115,6 @@ public class ReadOnlyPropertiesDaoTest { assertNoInteraction(); } - @Test - public void setProperty() { - underTest.setProperty(oldPropertyDto); - - assertNoInteraction(); - } - private void assertNoInteraction() { verifyNoMoreInteractions(myBatis, dbSession, propertyDto); } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/core/permission/ProjectPermissions.java b/server/sonar-db-dao/src/main/java/org/sonar/core/permission/ProjectPermissions.java index 0ed57827147..04b47d1c1d3 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/core/permission/ProjectPermissions.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/core/permission/ProjectPermissions.java @@ -28,7 +28,6 @@ import org.sonar.api.web.UserRole; /** * Holds the constants representing the various component permissions that can be assigned to users & groups - * */ public final class ProjectPermissions { /** @@ -39,7 +38,7 @@ public final class ProjectPermissions { /** * All the component permissions values, ordered from {@link UserRole#USER} to {@link GlobalPermissions#SCAN_EXECUTION}. */ - public static final List ALL = ImmutableList.of(UserRole.ADMIN, UserRole.CODEVIEWER, UserRole.ISSUE_ADMIN, GlobalPermissions.SCAN_EXECUTION, UserRole.USER); + public static final List ALL = ImmutableList.of(UserRole.ADMIN, UserRole.CODEVIEWER, UserRole.ISSUE_ADMIN, GlobalPermissions.SCAN_EXECUTION, UserRole.USER); public static final String ALL_ON_ONE_LINE = Joiner.on(", ").join(ProjectPermissions.ALL); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/core/persistence/MyBatis.java b/server/sonar-db-dao/src/main/java/org/sonar/core/persistence/MyBatis.java deleted file mode 100644 index f4e331cbdb8..00000000000 --- a/server/sonar-db-dao/src/main/java/org/sonar/core/persistence/MyBatis.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 SonarSource SA - * mailto:info 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.core.persistence; - -import org.sonar.db.Database; - -/** - * Kept for backward compatibility of plugins/libs (like sonar-license) that are directly calling classes from the core - * - * @deprecated since 5.2, should be replaced by {@link org.sonar.db.MyBatis} - */ -@Deprecated -public class MyBatis extends org.sonar.db.MyBatis { - - public MyBatis(Database database) { - super(database); - } - -} diff --git a/server/sonar-db-dao/src/main/java/org/sonar/core/persistence/package-info.java b/server/sonar-db-dao/src/main/java/org/sonar/core/persistence/package-info.java deleted file mode 100644 index 8de723f0c31..00000000000 --- a/server/sonar-db-dao/src/main/java/org/sonar/core/persistence/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 SonarSource SA - * mailto:info 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. - */ -@ParametersAreNonnullByDefault -package org.sonar.core.persistence; - -import javax.annotation.ParametersAreNonnullByDefault; - diff --git a/server/sonar-db-dao/src/main/java/org/sonar/core/properties/PropertiesDao.java b/server/sonar-db-dao/src/main/java/org/sonar/core/properties/PropertiesDao.java deleted file mode 100644 index d8a42d043c6..00000000000 --- a/server/sonar-db-dao/src/main/java/org/sonar/core/properties/PropertiesDao.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 SonarSource SA - * mailto:info 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.core.properties; - -import org.sonar.api.utils.System2; -import org.sonar.db.MyBatis; - -/** - * Kept for backward compatibility of plugins/libs (like sonar-license) that are directly calling classes from the core - * - * @deprecated since 5.2, should be replaced by {@link org.sonar.db.property.PropertiesDao} - */ -@Deprecated -public class PropertiesDao extends org.sonar.db.property.PropertiesDao { - - public PropertiesDao(MyBatis mybatis, System2 system2) { - super(mybatis, system2); - } - - public void setProperty(PropertyDto property) { - super.saveProperty(property); - } -} diff --git a/server/sonar-db-dao/src/main/java/org/sonar/core/properties/PropertyDto.java b/server/sonar-db-dao/src/main/java/org/sonar/core/properties/PropertyDto.java deleted file mode 100644 index d4c1ac5d3ef..00000000000 --- a/server/sonar-db-dao/src/main/java/org/sonar/core/properties/PropertyDto.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 SonarSource SA - * mailto:info 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.core.properties; - -/** - * Kept for backward compatibility of plugins/libs (like sonar-license) that are directly calling classes from the core - * - * @deprecated since 5.2, should be replaced by {@link org.sonar.db.property.PropertyDto} - */ -@Deprecated -public class PropertyDto extends org.sonar.db.property.PropertyDto { - - @Override - public PropertyDto setKey(String key) { - super.setKey(key); - return this; - } - - @Override - public PropertyDto setValue(String value) { - super.setValue(value); - return this; - } -} diff --git a/server/sonar-db-dao/src/main/java/org/sonar/core/properties/package-info.java b/server/sonar-db-dao/src/main/java/org/sonar/core/properties/package-info.java deleted file mode 100644 index b55f8ecf978..00000000000 --- a/server/sonar-db-dao/src/main/java/org/sonar/core/properties/package-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2018 SonarSource SA - * mailto:info 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. - */ -@ParametersAreNonnullByDefault -package org.sonar.core.properties; - -import javax.annotation.ParametersAreNonnullByDefault; - 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 5dc9e5b92f7..6fed7e8b245 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 @@ -29,7 +29,6 @@ import org.sonar.api.internal.SonarRuntimeImpl; import org.sonar.api.utils.System2; import org.sonar.api.utils.Version; import org.sonar.api.utils.internal.TempFolderCleaner; -import org.sonar.server.config.ConfigurationProvider; import org.sonar.core.config.CorePropertyDefinitions; import org.sonar.core.util.UuidFactoryImpl; import org.sonar.db.DBSessionsImpl; @@ -37,12 +36,14 @@ import org.sonar.db.DaoModule; import org.sonar.db.DatabaseChecker; import org.sonar.db.DbClient; import org.sonar.db.DefaultDatabase; +import org.sonar.db.MyBatis; import org.sonar.db.purge.PurgeProfiler; import org.sonar.process.NetworkUtilsImpl; import org.sonar.process.logging.LogbackHelper; import org.sonar.server.app.ProcessCommandWrapperImpl; import org.sonar.server.app.RestartFlagHolderImpl; import org.sonar.server.app.WebServerProcessLogging; +import org.sonar.server.config.ConfigurationProvider; import org.sonar.server.es.EsModule; import org.sonar.server.issue.index.IssueIndex; import org.sonar.server.platform.LogServerVersion; @@ -92,9 +93,7 @@ public class PlatformLevel1 extends PlatformLevel { WebServerProcessLogging.class, DefaultDatabase.class, DatabaseChecker.class, - // must instantiate deprecated class in 5.2 and only this one (and not its replacement) - // to avoid having two SqlSessionFactory instances - org.sonar.core.persistence.MyBatis.class, + MyBatis.class, PurgeProfiler.class, ServerFileSystemImpl.class, TempFolderCleaner.class, @@ -120,9 +119,7 @@ public class PlatformLevel1 extends PlatformLevel { // issues IssueIndex.class, - new OkHttpClientProvider(), - // Classes kept for backward compatibility of plugins/libs (like sonar-license) that are directly calling classes from the core - org.sonar.core.properties.PropertiesDao.class); + new OkHttpClientProvider()); addAll(CorePropertyDefinitions.all()); // cluster -- 2.39.5