]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-21643 Migrate db tests migration to Junit5
authorLéo Geoffroy <leo.geoffroy@sonarsource.com>
Tue, 20 Feb 2024 15:30:20 +0000 (16:30 +0100)
committersonartech <sonartech@sonarsource.com>
Wed, 21 Feb 2024 20:02:34 +0000 (20:02 +0000)
 #

141 files changed:
server/sonar-db-core/build.gradle
server/sonar-db-core/src/testFixtures/java/org/sonar/db/CoreDbTester.java
server/sonar-db-migration/build.gradle
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/charset/SelectExecutorIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/charset/SqlExecutorIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/history/MigrationHistoryImplIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/history/MigrationHistoryTableImplIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/history/NoTableMigrationHistoryImplIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/sql/CreateTableBuilderIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/sql/DbPrimaryKeyConstraintFinderIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/step/DataChangeIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/step/ForceReloadingOfAllPluginsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v00/CreateInitialSchemaIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v00/PopulateInitialSchemaIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/AddNclocToProjectsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/CreateScimGroupsTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/CreateUniqueIndexForScimGroupsUuidIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/DropBModuleUuidInComponentsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/DropBModuleUuidPathInComponentsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsModuleUuidInComponentsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/DropIndexProjectsRootUuidInComponentsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/DropModuleUuidInComponentsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/DropModuleUuidPathInComponentsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/DropRootUuidInComponentsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/DropScimUserProvisioningIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/DropSonarScimEnabledPropertyIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/LogMessageIfSonarScimEnabledPresentPropertyIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/MakeColumnUserLocalNotNullableInUsersIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/PopulateNclocForForProjectsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/RemoveOrphanRulesFromQualityProfilesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v100/UpdateUserLocalValueInUsersIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/AddCodeVariantsColumnInIssuesTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/AddIsMainColumnInProjectBranchesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/AddReportSchedulesTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/AddReportSubscriptionsTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/AlterIsMainColumnInProjectBranchesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/CreateExternalGroupsTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/CreateIndexForEmailOnUsersTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/CreateIndexForScmAccountOnScmAccountsTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/CreateIndexOnExternalIdAndIdentityOnExternalGroupsTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/CreateProjectUuidInUserTokensIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/CreateScmAccountsTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/CreateUniqueIndexForReportSchedulesTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/CreateUniqueIndexForReportSubscriptionsTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/DropProjectKeyInUserTokensIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/DropScmAccountsInUsersIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/FixDifferentUuidsForSubportfoliosIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/IncreaseKeeColumnSizeInInternalPropertiesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/IncreaseTaskTypeColumnSizeInCeActivityIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/IncreaseTaskTypeColumnSizeInCeQueueIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/MigrateScmAccountsFromUsersToScmAccountsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/PopulateProjectUuidInUserTokensIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/PopulateReportSchedulesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/PopulateReportSubscriptionsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/RemoveOrphanUserTokensIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/RemoveReportPropertiesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/RenameColumnComponentUuidInPropertiesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v101/UpdateIsMainColumnInProjectBranchesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/AddCleanCodeAttributeInRulesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/AddUserConsentRequiredIfGithubAutoProvisioningEnabledIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/CreateAnticipatedTransitionsTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/CreateBooleanPurgedColumnInSnapshotsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/CreateGithubOrganizationsGroupsTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexCreatedAtInWebhookDeliveriesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInCeActivityIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInCeQueueIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInGroupRolesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexEntityUuidInUserRolesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidCreatedAtInWebhookDeliveriesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexProjectUuidInProjectBranchesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexRootComponentUuidInSnapshotsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexTaskUuidCreatedAtInWebhookDeliveriesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/CreateIndexWebhookUuidCreatedAtInWebhookDeliveriesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/CreateIssueImpactsTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/CreatePreviousNonCompliantValueInNewCodePeriodsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/CreateRulesDefaultImpactsTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/CreateUniqueConstraintOnIssuesImpactsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/CreateUniqueConstraintOnRulesDefaultImpactsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInGroupRolesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInSnapshotsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInUserRolesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/DropIndexComponentUuidInWebhookDeliveriesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/DropIndexMainComponentUuidInCeActivityIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/DropIndexMainComponentUuidInCeQueueIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/DropIndexOnMainBranchProjectUuidIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/DropIndexProjectUuidInWebhookDeliveriesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/DropIndexTaskUuidInWebhookDeliveriesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/DropIndexWebhookUuidInWebhookDeliveriesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/DropMainBranchProjectUuidInComponentsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/DropPurgeStatusColumnInSnapshotsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/DropTableProjectMappingsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/FixSqaleIndexMetricDescriptionIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/IncreaseIsLastKeyInCeActivityIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/IncreaseMainIsLastKeyInCeActivityIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/MakeProjectUuidNullableInUserDismissedMessagesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/MakePurgedColumnNotNullableInSnapshotsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/PopulateCleanCodeAttributeColumnInRulesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/PopulateDefaultImpactsInRulesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/PopulatePurgedColumnInSnapshotsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/RenameBuildDateInSnapshotsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInGroupRolesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInSnapshotsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInUserRolesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/RenameComponentUuidInWebhookDeliveriesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/RenameMainComponentUuidInCeActivityIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/RenameMainComponentUuidInCeQueueIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v102/UpdateValueAndPopulatePreviousNonCompliantValueInNewCodePeriodsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v103/AddCleanCodeAttributeColumnInIssuesTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v103/AddCreationMethodColumnInProjectsTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v103/AddRuleChangesUuidColumnInQProfileChangesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v103/AddSqVersionColumnInQprofileChangesTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v103/CreateGithubPermissionsMappingTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v103/CreateIndexForRuleImpactChangesTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v103/CreateRuleChangesTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v103/CreateRuleImpactChangesTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v103/CreateUniqueIndexForGithubPermissionsMappingTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v103/CreateUniqueIndexForPropertiesTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v103/DeduplicatePropertiesTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v103/MakeCreationMethodColumnInProjectsNotNullableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v103/PopulateCreationMethodColumnInProjectsTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v103/PopulateGithubPermissionsMappingIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v103/SetAllowQualityProfileDisableInheritedRulesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v104/AddUuidColumnToGroupsUsersIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v104/CreateIssuesFixedTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v104/CreatePrimaryKeyOnGroupsUsersTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v104/CreateRuleTagsTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v104/DeleteRedundantFailedAlertsForApplicationsIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v104/DropSystemTagsInRulesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v104/DropTagsInRulesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v104/MakeUuidInGroupsUsersNotNullableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v104/PopulateGroupsUsersUuidIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v104/PopulateRuleTagsTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v104/RemoveCleanCodeAttributeFromCustomHotspotRulesIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v104/RenameWontFixIssuesMetricIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v105/CreatePrimaryKeyOnIssuesImpactsTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v105/CreatePrimaryKeyOnRulesDefaultImpactsTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v105/DropPrimaryKeyConstraintInIssuesImpactsTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v105/DropPrimaryKeyConstraintInRulesDefaultImpactsTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v105/DropUuidColumnInIssuesImpactsTableIT.java
server/sonar-db-migration/src/it/java/org/sonar/server/platform/db/migration/version/v105/DropUuidColumnInRulesDefaultImpactsTableIT.java
server/sonar-db-migration/src/testFixtures/java/org/sonar/db/MigrationDbTester.java

index 3d32c75be42b05b069dc8a33d2a1ca8cce7dbbda..c65d7834a21978d87c1917c1f2560ba7ad627384 100644 (file)
@@ -26,12 +26,15 @@ dependencies {
   testImplementation 'com.microsoft.sqlserver:mssql-jdbc'
   testImplementation 'com.oracle.database.jdbc:ojdbc11'
   testImplementation 'com.tngtech.java:junit-dataprovider'
+  testImplementation 'org.junit.jupiter:junit-jupiter-api'
   testImplementation 'org.mockito:mockito-core'
   testImplementation 'org.postgresql:postgresql'
   testImplementation 'org.sonarsource.api.plugin:sonar-plugin-api-test-fixtures'
 
   testImplementation project(':sonar-testing-harness')
 
+  testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
+  testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
   testRuntimeOnly 'com.h2database:h2'
   testRuntimeOnly 'com.microsoft.sqlserver:mssql-jdbc'
   testRuntimeOnly 'com.oracle.database.jdbc:ojdbc11'
@@ -43,6 +46,7 @@ dependencies {
   testFixturesApi 'org.apache.commons:commons-collections4'
 
   testFixturesImplementation 'com.oracle.database.jdbc:ojdbc11'
+  testFixturesImplementation 'org.junit.jupiter:junit-jupiter-api'
 
   testFixturesCompileOnly 'com.google.code.findbugs:jsr305'
 }
index e8d21132a013081f808fc9dedf4a53cbc06eb12d..75a29f2675e83f0bd7ef2317b19e2cf27a2d33f2 100644 (file)
 package org.sonar.db;
 
 import org.apache.commons.lang.StringUtils;
+import org.junit.jupiter.api.extension.AfterEachCallback;
+import org.junit.jupiter.api.extension.BeforeEachCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
 
 /**
  * This class should be called using @Rule.
  * Data is truncated between each tests. The schema is created between each test.
  */
-public class CoreDbTester extends AbstractDbTester<CoreTestDb> {
+public class CoreDbTester extends AbstractDbTester<CoreTestDb> implements BeforeEachCallback, AfterEachCallback {
 
   private CoreDbTester(CoreTestDb testDb) {
     super(testDb);
@@ -55,4 +58,14 @@ public class CoreDbTester extends AbstractDbTester<CoreTestDb> {
   protected void after() {
     db.stop();
   }
+
+  @Override
+  public void afterEach(ExtensionContext extensionContext) throws Exception {
+    after();
+  }
+
+  @Override
+  public void beforeEach(ExtensionContext extensionContext) throws Exception {
+    before();
+  }
 }
index 636f278c8f8a281ba557f2eb1b752aa12305705c..0025201269facc8d5402bce2165858a7f41aa182 100644 (file)
@@ -24,6 +24,7 @@ dependencies {
   testImplementation 'com.squareup.okhttp3:mockwebserver'
   testImplementation 'junit:junit'
   testImplementation 'org.assertj:assertj-core'
+  testImplementation 'org.junit.jupiter:junit-jupiter-api'
   testImplementation 'org.mindrot:jbcrypt'
   testImplementation 'org.mockito:mockito-core'
   testImplementation 'org.xmlunit:xmlunit-core'
@@ -34,14 +35,19 @@ dependencies {
   testImplementation testFixtures(project(':server:sonar-db-core'))
 
   testFixturesImplementation 'org.sonarsource.orchestrator:sonar-orchestrator-junit4'
+  testFixturesImplementation 'org.junit.jupiter:junit-jupiter-api'
   testFixturesImplementation testFixtures(project(':server:sonar-db-core'))
 
   testRuntimeOnly 'com.h2database:h2'
   testRuntimeOnly 'com.microsoft.sqlserver:mssql-jdbc'
   testRuntimeOnly 'com.oracle.database.jdbc:ojdbc11'
+  testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
+  testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
   testRuntimeOnly 'org.postgresql:postgresql'
 }
 
 test {
   systemProperty 'orchestrator.configUrl', System.getProperty('orchestrator.configUrl')
+  // Enabling the JUnit Platform (see https://github.com/junit-team/junit5-samples/tree/master/junit5-migration-gradle)
+  useJUnitPlatform()
 }
index bbf1ee7ac8a5cf9d87bee736229e836da53a5383..3eb108632cc06942ccaf698cc2108bf963fdc6e7 100644 (file)
@@ -21,21 +21,21 @@ package org.sonar.server.platform.db.migration.charset;
 
 import java.sql.Connection;
 import java.util.List;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.CoreDbTester;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-public class SelectExecutorIT {
+class SelectExecutorIT {
 
-  @Rule
-  public CoreDbTester dbTester = CoreDbTester.createForSchema(SelectExecutorIT.class, "users_table.sql");
+  @RegisterExtension
+  public final CoreDbTester dbTester = CoreDbTester.createForSchema(SelectExecutorIT.class, "users_table.sql");
 
   SqlExecutor underTest = new SqlExecutor();
 
   @Test
-  public void testExecuteQuery() throws Exception {
+  void testExecuteQuery() throws Exception {
     insertUser("him", "Him");
     insertUser("her", "Her");
 
index 9e8b9e42346501721a876383e3ee14cd026e4257..9311acb215d47cce79dd8f12a57dfcd76011362a 100644 (file)
@@ -22,13 +22,13 @@ package org.sonar.server.platform.db.migration.charset;
 import java.sql.Connection;
 import java.util.List;
 import java.util.Map;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.CoreDbTester;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-public class SqlExecutorIT {
+class SqlExecutorIT {
 
   private static final String LOGIN_DB_COLUMN = "login";
   private static final String NAME_DB_COLUMN = "name";
@@ -37,11 +37,11 @@ public class SqlExecutorIT {
 
   private SqlExecutor underTest = new SqlExecutor();
 
-  @Rule
-  public CoreDbTester dbTester = CoreDbTester.createForSchema(SqlExecutorIT.class, "users_table.sql");
+  @RegisterExtension
+  public final CoreDbTester dbTester = CoreDbTester.createForSchema(SqlExecutorIT.class, "users_table.sql");
 
   @Test
-  public void executeSelect_executes_PreparedStatement() throws Exception {
+  void executeSelect_executes_PreparedStatement() throws Exception {
     dbTester.executeInsert(USERS_DB_TABLE, LOGIN_DB_COLUMN, "login1", NAME_DB_COLUMN, "name one", IS_ROOT_DB_COLUMN, false);
     dbTester.executeInsert(USERS_DB_TABLE, LOGIN_DB_COLUMN, "login2", NAME_DB_COLUMN, "name two", IS_ROOT_DB_COLUMN, false);
 
@@ -57,7 +57,7 @@ public class SqlExecutorIT {
   }
 
   @Test
-  public void executeUpdate_executes_PreparedStatement() throws Exception {
+  void executeUpdate_executes_PreparedStatement() throws Exception {
     dbTester.executeInsert(USERS_DB_TABLE, LOGIN_DB_COLUMN, "the_login", NAME_DB_COLUMN, "the name", IS_ROOT_DB_COLUMN, false);
 
     try (Connection connection = dbTester.openConnection()) {
index 620c286f7e20edfda06a15750c864c39422a6f24..187222cfe572c470dce39cde01bb97d0b9a1af22 100644 (file)
@@ -23,8 +23,8 @@ import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.util.Arrays;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.CoreDbTester;
 import org.sonar.server.platform.db.migration.step.MigrationStep;
 import org.sonar.server.platform.db.migration.step.RegisteredMigrationStep;
@@ -34,40 +34,40 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 
-public class MigrationHistoryImplIT {
-  @Rule
-  public CoreDbTester dbTester = CoreDbTester.createForSchema(MigrationHistoryImplIT.class, "schema_migration.sql");
+class MigrationHistoryImplIT {
+  @RegisterExtension
+  public final CoreDbTester dbTester = CoreDbTester.createForSchema(MigrationHistoryImplIT.class, "schema_migration.sql");
 
   private MigrationHistoryMeddler migrationHistoryMeddler = mock(MigrationHistoryMeddler.class);
   private MigrationHistoryImpl underTest = new MigrationHistoryImpl(dbTester.database(), migrationHistoryMeddler);
 
   @Test
-  public void start_does_not_fail_if_table_history_exists_and_calls_meddler() {
+  void start_does_not_fail_if_table_history_exists_and_calls_meddler() {
     underTest.start();
 
     verify(migrationHistoryMeddler).meddle(underTest);
   }
 
   @Test
-  public void getLastMigrationNumber_returns_empty_if_history_table_is_empty() {
+  void getLastMigrationNumber_returns_empty_if_history_table_is_empty() {
     assertThat(underTest.getLastMigrationNumber()).isEmpty();
   }
 
   @Test
-  public void getLastMigrationNumber_returns_last_version_assuming_version_are_only_number() throws SQLException {
+  void getLastMigrationNumber_returns_last_version_assuming_version_are_only_number() throws SQLException {
     insert(12, 5, 30, 8);
 
     assertThat(underTest.getLastMigrationNumber()).contains(30L);
   }
 
   @Test
-  public void done_fails_with_NPE_if_argument_is_null() {
+  void done_fails_with_NPE_if_argument_is_null() {
     assertThatThrownBy(() -> underTest.done(null))
       .isInstanceOf(NullPointerException.class);
   }
 
   @Test
-  public void done_adds_migration_number_to_table() {
+  void done_adds_migration_number_to_table() {
     underTest.done(new RegisteredMigrationStep(12, "aa", MigrationStep.class));
 
     assertThat(underTest.getLastMigrationNumber()).contains(12L);
index c0c4efce8e71edc6dbda4ae12d926be4a2775e88..b90e7d09e83260c38fb7327d510e67985cccc966 100644 (file)
@@ -23,30 +23,30 @@ import java.sql.Connection;
 import java.sql.SQLException;
 import java.sql.Statement;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.db.dialect.MsSql;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
+import org.sonar.db.dialect.MsSql;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-public class MigrationHistoryTableImplIT {
+class MigrationHistoryTableImplIT {
   private static final String TABLE_SCHEMA_MIGRATIONS = "schema_migrations";
 
-  @Rule
-  public MigrationDbTester dbTester = MigrationDbTester.createEmpty();
+  @RegisterExtension
+  public final MigrationDbTester dbTester = MigrationDbTester.createEmpty();
 
-  private MigrationHistoryTableImpl underTest = new MigrationHistoryTableImpl(dbTester.database());
+  private final MigrationHistoryTableImpl underTest = new MigrationHistoryTableImpl(dbTester.database());
 
   @Test
-  public void start_creates_table_on_empty_schema() {
+  void start_creates_table_on_empty_schema() {
     underTest.start();
 
     verifyTable();
   }
 
   @Test
-  public void start_does_not_fail_if_table_exists() throws SQLException {
+  void start_does_not_fail_if_table_exists() throws SQLException {
     executeDdl(String.format("create table %s (version %s(255) not null)", TABLE_SCHEMA_MIGRATIONS, getFieldType()));
     verifyTable();
 
index 292cea6ac5f1d4a05c11504d9334fe9c0bda99e0..2549ac4d53ad231b3d85588a37eee180ca91998c 100644 (file)
  */
 package org.sonar.server.platform.db.migration.history;
 
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verifyNoInteractions;
 
-public class NoTableMigrationHistoryImplIT {
-  @Rule
-  public MigrationDbTester dbTester = MigrationDbTester.createEmpty();
+class NoTableMigrationHistoryImplIT {
+  @RegisterExtension
+  public final MigrationDbTester dbTester = MigrationDbTester.createEmpty();
 
-  private MigrationHistoryMeddler migrationHistoryMeddler = mock(MigrationHistoryMeddler.class);
-  private MigrationHistoryImpl underTest = new MigrationHistoryImpl(dbTester.database(), migrationHistoryMeddler);
+  private final MigrationHistoryMeddler migrationHistoryMeddler = mock(MigrationHistoryMeddler.class);
+  private final MigrationHistoryImpl underTest = new MigrationHistoryImpl(dbTester.database(), migrationHistoryMeddler);
 
   @Test
-  public void start_fails_with_ISE_if_table_history_does_not_exist() {
+  void start_fails_with_ISE_if_table_history_does_not_exist() {
     assertThatThrownBy(() -> {
       underTest.start();
       verifyNoInteractions(migrationHistoryMeddler);
index ad4d504f2b13542cda321eda2adbb976ad56895c..f13c36379562cf33960fe3a01dcbb89d63d79b3b 100644 (file)
  */
 package org.sonar.server.platform.db.migration.sql;
 
+import java.util.List;
 import java.util.Map;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.db.dialect.Dialect;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
+import org.sonar.db.dialect.Dialect;
 import org.sonar.server.platform.db.migration.def.TinyIntColumnDef;
 import org.sonar.server.platform.db.migration.def.VarcharColumnDef;
 
@@ -37,16 +39,22 @@ import static org.sonar.server.platform.db.migration.def.IntegerColumnDef.newInt
 import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.newVarcharColumnDefBuilder;
 import static org.sonar.server.platform.db.migration.sql.CreateTableBuilder.ColumnFlag.AUTO_INCREMENT;
 
-public class CreateTableBuilderIT {
-  @ClassRule
-  public static final MigrationDbTester dbTester = MigrationDbTester.createEmpty();
+class CreateTableBuilderIT {
+  @RegisterExtension
+  public final MigrationDbTester dbTester = MigrationDbTester.createEmpty();
 
-  private final Dialect dialect = dbTester.database().getDialect();
+  private Dialect dialect;
   private static int tableNameGenerator = 0;
 
+  @BeforeEach
+  void before() {
+    dialect = dbTester.database().getDialect();
+  }
+
   @Test
-  public void create_no_primary_key_table() {
-    newCreateTableBuilder()
+  void create_no_primary_key_table() {
+    String tableName = createTableName();
+    new CreateTableBuilder(dialect, tableName)
       .addColumn(newBooleanColumnDefBuilder().setColumnName("bool_col_1").build())
       .addColumn(newBooleanColumnDefBuilder().setColumnName("bool_col_2").setIsNullable(false).build())
       .addColumn(newIntegerColumnDefBuilder().setColumnName("i_col_1").build())
@@ -65,29 +73,35 @@ public class CreateTableBuilderIT {
       .addColumn(newBlobColumnDefBuilder().setColumnName("blob_col_2").setIsNullable(false).build())
       .build()
       .forEach(dbTester::executeDdl);
+    assertTableAndColumnsExists(tableName, "bool_col_1", "bool_col_2", "i_col_1", "i_col_2", "bi_col_1", "bi_col_2", "clob_col_1",
+      "clob_col_2", "dec_col_1", "dec_col_2", "tiny_col_1", "tiny_col_2", "varchar_col_1", "varchar_col_2", "blob_col_1", "blob_col_2");
   }
 
   @Test
-  public void create_single_column_primary_key_table() {
-    newCreateTableBuilder()
+  void create_single_column_primary_key_table() {
+    String tableName = createTableName();
+    new CreateTableBuilder(dialect, tableName)
       .addPkColumn(newBigIntegerColumnDefBuilder().setColumnName("bg_col_1").setIsNullable(false).build())
       .addColumn(newVarcharColumnDefBuilder().setColumnName("varchar_col_2").setLimit(40).setIsNullable(false).build())
       .build()
       .forEach(dbTester::executeDdl);
+    assertTableAndColumnsExists(tableName, "bg_col_1", "varchar_col_2");
   }
 
   @Test
-  public void create_multi_column_primary_key_table() {
-    newCreateTableBuilder()
+  void create_multi_column_primary_key_table() {
+    String tableName = createTableName();
+    new CreateTableBuilder(dialect, tableName)
       .addPkColumn(newBigIntegerColumnDefBuilder().setColumnName("bg_col_1").setIsNullable(false).build())
       .addPkColumn(newBigIntegerColumnDefBuilder().setColumnName("bg_col_2").setIsNullable(false).build())
       .addColumn(newVarcharColumnDefBuilder().setColumnName("varchar_col_2").setLimit(40).setIsNullable(false).build())
       .build()
       .forEach(dbTester::executeDdl);
+    assertTableAndColumnsExists(tableName, "bg_col_1", "bg_col_2", "varchar_col_2");
   }
 
   @Test
-  public void create_autoincrement_notnullable_integer_primary_key_table() {
+  void create_autoincrement_notnullable_integer_primary_key_table() {
     String tableName = createTableName();
     new CreateTableBuilder(dialect, tableName)
       .addPkColumn(newIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
@@ -99,7 +113,7 @@ public class CreateTableBuilderIT {
   }
 
   @Test
-  public void create_autoincrement_notnullable_biginteger_primary_key_table() {
+  void create_autoincrement_notnullable_biginteger_primary_key_table() {
     String tableName = createTableName();
     new CreateTableBuilder(dialect, tableName)
       .addPkColumn(newBigIntegerColumnDefBuilder().setColumnName("id").setIsNullable(false).build(), AUTO_INCREMENT)
@@ -122,6 +136,11 @@ public class CreateTableBuilderIT {
     assertThat(row).containsEntry("val", "toto");
   }
 
+  private void assertTableAndColumnsExists(String tableName, String... columnNames) {
+    List<Map<String, Object>> row = dbTester.select(String.format("select %s from %s", String.join(", ", columnNames), tableName));
+    assertThat(row).isEmpty();
+  }
+
   private CreateTableBuilder newCreateTableBuilder() {
     return new CreateTableBuilder(dialect, createTableName());
   }
index 8ad43ccf5a2d22e4230fc60429469af62095a8aa..64be9724a9471d5a4a61bc8e6d7295d8ccac2013 100644 (file)
@@ -23,8 +23,8 @@ import java.sql.Connection;
 import java.sql.SQLException;
 import java.util.Optional;
 import javax.sql.DataSource;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.CoreDbTester;
 import org.sonar.db.Database;
 import org.sonar.db.dialect.H2;
@@ -36,10 +36,10 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
-public class DbPrimaryKeyConstraintFinderIT {
+class DbPrimaryKeyConstraintFinderIT {
 
-  @Rule
-  public CoreDbTester db = CoreDbTester.createForSchema(DbPrimaryKeyConstraintFinderIT.class, "schema.sql");
+  @RegisterExtension
+  public final CoreDbTester db = CoreDbTester.createForSchema(DbPrimaryKeyConstraintFinderIT.class, "schema.sql");
 
   private final Database dbMock = mock(Database.class);
   private final DbPrimaryKeyConstraintFinder underTest = new DbPrimaryKeyConstraintFinder(dbMock);
@@ -50,7 +50,7 @@ public class DbPrimaryKeyConstraintFinderIT {
   private static final org.sonar.db.dialect.H2 H2 = new H2();
 
   @Test
-  public void findConstraintName_constraint_exists() throws SQLException {
+  void findConstraintName_constraint_exists() throws SQLException {
     DbPrimaryKeyConstraintFinder underTest = new DbPrimaryKeyConstraintFinder(db.database());
     Optional<String> constraintName = underTest.findConstraintName("TEST_PRIMARY_KEY");
     assertThat(constraintName).isPresent();
@@ -58,13 +58,13 @@ public class DbPrimaryKeyConstraintFinderIT {
   }
 
   @Test
-  public void findConstraintName_constraint_not_exist_fails_silently() throws SQLException {
+  void findConstraintName_constraint_not_exist_fails_silently() throws SQLException {
     DbPrimaryKeyConstraintFinder underTest = new DbPrimaryKeyConstraintFinder(db.database());
     assertThat(underTest.findConstraintName("NOT_EXISTING_TABLE")).isNotPresent();
   }
 
   @Test
-  public void getDbVendorSpecificQuery_mssql() {
+  void getDbVendorSpecificQuery_mssql() {
     when(dbMock.getDialect()).thenReturn(MS_SQL);
 
     assertThat(underTest.getDbVendorSpecificQuery("my_table"))
@@ -72,7 +72,7 @@ public class DbPrimaryKeyConstraintFinderIT {
   }
 
   @Test
-  public void getDbVendorSpecificQuery_postgresql() throws SQLException {
+  void getDbVendorSpecificQuery_postgresql() throws SQLException {
     DataSource dataSource = mock(DataSource.class);
     Connection connection = mock(Connection.class);
     when(dataSource.getConnection()).thenReturn(connection);
@@ -85,7 +85,7 @@ public class DbPrimaryKeyConstraintFinderIT {
   }
 
   @Test
-  public void getDbVendorSpecificQuery_oracle() {
+  void getDbVendorSpecificQuery_oracle() {
     when(dbMock.getDialect()).thenReturn(ORACLE);
 
     assertThat(underTest.getDbVendorSpecificQuery("my_table"))
@@ -93,7 +93,7 @@ public class DbPrimaryKeyConstraintFinderIT {
   }
 
   @Test
-  public void getDbVendorSpecificQuery_h2() {
+  void getDbVendorSpecificQuery_h2() {
     when(dbMock.getDialect()).thenReturn(H2);
 
     assertThat(underTest.getDbVendorSpecificQuery("my_table"))
index 35b937e534df1e104e5f606c47898943e62d7bc2..b48f129f89312c7418b2484f1ef16503e5965a55 100644 (file)
@@ -30,9 +30,9 @@ import java.util.Set;
 import java.util.concurrent.atomic.AtomicBoolean;
 import javax.annotation.Nullable;
 import org.apache.commons.lang.StringUtils;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.CoreDbTester;
 import org.sonar.server.platform.db.migration.step.Select.Row;
 import org.sonar.server.platform.db.migration.step.Select.RowReader;
@@ -43,21 +43,21 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.fail;
 
-public class DataChangeIT {
+class DataChangeIT {
 
   private static final int MAX_BATCH_SIZE = 250;
   private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
 
-  @Rule
-  public CoreDbTester db = CoreDbTester.createForSchema(DataChangeIT.class, "schema.sql");
+  @RegisterExtension
+  public final CoreDbTester db = CoreDbTester.createForSchema(DataChangeIT.class, "schema.sql");
 
-  @Before
+  @BeforeEach
   public void setUp() {
     db.executeUpdateSql("truncate table persons");
   }
 
   @Test
-  public void query() throws Exception {
+  void query() throws Exception {
     insertPersons();
 
     AtomicBoolean executed = new AtomicBoolean(false);
@@ -77,7 +77,7 @@ public class DataChangeIT {
   }
 
   @Test
-  public void read_column_types() throws Exception {
+  void read_column_types() throws Exception {
     insertPersons();
 
     List<Object[]> persons = new ArrayList<>();
@@ -99,7 +99,7 @@ public class DataChangeIT {
   }
 
   @Test
-  public void parameterized_query() throws Exception {
+  void parameterized_query() throws Exception {
     insertPersons();
 
     final List<Long> ids = new ArrayList<>();
@@ -113,7 +113,7 @@ public class DataChangeIT {
   }
 
   @Test
-  public void display_current_row_details_if_error_during_get() throws Exception {
+  void display_current_row_details_if_error_during_get() throws Exception {
     insertPersons();
 
     assertThatThrownBy(() -> {
@@ -131,7 +131,7 @@ public class DataChangeIT {
   }
 
   @Test
-  public void display_current_row_details_if_error_during_list() throws Exception {
+  void display_current_row_details_if_error_during_list() throws Exception {
     insertPersons();
 
     assertThatThrownBy(() -> {
@@ -149,7 +149,7 @@ public class DataChangeIT {
   }
 
   @Test
-  public void bad_parameterized_query() throws Exception {
+  void bad_parameterized_query() throws Exception {
     insertPersons();
 
     DataChange change = new DataChange(db.database()) {
@@ -165,7 +165,7 @@ public class DataChangeIT {
   }
 
   @Test
-  public void scroll() throws Exception {
+  void scroll() throws Exception {
     insertPersons();
 
     final List<Long> ids = new ArrayList<>();
@@ -179,7 +179,7 @@ public class DataChangeIT {
   }
 
   @Test
-  public void insert() throws Exception {
+  void insert() throws Exception {
     insertPersons();
 
     new DataChange(db.database()) {
@@ -203,7 +203,7 @@ public class DataChangeIT {
   }
 
   @Test
-  public void batch_inserts() throws Exception {
+  void batch_inserts() throws Exception {
     insertPersons();
 
     new DataChange(db.database()) {
@@ -241,7 +241,7 @@ public class DataChangeIT {
   }
 
   @Test
-  public void override_size_of_batch_inserts() throws Exception {
+  void override_size_of_batch_inserts() throws Exception {
     new DataChange(db.database()) {
       @Override
       public void execute(Context context) throws SQLException {
@@ -275,7 +275,7 @@ public class DataChangeIT {
   }
 
   @Test
-  public void update_null() throws Exception {
+  void update_null() throws Exception {
     insertPersons();
 
     new DataChange(db.database()) {
@@ -301,7 +301,7 @@ public class DataChangeIT {
   }
 
   @Test
-  public void mass_batch_insert() throws Exception {
+  void mass_batch_insert() throws Exception {
     db.executeUpdateSql("truncate table persons");
 
     final int count = MAX_BATCH_SIZE + 10;
@@ -327,7 +327,7 @@ public class DataChangeIT {
   }
 
   @Test
-  public void scroll_and_update() throws Exception {
+  void scroll_and_update() throws Exception {
     insertPersons();
 
     new DataChange(db.database()) {
@@ -352,7 +352,7 @@ public class DataChangeIT {
   }
 
   @Test
-  public void display_current_row_details_if_error_during_scroll() throws Exception {
+  void display_current_row_details_if_error_during_scroll() throws Exception {
     insertPersons();
 
     assertThatThrownBy(() -> {
@@ -372,7 +372,7 @@ public class DataChangeIT {
   }
 
   @Test
-  public void mass_update() throws Exception {
+  void mass_update() throws Exception {
     insertPersons();
 
     new DataChange(db.database()) {
@@ -398,7 +398,7 @@ public class DataChangeIT {
   }
 
   @Test
-  public void row_splitter_should_split_correctly() throws Exception {
+  void row_splitter_should_split_correctly() throws Exception {
     insertPersons();
 
     new DataChange(db.database()) {
@@ -452,7 +452,7 @@ public class DataChangeIT {
   private record PhoneNumberRow(long personId, String phoneNumber){}
 
   @Test
-  public void display_current_row_details_if_error_during_mass_update() throws Exception {
+  void display_current_row_details_if_error_during_mass_update() throws Exception {
     insertPersons();
 
     assertThatThrownBy(() -> {
@@ -473,7 +473,7 @@ public class DataChangeIT {
   }
 
   @Test
-  public void mass_update_nothing() throws Exception {
+  void mass_update_nothing() throws Exception {
     insertPersons();
 
     new DataChange(db.database()) {
@@ -490,7 +490,7 @@ public class DataChangeIT {
   }
 
   @Test
-  public void bad_mass_update() throws Exception {
+  void bad_mass_update() throws Exception {
     insertPersons();
 
     DataChange change = new DataChange(db.database()) {
@@ -511,7 +511,7 @@ public class DataChangeIT {
   }
 
   @Test
-  public void read_not_null_fields() throws Exception {
+  void read_not_null_fields() throws Exception {
     insertPersons();
 
     List<Object[]> persons = new ArrayList<>();
index 080363eeb987540ef4699908b1521084eb938f44..4c65c78f8b24081b18c2ebab42f67d0a8f699521 100644 (file)
@@ -22,8 +22,8 @@ package org.sonar.server.platform.db.migration.step;
 import java.sql.SQLException;
 import java.util.HashMap;
 import java.util.Map;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.core.util.UuidFactory;
 import org.sonar.core.util.UuidFactoryFast;
 import org.sonar.db.CoreDbTester;
@@ -32,16 +32,16 @@ import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonar.server.platform.db.migration.step.ForceReloadingOfAllPlugins.OVERWRITE_HASH;
 
-public class ForceReloadingOfAllPluginsIT {
+class ForceReloadingOfAllPluginsIT {
   private final UuidFactory uuidFactory = UuidFactoryFast.getInstance();
 
-  @Rule
-  public CoreDbTester db = CoreDbTester.createForSchema(ForceReloadingOfAllPluginsIT.class, "schema.sql");
+  @RegisterExtension
+  public final CoreDbTester db = CoreDbTester.createForSchema(ForceReloadingOfAllPluginsIT.class, "schema.sql");
 
   private final DataChange underTest = new ForceReloadingOfAllPlugins(db.database());
 
   @Test
-  public void migration_overwrite_file_hash_on_all_plugins() throws SQLException {
+  void migration_overwrite_file_hash_on_all_plugins() throws SQLException {
     String pluginUuid1 = insertPlugin();
     String pluginUuid2 = insertPlugin();
 
@@ -52,7 +52,7 @@ public class ForceReloadingOfAllPluginsIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     String pluginUuid1 = insertPlugin();
     String pluginUuid2 = insertPlugin();
 
index 6ca3cb8ffead4289755b88782f0b37f325ede78c..ffe5c19fa85f073ca35056f26994cf140d8c8141 100644 (file)
@@ -25,23 +25,23 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Set;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-public class CreateInitialSchemaIT {
+class CreateInitialSchemaIT {
 
   private static final Set<String> SCHEMAS_TO_IGNORE = Set.of("INFORMATION_SCHEMA", "sys", "SYS", "SYSTEM", "CTXSYS", "MDSYS", "XDB");
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester dbTester = MigrationDbTester.createForMigrationStep(CreateInitialSchema.class);
 
   private final CreateInitialSchema underTest = new CreateInitialSchema(dbTester.database());
 
   @Test
-  public void creates_tables_on_empty_db() throws Exception {
+  void creates_tables_on_empty_db() throws Exception {
     underTest.execute();
 
     List<String> tables = new ArrayList<>();
index 88beeafe3eda3315702d9bca5cde20389bb07858..93235827b007965d769ca1707e589855ae12e677 100644 (file)
@@ -27,9 +27,9 @@ import java.util.Random;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.api.utils.System2;
 import org.sonar.api.utils.Version;
 import org.sonar.core.platform.SonarQubeVersion;
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
-public class PopulateInitialSchemaIT {
+class PopulateInitialSchemaIT {
 
   private static final long NOW = 1_500L;
 
@@ -51,18 +51,18 @@ public class PopulateInitialSchemaIT {
   private final System2 system2 = mock(System2.class);
   private final SonarQubeVersion sonarQubeVersion = mock(SonarQubeVersion.class);
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulateInitialSchema.class);
 
   private final PopulateInitialSchema underTest = new PopulateInitialSchema(db.database(), system2, uuidFactory, sonarQubeVersion);
 
-  @Before
+  @BeforeEach
   public void setUp() {
     when(sonarQubeVersion.get()).thenReturn(version);
   }
 
   @Test
-  public void migration_inserts_users_and_groups() throws SQLException {
+  void migration_inserts_users_and_groups() throws SQLException {
     when(system2.now()).thenReturn(NOW);
 
     underTest.execute();
index 16c29ae3c063ac32148635eb75b3e33d21945551..647480672c7347fece0e5ed8b2697e281a3aec1c 100644 (file)
@@ -21,22 +21,22 @@ package org.sonar.server.platform.db.migration.version.v100;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
-public class AddNclocToProjectsIT {
+class AddNclocToProjectsIT {
 
   private static final String TABLE_NAME = "projects";
   private static final String COLUMN_NAME = "ncloc";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddNclocToProjects.class);
   private final DdlChange underTest = new AddNclocToProjects(db.database());
 
   @Test
-  public void add_column() throws SQLException {
+  void add_column() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
     underTest.execute();
@@ -44,7 +44,7 @@ public class AddNclocToProjectsIT {
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
     underTest.execute();
     underTest.execute();
index 653f6f2d7b86e0588069487a7a6deb88695e3082..855e92ea4044902a9da31772693604ac5ad2d474 100644 (file)
@@ -21,22 +21,22 @@ package org.sonar.server.platform.db.migration.version.v100;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
 import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE;
 import static org.sonar.server.platform.db.migration.version.v100.CreateScimGroupsTable.TABLE_NAME;
 
-public class CreateScimGroupsTableIT {
-  @Rule
+class CreateScimGroupsTableIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateScimGroupsTable.class);
 
   private final DdlChange underTest = new CreateScimGroupsTable(db.database());
 
   @Test
-  public void migration_should_create_a_table() throws SQLException {
+  void migration_should_create_a_table() throws SQLException {
     db.assertTableDoesNotExist(TABLE_NAME);
 
     underTest.execute();
@@ -48,7 +48,7 @@ public class CreateScimGroupsTableIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     db.assertTableDoesNotExist(TABLE_NAME);
 
     underTest.execute();
index 3f9a58b82846a161bf4038139ec31d7920610f2b..706a931eb4805390621bbf6e1f9e3e53f1949ff7 100644 (file)
@@ -20,8 +20,8 @@
 package org.sonar.server.platform.db.migration.version.v100;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
@@ -29,13 +29,13 @@ import static org.sonar.server.platform.db.migration.version.v100.CreateScimGrou
 import static org.sonar.server.platform.db.migration.version.v100.CreateUniqueIndexForScimGroupsUuid.COLUMN_NAME;
 import static org.sonar.server.platform.db.migration.version.v100.CreateUniqueIndexForScimGroupsUuid.INDEX_NAME;
 
-public class CreateUniqueIndexForScimGroupsUuidIT {
-  @Rule
+class CreateUniqueIndexForScimGroupsUuidIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateUniqueIndexForScimGroupsUuid.class);
   private final DdlChange underTest = new CreateUniqueIndexForScimGroupsUuid(db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME);
 
     underTest.execute();
@@ -44,7 +44,7 @@ public class CreateUniqueIndexForScimGroupsUuidIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME);
 
     underTest.execute();
index 7b5a3560da7f5e4e377c4830c1e569027bd85191..d415ffe2934b22eede22b6a3099fb235a21ff5cb 100644 (file)
@@ -21,28 +21,28 @@ package org.sonar.server.platform.db.migration.version.v100;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
-public class DropBModuleUuidInComponentsIT {
+class DropBModuleUuidInComponentsIT {
   private static final String TABLE_NAME = "components";
   private static final String COLUMN_NAME = "b_module_uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropBModuleUuidInComponents.class);
   private final DdlChange underTest = new DropBModuleUuidInComponents(db.database());
 
   @Test
-  public void drops_column() throws SQLException {
+  void drops_column() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 50, true);
     underTest.execute();
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 50, true);
     underTest.execute();
     underTest.execute();
index aacad8ba6f0b3ab4287fa5213e6389aee252b778..5807aa2897eb70816fff4085a567d21f32495fdf 100644 (file)
@@ -21,28 +21,28 @@ package org.sonar.server.platform.db.migration.version.v100;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
-public class DropBModuleUuidPathInComponentsIT {
+class DropBModuleUuidPathInComponentsIT {
   private static final String TABLE_NAME = "components";
   private static final String COLUMN_NAME = "b_module_uuid_path";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropBModuleUuidPathInComponents.class);
   private final DdlChange underTest = new DropBModuleUuidPathInComponents(db.database());
 
   @Test
-  public void drops_column() throws SQLException {
+  void drops_column() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 1500, true);
     underTest.execute();
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 1500, true);
     underTest.execute();
     underTest.execute();
index f742a14c2dc23442d4ffb8bca7a0830d19d20df7..0629581cd22bb2ce2b6e3892f8373b5dc72e8f4e 100644 (file)
 package org.sonar.server.platform.db.migration.version.v100;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
-public class DropIndexProjectsModuleUuidInComponentsIT {
+class DropIndexProjectsModuleUuidInComponentsIT {
   private static final String TABLE_NAME = "components";
   private static final String COLUMN_NAME = "module_uuid";
   private static final String INDEX_NAME = "projects_module_uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropIndexProjectsModuleUuidInComponents.class);
   private final DdlChange underTest = new DropIndexProjectsModuleUuidInComponents(db.database());
 
   @Test
-  public void drops_index() throws SQLException {
+  void drops_index() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
     underTest.execute();
     db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME);
   }
 
   @Test
-  public void execute_whenIndexNameWithPrefix_shouldStillDelete() throws SQLException {
+  void execute_whenIndexNameWithPrefix_shouldStillDelete() throws SQLException {
     String alteredIndexName = "idx_1234567891345678916456789_" + INDEX_NAME;
     db.renameIndex(TABLE_NAME, INDEX_NAME, alteredIndexName);
     db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME);
@@ -52,7 +52,7 @@ public class DropIndexProjectsModuleUuidInComponentsIT {
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
     underTest.execute();
     underTest.execute();
index 010376a937f3dd4ed6ab0c6782372eecd74b271e..c3d9d2691a16c8b2a27120fffaeb9fd657e82004 100644 (file)
 package org.sonar.server.platform.db.migration.version.v100;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
-public class DropIndexProjectsRootUuidInComponentsIT {
+class DropIndexProjectsRootUuidInComponentsIT {
   private static final String TABLE_NAME = "components";
   private static final String COLUMN_NAME = "root_uuid";
   private static final String INDEX_NAME = "projects_root_uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropIndexProjectsRootUuidInComponents.class);
   private final DdlChange underTest = new DropIndexProjectsRootUuidInComponents(db.database());
 
   @Test
-  public void drops_index() throws SQLException {
+  void drops_index() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
     underTest.execute();
     db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
     underTest.execute();
     underTest.execute();
index 605c86f86950169e1daa3797df8daf1f5283e523..ba4cd4303f6004e21d89c95b387f16518f12c18c 100644 (file)
@@ -21,28 +21,28 @@ package org.sonar.server.platform.db.migration.version.v100;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
-public class DropModuleUuidInComponentsIT {
+class DropModuleUuidInComponentsIT {
   private static final String TABLE_NAME = "components";
   private static final String COLUMN_NAME = "module_uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropModuleUuidInComponents.class);
   private final DdlChange underTest = new DropModuleUuidInComponents(db.database());
 
   @Test
-  public void drops_column() throws SQLException {
+  void drops_column() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 50, true);
     underTest.execute();
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 50, true);
     underTest.execute();
     underTest.execute();
index cc19d0354f07005909602bc7cb9f14d6af0a7909..aacb9cdd3703468fc894702dec86bc7dfe7d92fe 100644 (file)
@@ -21,28 +21,28 @@ package org.sonar.server.platform.db.migration.version.v100;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
-public class DropModuleUuidPathInComponentsIT {
+class DropModuleUuidPathInComponentsIT {
   private static final String TABLE_NAME = "components";
   private static final String COLUMN_NAME = "module_uuid_path";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropModuleUuidPathInComponents.class);
   private final DdlChange underTest = new DropModuleUuidPathInComponents(db.database());
 
   @Test
-  public void drops_column() throws SQLException {
+  void drops_column() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 1500, true);
     underTest.execute();
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 1500, true);
     underTest.execute();
     underTest.execute();
index 0874e1b22669b4ec86b7e85edc3318a7fa095fbf..ea7d33bc1a28dfbe5f31bfd31c569c5214effeb8 100644 (file)
@@ -21,28 +21,28 @@ package org.sonar.server.platform.db.migration.version.v100;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
-public class DropRootUuidInComponentsIT {
+class DropRootUuidInComponentsIT {
   private static final String TABLE_NAME = "components";
   private static final String COLUMN_NAME = "root_uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropRootUuidInComponents.class);
   private final DdlChange underTest = new DropRootUuidInComponents(db.database());
 
   @Test
-  public void drops_column() throws SQLException {
+  void drops_column() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 50, false);
     underTest.execute();
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 50, false);
     underTest.execute();
     underTest.execute();
index 56a7adf97eca0387af8407d0962c6919db4f146b..468c32b9f0f91b319e33d773b02fee3d07d6d332 100644 (file)
 package org.sonar.server.platform.db.migration.version.v100;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DataChange;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-public class DropScimUserProvisioningIT {
+class DropScimUserProvisioningIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropScimUserProvisioning.class);
   private final DataChange underTest = new DropScimUserProvisioning(db.database());
 
   @Test
-  public void migration_should_truncate_scim_users_table() throws SQLException {
+  void migration_should_truncate_scim_users_table() throws SQLException {
     insertScimUser(1);
     insertScimUser(2);
 
@@ -51,7 +51,7 @@ public class DropScimUserProvisioningIT {
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     insertScimUser(1);
     insertScimUser(2);
 
index 88df4a655c8228adc1b388e75d7647e30b49cd66..c5399175f8b2cf984d0672a72b801b464e8bd5e5 100644 (file)
@@ -21,19 +21,19 @@ package org.sonar.server.platform.db.migration.version.v100;
 
 import java.sql.SQLException;
 import org.assertj.core.api.Assertions;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DataChange;
 
-public class DropSonarScimEnabledPropertyIT {
+class DropSonarScimEnabledPropertyIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropSonarScimEnabledProperty.class);
   private final DataChange underTest = new DropSonarScimEnabledProperty(db.database());
 
   @Test
-  public void migration_should_remove_scim_property() throws SQLException {
+  void migration_should_remove_scim_property() throws SQLException {
     insertScimProperty(db);
 
     underTest.execute();
@@ -42,7 +42,7 @@ public class DropSonarScimEnabledPropertyIT {
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     insertScimProperty(db);
 
     underTest.execute();
index b36309953e8fe998e8719d8cb0ba7a0b649d7107..6142584c25c6c57f5f7d2be08f4f8c3f0e97d50f 100644 (file)
 package org.sonar.server.platform.db.migration.version.v100;
 
 import java.sql.SQLException;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.slf4j.event.Level;
-import org.sonar.api.testfixtures.log.LogTester;
+import org.sonar.api.testfixtures.log.LogTesterJUnit5;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DataChange;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonar.server.platform.db.migration.version.v100.LogMessageIfSonarScimEnabledPresentProperty.SONAR_SCIM_ENABLED;
 
-public class LogMessageIfSonarScimEnabledPresentPropertyIT {
+class LogMessageIfSonarScimEnabledPresentPropertyIT {
 
-  @Rule
-  public LogTester logger = new LogTester();
+  @RegisterExtension
+  public final LogTesterJUnit5 logger = new LogTesterJUnit5();
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(LogMessageIfSonarScimEnabledPresentProperty.class);
   private final DataChange underTest = new LogMessageIfSonarScimEnabledPresentProperty(db.database());
 
-  @Before
+  @BeforeEach
   public void before() {
     logger.clear();
   }
 
   @Test
-  public void migration_should_log_message_when_scim_property() throws SQLException {
+  void migration_should_log_message_when_scim_property() throws SQLException {
     db.executeInsert("properties ",
       "prop_key", "sonar.scim.enabled",
       "is_empty", false,
@@ -66,7 +66,7 @@ public class LogMessageIfSonarScimEnabledPresentPropertyIT {
   }
 
   @Test
-  public void migration_should_not_log_if_no_scim_property() throws SQLException {
+  void migration_should_not_log_if_no_scim_property() throws SQLException {
 
     underTest.execute();
 
@@ -74,7 +74,7 @@ public class LogMessageIfSonarScimEnabledPresentPropertyIT {
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.executeInsert("properties ",
       "prop_key", "sonar.scim.enabled",
       "is_empty", false,
index 822030350b8ad2c850a2ade34f607742b22d3423..8e1693f1529eb34f8be4b52062ddc0e0a2509c89 100644 (file)
 package org.sonar.server.platform.db.migration.version.v100;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.BOOLEAN;
 
-public class MakeColumnUserLocalNotNullableInUsersIT {
+class MakeColumnUserLocalNotNullableInUsersIT {
   private static final String TABLE_NAME = "users";
   private static final String COLUMN_NAME = "user_local";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(MakeColumnUserLocalNotNullableInUsers.class);
   private final MakeColumnUserLocalNotNullableInUsers underTest = new MakeColumnUserLocalNotNullableInUsers(db.database());
 
   @Test
-  public void user_local_column_is_not_null() throws SQLException {
+  void user_local_column_is_not_null() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, BOOLEAN, null, true);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, BOOLEAN, null, false);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, BOOLEAN, null, true);
     underTest.execute();
     underTest.execute();
index 84e0fc5917c05607cf086f340d58eddc1d5a8cd3..2384ca1eafc0f4e04a3a276d804c6ad71d436e19 100644 (file)
@@ -22,8 +22,8 @@ package org.sonar.server.platform.db.migration.version.v100;
 import java.sql.SQLException;
 import java.util.HashMap;
 import java.util.Map;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.core.util.UuidFactory;
 import org.sonar.core.util.UuidFactoryFast;
 import org.sonar.db.MigrationDbTester;
@@ -32,24 +32,24 @@ import org.sonar.server.platform.db.migration.step.DataChange;
 import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
 import static org.assertj.core.api.Assertions.assertThat;
 
-public class PopulateNclocForForProjectsIT {
+class PopulateNclocForForProjectsIT {
 
   private final UuidFactory uuidFactory = UuidFactoryFast.getInstance();
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulateNclocForForProjects.class);
 
   private final DataChange underTest = new PopulateNclocForForProjects(db.database());
 
   @Test
-  public void migration_populates_ncloc_for_projects() throws SQLException {
+  void migration_populates_ncloc_for_projects() throws SQLException {
     Map<String, Long> expectedNclocByProjectUuid = populateData();
     underTest.execute();
     verifyNclocCorrectlyPopulatedForProjects(expectedNclocByProjectUuid);
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     Map<String, Long> expectedNclocByProjectUuid = populateData();
     underTest.execute();
     // re-entrant
index 663ac914ded4a51a97ac953bb99af9203695c463..1597d8535dd398c02e60f2432a702ba37a5fd89c 100644 (file)
@@ -22,9 +22,9 @@ package org.sonar.server.platform.db.migration.version.v100;
 import java.sql.SQLException;
 import java.util.HashMap;
 import java.util.Map;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.api.utils.System2;
 import org.sonar.core.util.SequenceUuidFactory;
 import org.sonar.core.util.UuidFactory;
@@ -37,21 +37,21 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 import static org.sonar.core.util.SequenceUuidFactory.UUID_1;
 
-public class RemoveOrphanRulesFromQualityProfilesIT {
+class RemoveOrphanRulesFromQualityProfilesIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RemoveOrphanRulesFromQualityProfiles.class);
   private final System2 system2 = mock(System2.class);
   private final UuidFactory instance = new SequenceUuidFactory();
   private final DataChange underTest = new RemoveOrphanRulesFromQualityProfiles(db.database(), instance, system2);
 
-  @Before
+  @BeforeEach
   public void before() {
     when(system2.now()).thenReturn(1L);
   }
 
   @Test
-  public void migration_should_remove_orphans() throws SQLException {
+  void migration_should_remove_orphans() throws SQLException {
     insertData();
 
     underTest.execute();
@@ -61,7 +61,7 @@ public class RemoveOrphanRulesFromQualityProfilesIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     insertData();
 
     // re-entrant
index e5f63d4d5ebf0e7000d8e235304299d6e5b7066d..63b917015007ff61548736a2f9b0a1e154d0be1f 100644 (file)
@@ -22,8 +22,8 @@ package org.sonar.server.platform.db.migration.version.v100;
 import java.sql.SQLException;
 import java.util.HashMap;
 import java.util.Map;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.core.util.UuidFactory;
 import org.sonar.core.util.UuidFactoryFast;
 import org.sonar.db.MigrationDbTester;
@@ -33,17 +33,17 @@ import static org.apache.commons.lang.RandomStringUtils.randomAlphabetic;
 import static org.apache.commons.lang.RandomStringUtils.randomNumeric;
 import static org.assertj.core.api.Assertions.assertThat;
 
-public class UpdateUserLocalValueInUsersIT {
+class UpdateUserLocalValueInUsersIT {
 
   private final UuidFactory uuidFactory = UuidFactoryFast.getInstance();
 
-  @Rule
-  public MigrationDbTester db = MigrationDbTester.createForMigrationStep(UpdateUserLocalValueInUsers.class);
+  @RegisterExtension
+  public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(UpdateUserLocalValueInUsers.class);
 
   private final DataChange underTest = new UpdateUserLocalValueInUsers(db.database());
 
   @Test
-  public void migration_updates_user_local_if_null() throws SQLException {
+  void migration_updates_user_local_if_null() throws SQLException {
     String userUuid1 = insertUser(true);
     String userUuid2 = insertUser(false);
     String userUuid3 = insertUser(null);
@@ -56,7 +56,7 @@ public class UpdateUserLocalValueInUsersIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     String userUuid1 = insertUser(true);
     String userUuid2 = insertUser(false);
     String userUuid3 = insertUser(null);
index 43b9114648cfa21d0ac46f34b650530cc9115e64..f71df86f42e6ea48cdce637791773e6157053265 100644 (file)
 package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.VARCHAR;
 
-public class AddCodeVariantsColumnInIssuesTableIT {
+class AddCodeVariantsColumnInIssuesTableIT {
 
   private static final String TABLE_NAME = "issues";
   private static final String COLUMN_NAME = "code_variants";
   private static final int COLUMN_SIZE = 4000;
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddCodeVariantsColumnInIssuesTable.class);
   private final AddCodeVariantsColumnInIssuesTable underTest = new AddCodeVariantsColumnInIssuesTable(db.database());
 
   @Test
-  public void migration_should_add_column() throws SQLException {
+  void migration_should_add_column() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, COLUMN_SIZE, true);
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
     underTest.execute();
     underTest.execute();
index f52832874b2539247aa3158b5cc4ebd3cf5ad542..6dab954a97ad21665da95ecf20c61ecc08e37b35 100644 (file)
 package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.BOOLEAN;
 
-public class AddIsMainColumnInProjectBranchesIT {
+class AddIsMainColumnInProjectBranchesIT {
 
   private static final String TABLE_NAME = "project_branches";
   private static final String COLUMN_NAME = "is_main";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddIsMainColumnInProjectBranches.class);
   private final AddIsMainColumnInProjectBranches underTest = new AddIsMainColumnInProjectBranches(db.database());
 
   @Test
-  public void is_main_column_exists_with_null_value() throws SQLException {
+  void is_main_column_exists_with_null_value() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, BOOLEAN, null, null);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
     underTest.execute();
     underTest.execute();
index ec0cf65c393675001f2c9a059ece505ebd84b74c..5af08256fc6499bd362c778a724334d3e657b27e 100644 (file)
@@ -21,22 +21,22 @@ package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
 import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE;
 import static org.sonar.server.platform.db.migration.version.v101.AddReportSchedulesTable.TABLE_NAME;
 
-public class AddReportSchedulesTableIT {
-  @Rule
+class AddReportSchedulesTableIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddReportSchedulesTable.class);
 
   private final DdlChange underTest = new AddReportSchedulesTable(db.database());
 
   @Test
-  public void migration_should_create_a_table() throws SQLException {
+  void migration_should_create_a_table() throws SQLException {
     db.assertTableDoesNotExist(TABLE_NAME);
 
     underTest.execute();
@@ -51,7 +51,7 @@ public class AddReportSchedulesTableIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     db.assertTableDoesNotExist(TABLE_NAME);
 
     underTest.execute();
index 9c80412fce4cf8f902052c7c2c90b0315bf3ceaf..8a2dc83e148134da6894b07fe4ece251c321fea4 100644 (file)
@@ -21,22 +21,22 @@ package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
 import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE;
 import static org.sonar.server.platform.db.migration.version.v101.AddReportSubscriptionsTable.TABLE_NAME;
 
-public class AddReportSubscriptionsTableIT {
-  @Rule
+class AddReportSubscriptionsTableIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddReportSubscriptionsTable.class);
 
   private final DdlChange underTest = new AddReportSubscriptionsTable(db.database());
 
   @Test
-  public void migration_should_create_a_table() throws SQLException {
+  void migration_should_create_a_table() throws SQLException {
     db.assertTableDoesNotExist(TABLE_NAME);
 
     underTest.execute();
@@ -51,7 +51,7 @@ public class AddReportSubscriptionsTableIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     db.assertTableDoesNotExist(TABLE_NAME);
 
     underTest.execute();
index df2027fa5e6638411b21c3181ec4c68aa7018d7c..c1d8adfbc1195f8a80c2c4e19b26f972e0290f93 100644 (file)
 package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.BOOLEAN;
 
-public class AlterIsMainColumnInProjectBranchesIT {
+class AlterIsMainColumnInProjectBranchesIT {
 
   private static final String TABLE_NAME = "project_branches";
   private static final String COLUMN_NAME = "is_main";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AlterIsMainColumnInProjectBranches.class);
   private final AlterIsMainColumnInProjectBranches underTest = new AlterIsMainColumnInProjectBranches(db.database());
 
   @Test
-  public void execute_shouldNotBeNullable() throws SQLException {
+  void execute_shouldNotBeNullable() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, BOOLEAN, null, true);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, BOOLEAN, null, false);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, BOOLEAN, null, true);
     underTest.execute();
     underTest.execute();
index a083d6c68c9210f68d6b2c1019166048a068939b..df5dcf96c79f913b8b04dfca5e4d358d4ec7f12d 100644 (file)
@@ -21,8 +21,8 @@ package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
@@ -32,15 +32,15 @@ import static org.sonar.server.platform.db.migration.version.v101.CreateExternal
 import static org.sonar.server.platform.db.migration.version.v101.CreateExternalGroupsTable.GROUP_UUID_COLUMN_NAME;
 import static org.sonar.server.platform.db.migration.version.v101.CreateExternalGroupsTable.TABLE_NAME;
 
-public class CreateExternalGroupsTableIT {
+class CreateExternalGroupsTableIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateExternalGroupsTable.class);
 
   private final DdlChange createExternalGroupsTable = new CreateExternalGroupsTable(db.database());
 
   @Test
-  public void migration_should_create_a_table() throws SQLException {
+  void migration_should_create_a_table() throws SQLException {
     db.assertTableDoesNotExist(TABLE_NAME);
 
     createExternalGroupsTable.execute();
@@ -53,7 +53,7 @@ public class CreateExternalGroupsTableIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     db.assertTableDoesNotExist(TABLE_NAME);
 
     createExternalGroupsTable.execute();
index 02c5bcc5f4dc6bdc934271d4be534c0ca1419036..3e110be239da522ac0145dfb0984a9d36377fdc4 100644 (file)
 package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.sonar.server.platform.db.migration.version.v101.CreateIndexForEmailOnUsersTable.COLUMN_NAME;
 import static org.sonar.server.platform.db.migration.version.v101.CreateIndexForEmailOnUsersTable.INDEX_NAME;
 import static org.sonar.server.platform.db.migration.version.v101.CreateIndexForEmailOnUsersTable.TABLE_NAME;
 
-public class CreateIndexForEmailOnUsersTableIT {
-  @Rule
+class CreateIndexForEmailOnUsersTableIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexForEmailOnUsersTable.class);
   private final CreateIndexForEmailOnUsersTable createIndexForEmailOnUsersTable = new CreateIndexForEmailOnUsersTable(db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME);
 
     createIndexForEmailOnUsersTable.execute();
@@ -43,7 +43,7 @@ public class CreateIndexForEmailOnUsersTableIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     createIndexForEmailOnUsersTable.execute();
     createIndexForEmailOnUsersTable.execute();
 
index a7b3583ce0e10130135845d5b18b605ad8e41e7d..b56221bd9c32752b8123a2b6063dce24ab60473c 100644 (file)
 package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.sonar.server.platform.db.migration.version.v101.CreateIndexForScmAccountOnScmAccountsTable.INDEX_NAME;
 import static org.sonar.server.platform.db.migration.version.v101.CreateScmAccountsTable.SCM_ACCOUNTS_TABLE_NAME;
 import static org.sonar.server.platform.db.migration.version.v101.CreateScmAccountsTable.SCM_ACCOUNT_COLUMN_NAME;
 
-public class CreateIndexForScmAccountOnScmAccountsTableIT {
-  @Rule
+class CreateIndexForScmAccountOnScmAccountsTableIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexForScmAccountOnScmAccountsTable.class);
   private final CreateIndexForScmAccountOnScmAccountsTable createIndexForScmAccountOnScmAccountsTable = new CreateIndexForScmAccountOnScmAccountsTable(db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist(SCM_ACCOUNTS_TABLE_NAME, INDEX_NAME);
 
     createIndexForScmAccountOnScmAccountsTable.execute();
@@ -43,7 +43,7 @@ public class CreateIndexForScmAccountOnScmAccountsTableIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     createIndexForScmAccountOnScmAccountsTable.execute();
     createIndexForScmAccountOnScmAccountsTable.execute();
 
index b03f1666ae1da74daef2441e4e3b18c897a0472f..af5067c52ed2419549f0e79d1e27f85d5b9ad427 100644 (file)
@@ -20,8 +20,8 @@
 package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.sonar.server.platform.db.migration.version.v101.CreateExternalGroupsTable.EXTERNAL_GROUP_ID_COLUMN_NAME;
@@ -29,15 +29,15 @@ import static org.sonar.server.platform.db.migration.version.v101.CreateExternal
 import static org.sonar.server.platform.db.migration.version.v101.CreateExternalGroupsTable.TABLE_NAME;
 import static org.sonar.server.platform.db.migration.version.v101.CreateIndexOnExternalIdAndIdentityOnExternalGroupsTable.INDEX_NAME;
 
-public class CreateIndexOnExternalIdAndIdentityOnExternalGroupsTableIT {
+class CreateIndexOnExternalIdAndIdentityOnExternalGroupsTableIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexOnExternalIdAndIdentityOnExternalGroupsTable.class);
   private final CreateIndexOnExternalIdAndIdentityOnExternalGroupsTable createIndexOnExternalIdAndIdentityOnExternalGroupsTable = new CreateIndexOnExternalIdAndIdentityOnExternalGroupsTable(
     db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME);
 
     createIndexOnExternalIdAndIdentityOnExternalGroupsTable.execute();
@@ -46,7 +46,7 @@ public class CreateIndexOnExternalIdAndIdentityOnExternalGroupsTableIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     createIndexOnExternalIdAndIdentityOnExternalGroupsTable.execute();
     createIndexOnExternalIdAndIdentityOnExternalGroupsTable.execute();
 
index 2c053f84b555b97abfc25506195f8182dc0e529c..15194eecb22c48aa4099034f5c1e5b4a9b650353 100644 (file)
 package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.VARCHAR;
 
-public class CreateProjectUuidInUserTokensIT {
+class CreateProjectUuidInUserTokensIT {
   private static final String TABLE_NAME = "user_tokens";
   private static final String COLUMN_NAME = "project_uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateProjectUuidInUserTokens.class);
   private final CreateProjectUuidInUserTokens underTest = new CreateProjectUuidInUserTokens(db.database());
 
   @Test
-  public void migration_creates_new_column() throws SQLException {
+  void migration_creates_new_column() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, 40, null);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
     underTest.execute();
     underTest.execute();
index 569728802cbb9c3a86129f2d7f0eb361ddf8d19c..c50058a0a3ed8ad37cba6041b23fec958ce9fb91 100644 (file)
@@ -21,8 +21,8 @@ package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
@@ -32,14 +32,14 @@ import static org.sonar.server.platform.db.migration.version.v101.CreateScmAccou
 import static org.sonar.server.platform.db.migration.version.v101.CreateScmAccountsTable.SCM_ACCOUNT_SIZE;
 import static org.sonar.server.platform.db.migration.version.v101.CreateScmAccountsTable.USER_UUID_COLUMN_NAME;
 
-public class CreateScmAccountsTableIT {
-  @Rule
+class CreateScmAccountsTableIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateScmAccountsTable.class);
 
   private final DdlChange createScmAccountsTable = new CreateScmAccountsTable(db.database());
 
   @Test
-  public void migration_should_create_a_table() throws SQLException {
+  void migration_should_create_a_table() throws SQLException {
     db.assertTableDoesNotExist(SCM_ACCOUNTS_TABLE_NAME);
 
     createScmAccountsTable.execute();
@@ -51,7 +51,7 @@ public class CreateScmAccountsTableIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     db.assertTableDoesNotExist(SCM_ACCOUNTS_TABLE_NAME);
 
     createScmAccountsTable.execute();
index c2fdd1a1f3523b8847e0e76fd1cc7bbd91e792b2..f7398476604e56fc672e70a4a96bcff1a50ccee8 100644 (file)
@@ -20,8 +20,8 @@
 package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.sonar.server.platform.db.migration.version.v101.AddReportSchedulesTable.TABLE_NAME;
@@ -30,13 +30,13 @@ import static org.sonar.server.platform.db.migration.version.v101.CreateUniqueIn
 import static org.sonar.server.platform.db.migration.version.v101.CreateUniqueIndexForReportSchedulesTable.INDEX_NAME;
 
 
-public class CreateUniqueIndexForReportSchedulesTableIT {
-  @Rule
+class CreateUniqueIndexForReportSchedulesTableIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateUniqueIndexForReportSchedulesTable.class);
   private final CreateUniqueIndexForReportSchedulesTable createUniqueIndexForReportSchedulesTable = new CreateUniqueIndexForReportSchedulesTable(db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME);
 
     createUniqueIndexForReportSchedulesTable.execute();
@@ -45,7 +45,7 @@ public class CreateUniqueIndexForReportSchedulesTableIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     createUniqueIndexForReportSchedulesTable.execute();
     createUniqueIndexForReportSchedulesTable.execute();
 
index 85fa8d27ad595625185e7201b3fbc3c6e363577c..96e509641a4651f5b113859e3f1c4837d11039c5 100644 (file)
@@ -20,8 +20,8 @@
 package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.sonar.server.platform.db.migration.version.v101.AddReportSubscriptionsTable.TABLE_NAME;
@@ -31,13 +31,13 @@ import static org.sonar.server.platform.db.migration.version.v101.CreateUniqueIn
 import static org.sonar.server.platform.db.migration.version.v101.CreateUniqueIndexForReportSubscriptionsTable.INDEX_NAME;
 
 
-public class CreateUniqueIndexForReportSubscriptionsTableIT {
-  @Rule
+class CreateUniqueIndexForReportSubscriptionsTableIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateUniqueIndexForReportSubscriptionsTable.class);
   private final CreateUniqueIndexForReportSubscriptionsTable createUniqueIndexForReportSubscriptionsTable = new CreateUniqueIndexForReportSubscriptionsTable(db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME);
 
     createUniqueIndexForReportSubscriptionsTable.execute();
@@ -46,7 +46,7 @@ public class CreateUniqueIndexForReportSubscriptionsTableIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     createUniqueIndexForReportSubscriptionsTable.execute();
     createUniqueIndexForReportSubscriptionsTable.execute();
 
index fca60dc3fe3619eb19ef2ca789dfa162ae3bfb14..6634561d79fde6973290a2bb2abba09b6afb3c9b 100644 (file)
@@ -21,28 +21,28 @@ package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
 import static org.sonar.server.platform.db.migration.version.v101.DropProjectKeyInUserTokens.COLUMN_NAME;
 import static org.sonar.server.platform.db.migration.version.v101.DropProjectKeyInUserTokens.TABLE_NAME;
 
-public class DropProjectKeyInUserTokensIT {
-  @Rule
+class DropProjectKeyInUserTokensIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropProjectKeyInUserTokens.class);
   private final DdlChange underTest = new DropProjectKeyInUserTokens(db.database());
 
   @Test
-  public void drops_column() throws SQLException {
+  void drops_column() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 255, true);
     underTest.execute();
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 255, true);
     underTest.execute();
     underTest.execute();
index ecf4d905b120fb819244378c3ba96bf4c84ecd85..be6f7fb5b1d8113c9ebfddb2f803c7169c8bdd5e 100644 (file)
@@ -21,29 +21,29 @@ package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
 import static org.sonar.server.platform.db.migration.version.v101.DropScmAccountsInUsers.COLUMN_NAME;
 import static org.sonar.server.platform.db.migration.version.v101.DropScmAccountsInUsers.TABLE_NAME;
 
-public class DropScmAccountsInUsersIT {
+class DropScmAccountsInUsersIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropScmAccountsInUsers.class);
   private final DdlChange dropScmAccountsInUsers = new DropScmAccountsInUsers(db.database());
 
   @Test
-  public void drops_column() throws SQLException {
+  void drops_column() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 4000, true);
     dropScmAccountsInUsers.execute();
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 4000, true);
     dropScmAccountsInUsers.execute();
     dropScmAccountsInUsers.execute();
index b09a2431d35d5580daea9f070ed176a97458bec7..c1d124b381ddfdb0f5e23f394a3c860d2d8206c2 100644 (file)
@@ -25,26 +25,26 @@ import java.util.Map;
 import java.util.Set;
 import javax.annotation.Nullable;
 import org.assertj.core.api.Assertions;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.api.resources.Qualifiers;
 import org.sonar.db.MigrationDbTester;
 
 import static java.util.stream.Collectors.toSet;
 
-public class FixDifferentUuidsForSubportfoliosIT {
+class FixDifferentUuidsForSubportfoliosIT {
   private static final String OLD_UUID = "differentSubPfUuid";
   private static final String SUB_PF_KEY = "subPfKey";
   private static final String NEW_SUBPF_UUID = "subPfUuid";
   private static final String PF_UUID = "pfUuid";
   private static final String NEW_CHILD_SUBPF_UUID = "childsubpfUuid";
   private static final String OLD_CHILD_SUBPF_UUID = "old_child_subpf_uuid";
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(FixDifferentUuidsForSubportfolios.class);
   private final FixDifferentUuidsForSubportfolios underTest = new FixDifferentUuidsForSubportfolios(db.database());
 
   @Test
-  public void execute_shouldUpdatePortfoliosAndPortfolioProjectsAndPortfolioReferenceTable() throws SQLException {
+  void execute_shouldUpdatePortfoliosAndPortfolioProjectsAndPortfolioReferenceTable() throws SQLException {
     insertPortfolio("pfKey", PF_UUID);
     insertComponent(SUB_PF_KEY, NEW_SUBPF_UUID, PF_UUID, Qualifiers.SUBVIEW);
     insertSubPortfolio(SUB_PF_KEY, PF_UUID, PF_UUID, OLD_UUID);
@@ -59,7 +59,7 @@ public class FixDifferentUuidsForSubportfoliosIT {
   }
 
   @Test
-  public void execute_shouldBeRentrant() throws SQLException {
+  void execute_shouldBeRentrant() throws SQLException {
     insertPortfolio("pfKey", PF_UUID);
     insertComponent(SUB_PF_KEY, NEW_SUBPF_UUID, PF_UUID, Qualifiers.SUBVIEW);
     insertSubPortfolio(SUB_PF_KEY, PF_UUID, PF_UUID, OLD_UUID);
@@ -75,7 +75,7 @@ public class FixDifferentUuidsForSubportfoliosIT {
   }
 
   @Test
-  public void execute_shouldFixUuidForSubPortfolioAtDifferentLevels() throws SQLException {
+  void execute_shouldFixUuidForSubPortfolioAtDifferentLevels() throws SQLException {
     insertPortfolio("pfKey", PF_UUID);
 
     insertComponent(SUB_PF_KEY, NEW_SUBPF_UUID, PF_UUID, Qualifiers.SUBVIEW);
index ad2f2cf9cc719ac95b058065bcdefdf88c9c12f3..86f481245c41392fb7801f2c4e006ed88c66b3dd 100644 (file)
@@ -20,8 +20,8 @@
 package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.VARCHAR;
@@ -29,21 +29,21 @@ import static org.sonar.server.platform.db.migration.version.v101.IncreaseKeeCol
 import static org.sonar.server.platform.db.migration.version.v101.IncreaseKeeColumnSizeInInternalProperties.NEW_COLUMN_SIZE;
 import static org.sonar.server.platform.db.migration.version.v101.IncreaseKeeColumnSizeInInternalProperties.TABLE_NAME;
 
-public class IncreaseKeeColumnSizeInInternalPropertiesIT {
+class IncreaseKeeColumnSizeInInternalPropertiesIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(IncreaseKeeColumnSizeInInternalProperties.class);
   private final IncreaseKeeColumnSizeInInternalProperties underTest = new IncreaseKeeColumnSizeInInternalProperties(db.database());
 
   @Test
-  public void execute_increaseColumnSize() throws SQLException {
+  void execute_increaseColumnSize() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, 20, false);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, NEW_COLUMN_SIZE, false);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, 20, false);
     underTest.execute();
     underTest.execute();
index efdf026f8443cc11faa888ac61c793a759ad3b9a..df0e785c2b1ac5d0fadf23cb1082efbc0222c1f3 100644 (file)
@@ -20,8 +20,8 @@
 package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.VARCHAR;
@@ -29,21 +29,21 @@ import static org.sonar.server.platform.db.migration.version.v101.IncreaseTaskTy
 import static org.sonar.server.platform.db.migration.version.v101.IncreaseTaskTypeColumnSizeInCeActivity.NEW_COLUMN_SIZE;
 import static org.sonar.server.platform.db.migration.version.v101.IncreaseTaskTypeColumnSizeInCeActivity.TABLE_NAME;
 
-public class IncreaseTaskTypeColumnSizeInCeActivityIT {
+class IncreaseTaskTypeColumnSizeInCeActivityIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(IncreaseTaskTypeColumnSizeInCeActivity.class);
   private final IncreaseTaskTypeColumnSizeInCeActivity underTest = new IncreaseTaskTypeColumnSizeInCeActivity(db.database());
 
   @Test
-  public void execute_increaseColumnSize() throws SQLException {
+  void execute_increaseColumnSize() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, 15, false);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, NEW_COLUMN_SIZE, false);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, 15, false);
     underTest.execute();
     underTest.execute();
index 7a5f2f2b4bc32692a3df9b0658c5518fe8c912b7..7aa1d4f40e7cf7be8f610d44ee9e2f8edb42c2d7 100644 (file)
@@ -20,8 +20,8 @@
 package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.VARCHAR;
@@ -29,21 +29,21 @@ import static org.sonar.server.platform.db.migration.version.v101.IncreaseTaskTy
 import static org.sonar.server.platform.db.migration.version.v101.IncreaseTaskTypeColumnSizeInCeQueue.NEW_COLUMN_SIZE;
 import static org.sonar.server.platform.db.migration.version.v101.IncreaseTaskTypeColumnSizeInCeQueue.TABLE_NAME;
 
-public class IncreaseTaskTypeColumnSizeInCeQueueIT {
+class IncreaseTaskTypeColumnSizeInCeQueueIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(IncreaseTaskTypeColumnSizeInCeQueue.class);
   private final IncreaseTaskTypeColumnSizeInCeQueue underTest = new IncreaseTaskTypeColumnSizeInCeQueue(db.database());
 
   @Test
-  public void execute_increaseColumnSize() throws SQLException {
+  void execute_increaseColumnSize() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, 15, false);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, NEW_COLUMN_SIZE, false);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, 15, false);
     underTest.execute();
     underTest.execute();
index 581bf7f5bec25f889cf45a7835171c0a243105f3..5832df0d2bf84c49d58b6372aa75792d7b0f6c61 100644 (file)
@@ -25,8 +25,8 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import javax.annotation.Nullable;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.core.util.UuidFactory;
 import org.sonar.core.util.UuidFactoryFast;
 import org.sonar.db.MigrationDbTester;
@@ -39,19 +39,19 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatNoException;
 import static org.sonar.server.platform.db.migration.version.v101.MigrateScmAccountsFromUsersToScmAccounts.SCM_ACCOUNTS_SEPARATOR_CHAR;
 
-public class MigrateScmAccountsFromUsersToScmAccountsIT {
+class MigrateScmAccountsFromUsersToScmAccountsIT {
 
   private static final UuidFactory UUID_FACTORY = UuidFactoryFast.getInstance();
   private static final String SCM_ACCOUNT1 = "scmaccount";
   private static final String SCM_ACCOUNT2 = "scmaccount2";
   private static final String SCM_ACCOUNT_CAMELCASE = "scmAccount3";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(MigrateScmAccountsFromUsersToScmAccounts.class);
   private final DataChange migrateScmAccountsFromUsersToScmAccounts = new MigrateScmAccountsFromUsersToScmAccounts(db.database());
 
   @Test
-  public void execute_whenUserHasNullScmAccounts_doNotInsertInScmAccounts() throws SQLException {
+  void execute_whenUserHasNullScmAccounts_doNotInsertInScmAccounts() throws SQLException {
     insertUserAndGetUuid(null);
 
     migrateScmAccountsFromUsersToScmAccounts.execute();
@@ -61,7 +61,7 @@ public class MigrateScmAccountsFromUsersToScmAccountsIT {
   }
 
   @Test
-  public void execute_whenUserHasEmptyScmAccounts_doNotInsertInScmAccounts() throws SQLException {
+  void execute_whenUserHasEmptyScmAccounts_doNotInsertInScmAccounts() throws SQLException {
     insertUserAndGetUuid("");
 
     migrateScmAccountsFromUsersToScmAccounts.execute();
@@ -71,7 +71,7 @@ public class MigrateScmAccountsFromUsersToScmAccountsIT {
   }
 
   @Test
-  public void execute_whenUserHasEmptyScmAccountsWithOneSeparator_doNotInsertInScmAccounts() throws SQLException {
+  void execute_whenUserHasEmptyScmAccountsWithOneSeparator_doNotInsertInScmAccounts() throws SQLException {
     insertUserAndGetUuid(String.valueOf(SCM_ACCOUNTS_SEPARATOR_CHAR));
 
     migrateScmAccountsFromUsersToScmAccounts.execute();
@@ -81,7 +81,7 @@ public class MigrateScmAccountsFromUsersToScmAccountsIT {
   }
 
   @Test
-  public void execute_whenUserHasEmptyScmAccountsWithTwoSeparators_doNotInsertInScmAccounts() throws SQLException {
+  void execute_whenUserHasEmptyScmAccountsWithTwoSeparators_doNotInsertInScmAccounts() throws SQLException {
     insertUserAndGetUuid(SCM_ACCOUNTS_SEPARATOR_CHAR + String.valueOf(SCM_ACCOUNTS_SEPARATOR_CHAR));
 
     migrateScmAccountsFromUsersToScmAccounts.execute();
@@ -91,7 +91,7 @@ public class MigrateScmAccountsFromUsersToScmAccountsIT {
   }
 
   @Test
-  public void execute_whenUserHasOneScmAccountWithoutSeparator_insertsInScmAccounts() throws SQLException {
+  void execute_whenUserHasOneScmAccountWithoutSeparator_insertsInScmAccounts() throws SQLException {
     String userUuid = insertUserAndGetUuid(SCM_ACCOUNT1);
 
     migrateScmAccountsFromUsersToScmAccounts.execute();
@@ -101,7 +101,7 @@ public class MigrateScmAccountsFromUsersToScmAccountsIT {
   }
 
   @Test
-  public void execute_whenUserHasOneScmAccountWithSeparators_insertsInScmAccounts() throws SQLException {
+  void execute_whenUserHasOneScmAccountWithSeparators_insertsInScmAccounts() throws SQLException {
     String userUuid = insertUserAndGetUuid(format("%s%s%s", SCM_ACCOUNTS_SEPARATOR_CHAR, SCM_ACCOUNT1, SCM_ACCOUNTS_SEPARATOR_CHAR));
 
     migrateScmAccountsFromUsersToScmAccounts.execute();
@@ -111,7 +111,7 @@ public class MigrateScmAccountsFromUsersToScmAccountsIT {
   }
 
   @Test
-  public void execute_whenUserHasOneScmAccountWithMixedCase_insertsInScmAccountsInLowerCase() throws SQLException {
+  void execute_whenUserHasOneScmAccountWithMixedCase_insertsInScmAccountsInLowerCase() throws SQLException {
     String userUuid = insertUserAndGetUuid(format("%s%s%s", SCM_ACCOUNTS_SEPARATOR_CHAR, SCM_ACCOUNT_CAMELCASE, SCM_ACCOUNTS_SEPARATOR_CHAR));
 
     migrateScmAccountsFromUsersToScmAccounts.execute();
@@ -121,7 +121,7 @@ public class MigrateScmAccountsFromUsersToScmAccountsIT {
   }
 
   @Test
-  public void execute_whenUserHasTwoScmAccount_insertsInScmAccounts() throws SQLException {
+  void execute_whenUserHasTwoScmAccount_insertsInScmAccounts() throws SQLException {
     String userUuid = insertUserAndGetUuid(format("%s%s%s%s%s",
       SCM_ACCOUNTS_SEPARATOR_CHAR, SCM_ACCOUNT1, SCM_ACCOUNTS_SEPARATOR_CHAR, SCM_ACCOUNT2, SCM_ACCOUNTS_SEPARATOR_CHAR));
 
@@ -135,7 +135,7 @@ public class MigrateScmAccountsFromUsersToScmAccountsIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     String userUuid = insertUserAndGetUuid(SCM_ACCOUNT1);
 
     migrateScmAccountsFromUsersToScmAccounts.execute();
@@ -146,7 +146,7 @@ public class MigrateScmAccountsFromUsersToScmAccountsIT {
   }
 
   @Test
-  public void migration_should_be_reentrant_if_scm_account_column_dropped() {
+  void migration_should_be_reentrant_if_scm_account_column_dropped() {
     db.executeDdl("alter table users drop column scm_accounts");
 
     assertThatNoException().isThrownBy(migrateScmAccountsFromUsersToScmAccounts::execute);
index 956cfbda16f9991ae4b770fec8b50a8628005a66..81deca542e4a732f975b536acb0b8854c11f3948 100644 (file)
@@ -23,8 +23,8 @@ import java.sql.SQLException;
 import java.util.HashMap;
 import java.util.Map;
 import javax.annotation.Nullable;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.core.util.UuidFactory;
 import org.sonar.core.util.UuidFactoryFast;
 import org.sonar.db.MigrationDbTester;
@@ -33,16 +33,16 @@ import org.sonar.server.platform.db.migration.step.DataChange;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.groups.Tuple.tuple;
 
-public class PopulateProjectUuidInUserTokensIT {
+class PopulateProjectUuidInUserTokensIT {
   private final UuidFactory uuidFactory = UuidFactoryFast.getInstance();
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulateProjectUuidInUserTokens.class);
 
   private final DataChange underTest = new PopulateProjectUuidInUserTokens(db.database());
 
   @Test
-  public void migration_populates_project_uuid_for_tokens() throws SQLException {
+  void migration_populates_project_uuid_for_tokens() throws SQLException {
     String project1Uuid = insertProject("project1");
     String project2Uuid = insertProject("project2");
 
@@ -62,7 +62,7 @@ public class PopulateProjectUuidInUserTokensIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     String project1Uuid = insertProject("project1");
     String project2Uuid = insertProject("project2");
 
index 5cd05bd2230d1381536139f9f0ab67c3733bcaad..e121b2b2381874b5cb7e61e812a33b2e4df539cc 100644 (file)
@@ -20,8 +20,8 @@
 package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.core.util.UuidFactory;
 import org.sonar.core.util.UuidFactoryFast;
 import org.sonar.db.MigrationDbTester;
@@ -30,15 +30,15 @@ import org.sonar.server.platform.db.migration.step.DataChange;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.tuple;
 
-public class PopulateReportSchedulesIT {
-  @Rule
+class PopulateReportSchedulesIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulateReportSchedules.class);
 
   private final UuidFactory uuidFactory = UuidFactoryFast.getInstance();
   private final DataChange underTest = new PopulateReportSchedules(db.database());
 
   @Test
-  public void execute_shouldPopulateFromPortfolioProperties() throws SQLException {
+  void execute_shouldPopulateFromPortfolioProperties() throws SQLException {
     insertPortfolio("uuid1");
     insertPortfolioProperty("uuid1", "1234");
 
@@ -50,7 +50,7 @@ public class PopulateReportSchedulesIT {
   }
 
   @Test
-  public void execute_shouldPopulateFromBranchProperties() throws SQLException {
+  void execute_shouldPopulateFromBranchProperties() throws SQLException {
     insertBranch("uuid1");
     insertProjectBranchProperty("uuid1", "1234");
 
@@ -62,7 +62,7 @@ public class PopulateReportSchedulesIT {
   }
 
   @Test
-  public void execute_whenPropertyMatchesBothBranchAndPortfolio_shouldNotPopulate() throws SQLException {
+  void execute_whenPropertyMatchesBothBranchAndPortfolio_shouldNotPopulate() throws SQLException {
     insertBranch("uuid1");
     insertPortfolio("uuid1");
     insertProjectBranchProperty("uuid1", "1234");
index e122c3e700b297c268e9ee51270a80b78931b1ec..9844e08d85eb6fa64b1bcab560c531f677167ca3 100644 (file)
@@ -20,8 +20,8 @@
 package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.core.util.UuidFactory;
 import org.sonar.core.util.UuidFactoryFast;
 import org.sonar.db.MigrationDbTester;
@@ -30,15 +30,15 @@ import org.sonar.server.platform.db.migration.step.DataChange;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.tuple;
 
-public class PopulateReportSubscriptionsIT {
-  @Rule
+class PopulateReportSubscriptionsIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulateReportSubscriptions.class);
 
   private final UuidFactory uuidFactory = UuidFactoryFast.getInstance();
   private final DataChange underTest = new PopulateReportSubscriptions(db.database());
 
   @Test
-  public void execute_shouldPopulateFromPortfolioProperties() throws SQLException {
+  void execute_shouldPopulateFromPortfolioProperties() throws SQLException {
     insertPortfolio("uuid1");
     insertPortfolioProperty("uuid1", "1234");
 
@@ -50,7 +50,7 @@ public class PopulateReportSubscriptionsIT {
   }
 
   @Test
-  public void execute_shouldPopulateFromBranchProperties() throws SQLException {
+  void execute_shouldPopulateFromBranchProperties() throws SQLException {
     insertBranch("uuid1");
     insertBranchProperty("uuid1", "1234");
 
@@ -62,7 +62,7 @@ public class PopulateReportSubscriptionsIT {
   }
 
   @Test
-  public void execute_whenPropertyMatchesBothBranchAndPortfolio_shouldNotPopulate() throws SQLException {
+  void execute_whenPropertyMatchesBothBranchAndPortfolio_shouldNotPopulate() throws SQLException {
     insertBranch("uuid1");
     insertPortfolio("uuid1");
     insertBranchProperty("uuid1", "1234");
index 12221063acf7451f0d23d86c77a7713bad9abc4e..1c126124a5bb18743b8257d96b36c7dd79ecee9a 100644 (file)
@@ -23,8 +23,8 @@ import java.sql.SQLException;
 import java.util.HashMap;
 import java.util.Map;
 import javax.annotation.Nullable;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.core.util.UuidFactory;
 import org.sonar.core.util.UuidFactoryFast;
 import org.sonar.db.MigrationDbTester;
@@ -32,16 +32,16 @@ import org.sonar.server.platform.db.migration.step.DataChange;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-public class RemoveOrphanUserTokensIT {
+class RemoveOrphanUserTokensIT {
   private final UuidFactory uuidFactory = UuidFactoryFast.getInstance();
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RemoveOrphanUserTokens.class);
 
   private final DataChange underTest = new RemoveOrphanUserTokens(db.database());
 
   @Test
-  public void migration_deletes_orphan_tokens() throws SQLException {
+  void migration_deletes_orphan_tokens() throws SQLException {
     String project1Uuid = insertProject("project1");
 
     String token1Uuid = insertUserToken("project1");
@@ -55,7 +55,7 @@ public class RemoveOrphanUserTokensIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     String project1Uuid = insertProject("project1");
 
     String token1Uuid = insertUserToken("project1");
index 7514f6da085a5f8cbb98ef4fdca874c02dd1c7f6..71a9d4d412d74e8eb09f0775ff026f6eec626ad7 100644 (file)
@@ -20,8 +20,8 @@
 package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.core.util.UuidFactory;
 import org.sonar.core.util.UuidFactoryFast;
 import org.sonar.db.MigrationDbTester;
@@ -29,13 +29,13 @@ import org.sonar.server.platform.db.migration.step.DataChange;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-public class RemoveReportPropertiesIT {
+class RemoveReportPropertiesIT {
 
   private static final String SONAR_GOVERNANCE_REPORT_USER_NOTIFICATION = "sonar.governance.report.userNotification";
   private static final String SONAR_GOVERNANCE_REPORT_PROJECT_BRANCH_USER_NOTIFICATION = "sonar.governance.report.project.branch.userNotification";
   private static final String SONAR_GOVERNANCE_REPORT_LAST_SEND_TIME_IN_MS = "sonar.governance.report.lastSendTimeInMs";
   private static final String SONAR_GOVERNANCE_REPORT_PROJECT_BRANCH_LAST_SEND_TIME_IN_MS = "sonar.governance.report.project.branch.lastSendTimeInMs";
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RemoveReportProperties.class);
 
   private final DataChange underTest = new RemoveReportProperties(db.database());
@@ -43,7 +43,7 @@ public class RemoveReportPropertiesIT {
   private final UuidFactory uuidFactory = UuidFactoryFast.getInstance();
 
   @Test
-  public void execute_shouldRemoveRelevantPropertiesFromTable() throws SQLException {
+  void execute_shouldRemoveRelevantPropertiesFromTable() throws SQLException {
     insertProperty( "branch_uuid", "user_uuid", SONAR_GOVERNANCE_REPORT_USER_NOTIFICATION, "true");
     insertProperty( "portfolio_uuid", "user_uuid", SONAR_GOVERNANCE_REPORT_PROJECT_BRANCH_USER_NOTIFICATION, "true");
     insertProperty( "branch_uuid", "user_uuid", SONAR_GOVERNANCE_REPORT_LAST_SEND_TIME_IN_MS, "12");
@@ -57,7 +57,7 @@ public class RemoveReportPropertiesIT {
   }
 
   @Test
-  public void execute_shouldBeIdempotent() throws SQLException {
+  void execute_shouldBeIdempotent() throws SQLException {
     insertProperty( "branch_uuid", "user_uuid", SONAR_GOVERNANCE_REPORT_USER_NOTIFICATION, "true");
     insertProperty( "portfolio_uuid", "user_uuid", SONAR_GOVERNANCE_REPORT_PROJECT_BRANCH_USER_NOTIFICATION, "true");
 
index b3a5dbb67cf0dab5e923d7c0bd932499da31487b..858359f96bbc16bb6026344385abd9b8fc8bd6cd 100644 (file)
 package org.sonar.server.platform.db.migration.version.v101;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.VARCHAR;
 
-public class RenameColumnComponentUuidInPropertiesIT {
+class RenameColumnComponentUuidInPropertiesIT {
 
   public static final String TABLE_NAME = "properties";
   public static final String NEW_COLUMN_NAME = "entity_uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RenameColumnComponentUuidInProperties.class);
   private final RenameColumnComponentUuidInProperties underTest = new RenameColumnComponentUuidInProperties(db.database());
 
   @Test
-  public void columnIsRenamed() throws SQLException {
+  void columnIsRenamed() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, NEW_COLUMN_NAME);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, NEW_COLUMN_NAME, VARCHAR, 40, true);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, NEW_COLUMN_NAME);
     underTest.execute();
     underTest.execute();
index 5ffcbf95f84841ed54b0cfe7c61af14bc970357f..a4c5310ac2bc3d38d1c388436f3ea50a78b91ace 100644 (file)
@@ -22,8 +22,8 @@ package org.sonar.server.platform.db.migration.version.v101;
 import java.sql.SQLException;
 import java.util.HashMap;
 import java.util.Map;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.core.util.UuidFactory;
 import org.sonar.core.util.UuidFactoryFast;
 import org.sonar.db.MigrationDbTester;
@@ -31,11 +31,11 @@ import org.sonar.server.platform.db.migration.step.DataChange;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-public class UpdateIsMainColumnInProjectBranchesIT {
+class UpdateIsMainColumnInProjectBranchesIT {
 
   private final UuidFactory uuidFactory = UuidFactoryFast.getInstance();
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(UpdateIsMainColumnInProjectBranches.class);
 
   private final DataChange underTest = new UpdateIsMainColumnInProjectBranches(db.database());
@@ -43,7 +43,7 @@ public class UpdateIsMainColumnInProjectBranchesIT {
   private static int not_random_value_always_incremented = 0;
 
   @Test
-  public void migration_updates_is_main_if_row_has_the_same_uuids() throws SQLException {
+  void migration_updates_is_main_if_row_has_the_same_uuids() throws SQLException {
     String branchUuid1 = insertProjectBranch(true);
     String branchUuid2 = insertProjectBranch(false);
 
@@ -54,7 +54,7 @@ public class UpdateIsMainColumnInProjectBranchesIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     String branchUuid1 = insertProjectBranch(true);
     String branchUuid2 = insertProjectBranch(false);
 
index 8aa39e3409583a82164ccc74e6a63e672d86dd30..c67e56748538ac22880db28fbe15fc68af906641 100644 (file)
@@ -21,28 +21,28 @@ package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
-public class AddCleanCodeAttributeInRulesIT {
+class AddCleanCodeAttributeInRulesIT {
   private static final String TABLE_NAME = "rules";
   private static final String COLUMN_NAME = "clean_code_attribute";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddCleanCodeAttributeInRules.class);
 
   private final AddCleanCodeAttributeInRules underTest = new AddCleanCodeAttributeInRules(db.database());
 
   @Test
-  public void execute_whenColumnDoesNotExist_shouldCreateColumn() throws SQLException {
+  void execute_whenColumnDoesNotExist_shouldCreateColumn() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 40, true);
   }
 
   @Test
-  public void execute_whenExecutedTwice_shouldNotFail() throws SQLException {
+  void execute_whenExecutedTwice_shouldNotFail() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
     underTest.execute();
     underTest.execute();
index 680cc12081631ac2887593c99d03e19bf9a7908d..a3a8a410d42948c1d2c6eb030e31b05cfb27aa65 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.slf4j.event.Level;
-import org.sonar.api.testfixtures.log.LogTester;
+import org.sonar.api.testfixtures.log.LogTesterJUnit5;
 import org.sonar.api.utils.System2;
 import org.sonar.core.util.UuidFactoryFast;
 import org.sonar.db.MigrationDbTester;
@@ -34,22 +34,22 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonar.server.platform.db.migration.version.v102.AddUserConsentRequiredIfGithubAutoProvisioningEnabled.PROP_KEY;
 import static org.sonar.server.platform.db.migration.version.v102.AddUserConsentRequiredIfGithubAutoProvisioningEnabled.PROVISIONING_GITHUB_ENABLED_PROP_KEY;
 
-public class AddUserConsentRequiredIfGithubAutoProvisioningEnabledIT {
+class AddUserConsentRequiredIfGithubAutoProvisioningEnabledIT {
 
-  @Rule
-  public LogTester logger = new LogTester();
+  @RegisterExtension
+  public final LogTesterJUnit5 logger = new LogTesterJUnit5();
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddUserConsentRequiredIfGithubAutoProvisioningEnabled.class);
   private final DataChange underTest = new AddUserConsentRequiredIfGithubAutoProvisioningEnabled(db.database(), new System2(), UuidFactoryFast.getInstance());
 
-  @Before
+  @BeforeEach
   public void before() {
     logger.clear();
   }
 
   @Test
-  public void migration_whenGitHubAutoProvisioningPropertyNotPresent_shouldNotRequireConsent() throws SQLException {
+  void migration_whenGitHubAutoProvisioningPropertyNotPresent_shouldNotRequireConsent() throws SQLException {
     underTest.execute();
 
     assertThat(logger.logs(Level.WARN)).isEmpty();
@@ -57,7 +57,7 @@ public class AddUserConsentRequiredIfGithubAutoProvisioningEnabledIT {
   }
 
   @Test
-  public void migration_whenGitHubAutoProvisioningDisabled_shouldNotRequireConsent() throws SQLException {
+  void migration_whenGitHubAutoProvisioningDisabled_shouldNotRequireConsent() throws SQLException {
     disableGithubProvisioning();
     underTest.execute();
 
@@ -66,7 +66,7 @@ public class AddUserConsentRequiredIfGithubAutoProvisioningEnabledIT {
   }
 
   @Test
-  public void migration_whenGitHubAutoProvisioningEnabled_shouldRequireConsent() throws SQLException {
+  void migration_whenGitHubAutoProvisioningEnabled_shouldRequireConsent() throws SQLException {
     enableGithubProvisioning();
 
     underTest.execute();
@@ -77,7 +77,7 @@ public class AddUserConsentRequiredIfGithubAutoProvisioningEnabledIT {
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     enableGithubProvisioning();
 
     underTest.execute();
index 3523a9bc70e899d571f45248d1a97b50da14e59a..8502eb784bb75844de0b276082fd28d98271ca78 100644 (file)
@@ -21,8 +21,8 @@ package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
@@ -31,14 +31,14 @@ import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.USER_U
 import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE;
 import static org.sonar.server.platform.db.migration.version.v102.CreateAnticipatedTransitionsTable.ANTICIPATED_TRANSITIONS_TABLE_NAME;
 
-public class CreateAnticipatedTransitionsTableIT {
-  @Rule
+class CreateAnticipatedTransitionsTableIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateAnticipatedTransitionsTable.class);
 
   private final DdlChange createAnticipatedTransitionsTable = new CreateAnticipatedTransitionsTable(db.database());
 
   @Test
-  public void migration_should_create_a_table() throws SQLException {
+  void migration_should_create_a_table() throws SQLException {
     db.assertTableDoesNotExist(ANTICIPATED_TRANSITIONS_TABLE_NAME);
 
     createAnticipatedTransitionsTable.execute();
@@ -58,7 +58,7 @@ public class CreateAnticipatedTransitionsTableIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     db.assertTableDoesNotExist(ANTICIPATED_TRANSITIONS_TABLE_NAME);
 
     createAnticipatedTransitionsTable.execute();
index 8bdcec97eb61c503da35ae672189413dd7d2be5c..9e1b00b27f6b8c83d3b0abe99283821b1a36fb73 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.BOOLEAN;
 
-public class CreateBooleanPurgedColumnInSnapshotsIT {
+class CreateBooleanPurgedColumnInSnapshotsIT {
 
   private static final String TABLE_NAME = "snapshots";
   private static final String COLUMN_NAME = "purged";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateBooleanPurgedColumnInSnapshots.class);
 
   private final CreateBooleanPurgedColumnInSnapshots underTest = new CreateBooleanPurgedColumnInSnapshots(db.database());
 
   @Test
-  public void execute_whenColumnDoesNotExist_shouldCreatePurgedColumn() throws SQLException {
+  void execute_whenColumnDoesNotExist_shouldCreatePurgedColumn() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, BOOLEAN, null, null);
   }
 
   @Test
-  public void execute_whenExecutedTwice_shouldNotFail() throws SQLException {
+  void execute_whenExecutedTwice_shouldNotFail() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
     underTest.execute();
     underTest.execute();
index 0a64062bcc086096faf8cb827f224cf95ff79269..e75a7871cf1bd75ccd8da483af5fd701b22e9711 100644 (file)
@@ -21,8 +21,8 @@ package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
@@ -31,13 +31,13 @@ import static org.sonar.server.platform.db.migration.version.v102.CreateGithubOr
 import static org.sonar.server.platform.db.migration.version.v102.CreateGithubOrganizationsGroupsTable.ORGANIZATION_COLUMN_NAME;
 import static org.sonar.server.platform.db.migration.version.v102.CreateGithubOrganizationsGroupsTable.TABLE_NAME;
 
-public class CreateGithubOrganizationsGroupsTableIT {
-  @Rule
+class CreateGithubOrganizationsGroupsTableIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateGithubOrganizationsGroupsTable.class);
   private final DdlChange createGithubOrganizationsGroupsTable = new CreateGithubOrganizationsGroupsTable(db.database());
 
   @Test
-  public void migration_should_create_a_table() throws SQLException {
+  void migration_should_create_a_table() throws SQLException {
     db.assertTableDoesNotExist(TABLE_NAME);
 
     createGithubOrganizationsGroupsTable.execute();
@@ -49,7 +49,7 @@ public class CreateGithubOrganizationsGroupsTableIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     db.assertTableDoesNotExist(TABLE_NAME);
 
     createGithubOrganizationsGroupsTable.execute();
index 64a2f92532ea8c0ed49064c1752199762e47fefe..0e5a518f38bdb524c868239758cba78d1f564651 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
-public class CreateIndexCreatedAtInWebhookDeliveriesIT {
+class CreateIndexCreatedAtInWebhookDeliveriesIT {
 
   public static final String TABLE_NAME = "webhook_deliveries";
   public static final String INDEX_NAME = "wd_created_at";
   public static final String EXPECTED_COLUMN = "created_at";
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexCreatedAtInWebhookDeliveries.class);
   private final DdlChange createIndex = new CreateIndexCreatedAtInWebhookDeliveries(db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME);
 
     createIndex.execute();
@@ -44,7 +44,7 @@ public class CreateIndexCreatedAtInWebhookDeliveriesIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     createIndex.execute();
     createIndex.execute();
 
index 6b98a3e4b9a003e85d71758f87c59290cf5edb2e..fc2b0a945b4f75b90272da44ab75495119137c83 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
-public class CreateIndexEntityUuidInCeActivityIT {
-  @Rule
+class CreateIndexEntityUuidInCeActivityIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexEntityUuidInCeActivity.class);
   private final CreateIndexEntityUuidInCeActivity createIndex = new CreateIndexEntityUuidInCeActivity(db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist("ce_activity", "ce_activity_entity_uuid");
 
     createIndex.execute();
@@ -39,7 +39,7 @@ public class CreateIndexEntityUuidInCeActivityIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     createIndex.execute();
     createIndex.execute();
 
index 24d8a20d52206685a0cddeade02637190df311dc..e743789a5797e74461dc2d6a32a9e61357c11fab 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
-public class CreateIndexEntityUuidInCeQueueIT {
-  @Rule
+class CreateIndexEntityUuidInCeQueueIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexEntityUuidInCeQueue.class);
   private final CreateIndexEntityUuidInCeQueue createIndex = new CreateIndexEntityUuidInCeQueue(db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist("ce_queue", "ce_queue_entity_uuid");
 
     createIndex.execute();
@@ -39,7 +39,7 @@ public class CreateIndexEntityUuidInCeQueueIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     createIndex.execute();
     createIndex.execute();
 
index 71845c4bb2ad1d32f472f7dbcb9a218aabcd89cc..55b4ff0de1d4a9e65e47b37a87a7994c8921f3a8 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
-public class CreateIndexEntityUuidInGroupRolesIT {
-  @Rule
+class CreateIndexEntityUuidInGroupRolesIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexEntityUuidInGroupRoles.class);
   private final CreateIndexEntityUuidInGroupRoles createIndex = new CreateIndexEntityUuidInGroupRoles(db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist("group_roles", "group_roles_entity_uuid");
 
     createIndex.execute();
@@ -39,7 +39,7 @@ public class CreateIndexEntityUuidInGroupRolesIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     createIndex.execute();
     createIndex.execute();
 
index 4f6b1555645d1d1b364b0270228e6ff122f91533..e737ea653ad5fcf9837289fecdc195e42fca5a0a 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
-public class CreateIndexEntityUuidInUserRolesIT {
-  @Rule
+class CreateIndexEntityUuidInUserRolesIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexEntityUuidInUserRoles.class);
   private final CreateIndexEntityUuidInUserRoles createIndex = new CreateIndexEntityUuidInUserRoles(db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist("user_roles", "user_roles_entity_uuid");
 
     createIndex.execute();
@@ -39,7 +39,7 @@ public class CreateIndexEntityUuidInUserRolesIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     createIndex.execute();
     createIndex.execute();
 
index 0425192ab12a3db67704655a111e474d1cc8dc23..3e3556653a1d707d06c6d955957ded4cbf4db03a 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
-public class CreateIndexProjectUuidCreatedAtInWebhookDeliveriesIT {
+class CreateIndexProjectUuidCreatedAtInWebhookDeliveriesIT {
 
   public static final String TABLE_NAME = "webhook_deliveries";
   public static final String INDEX_NAME = "wd_project_uuid_created_at";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexProjectUuidCreatedAtInWebhookDeliveries.class);
   private final DdlChange createIndex = new CreateIndexProjectUuidCreatedAtInWebhookDeliveries(db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME);
 
     createIndex.execute();
@@ -44,7 +44,7 @@ public class CreateIndexProjectUuidCreatedAtInWebhookDeliveriesIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     createIndex.execute();
     createIndex.execute();
 
index ad44b2c68515561e1440b746d984599b9e1ee103..38b4e265bd2ed983404fef00ee36201195fa6c3d 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 
 
-public class CreateIndexProjectUuidInProjectBranchesIT {
-  @Rule
+class CreateIndexProjectUuidInProjectBranchesIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexProjectUuidInProjectBranches.class);
   private final CreateIndexProjectUuidInProjectBranches createIndex = new CreateIndexProjectUuidInProjectBranches(db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist("project_branches", "project_branches_project_uuid");
 
     createIndex.execute();
@@ -41,7 +41,7 @@ public class CreateIndexProjectUuidInProjectBranchesIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     createIndex.execute();
     createIndex.execute();
 
index ca8b2985236889b041ccd4dfad68f0cf6755ca2b..04b14d0ecd75dbb5ca86e11e2cd2621fd537053a 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 
 
-public class CreateIndexRootComponentUuidInSnapshotsIT {
-  @Rule
+class CreateIndexRootComponentUuidInSnapshotsIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexRootComponentUuidInSnapshots.class);
   private final CreateIndexRootComponentUuidInSnapshots createIndex = new CreateIndexRootComponentUuidInSnapshots(db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist("snapshots", "snapshots_root_component_uuid");
 
     createIndex.execute();
@@ -41,7 +41,7 @@ public class CreateIndexRootComponentUuidInSnapshotsIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     createIndex.execute();
     createIndex.execute();
 
index e73cd2d789d2f3a3b789947c50fa828bebe309dd..64c9930db589f110d93e5f2993128906f1ec2079 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
-public class CreateIndexTaskUuidCreatedAtInWebhookDeliveriesIT {
+class CreateIndexTaskUuidCreatedAtInWebhookDeliveriesIT {
 
   public static final String TABLE_NAME = "webhook_deliveries";
   public static final String INDEX_NAME = "wd_ce_task_uuid_created_at";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexTaskUuidCreatedAtInWebhookDeliveries.class);
   private final DdlChange createIndex = new CreateIndexTaskUuidCreatedAtInWebhookDeliveries(db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME);
 
     createIndex.execute();
@@ -44,7 +44,7 @@ public class CreateIndexTaskUuidCreatedAtInWebhookDeliveriesIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     createIndex.execute();
     createIndex.execute();
 
index 9b11b1a8b20276e7060b4f879ad115f0382b8cc8..1a3f2070d52b63a645913567843ecc7ce679794b 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
-public class CreateIndexWebhookUuidCreatedAtInWebhookDeliveriesIT {
+class CreateIndexWebhookUuidCreatedAtInWebhookDeliveriesIT {
 
   public static final String TABLE_NAME = "webhook_deliveries";
   public static final String INDEX_NAME = "wd_webhook_uuid_created_at";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexWebhookUuidCreatedAtInWebhookDeliveries.class);
   private final DdlChange createIndex = new CreateIndexWebhookUuidCreatedAtInWebhookDeliveries(db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME);
 
     createIndex.execute();
@@ -44,7 +44,7 @@ public class CreateIndexWebhookUuidCreatedAtInWebhookDeliveriesIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     createIndex.execute();
     createIndex.execute();
 
index 9918337a186320671b8280752ab5271e68f553f3..10a0abe06e768e4b2583c5346c32e4f87ec2b89b 100644 (file)
@@ -21,21 +21,21 @@ package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
-public class CreateIssueImpactsTableIT {
+class CreateIssueImpactsTableIT {
   private static final String EXPECTED_TABLE_NAME = "issues_impacts";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIssueImpactsTable.class);
 
   private final DdlChange underTest = new CreateIssueImpactsTable(db.database());
 
   @Test
-  public void migration_should_create_a_table() throws SQLException {
+  void migration_should_create_a_table() throws SQLException {
     db.assertTableDoesNotExist(EXPECTED_TABLE_NAME);
 
     underTest.execute();
@@ -48,7 +48,7 @@ public class CreateIssueImpactsTableIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     db.assertTableDoesNotExist(EXPECTED_TABLE_NAME);
 
     underTest.execute();
index eac2365c70200fb4a8e133976e80e235905d27f2..347e20820155c3f6e5294711d896ae6a7d4b9b67 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.VARCHAR;
 
-public class CreatePreviousNonCompliantValueInNewCodePeriodsIT {
+class CreatePreviousNonCompliantValueInNewCodePeriodsIT {
 
   private static final String COLUMN_NAME= "previous_non_compliant_value";
 
   private static final String TABLE_NAME = "new_code_periods";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreatePreviousNonCompliantValueInNewCodePeriods.class);
   private final CreatePreviousNonCompliantValueInNewCodePeriods underTest = new CreatePreviousNonCompliantValueInNewCodePeriods(db.database());
 
   @Test
-  public void execute_whenColumnDoesNotExist_shouldCreatePurgedColumn() throws SQLException {
+  void execute_whenColumnDoesNotExist_shouldCreatePurgedColumn() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, 255, null);
   }
 
   @Test
-  public void execute_whenExecutedTwice_shouldNotFail() throws SQLException {
+  void execute_whenExecutedTwice_shouldNotFail() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
     underTest.execute();
     underTest.execute();
index 12a4c3bcbaac761ca21284c76f80b962ded8a9b0..6aaf17fe9e83f593f2b5e419db07723c322183d4 100644 (file)
@@ -21,22 +21,22 @@ package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
 
-public class CreateRulesDefaultImpactsTableIT {
+class CreateRulesDefaultImpactsTableIT {
   private static final String EXPECTED_TABLE_NAME = "rules_default_impacts";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateRulesDefaultImpactsTable.class);
 
   private final DdlChange underTest = new CreateRulesDefaultImpactsTable(db.database());
 
   @Test
-  public void migration_should_create_a_table() throws SQLException {
+  void migration_should_create_a_table() throws SQLException {
     db.assertTableDoesNotExist(EXPECTED_TABLE_NAME);
 
     underTest.execute();
@@ -49,7 +49,7 @@ public class CreateRulesDefaultImpactsTableIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     db.assertTableDoesNotExist(EXPECTED_TABLE_NAME);
 
     underTest.execute();
index d780a2f152584cea0e855200840518ade8ffdb77..57983e20c16c2f85af28c75613245e66880c65a5 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 
 
-public class CreateUniqueConstraintOnIssuesImpactsIT {
-  @Rule
+class CreateUniqueConstraintOnIssuesImpactsIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateUniqueConstraintOnIssuesImpacts.class);
   private final CreateUniqueConstraintOnIssuesImpacts underTest = new CreateUniqueConstraintOnIssuesImpacts(db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist("issues_impacts", "uniq_iss_key_sof_qual");
 
     underTest.execute();
@@ -41,7 +41,7 @@ public class CreateUniqueConstraintOnIssuesImpactsIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     underTest.execute();
     underTest.execute();
 
index 437244b01abb03d1929d5b5ae0374c33f418bfae..0877b914838349b742c71727a7dd525ac1ff8b2a 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 
 
 
-public class CreateUniqueConstraintOnRulesDefaultImpactsIT {
-  @Rule
+class CreateUniqueConstraintOnRulesDefaultImpactsIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateUniqueConstraintOnRulesDefaultImpacts.class);
   private final CreateUniqueConstraintOnRulesDefaultImpacts underTest = new CreateUniqueConstraintOnRulesDefaultImpacts(db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist("rules_default_impacts", "uniq_rul_uuid_sof_qual");
 
     underTest.execute();
@@ -42,7 +42,7 @@ public class CreateUniqueConstraintOnRulesDefaultImpactsIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     underTest.execute();
     underTest.execute();
 
index 912fc4c710525fc5b5f8f01efea1d9a75ad5d6cc..ab5ee3b31a47118409b67e568eb4f0c560080b56 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.CoreDbTester;
 import org.sonar.db.MigrationDbTester;
 
 
 
-public class DropIndexComponentUuidInGroupRolesIT {
+class DropIndexComponentUuidInGroupRolesIT {
 
   private static final String TABLE_NAME = "group_roles";
   private static final String COLUMN_NAME = "component_uuid";
@@ -37,12 +37,12 @@ public class DropIndexComponentUuidInGroupRolesIT {
    * {@link MigrationDbTester} is not used because we are expecting index with component_uuid to exist. However, renaming the column component_uuid to entity_uuid
    * also updated the index
    */
-  @Rule
+  @RegisterExtension
   public final CoreDbTester db = CoreDbTester.createForSchema(DropIndexComponentUuidInGroupRolesIT.class, "schema.sql");
   private final DropIndexComponentUuidInGroupRoles underTest = new DropIndexComponentUuidInGroupRoles(db.database());
 
   @Test
-  public void index_is_dropped() throws SQLException {
+  void index_is_dropped() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
 
     underTest.execute();
@@ -51,7 +51,7 @@ public class DropIndexComponentUuidInGroupRolesIT {
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
 
     underTest.execute();
index 666646f780ec10918c27a76dfd96c07672bcf30a..2f0224203169554ccac074c79d37bf553861f112 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 
 
-public class DropIndexComponentUuidInSnapshotsIT {
+class DropIndexComponentUuidInSnapshotsIT {
 
   private static final String TABLE_NAME = "snapshots";
   private static final String COLUMN_NAME = "component_uuid";
   private static final String INDEX_NAME = "snapshot_component";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropIndexComponentUuidInSnapshots.class);
   private final DropIndexComponentUuidInSnapshots underTest = new DropIndexComponentUuidInSnapshots(db.database());
 
   @Test
-  public void index_is_dropped() throws SQLException {
+  void index_is_dropped() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
 
     underTest.execute();
@@ -46,7 +46,7 @@ public class DropIndexComponentUuidInSnapshotsIT {
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
 
     underTest.execute();
index 403e472a5ca1b5ddb39414a005270181fe7e4dd5..10fc0b5d4b3e0d63e6e2d4c1719104314c0b10f4 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.CoreDbTester;
 import org.sonar.db.MigrationDbTester;
 
 
 
-public class DropIndexComponentUuidInUserRolesIT {
+class DropIndexComponentUuidInUserRolesIT {
 
   private static final String TABLE_NAME = "user_roles";
   private static final String COLUMN_NAME = "component_uuid";
@@ -37,12 +37,12 @@ public class DropIndexComponentUuidInUserRolesIT {
    * {@link MigrationDbTester} is not used because we are expecting index with component_uuid to exist. However, renaming the column component_uuid to entity_uuid
    * also updated the index
    */
-  @Rule
+  @RegisterExtension
   public final CoreDbTester db = CoreDbTester.createForSchema(DropIndexComponentUuidInUserRolesIT.class, "schema.sql");
   private final DropIndexComponentUuidInUserRoles underTest = new DropIndexComponentUuidInUserRoles(db.database());
 
   @Test
-  public void index_is_dropped() throws SQLException {
+  void index_is_dropped() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
 
     underTest.execute();
@@ -51,7 +51,7 @@ public class DropIndexComponentUuidInUserRolesIT {
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
 
     underTest.execute();
index cd578fcc5f57a0b734825bde61b1460b17c7ff3c..25736409eb3b7cdf519beecc3a2fde1e5cb0c421 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 
 
-public class DropIndexComponentUuidInWebhookDeliveriesIT {
+class DropIndexComponentUuidInWebhookDeliveriesIT {
 
   private static final String TABLE_NAME = "webhook_deliveries";
   private static final String COLUMN_NAME = "component_uuid";
   private static final String INDEX_NAME = "component_uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropIndexComponentUuidInWebhookDeliveries.class);
   private final DropIndexComponentUuidInWebhookDeliveries underTest = new DropIndexComponentUuidInWebhookDeliveries(db.database());
 
   @Test
-  public void index_is_dropped() throws SQLException {
+  void index_is_dropped() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
 
     underTest.execute();
@@ -46,7 +46,7 @@ public class DropIndexComponentUuidInWebhookDeliveriesIT {
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
 
     underTest.execute();
index 09f4e195af39ca0e14f913f6ef2ae3389335adb9..289562e850f701e096d61d17cc3ea6849baa7271 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 
 
-public class DropIndexMainComponentUuidInCeActivityIT {
+class DropIndexMainComponentUuidInCeActivityIT {
 
   private static final String TABLE_NAME = "ce_activity";
   private static final String COLUMN_NAME = "main_component_uuid";
   private static final String INDEX_NAME = "ce_activity_main_component";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropIndexMainComponentUuidInCeActivity.class);
   private final DropIndexMainComponentUuidInCeActivity underTest = new DropIndexMainComponentUuidInCeActivity(db.database());
 
   @Test
-  public void index_is_dropped() throws SQLException {
+  void index_is_dropped() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
 
     underTest.execute();
@@ -46,7 +46,7 @@ public class DropIndexMainComponentUuidInCeActivityIT {
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
 
     underTest.execute();
index 7200ae997be0d793d9dc3a6927b4ef06eacdcbda..f57c06d4ab9f4f1cbc8656b3c3cfa6d9c0526487 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 
 
-public class DropIndexMainComponentUuidInCeQueueIT {
+class DropIndexMainComponentUuidInCeQueueIT {
 
   private static final String TABLE_NAME = "ce_queue";
   private static final String COLUMN_NAME = "main_component_uuid";
   private static final String INDEX_NAME = "ce_queue_main_component";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropIndexMainComponentUuidInCeQueue.class);
   private final DropIndexMainComponentUuidInCeQueue underTest = new DropIndexMainComponentUuidInCeQueue(db.database());
 
   @Test
-  public void index_is_dropped() throws SQLException {
+  void index_is_dropped() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
 
     underTest.execute();
@@ -46,7 +46,7 @@ public class DropIndexMainComponentUuidInCeQueueIT {
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
 
     underTest.execute();
index 03fc68c2ee1731030b5fb8485f4179e2d5c07a5c..5361755735bd2b90818d3c51fd13c1b1e64ac27f 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
-public class DropIndexOnMainBranchProjectUuidIT {
+class DropIndexOnMainBranchProjectUuidIT {
   private static final String TABLE_NAME = "components";
   private static final String COLUMN_NAME = "main_branch_project_uuid";
   private static final String INDEX_NAME = "idx_main_branch_prj_uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropIndexOnMainBranchProjectUuid.class);
   private final DdlChange underTest = new DropIndexOnMainBranchProjectUuid(db.database());
 
   @Test
-  public void drops_index() throws SQLException {
+  void drops_index() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
     underTest.execute();
     db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
     underTest.execute();
     underTest.execute();
index ffae285617526ac49ebf878b50aa3051a5e13e4d..73e0a4bb4ba883c4997d0f1bffec53b649fd2770 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.CoreDbTester;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
-public class DropIndexProjectUuidInWebhookDeliveriesIT {
+class DropIndexProjectUuidInWebhookDeliveriesIT {
 
   private static final String TABLE_NAME = "webhook_deliveries";
   private static final String COLUMN_NAME = "project_uuid";
@@ -36,12 +36,12 @@ public class DropIndexProjectUuidInWebhookDeliveriesIT {
    * {@link MigrationDbTester} is not used because we are expecting index with component_uuid to exist. However, renaming the column component_uuid to entity_uuid
    * also updated the index
    */
-  @Rule
+  @RegisterExtension
   public final CoreDbTester db = CoreDbTester.createForSchema(DropIndexProjectUuidInWebhookDeliveriesIT.class, "schema.sql");
   private final DdlChange underTest = new DropIndexProjectUuidInWebhookDeliveries(db.database());
 
   @Test
-  public void index_is_dropped() throws SQLException {
+  void index_is_dropped() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
 
     underTest.execute();
@@ -50,7 +50,7 @@ public class DropIndexProjectUuidInWebhookDeliveriesIT {
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
 
     underTest.execute();
index 322fb30e302d5403ffe5db94a8f2be0f1f996596..594de8a656b7db7889d4ca4d6efc995522b10a7a 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
-public class DropIndexTaskUuidInWebhookDeliveriesIT {
+class DropIndexTaskUuidInWebhookDeliveriesIT {
 
   private static final String TABLE_NAME = "webhook_deliveries";
   private static final String COLUMN_NAME = "ce_task_uuid";
   private static final String INDEX_NAME = "ce_task_uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropIndexTaskUuidInWebhookDeliveries.class);
   private final DdlChange underTest = new DropIndexTaskUuidInWebhookDeliveries(db.database());
 
   @Test
-  public void index_is_dropped() throws SQLException {
+  void index_is_dropped() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
 
     underTest.execute();
@@ -45,7 +45,7 @@ public class DropIndexTaskUuidInWebhookDeliveriesIT {
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
 
     underTest.execute();
index 3653304ae3d984c1184dcf280b5d71c6eb0a4326..42fd7c2397025df49e4bce61d11b4ed498f89602 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
-public class DropIndexWebhookUuidInWebhookDeliveriesIT {
+class DropIndexWebhookUuidInWebhookDeliveriesIT {
 
   private static final String TABLE_NAME = "webhook_deliveries";
   private static final String COLUMN_NAME = "webhook_uuid";
   private static final String INDEX_NAME = "idx_wbhk_dlvrs_wbhk_uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropIndexWebhookUuidInWebhookDeliveries.class);
   private final DdlChange underTest = new DropIndexWebhookUuidInWebhookDeliveries(db.database());
 
   @Test
-  public void index_is_dropped() throws SQLException {
+  void index_is_dropped() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
 
     underTest.execute();
@@ -45,7 +45,7 @@ public class DropIndexWebhookUuidInWebhookDeliveriesIT {
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertIndex(TABLE_NAME, INDEX_NAME, COLUMN_NAME);
 
     underTest.execute();
index 46d1e1a3755a06b7f4cc2733fa38f25929eec3d2..b94f7f7dd3aabba601b8b64f48c7880519fd1af6 100644 (file)
@@ -21,29 +21,29 @@ package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
 import static org.sonar.server.platform.db.migration.version.v102.DropMainBranchProjectUuidInComponents.COLUMN_NAME;
 import static org.sonar.server.platform.db.migration.version.v102.DropMainBranchProjectUuidInComponents.TABLE_NAME;
 
-public class DropMainBranchProjectUuidInComponentsIT {
+class DropMainBranchProjectUuidInComponentsIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropMainBranchProjectUuidInComponents.class);
   private final DdlChange underTest = new DropMainBranchProjectUuidInComponents(db.database());
 
   @Test
-  public void drops_column() throws SQLException {
+  void drops_column() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 50, true);
     underTest.execute();
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 50, true);
     underTest.execute();
     underTest.execute();
index 211ae43b9ea308166c539ac7bb3c91d75bcba141..bd0f6d907344b71f53f617a7b0efdce9596d5786 100644 (file)
@@ -21,30 +21,30 @@ package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 
 
-public class DropPurgeStatusColumnInSnapshotsIT {
+class DropPurgeStatusColumnInSnapshotsIT {
 
   private static final String TABLE_NAME = "snapshots";
   private static final String COLUMN_NAME = "purge_status";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropPurgeStatusColumnInSnapshots.class);
   private final DropPurgeStatusColumnInSnapshots underTest = new DropPurgeStatusColumnInSnapshots(db.database());
 
   @Test
-  public void drops_column() throws SQLException {
+  void drops_column() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.INTEGER, null, null);
     underTest.execute();
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.INTEGER, null, null);
     underTest.execute();
     underTest.execute();
index 12653b4483dfd04cb7cc264d060487accad109df..39eda7c37684c5786f5491b48fcd81e461162868 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 
 
-public class DropTableProjectMappingsIT {
+class DropTableProjectMappingsIT {
   public static final String TABLE_NAME = "project_mappings";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropTableProjectMappings.class);
   private final DropTableProjectMappings underTest = new DropTableProjectMappings(db.database());
 
   @Test
-  public void execute_shouldDropTable() throws SQLException {
+  void execute_shouldDropTable() throws SQLException {
     db.assertTableExists(TABLE_NAME);
     underTest.execute();
     db.assertTableDoesNotExist(TABLE_NAME);
   }
 
   @Test
-  public void execute_shouldSupportReentrantMigrationExecution() throws SQLException {
+  void execute_shouldSupportReentrantMigrationExecution() throws SQLException {
     db.assertTableExists(TABLE_NAME);
     underTest.execute();
     underTest.execute();
index 30f3f6c35d5bf9cefbb993c7eecbc6f6c69893b6..5c69c15ec4d7ce58ff3c110ed6d88ad03343eb80 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-public class FixSqaleIndexMetricDescriptionIT {
+class FixSqaleIndexMetricDescriptionIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(FixSqaleIndexMetricDescription.class);
   private final FixSqaleIndexMetricDescription underTest = new FixSqaleIndexMetricDescription(db.database());
   private final String OLD_DESCRIPTION = "Total effort (in hours) to fix all the issues on the component and therefore to comply to all the requirements.";
   private final String NEW_DESCRIPTION = "Total effort (in minutes) to fix all the issues on the component and therefore to comply to all the requirements.";
 
-  @Before
+  @BeforeEach
   public void setUp() {
     db.executeInsert("metrics",
       "uuid", "uuid",
@@ -44,14 +44,14 @@ public class FixSqaleIndexMetricDescriptionIT {
   }
 
   @Test
-  public void execute_whenExecuted_shouldUpdateSqaleIndexDescription() throws SQLException {
+  void execute_whenExecuted_shouldUpdateSqaleIndexDescription() throws SQLException {
     assertThat(select()).isEqualTo(OLD_DESCRIPTION);
     underTest.execute();
     assertThat(select()).isEqualTo(NEW_DESCRIPTION);
   }
 
   @Test
-  public void execute_WhenExecutedTwice_shouldBeReentrant() throws SQLException {
+  void execute_WhenExecutedTwice_shouldBeReentrant() throws SQLException {
     assertThat(select()).isEqualTo(OLD_DESCRIPTION);
     underTest.execute();
     underTest.execute();
index f4953590681947e9e8ec9b0ef9dd01746cc3a133..2d95297524c65cc1884ae503d18491796b6bd932 100644 (file)
@@ -20,8 +20,8 @@
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.VARCHAR;
@@ -29,21 +29,21 @@ import static org.sonar.server.platform.db.migration.version.v102.IncreaseIsLast
 import static org.sonar.server.platform.db.migration.version.v102.IncreaseIsLastKeyInCeActivity.NEW_COLUMN_SIZE;
 import static org.sonar.server.platform.db.migration.version.v102.IncreaseIsLastKeyInCeActivity.TABLE_NAME;
 
-public class IncreaseIsLastKeyInCeActivityIT {
+class IncreaseIsLastKeyInCeActivityIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(IncreaseIsLastKeyInCeActivity.class);
   private final IncreaseIsLastKeyInCeActivity underTest = new IncreaseIsLastKeyInCeActivity(db.database());
 
   @Test
-  public void execute_increaseColumnSize() throws SQLException {
+  void execute_increaseColumnSize() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, 55, false);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, NEW_COLUMN_SIZE, false);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, 55, false);
     underTest.execute();
     underTest.execute();
index b2e239a898e41bb7caf217a799c575bcfd834899..235e902fa228712786a4672729f5fbbe3b54f5da 100644 (file)
@@ -20,8 +20,8 @@
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.VARCHAR;
@@ -29,21 +29,21 @@ import static org.sonar.server.platform.db.migration.version.v102.IncreaseMainIs
 import static org.sonar.server.platform.db.migration.version.v102.IncreaseMainIsLastKeyInCeActivity.NEW_COLUMN_SIZE;
 import static org.sonar.server.platform.db.migration.version.v102.IncreaseMainIsLastKeyInCeActivity.TABLE_NAME;
 
-public class IncreaseMainIsLastKeyInCeActivityIT {
+class IncreaseMainIsLastKeyInCeActivityIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(IncreaseMainIsLastKeyInCeActivity.class);
   private final IncreaseMainIsLastKeyInCeActivity underTest = new IncreaseMainIsLastKeyInCeActivity(db.database());
 
   @Test
-  public void execute_increaseColumnSize() throws SQLException {
+  void execute_increaseColumnSize() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, 55, false);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, NEW_COLUMN_SIZE, false);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, 55, false);
     underTest.execute();
     underTest.execute();
index 024922efe9c5af296f0f8b65277e921f1bb6bacc..b21e06bd5fef5d3afa52b07165dc69e3be7d2dca 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.VARCHAR;
 
-public class MakeProjectUuidNullableInUserDismissedMessagesIT {
+class MakeProjectUuidNullableInUserDismissedMessagesIT {
 
   private static final String TABLE_NAME = "user_dismissed_messages";
   private static final String COLUMN_NAME = "project_uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(MakeProjectUuidNullableInUserDismissedMessages.class);
   private final MakeProjectUuidNullableInUserDismissedMessages underTest = new MakeProjectUuidNullableInUserDismissedMessages(db.database());
 
   @Test
-  public void execute_shouldBeNullable() throws SQLException {
+  void execute_shouldBeNullable() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, 40, false);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, 40, true);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, VARCHAR, 40, false);
     underTest.execute();
     underTest.execute();
index dd1e5b11446423f44bb1ed8b060b932fb39a20ff..ce561cf9d8e7db91535fd5757206916bdefdd926 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.BOOLEAN;
 
-public class MakePurgedColumnNotNullableInSnapshotsIT {
+class MakePurgedColumnNotNullableInSnapshotsIT {
   private static final String TABLE_NAME = "snapshots";
   private static final String COLUMN_NAME = "purged";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(MakePurgedColumnNotNullableInSnapshots.class);
   private final MakePurgedColumnNotNullableInSnapshots underTest = new MakePurgedColumnNotNullableInSnapshots(db.database());
 
   @Test
-  public void execute_whenColumnIsNullable_shouldMakeColumnNullable() throws SQLException {
+  void execute_whenColumnIsNullable_shouldMakeColumnNullable() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, BOOLEAN, null, true);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, BOOLEAN, null, false);
   }
 
   @Test
-  public void execute_whenExecutedTwice_shouldMakeColumnNullable() throws SQLException {
+  void execute_whenExecutedTwice_shouldMakeColumnNullable() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, BOOLEAN, null, true);
     underTest.execute();
     underTest.execute();
index f0ac747ad54c19b22abafc928f3b8c84af0315b1..053e60cf4afec58640ff1912fc63956ec9af6924 100644 (file)
@@ -21,8 +21,8 @@ package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
 import javax.annotation.Nullable;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.api.rules.CleanCodeAttribute;
 import org.sonar.api.rules.RuleType;
 import org.sonar.db.MigrationDbTester;
@@ -30,21 +30,21 @@ import org.sonar.db.MigrationDbTester;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatCode;
 
-public class PopulateCleanCodeAttributeColumnInRulesIT {
+class PopulateCleanCodeAttributeColumnInRulesIT {
 
   private static final String TABLE_NAME = "rules";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulateCleanCodeAttributeColumnInRules.class);
   private final PopulateCleanCodeAttributeColumnInRules underTest = new PopulateCleanCodeAttributeColumnInRules(db.database());
 
   @Test
-  public void execute_whenRulesDoNotExist_shouldNotFail() {
+  void execute_whenRulesDoNotExist_shouldNotFail() {
     assertThatCode(underTest::execute).doesNotThrowAnyException();
   }
 
   @Test
-  public void execute_whenRuleWithUndefinedCleanCodeAttribute_shouldUpdate() throws SQLException {
+  void execute_whenRuleWithUndefinedCleanCodeAttribute_shouldUpdate() throws SQLException {
     insertRule("1", null);
     underTest.execute();
     assertThat(db.select("select uuid, clean_code_attribute from rules"))
@@ -53,7 +53,7 @@ public class PopulateCleanCodeAttributeColumnInRulesIT {
   }
 
   @Test
-  public void execute_whenRuleWithUndefinedCleanCodeAttribute_shouldBeReentrant() throws SQLException {
+  void execute_whenRuleWithUndefinedCleanCodeAttribute_shouldBeReentrant() throws SQLException {
     insertRule("1", null);
     underTest.execute();
     underTest.execute();
@@ -63,7 +63,7 @@ public class PopulateCleanCodeAttributeColumnInRulesIT {
   }
 
   @Test
-  public void execute_whenRuleWithDefinedCleanCodeAttribute_shouldNotUpdate() throws SQLException {
+  void execute_whenRuleWithDefinedCleanCodeAttribute_shouldNotUpdate() throws SQLException {
     insertRule("1", CleanCodeAttribute.FOCUSED);
     underTest.execute();
     assertThat(db.select("select uuid, clean_code_attribute from rules"))
@@ -72,7 +72,7 @@ public class PopulateCleanCodeAttributeColumnInRulesIT {
   }
 
   @Test
-  public void execute_whenRuleIsHotspot_shouldNotUpdate() throws SQLException {
+  void execute_whenRuleIsHotspot_shouldNotUpdate() throws SQLException {
     insertRule("1", RuleType.SECURITY_HOTSPOT, null, null);
     underTest.execute();
     assertThat(db.select("select uuid, clean_code_attribute from rules"))
@@ -81,7 +81,7 @@ public class PopulateCleanCodeAttributeColumnInRulesIT {
   }
 
   @Test
-  public void execute_whenAdhocRuleIsHotspot_shouldNotUpdate() throws SQLException {
+  void execute_whenAdhocRuleIsHotspot_shouldNotUpdate() throws SQLException {
     insertRule("1", null, RuleType.SECURITY_HOTSPOT, null);
     underTest.execute();
     assertThat(db.select("select uuid, clean_code_attribute from rules"))
index 1eb137d93ce91ab311415737a9216e3798548f3d..fea88b667aaace783783caadf486751f560cc383 100644 (file)
@@ -21,12 +21,12 @@ package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
 import javax.annotation.Nullable;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.api.batch.rule.Severity;
 import org.sonar.api.issue.impact.SoftwareQuality;
 import org.sonar.api.rules.RuleType;
-import org.sonar.api.testfixtures.log.LogTester;
+import org.sonar.api.testfixtures.log.LogTesterJUnit5;
 import org.sonar.core.util.Uuids;
 import org.sonar.db.MigrationDbTester;
 
@@ -34,23 +34,23 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatCode;
 import static org.assertj.core.api.Assertions.tuple;
 
-public class PopulateDefaultImpactsInRulesIT {
+class PopulateDefaultImpactsInRulesIT {
   private static final String TABLE_NAME = "rules";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulateDefaultImpactsInRules.class);
-  @Rule
-  public LogTester logTester = new LogTester();
+  @RegisterExtension
+  public final LogTesterJUnit5 logTester = new LogTesterJUnit5();
 
   private final PopulateDefaultImpactsInRules underTest = new PopulateDefaultImpactsInRules(db.database());
 
   @Test
-  public void execute_whenRulesDoNotExist_shouldNotFail() {
+  void execute_whenRulesDoNotExist_shouldNotFail() {
     assertThatCode(underTest::execute).doesNotThrowAnyException();
   }
 
   @Test
-  public void execute_whenRulesHasTypeAndSeverity_shouldCreateImpact() throws SQLException {
+  void execute_whenRulesHasTypeAndSeverity_shouldCreateImpact() throws SQLException {
     insertRuleWithType("uuid", RuleType.CODE_SMELL, Severity.MAJOR);
     underTest.execute();
 
@@ -61,7 +61,7 @@ public class PopulateDefaultImpactsInRulesIT {
   }
 
   @Test
-  public void execute_shouldBeReentrant() throws SQLException {
+  void execute_shouldBeReentrant() throws SQLException {
     insertRuleWithType("uuid", RuleType.CODE_SMELL, Severity.MAJOR);
     underTest.execute();
     underTest.execute();
@@ -75,7 +75,7 @@ public class PopulateDefaultImpactsInRulesIT {
   }
 
   @Test
-  public void execute_shouldNotBeExecuted_whenImpactsTableHasAlreadyRecords() throws SQLException {
+  void execute_shouldNotBeExecuted_whenImpactsTableHasAlreadyRecords() throws SQLException {
     insertRuleWithType("uuid", RuleType.CODE_SMELL, Severity.MAJOR);
     insertRuleWithType("uuid2", RuleType.CODE_SMELL, Severity.MAJOR);
     insertImpact("uuid", SoftwareQuality.SECURITY, org.sonar.api.issue.impact.Severity.HIGH);
@@ -90,7 +90,7 @@ public class PopulateDefaultImpactsInRulesIT {
   }
 
   @Test
-  public void execute_whenAdhocRulesHasTypeAndSeverity_shouldCreateImpact() throws SQLException {
+  void execute_whenAdhocRulesHasTypeAndSeverity_shouldCreateImpact() throws SQLException {
     insertRuleWithAdHocType("uuid", RuleType.CODE_SMELL, Severity.MAJOR);
     underTest.execute();
 
@@ -103,7 +103,7 @@ public class PopulateDefaultImpactsInRulesIT {
   }
 
   @Test
-  public void execute_whenAdhocRulesHasImpactAlready_shouldNotCreateImpact() throws SQLException {
+  void execute_whenAdhocRulesHasImpactAlready_shouldNotCreateImpact() throws SQLException {
     insertRuleWithAdHocType("uuid", RuleType.CODE_SMELL, Severity.MAJOR);
     insertImpact("uuid", SoftwareQuality.SECURITY, org.sonar.api.issue.impact.Severity.HIGH);
     underTest.execute();
@@ -117,7 +117,7 @@ public class PopulateDefaultImpactsInRulesIT {
   }
 
   @Test
-  public void execute_whenNoTypeAndSeverityDefined_shouldNotCreateImpact() throws SQLException {
+  void execute_whenNoTypeAndSeverityDefined_shouldNotCreateImpact() throws SQLException {
     insertRuleWithType("uuid", null, null);
     underTest.execute();
 
@@ -127,7 +127,7 @@ public class PopulateDefaultImpactsInRulesIT {
   }
 
   @Test
-  public void execute_whenInvalidValueDefined_shouldNotCreateImpactAndLog() throws SQLException {
+  void execute_whenInvalidValueDefined_shouldNotCreateImpactAndLog() throws SQLException {
     insertInvalidRule("uuid");
     underTest.execute();
 
@@ -138,7 +138,7 @@ public class PopulateDefaultImpactsInRulesIT {
   }
 
   @Test
-  public void execute_whenTypeIsHotspot_shouldNotCreateImpactAndLog() throws SQLException {
+  void execute_whenTypeIsHotspot_shouldNotCreateImpactAndLog() throws SQLException {
     insertRuleWithType("uuid", RuleType.SECURITY_HOTSPOT, Severity.MAJOR);
     underTest.execute();
 
@@ -148,7 +148,7 @@ public class PopulateDefaultImpactsInRulesIT {
   }
 
   @Test
-  public void execute_whenRuleHasEmptyFields_shouldCreateADefaultImpact() throws SQLException {
+  void execute_whenRuleHasEmptyFields_shouldCreateADefaultImpact() throws SQLException {
     insertPlaceholderAdhocRule("uuid");
     underTest.execute();
 
@@ -160,7 +160,7 @@ public class PopulateDefaultImpactsInRulesIT {
   }
 
   @Test
-  public void execute_whenStandardRuleHasBothAdhocAndStandardTypeAndSeverity_shouldCreateADefaultImpactWithAdhocTypes() throws SQLException {
+  void execute_whenStandardRuleHasBothAdhocAndStandardTypeAndSeverity_shouldCreateADefaultImpactWithAdhocTypes() throws SQLException {
     insertRule("uuid", RuleType.CODE_SMELL, Severity.CRITICAL, RuleType.VULNERABILITY, Severity.MINOR, true);
     underTest.execute();
 
index 5b0744f1bb80c01ee34ad042f5f15693429ff21e..b65d089216769b1f40a082bdbfd34b17466067a7 100644 (file)
@@ -21,29 +21,29 @@ package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
 import javax.annotation.Nullable;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatCode;
 import static org.assertj.core.api.Assertions.tuple;
 
-public class PopulatePurgedColumnInSnapshotsIT {
+class PopulatePurgedColumnInSnapshotsIT {
   private static final String TABLE_NAME = "snapshots";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulatePurgedColumnInSnapshots.class);
   private final PopulatePurgedColumnInSnapshots underTest = new PopulatePurgedColumnInSnapshots(db.database());
 
   @Test
-  public void execute_whenSnapshotsDoesNotExist_shouldNotFail() {
+  void execute_whenSnapshotsDoesNotExist_shouldNotFail() {
     assertThatCode(underTest::execute)
       .doesNotThrowAnyException();
   }
 
   @Test
-  public void execute_whenSnapshotsExist_shouldPopulatePurgedColumn() throws SQLException {
+  void execute_whenSnapshotsExist_shouldPopulatePurgedColumn() throws SQLException {
     insertSnapshot("uuid-1", null);
     insertSnapshot("uuid-2", 1);
     insertSnapshot("uuid-3", 0);
index 24e02f21c8c42dcffeac34a35189971f07bab3ce..d47db60854386cbbdc8230f7a83a83df1c6b5d4a 100644 (file)
@@ -21,28 +21,28 @@ package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 
 
-public class RenameBuildDateInSnapshotsIT {
+class RenameBuildDateInSnapshotsIT {
   private static final String TABLE_NAME = "snapshots";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RenameBuildDateInSnapshots.class);
   private final RenameBuildDateInSnapshots underTest = new RenameBuildDateInSnapshots(db.database());
 
   @Test
-  public void execute_whenExecuted_shouldRenameColumn() throws SQLException {
+  void execute_whenExecuted_shouldRenameColumn() throws SQLException {
     assertColumnExists("build_date");
     underTest.execute();
     assertColumnExists("analysis_date");
   }
 
   @Test
-  public void execute_whenExecutedTwice_shouldNotFail() throws SQLException {
+  void execute_whenExecutedTwice_shouldNotFail() throws SQLException {
     assertColumnExists("build_date");
     underTest.execute();
     underTest.execute();
index 5334b2bf2e724445e8dbb5329bde75a863dc0366..cbe5f9b22d8014d216182f2a3558378b19822e98 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.VARCHAR;
 
-public class RenameComponentUuidInGroupRolesIT {
+class RenameComponentUuidInGroupRolesIT {
   public static final String TABLE_NAME = "group_roles";
   public static final String NEW_COLUMN_NAME = "entity_uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RenameComponentUuidInGroupRoles.class);
   private final RenameComponentUuidInGroupRoles underTest = new RenameComponentUuidInGroupRoles(db.database());
 
   @Test
-  public void columnIsRenamed() throws SQLException {
+  void columnIsRenamed() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, NEW_COLUMN_NAME);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, NEW_COLUMN_NAME, VARCHAR, 40, true);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, NEW_COLUMN_NAME);
     underTest.execute();
     underTest.execute();
index 48fb4662392a4c7c1a62f91b37ef0dbd75c7279c..48aaa7cef69b8e3e89c5f152397d2e46fe3117d1 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.VARCHAR;
 
-public class RenameComponentUuidInSnapshotsIT {
+class RenameComponentUuidInSnapshotsIT {
   public static final String TABLE_NAME = "snapshots";
   public static final String NEW_COLUMN_NAME = "root_component_uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RenameComponentUuidInSnapshots.class);
   private final RenameComponentUuidInSnapshots underTest = new RenameComponentUuidInSnapshots(db.database());
 
   @Test
-  public void columnIsRenamed() throws SQLException {
+  void columnIsRenamed() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, NEW_COLUMN_NAME);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, NEW_COLUMN_NAME, VARCHAR, 50, false);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, NEW_COLUMN_NAME);
     underTest.execute();
     underTest.execute();
index 6631b3256dd2bb6bc18056ba5a66f753f92852b1..c113efc5589b63afc3ce3a03612a1371d3f98aea 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.VARCHAR;
 
-public class RenameComponentUuidInUserRolesIT {
+class RenameComponentUuidInUserRolesIT {
   public static final String TABLE_NAME = "user_roles";
   public static final String NEW_COLUMN_NAME = "entity_uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RenameComponentUuidInUserRoles.class);
   private final RenameComponentUuidInUserRoles underTest = new RenameComponentUuidInUserRoles(db.database());
 
   @Test
-  public void columnIsRenamed() throws SQLException {
+  void columnIsRenamed() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, NEW_COLUMN_NAME);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, NEW_COLUMN_NAME, VARCHAR, 40, true);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, NEW_COLUMN_NAME);
     underTest.execute();
     underTest.execute();
index f5c95827e0bc706b205c82ad7ff55f35acbdd9c5..4945506867b311b1d923d10c0b22cde9a3ebf2a9 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.AbstractDbTester;
-import org.sonar.db.TestDb;
 import org.sonar.db.MigrationDbTester;
+import org.sonar.db.TestDb;
 import org.sonar.server.platform.db.migration.step.RenameVarcharColumnChange;
 import org.sonar.server.platform.db.migration.version.RenameVarcharColumnAbstractTest;
 
-public class RenameComponentUuidInWebhookDeliveriesIT extends RenameVarcharColumnAbstractTest {
+class RenameComponentUuidInWebhookDeliveriesIT extends RenameVarcharColumnAbstractTest {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RenameComponentUuidInWebhookDeliveries.class);
 
   public RenameComponentUuidInWebhookDeliveriesIT() {
@@ -38,12 +38,12 @@ public class RenameComponentUuidInWebhookDeliveriesIT extends RenameVarcharColum
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     super.verifyMigrationIsReentrant();
   }
 
   @Test
-  public void column_is_renamed() throws SQLException {
+  void column_is_renamed() throws SQLException {
     super.verifyColumnIsRenamed();
   }
 
index 66ba036aece0bcac9471c1535554fd56019a6396..24ad24509c9dcdec0b406ad1d2d5cc5f34cc758b 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.VARCHAR;
 
-public class RenameMainComponentUuidInCeActivityIT {
+class RenameMainComponentUuidInCeActivityIT {
   public static final String TABLE_NAME = "ce_activity";
   public static final String NEW_COLUMN_NAME = "entity_uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RenameMainComponentUuidInCeActivity.class);
   private final RenameMainComponentUuidInCeActivity underTest = new RenameMainComponentUuidInCeActivity(db.database());
 
   @Test
-  public void column_is_renamed() throws SQLException {
+  void column_is_renamed() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, NEW_COLUMN_NAME);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, NEW_COLUMN_NAME, VARCHAR, 40, true);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, NEW_COLUMN_NAME);
     underTest.execute();
     underTest.execute();
index 6138d66bb39455af459f1539f9a75a15dabc791a..a5bf85f38ff513ce95929e7c73017735eccb723b 100644 (file)
 package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.VARCHAR;
 
-public class RenameMainComponentUuidInCeQueueIT {
+class RenameMainComponentUuidInCeQueueIT {
   public static final String TABLE_NAME = "ce_queue";
   public static final String NEW_COLUMN_NAME = "entity_uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RenameMainComponentUuidInCeQueue.class);
   private final RenameMainComponentUuidInCeQueue underTest = new RenameMainComponentUuidInCeQueue(db.database());
 
   @Test
-  public void column_is_renamed() throws SQLException {
+  void column_is_renamed() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, NEW_COLUMN_NAME);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, NEW_COLUMN_NAME, VARCHAR, 40, true);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, NEW_COLUMN_NAME);
     underTest.execute();
     underTest.execute();
index bb58bf58d25bbeb7610bb553b3449b0b2128e3b2..4b8f5470766663066e55001c97f44b73aa4bdb11 100644 (file)
@@ -21,25 +21,25 @@ package org.sonar.server.platform.db.migration.version.v102;
 
 import java.sql.SQLException;
 import javax.annotation.Nullable;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.tuple;
 
-public class UpdateValueAndPopulatePreviousNonCompliantValueInNewCodePeriodsIT {
+class UpdateValueAndPopulatePreviousNonCompliantValueInNewCodePeriodsIT {
 
   private static final String TABLE_NAME = "new_code_periods";
   private static final String PROJECT_UUID = "project-uuid";
   private static final String BRANCH_UUID = "branch-uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(UpdateValueAndPopulatePreviousNonCompliantValueInNewCodePeriods.class);
   public final UpdateValueAndPopulatePreviousNonCompliantValueInNewCodePeriods underTest = new UpdateValueAndPopulatePreviousNonCompliantValueInNewCodePeriods(db.database());
 
   @Test
-  public void execute_whenSnapshotsExist_shouldPopulatePurgedColumn() throws SQLException {
+  void execute_whenSnapshotsExist_shouldPopulatePurgedColumn() throws SQLException {
     insertNewCodePeriods("uuid-1", PROJECT_UUID, BRANCH_UUID, "PREVIOUS_VERSION", null);
     insertNewCodePeriods("uuid-2", PROJECT_UUID, null, "NUMBER_OF_DAYS", "90");
     insertNewCodePeriods("uuid-3", null, null, "NUMBER_OF_DAYS", "97");
index d08a5f17e3eb8c0a402185733306b9135b158145..9377eefa5afc842cc0d3a0661ade0f3574c73d99 100644 (file)
@@ -21,29 +21,29 @@ package org.sonar.server.platform.db.migration.version.v103;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.assertj.core.api.Assertions.assertThatCode;
 
-public class AddCleanCodeAttributeColumnInIssuesTableIT {
+class AddCleanCodeAttributeColumnInIssuesTableIT {
   private static final String TABLE_NAME = "issues";
   private static final String COLUMN_NAME = "clean_code_attribute";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddCleanCodeAttributeColumnInIssuesTable.class);
   private final AddCleanCodeAttributeColumnInIssuesTable underTest = new AddCleanCodeAttributeColumnInIssuesTable(db.database());
 
   @Test
-  public void execute_whenColumnDoesNotExist_shouldCreateColumn() throws SQLException {
+  void execute_whenColumnDoesNotExist_shouldCreateColumn() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 40, true);
   }
 
   @Test
-  public void execute_whenColumnsAlreadyExists_shouldNotFail() throws SQLException {
+  void execute_whenColumnsAlreadyExists_shouldNotFail() throws SQLException {
     underTest.execute();
     assertThatCode(underTest::execute).doesNotThrowAnyException();
   }
index ff51c47362f4867e69c6a8ea1e58dfafa63e61a3..7d91db50e91c7b3c74befaf1a638c0c07fff12fb 100644 (file)
@@ -20,8 +20,8 @@
 package org.sonar.server.platform.db.migration.version.v103;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.VARCHAR;
@@ -30,20 +30,20 @@ import static org.sonar.server.platform.db.migration.version.v103.AddCreationMet
 import static org.sonar.server.platform.db.migration.version.v103.AddCreationMethodColumnInProjectsTable.PROJECTS_CREATION_METHOD_COLUMN_SIZE;
 import static org.sonar.server.platform.db.migration.version.v103.AddCreationMethodColumnInProjectsTable.PROJECTS_TABLE_NAME;
 
-public class AddCreationMethodColumnInProjectsTableIT {
-  @Rule
+class AddCreationMethodColumnInProjectsTableIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddCreationMethodColumnInProjectsTable.class);
   private final AddCreationMethodColumnInProjectsTable underTest = new AddCreationMethodColumnInProjectsTable(db.database());
 
   @Test
-  public void execute_whenColumnDoesNotExist_shouldCreateColumn() throws SQLException {
+  void execute_whenColumnDoesNotExist_shouldCreateColumn() throws SQLException {
     db.assertColumnDoesNotExist(PROJECTS_TABLE_NAME, PROJECTS_CREATION_METHOD_COLUMN_NAME);
     underTest.execute();
     db.assertColumnDefinition(PROJECTS_TABLE_NAME, PROJECTS_CREATION_METHOD_COLUMN_NAME, VARCHAR, PROJECTS_CREATION_METHOD_COLUMN_SIZE, true);
   }
 
   @Test
-  public void execute_whenColumnsAlreadyExists_shouldNotFail() throws SQLException {
+  void execute_whenColumnsAlreadyExists_shouldNotFail() throws SQLException {
     underTest.execute();
     assertThatCode(underTest::execute).doesNotThrowAnyException();
   }
index 9e1884e6254941cc771c011f1b41aa1ca0c4c05a..3bf8bcbd13d1dd7726c270609fc5b3f66dd43ad1 100644 (file)
@@ -21,30 +21,30 @@ package org.sonar.server.platform.db.migration.version.v103;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.assertj.core.api.Assertions.assertThatCode;
 
-public class AddRuleChangesUuidColumnInQProfileChangesIT {
+class AddRuleChangesUuidColumnInQProfileChangesIT {
 
   private static final String TABLE_NAME = "qprofile_changes";
   private static final String COLUMN_NAME = "rule_change_uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddRuleChangesUuidColumnInQProfileChanges.class);
   private final AddRuleChangesUuidColumnInQProfileChanges underTest = new AddRuleChangesUuidColumnInQProfileChanges(db.database());
 
   @Test
-  public void execute_whenColumnDoesNotExist_shouldCreateColumn() throws SQLException {
+  void execute_whenColumnDoesNotExist_shouldCreateColumn() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 40, true);
   }
 
   @Test
-  public void execute_whenColumnsAlreadyExists_shouldNotFail() throws SQLException {
+  void execute_whenColumnsAlreadyExists_shouldNotFail() throws SQLException {
     underTest.execute();
     assertThatCode(underTest::execute).doesNotThrowAnyException();
   }
index ae03b99886519a21bb13ef19447127d6a8bf9c54..280cf614ce2cc422b1b174d2182fb6a9e56d82f4 100644 (file)
@@ -21,30 +21,30 @@ package org.sonar.server.platform.db.migration.version.v103;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.assertj.core.api.Assertions.assertThatCode;
 
-public class AddSqVersionColumnInQprofileChangesTableIT {
+class AddSqVersionColumnInQprofileChangesTableIT {
 
   private static final String TABLE_NAME = "qprofile_changes";
   private static final String COLUMN_NAME = "sq_version";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddSqVersionColumnInQprofileChangesTable.class);
   private final AddSqVersionColumnInQprofileChangesTable underTest = new AddSqVersionColumnInQprofileChangesTable(db.database());
 
   @Test
-  public void execute_whenColumnDoesNotExist_shouldCreateColumn() throws SQLException {
+  void execute_whenColumnDoesNotExist_shouldCreateColumn() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 40, true);
   }
 
   @Test
-  public void execute_whenColumnsAlreadyExists_shouldNotFail() throws SQLException {
+  void execute_whenColumnsAlreadyExists_shouldNotFail() throws SQLException {
     underTest.execute();
     assertThatCode(underTest::execute).doesNotThrowAnyException();
   }
index 23895f74091284055b54445d9e3d02e5380cff5e..e592d9ca0a62c25ccf82b252cc1310de93103b83 100644 (file)
@@ -21,22 +21,22 @@ package org.sonar.server.platform.db.migration.version.v103;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
 import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE;
 import static org.sonar.server.platform.db.migration.version.v103.CreateGithubPermissionsMappingTable.GITHUB_PERMISSIONS_MAPPING_TABLE_NAME;
 
-public class CreateGithubPermissionsMappingTableIT {
-  @Rule
+class CreateGithubPermissionsMappingTableIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateGithubPermissionsMappingTable.class);
 
   private final DdlChange createGithubPermissionsMappingTable = new CreateGithubPermissionsMappingTable(db.database());
 
   @Test
-  public void migration_should_create_a_table() throws SQLException {
+  void migration_should_create_a_table() throws SQLException {
     db.assertTableDoesNotExist(GITHUB_PERMISSIONS_MAPPING_TABLE_NAME);
 
     createGithubPermissionsMappingTable.execute();
@@ -49,7 +49,7 @@ public class CreateGithubPermissionsMappingTableIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     db.assertTableDoesNotExist(GITHUB_PERMISSIONS_MAPPING_TABLE_NAME);
 
     createGithubPermissionsMappingTable.execute();
index 8c9ae56d98822f53ba4625696d96c0bc7e9b7ca9..453e2921785af00a689a83bd3948aba3de9cb8a6 100644 (file)
 package org.sonar.server.platform.db.migration.version.v103;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 
 
-public class CreateIndexForRuleImpactChangesTableIT {
+class CreateIndexForRuleImpactChangesTableIT {
 
   static final String INDEX_NAME = "rule_impact_changes_r_c_uuid";
   static final String TABLE_NAME = "rule_impact_changes";
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIndexForRuleImpactChangesTable.class);
   private final CreateIndexForRuleImpactChangesTable underTest = new CreateIndexForRuleImpactChangesTable(db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist(TABLE_NAME, INDEX_NAME);
 
     underTest.execute();
@@ -44,7 +44,7 @@ public class CreateIndexForRuleImpactChangesTableIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     underTest.execute();
     underTest.execute();
 
index 21e97096594badd6ca96a652658f7e36c3bd4e91..6e6983202e8fe6b608cde536321734a8e6693679 100644 (file)
@@ -21,24 +21,24 @@ package org.sonar.server.platform.db.migration.version.v103;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
 import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE;
 
-public class CreateRuleChangesTableIT {
+class CreateRuleChangesTableIT {
 
   private final static String TABLE_NAME = "rule_changes";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateRuleChangesTable.class);
 
   private final DdlChange underTest = new CreateRuleChangesTable(db.database());
 
   @Test
-  public void migration_should_create_a_table() throws SQLException {
+  void migration_should_create_a_table() throws SQLException {
     db.assertTableDoesNotExist(TABLE_NAME);
 
     underTest.execute();
@@ -51,7 +51,7 @@ public class CreateRuleChangesTableIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     db.assertTableDoesNotExist(TABLE_NAME);
 
     underTest.execute();
index 97f013b25590cba114d875b27f5f0147b413647f..091b3e55d6b0a0abd7ca1f723df8edf2358524a4 100644 (file)
@@ -21,25 +21,25 @@ package org.sonar.server.platform.db.migration.version.v103;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
 import static org.sonar.server.platform.db.migration.def.VarcharColumnDef.UUID_SIZE;
 
-public class CreateRuleImpactChangesTableIT {
+class CreateRuleImpactChangesTableIT {
 
 
   private final static String TABLE_NAME = "rule_impact_changes";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateRuleImpactChangesTable.class);
 
   private final DdlChange underTest = new CreateRuleImpactChangesTable(db.database());
 
   @Test
-  public void migration_should_create_a_table() throws SQLException {
+  void migration_should_create_a_table() throws SQLException {
     db.assertTableDoesNotExist(TABLE_NAME);
 
     underTest.execute();
@@ -53,7 +53,7 @@ public class CreateRuleImpactChangesTableIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     db.assertTableDoesNotExist(TABLE_NAME);
 
     underTest.execute();
index 7adab1131483568115217501611ef7102b9c3254..9f7acdcc1facda393cd0309c83de4f3569cd335f 100644 (file)
@@ -20,8 +20,8 @@
 package org.sonar.server.platform.db.migration.version.v103;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.sonar.server.platform.db.migration.version.v103.CreateGithubPermissionsMappingTable.GITHUB_PERMISSIONS_MAPPING_TABLE_NAME;
@@ -29,13 +29,13 @@ import static org.sonar.server.platform.db.migration.version.v103.CreateGithubPe
 import static org.sonar.server.platform.db.migration.version.v103.CreateGithubPermissionsMappingTable.SONARQUBE_PERMISSION_COLUMN;
 import static org.sonar.server.platform.db.migration.version.v103.CreateUniqueIndexForGithubPermissionsMappingTable.INDEX_NAME;
 
-public class CreateUniqueIndexForGithubPermissionsMappingTableIT {
-  @Rule
+class CreateUniqueIndexForGithubPermissionsMappingTableIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateUniqueIndexForGithubPermissionsMappingTable.class);
   private final CreateUniqueIndexForGithubPermissionsMappingTable createIndex = new CreateUniqueIndexForGithubPermissionsMappingTable(db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist(GITHUB_PERMISSIONS_MAPPING_TABLE_NAME, INDEX_NAME);
 
     createIndex.execute();
@@ -44,7 +44,7 @@ public class CreateUniqueIndexForGithubPermissionsMappingTableIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     createIndex.execute();
     createIndex.execute();
 
index d01a9f75ec848ba9a5c7b8c60416b27125202c92..e2c15c2d8a584ec6f80fe75ef7b8454f71c4c0c4 100644 (file)
 package org.sonar.server.platform.db.migration.version.v103;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.sonar.server.platform.db.migration.version.v103.CreateUniqueIndexForPropertiesTable.INDEX_NAME;
 import static org.sonar.server.platform.db.migration.version.v103.CreateUniqueIndexForPropertiesTable.PROPERTIES_TABLE_NAME;
 
 
-public class CreateUniqueIndexForPropertiesTableIT {
+class CreateUniqueIndexForPropertiesTableIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateUniqueIndexForPropertiesTable.class);
   private final CreateUniqueIndexForPropertiesTable createIndex = new CreateUniqueIndexForPropertiesTable(db.database());
 
   @Test
-  public void migration_should_create_index() throws SQLException {
+  void migration_should_create_index() throws SQLException {
     db.assertIndexDoesNotExist(PROPERTIES_TABLE_NAME, INDEX_NAME);
 
     createIndex.execute();
@@ -44,7 +44,7 @@ public class CreateUniqueIndexForPropertiesTableIT {
   }
 
   @Test
-  public void migration_should_be_reentrant() throws SQLException {
+  void migration_should_be_reentrant() throws SQLException {
     createIndex.execute();
     createIndex.execute();
 
index b9db929e5984fd8fdd71d0d009403f289cbdaad7..69c838375ff9d34eb349f1e7f7df614dbebf7871 100644 (file)
@@ -22,19 +22,19 @@ package org.sonar.server.platform.db.migration.version.v103;
 import java.sql.SQLException;
 import java.util.Date;
 import javax.annotation.Nullable;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.core.util.Uuids;
 import org.sonar.db.MigrationDbTester;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.tuple;
 
-public class DeduplicatePropertiesTableIT {
+class DeduplicatePropertiesTableIT {
   public static final String KEY = "key";
   public static final String ENTITY = "entity";
   public static final String USER = "user";
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DeduplicatePropertiesTable.class);
   private final DeduplicatePropertiesTable underTest = new DeduplicatePropertiesTable(db.database());
 
@@ -57,7 +57,7 @@ public class DeduplicatePropertiesTableIT {
   }
 
   @Test
-  public void execute_shouldDeduplicateRows_WhenOnlyKeyIsSpecified() throws SQLException {
+  void execute_shouldDeduplicateRows_WhenOnlyKeyIsSpecified() throws SQLException {
     createBaseProperties();
     createProperty(KEY, null, null);
     createProperty(KEY, null, null);
@@ -69,7 +69,7 @@ public class DeduplicatePropertiesTableIT {
   }
 
   @Test
-  public void execute_shouldDeduplicateRows_WhenOnlyKeyAndUserAreSpecified() throws SQLException {
+  void execute_shouldDeduplicateRows_WhenOnlyKeyAndUserAreSpecified() throws SQLException {
     createBaseProperties();
     createProperty(KEY, USER, null);
     createProperty(KEY, USER, null);
@@ -81,7 +81,7 @@ public class DeduplicatePropertiesTableIT {
   }
 
   @Test
-  public void execute_shouldDeduplicateRows_WhenKeyUserAndEntityAreSpecified() throws SQLException {
+  void execute_shouldDeduplicateRows_WhenKeyUserAndEntityAreSpecified() throws SQLException {
     createBaseProperties();
     createProperty(KEY, USER, ENTITY);
     createProperty(KEY, USER, ENTITY);
@@ -93,7 +93,7 @@ public class DeduplicatePropertiesTableIT {
   }
 
   @Test
-  public void execute_shouldBeReentrant() throws SQLException {
+  void execute_shouldBeReentrant() throws SQLException {
     createBaseProperties();
     createProperty(KEY, USER, ENTITY);
 
index fef596121d955250eb866fa41bae311d58560ec6..d160db48414678a35fac0f5b6a751f32485a8c7b 100644 (file)
 package org.sonar.server.platform.db.migration.version.v103;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.VARCHAR;
 import static org.sonar.server.platform.db.migration.version.v103.AddCreationMethodColumnInProjectsTable.PROJECTS_CREATION_METHOD_COLUMN_NAME;
 import static org.sonar.server.platform.db.migration.version.v103.AddCreationMethodColumnInProjectsTable.PROJECTS_TABLE_NAME;
 
-public class MakeCreationMethodColumnInProjectsNotNullableIT {
-  @Rule
+class MakeCreationMethodColumnInProjectsNotNullableIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(MakeCreationMethodColumnInProjectsNotNullable.class);
   private final MakeCreationMethodColumnInProjectsNotNullable underTest = new MakeCreationMethodColumnInProjectsNotNullable(db.database());
 
   @Test
-  public void user_local_column_is_not_null() throws SQLException {
+  void user_local_column_is_not_null() throws SQLException {
     db.assertColumnDefinition(PROJECTS_TABLE_NAME, PROJECTS_CREATION_METHOD_COLUMN_NAME, VARCHAR, null, true);
     underTest.execute();
     db.assertColumnDefinition(PROJECTS_TABLE_NAME, PROJECTS_CREATION_METHOD_COLUMN_NAME, VARCHAR, null, false);
   }
 
   @Test
-  public void migration_is_reentrant() throws SQLException {
+  void migration_is_reentrant() throws SQLException {
     db.assertColumnDefinition(PROJECTS_TABLE_NAME, PROJECTS_CREATION_METHOD_COLUMN_NAME, VARCHAR, null, true);
     underTest.execute();
     underTest.execute();
index fa65f104266c2733601e1bbb5c709b28aee41761..0e040f0127679e4596b84b0d496cf47fb0435769 100644 (file)
 package org.sonar.server.platform.db.migration.version.v103;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.sonar.server.platform.db.migration.version.v103.AddCreationMethodColumnInProjectsTable.PROJECTS_TABLE_NAME;
 
-public class PopulateCreationMethodColumnInProjectsTableIT {
+class PopulateCreationMethodColumnInProjectsTableIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulateCreationMethodColumnInProjectsTable.class);
   private final PopulateCreationMethodColumnInProjectsTable underTest = new PopulateCreationMethodColumnInProjectsTable(db.database());
 
   @Test
-  public void execute_whenProjectsTableIsEmpty_shouldDoNothing() throws SQLException {
+  void execute_whenProjectsTableIsEmpty_shouldDoNothing() throws SQLException {
     underTest.execute();
 
     assertThat(db.select("select creation_method from projects")).isEmpty();
   }
 
   @Test
-  public void execute_whenProjectsExist_shouldPopulateCreationMethodColumn() throws SQLException {
+  void execute_whenProjectsExist_shouldPopulateCreationMethodColumn() throws SQLException {
     insertProject("uuid-1");
     insertProject("uuid-2");
 
@@ -53,7 +53,7 @@ public class PopulateCreationMethodColumnInProjectsTableIT {
   }
 
   @Test
-  public void execute_isReentrant() throws SQLException {
+  void execute_isReentrant() throws SQLException {
     insertProject("uuid-1");
 
     underTest.execute();
index ef20a61ad73f617345adb34ea842b6722da217a0..d0de06f288ea0164f4735076e93f927a2eca8b72 100644 (file)
@@ -20,9 +20,9 @@
 package org.sonar.server.platform.db.migration.version.v103;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
-import org.sonar.api.testfixtures.log.LogTester;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+import org.sonar.api.testfixtures.log.LogTesterJUnit5;
 import org.sonar.core.util.UuidFactoryFast;
 import org.sonar.db.MigrationDbTester;
 
@@ -30,17 +30,17 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.tuple;
 import static org.sonar.server.platform.db.migration.version.v103.CreateGithubPermissionsMappingTable.GITHUB_PERMISSIONS_MAPPING_TABLE_NAME;
 
-public class PopulateGithubPermissionsMappingIT {
+class PopulateGithubPermissionsMappingIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulateGithubPermissionsMapping.class);
-  @Rule
-  public LogTester logTester = new LogTester();
+  @RegisterExtension
+  public final LogTesterJUnit5 logTester = new LogTesterJUnit5();
 
   private final PopulateGithubPermissionsMapping migration = new PopulateGithubPermissionsMapping(db.database(), UuidFactoryFast.getInstance());
 
   @Test
-  public void execute_whenTableAlreadyPopulated_doesNothing() throws SQLException {
+  void execute_whenTableAlreadyPopulated_doesNothing() throws SQLException {
     db.executeInsert(GITHUB_PERMISSIONS_MAPPING_TABLE_NAME,
       "UUID", UuidFactoryFast.getInstance().create(),
       "github_role", "gh_role",
@@ -54,14 +54,14 @@ public class PopulateGithubPermissionsMappingIT {
   }
 
   @Test
-  public void execute_whenTableIsEmpty_shouldPopulate() throws SQLException {
+  void execute_whenTableIsEmpty_shouldPopulate() throws SQLException {
     migration.execute();
 
     verifyMapping();
   }
 
   @Test
-  public void execute_isReentrant() throws SQLException {
+  void execute_isReentrant() throws SQLException {
     migration.execute();
     migration.execute();
     migration.execute();
index d4bd821de11496c6509c2782b6e98c5c89ed268b..06f8bf3b3e33a21c09654eaaad94b6c9814469ef 100644 (file)
@@ -20,8 +20,8 @@
 package org.sonar.server.platform.db.migration.version.v103;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.api.impl.utils.TestSystem2;
 import org.sonar.api.utils.System2;
 import org.sonar.core.util.UuidFactoryFast;
@@ -29,25 +29,25 @@ import org.sonar.db.MigrationDbTester;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-public class SetAllowQualityProfileDisableInheritedRulesIT {
+class SetAllowQualityProfileDisableInheritedRulesIT {
 
   private static final long NOW = 1;
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester dbTester = MigrationDbTester.createForMigrationStep(SetAllowQualityProfileDisableInheritedRules.class);
   private final System2 system2 = new TestSystem2().setNow(NOW);
 
   private final SetAllowQualityProfileDisableInheritedRules script = new SetAllowQualityProfileDisableInheritedRules(dbTester.database(), system2, UuidFactoryFast.getInstance());
 
   @Test
-  public void execute_shouldInsertPropertyWithFalseValue() throws SQLException {
+  void execute_shouldInsertPropertyWithFalseValue() throws SQLException {
     script.execute();
 
     assertThatForceAuthenticationEquals("false");
   }
 
   @Test
-  public void execute_shouldBeReentrant() throws SQLException {
+  void execute_shouldBeReentrant() throws SQLException {
     script.execute();
     // re-entrant
     script.execute();
@@ -56,7 +56,7 @@ public class SetAllowQualityProfileDisableInheritedRulesIT {
   }
 
   @Test
-  public void execute_shouldNotUpdateTheValueThatAlreadyExistsInTheDatabase() throws SQLException {
+  void execute_shouldNotUpdateTheValueThatAlreadyExistsInTheDatabase() throws SQLException {
     insertPropertyWithValueAsTrue();
     script.execute();
 
index 9ceacdb6c839a4dff5ab7cc1b381ef8507d02f8e..b36eb2c8fda3abe3348716a6424dde63943def86 100644 (file)
@@ -21,30 +21,30 @@ package org.sonar.server.platform.db.migration.version.v104;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.assertj.core.api.Assertions.assertThatCode;
 
-public class AddUuidColumnToGroupsUsersIT {
+class AddUuidColumnToGroupsUsersIT {
 
   private static final String TABLE_NAME = "groups_users";
   private static final String COLUMN_NAME = "uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(AddUuidColumnToGroupsUsers.class);
   private final AddUuidColumnToGroupsUsers underTest = new AddUuidColumnToGroupsUsers(db.database());
 
   @Test
-  public void execute_whenColumnDoesNotExist_shouldCreateColumn() throws SQLException {
+  void execute_whenColumnDoesNotExist_shouldCreateColumn() throws SQLException {
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
     underTest.execute();
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 40, true);
   }
 
   @Test
-  public void execute_whenColumnsAlreadyExists_shouldNotFail() throws SQLException {
+  void execute_whenColumnsAlreadyExists_shouldNotFail() throws SQLException {
     underTest.execute();
     assertThatCode(underTest::execute).doesNotThrowAnyException();
   }
index df91a20a8028a1bae725df67671cf92e73fed140..d9988b6bbda260972c864ded56b3d1a66083d140 100644 (file)
@@ -21,8 +21,8 @@ package org.sonar.server.platform.db.migration.version.v104;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
@@ -31,15 +31,15 @@ import static org.sonar.server.platform.db.migration.version.v104.CreateIssuesFi
 import static org.sonar.server.platform.db.migration.version.v104.CreateIssuesFixedTable.COLUMN_PULL_REQUEST_UUID;
 import static org.sonar.server.platform.db.migration.version.v104.CreateIssuesFixedTable.TABLE_NAME;
 
-public class CreateIssuesFixedTableIT {
+class CreateIssuesFixedTableIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateIssuesFixedTable.class);
 
   private final DdlChange underTest = new CreateIssuesFixedTable(db.database());
 
   @Test
-  public void execute_shouldCreateTable() throws SQLException {
+  void execute_shouldCreateTable() throws SQLException {
     db.assertTableDoesNotExist(TABLE_NAME);
 
     underTest.execute();
@@ -51,7 +51,7 @@ public class CreateIssuesFixedTableIT {
   }
 
   @Test
-  public void execute_shouldBeReentrant() throws SQLException {
+  void execute_shouldBeReentrant() throws SQLException {
     db.assertTableDoesNotExist(TABLE_NAME);
 
     underTest.execute();
index ffb66081cef408e22a7cf5384e47451b78368202..ec714c8d3c7c4fea41d740a31c34b95b2d9136b1 100644 (file)
 package org.sonar.server.platform.db.migration.version.v104;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.sonar.server.platform.db.migration.version.v104.AddUuidColumnToGroupsUsers.GROUPS_USERS_TABLE_NAME;
 import static org.sonar.server.platform.db.migration.version.v104.AddUuidColumnToGroupsUsers.GROUPS_USERS_UUID_COLUMN_NAME;
 import static org.sonar.server.platform.db.migration.version.v104.CreatePrimaryKeyOnGroupsUsersTable.PK_NAME;
 
-public class CreatePrimaryKeyOnGroupsUsersTableIT {
-  @Rule
+class CreatePrimaryKeyOnGroupsUsersTableIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreatePrimaryKeyOnGroupsUsersTable.class);
   private final CreatePrimaryKeyOnGroupsUsersTable createIndex = new CreatePrimaryKeyOnGroupsUsersTable(db.database());
 
   @Test
-  public void execute_whenPrimaryKeyDoesntExist_shouldCreatePrimaryKey() throws SQLException {
+  void execute_whenPrimaryKeyDoesntExist_shouldCreatePrimaryKey() throws SQLException {
     db.assertNoPrimaryKey(GROUPS_USERS_TABLE_NAME);
 
     createIndex.execute();
@@ -42,7 +42,7 @@ public class CreatePrimaryKeyOnGroupsUsersTableIT {
   }
 
   @Test
-  public void  execute_whenPrimaryKeyAlreadyExist_shouldKeepThePrimaryKeyAndNotFail() throws SQLException {
+  void  execute_whenPrimaryKeyAlreadyExist_shouldKeepThePrimaryKeyAndNotFail() throws SQLException {
     createIndex.execute();
     createIndex.execute();
 
index 1b797efd1c9d8254fe4a93fbc85e79d9a5468e32..0a1641964f5bc9b2382f5cc3b933eab316077077 100644 (file)
@@ -21,8 +21,8 @@ package org.sonar.server.platform.db.migration.version.v104;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
@@ -33,14 +33,14 @@ import static org.sonar.server.platform.db.migration.version.v104.CreateRuleTags
 import static org.sonar.server.platform.db.migration.version.v104.CreateRuleTagsTable.VALUE_COLUMN_NAME;
 import static org.sonar.server.platform.db.migration.version.v104.CreateRuleTagsTable.VALUE_COLUMN_SIZE;
 
-public class CreateRuleTagsTableIT {
-  @Rule
+class CreateRuleTagsTableIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreateRuleTagsTable.class);
 
   private final DdlChange createScmAccountsTable = new CreateRuleTagsTable(db.database());
 
   @Test
-  public void execute_whenRun_shouldCreateRuleTagsTable() throws SQLException {
+  void execute_whenRun_shouldCreateRuleTagsTable() throws SQLException {
     db.assertTableDoesNotExist(RULE_TAGS_TABLE_NAME);
 
     createScmAccountsTable.execute();
@@ -53,7 +53,7 @@ public class CreateRuleTagsTableIT {
   }
 
   @Test
-  public void execute_whenRunMoreThanOnce_shouldBeReentrant() throws SQLException {
+  void execute_whenRunMoreThanOnce_shouldBeReentrant() throws SQLException {
     db.assertTableDoesNotExist(RULE_TAGS_TABLE_NAME);
 
     createScmAccountsTable.execute();
index 57b2e422bc18b84c206f40677a5554d6cef3710c..19d7d6500e3dcba92fa2ef334e3cce46412a0238 100644 (file)
@@ -21,21 +21,21 @@ package org.sonar.server.platform.db.migration.version.v104;
 
 import java.sql.SQLException;
 import java.util.Map;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DataChange;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-public class DeleteRedundantFailedAlertsForApplicationsIT {
+class DeleteRedundantFailedAlertsForApplicationsIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DeleteRedundantFailedAlertsForApplications.class);
   private final DataChange underTest = new DeleteRedundantFailedAlertsForApplications(db.database());
 
-  @Before
+  @BeforeEach
   public void setUp() {
     // cleanup db
     db.executeUpdateSql("truncate table events");
@@ -44,7 +44,7 @@ public class DeleteRedundantFailedAlertsForApplicationsIT {
   }
 
   @Test
-  public void givenFailedAlertsForApplication_whenExecuted_thenFailedAlertsAreDeleted() throws SQLException {
+  void givenFailedAlertsForApplication_whenExecuted_thenFailedAlertsAreDeleted() throws SQLException {
     // given
     insertComponent("app1", "appUuid1", "appUuid1", "APP");
 
@@ -71,7 +71,7 @@ public class DeleteRedundantFailedAlertsForApplicationsIT {
   }
 
   @Test
-  public void givenFailedAlertsForProject_whenExecute_thenTheEventsAreNotDeleted() throws SQLException {
+  void givenFailedAlertsForProject_whenExecute_thenTheEventsAreNotDeleted() throws SQLException {
     // given
     insertComponent("project1", "projectUuid1", "projectUuid1", "TRK");
 
@@ -89,7 +89,7 @@ public class DeleteRedundantFailedAlertsForApplicationsIT {
   }
 
   @Test
-  public void givenMigration_whenExecutedMoreThanOnce_thenNoError() throws SQLException {
+  void givenMigration_whenExecutedMoreThanOnce_thenNoError() throws SQLException {
     // given
     insertComponent("app1", "appUuid1", "appUuid1", "APP");
 
index 088b0d59148743d1763264b58dcf75f8bda756a3..929689e43c02fa4a8a31949ce95caa7eb5c9384c 100644 (file)
@@ -21,28 +21,28 @@ package org.sonar.server.platform.db.migration.version.v104;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
-public class DropSystemTagsInRulesIT {
+class DropSystemTagsInRulesIT {
   private static final String TABLE_NAME = "rules";
   private static final String COLUMN_NAME = "system_tags";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropSystemTagsInRules.class);
   private final DdlChange underTest = new DropSystemTagsInRules(db.database());
 
   @Test
-  public void executed_whenRun_shouldDropSystemTagsColumn() throws SQLException {
+  void executed_whenRun_shouldDropSystemTagsColumn() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 4000, true);
     underTest.execute();
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
   }
 
   @Test
-  public void execute_whenRunMoreThanOnce_shouldBeReentrant() throws SQLException {
+  void execute_whenRunMoreThanOnce_shouldBeReentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 4000, true);
     underTest.execute();
     underTest.execute();
index 8354acae1960493debf681f1d1dd0b58f03b5abb..476d5cf8ccf8f59f2ecc1967ad69df764b89dcc2 100644 (file)
@@ -21,28 +21,28 @@ package org.sonar.server.platform.db.migration.version.v104;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
-public class DropTagsInRulesIT {
+class DropTagsInRulesIT {
   static final String TABLE_NAME = "rules";
   static final String COLUMN_NAME = "tags";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropTagsInRules.class);
   private final DdlChange underTest = new DropTagsInRules(db.database());
 
   @Test
-  public void executed_whenRun_shouldDropTagsColumn() throws SQLException {
+  void executed_whenRun_shouldDropTagsColumn() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 4000, true);
     underTest.execute();
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
   }
 
   @Test
-  public void execute_whenExecutedMoreThanOnce_shouldBeReentrant() throws SQLException {
+  void execute_whenExecutedMoreThanOnce_shouldBeReentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 4000, true);
     underTest.execute();
     underTest.execute();
index 876a75175350c69f7180649f2d801fed1bd07ecd..238d125c303a1ad3a9138982c8edcd36457e0ffc 100644 (file)
 package org.sonar.server.platform.db.migration.version.v104;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static java.sql.Types.VARCHAR;
 import static org.sonar.server.platform.db.migration.version.v104.AddUuidColumnToGroupsUsers.GROUPS_USERS_TABLE_NAME;
 import static org.sonar.server.platform.db.migration.version.v104.AddUuidColumnToGroupsUsers.GROUPS_USERS_UUID_COLUMN_NAME;
 
-public class MakeUuidInGroupsUsersNotNullableIT {
+class MakeUuidInGroupsUsersNotNullableIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep( MakeUuidInGroupsUsersNotNullable.class);
   private final  MakeUuidInGroupsUsersNotNullable underTest = new  MakeUuidInGroupsUsersNotNullable(db.database());
 
   @Test
-  public void execute_whenUuidColumnIsNullable_shouldMakeItNonNullable() throws SQLException {
+  void execute_whenUuidColumnIsNullable_shouldMakeItNonNullable() throws SQLException {
     db.assertColumnDefinition(GROUPS_USERS_TABLE_NAME, GROUPS_USERS_UUID_COLUMN_NAME, VARCHAR, null, true);
     underTest.execute();
     db.assertColumnDefinition(GROUPS_USERS_TABLE_NAME, GROUPS_USERS_UUID_COLUMN_NAME, VARCHAR, null, false);
   }
 
   @Test
-  public void execute_whenUuidColumnIsNullable_shouldKeepItNullableAndNotFail() throws SQLException {
+  void execute_whenUuidColumnIsNullable_shouldKeepItNullableAndNotFail() throws SQLException {
     db.assertColumnDefinition(GROUPS_USERS_TABLE_NAME, GROUPS_USERS_UUID_COLUMN_NAME, VARCHAR, null, true);
     underTest.execute();
     underTest.execute();
index df42ba5b6ccf69b7aaa936c56cd13be806dbdf38..b794628c53497cb34de1658be96ec63b2ab89716 100644 (file)
@@ -23,24 +23,24 @@ import java.sql.SQLException;
 import java.util.List;
 import java.util.Map;
 import org.assertj.core.groups.Tuple;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.core.util.UuidFactoryFast;
 import org.sonar.db.MigrationDbTester;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.tuple;
 
-public class PopulateGroupsUsersUuidIT {
+class PopulateGroupsUsersUuidIT {
 
   private static final String GROUPS_USERS_TABLE_NAME = "groups_users";
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulateGroupsUsersUuid.class);
 
   private final PopulateGroupsUsersUuid migration = new PopulateGroupsUsersUuid(db.database(), UuidFactoryFast.getInstance());
 
   @Test
-  public void execute_whenTableIsEmpty_shouldPopulate() throws SQLException {
+  void execute_whenTableIsEmpty_shouldPopulate() throws SQLException {
     insertRowsWithoutUuid();
 
     migration.execute();
@@ -51,7 +51,7 @@ public class PopulateGroupsUsersUuidIT {
 
 
   @Test
-  public void execute_isReentrant() throws SQLException {
+  void execute_isReentrant() throws SQLException {
     insertRowsWithoutUuid();
     migration.execute();
     List<Tuple> existingUuids = getExistingUuids();
index 7ca957a4f6801cdd7e12e3e53456733442279d93..f7bb7df824b8dacd992b26b43391d90218b3885b 100644 (file)
@@ -21,22 +21,22 @@ package org.sonar.server.platform.db.migration.version.v104;
 
 import java.sql.SQLException;
 import javax.annotation.Nullable;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.tuple;
 
-public class PopulateRuleTagsTableIT {
+class PopulateRuleTagsTableIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(PopulateRuleTagsTable.class);
 
   private final PopulateRuleTagsTable migration = new PopulateRuleTagsTable(db.database());
 
   @Test
-  public void execute_whenTagsExist_shouldPopulateProperly() throws SQLException {
+  void execute_whenTagsExist_shouldPopulateProperly() throws SQLException {
     insertRule("uuid-1", null, "tag_1,tag_2");
     insertRule("uuid-2", "systag_1,systag_2", null);
     insertRule("uuid-3", "systag_3,systag_4", "tag_3,tag_4");
@@ -58,7 +58,7 @@ public class PopulateRuleTagsTableIT {
   }
 
   @Test
-  public void execute_whenEmptyOrDuplicateTagsExist_shouldNotBeMigrated() throws SQLException {
+  void execute_whenEmptyOrDuplicateTagsExist_shouldNotBeMigrated() throws SQLException {
     insertRule("uuid-1", null, "tag_1,,tag_2");
     insertRule("uuid-2", "systag_1,,systag_2,systag_2,", null);
 
@@ -75,7 +75,7 @@ public class PopulateRuleTagsTableIT {
   }
 
   @Test
-  public void execute_whenRunMoreThanOnce_shouldBeReentrant() throws SQLException {
+  void execute_whenRunMoreThanOnce_shouldBeReentrant() throws SQLException {
     insertRule("uuid-3", "sys_tag", "tag");
     migration.execute();
     migration.execute();
index 3436a4c7b34f7b50a65b736590f0202885077ae5..b5285f8560a2889fdcf95d78b708d27c0405c8c1 100644 (file)
@@ -23,28 +23,28 @@ import java.sql.SQLException;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.tuple;
 
-public class RemoveCleanCodeAttributeFromCustomHotspotRulesIT {
+class RemoveCleanCodeAttributeFromCustomHotspotRulesIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RemoveCleanCodeAttributeFromCustomHotspotRules.class);
   private final RemoveCleanCodeAttributeFromCustomHotspotRules underTest = new RemoveCleanCodeAttributeFromCustomHotspotRules(db.database());
 
   @Test
-  public void execute_whenRulesTableIsEmpty_shouldDoNothing() throws SQLException {
+  void execute_whenRulesTableIsEmpty_shouldDoNothing() throws SQLException {
     underTest.execute();
 
     assertThat(db.select("select clean_code_attribute from rules")).isEmpty();
   }
 
   @Test
-  public void execute_whenCustomHotspotRuleExist_shouldRemoveCleanCodeAttributeOnlyFromHotspot() throws SQLException {
+  void execute_whenCustomHotspotRuleExist_shouldRemoveCleanCodeAttributeOnlyFromHotspot() throws SQLException {
     insertRule("custom_hotspot_rule", 4, "CONVENTIONAL");
     insertRule("other_rule", 1, "ETHICAL");
 
@@ -66,7 +66,7 @@ public class RemoveCleanCodeAttributeFromCustomHotspotRulesIT {
   }
 
   @Test
-  public void execute_whenCustomHotspotRuleExist_isReentrant() throws SQLException {
+  void execute_whenCustomHotspotRuleExist_isReentrant() throws SQLException {
     insertRule("custom_hotspot_rule", 4, "CONVENTIONAL");
     insertRule("other_rule", 1, "ETHICAL");
 
index c50b52e59dc120263df79bd4495d11ea2ef4fd9d..d335b390a2db19a14c7a8721df1afc38719e865a 100644 (file)
 package org.sonar.server.platform.db.migration.version.v104;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
 
-public class RenameWontFixIssuesMetricIT {
+class RenameWontFixIssuesMetricIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(RenameWontFixIssuesMetric.class);
   private final RenameWontFixIssuesMetric underTest = new RenameWontFixIssuesMetric(db.database());
 
   @Test
-  public void execute_whenMetricsTableIsEmpty_shouldDoNothing() throws SQLException {
+  void execute_whenMetricsTableIsEmpty_shouldDoNothing() throws SQLException {
     underTest.execute();
 
     assertThat(db.select("select name from metrics")).isEmpty();
   }
 
   @Test
-  public void execute_whenWontFixMetricExist_shouldRenameToAccepted() throws SQLException {
+  void execute_whenWontFixMetricExist_shouldRenameToAccepted() throws SQLException {
     insertMetric("wont_fix_issues");
     insertMetric("other_metric");
 
@@ -53,7 +53,7 @@ public class RenameWontFixIssuesMetricIT {
   }
 
   @Test
-  public void execute_isReentrant() throws SQLException {
+  void execute_isReentrant() throws SQLException {
     insertMetric("wont_fix_issues");
     insertMetric("other_metric");
 
index 3e295373be1a2e19bdcac331ce34fe21eeefebaa..08ea6d5558b9e131ad266e6a6b5d7dc8b0695255 100644 (file)
@@ -20,8 +20,8 @@
 package org.sonar.server.platform.db.migration.version.v105;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.sonar.server.platform.db.migration.version.v105.CreatePrimaryKeyOnIssuesImpactsTable.ISSUE_KEY_COLUMN_NAME;
@@ -29,14 +29,14 @@ import static org.sonar.server.platform.db.migration.version.v105.CreatePrimaryK
 import static org.sonar.server.platform.db.migration.version.v105.CreatePrimaryKeyOnIssuesImpactsTable.SOFTWARE_QUALITY_COLUMN;
 import static org.sonar.server.platform.db.migration.version.v105.CreatePrimaryKeyOnIssuesImpactsTable.TABLE_NAME;
 
-public class CreatePrimaryKeyOnIssuesImpactsTableIT {
-  @Rule
+class CreatePrimaryKeyOnIssuesImpactsTableIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreatePrimaryKeyOnIssuesImpactsTable.class);
 
   private final CreatePrimaryKeyOnIssuesImpactsTable createIndex = new CreatePrimaryKeyOnIssuesImpactsTable(db.database());
 
   @Test
-  public void execute_whenPrimaryKeyDoesntExist_shouldCreatePrimaryKey() throws SQLException {
+  void execute_whenPrimaryKeyDoesntExist_shouldCreatePrimaryKey() throws SQLException {
     db.assertNoPrimaryKey(TABLE_NAME);
 
     createIndex.execute();
@@ -44,7 +44,7 @@ public class CreatePrimaryKeyOnIssuesImpactsTableIT {
   }
 
   @Test
-  public void execute_whenPrimaryKeyAlreadyExist_shouldKeepThePrimaryKeyAndNotFail() throws SQLException {
+  void execute_whenPrimaryKeyAlreadyExist_shouldKeepThePrimaryKeyAndNotFail() throws SQLException {
     createIndex.execute();
     createIndex.execute();
 
index a2749be32c53ac9953b2f858980d46a2840d5299..b0f4df2998186b0e5fb3d325fae664e26147d5d5 100644 (file)
@@ -20,8 +20,8 @@
 package org.sonar.server.platform.db.migration.version.v105;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 
 import static org.sonar.server.platform.db.migration.version.v105.CreatePrimaryKeyOnRulesDefaultImpactsTable.PK_NAME;
@@ -29,14 +29,14 @@ import static org.sonar.server.platform.db.migration.version.v105.CreatePrimaryK
 import static org.sonar.server.platform.db.migration.version.v105.CreatePrimaryKeyOnRulesDefaultImpactsTable.SOFTWARE_QUALITY_COLUMN;
 import static org.sonar.server.platform.db.migration.version.v105.CreatePrimaryKeyOnRulesDefaultImpactsTable.TABLE_NAME;
 
-public class CreatePrimaryKeyOnRulesDefaultImpactsTableIT {
-  @Rule
+class CreatePrimaryKeyOnRulesDefaultImpactsTableIT {
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(CreatePrimaryKeyOnRulesDefaultImpactsTable.class);
 
   private final CreatePrimaryKeyOnRulesDefaultImpactsTable createIndex = new CreatePrimaryKeyOnRulesDefaultImpactsTable(db.database());
 
   @Test
-  public void execute_whenPrimaryKeyDoesntExist_shouldCreatePrimaryKey() throws SQLException {
+  void execute_whenPrimaryKeyDoesntExist_shouldCreatePrimaryKey() throws SQLException {
     db.assertNoPrimaryKey(TABLE_NAME);
 
     createIndex.execute();
@@ -44,7 +44,7 @@ public class CreatePrimaryKeyOnRulesDefaultImpactsTableIT {
   }
 
   @Test
-  public void execute_whenPrimaryKeyAlreadyExist_shouldKeepThePrimaryKeyAndNotFail() throws SQLException {
+  void execute_whenPrimaryKeyAlreadyExist_shouldKeepThePrimaryKeyAndNotFail() throws SQLException {
     createIndex.execute();
     createIndex.execute();
 
index 22c92f8bdcc63e98d4a1ac17d16a1cbd4a1e960e..f88850d503b0d81a34959efd4bf8149d0884e2a2 100644 (file)
@@ -20,8 +20,8 @@
 package org.sonar.server.platform.db.migration.version.v105;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder;
 import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator;
@@ -31,9 +31,9 @@ import static org.sonar.server.platform.db.migration.version.v105.DropPrimaryKey
 import static org.sonar.server.platform.db.migration.version.v105.DropPrimaryKeyConstraintInIssuesImpactsTable.CONSTRAINT_NAME;
 import static org.sonar.server.platform.db.migration.version.v105.DropPrimaryKeyConstraintInIssuesImpactsTable.TABLE_NAME;
 
-public class DropPrimaryKeyConstraintInIssuesImpactsTableIT {
+class DropPrimaryKeyConstraintInIssuesImpactsTableIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropPrimaryKeyConstraintInIssuesImpactsTable.class);
 
   private final DbPrimaryKeyConstraintFinder dbPrimaryKeyConstraintFinder = new DbPrimaryKeyConstraintFinder(db.database());
@@ -41,14 +41,14 @@ public class DropPrimaryKeyConstraintInIssuesImpactsTableIT {
     new DropPrimaryKeySqlGenerator(db.database(), dbPrimaryKeyConstraintFinder), dbPrimaryKeyConstraintFinder);
 
   @Test
-  public void execute_shouldRemoveExistingPrimaryKey() throws SQLException {
+  void execute_shouldRemoveExistingPrimaryKey() throws SQLException {
     db.assertPrimaryKey(TABLE_NAME, CONSTRAINT_NAME, COLUMN_NAME);
     underTest.execute();
     db.assertNoPrimaryKey(TABLE_NAME);
   }
 
   @Test
-  public void execute_when_reentrant_shouldRemoveExistingPrimaryKey() throws SQLException {
+  void execute_when_reentrant_shouldRemoveExistingPrimaryKey() throws SQLException {
     db.assertPrimaryKey(TABLE_NAME, CONSTRAINT_NAME, COLUMN_NAME);
     underTest.execute();
     underTest.execute();
index 4dec602889dd4bd34628c43b4dd6620dd1de4799..16dfefbb258b5cf07628986cfb61674f5e6130c7 100644 (file)
@@ -20,8 +20,8 @@
 package org.sonar.server.platform.db.migration.version.v105;
 
 import java.sql.SQLException;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.sql.DbPrimaryKeyConstraintFinder;
 import org.sonar.server.platform.db.migration.sql.DropPrimaryKeySqlGenerator;
@@ -31,9 +31,9 @@ import static org.sonar.server.platform.db.migration.version.v105.DropPrimaryKey
 import static org.sonar.server.platform.db.migration.version.v105.DropPrimaryKeyConstraintInRulesDefaultImpactsTable.CONSTRAINT_NAME;
 import static org.sonar.server.platform.db.migration.version.v105.DropPrimaryKeyConstraintInRulesDefaultImpactsTable.TABLE_NAME;
 
-public class DropPrimaryKeyConstraintInRulesDefaultImpactsTableIT {
+class DropPrimaryKeyConstraintInRulesDefaultImpactsTableIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropPrimaryKeyConstraintInRulesDefaultImpactsTable.class);
 
   private final DbPrimaryKeyConstraintFinder dbPrimaryKeyConstraintFinder = new DbPrimaryKeyConstraintFinder(db.database());
@@ -41,14 +41,14 @@ public class DropPrimaryKeyConstraintInRulesDefaultImpactsTableIT {
     new DropPrimaryKeySqlGenerator(db.database(), dbPrimaryKeyConstraintFinder), dbPrimaryKeyConstraintFinder);
 
   @Test
-  public void execute_shouldRemoveExistingPrimaryKey() throws SQLException {
+  void execute_shouldRemoveExistingPrimaryKey() throws SQLException {
     db.assertPrimaryKey(TABLE_NAME, CONSTRAINT_NAME, COLUMN_NAME);
     underTest.execute();
     db.assertNoPrimaryKey(TABLE_NAME);
   }
 
   @Test
-  public void execute_when_reentrant_shouldRemoveExistingPrimaryKey() throws SQLException {
+  void execute_when_reentrant_shouldRemoveExistingPrimaryKey() throws SQLException {
     db.assertPrimaryKey(TABLE_NAME, CONSTRAINT_NAME, COLUMN_NAME);
     underTest.execute();
     underTest.execute();
index ae4dbce13aa393d4edb34ab1d940f66efca11125..245dd4b4f13205620892f70df541cedcc1541359 100644 (file)
@@ -21,29 +21,29 @@ package org.sonar.server.platform.db.migration.version.v105;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
 import static org.sonar.server.platform.db.migration.version.v105.DropUuidColumnInIssuesImpactsTable.COLUMN_NAME;
 import static org.sonar.server.platform.db.migration.version.v105.DropUuidColumnInIssuesImpactsTable.TABLE_NAME;
 
-public class DropUuidColumnInIssuesImpactsTableIT {
+class DropUuidColumnInIssuesImpactsTableIT {
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropUuidColumnInIssuesImpactsTable.class);
   private final DdlChange underTest = new DropUuidColumnInIssuesImpactsTable(db.database());
 
   @Test
-  public void executed_whenRun_shouldDropSystemTagsColumn() throws SQLException {
+  void executed_whenRun_shouldDropSystemTagsColumn() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 40, false);
     underTest.execute();
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
   }
 
   @Test
-  public void execute_whenRunMoreThanOnce_shouldBeReentrant() throws SQLException {
+  void execute_whenRunMoreThanOnce_shouldBeReentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 40, false);
     underTest.execute();
     underTest.execute();
index 6428c67b0ab38cce0af354b9e11d467b0e6331d3..503de4e9a67b4e0e19633dde1f24e3481113c616 100644 (file)
@@ -21,28 +21,28 @@ package org.sonar.server.platform.db.migration.version.v105;
 
 import java.sql.SQLException;
 import java.sql.Types;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
 import org.sonar.db.MigrationDbTester;
 import org.sonar.server.platform.db.migration.step.DdlChange;
 
-public class DropUuidColumnInRulesDefaultImpactsTableIT {
+class DropUuidColumnInRulesDefaultImpactsTableIT {
   private static final String TABLE_NAME = "issues_impacts";
   private static final String COLUMN_NAME = "uuid";
 
-  @Rule
+  @RegisterExtension
   public final MigrationDbTester db = MigrationDbTester.createForMigrationStep(DropUuidColumnInIssuesImpactsTable.class);
   private final DdlChange underTest = new DropUuidColumnInIssuesImpactsTable(db.database());
 
   @Test
-  public void executed_whenRun_shouldDropSystemTagsColumn() throws SQLException {
+  void executed_whenRun_shouldDropSystemTagsColumn() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 40, false);
     underTest.execute();
     db.assertColumnDoesNotExist(TABLE_NAME, COLUMN_NAME);
   }
 
   @Test
-  public void execute_whenRunMoreThanOnce_shouldBeReentrant() throws SQLException {
+  void execute_whenRunMoreThanOnce_shouldBeReentrant() throws SQLException {
     db.assertColumnDefinition(TABLE_NAME, COLUMN_NAME, Types.VARCHAR, 40, false);
     underTest.execute();
     underTest.execute();
index 69ebcb8fadc1bac0c0fcefaa1a9443f94ed0ce61..1622b3bb9f10897d9a587e9d68a6685225e3dfe7 100644 (file)
@@ -21,9 +21,12 @@ package org.sonar.db;
 
 import java.sql.SQLException;
 import javax.annotation.Nullable;
+import org.junit.jupiter.api.extension.AfterEachCallback;
+import org.junit.jupiter.api.extension.BeforeEachCallback;
+import org.junit.jupiter.api.extension.ExtensionContext;
 import org.sonar.server.platform.db.migration.step.MigrationStep;
 
-public class MigrationDbTester extends AbstractDbTester<MigrationTestDb> {
+public class MigrationDbTester extends AbstractDbTester<MigrationTestDb> implements BeforeEachCallback, AfterEachCallback {
 
   private MigrationDbTester(@Nullable Class<? extends MigrationStep> migrationStepClass) {
     super(new MigrationTestDb(migrationStepClass));
@@ -57,4 +60,14 @@ public class MigrationDbTester extends AbstractDbTester<MigrationTestDb> {
       throw new IllegalStateException("Fail to truncate db tables", e);
     }
   }
+
+  @Override
+  public void afterEach(ExtensionContext extensionContext) throws Exception {
+    after();
+  }
+
+  @Override
+  public void beforeEach(ExtensionContext extensionContext) throws Exception {
+    before();
+  }
 }