Search in sources :

Example 31 with CeActivityDto

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

the class PurgeCeActivitiesTest method insertWithDate.

private void insertWithDate(String uuid, long date) {
    CeQueueDto queueDto = new CeQueueDto();
    queueDto.setUuid(uuid);
    queueDto.setTaskType(CeTaskTypes.REPORT);
    CeActivityDto dto = new CeActivityDto(queueDto);
    dto.setStatus(CeActivityDto.Status.SUCCESS);
    when(system2.now()).thenReturn(date);
    dbTester.getDbClient().ceActivityDao().insert(dbTester.getSession(), dto);
    dbTester.getSession().commit();
}
Also used : CeActivityDto(org.sonar.db.ce.CeActivityDto) CeQueueDto(org.sonar.db.ce.CeQueueDto)

Example 32 with CeActivityDto

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

the class CeQueueImpl method cancelImpl.

protected void cancelImpl(DbSession dbSession, CeQueueDto q) {
    CeActivityDto activityDto = new CeActivityDto(q);
    activityDto.setStatus(CeActivityDto.Status.CANCELED);
    remove(dbSession, q, activityDto);
}
Also used : CeActivityDto(org.sonar.db.ce.CeActivityDto)

Example 33 with CeActivityDto

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

the class ActivityAction method searchTaskByUuid.

private Optional<WsCe.Task> searchTaskByUuid(DbSession dbSession, ActivityWsRequest request) {
    String textQuery = request.getQuery();
    if (textQuery == null) {
        return Optional.absent();
    }
    Optional<CeQueueDto> queue = dbClient.ceQueueDao().selectByUuid(dbSession, textQuery);
    if (queue.isPresent()) {
        return Optional.of(formatter.formatQueue(dbSession, queue.get()));
    }
    Optional<CeActivityDto> activity = dbClient.ceActivityDao().selectByUuid(dbSession, textQuery);
    if (activity.isPresent()) {
        return Optional.of(formatter.formatActivity(dbSession, activity.get()));
    }
    return Optional.absent();
}
Also used : CeActivityDto(org.sonar.db.ce.CeActivityDto) CeQueueDto(org.sonar.db.ce.CeQueueDto) StringUtils.defaultString(org.apache.commons.lang.StringUtils.defaultString)

Aggregations

CeActivityDto (org.sonar.db.ce.CeActivityDto)33 Test (org.junit.Test)21 CeQueueDto (org.sonar.db.ce.CeQueueDto)11 WsCe (org.sonarqube.ws.WsCe)9 CeTask (org.sonar.ce.queue.CeTask)6 TestResponse (org.sonar.server.ws.TestResponse)4 DbSession (org.sonar.db.DbSession)3 ComponentDto (org.sonar.db.component.ComponentDto)2 Date (java.util.Date)1 StringUtils.defaultString (org.apache.commons.lang.StringUtils.defaultString)1 Status (org.sonar.db.ce.CeQueueDto.Status)1 CeTaskQuery (org.sonar.db.ce.CeTaskQuery)1 ProjectResponse (org.sonarqube.ws.WsCe.ProjectResponse)1