From 828d3fded1f6dcc521a28c2ee3170efcb451332e Mon Sep 17 00:00:00 2001 From: Lukasz Jarocki Date: Fri, 10 Mar 2023 09:42:50 +0100 Subject: [PATCH] SONAR-18679 refactored sonar-db-core and sonar-db-dao to match testing strategy --- server/sonar-db-core/build.gradle | 11 + .../java/org/sonar/db/DatabaseUtilsTest.java | 394 +++++++++--------- .../org/sonar/db/ResultSetIteratorTest.java | 0 .../org/sonar/db/DatabaseUtilsTest/sql.sql | 0 .../sonar/db/ResultSetIteratorTest/schema.sql | 0 server/sonar-db-dao/build.gradle | 11 + .../java/org/sonar/db/DatabaseMBeanTest.java | 0 .../java/org/sonar/db/IsAliveMapperTest.java | 4 +- .../java/org/sonar/db/MyBatisTest.java | 0 .../org/sonar/db/SQDatabaseForH2Test.java | 0 .../org/sonar/db/alm/pat/AlmPatDaoTest.java | 0 .../alm/pat/AlmPatDaoWithPersisterTest.java | 0 .../db/alm/setting/AlmSettingDaoTest.java | 0 .../AlmSettingDaoWithPersisterTest.java | 0 .../alm/setting/ProjectAlmSettingDaoTest.java | 0 ...ProjectAlmSettingDaoWithPersisterTest.java | 1 - .../java/org/sonar/db/audit/AuditDaoTest.java | 0 .../org/sonar/db/ce/CeActivityDaoTest.java | 0 .../java/org/sonar/db/ce/CeQueueDaoTest.java | 0 .../sonar/db/ce/CeScannerContextDaoTest.java | 0 .../db/ce/CeTaskCharacteristicDaoTest.java | 0 .../org/sonar/db/ce/CeTaskInputDaoTest.java | 0 .../org/sonar/db/ce/CeTaskMessageDaoTest.java | 0 .../component/AnalysisPropertiesDaoTest.java | 0 .../component/ApplicationProjectsDaoTest.java | 0 .../org/sonar/db/component/BranchDaoTest.java | 0 .../sonar/db/component/ComponentDaoTest.java | 0 .../component/ComponentKeyUpdaterDaoTest.java | 0 .../db/component/ProjectLinkDaoTest.java | 0 .../ScrollForFileMoveComponentDaoTest.java | 0 .../sonar/db/component/SnapshotDaoTest.java | 0 .../db/duplication/DuplicationDaoTest.java | 3 +- .../java/org/sonar/db/es/EsQueueDaoTest.java | 0 .../db/event/EventComponentChangeDaoTest.java | 0 .../java/org/sonar/db/event/EventDaoTest.java | 1 - .../sonar/db/issue/IssueChangeDaoTest.java | 0 .../sonar/db/issue/IssueChangeMapperTest.java | 0 .../java/org/sonar/db/issue/IssueDaoTest.java | 0 .../org/sonar/db/issue/IssueMapperTest.java | 0 .../db/mapping/ProjectMappingsDaoTest.java | 0 .../sonar/db/measure/LiveMeasureDaoTest.java | 0 .../org/sonar/db/measure/MeasureDaoTest.java | 0 .../db/measure/MeasureTreeQueryTest.java | 0 .../ProjectMeasuresIndexerIteratorTest.java | 0 .../org/sonar/db/metric/MetricDaoTest.java | 0 .../newcodeperiod/NewCodePeriodDaoTest.java | 0 .../NotificationQueueDaoTest.java | 0 .../db/permission/AuthorizationDaoTest.java | 0 .../db/permission/GroupPermissionDaoTest.java | 0 .../GroupPermissionDaoWithPersisterTest.java | 0 .../db/permission/UserPermissionDaoTest.java | 0 .../UserPermissionDaoWithPersisterTest.java | 0 .../GroupWithPermissionTemplateDaoTest.java | 0 ...rmissionTemplateCharacteristicDaoTest.java | 0 ...ateCharacteristicDaoWithPersisterTest.java | 0 .../template/PermissionTemplateDaoTest.java | 0 ...ermissionTemplateDaoWithPersisterTest.java | 0 .../UserWithPermissionTemplateDaoTest.java | 0 .../org/sonar/db/plugin/PluginDaoTest.java | 0 .../db/plugin/PluginDaoWithPersisterTest.java | 0 .../sonar/db/portfolio/PortfolioDaoTest.java | 0 .../db/project/ProjectBadgeTokenDaoTest.java | 0 .../org/sonar/db/project/ProjectDaoTest.java | 0 .../InternalComponentPropertiesDaoTest.java | 0 .../property/InternalPropertiesDaoTest.java | 0 .../sonar/db/property/PropertiesDaoTest.java | 0 .../PropertiesDaoWithPersisterTest.java | 0 .../org/sonar/db/property/PropertiesRow.java | 0 .../db/property/PropertiesRowAssert.java | 0 .../org/sonar/db/purge/PurgeCommandsTest.java | 0 .../java/org/sonar/db/purge/PurgeDaoTest.java | 0 .../sonar/db/purge/PurgeDaoWithAuditTest.java | 0 .../org/sonar/db/purge/PurgeMapperTest.java | 0 .../sonar/db/pushevent/PushEventDaoTest.java | 0 .../ProjectQgateAssociationDaoTest.java | 0 .../QualityGateConditionDaoTest.java | 0 .../db/qualitygate/QualityGateDaoTest.java | 0 .../QualityGateGroupPermissionsDaoTest.java | 0 .../QualityGateUserPermissionsDaoTest.java | 0 .../db/qualityprofile/ActiveRuleDaoTest.java | 0 .../DefaultQProfileDaoTest.java | 0 .../qualityprofile/QProfileChangeDaoTest.java | 0 .../QProfileEditGroupsDaoTest.java | 0 .../QProfileEditUsersDaoTest.java | 0 .../qualityprofile/QualityProfileDaoTest.java | 0 .../QualityProfileExportDaoTest.java | 0 .../db/report/RegulatoryReportDaoTest.java | 0 .../java/org/sonar/db/rule/RuleDaoTest.java | 0 .../sonar/db/rule/RuleRepositoryDaoTest.java | 0 .../ScannerAnalysisCacheDaoTest.java | 0 .../SchemaMigrationDaoTest.java | 0 .../org/sonar/db/scim/ScimUserDaoTest.java | 0 .../sonar/db/source/FileSourceDaoTest.java | 0 .../java/org/sonar/db/user/GroupDaoTest.java | 0 .../db/user/GroupDaoWithPersisterTest.java | 0 .../sonar/db/user/GroupMembershipDaoTest.java | 0 .../java/org/sonar/db/user/RoleDaoTest.java | 0 .../sonar/db/user/SamlMessageIdDaoTest.java | 0 .../sonar/db/user/SessionTokensDaoTest.java | 0 .../java/org/sonar/db/user/UserDaoTest.java | 0 .../db/user/UserDaoWithPersisterTest.java | 0 .../db/user/UserDismissedMessagesDaoTest.java | 0 .../org/sonar/db/user/UserGroupDaoTest.java | 0 .../user/UserGroupDaoWithPersisterTest.java | 0 .../org/sonar/db/user/UserTokenDaoTest.java | 0 .../user/UserTokenDaoWithPersisterTest.java | 0 .../org/sonar/db/webhook/WebhookDaoTest.java | 0 .../webhook/WebhookDaoWithPersisterTest.java | 0 .../db/webhook/WebhookDeliveryDaoTest.java | 0 .../DefaultModelFinderTest/shared.xml | 0 .../update_authorization_date-result.xml | 0 .../update_authorization_date.xml | 0 .../sonar/db/issue/IssueDaoTest/shared.xml | 0 .../should_select_issue_and_component_ids.xml | 0 ...uld_select_non_closed_issues_by_module.xml | 0 ...ed_issues_by_module_on_removed_project.xml | 0 .../should_select_assignees.xml | 0 .../sonar/db/measure/MeasureDaoTest/empty.xml | 0 .../measure/MeasureDaoTest/insert-result.xml | 0 .../measure/MeasureDaoTest/past_measures.xml | 0 .../select_by_snapshot_and_metric_keys.xml | 0 .../db/measure/MeasureDaoTest/shared.xml | 0 ...return_root_project_keys_for_anonymous.xml | 0 ...uld_return_root_project_keys_for_group.xml | 0 ...ould_return_root_project_keys_for_user.xml | 0 .../java/org/sonar/db/PaginationTest.java | 1 + .../qualityprofile/QProfileChangeDtoTest.java | 3 +- 127 files changed, 232 insertions(+), 197 deletions(-) rename server/sonar-db-core/src/{test => it}/java/org/sonar/db/DatabaseUtilsTest.java (63%) rename server/sonar-db-core/src/{test => it}/java/org/sonar/db/ResultSetIteratorTest.java (100%) rename server/sonar-db-core/src/{test => it}/resources/org/sonar/db/DatabaseUtilsTest/sql.sql (100%) rename server/sonar-db-core/src/{test => it}/resources/org/sonar/db/ResultSetIteratorTest/schema.sql (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/DatabaseMBeanTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/IsAliveMapperTest.java (95%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/MyBatisTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/SQDatabaseForH2Test.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/alm/pat/AlmPatDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/alm/pat/AlmPatDaoWithPersisterTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/alm/setting/AlmSettingDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/alm/setting/AlmSettingDaoWithPersisterTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/alm/setting/ProjectAlmSettingDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/alm/setting/ProjectAlmSettingDaoWithPersisterTest.java (99%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/audit/AuditDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/ce/CeActivityDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/ce/CeQueueDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/ce/CeScannerContextDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/ce/CeTaskCharacteristicDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/ce/CeTaskInputDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/ce/CeTaskMessageDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/component/AnalysisPropertiesDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/component/ApplicationProjectsDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/component/BranchDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/component/ComponentDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/component/ComponentKeyUpdaterDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/component/ProjectLinkDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/component/ScrollForFileMoveComponentDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/component/SnapshotDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/duplication/DuplicationDaoTest.java (98%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/es/EsQueueDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/event/EventComponentChangeDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/event/EventDaoTest.java (99%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/issue/IssueChangeDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/issue/IssueChangeMapperTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/issue/IssueDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/issue/IssueMapperTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/mapping/ProjectMappingsDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/measure/LiveMeasureDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/measure/MeasureDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/measure/MeasureTreeQueryTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/measure/ProjectMeasuresIndexerIteratorTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/metric/MetricDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/newcodeperiod/NewCodePeriodDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/notification/NotificationQueueDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/permission/AuthorizationDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/permission/GroupPermissionDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/permission/GroupPermissionDaoWithPersisterTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/permission/UserPermissionDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/permission/UserPermissionDaoWithPersisterTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/permission/template/GroupWithPermissionTemplateDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/permission/template/PermissionTemplateCharacteristicDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/permission/template/PermissionTemplateCharacteristicDaoWithPersisterTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/permission/template/PermissionTemplateDaoWithPersisterTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/permission/template/UserWithPermissionTemplateDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/plugin/PluginDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/plugin/PluginDaoWithPersisterTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/portfolio/PortfolioDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/project/ProjectBadgeTokenDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/project/ProjectDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/property/InternalComponentPropertiesDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/property/InternalPropertiesDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/property/PropertiesDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/property/PropertiesDaoWithPersisterTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/property/PropertiesRow.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/property/PropertiesRowAssert.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/purge/PurgeCommandsTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/purge/PurgeDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/purge/PurgeDaoWithAuditTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/purge/PurgeMapperTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/pushevent/PushEventDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/qualitygate/ProjectQgateAssociationDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/qualitygate/QualityGateConditionDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/qualitygate/QualityGateDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/qualitygate/QualityGateGroupPermissionsDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/qualitygate/QualityGateUserPermissionsDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/qualityprofile/ActiveRuleDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/qualityprofile/DefaultQProfileDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/qualityprofile/QProfileChangeDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/qualityprofile/QProfileEditGroupsDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/qualityprofile/QProfileEditUsersDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/qualityprofile/QualityProfileDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/qualityprofile/QualityProfileExportDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/report/RegulatoryReportDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/rule/RuleDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/rule/RuleRepositoryDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/scannercache/ScannerAnalysisCacheDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/schemamigration/SchemaMigrationDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/scim/ScimUserDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/source/FileSourceDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/user/GroupDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/user/GroupDaoWithPersisterTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/user/GroupMembershipDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/user/RoleDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/user/SamlMessageIdDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/user/SessionTokensDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/user/UserDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/user/UserDaoWithPersisterTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/user/UserDismissedMessagesDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/user/UserGroupDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/user/UserGroupDaoWithPersisterTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/user/UserTokenDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/user/UserTokenDaoWithPersisterTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/webhook/WebhookDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/webhook/WebhookDaoWithPersisterTest.java (100%) rename server/sonar-db-dao/src/{test => it}/java/org/sonar/db/webhook/WebhookDeliveryDaoTest.java (100%) rename server/sonar-db-dao/src/{test => it}/resources/org/sonar/core/qualitymodel/DefaultModelFinderTest/shared.xml (100%) rename server/sonar-db-dao/src/{test => it}/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date-result.xml (100%) rename server/sonar-db-dao/src/{test => it}/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date.xml (100%) rename server/sonar-db-dao/src/{test => it}/resources/org/sonar/db/issue/IssueDaoTest/shared.xml (100%) rename server/sonar-db-dao/src/{test => it}/resources/org/sonar/db/issue/IssueDaoTest/should_select_issue_and_component_ids.xml (100%) rename server/sonar-db-dao/src/{test => it}/resources/org/sonar/db/issue/IssueDaoTest/should_select_non_closed_issues_by_module.xml (100%) rename server/sonar-db-dao/src/{test => it}/resources/org/sonar/db/issue/IssueDaoTest/should_select_non_closed_issues_by_module_on_removed_project.xml (100%) rename server/sonar-db-dao/src/{test => it}/resources/org/sonar/db/issue/IssueStatsDaoTest/should_select_assignees.xml (100%) rename server/sonar-db-dao/src/{test => it}/resources/org/sonar/db/measure/MeasureDaoTest/empty.xml (100%) rename server/sonar-db-dao/src/{test => it}/resources/org/sonar/db/measure/MeasureDaoTest/insert-result.xml (100%) rename server/sonar-db-dao/src/{test => it}/resources/org/sonar/db/measure/MeasureDaoTest/past_measures.xml (100%) rename server/sonar-db-dao/src/{test => it}/resources/org/sonar/db/measure/MeasureDaoTest/select_by_snapshot_and_metric_keys.xml (100%) rename server/sonar-db-dao/src/{test => it}/resources/org/sonar/db/measure/MeasureDaoTest/shared.xml (100%) rename server/sonar-db-dao/src/{test => it}/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_anonymous.xml (100%) rename server/sonar-db-dao/src/{test => it}/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_group.xml (100%) rename server/sonar-db-dao/src/{test => it}/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_user.xml (100%) diff --git a/server/sonar-db-core/build.gradle b/server/sonar-db-core/build.gradle index 5413fef01b0..6d3bad048e7 100644 --- a/server/sonar-db-core/build.gradle +++ b/server/sonar-db-core/build.gradle @@ -4,6 +4,17 @@ sonar { } } +sourceSets { + test { + resources { + srcDirs += ['src/it/resources'] + } + java{ + srcDirs += ['src/it/java'] + } + } +} + dependencies { // please keep the list grouped by configuration and ordered by name diff --git a/server/sonar-db-core/src/test/java/org/sonar/db/DatabaseUtilsTest.java b/server/sonar-db-core/src/it/java/org/sonar/db/DatabaseUtilsTest.java similarity index 63% rename from server/sonar-db-core/src/test/java/org/sonar/db/DatabaseUtilsTest.java rename to server/sonar-db-core/src/it/java/org/sonar/db/DatabaseUtilsTest.java index 344f7c1ad99..a69683aa2f7 100644 --- a/server/sonar-db-core/src/test/java/org/sonar/db/DatabaseUtilsTest.java +++ b/server/sonar-db-core/src/it/java/org/sonar/db/DatabaseUtilsTest.java @@ -19,7 +19,6 @@ */ package org.sonar.db; -import com.google.common.base.Function; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.PreparedStatement; @@ -33,6 +32,7 @@ import java.util.Locale; import java.util.Objects; import java.util.Optional; import java.util.Set; +import java.util.function.Function; import javax.annotation.Nullable; import org.junit.Rule; import org.junit.Test; @@ -42,8 +42,8 @@ import org.sonar.api.utils.log.Loggers; import org.sonar.core.util.stream.MoreCollectors; import org.sonar.db.dialect.Oracle; -import static com.google.common.collect.Lists.newArrayList; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.Assertions.fail; import static org.mockito.ArgumentMatchers.any; @@ -57,10 +57,18 @@ import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import static org.sonar.db.DatabaseUtils.ORACLE_DRIVER_NAME; +import static org.sonar.db.DatabaseUtils.checkThatNotTooManyConditions; +import static org.sonar.db.DatabaseUtils.closeQuietly; +import static org.sonar.db.DatabaseUtils.getDriver; +import static org.sonar.db.DatabaseUtils.log; +import static org.sonar.db.DatabaseUtils.tableColumnExists; +import static org.sonar.db.DatabaseUtils.tableExists; import static org.sonar.db.DatabaseUtils.toUniqueAndSortedList; public class DatabaseUtilsTest { + private static final String DEFAULT_SCHEMA = "public"; + private static final String SCHEMA_MIGRATIONS_TABLE = "SCHEMA_MIGRATIONS"; @Rule public CoreDbTester dbTester = CoreDbTester.createForSchema(DatabaseUtilsTest.class, "sql.sql", false); @@ -68,99 +76,95 @@ public class DatabaseUtilsTest { public LogTester logTester = new LogTester(); @Test - public void find_index_with_lower_case() throws SQLException { - String tableName = "SCHEMA_MIGRATIONS"; + public void findExistingIndex_whenTableBothInLowerAndUpperCase_shouldFindIndex() throws SQLException { String indexName = "lower_case_name"; try (Connection connection = dbTester.openConnection()) { - assertThat(DatabaseUtils.findExistingIndex(connection, tableName, indexName)).contains(indexName); - assertThat(DatabaseUtils.findExistingIndex(connection, tableName.toLowerCase(Locale.US), indexName)).contains(indexName); + assertThat(DatabaseUtils.findExistingIndex(connection, SCHEMA_MIGRATIONS_TABLE, indexName)).contains(indexName); + assertThat(DatabaseUtils.findExistingIndex(connection, SCHEMA_MIGRATIONS_TABLE.toLowerCase(Locale.US), indexName)).contains(indexName); } } @Test - public void find_index_with_upper_case() throws SQLException { - String tableName = "SCHEMA_MIGRATIONS"; + public void findExistingIndex_whenMixedCasesInTableAndIndexName_shouldFindIndex() throws SQLException { String indexName = "UPPER_CASE_NAME"; try (Connection connection = dbTester.openConnection()) { - assertThat(DatabaseUtils.findExistingIndex(connection, tableName, indexName)).contains(indexName); - assertThat(DatabaseUtils.findExistingIndex(connection, tableName, indexName.toLowerCase(Locale.US))).contains(indexName); - assertThat(DatabaseUtils.findExistingIndex(connection, tableName.toLowerCase(Locale.US), indexName.toLowerCase(Locale.US))).contains(indexName); + assertThat(DatabaseUtils.findExistingIndex(connection, SCHEMA_MIGRATIONS_TABLE, indexName)).contains(indexName); + assertThat(DatabaseUtils.findExistingIndex(connection, SCHEMA_MIGRATIONS_TABLE, indexName.toLowerCase(Locale.US))).contains(indexName); + assertThat(DatabaseUtils.findExistingIndex(connection, SCHEMA_MIGRATIONS_TABLE.toLowerCase(Locale.US), indexName.toLowerCase(Locale.US))).contains(indexName); } } @Test - public void find_index_with_special_name() throws SQLException { - String tableName = "SCHEMA_MIGRATIONS"; + public void findExistingIndex_whenPassingOnlyPartOfIndexName_shouldFindIndexAndReturnFullName() throws SQLException { String indexName = "INDEX_NAME"; try (Connection connection = dbTester.openConnection()) { - assertThat(DatabaseUtils.findExistingIndex(connection, tableName, indexName)).contains("idx_1234_index_name"); - assertThat(DatabaseUtils.findExistingIndex(connection, tableName.toLowerCase(Locale.US), indexName)).contains("idx_1234_index_name"); - assertThat(DatabaseUtils.findExistingIndex(connection, tableName.toLowerCase(Locale.US), indexName.toLowerCase(Locale.US))).contains("idx_1234_index_name"); - assertThat(DatabaseUtils.findExistingIndex(connection, tableName, "index")).isEmpty(); - assertThat(DatabaseUtils.findExistingIndex(connection, tableName, "index_name_2")).isEmpty(); - assertThat(DatabaseUtils.findExistingIndex(connection, tableName, "index_name_")).isEmpty(); + assertThat(DatabaseUtils.findExistingIndex(connection, SCHEMA_MIGRATIONS_TABLE, indexName)).contains("idx_1234_index_name"); + assertThat(DatabaseUtils.findExistingIndex(connection, SCHEMA_MIGRATIONS_TABLE.toLowerCase(Locale.US), indexName)).contains("idx_1234_index_name"); + assertThat(DatabaseUtils.findExistingIndex(connection, SCHEMA_MIGRATIONS_TABLE.toLowerCase(Locale.US), indexName.toLowerCase(Locale.US))).contains("idx_1234_index_name"); + assertThat(DatabaseUtils.findExistingIndex(connection, SCHEMA_MIGRATIONS_TABLE, "index")).isEmpty(); + assertThat(DatabaseUtils.findExistingIndex(connection, SCHEMA_MIGRATIONS_TABLE, "index_name_2")).isEmpty(); + assertThat(DatabaseUtils.findExistingIndex(connection, SCHEMA_MIGRATIONS_TABLE, "index_name_")).isEmpty(); } } @Test - public void find_column_with_lower_case_table_name_and_upper_case_column_name() throws SQLException { + public void tableColumnExists_whenTableNameLowerCaseColumnUpperCase_shouldFindColumn() throws SQLException { String tableName = "tablea"; String columnName = "COLUMNA"; try (Connection connection = dbTester.openConnection()) { - assertThat(DatabaseUtils.tableColumnExists(connection, tableName, columnName)).isTrue(); + assertThat(tableColumnExists(connection, tableName, columnName)).isTrue(); } } @Test - public void find_column_with_upper_case_table_name_and_upper_case_column_name() throws SQLException { + public void tableColumnExists_whenArgumentInUpperCase_shouldFindColumn() throws SQLException { String tableName = "TABLEA"; String columnName = "COLUMNA"; try (Connection connection = dbTester.openConnection()) { - assertThat(DatabaseUtils.tableColumnExists(connection, tableName, columnName)).isTrue(); + assertThat(tableColumnExists(connection, tableName, columnName)).isTrue(); } } @Test - public void find_column_with_lower_case_table_name_and_lower_case_column_name() throws SQLException { + public void tableColumnExists_whenArgumentsInLowerCase_shouldFindColumn() throws SQLException { String tableName = "tablea"; String columnName = "columna"; try (Connection connection = dbTester.openConnection()) { - assertThat(DatabaseUtils.tableColumnExists(connection, tableName, columnName)).isTrue(); + assertThat(tableColumnExists(connection, tableName, columnName)).isTrue(); } } @Test - public void find_column_with_upper_case_table_name_and_lower_case_column_name() throws SQLException { + public void tableColumnExists_whenTableNameInUpperCaseAndColumnInLowerCase_shouldFindColumn() throws SQLException { String tableName = "TABLEA"; String columnName = "columna"; try (Connection connection = dbTester.openConnection()) { - assertThat(DatabaseUtils.tableColumnExists(connection, tableName, columnName)).isTrue(); + assertThat(tableColumnExists(connection, tableName, columnName)).isTrue(); } } @Test - public void should_close_connection() throws Exception { + public void closeQuietly_shouldCloseConnection() throws SQLException { try (Connection connection = dbTester.openConnection()) { assertThat(isClosed(connection)).isFalse(); - DatabaseUtils.closeQuietly(connection); + closeQuietly(connection); assertThat(isClosed(connection)).isTrue(); } } @Test - public void should_support_null_connection() { - DatabaseUtils.closeQuietly((Connection) null); - // no failure + public void closeQuietly_shouldNotFailOnNullArgument() { + assertThatCode(() -> closeQuietly((Connection) null)).doesNotThrowAnyException(); } @Test - public void should_close_statement_and_resultset() throws Exception { + public void closeQuietly_whenStatementAndResultSetOpen_shouldCloseBoth() throws SQLException { try (Connection connection = dbTester.openConnection(); PreparedStatement statement = connection.prepareStatement(selectDual())) { ResultSet rs = statement.executeQuery(); - DatabaseUtils.closeQuietly(rs); - DatabaseUtils.closeQuietly(statement); + closeQuietly(rs); + closeQuietly(statement); assertThat(isClosed(statement)).isTrue(); assertThat(isClosed(rs)).isTrue(); @@ -168,72 +172,72 @@ public class DatabaseUtilsTest { } @Test - public void should_not_fail_on_connection_errors() throws SQLException { + public void closeQuietly_whenConnectionThrowsException_shouldNotThrowException() throws SQLException { Connection connection = mock(Connection.class); doThrow(new SQLException()).when(connection).close(); - DatabaseUtils.closeQuietly(connection); + closeQuietly(connection); // no failure verify(connection).close(); // just to be sure } @Test - public void should_not_fail_on_statement_errors() throws SQLException { + public void closeQuietly_whenStatementThrowsException_shouldNotThrowException() throws SQLException { Statement statement = mock(Statement.class); doThrow(new SQLException()).when(statement).close(); - DatabaseUtils.closeQuietly(statement); + closeQuietly(statement); // no failure verify(statement).close(); // just to be sure } @Test - public void should_not_fail_on_resulset_errors() throws SQLException { + public void closeQuietly_whenResultSetThrowsException_shouldNotThrowException() throws SQLException { ResultSet rs = mock(ResultSet.class); doThrow(new SQLException()).when(rs).close(); - DatabaseUtils.closeQuietly(rs); + closeQuietly(rs); // no failure verify(rs).close(); // just to be sure } @Test - public void toUniqueAndSortedList_throws_NPE_if_arg_is_null() { + public void toUniqueAndSortedList_whenNullPassed_shouldThrowNullPointerException() { assertThatThrownBy(() -> toUniqueAndSortedList(null)) .isInstanceOf(NullPointerException.class); } @Test - public void toUniqueAndSortedList_throws_NPE_if_arg_contains_a_null() { + public void toUniqueAndSortedList_whenNullPassedInsideTheList_shouldThrowNullPointerException() { assertThatThrownBy(() -> toUniqueAndSortedList(List.of("A", null, "C"))) .isInstanceOf(NullPointerException.class); } @Test - public void toUniqueAndSortedList_throws_NPE_if_arg_is_a_set_containing_a_null() { + public void toUniqueAndSortedList_whenNullPassedInsideTheSet_shouldThrowNullPointerException() { assertThatThrownBy(() -> toUniqueAndSortedList(Set.of("A", null, "C"))) .isInstanceOf(NullPointerException.class); } @Test - public void toUniqueAndSortedList_enforces_natural_order() { + public void toUniqueAndSortedList_shouldEnforceNaturalOrder() { assertThat(toUniqueAndSortedList(List.of("A", "B", "C"))).containsExactly("A", "B", "C"); assertThat(toUniqueAndSortedList(List.of("B", "A", "C"))).containsExactly("A", "B", "C"); assertThat(toUniqueAndSortedList(List.of("B", "C", "A"))).containsExactly("A", "B", "C"); } @Test - public void toUniqueAndSortedList_removes_duplicates() { + public void toUniqueAndSortedList_shouldRemoveDuplicates() { assertThat(toUniqueAndSortedList(List.of("A", "A", "A"))).containsExactly("A"); assertThat(toUniqueAndSortedList(List.of("A", "C", "A"))).containsExactly("A", "C"); assertThat(toUniqueAndSortedList(List.of("C", "C", "B", "B", "A", "N", "C", "A"))).containsExactly("A", "B", "C", "N"); } @Test - public void toUniqueAndSortedList_removes_duplicates_and_apply_natural_order_of_any_Comparable() { + public void toUniqueAndSortedList_shouldRemoveDuplicatesAndEnforceNaturalOrder() { assertThat( toUniqueAndSortedList(List.of(myComparable(2), myComparable(5), myComparable(2), myComparable(4), myComparable(-1), myComparable(10)))) .containsExactly( @@ -241,71 +245,217 @@ public class DatabaseUtilsTest { } @Test - public void can_not_determine_database_driver() throws SQLException { + public void getDriver_whenIssuesWithDriver_shouldLeaveAMessageInTheLogs() throws SQLException { Connection connection = mock(Connection.class); DatabaseMetaData metaData = mock(DatabaseMetaData.class); when(connection.getMetaData()).thenReturn(metaData); when(metaData.getDriverName()).thenThrow(new SQLException()); - DatabaseUtils.getDriver(connection); + + getDriver(connection); + assertThat(logTester.logs(LoggerLevel.WARN)).contains("Fail to determine database driver."); } @Test - public void result_set_throw_exception() throws SQLException { + public void findExistingIndex_whenResultSetThrowsException_shouldThrowExceptionToo() throws SQLException { String indexName = "idx"; String schema = "TEST-SONAR"; ResultSet resultSet = mock(ResultSet.class); when(resultSet.next()).thenThrow(new SQLException()); + assertThatThrownBy(() -> findExistingIndex(indexName, schema, resultSet, true)) .isInstanceOf(IllegalStateException.class) .hasMessage("Can not check that table test_table exists"); } @Test - public void find_existing_index_on_oracle_double_quoted_schema() throws SQLException { + public void findExistingIndex_whenExistingIndexOnOracleDoubleQuotedSchema_shouldReturnIndex() throws SQLException { String indexName = "idx"; String schema = "TEST-SONAR"; ResultSet resultSet = newResultSet(true, indexName, schema); + Optional foundIndex = findExistingIndex(indexName, schema, resultSet, true); + assertThat(foundIndex).hasValue(indexName); } @Test - public void find_existing_index_on_oracle_standard_schema() throws SQLException { + public void findExistingIndex_whenExistingIndexOnDefaultSchema_shouldReturnIndex() throws SQLException { String indexName = "idx"; String schema = DEFAULT_SCHEMA; ResultSet resultSet = newResultSet(true, indexName, schema); + Optional foundIndex = findExistingIndex(indexName, schema, resultSet, true); + assertThat(foundIndex).hasValue(indexName); } @Test - public void no_existing_index_on_oracle_double_quoted_schema() throws SQLException { + public void findExistingIndex_whenNoExistingIndexOnOracleDoubleQuotedSchema_shouldNotReturnIndex() throws SQLException { String indexName = "idx"; String schema = "TEST-SONAR"; ResultSet resultSet = newResultSet(false, null, null); + Optional foundIndex = findExistingIndex(indexName, schema, resultSet, true); + assertThat(foundIndex).isEmpty(); } @Test - public void no_matching_index_on_oracle_double_quoted_schema() throws SQLException { + public void findExistingIndex_whenNoMatchingIndexOnOracleDoubleQuotedSchema_shouldNotReturnIndex() throws SQLException { String indexName = "idx"; String schema = "TEST-SONAR"; ResultSet resultSet = newResultSet(true, "different", "different"); + Optional foundIndex = findExistingIndex(indexName, schema, resultSet, true); + assertThat(foundIndex).isEmpty(); } @Test - public void find_existing_index_on_default_schema() throws SQLException { + public void findExistingIndex_whenExistingIndexAndSchemaPassed_shouldFindIndex() throws SQLException { String indexName = "idx"; String schema = DEFAULT_SCHEMA; ResultSet resultSet = newResultSet(true, indexName, schema); + Optional foundIndex = findExistingIndex(indexName, schema, resultSet, false); + assertThat(foundIndex).hasValue(indexName); } + @Test + public void executeLargeInputs_whenALotOfElementsPassed_shouldProcessAllItems() { + List inputs = new ArrayList<>(); + List expectedOutputs = new ArrayList<>(); + for (int i = 0; i < 2010; i++) { + inputs.add(i); + expectedOutputs.add(Integer.toString(i)); + } + + List outputs = DatabaseUtils.executeLargeInputs(inputs, input -> { + // Check that each partition is only done on 1000 elements max + assertThat(input).hasSizeLessThanOrEqualTo(1000); + return input.stream().map(String::valueOf).collect(MoreCollectors.toList()); + }); + + assertThat(outputs).isEqualTo(expectedOutputs); + } + + @Test + public void executeLargeInputsWithFunctionAsInput_whenEmptyList_shouldReturnEmpty() { + List outputs = DatabaseUtils.executeLargeInputs(Collections.emptyList(), (Function, List>) input -> { + fail("No partition should be made on empty list"); + return Collections.emptyList(); + }); + + assertThat(outputs).isEmpty(); + } + + @Test + public void executeLargeUpdates_whenEmptyList_shouldFail() { + DatabaseUtils.executeLargeUpdates(Collections.emptyList(), input -> fail("No partition should be made on empty list")); + } + + @Test + public void executeLargeInputs_whenPartitionSizeIsCustom_shouldParitionAccordingly() { + List> partitions = new ArrayList<>(); + List outputs = DatabaseUtils.executeLargeInputs( + List.of(1, 2, 3), + partition -> { + partitions.add(partition); + return partition; + }, + i -> i / 500); + + assertThat(outputs).containsExactly(1, 2, 3); + assertThat(partitions).containsExactly(List.of(1, 2), List.of(3)); + } + + @Test + public void executeLargeUpdates_whenALotOfElementsPassed_shouldProcessAllItems() { + List inputs = new ArrayList<>(); + for (int i = 0; i < 2010; i++) { + inputs.add(i); + } + + List processed = new ArrayList<>(); + DatabaseUtils.executeLargeUpdates(inputs, input -> { + assertThat(input).hasSizeLessThanOrEqualTo(1000); + processed.addAll(input); + }); + assertThat(processed).containsExactlyElementsOf(inputs); + } + + @Test + public void logging_whenSomeExceptionThrown_shouldContainThemInTheLog() { + SQLException root = new SQLException("this is root", "123"); + SQLException next = new SQLException("this is next", "456"); + root.setNextException(next); + + log(Loggers.get(getClass()), root); + + assertThat(logTester.logs(LoggerLevel.ERROR)).contains("SQL error: 456. Message: this is next"); + } + + @Test + public void tableExists_whenTableInTheMetadata_shouldReturnTrue() throws Exception { + try (Connection connection = dbTester.openConnection()) { + assertThat(tableExists("SCHEMA_MIGRATIONS", connection)).isTrue(); + assertThat(tableExists("schema_migrations", connection)).isTrue(); + assertThat(tableExists("schema_MIGRATIONS", connection)).isTrue(); + assertThat(tableExists("foo", connection)).isFalse(); + } + } + + @Test + public void tableExists_whenGetSchemaThrowException_shouldNotFail() throws Exception { + try (Connection connection = spy(dbTester.openConnection())) { + doThrow(AbstractMethodError.class).when(connection).getSchema(); + assertThat(tableExists("SCHEMA_MIGRATIONS", connection)).isTrue(); + assertThat(tableExists("schema_migrations", connection)).isTrue(); + assertThat(tableExists("schema_MIGRATIONS", connection)).isTrue(); + assertThat(tableExists("foo", connection)).isFalse(); + } + } + + @Test//is_using_getSchema_when_not_using_h2 + public void tableExists_whenNotUsingH2_shouldReturnTrue() throws Exception { + try (Connection connection = spy(dbTester.openConnection())) { + // DatabaseMetaData mock + DatabaseMetaData metaData = mock(DatabaseMetaData.class); + doReturn("xxx").when(metaData).getDriverName(); + + // ResultSet mock + ResultSet resultSet = mock(ResultSet.class); + doReturn(true, false).when(resultSet).next(); + doReturn(SCHEMA_MIGRATIONS_TABLE).when(resultSet).getString("TABLE_NAME"); + doReturn(resultSet).when(metaData).getTables(any(), eq("yyyy"), any(), any()); + + // Connection mock + doReturn("yyyy").when(connection).getSchema(); + doReturn(metaData).when(connection).getMetaData(); + + assertThat(tableExists(SCHEMA_MIGRATIONS_TABLE, connection)).isTrue(); + } + } + + @Test + public void checkThatNotTooManyConditions_whenLessThan1000Items_shouldNotThrowException() { + checkThatNotTooManyConditions(null, "unused"); + checkThatNotTooManyConditions(Collections.emptySet(), "unused"); + checkThatNotTooManyConditions(Collections.nCopies(10, "foo"), "unused"); + checkThatNotTooManyConditions(Collections.nCopies(1_000, "foo"), "unused"); + } + + @Test + public void checkThatNotTooManyConditions_whenMoreThan1000ItemsInTheList_shouldNotThrowException() { + List list = Collections.nCopies(1_001, "foo"); + assertThatThrownBy(() -> checkThatNotTooManyConditions(list, "the message")) + .isInstanceOf(IllegalArgumentException.class) + .hasMessage("the message"); + } + + private Optional findExistingIndex(String indexName, String schema, ResultSet resultSet, boolean isOracle) throws SQLException { Connection connection = mock(Connection.class); @@ -408,138 +558,4 @@ public class DatabaseUtilsTest { return sql; } - @Test - public void executeLargeInputs() { - List inputs = newArrayList(); - List expectedOutputs = newArrayList(); - for (int i = 0; i < 2010; i++) { - inputs.add(i); - expectedOutputs.add(Integer.toString(i)); - } - - List outputs = DatabaseUtils.executeLargeInputs(inputs, input -> { - // Check that each partition is only done on 1000 elements max - assertThat(input).hasSizeLessThanOrEqualTo(1000); - return input.stream().map(String::valueOf).collect(MoreCollectors.toList()); - }); - - assertThat(outputs).isEqualTo(expectedOutputs); - } - - @Test - public void executeLargeInputs_on_empty_list() { - List outputs = DatabaseUtils.executeLargeInputs(Collections.emptyList(), new Function, List>() { - @Override - public List apply(List input) { - fail("No partition should be made on empty list"); - return Collections.emptyList(); - } - }); - - assertThat(outputs).isEmpty(); - } - - @Test - public void executeLargeInputs_uses_specified_partition_size_manipulations() { - List> partitions = new ArrayList<>(); - List outputs = DatabaseUtils.executeLargeInputs( - List.of(1, 2, 3), - partition -> { - partitions.add(partition); - return partition; - }, - i -> i / 500); - - assertThat(outputs).containsExactly(1, 2, 3); - assertThat(partitions).containsExactly(List.of(1, 2), List.of(3)); - } - - @Test - public void executeLargeUpdates() { - List inputs = newArrayList(); - for (int i = 0; i < 2010; i++) { - inputs.add(i); - } - - List processed = newArrayList(); - DatabaseUtils.executeLargeUpdates(inputs, input -> { - assertThat(input).hasSizeLessThanOrEqualTo(1000); - processed.addAll(input); - }); - assertThat(processed).containsExactlyElementsOf(inputs); - } - - @Test - public void executeLargeUpdates_on_empty_list() { - DatabaseUtils.executeLargeUpdates(Collections.emptyList(), input -> fail("No partition should be made on empty list")); - } - - @Test - public void log_all_sql_exceptions() { - SQLException root = new SQLException("this is root", "123"); - SQLException next = new SQLException("this is next", "456"); - root.setNextException(next); - - DatabaseUtils.log(Loggers.get(getClass()), root); - - assertThat(logTester.logs(LoggerLevel.ERROR)).contains("SQL error: 456. Message: this is next"); - } - - @Test - public void tableExists_returns_true_if_table_is_referenced_in_db_metadata() throws Exception { - try (Connection connection = dbTester.openConnection()) { - assertThat(DatabaseUtils.tableExists("SCHEMA_MIGRATIONS", connection)).isTrue(); - assertThat(DatabaseUtils.tableExists("schema_migrations", connection)).isTrue(); - assertThat(DatabaseUtils.tableExists("schema_MIGRATIONS", connection)).isTrue(); - assertThat(DatabaseUtils.tableExists("foo", connection)).isFalse(); - } - } - - @Test - public void tableExists_is_resilient_on_getSchema() throws Exception { - try (Connection connection = spy(dbTester.openConnection())) { - doThrow(AbstractMethodError.class).when(connection).getSchema(); - assertThat(DatabaseUtils.tableExists("SCHEMA_MIGRATIONS", connection)).isTrue(); - assertThat(DatabaseUtils.tableExists("schema_migrations", connection)).isTrue(); - assertThat(DatabaseUtils.tableExists("schema_MIGRATIONS", connection)).isTrue(); - assertThat(DatabaseUtils.tableExists("foo", connection)).isFalse(); - } - } - - @Test - public void tableExists_is_using_getSchema_when_not_using_h2() throws Exception { - try (Connection connection = spy(dbTester.openConnection())) { - // DatabaseMetaData mock - DatabaseMetaData metaData = mock(DatabaseMetaData.class); - doReturn("xxx").when(metaData).getDriverName(); - - // ResultSet mock - ResultSet resultSet = mock(ResultSet.class); - doReturn(true, false).when(resultSet).next(); - doReturn("SCHEMA_MIGRATIONS").when(resultSet).getString(eq("TABLE_NAME")); - doReturn(resultSet).when(metaData).getTables(any(), eq("yyyy"), any(), any()); - - // Connection mock - doReturn("yyyy").when(connection).getSchema(); - doReturn(metaData).when(connection).getMetaData(); - - assertThat(DatabaseUtils.tableExists("SCHEMA_MIGRATIONS", connection)).isTrue(); - } - } - - @Test - public void checkThatNotTooManyConditions_does_not_fail_if_less_than_1000_conditions() { - DatabaseUtils.checkThatNotTooManyConditions(null, "unused"); - DatabaseUtils.checkThatNotTooManyConditions(Collections.emptySet(), "unused"); - DatabaseUtils.checkThatNotTooManyConditions(Collections.nCopies(10, "foo"), "unused"); - DatabaseUtils.checkThatNotTooManyConditions(Collections.nCopies(1_000, "foo"), "unused"); - } - - @Test - public void checkThatNotTooManyConditions_throws_IAE_if_strictly_more_than_1000_conditions() { - List list = Collections.nCopies(1_001, "foo"); - assertThatThrownBy(() -> DatabaseUtils.checkThatNotTooManyConditions(list, "the message")) - .isInstanceOf(IllegalArgumentException.class) - .hasMessage("the message"); - } } diff --git a/server/sonar-db-core/src/test/java/org/sonar/db/ResultSetIteratorTest.java b/server/sonar-db-core/src/it/java/org/sonar/db/ResultSetIteratorTest.java similarity index 100% rename from server/sonar-db-core/src/test/java/org/sonar/db/ResultSetIteratorTest.java rename to server/sonar-db-core/src/it/java/org/sonar/db/ResultSetIteratorTest.java diff --git a/server/sonar-db-core/src/test/resources/org/sonar/db/DatabaseUtilsTest/sql.sql b/server/sonar-db-core/src/it/resources/org/sonar/db/DatabaseUtilsTest/sql.sql similarity index 100% rename from server/sonar-db-core/src/test/resources/org/sonar/db/DatabaseUtilsTest/sql.sql rename to server/sonar-db-core/src/it/resources/org/sonar/db/DatabaseUtilsTest/sql.sql diff --git a/server/sonar-db-core/src/test/resources/org/sonar/db/ResultSetIteratorTest/schema.sql b/server/sonar-db-core/src/it/resources/org/sonar/db/ResultSetIteratorTest/schema.sql similarity index 100% rename from server/sonar-db-core/src/test/resources/org/sonar/db/ResultSetIteratorTest/schema.sql rename to server/sonar-db-core/src/it/resources/org/sonar/db/ResultSetIteratorTest/schema.sql diff --git a/server/sonar-db-dao/build.gradle b/server/sonar-db-dao/build.gradle index f4210fdc6d3..27d7e36d4b1 100644 --- a/server/sonar-db-dao/build.gradle +++ b/server/sonar-db-dao/build.gradle @@ -4,6 +4,16 @@ sonar { } } +sourceSets { + test { + resources { + srcDirs += ['src/it/resources'] + } + java{ + srcDirs += ['src/it/java'] + } + } +} dependencies { // please keep the list grouped by configuration and ordered by name @@ -53,6 +63,7 @@ task dumpSchema(type:JavaExec) { mainClass = 'org.sonar.db.dump.DumpSQSchema' classpath = sourceSets.test.runtimeClasspath } + tasks.check.dependsOn dumpSchema task createDB(type:JavaExec) { diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/DatabaseMBeanTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/DatabaseMBeanTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/DatabaseMBeanTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/DatabaseMBeanTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/IsAliveMapperTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/IsAliveMapperTest.java similarity index 95% rename from server/sonar-db-dao/src/test/java/org/sonar/db/IsAliveMapperTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/IsAliveMapperTest.java index a517c824c95..5e3682b0d66 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/IsAliveMapperTest.java +++ b/server/sonar-db-dao/src/it/java/org/sonar/db/IsAliveMapperTest.java @@ -31,8 +31,8 @@ public class IsAliveMapperTest { @Rule public DbTester dbTester = DbTester.create(System2.INSTANCE); - DbSession session; - IsAliveMapper underTest; + private DbSession session; + private IsAliveMapper underTest; @Before public void setUp() { diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/MyBatisTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/MyBatisTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/MyBatisTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/MyBatisTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/SQDatabaseForH2Test.java b/server/sonar-db-dao/src/it/java/org/sonar/db/SQDatabaseForH2Test.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/SQDatabaseForH2Test.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/SQDatabaseForH2Test.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/alm/pat/AlmPatDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/alm/pat/AlmPatDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/alm/pat/AlmPatDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/alm/pat/AlmPatDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/alm/pat/AlmPatDaoWithPersisterTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/alm/pat/AlmPatDaoWithPersisterTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/alm/pat/AlmPatDaoWithPersisterTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/alm/pat/AlmPatDaoWithPersisterTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/alm/setting/AlmSettingDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/alm/setting/AlmSettingDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/alm/setting/AlmSettingDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/alm/setting/AlmSettingDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/alm/setting/AlmSettingDaoWithPersisterTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/alm/setting/AlmSettingDaoWithPersisterTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/alm/setting/AlmSettingDaoWithPersisterTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/alm/setting/AlmSettingDaoWithPersisterTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/alm/setting/ProjectAlmSettingDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/alm/setting/ProjectAlmSettingDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/alm/setting/ProjectAlmSettingDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/alm/setting/ProjectAlmSettingDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/alm/setting/ProjectAlmSettingDaoWithPersisterTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/alm/setting/ProjectAlmSettingDaoWithPersisterTest.java similarity index 99% rename from server/sonar-db-dao/src/test/java/org/sonar/db/alm/setting/ProjectAlmSettingDaoWithPersisterTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/alm/setting/ProjectAlmSettingDaoWithPersisterTest.java index 131bfbd8ee6..163c3a3c821 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/alm/setting/ProjectAlmSettingDaoWithPersisterTest.java +++ b/server/sonar-db-dao/src/it/java/org/sonar/db/alm/setting/ProjectAlmSettingDaoWithPersisterTest.java @@ -43,7 +43,6 @@ import static org.sonar.db.almsettings.AlmSettingsTesting.newGithubProjectAlmSet public class ProjectAlmSettingDaoWithPersisterTest { private static final long A_DATE = 1_000_000_000_000L; private static final long A_DATE_LATER = 1_700_000_000_000L; - private static final String A_UUID = "SOME_UUID"; private final ArgumentCaptor newValueCaptor = ArgumentCaptor.forClass(DevOpsPlatformSettingNewValue.class); private final AuditPersister auditPersister = mock(AuditPersister.class); diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/audit/AuditDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/audit/AuditDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/audit/AuditDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/audit/AuditDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/ce/CeActivityDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/ce/CeActivityDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/ce/CeActivityDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/ce/CeActivityDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/ce/CeQueueDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/ce/CeQueueDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/ce/CeQueueDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/ce/CeQueueDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/ce/CeScannerContextDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/ce/CeScannerContextDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/ce/CeScannerContextDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/ce/CeScannerContextDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/ce/CeTaskCharacteristicDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/ce/CeTaskCharacteristicDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/ce/CeTaskCharacteristicDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/ce/CeTaskCharacteristicDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/ce/CeTaskInputDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/ce/CeTaskInputDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/ce/CeTaskInputDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/ce/CeTaskInputDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/ce/CeTaskMessageDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/ce/CeTaskMessageDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/ce/CeTaskMessageDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/ce/CeTaskMessageDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/AnalysisPropertiesDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/component/AnalysisPropertiesDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/component/AnalysisPropertiesDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/component/AnalysisPropertiesDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ApplicationProjectsDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/component/ApplicationProjectsDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/component/ApplicationProjectsDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/component/ApplicationProjectsDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/BranchDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/component/BranchDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/component/BranchDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/component/BranchDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/component/ComponentDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/component/ComponentDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentKeyUpdaterDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/component/ComponentKeyUpdaterDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/component/ComponentKeyUpdaterDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/component/ComponentKeyUpdaterDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ProjectLinkDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/component/ProjectLinkDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/component/ProjectLinkDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/component/ProjectLinkDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/ScrollForFileMoveComponentDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/component/ScrollForFileMoveComponentDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/component/ScrollForFileMoveComponentDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/component/ScrollForFileMoveComponentDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/component/SnapshotDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/component/SnapshotDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/component/SnapshotDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/component/SnapshotDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/duplication/DuplicationDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/duplication/DuplicationDaoTest.java similarity index 98% rename from server/sonar-db-dao/src/test/java/org/sonar/db/duplication/DuplicationDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/duplication/DuplicationDaoTest.java index 0102e902bcf..3d9b6f1c6b3 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/duplication/DuplicationDaoTest.java +++ b/server/sonar-db-dao/src/it/java/org/sonar/db/duplication/DuplicationDaoTest.java @@ -35,7 +35,6 @@ import org.sonar.db.component.ComponentDto; import org.sonar.db.component.ComponentTesting; import org.sonar.db.component.SnapshotDto; -import static com.google.common.collect.ImmutableList.of; import static java.util.Collections.singletonList; import static org.assertj.core.api.Assertions.tuple; import static org.sonar.db.component.ComponentTesting.newPrivateProjectDto; @@ -78,7 +77,7 @@ public class DuplicationDaoTest { assertThat(dao.selectCandidates(dbSession, newAnalysis.getUuid(), "donut", singletonList(hash))) .isEmpty(); } - for (List hashes : Arrays.asList(of("aa", "bb"), of("bb", "aa"), of("aa", "bb", "cc"))) { + for (List hashes : Arrays.asList(List.of("aa", "bb"), List.of("bb", "aa"), List.of("aa", "bb", "cc"))) { assertThat(dao.selectCandidates(dbSession, newAnalysis.getUuid(), "foo", hashes)) .containsOnly( tuple(fooFile.uuid(), fooFile.getKey(), lastAnalysis.getUuid(), "aa"), diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/es/EsQueueDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/es/EsQueueDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/es/EsQueueDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/es/EsQueueDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/event/EventComponentChangeDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/event/EventComponentChangeDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/event/EventComponentChangeDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/event/EventComponentChangeDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/event/EventDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/event/EventDaoTest.java similarity index 99% rename from server/sonar-db-dao/src/test/java/org/sonar/db/event/EventDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/event/EventDaoTest.java index 6c41d79d051..bd7c9d11b93 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/event/EventDaoTest.java +++ b/server/sonar-db-dao/src/it/java/org/sonar/db/event/EventDaoTest.java @@ -34,7 +34,6 @@ import org.sonar.db.component.ComponentTesting; import org.sonar.db.component.SnapshotDto; import static com.google.common.collect.Lists.newArrayList; -import static java.util.stream.Collectors.toList; import static org.assertj.core.api.Assertions.assertThat; import static org.sonar.db.component.SnapshotTesting.newAnalysis; import static org.sonar.db.event.EventTesting.newEvent; diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueChangeDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/issue/IssueChangeDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueChangeDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/issue/IssueChangeDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueChangeMapperTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/issue/IssueChangeMapperTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueChangeMapperTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/issue/IssueChangeMapperTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/issue/IssueDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/issue/IssueDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueMapperTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/issue/IssueMapperTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/issue/IssueMapperTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/issue/IssueMapperTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/mapping/ProjectMappingsDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/mapping/ProjectMappingsDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/mapping/ProjectMappingsDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/mapping/ProjectMappingsDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/measure/LiveMeasureDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/measure/LiveMeasureDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/measure/LiveMeasureDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/measure/LiveMeasureDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/measure/MeasureDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/measure/MeasureDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/measure/MeasureDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/measure/MeasureDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/measure/MeasureTreeQueryTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/measure/MeasureTreeQueryTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/measure/MeasureTreeQueryTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/measure/MeasureTreeQueryTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/measure/ProjectMeasuresIndexerIteratorTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/measure/ProjectMeasuresIndexerIteratorTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/measure/ProjectMeasuresIndexerIteratorTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/measure/ProjectMeasuresIndexerIteratorTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/metric/MetricDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/metric/MetricDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/metric/MetricDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/metric/MetricDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/newcodeperiod/NewCodePeriodDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/newcodeperiod/NewCodePeriodDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/newcodeperiod/NewCodePeriodDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/newcodeperiod/NewCodePeriodDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/notification/NotificationQueueDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/notification/NotificationQueueDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/notification/NotificationQueueDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/notification/NotificationQueueDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/permission/AuthorizationDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/permission/AuthorizationDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/permission/AuthorizationDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/GroupPermissionDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/permission/GroupPermissionDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/permission/GroupPermissionDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/permission/GroupPermissionDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/GroupPermissionDaoWithPersisterTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/permission/GroupPermissionDaoWithPersisterTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/permission/GroupPermissionDaoWithPersisterTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/permission/GroupPermissionDaoWithPersisterTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/UserPermissionDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/permission/UserPermissionDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/permission/UserPermissionDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/permission/UserPermissionDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/UserPermissionDaoWithPersisterTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/permission/UserPermissionDaoWithPersisterTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/permission/UserPermissionDaoWithPersisterTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/permission/UserPermissionDaoWithPersisterTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/GroupWithPermissionTemplateDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/permission/template/GroupWithPermissionTemplateDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/GroupWithPermissionTemplateDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/permission/template/GroupWithPermissionTemplateDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateCharacteristicDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/permission/template/PermissionTemplateCharacteristicDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateCharacteristicDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/permission/template/PermissionTemplateCharacteristicDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateCharacteristicDaoWithPersisterTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/permission/template/PermissionTemplateCharacteristicDaoWithPersisterTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateCharacteristicDaoWithPersisterTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/permission/template/PermissionTemplateCharacteristicDaoWithPersisterTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/permission/template/PermissionTemplateDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoWithPersisterTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/permission/template/PermissionTemplateDaoWithPersisterTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/PermissionTemplateDaoWithPersisterTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/permission/template/PermissionTemplateDaoWithPersisterTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/UserWithPermissionTemplateDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/permission/template/UserWithPermissionTemplateDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/permission/template/UserWithPermissionTemplateDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/permission/template/UserWithPermissionTemplateDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/plugin/PluginDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/plugin/PluginDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/plugin/PluginDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/plugin/PluginDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/plugin/PluginDaoWithPersisterTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/plugin/PluginDaoWithPersisterTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/plugin/PluginDaoWithPersisterTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/plugin/PluginDaoWithPersisterTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/portfolio/PortfolioDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/portfolio/PortfolioDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/portfolio/PortfolioDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/portfolio/PortfolioDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/project/ProjectBadgeTokenDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/project/ProjectBadgeTokenDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/project/ProjectBadgeTokenDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/project/ProjectBadgeTokenDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/project/ProjectDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/project/ProjectDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/project/ProjectDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/project/ProjectDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/property/InternalComponentPropertiesDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/property/InternalComponentPropertiesDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/property/InternalComponentPropertiesDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/property/InternalComponentPropertiesDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/property/InternalPropertiesDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/property/InternalPropertiesDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/property/InternalPropertiesDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/property/InternalPropertiesDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/property/PropertiesDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/property/PropertiesDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/property/PropertiesDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/property/PropertiesDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/property/PropertiesDaoWithPersisterTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/property/PropertiesDaoWithPersisterTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/property/PropertiesDaoWithPersisterTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/property/PropertiesDaoWithPersisterTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/property/PropertiesRow.java b/server/sonar-db-dao/src/it/java/org/sonar/db/property/PropertiesRow.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/property/PropertiesRow.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/property/PropertiesRow.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/property/PropertiesRowAssert.java b/server/sonar-db-dao/src/it/java/org/sonar/db/property/PropertiesRowAssert.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/property/PropertiesRowAssert.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/property/PropertiesRowAssert.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeCommandsTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/purge/PurgeCommandsTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeCommandsTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/purge/PurgeCommandsTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/purge/PurgeDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/purge/PurgeDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoWithAuditTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/purge/PurgeDaoWithAuditTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeDaoWithAuditTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/purge/PurgeDaoWithAuditTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeMapperTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/purge/PurgeMapperTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/purge/PurgeMapperTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/purge/PurgeMapperTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/pushevent/PushEventDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/pushevent/PushEventDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/pushevent/PushEventDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/pushevent/PushEventDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/qualitygate/ProjectQgateAssociationDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/qualitygate/ProjectQgateAssociationDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/qualitygate/ProjectQgateAssociationDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/qualitygate/ProjectQgateAssociationDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/qualitygate/QualityGateConditionDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/qualitygate/QualityGateConditionDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/qualitygate/QualityGateConditionDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/qualitygate/QualityGateConditionDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/qualitygate/QualityGateDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/qualitygate/QualityGateDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/qualitygate/QualityGateDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/qualitygate/QualityGateDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/qualitygate/QualityGateGroupPermissionsDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/qualitygate/QualityGateGroupPermissionsDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/qualitygate/QualityGateGroupPermissionsDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/qualitygate/QualityGateGroupPermissionsDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/qualitygate/QualityGateUserPermissionsDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/qualitygate/QualityGateUserPermissionsDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/qualitygate/QualityGateUserPermissionsDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/qualitygate/QualityGateUserPermissionsDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/ActiveRuleDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/qualityprofile/ActiveRuleDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/ActiveRuleDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/qualityprofile/ActiveRuleDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/DefaultQProfileDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/qualityprofile/DefaultQProfileDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/DefaultQProfileDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/qualityprofile/DefaultQProfileDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/qualityprofile/QProfileChangeDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/qualityprofile/QProfileChangeDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileEditGroupsDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/qualityprofile/QProfileEditGroupsDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileEditGroupsDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/qualityprofile/QProfileEditGroupsDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileEditUsersDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/qualityprofile/QProfileEditUsersDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileEditUsersDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/qualityprofile/QProfileEditUsersDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QualityProfileDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/qualityprofile/QualityProfileDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QualityProfileDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/qualityprofile/QualityProfileDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QualityProfileExportDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/qualityprofile/QualityProfileExportDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QualityProfileExportDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/qualityprofile/QualityProfileExportDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/report/RegulatoryReportDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/report/RegulatoryReportDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/report/RegulatoryReportDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/report/RegulatoryReportDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/rule/RuleDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/rule/RuleDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleRepositoryDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/rule/RuleRepositoryDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/rule/RuleRepositoryDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/rule/RuleRepositoryDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/scannercache/ScannerAnalysisCacheDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/scannercache/ScannerAnalysisCacheDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/scannercache/ScannerAnalysisCacheDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/scannercache/ScannerAnalysisCacheDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/schemamigration/SchemaMigrationDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/schemamigration/SchemaMigrationDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/schemamigration/SchemaMigrationDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/schemamigration/SchemaMigrationDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/scim/ScimUserDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/scim/ScimUserDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/scim/ScimUserDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/scim/ScimUserDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/source/FileSourceDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/source/FileSourceDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/source/FileSourceDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/source/FileSourceDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/GroupDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/user/GroupDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/user/GroupDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/user/GroupDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/GroupDaoWithPersisterTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/user/GroupDaoWithPersisterTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/user/GroupDaoWithPersisterTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/user/GroupDaoWithPersisterTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/GroupMembershipDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/user/GroupMembershipDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/user/GroupMembershipDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/user/GroupMembershipDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/RoleDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/user/RoleDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/user/RoleDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/user/RoleDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/SamlMessageIdDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/user/SamlMessageIdDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/user/SamlMessageIdDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/user/SamlMessageIdDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/SessionTokensDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/user/SessionTokensDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/user/SessionTokensDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/user/SessionTokensDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/user/UserDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/user/UserDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoWithPersisterTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/user/UserDaoWithPersisterTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDaoWithPersisterTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/user/UserDaoWithPersisterTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDismissedMessagesDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/user/UserDismissedMessagesDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/user/UserDismissedMessagesDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/user/UserDismissedMessagesDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserGroupDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/user/UserGroupDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/user/UserGroupDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/user/UserGroupDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserGroupDaoWithPersisterTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/user/UserGroupDaoWithPersisterTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/user/UserGroupDaoWithPersisterTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/user/UserGroupDaoWithPersisterTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserTokenDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/user/UserTokenDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/user/UserTokenDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/user/UserTokenDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/user/UserTokenDaoWithPersisterTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/user/UserTokenDaoWithPersisterTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/user/UserTokenDaoWithPersisterTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/user/UserTokenDaoWithPersisterTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/webhook/WebhookDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/webhook/WebhookDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/webhook/WebhookDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/webhook/WebhookDaoTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/webhook/WebhookDaoWithPersisterTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/webhook/WebhookDaoWithPersisterTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/webhook/WebhookDaoWithPersisterTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/webhook/WebhookDaoWithPersisterTest.java diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/webhook/WebhookDeliveryDaoTest.java b/server/sonar-db-dao/src/it/java/org/sonar/db/webhook/WebhookDeliveryDaoTest.java similarity index 100% rename from server/sonar-db-dao/src/test/java/org/sonar/db/webhook/WebhookDeliveryDaoTest.java rename to server/sonar-db-dao/src/it/java/org/sonar/db/webhook/WebhookDeliveryDaoTest.java diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/core/qualitymodel/DefaultModelFinderTest/shared.xml b/server/sonar-db-dao/src/it/resources/org/sonar/core/qualitymodel/DefaultModelFinderTest/shared.xml similarity index 100% rename from server/sonar-db-dao/src/test/resources/org/sonar/core/qualitymodel/DefaultModelFinderTest/shared.xml rename to server/sonar-db-dao/src/it/resources/org/sonar/core/qualitymodel/DefaultModelFinderTest/shared.xml diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date-result.xml b/server/sonar-db-dao/src/it/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date-result.xml similarity index 100% rename from server/sonar-db-dao/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date-result.xml rename to server/sonar-db-dao/src/it/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date-result.xml diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date.xml b/server/sonar-db-dao/src/it/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date.xml similarity index 100% rename from server/sonar-db-dao/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date.xml rename to server/sonar-db-dao/src/it/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date.xml diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/issue/IssueDaoTest/shared.xml b/server/sonar-db-dao/src/it/resources/org/sonar/db/issue/IssueDaoTest/shared.xml similarity index 100% rename from server/sonar-db-dao/src/test/resources/org/sonar/db/issue/IssueDaoTest/shared.xml rename to server/sonar-db-dao/src/it/resources/org/sonar/db/issue/IssueDaoTest/shared.xml diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/issue/IssueDaoTest/should_select_issue_and_component_ids.xml b/server/sonar-db-dao/src/it/resources/org/sonar/db/issue/IssueDaoTest/should_select_issue_and_component_ids.xml similarity index 100% rename from server/sonar-db-dao/src/test/resources/org/sonar/db/issue/IssueDaoTest/should_select_issue_and_component_ids.xml rename to server/sonar-db-dao/src/it/resources/org/sonar/db/issue/IssueDaoTest/should_select_issue_and_component_ids.xml diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/issue/IssueDaoTest/should_select_non_closed_issues_by_module.xml b/server/sonar-db-dao/src/it/resources/org/sonar/db/issue/IssueDaoTest/should_select_non_closed_issues_by_module.xml similarity index 100% rename from server/sonar-db-dao/src/test/resources/org/sonar/db/issue/IssueDaoTest/should_select_non_closed_issues_by_module.xml rename to server/sonar-db-dao/src/it/resources/org/sonar/db/issue/IssueDaoTest/should_select_non_closed_issues_by_module.xml diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/issue/IssueDaoTest/should_select_non_closed_issues_by_module_on_removed_project.xml b/server/sonar-db-dao/src/it/resources/org/sonar/db/issue/IssueDaoTest/should_select_non_closed_issues_by_module_on_removed_project.xml similarity index 100% rename from server/sonar-db-dao/src/test/resources/org/sonar/db/issue/IssueDaoTest/should_select_non_closed_issues_by_module_on_removed_project.xml rename to server/sonar-db-dao/src/it/resources/org/sonar/db/issue/IssueDaoTest/should_select_non_closed_issues_by_module_on_removed_project.xml diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/issue/IssueStatsDaoTest/should_select_assignees.xml b/server/sonar-db-dao/src/it/resources/org/sonar/db/issue/IssueStatsDaoTest/should_select_assignees.xml similarity index 100% rename from server/sonar-db-dao/src/test/resources/org/sonar/db/issue/IssueStatsDaoTest/should_select_assignees.xml rename to server/sonar-db-dao/src/it/resources/org/sonar/db/issue/IssueStatsDaoTest/should_select_assignees.xml diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/empty.xml b/server/sonar-db-dao/src/it/resources/org/sonar/db/measure/MeasureDaoTest/empty.xml similarity index 100% rename from server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/empty.xml rename to server/sonar-db-dao/src/it/resources/org/sonar/db/measure/MeasureDaoTest/empty.xml diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/insert-result.xml b/server/sonar-db-dao/src/it/resources/org/sonar/db/measure/MeasureDaoTest/insert-result.xml similarity index 100% rename from server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/insert-result.xml rename to server/sonar-db-dao/src/it/resources/org/sonar/db/measure/MeasureDaoTest/insert-result.xml diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/past_measures.xml b/server/sonar-db-dao/src/it/resources/org/sonar/db/measure/MeasureDaoTest/past_measures.xml similarity index 100% rename from server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/past_measures.xml rename to server/sonar-db-dao/src/it/resources/org/sonar/db/measure/MeasureDaoTest/past_measures.xml diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/select_by_snapshot_and_metric_keys.xml b/server/sonar-db-dao/src/it/resources/org/sonar/db/measure/MeasureDaoTest/select_by_snapshot_and_metric_keys.xml similarity index 100% rename from server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/select_by_snapshot_and_metric_keys.xml rename to server/sonar-db-dao/src/it/resources/org/sonar/db/measure/MeasureDaoTest/select_by_snapshot_and_metric_keys.xml diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/shared.xml b/server/sonar-db-dao/src/it/resources/org/sonar/db/measure/MeasureDaoTest/shared.xml similarity index 100% rename from server/sonar-db-dao/src/test/resources/org/sonar/db/measure/MeasureDaoTest/shared.xml rename to server/sonar-db-dao/src/it/resources/org/sonar/db/measure/MeasureDaoTest/shared.xml diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_anonymous.xml b/server/sonar-db-dao/src/it/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_anonymous.xml similarity index 100% rename from server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_anonymous.xml rename to server/sonar-db-dao/src/it/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_anonymous.xml diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_group.xml b/server/sonar-db-dao/src/it/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_group.xml similarity index 100% rename from server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_group.xml rename to server/sonar-db-dao/src/it/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_group.xml diff --git a/server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_user.xml b/server/sonar-db-dao/src/it/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_user.xml similarity index 100% rename from server/sonar-db-dao/src/test/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_user.xml rename to server/sonar-db-dao/src/it/resources/org/sonar/db/permission/AuthorizationDaoTest/should_return_root_project_keys_for_user.xml diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/PaginationTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/PaginationTest.java index e59bc7f7c47..5f85d87c18b 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/PaginationTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/PaginationTest.java @@ -25,6 +25,7 @@ import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.sonar.db.Pagination.forPage; + public class PaginationTest { @Test diff --git a/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDtoTest.java b/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDtoTest.java index f0efd3bb21a..daf7368e68e 100644 --- a/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDtoTest.java +++ b/server/sonar-db-dao/src/test/java/org/sonar/db/qualityprofile/QProfileChangeDtoTest.java @@ -19,7 +19,6 @@ */ package org.sonar.db.qualityprofile; -import com.google.common.collect.ImmutableMap; import java.util.Collections; import java.util.Map; import org.junit.Test; @@ -39,7 +38,7 @@ public class QProfileChangeDtoTest { underTest.setData(Collections.emptyMap()); assertThat(underTest.getDataAsMap()).isEmpty(); - underTest.setData(ImmutableMap.of("k1", "v1", "k2", "v2")); + underTest.setData(Map.of("k1", "v1", "k2", "v2")); assertThat(underTest.getDataAsMap()).containsOnly(entry("k1", "v1"), entry("k2", "v2")); } } -- 2.39.5