Search in sources :

Example 1 with BatchReportReader

use of org.sonar.ce.task.projectanalysis.batch.BatchReportReader in project sonarqube by SonarSource.

the class PersistProjectLinksStepTest method no_effect_if_branch_is_not_main.

@Test
public void no_effect_if_branch_is_not_main() {
    DbClient dbClient = mock(DbClient.class);
    TreeRootHolder treeRootHolder = mock(TreeRootHolder.class);
    BatchReportReader reportReader = mock(BatchReportReader.class);
    UuidFactory uuidFactory = mock(UuidFactory.class);
    mockBranch(false);
    PersistProjectLinksStep underTest = new PersistProjectLinksStep(analysisMetadataHolder, dbClient, treeRootHolder, reportReader, uuidFactory);
    underTest.execute(new TestComputationStepContext());
    verifyZeroInteractions(uuidFactory, reportReader, treeRootHolder, dbClient);
}
Also used : DbClient(org.sonar.db.DbClient) UuidFactory(org.sonar.core.util.UuidFactory) TestComputationStepContext(org.sonar.ce.task.step.TestComputationStepContext) TreeRootHolder(org.sonar.ce.task.projectanalysis.component.TreeRootHolder) BatchReportReader(org.sonar.ce.task.projectanalysis.batch.BatchReportReader) Test(org.junit.Test)

Example 2 with BatchReportReader

use of org.sonar.ce.task.projectanalysis.batch.BatchReportReader in project sonarqube by SonarSource.

the class ScmInfoRepositoryImplTest method do_not_query_db_nor_report_if_component_type_is_not_FILE.

@Test
@UseDataProvider("allTypeComponentButFile")
public void do_not_query_db_nor_report_if_component_type_is_not_FILE(Component component) {
    BatchReportReader batchReportReader = mock(BatchReportReader.class);
    ScmInfoRepositoryImpl underTest = new ScmInfoRepositoryImpl(batchReportReader, analysisMetadata, dbLoader, diff, sourceHashRepository);
    assertThat(underTest.getScmInfo(component)).isEmpty();
    verifyZeroInteractions(batchReportReader, dbLoader);
}
Also used : BatchReportReader(org.sonar.ce.task.projectanalysis.batch.BatchReportReader) Test(org.junit.Test) UseDataProvider(com.tngtech.java.junit.dataprovider.UseDataProvider)

Aggregations

Test (org.junit.Test)2 BatchReportReader (org.sonar.ce.task.projectanalysis.batch.BatchReportReader)2 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)1 TreeRootHolder (org.sonar.ce.task.projectanalysis.component.TreeRootHolder)1 TestComputationStepContext (org.sonar.ce.task.step.TestComputationStepContext)1 UuidFactory (org.sonar.core.util.UuidFactory)1 DbClient (org.sonar.db.DbClient)1