@@ -54,7 +54,7 @@ import static org.sonar.db.component.BranchType.BRANCH; | |||
import static org.sonar.db.component.BranchType.PULL_REQUEST; | |||
@RunWith(DataProviderRunner.class) | |||
public class BranchPersisterImplTest { | |||
public class BranchPersisterImplIT { | |||
private final static Component MAIN = builder(Component.Type.PROJECT, 1, "PROJECT_KEY").setUuid("PROJECT_UUID").setName("p1").build(); | |||
private final static Component BRANCH1 = builder(Component.Type.PROJECT, 2, "BRANCH_KEY").setUuid("BRANCH_UUID").build(); | |||
private final static Component PR1 = builder(Component.Type.PROJECT, 3, "develop").setUuid("PR_UUID").build(); |
@@ -62,7 +62,7 @@ import static org.sonar.ce.task.projectanalysis.component.ReportComponent.builde | |||
import static org.sonar.ce.task.projectanalysis.filemove.FileMoveDetectionStep.MIN_REQUIRED_SCORE; | |||
import static org.sonar.db.component.BranchType.*; | |||
public class FileMoveDetectionStepTest { | |||
public class FileMoveDetectionStepIT { | |||
private static final String SNAPSHOT_UUID = "uuid_1"; | |||
private static final Analysis ANALYSIS = new Analysis.Builder() | |||
@@ -548,14 +548,14 @@ public class FileMoveDetectionStepTest { | |||
@Test | |||
public void real_life_use_case() throws Exception { | |||
prepareBranchAnalysis(ANALYSIS); | |||
for (File f : FileUtils.listFiles(new File("src/test/resources/org/sonar/ce/task/projectanalysis/filemove/FileMoveDetectionStepTest/v1"), null, false)) { | |||
for (File f : FileUtils.listFiles(new File("src/it/resources/org/sonar/ce/task/projectanalysis/filemove/FileMoveDetectionStepIT/v1"), null, false)) { | |||
insertFiles("uuid_" + f.getName().hashCode()); | |||
insertContentOfFileInDb("uuid_" + f.getName().hashCode(), readLines(f)); | |||
} | |||
Map<String, Component> comps = new HashMap<>(); | |||
int i = 1; | |||
for (File f : FileUtils.listFiles(new File("src/test/resources/org/sonar/ce/task/projectanalysis/filemove/FileMoveDetectionStepTest/v2"), null, false)) { | |||
for (File f : FileUtils.listFiles(new File("src/it/resources/org/sonar/ce/task/projectanalysis/filemove/FileMoveDetectionStepIT/v2"), null, false)) { | |||
String[] lines = readLines(f); | |||
Component c = builder(Component.Type.FILE, i++) | |||
.setUuid("uuid_" + f.getName().hashCode()) |
@@ -36,6 +36,7 @@ import org.sonar.ce.task.projectanalysis.analysis.Branch; | |||
import org.sonar.ce.task.projectanalysis.component.Component; | |||
import org.sonar.ce.task.projectanalysis.component.FileAttributes; | |||
import org.sonar.ce.task.projectanalysis.component.TreeRootHolderRule; | |||
import org.sonar.ce.task.projectanalysis.filemove.FileMoveDetectionStepIT.RecordingMutableAddedFileRepository; | |||
import org.sonar.ce.task.projectanalysis.filemove.MovedFilesRepository.OriginalFile; | |||
import org.sonar.ce.task.step.TestComputationStepContext; | |||
import org.sonar.core.util.Uuids; | |||
@@ -56,12 +57,11 @@ import static org.mockito.Mockito.when; | |||
import static org.sonar.ce.task.projectanalysis.component.Component.Type.FILE; | |||
import static org.sonar.ce.task.projectanalysis.component.Component.Type.PROJECT; | |||
import static org.sonar.ce.task.projectanalysis.component.ReportComponent.builder; | |||
import static org.sonar.ce.task.projectanalysis.filemove.FileMoveDetectionStepTest.RecordingMutableAddedFileRepository; | |||
import static org.sonar.ce.task.projectanalysis.filemove.FileMoveDetectionStepTest.verifyStatistics; | |||
import static org.sonar.ce.task.projectanalysis.filemove.FileMoveDetectionStepIT.verifyStatistics; | |||
import static org.sonar.db.component.BranchType.BRANCH; | |||
import static org.sonar.db.component.BranchType.PULL_REQUEST; | |||
public class PullRequestFileMoveDetectionStepTest { | |||
public class PullRequestFileMoveDetectionStepIT { | |||
private static final String ROOT_REF = "0"; | |||
private static final String FILE_1_REF = "1"; | |||
private static final String FILE_2_REF = "2"; | |||
@@ -270,7 +270,7 @@ public class PullRequestFileMoveDetectionStepTest { | |||
private static Set<Component> createFileComponents(Set<FileReference> references) { | |||
return references | |||
.stream() | |||
.map(PullRequestFileMoveDetectionStepTest::createReportFileComponent) | |||
.map(PullRequestFileMoveDetectionStepIT::createReportFileComponent) | |||
.collect(toSet()); | |||
} | |||
@@ -33,7 +33,7 @@ import org.sonar.db.metric.MetricDto; | |||
import static org.assertj.core.api.Assertions.assertThat; | |||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | |||
public class MetricRepositoryImplTest { | |||
public class MetricRepositoryImplIT { | |||
private static final String SOME_KEY = "some_key"; | |||
private static final String SOME_UUID = "uuid"; | |||
@@ -54,7 +54,7 @@ import static org.mockito.Mockito.when; | |||
import static org.sonar.api.utils.log.LoggerLevel.TRACE; | |||
import static org.sonar.ce.task.projectanalysis.component.ReportComponent.builder; | |||
public class ScmInfoDbLoaderTest { | |||
public class ScmInfoDbLoaderIT { | |||
static final int FILE_REF = 1; | |||
static final Component FILE = builder(Component.Type.FILE, FILE_REF).setKey("FILE_KEY").setUuid("FILE_UUID").build(); | |||
static final long DATE_1 = 123456789L; |
@@ -64,7 +64,7 @@ import static org.sonar.scanner.protocol.output.ScannerReport.Component.Componen | |||
import static org.sonar.scanner.protocol.output.ScannerReport.Component.ComponentType.PROJECT; | |||
@RunWith(DataProviderRunner.class) | |||
public class BuildComponentTreeStepTest { | |||
public class BuildComponentTreeStepIT { | |||
private static final String NO_SCANNER_PROJECT_VERSION = null; | |||
private static final String NO_SCANNER_BUILD_STRING = null; | |||
@@ -62,7 +62,7 @@ import static org.mockito.Mockito.when; | |||
import static org.sonar.ce.task.projectanalysis.component.Component.Type.FILE; | |||
import static org.sonar.ce.task.projectanalysis.component.Component.Type.PROJECT; | |||
public class LoadCrossProjectDuplicationsRepositoryStepTest { | |||
public class LoadCrossProjectDuplicationsRepositoryStepIT { | |||
private static final String XOO_LANGUAGE = "xoo"; |
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.tuple; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
public class PersistAnalysisPropertiesStepTest { | |||
public class PersistAnalysisPropertiesStepIT { | |||
private static final String SNAPSHOT_UUID = randomAlphanumeric(40); | |||
private static final String SMALL_VALUE1 = randomAlphanumeric(50); | |||
private static final String SMALL_VALUE2 = randomAlphanumeric(50); |
@@ -45,7 +45,7 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
public class PersistCrossProjectDuplicationIndexStepTest { | |||
public class PersistCrossProjectDuplicationIndexStepIT { | |||
private static final int FILE_1_REF = 2; | |||
private static final int FILE_2_REF = 3; |
@@ -53,7 +53,7 @@ import static org.sonar.db.event.EventDto.CATEGORY_ALERT; | |||
import static org.sonar.db.event.EventDto.CATEGORY_PROFILE; | |||
import static org.sonar.db.event.EventDto.CATEGORY_VERSION; | |||
public class PersistEventsStepTest extends BaseStepTest { | |||
public class PersistEventsStepIT extends BaseStepTest { | |||
private static final long NOW = 1225630680000L; | |||
private static final ReportComponent ROOT = builder(PROJECT, 1) |
@@ -32,7 +32,7 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | |||
import static org.sonar.db.component.BranchType.BRANCH; | |||
public class IgnoreOrphanBranchStepTest { | |||
public class IgnoreOrphanBranchStepIT { | |||
private String BRANCH_UUID = "branch_uuid"; | |||
@@ -46,7 +46,7 @@ import static org.mockito.Mockito.when; | |||
import static org.sonar.db.component.ComponentDto.UUID_PATH_OF_ROOT; | |||
import static org.sonar.db.component.ComponentDto.UUID_PATH_SEPARATOR; | |||
public class ExportComponentsStepTest { | |||
public class ExportComponentsStepIT { | |||
private static final String PROJECT_UUID = "PROJECT_UUID"; | |||
private static final ComponentDto PROJECT = new ComponentDto() |
@@ -46,7 +46,7 @@ import static org.sonar.db.component.ComponentDto.UUID_PATH_SEPARATOR; | |||
import static org.sonar.db.component.SnapshotDto.STATUS_PROCESSED; | |||
import static org.sonar.db.component.SnapshotDto.STATUS_UNPROCESSED; | |||
public class ExportMeasuresStepTest { | |||
public class ExportMeasuresStepIT { | |||
private static final ComponentDto PROJECT = new ComponentDto() | |||
.setKey("project_key") |
@@ -33,7 +33,7 @@ import static org.junit.Assert.assertThrows; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
public class DetectPluginChangeTest { | |||
public class DetectPluginChangeIT { | |||
@Rule | |||
public DbTester dbTester = DbTester.create(); | |||
@@ -47,7 +47,7 @@ import static org.mockito.Mockito.verify; | |||
import static org.mockito.Mockito.verifyNoMoreInteractions; | |||
import static org.mockito.Mockito.when; | |||
public class CachingRuleFinderTest { | |||
public class CachingRuleFinderIT { | |||
@org.junit.Rule | |||
public DbTester dbTester = DbTester.create(System2.INSTANCE); | |||
@@ -259,7 +259,7 @@ public class CachingRuleFinderTest { | |||
@Test | |||
public void findAll_returns_all_rules_when_RuleQuery_has_no_non_null_field() { | |||
assertThat(underTest.findAll(RuleQuery.create())) | |||
.extracting(CachingRuleFinderTest::toRuleKey) | |||
.extracting(CachingRuleFinderIT::toRuleKey) | |||
.containsOnly(Arrays.stream(ruleDtos).map(RuleDto::getKey).toArray(RuleKey[]::new)); | |||
} | |||
@@ -276,10 +276,10 @@ public class CachingRuleFinderTest { | |||
CachingRuleFinder underTest = new CachingRuleFinder(dbClient, ruleDescriptionFormatter); | |||
assertThat(underTest.findAll(RuleQuery.create().withRepositoryKey(repoKey))) | |||
.extracting(CachingRuleFinderTest::toRuleKey) | |||
.extracting(CachingRuleFinderIT::toRuleKey) | |||
.containsExactly(sameRepoKey[1].getKey(), sameRepoKey[0].getKey()); | |||
assertThat(underTest.findAll(RuleQuery.create().withRepositoryKey(otherRule.getRepositoryKey()))) | |||
.extracting(CachingRuleFinderTest::toRuleKey) | |||
.extracting(CachingRuleFinderIT::toRuleKey) | |||
.containsExactly(otherRule.getKey()); | |||
assertThat(underTest.findAll(RuleQuery.create().withRepositoryKey(repoKey.toLowerCase()))) | |||
.isEmpty(); | |||
@@ -299,10 +299,10 @@ public class CachingRuleFinderTest { | |||
CachingRuleFinder underTest = new CachingRuleFinder(dbClient, ruleDescriptionFormatter); | |||
assertThat(underTest.findAll(RuleQuery.create().withKey(ruleKey))) | |||
.extracting(CachingRuleFinderTest::toRuleKey) | |||
.extracting(CachingRuleFinderIT::toRuleKey) | |||
.containsExactly(sameRuleKey[1].getKey(), sameRuleKey[0].getKey()); | |||
assertThat(underTest.findAll(RuleQuery.create().withKey(otherRule.getRuleKey()))) | |||
.extracting(CachingRuleFinderTest::toRuleKey) | |||
.extracting(CachingRuleFinderIT::toRuleKey) | |||
.containsExactly(otherRule.getKey()); | |||
assertThat(underTest.findAll(RuleQuery.create().withKey(ruleKey.toLowerCase()))) | |||
.isEmpty(); | |||
@@ -322,10 +322,10 @@ public class CachingRuleFinderTest { | |||
CachingRuleFinder underTest = new CachingRuleFinder(dbClient, ruleDescriptionFormatter); | |||
assertThat(underTest.findAll(RuleQuery.create().withConfigKey(configKey))) | |||
.extracting(CachingRuleFinderTest::toRuleKey) | |||
.extracting(CachingRuleFinderIT::toRuleKey) | |||
.containsExactly(sameConfigKey[1].getKey(), sameConfigKey[0].getKey()); | |||
assertThat(underTest.findAll(RuleQuery.create().withConfigKey(otherRule.getConfigKey()))) | |||
.extracting(CachingRuleFinderTest::toRuleKey) | |||
.extracting(CachingRuleFinderIT::toRuleKey) | |||
.containsExactly(otherRule.getKey()); | |||
assertThat(underTest.findAll(RuleQuery.create().withConfigKey(configKey.toLowerCase()))) | |||
.isEmpty(); | |||
@@ -355,25 +355,25 @@ public class CachingRuleFinderTest { | |||
CachingRuleFinder underTest = new CachingRuleFinder(dbClient, ruleDescriptionFormatter); | |||
assertThat(underTest.findAll(allQuery)) | |||
.extracting(CachingRuleFinderTest::toRuleKey) | |||
.extracting(CachingRuleFinderIT::toRuleKey) | |||
.containsExactly(rules[0].getKey()); | |||
assertThat(underTest.findAll(ruleAndConfigKeyQuery)) | |||
.extracting(CachingRuleFinderTest::toRuleKey) | |||
.extracting(CachingRuleFinderIT::toRuleKey) | |||
.containsExactly(rules[1].getKey(), rules[0].getKey()); | |||
assertThat(underTest.findAll(repoAndConfigKeyQuery)) | |||
.extracting(CachingRuleFinderTest::toRuleKey) | |||
.extracting(CachingRuleFinderIT::toRuleKey) | |||
.containsExactly(rules[2].getKey(), rules[0].getKey()); | |||
assertThat(underTest.findAll(repoAndKeyQuery)) | |||
.extracting(CachingRuleFinderTest::toRuleKey) | |||
.extracting(CachingRuleFinderIT::toRuleKey) | |||
.containsExactly(rules[0].getKey()); | |||
assertThat(underTest.findAll(repoKeyQuery)) | |||
.extracting(CachingRuleFinderTest::toRuleKey) | |||
.extracting(CachingRuleFinderIT::toRuleKey) | |||
.containsExactly(rules[2].getKey(), rules[0].getKey()); | |||
assertThat(underTest.findAll(ruleKeyQuery)) | |||
.extracting(CachingRuleFinderTest::toRuleKey) | |||
.extracting(CachingRuleFinderIT::toRuleKey) | |||
.containsExactly(rules[1].getKey(), rules[0].getKey()); | |||
assertThat(underTest.findAll(configKeyQuery)) | |||
.extracting(CachingRuleFinderTest::toRuleKey) | |||
.extracting(CachingRuleFinderIT::toRuleKey) | |||
.containsExactly(rules[2].getKey(), rules[1].getKey(), rules[0].getKey()); | |||
} | |||
@@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.verify; | |||
public class PersistentSettingsTest { | |||
public class PersistentSettingsIT { | |||
@Rule | |||
public DbTester dbTester = DbTester.create(System2.INSTANCE); | |||
private Settings delegate = new MapSettings(); |
@@ -29,7 +29,7 @@ import org.sonar.db.property.PropertyDto; | |||
import static org.assertj.core.api.Assertions.assertThat; | |||
public class StartupMetadataPersisterTest { | |||
public class StartupMetadataPersisterIT { | |||
@Rule | |||
public DbTester dbTester = DbTester.create(System2.INSTANCE); |
@@ -54,7 +54,7 @@ import static org.sonar.core.platform.ServerId.NOT_UUID_DATASET_ID_LENGTH; | |||
import static org.sonar.core.platform.ServerId.UUID_DATASET_ID_LENGTH; | |||
@RunWith(DataProviderRunner.class) | |||
public class ServerIdManagerTest { | |||
public class ServerIdManagerIT { | |||
private static final ServerId WITH_DATABASE_ID_SERVER_ID = ServerId.of(randomAlphanumeric(DATABASE_ID_LENGTH), randomAlphanumeric(NOT_UUID_DATASET_ID_LENGTH)); | |||
private static final String CHECKSUM_1 = randomAlphanumeric(12); | |||
@@ -242,7 +242,7 @@ public class ServerIdManagerTest { | |||
private void verifyDb(String expectedChecksum) { | |||
assertThat(dbClient.propertiesDao().selectGlobalProperty(dbSession, CoreProperties.SERVER_ID)) | |||
.extracting(PropertyDto::getValue) | |||
.isEqualTo(ServerIdManagerTest.WITH_DATABASE_ID_SERVER_ID.toString()); | |||
.isEqualTo(ServerIdManagerIT.WITH_DATABASE_ID_SERVER_ID.toString()); | |||
assertThat(dbClient.internalPropertiesDao().selectByKey(dbSession, InternalProperties.SERVER_ID_CHECKSUM)) | |||
.hasValue(expectedChecksum); | |||
} | |||
@@ -254,7 +254,7 @@ public class ServerIdManagerTest { | |||
private void mockCreateNewServerIdFrom(ServerId currentServerId) { | |||
when(serverIdFactory.create()).thenThrow(new IllegalStateException("new ServerId should be created from current server id")); | |||
when(serverIdFactory.create(currentServerId)).thenReturn(ServerIdManagerTest.WITH_DATABASE_ID_SERVER_ID); | |||
when(serverIdFactory.create(currentServerId)).thenReturn(ServerIdManagerIT.WITH_DATABASE_ID_SERVER_ID); | |||
} | |||
private void verifyCreateNewServerIdFromScratch() { |
@@ -41,7 +41,7 @@ import static org.assertj.core.api.Assertions.assertThat; | |||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | |||
import static org.sonar.core.util.stream.MoreCollectors.uniqueIndex; | |||
public class RegisterMetricsTest { | |||
public class RegisterMetricsIT { | |||
@Rule | |||
public DbTester dbTester = DbTester.create(System2.INSTANCE); |
@@ -46,7 +46,7 @@ import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
import static org.sonar.core.util.stream.MoreCollectors.uniqueIndex; | |||
public class RegisterPluginsTest { | |||
public class RegisterPluginsIT { | |||
@Rule | |||
public TemporaryFolder temp = new TemporaryFolder(); |
@@ -40,7 +40,7 @@ import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
@RunWith(DataProviderRunner.class) | |||
public class UpgradeSuggestionsCleanerTest { | |||
public class UpgradeSuggestionsCleanerIT { | |||
private static final String TASK_UUID = "b8d564dd-4ceb-4dba-8a3d-5fafa2d72cdf"; | |||
@Rule |
@@ -66,7 +66,7 @@ import static org.sonar.core.util.stream.MoreCollectors.toArrayList; | |||
import static org.sonar.db.component.BranchType.BRANCH; | |||
@RunWith(DataProviderRunner.class) | |||
public class WebhookQGChangeEventListenerTest { | |||
public class WebhookQGChangeEventListenerIT { | |||
private static final Set<QGChangeEventListener.ChangedIssue> CHANGED_ISSUES_ARE_IGNORED = emptySet(); | |||
@@ -33,7 +33,7 @@ import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.when; | |||
import static org.sonar.process.systeminfo.SystemInfoUtils.attribute; | |||
public class DbConnectionSectionTest { | |||
public class DbConnectionSectionIT { | |||
@Rule | |||
public DbTester dbTester = DbTester.create(System2.INSTANCE); |
@@ -50,7 +50,7 @@ import static org.sonar.api.resources.Qualifiers.VIEW; | |||
import static org.sonar.api.web.UserRole.ADMIN; | |||
import static org.sonar.api.web.UserRole.USER; | |||
public class PermissionIndexerDaoTest { | |||
public class PermissionIndexerDaoIT { | |||
@Rule | |||
public DbTester dbTester = DbTester.create(System2.INSTANCE); |
@@ -41,7 +41,7 @@ import static org.mockito.Mockito.when; | |||
import static org.sonar.server.pushapi.scheduler.purge.PushEventsPurgeScheduler.ENQUEUE_DELAY_IN_SECONDS; | |||
import static org.sonar.server.pushapi.scheduler.purge.PushEventsPurgeScheduler.INITIAL_DELAY_IN_SECONDS; | |||
public class PushEventsPurgeSchedulerAndExecutorTest { | |||
public class PushEventsPurgeSchedulerAndExecutorIT { | |||
private static final String PUSH_EVENT_UUID = "push_event_uuid"; | |||
private static final long INITIAL_AND_ENQUE_DELAY_MS = 1L; |
@@ -40,7 +40,7 @@ import static org.mockito.Mockito.mock; | |||
import static org.mockito.Mockito.verify; | |||
import static org.mockito.Mockito.when; | |||
public class SonarLintConnectionFilterTest { | |||
public class SonarLintConnectionFilterIT { | |||
private static final String LOGIN = "user1"; | |||
private final TestSystem2 system2 = new TestSystem2(); | |||