Search in sources :

Example 1 with CeTaskInputDao

use of org.sonar.db.ce.CeTaskInputDao in project sonarqube by SonarSource.

the class CeQueueCleanerTest method start_deletes_orphan_report_files.

@Test
public void start_deletes_orphan_report_files() {
    // analysis reports are persisted but the associated
    // task is not in the queue
    insertInQueue("TASK_1", CeQueueDto.Status.PENDING);
    insertTaskData("TASK_1");
    insertTaskData("TASK_2");
    runCleaner();
    CeTaskInputDao dataDao = dbTester.getDbClient().ceTaskInputDao();
    Optional<CeTaskInputDao.DataStream> task1Data = dataDao.selectData(dbTester.getSession(), "TASK_1");
    assertThat(task1Data).isPresent();
    task1Data.get().close();
    assertThat(dataDao.selectData(dbTester.getSession(), "TASK_2")).isNotPresent();
}
Also used : CeTaskInputDao(org.sonar.db.ce.CeTaskInputDao) Test(org.junit.Test)

Example 2 with CeTaskInputDao

use of org.sonar.db.ce.CeTaskInputDao in project sonarqube by SonarSource.

the class CeQueueCleanerTest method delete_orphan_report_files.

@Test
public void delete_orphan_report_files() throws Exception {
    // analysis reports are persisted but the associated
    // task is not in the queue
    insertInQueue("TASK_1", CeQueueDto.Status.PENDING);
    insertTaskData("TASK_1");
    insertTaskData("TASK_2");
    underTest.clean(dbTester.getSession());
    CeTaskInputDao dataDao = dbTester.getDbClient().ceTaskInputDao();
    Optional<CeTaskInputDao.DataStream> task1Data = dataDao.selectData(dbTester.getSession(), "TASK_1");
    assertThat(task1Data).isPresent();
    task1Data.get().close();
    assertThat(dataDao.selectData(dbTester.getSession(), "TASK_2")).isNotPresent();
}
Also used : CeTaskInputDao(org.sonar.db.ce.CeTaskInputDao) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 CeTaskInputDao (org.sonar.db.ce.CeTaskInputDao)2