Skip to content

Commit

Permalink
SONAR-8673 add organization to response of api/ce/component
Browse files Browse the repository at this point in the history
  • Loading branch information
sns-seb committed Jan 17, 2017
1 parent 0af4eff commit 3cc4c7a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
@@ -1,6 +1,7 @@
{
"queue": [
{
"organization": "my-org-1",
"id": "AU_w84A6gAS1Hm6h4_ih",
"type": "REPORT",
"componentId": "AU_w74XMgAS1Hm6h4-Y-",
Expand All @@ -13,6 +14,7 @@
}
],
"current": {
"organization": "my-org-1",
"id": "AU_w8LDjgAS1Hm6h4-aY",
"type": "REPORT",
"componentId": "AU_w74XMgAS1Hm6h4-Y-",
Expand Down
Expand Up @@ -32,6 +32,7 @@
import org.sonar.db.ce.CeTaskTypes;
import org.sonar.db.component.ComponentDbTester;
import org.sonar.db.component.ComponentDto;
import org.sonar.db.organization.OrganizationDto;
import org.sonar.server.component.ComponentFinder;
import org.sonar.server.exceptions.ForbiddenException;
import org.sonar.server.exceptions.NotFoundException;
Expand Down Expand Up @@ -79,7 +80,8 @@ public void empty_queue_and_empty_activity() {

@Test
public void project_tasks() {
componentDbTester.insertComponent(newProjectDto(dbTester.organizations().insert(), "PROJECT_1"));
OrganizationDto organizationDto = dbTester.organizations().insert();
componentDbTester.insertComponent(newProjectDto(organizationDto, "PROJECT_1"));
userSession.addComponentUuidPermission(UserRole.USER, "PROJECT_1", "PROJECT_1");
insertActivity("T1", "PROJECT_1", CeActivityDto.Status.SUCCESS);
insertActivity("T2", "PROJECT_2", CeActivityDto.Status.FAILED);
Expand All @@ -99,6 +101,10 @@ public void project_tasks() {
// T3 is the latest task executed on PROJECT_1
assertThat(response.hasCurrent()).isTrue();
assertThat(response.getCurrent().getId()).isEqualTo("T3");
assertThat(response.getQueueList())
.extracting(WsCe.Task::getOrganization)
.containsOnly(organizationDto.getKey());
assertThat(response.getCurrent().getOrganization()).isEqualTo(organizationDto.getKey());
}

@Test
Expand Down

0 comments on commit 3cc4c7a

Please sign in to comment.