@@ -127,6 +127,7 @@ public class TaskFormatter { | |||
if (componentDto != null) { | |||
builder.setComponentKey(componentDto.getKey()); | |||
builder.setComponentName(componentDto.name()); | |||
builder.setComponentQualifier(componentDto.qualifier()); | |||
} | |||
} | |||
@@ -27,6 +27,7 @@ import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.junit.rules.TemporaryFolder; | |||
import org.mockito.Mockito; | |||
import org.sonar.api.resources.Qualifiers; | |||
import org.sonar.api.utils.DateUtils; | |||
import org.sonar.api.utils.System2; | |||
import org.sonar.db.DbTester; | |||
@@ -82,7 +83,8 @@ public class TaskFormatterTest { | |||
@Test | |||
public void formatQueue_with_component_and_other_fields() throws IOException { | |||
when(ceLogging.getFile(any(LogFileRef.class))).thenReturn(Optional.of(temp.newFile())); | |||
db.getDbClient().componentDao().insert(db.getSession(), new ComponentDto().setUuid("COMPONENT_UUID").setKey("COMPONENT_KEY").setName("Component Name")); | |||
db.getDbClient().componentDao().insert(db.getSession(), new ComponentDto() | |||
.setUuid("COMPONENT_UUID").setKey("COMPONENT_KEY").setName("Component Name").setQualifier(Qualifiers.PROJECT)); | |||
CeQueueDto dto = new CeQueueDto(); | |||
dto.setUuid("UUID"); | |||
@@ -100,6 +102,7 @@ public class TaskFormatterTest { | |||
assertThat(wsTask.getComponentId()).isEqualTo("COMPONENT_UUID"); | |||
assertThat(wsTask.getComponentKey()).isEqualTo("COMPONENT_KEY"); | |||
assertThat(wsTask.getComponentName()).isEqualTo("Component Name"); | |||
assertThat(wsTask.getComponentQualifier()).isEqualTo("TRK"); | |||
assertThat(wsTask.getStatus()).isEqualTo(WsCe.TaskStatus.IN_PROGRESS); | |||
assertThat(wsTask.getLogs()).isTrue(); | |||
assertThat(wsTask.getSubmitterLogin()).isEqualTo("rob"); |
@@ -32,6 +32,7 @@ import org.sonar.db.ce.CeActivityDto; | |||
import org.sonar.db.ce.CeQueueDto; | |||
import org.sonar.db.ce.CeTaskTypes; | |||
import org.sonar.db.component.ComponentDto; | |||
import org.sonar.db.component.ComponentTesting; | |||
import org.sonar.server.computation.log.CeLogging; | |||
import org.sonar.server.computation.log.LogFileRef; | |||
import org.sonar.server.exceptions.NotFoundException; | |||
@@ -69,7 +70,7 @@ public class TaskWsActionTest { | |||
public void task_is_in_queue() throws Exception { | |||
userSession.setGlobalPermissions(UserRole.ADMIN); | |||
ComponentDto project = new ComponentDto().setUuid("PROJECT_1").setName("Project One").setKey("P1"); | |||
ComponentDto project = ComponentTesting.newProjectDto().setUuid("PROJECT_1").setName("Project One").setKey("P1"); | |||
dbTester.getDbClient().componentDao().insert(dbTester.getSession(), project); | |||
CeQueueDto queueDto = new CeQueueDto(); | |||
@@ -101,7 +102,7 @@ public class TaskWsActionTest { | |||
public void task_is_archived() throws Exception { | |||
userSession.setGlobalPermissions(UserRole.ADMIN); | |||
ComponentDto project = new ComponentDto().setUuid("PROJECT_1").setName("Project One").setKey("P1"); | |||
ComponentDto project = ComponentTesting.newProjectDto().setUuid("PROJECT_1").setName("Project One").setKey("P1"); | |||
dbTester.getDbClient().componentDao().insert(dbTester.getSession(), project); | |||
CeQueueDto queueDto = new CeQueueDto(); |
@@ -60,14 +60,15 @@ message Task { | |||
optional string componentId = 3; | |||
optional string componentKey = 4; | |||
optional string componentName = 5; | |||
optional TaskStatus status = 6; | |||
optional string submittedAt = 7; | |||
optional string submitterLogin = 8; | |||
optional string startedAt = 9; | |||
optional string executedAt = 10; | |||
optional bool isLastExecuted = 11; | |||
optional int64 executionTimeMs = 12; | |||
optional bool logs = 13; | |||
optional string componentQualifier = 6; | |||
optional TaskStatus status = 7; | |||
optional string submittedAt = 8; | |||
optional string submitterLogin = 9; | |||
optional string startedAt = 10; | |||
optional string executedAt = 11; | |||
optional bool isLastExecuted = 12; | |||
optional int64 executionTimeMs = 13; | |||
optional bool logs = 14; | |||
} | |||
enum TaskStatus { |