From f1cfcc3fdc70b379b20db44f0b3ba9b10c54ce58 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Tue, 31 Jan 2017 16:13:38 +0100 Subject: [PATCH] SONAR-6393 Remove quality model extension point --- .../sonar/server/debt/DebtModelService.java | 85 ------------------- .../platformlevel/PlatformLevel4.java | 2 - .../server/debt/DebtModelServiceTest.java | 72 ---------------- .../api/server/debt/DebtCharacteristic.java | 44 ---------- .../org/sonar/api/server/debt/DebtModel.java | 52 ------------ 5 files changed, 255 deletions(-) delete mode 100644 server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelService.java delete mode 100644 server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelServiceTest.java delete mode 100644 sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtCharacteristic.java delete mode 100644 sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtModel.java diff --git a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelService.java b/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelService.java deleted file mode 100644 index a201d822f25..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/debt/DebtModelService.java +++ /dev/null @@ -1,85 +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.debt; - -import java.util.Collections; -import java.util.List; -import javax.annotation.CheckForNull; -import org.sonar.api.server.debt.DebtCharacteristic; -import org.sonar.api.server.debt.DebtModel; -import org.sonar.api.utils.ValidationMessages; - -/** - * Also used by SQALE plugin. - */ -public class DebtModelService implements DebtModel { - - private final DebtModelBackup debtModelBackup; - - public DebtModelService(DebtModelBackup debtModelBackup) { - this.debtModelBackup = debtModelBackup; - } - - @Override - public List characteristics() { - return Collections.emptyList(); - } - - @Override - public List allCharacteristics() { - return Collections.emptyList(); - } - - @Override - @CheckForNull - public DebtCharacteristic characteristicByKey(String key) { - return null; - } - - /** - * Reset model - */ - public void reset() { - debtModelBackup.reset(); - } - - /** - * Restore from XML - */ - public ValidationMessages restoreFromXml(String xml) { - return debtModelBackup.restoreFromXml(xml); - } - - /** - * Restore from XML and a given language - */ - public ValidationMessages restoreFromXmlAndLanguage(String xml, String languageKey) { - return debtModelBackup.restoreFromXml(xml, languageKey); - } - - public String backup() { - return debtModelBackup.backup(); - } - - public String backupFromLanguage(String languageKey) { - return debtModelBackup.backup(languageKey); - } - -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java index 895df2df58c..64d62a23326 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/platformlevel/PlatformLevel4.java @@ -45,7 +45,6 @@ import org.sonar.server.component.index.ComponentIndexer; import org.sonar.server.component.ws.ComponentsWsModule; import org.sonar.server.debt.DebtModelBackup; import org.sonar.server.debt.DebtModelPluginRepository; -import org.sonar.server.debt.DebtModelService; import org.sonar.server.debt.DebtModelXMLExporter; import org.sonar.server.debt.DebtRulesXMLImporter; import org.sonar.server.duplication.ws.DuplicationsJsonWriter; @@ -406,7 +405,6 @@ public class PlatformLevel4 extends PlatformLevel { RemoveTagsAction.class, // technical debt - DebtModelService.class, DebtModelBackup.class, DebtModelPluginRepository.class, DebtModelXMLExporter.class, diff --git a/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelServiceTest.java deleted file mode 100644 index 98883a214b4..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/debt/DebtModelServiceTest.java +++ /dev/null @@ -1,72 +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.debt; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; - -import static org.mockito.Mockito.verify; - -@RunWith(MockitoJUnitRunner.class) -public class DebtModelServiceTest { - - @Mock - DebtModelBackup debtModelBackup; - - DebtModelService underTest; - - @Before - public void setUp() { - underTest = new DebtModelService(debtModelBackup); - } - - @Test - public void reset_model() { - underTest.reset(); - verify(debtModelBackup).reset(); - } - - @Test - public void restore_xml() { - underTest.restoreFromXml(""); - verify(debtModelBackup).restoreFromXml(""); - } - - @Test - public void restore_from_xml_and_language() { - underTest.restoreFromXmlAndLanguage("", "xoo"); - verify(debtModelBackup).restoreFromXml("", "xoo"); - } - - @Test - public void backup() { - underTest.backup(); - verify(debtModelBackup).backup(); - } - - @Test - public void backup_fom_language() { - underTest.backupFromLanguage("xoo"); - verify(debtModelBackup).backup("xoo"); - } -} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtCharacteristic.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtCharacteristic.java deleted file mode 100644 index 52d9cd48a6d..00000000000 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtCharacteristic.java +++ /dev/null @@ -1,44 +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.api.server.debt; - -import javax.annotation.CheckForNull; - -/** - * @since 4.3 - * @deprecated in 5.2. It will be dropped in version 6.0 (see https://jira.sonarsource.com/browse/SONAR-6393) - */ -@Deprecated -public interface DebtCharacteristic { - - /** - * Only used when a characteristic is disabled (id is -1 in dto) by the user. - */ - String NONE = "NONE"; - - String key(); - - String name(); - - @CheckForNull - Integer order(); - - boolean isSub(); -} diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtModel.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtModel.java deleted file mode 100644 index 392916a17fa..00000000000 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/debt/DebtModel.java +++ /dev/null @@ -1,52 +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.api.server.debt; - -import java.util.List; -import javax.annotation.CheckForNull; -import org.sonar.api.ce.ComputeEngineSide; -import org.sonar.api.server.ServerSide; - -/** - * @since 4.3 - * @deprecated in 5.2. It will be dropped in version 6.0 (see https://jira.sonarsource.com/browse/SONAR-6393) - */ -@ServerSide -@ComputeEngineSide -@Deprecated -public interface DebtModel { - - /** - * @return an empty list since 5.5. - */ - List allCharacteristics(); - - /** - * @return an empty list since 5.5. - */ - List characteristics(); - - /** - * @return null since 5.5. - */ - @CheckForNull - DebtCharacteristic characteristicByKey(String key); - -} -- 2.39.5