It's useless that DbClient return a ReadOnlyPropertiesDao, and it prevent any CE task to update a property
import org.sonar.api.utils.Durations;
import org.sonar.api.utils.System2;
import org.sonar.api.utils.UriReader;
-import org.sonar.ce.db.CeDbClient;
import org.sonar.ce.db.ReadOnlyPropertiesDao;
import org.sonar.ce.es.EsIndexerEnabler;
import org.sonar.ce.platform.ComputeEngineExtensionInstaller;
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.permission.PermissionRepository;
import org.sonar.db.purge.PurgeProfiler;
DaoModule.class,
// DbClient.class, replaced by CeDbClient to use ReadOnlyPropertiesDao instead of PropertiesDao
ReadOnlyPropertiesDao.class,
- CeDbClient.class,
+ DbClient.class,
// MigrationStepModule.class, DB maintenance, responsibility of Web Server
// Elasticsearch
+++ /dev/null
-/*
- * 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.ce.db;
-
-import java.util.Map;
-import org.sonar.db.Dao;
-import org.sonar.db.Database;
-import org.sonar.db.DbClient;
-import org.sonar.db.MyBatis;
-import org.sonar.db.property.PropertiesDao;
-
-public class CeDbClient extends DbClient {
- private ReadOnlyPropertiesDao readOnlyPropertiesDao;
-
- public CeDbClient(Database database, MyBatis myBatis, Dao... daos) {
- super(database, myBatis, daos);
- }
-
- @Override
- protected void doOnLoad(Map<Class, Dao> daoByClass) {
- this.readOnlyPropertiesDao = getDao(daoByClass, ReadOnlyPropertiesDao.class);
- }
-
- @Override
- public PropertiesDao propertiesDao() {
- return this.readOnlyPropertiesDao;
- }
-}
+++ /dev/null
-/*
- * 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.ce.db;
-
-import org.junit.Test;
-import org.sonar.db.Dao;
-import org.sonar.db.Database;
-import org.sonar.db.DbClient;
-import org.sonar.db.MyBatis;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-
-public class CeDbClientTest {
- private Database database = mock(Database.class);
- private MyBatis myBatis = mock(MyBatis.class);
- private ReadOnlyPropertiesDao readOnlyPropertiesDao = new ReadOnlyPropertiesDao(myBatis);
-
- private DbClient underTest = new CeDbClient(database, myBatis, (Dao) readOnlyPropertiesDao);
-
- @Test
- public void getPropertiesDao_returns_ReadOnlyPropertiesDao() {
- assertThat(underTest.propertiesDao()).isSameAs(readOnlyPropertiesDao);
- }
-}
import org.sonar.ce.settings.SettingsLoader;
import org.sonar.core.issue.tracking.Tracker;
import org.sonar.core.platform.ContainerPopulator;
-import org.sonar.db.property.PropertiesDao;
import org.sonar.plugin.ce.ReportAnalysisComponentProvider;
import org.sonar.server.computation.analysis.AnalysisMetadataHolderImpl;
import org.sonar.server.computation.batch.BatchReportDirectoryHolderImpl;
MetricModule.class,
- // We need to add PropertiesDao here because otherwise we only have access to ReadOnlyPropertiesDao
- PropertiesDao.class,
-
// holders
AnalysisMetadataHolderImpl.class,
CrossProjectDuplicationStatusHolderImpl.class,