diff options
Diffstat (limited to 'server/sonar-ce')
4 files changed, 1 insertions, 196 deletions
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 fe78a50fff3..64bd491940b 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 @@ -45,7 +45,6 @@ import org.sonar.ce.StandaloneCeDistributedInformation; import org.sonar.ce.analysis.cache.cleaning.AnalysisCacheCleaningModule; import org.sonar.ce.async.SynchronousAsyncExecution; import org.sonar.ce.cleaning.CeCleaningModule; -import org.sonar.ce.db.ReadOnlyPropertiesDao; import org.sonar.ce.issue.index.NoAsyncIssueIndexing; import org.sonar.ce.logging.CeProcessLogging; import org.sonar.ce.monitoring.CEQueueStatusImpl; @@ -67,6 +66,7 @@ import org.sonar.core.documentation.DefaultDocumentationLinkGenerator; import org.sonar.core.extension.CoreExtensionRepositoryImpl; import org.sonar.core.extension.CoreExtensionsLoader; import org.sonar.core.language.LanguagesProvider; +import org.sonar.core.metric.SoftwareQualitiesMetrics; import org.sonar.core.platform.Container; import org.sonar.core.platform.EditionProvider; import org.sonar.core.platform.PlatformEditionProvider; @@ -109,7 +109,6 @@ import org.sonar.server.l18n.ServerI18n; import org.sonar.server.log.ServerLogging; import org.sonar.server.measure.index.ProjectMeasuresIndexer; import org.sonar.server.metric.IssueCountMetrics; -import org.sonar.core.metric.SoftwareQualitiesMetrics; import org.sonar.server.metric.UnanalyzedLanguageMetrics; import org.sonar.server.notification.DefaultNotificationManager; import org.sonar.server.notification.NotificationService; @@ -295,7 +294,6 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer { // DB new DaoModule(), - ReadOnlyPropertiesDao.class, DBSessionsImpl.class, DbClient.class, @@ -325,9 +323,6 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer { DatabaseSettingsEnabler.class, UrlSettings.class, - // add ReadOnlyPropertiesDao at level2 again so that it shadows PropertiesDao - ReadOnlyPropertiesDao.class, - // plugins PluginClassloaderFactory.class, CePluginJarExploder.class, 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 deleted file mode 100644 index a640e847b3e..00000000000 --- a/server/sonar-ce/src/main/java/org/sonar/ce/db/ReadOnlyPropertiesDao.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2024 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.ce.db; - -import javax.annotation.Nullable; -import org.sonar.api.utils.System2; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.DbSession; -import org.sonar.db.MyBatis; -import org.sonar.db.audit.NoOpAuditPersister; -import org.sonar.db.property.PropertiesDao; -import org.sonar.db.property.PropertyDto; - -/** - * Compute Engine specific override of {@link PropertiesDao} and {@link org.sonar.db.property.PropertiesDao} which - * implements no write method (ie. insert/update/delete) because updating the Properties is the Web Server responsibility - * alone. - * <p> - * This ugly trick is required because licensed plugin bundle {@link com.sonarsource.license.api.internal.ServerLicenseVerifierImpl} - * which update license properties by calling {@link PropertiesDao} directly and this can not be disabled. - * </p> - */ -public class ReadOnlyPropertiesDao extends PropertiesDao { - public ReadOnlyPropertiesDao(MyBatis mybatis, System2 system2, UuidFactory uuidFactory) { - super(mybatis, system2, uuidFactory, new NoOpAuditPersister()); - } - - @Override - public void saveProperty(DbSession session, PropertyDto property, @Nullable String userLogin, - @Nullable String projectKey, @Nullable String projectName, @Nullable String qualifier) { - // do nothing - } - - @Override - public void saveProperty(PropertyDto property) { - // do nothing - } - - @Override - public void deleteProjectProperty(DbSession session, String key, String projectUuid, String projectKey, - String projectName, String qualifier) { - // do nothing - } - - @Override - public void deleteGlobalProperty(String key, DbSession session) { - // do nothing - } - - @Override - public void renamePropertyKey(String oldKey, String newKey) { - // do nothing - } - -} diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/db/package-info.java b/server/sonar-ce/src/main/java/org/sonar/ce/db/package-info.java deleted file mode 100644 index 4f8609c03e7..00000000000 --- a/server/sonar-ce/src/main/java/org/sonar/ce/db/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2024 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.ce.db; - -import javax.annotation.ParametersAreNonnullByDefault; 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 deleted file mode 100644 index ef0cb062c1f..00000000000 --- a/server/sonar-ce/src/test/java/org/sonar/ce/db/ReadOnlyPropertiesDaoTest.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2024 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.ce.db; - -import org.junit.Test; -import org.sonar.api.utils.System2; -import org.sonar.core.util.SequenceUuidFactory; -import org.sonar.core.util.UuidFactory; -import org.sonar.db.DbSession; -import org.sonar.db.MyBatis; -import org.sonar.db.property.PropertyDto; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verifyNoMoreInteractions; - -public class ReadOnlyPropertiesDaoTest { - private MyBatis myBatis = mock(MyBatis.class); - private DbSession dbSession = mock(DbSession.class); - private PropertyDto propertyDto = mock(PropertyDto.class); - private PropertyDto oldPropertyDto = mock(PropertyDto.class); - private UuidFactory uuidFactory = new SequenceUuidFactory(); - private ReadOnlyPropertiesDao underTest = new ReadOnlyPropertiesDao(myBatis, System2.INSTANCE, uuidFactory); - - @Test - public void insertProperty() { - underTest.saveProperty(dbSession, propertyDto, null, null, null, null); - - assertNoInteraction(); - } - - @Test - public void insertProperty1() { - underTest.saveProperty(propertyDto); - - assertNoInteraction(); - } - - @Test - public void deleteProjectProperty() { - underTest.deleteProjectProperty(null, null, null, null, null, null); - - assertNoInteraction(); - - } - - @Test - public void deleteProjectProperty1() { - underTest.deleteProjectProperty(dbSession, null, null, null, null, null); - - assertNoInteraction(); - - } - - @Test - public void deleteGlobalProperty() { - underTest.deleteGlobalProperty(null, dbSession); - - assertNoInteraction(); - } - - @Test - public void renamePropertyKey() { - underTest.renamePropertyKey(null, null); - - assertNoInteraction(); - } - - @Test - public void saveProperty() { - underTest.saveProperty(oldPropertyDto); - - assertNoInteraction(); - } - - private void assertNoInteraction() { - verifyNoMoreInteractions(myBatis, dbSession, propertyDto); - } -} |