From 8cd57ce8858b6229246c2a96dff5daf5bf0050fc Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Lesaint?= Date: Wed, 24 May 2017 16:31:10 +0200 Subject: [PATCH] SONAR-9028 remove any support to table authors from code --- .../ComputeEngineContainerImplTest.java | 2 +- .../java/org/sonar/db/version/SqTables.java | 1 - .../src/main/java/org/sonar/db/DaoModule.java | 2 - .../src/main/java/org/sonar/db/DbClient.java | 7 -- .../src/main/java/org/sonar/db/MyBatis.java | 4 - .../org/sonar/db/purge/PurgeCommands.java | 5 - .../java/org/sonar/db/purge/PurgeMapper.java | 2 - .../java/org/sonar/db/user/AuthorDao.java | 61 ------------ .../java/org/sonar/db/user/AuthorDto.java | 80 --------------- .../java/org/sonar/db/user/AuthorMapper.java | 38 -------- .../org/sonar/db/purge/PurgeMapper.xml | 9 -- .../org/sonar/db/user/AuthorMapper.xml | 33 ------- .../test/java/org/sonar/db/DaoModuleTest.java | 2 +- .../org/sonar/db/purge/PurgeCommandsTest.java | 2 - .../java/org/sonar/db/user/AuthorDaoTest.java | 97 ------------------- .../shouldDeleteResource.xml | 10 -- .../add_missing_module_uuid_path-result.xml | 29 ------ .../add_missing_module_uuid_path.xml | 2 - .../AuthorDaoTest/countDeveloperLogins.xml | 7 -- .../shouldInsertAuthor-result.xml | 8 -- .../user/AuthorDaoTest/shouldInsertAuthor.xml | 2 - .../shouldInsertAuthorAndDeveloper-result.xml | 15 --- .../shouldInsertAuthorAndDeveloper.xml | 2 - ...AuthorsAndDevelopersDuplication-result.xml | 18 ---- ...PreventAuthorsAndDevelopersDuplication.xml | 18 ---- ...shouldPreventAuthorsDuplication-result.xml | 5 - .../shouldPreventAuthorsDuplication.xml | 5 - .../AuthorDaoTest/shouldSelectByLogin.xml | 8 -- .../sonar/server/platform/BackendCleanup.java | 1 - 29 files changed, 2 insertions(+), 473 deletions(-) delete mode 100644 server/sonar-db-dao/src/main/java/org/sonar/db/user/AuthorDao.java delete mode 100644 server/sonar-db-dao/src/main/java/org/sonar/db/user/AuthorDto.java delete mode 100644 server/sonar-db-dao/src/main/java/org/sonar/db/user/AuthorMapper.java delete mode 100644 server/sonar-db-dao/src/main/resources/org/sonar/db/user/AuthorMapper.xml delete mode 100644 server/sonar-db-dao/src/test/java/org/sonar/db/user/AuthorDaoTest.java delete mode 100644 server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/add_missing_module_uuid_path-result.xml delete mode 100644 server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/add_missing_module_uuid_path.xml delete mode 100644 server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/countDeveloperLogins.xml delete mode 100644 server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldInsertAuthor-result.xml delete mode 100644 server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldInsertAuthor.xml delete mode 100644 server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldInsertAuthorAndDeveloper-result.xml delete mode 100644 server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldInsertAuthorAndDeveloper.xml delete mode 100644 server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsAndDevelopersDuplication-result.xml delete mode 100644 server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsAndDevelopersDuplication.xml delete mode 100644 server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsDuplication-result.xml delete mode 100644 server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsDuplication.xml delete mode 100644 server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldSelectByLogin.xml diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java index 1e4445ed39f..889499f0354 100644 --- a/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java +++ b/server/sonar-ce/src/test/java/org/sonar/ce/container/ComputeEngineContainerImplTest.java @@ -135,7 +135,7 @@ public class ComputeEngineContainerImplTest { assertThat(picoContainer.getParent().getParent().getParent().getComponentAdapters()).hasSize( COMPONENTS_IN_LEVEL_1_AT_CONSTRUCTION + 23 // level 1 - + 46 // content of DaoModule + + 45 // content of DaoModule + 3 // content of EsSearchModule + 56 // content of CorePropertyDefinitions ); diff --git a/server/sonar-db-core/src/main/java/org/sonar/db/version/SqTables.java b/server/sonar-db-core/src/main/java/org/sonar/db/version/SqTables.java index 6bfd1a9a592..b3be68dc6c6 100644 --- a/server/sonar-db-core/src/main/java/org/sonar/db/version/SqTables.java +++ b/server/sonar-db-core/src/main/java/org/sonar/db/version/SqTables.java @@ -48,7 +48,6 @@ public final class SqTables { public static final Set TABLES = ImmutableSet.of( "active_rules", "active_rule_parameters", - "authors", "ce_activity", "ce_queue", "ce_task_input", diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java b/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java index 17e164dfd1d..d94eb8ef217 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/DaoModule.java @@ -60,7 +60,6 @@ import org.sonar.db.rule.RuleDao; import org.sonar.db.rule.RuleRepositoryDao; import org.sonar.db.schemamigration.SchemaMigrationDao; import org.sonar.db.source.FileSourceDao; -import org.sonar.db.user.AuthorDao; import org.sonar.db.user.GroupDao; import org.sonar.db.user.GroupMembershipDao; import org.sonar.db.user.RoleDao; @@ -75,7 +74,6 @@ public class DaoModule extends Module { // for readability and easier merge, keep list ordered alphabetically // ===================================================================== ActiveRuleDao.class, - AuthorDao.class, AuthorizationDao.class, CeActivityDao.class, CeQueueDao.class, diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java b/server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java index c36d7934c0b..b88fc81baf5 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/DbClient.java @@ -59,7 +59,6 @@ import org.sonar.db.rule.RuleDao; import org.sonar.db.rule.RuleRepositoryDao; import org.sonar.db.schemamigration.SchemaMigrationDao; import org.sonar.db.source.FileSourceDao; -import org.sonar.db.user.AuthorDao; import org.sonar.db.user.GroupDao; import org.sonar.db.user.GroupMembershipDao; import org.sonar.db.user.RoleDao; @@ -100,7 +99,6 @@ public class DbClient { private final CeTaskInputDao ceTaskInputDao; private final CeScannerContextDao ceScannerContextDao; private final FileSourceDao fileSourceDao; - private final AuthorDao authorDao; private final ComponentLinkDao componentLinkDao; private final EventDao eventDao; private final PurgeDao purgeDao; @@ -155,7 +153,6 @@ public class DbClient { ceTaskInputDao = getDao(map, CeTaskInputDao.class); ceScannerContextDao = getDao(map, CeScannerContextDao.class); fileSourceDao = getDao(map, FileSourceDao.class); - authorDao = getDao(map, AuthorDao.class); componentLinkDao = getDao(map, ComponentLinkDao.class); eventDao = getDao(map, EventDao.class); purgeDao = getDao(map, PurgeDao.class); @@ -295,10 +292,6 @@ public class DbClient { return fileSourceDao; } - public AuthorDao authorDao() { - return authorDao; - } - public ComponentLinkDao componentLinkDao() { return componentLinkDao; } diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java b/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java index e60a2dede42..0b847ed1d7d 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/MyBatis.java @@ -105,8 +105,6 @@ import org.sonar.db.rule.RuleRepositoryMapper; import org.sonar.db.schemamigration.SchemaMigrationDto; import org.sonar.db.schemamigration.SchemaMigrationMapper; import org.sonar.db.source.FileSourceMapper; -import org.sonar.db.user.AuthorDto; -import org.sonar.db.user.AuthorMapper; import org.sonar.db.user.GroupDto; import org.sonar.db.user.GroupMapper; import org.sonar.db.user.GroupMembershipDto; @@ -139,7 +137,6 @@ public class MyBatis implements Startable { // DTO aliases, keep them sorted alphabetically confBuilder.loadAlias("ActiveRule", ActiveRuleDto.class); confBuilder.loadAlias("ActiveRuleParam", ActiveRuleParamDto.class); - confBuilder.loadAlias("Author", AuthorDto.class); confBuilder.loadAlias("Component", ComponentDto.class); confBuilder.loadAlias("ComponentLink", ComponentLinkDto.class); confBuilder.loadAlias("ComponentWithSnapshot", ComponentDtoWithSnapshotId.class); @@ -190,7 +187,6 @@ public class MyBatis implements Startable { // keep them sorted alphabetically Class[] mappers = { ActiveRuleMapper.class, - AuthorMapper.class, AuthorizationMapper.class, CeActivityMapper.class, CeQueueMapper.class, diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeCommands.java b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeCommands.java index 8c25c7fc219..a2abbe53182 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeCommands.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeCommands.java @@ -113,11 +113,6 @@ class PurgeCommands { componentUuidsPartitions.forEach(purgeMapper::deleteComponents); session.commit(); profiler.stop(); - - profiler.start("deleteAuthors (authors)"); - componentIdPartitions.forEach(purgeMapper::deleteAuthors); - session.commit(); - profiler.stop(); } public void deleteComponentMeasures(List analysisUuids, List componentUuids) { diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeMapper.java index d9fa8209e7c..08ec08c0a16 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeMapper.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeMapper.java @@ -64,8 +64,6 @@ public interface PurgeMapper { void deleteComponentEvents(@Param("componentUuids") List componentUuids); - void deleteAuthors(@Param("resourceIds") List resourceIds); - List selectPurgeableAnalysesWithEvents(@Param("componentUuid") String componentUuid); List selectPurgeableAnalysesWithoutEvents(@Param("componentUuid") String componentUuid); diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/user/AuthorDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/user/AuthorDao.java deleted file mode 100644 index 3063127d210..00000000000 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/user/AuthorDao.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.db.user; - -import java.util.Collection; -import java.util.Date; -import java.util.List; -import org.sonar.db.Dao; -import org.sonar.db.DbSession; - -import static org.sonar.db.DatabaseUtils.executeLargeInputs; - -/** - * Be careful when updating this class because it's used by the Dev Cockpit plugin. - */ -public class AuthorDao implements Dao { - - public AuthorDto selectByLogin(DbSession session, String login) { - return getMapper(session).selectByLogin(login); - } - - public int countDeveloperLogins(DbSession session, long developerId) { - return getMapper(session).countDeveloperLogins(developerId); - } - - public void insertAuthor(DbSession session, String login, long personId) { - Date now = new Date(); - AuthorDto authorDto = new AuthorDto() - .setLogin(login) - .setPersonId(personId) - .setCreatedAt(now) - .setUpdatedAt(now); - - getMapper(session).insert(authorDto); - } - - public List selectScmAccountsByDeveloperUuids(final DbSession session, Collection developerUuids) { - return executeLargeInputs(developerUuids, getMapper(session)::selectScmAccountsByDeveloperUuids); - } - - private static AuthorMapper getMapper(DbSession session) { - return session.getMapper(AuthorMapper.class); - } -} diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/user/AuthorDto.java b/server/sonar-db-dao/src/main/java/org/sonar/db/user/AuthorDto.java deleted file mode 100644 index 00b93c40a64..00000000000 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/user/AuthorDto.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.db.user; - -import java.util.Date; - -/** - * @since 3.0 - */ -public final class AuthorDto { - - private Long id; - private Long personId; - private String login; - private Date createdAt; - private Date updatedAt; - - public Long getId() { - return id; - } - - public AuthorDto setId(Long id) { - this.id = id; - return this; - } - - public Long getPersonId() { - return personId; - } - - public AuthorDto setPersonId(Long personId) { - this.personId = personId; - return this; - } - - public String getLogin() { - return login; - } - - public AuthorDto setLogin(String login) { - this.login = login; - return this; - } - - public Date getCreatedAt() { - return createdAt;// NOSONAR May expose internal representation by returning reference to mutable object - } - - public AuthorDto setCreatedAt(Date createdAt) { - this.createdAt = createdAt;// NOSONAR May expose internal representation by incorporating reference to mutable object - return this; - } - - public Date getUpdatedAt() { - return updatedAt;// NOSONAR May expose internal representation by returning reference to mutable object - } - - public AuthorDto setUpdatedAt(Date updatedAt) { - this.updatedAt = updatedAt;// NOSONAR May expose internal representation by incorporating reference to mutable object - return this; - } - -} diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/user/AuthorMapper.java b/server/sonar-db-dao/src/main/java/org/sonar/db/user/AuthorMapper.java deleted file mode 100644 index 63321fc7687..00000000000 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/user/AuthorMapper.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.db.user; - -import java.util.Collection; -import java.util.List; -import org.apache.ibatis.annotations.Param; - -/** - * @since 3.0 - */ -public interface AuthorMapper { - - AuthorDto selectByLogin(String login); - - void insert(AuthorDto authorDto); - - int countDeveloperLogins(long developerId); - - List selectScmAccountsByDeveloperUuids(@Param("uuids") Collection uuids); -} diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml index b36aeb52638..67eec7c0f76 100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/purge/PurgeMapper.xml @@ -212,15 +212,6 @@ - - delete from authors - where - person_id in - - #{resourceId} - - - delete from issue_changes ic where exists (select * from issues i where i.kee=ic.issue_key and i.component_uuid in diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/user/AuthorMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/user/AuthorMapper.xml deleted file mode 100644 index 39e13226f0f..00000000000 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/user/AuthorMapper.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - INSERT INTO authors (person_id, login, created_at, updated_at) - VALUES (#{personId}, #{login}, - #{createdAt}, #{updatedAt}) - - - - diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/DaoModuleTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/DaoModuleTest.java index 4e2c7cb812e..914622cfd1e 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/DaoModuleTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/DaoModuleTest.java @@ -29,6 +29,6 @@ public class DaoModuleTest { public void verify_count_of_added_components() { ComponentContainer container = new ComponentContainer(); new DaoModule().configure(container); - assertThat(container.size()).isEqualTo(2 + 46); + assertThat(container.size()).isEqualTo(2 + 45); } } diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeCommandsTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeCommandsTest.java index 82db2b299a5..656a69f9cb4 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeCommandsTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeCommandsTest.java @@ -88,7 +88,6 @@ public class PurgeCommandsTest { assertThat(dbTester.countRowsOfTable("events")).isEqualTo(2); assertThat(dbTester.countRowsOfTable("issues")).isZero(); assertThat(dbTester.countRowsOfTable("issue_changes")).isZero(); - assertThat(dbTester.countRowsOfTable("authors")).isZero(); } @@ -104,7 +103,6 @@ public class PurgeCommandsTest { assertThat(dbTester.countRowsOfTable("events")).isEqualTo(0); assertThat(dbTester.countRowsOfTable("issues")).isEqualTo(1); assertThat(dbTester.countRowsOfTable("issue_changes")).isEqualTo(1); - assertThat(dbTester.countRowsOfTable("authors")).isEqualTo(2); } /** diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/AuthorDaoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/user/AuthorDaoTest.java deleted file mode 100644 index 553ce7ca7fe..00000000000 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/user/AuthorDaoTest.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 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.db.user; - -import org.junit.After; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.api.utils.System2; -import org.sonar.db.DbSession; -import org.sonar.db.DbTester; - -import static org.assertj.core.api.Assertions.assertThat; - - -public class AuthorDaoTest { - - @Rule - public DbTester dbTester = DbTester.create(System2.INSTANCE); - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - DbSession dbSession = dbTester.getSession(); - AuthorDao dao = dbTester.getDbClient().authorDao(); - - @After - public void tearDown() throws Exception { - dbSession.close(); - } - - @Test - public void shouldSelectByLogin() { - dbTester.prepareDbUnit(getClass(), "shouldSelectByLogin.xml"); - dbSession.commit(); - - AuthorDto authorDto = dao.selectByLogin(dbSession, "godin"); - assertThat(authorDto.getId()).isEqualTo(1L); - assertThat(authorDto.getPersonId()).isEqualTo(13L); - assertThat(authorDto.getLogin()).isEqualTo("godin"); - - assertThat(dao.selectByLogin(dbSession, "simon")).isNull(); - } - - @Test - public void shouldInsertAuthor() { - dbTester.prepareDbUnit(getClass(), "shouldInsertAuthor.xml"); - dbSession.commit(); - - dao.insertAuthor(dbSession, "godin", 13L); - dbSession.commit(); - - dbTester.assertDbUnit(getClass(), "shouldInsertAuthor-result.xml", new String[] {"created_at", "updated_at"}, "authors"); - } - - @Test - public void countDeveloperLogins() { - dbTester.prepareDbUnit(getClass(), "countDeveloperLogins.xml"); - dbSession.commit(); - - assertThat(dao.countDeveloperLogins(dbSession, 1L)).isEqualTo(2); - assertThat(dao.countDeveloperLogins(dbSession, 98765L)).isEqualTo(0); - } - - @Test - public void shouldPreventAuthorsDuplication() { - dbTester.prepareDbUnit(getClass(), "shouldPreventAuthorsDuplication.xml"); - dbSession.commit(); - - expectedException.expect(RuntimeException.class); - - try { - dao.insertAuthor(dbSession, "godin", 20L); - } catch (RuntimeException ex) { - dbSession.commit(); - dbTester.assertDbUnit(getClass(), "shouldPreventAuthorsDuplication-result.xml", new String[] {"created_at", "updated_at"}, "authors"); - throw ex; - } - } - -} diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeCommandsTest/shouldDeleteResource.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeCommandsTest/shouldDeleteResource.xml index 6bc921f26ee..1a269703e3c 100644 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeCommandsTest/shouldDeleteResource.xml +++ b/server/sonar-db-dao/src/test/resources/org/sonar/db/purge/PurgeCommandsTest/shouldDeleteResource.xml @@ -105,14 +105,4 @@ change_type="comment" change_data="this is a comment"/> - - diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/add_missing_module_uuid_path-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/add_missing_module_uuid_path-result.xml deleted file mode 100644 index fb7d71381e9..00000000000 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/add_missing_module_uuid_path-result.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/add_missing_module_uuid_path.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/add_missing_module_uuid_path.xml deleted file mode 100644 index fb0854fccbe..00000000000 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/add_missing_module_uuid_path.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/countDeveloperLogins.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/countDeveloperLogins.xml deleted file mode 100644 index 42776255866..00000000000 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/countDeveloperLogins.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldInsertAuthor-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldInsertAuthor-result.xml deleted file mode 100644 index 40e855c7588..00000000000 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldInsertAuthor-result.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldInsertAuthor.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldInsertAuthor.xml deleted file mode 100644 index fb0854fccbe..00000000000 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldInsertAuthor.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldInsertAuthorAndDeveloper-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldInsertAuthorAndDeveloper-result.xml deleted file mode 100644 index 70b0c58d48b..00000000000 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldInsertAuthorAndDeveloper-result.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldInsertAuthorAndDeveloper.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldInsertAuthorAndDeveloper.xml deleted file mode 100644 index fb0854fccbe..00000000000 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldInsertAuthorAndDeveloper.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsAndDevelopersDuplication-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsAndDevelopersDuplication-result.xml deleted file mode 100644 index dfd6673d49f..00000000000 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsAndDevelopersDuplication-result.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsAndDevelopersDuplication.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsAndDevelopersDuplication.xml deleted file mode 100644 index dfd6673d49f..00000000000 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsAndDevelopersDuplication.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsDuplication-result.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsDuplication-result.xml deleted file mode 100644 index 8203f8edbc2..00000000000 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsDuplication-result.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsDuplication.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsDuplication.xml deleted file mode 100644 index 8203f8edbc2..00000000000 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsDuplication.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldSelectByLogin.xml b/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldSelectByLogin.xml deleted file mode 100644 index 40e855c7588..00000000000 --- a/server/sonar-db-dao/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldSelectByLogin.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java b/server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java index 6cf963f55f4..d465a9a8ba5 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java +++ b/server/sonar-server/src/main/java/org/sonar/server/platform/BackendCleanup.java @@ -47,7 +47,6 @@ import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery; public class BackendCleanup { private static final String[] ANALYSIS_TABLES = { - "authors", "ce_activity", "ce_queue", "ce_task_input", "ce_scanner_context", "duplications_index", "events", "issues", "issue_changes", "manual_measures", "notifications", "project_links", "project_measures", "projects", -- 2.39.5