Search in sources :

Example 21 with TestResponse

use of org.sonar.server.ws.TestResponse in project sonarqube by SonarSource.

the class LogsActionTest method get_ce_logs.

@Test
public void get_ce_logs() throws IOException {
    logInAsSystemAdministrator();
    createAllLogsFiles();
    TestResponse response = actionTester.newRequest().setParam("process", "ce").execute();
    assertThat(response.getMediaType()).isEqualTo(MediaTypes.TXT);
    assertThat(response.getInput()).isEqualTo("{ce}");
}
Also used : TestResponse(org.sonar.server.ws.TestResponse) Test(org.junit.Test)

Example 22 with TestResponse

use of org.sonar.server.ws.TestResponse in project sonarqube by SonarSource.

the class LogsActionTest method get_app_logs_by_default.

@Test
public void get_app_logs_by_default() throws IOException {
    logInAsSystemAdministrator();
    createAllLogsFiles();
    TestResponse response = actionTester.newRequest().execute();
    assertThat(response.getMediaType()).isEqualTo(MediaTypes.TXT);
    assertThat(response.getInput()).isEqualTo("{app}");
}
Also used : TestResponse(org.sonar.server.ws.TestResponse) Test(org.junit.Test)

Example 23 with TestResponse

use of org.sonar.server.ws.TestResponse in project sonarqube by SonarSource.

the class ProvisionedActionTest method provisioned_projects_as_defined_in_the_example.

@Test
public void provisioned_projects_as_defined_in_the_example() throws Exception {
    OrganizationDto org = db.organizations().insert();
    ComponentDto hBaseProject = ComponentTesting.newProjectDto(org, "ce4c03d6-430f-40a9-b777-ad877c00aa4d").setKey("org.apache.hbas:hbase").setName("HBase").setCreatedAt(DateUtils.parseDateTime("2015-03-04T23:03:44+0100"));
    ComponentDto roslynProject = ComponentTesting.newProjectDto(org, "c526ef20-131b-4486-9357-063fa64b5079").setKey("com.microsoft.roslyn:roslyn").setName("Roslyn").setCreatedAt(DateUtils.parseDateTime("2013-03-04T23:03:44+0100"));
    db.components().insertComponents(hBaseProject, roslynProject);
    userSessionRule.logIn().addPermission(PROVISION_PROJECTS, org);
    TestResponse result = underTest.newRequest().setParam(PARAM_ORGANIZATION, org.getKey()).execute();
    assertJson(result.getInput()).isSimilarTo(Resources.getResource(getClass(), "projects-example-provisioned.json"));
}
Also used : TestResponse(org.sonar.server.ws.TestResponse) ComponentDto(org.sonar.db.component.ComponentDto) OrganizationDto(org.sonar.db.organization.OrganizationDto) Test(org.junit.Test)

Example 24 with TestResponse

use of org.sonar.server.ws.TestResponse in project sonarqube by SonarSource.

the class GhostsActionTest method ghost_projects_with_chosen_fields.

@Test
public void ghost_projects_with_chosen_fields() throws Exception {
    OrganizationDto organization = db.organizations().insert();
    insertGhostProject(organization);
    userSessionRule.logIn().addPermission(ADMINISTER, organization);
    TestResponse result = underTest.newRequest().setParam("organization", organization.getKey()).setParam(Param.FIELDS, "name").execute();
    assertThat(result.getInput()).contains("uuid", "name").doesNotContain("key").doesNotContain("creationDate");
}
Also used : TestResponse(org.sonar.server.ws.TestResponse) OrganizationDto(org.sonar.db.organization.OrganizationDto) Test(org.junit.Test)

Example 25 with TestResponse

use of org.sonar.server.ws.TestResponse in project sonarqube by SonarSource.

the class GhostsActionTest method ghost_projects_with_partial_query_on_name.

@Test
public void ghost_projects_with_partial_query_on_name() throws Exception {
    OrganizationDto organization = db.organizations().insert();
    insertGhostProject(organization, dto -> dto.setName("ghost-name-10"));
    insertGhostProject(organization, dto -> dto.setName("ghost-name-11"));
    insertGhostProject(organization, dto -> dto.setName("ghost-name-20"));
    userSessionRule.logIn().addPermission(ADMINISTER, organization);
    TestResponse result = underTest.newRequest().setParam("organization", organization.getKey()).setParam(Param.TEXT_QUERY, "name-1").execute();
    assertThat(result.getInput()).contains("ghost-name-10", "ghost-name-11").doesNotContain("ghost-name-2");
}
Also used : TestResponse(org.sonar.server.ws.TestResponse) OrganizationDto(org.sonar.db.organization.OrganizationDto) Test(org.junit.Test)

Aggregations

TestResponse (org.sonar.server.ws.TestResponse)67 Test (org.junit.Test)64 OrganizationDto (org.sonar.db.organization.OrganizationDto)18 WsCe (org.sonarqube.ws.WsCe)13 ComponentDto (org.sonar.db.component.ComponentDto)9 CeActivityDto (org.sonar.db.ce.CeActivityDto)4 InputStream (java.io.InputStream)2 Date (java.util.Date)2 PermissionTemplateDto (org.sonar.db.permission.template.PermissionTemplateDto)2 UserDto (org.sonar.db.user.UserDto)2 ProjectRepositories (org.sonar.scanner.protocol.input.ProjectRepositories)2 File (java.io.File)1 IOException (java.io.IOException)1 LinkedHashMap (java.util.LinkedHashMap)1 CeQueueDto (org.sonar.db.ce.CeQueueDto)1 ComponentLinkDto (org.sonar.db.component.ComponentLinkDto)1 IssueDto (org.sonar.db.issue.IssueDto)1 PropertyDto (org.sonar.db.property.PropertyDto)1 RuleDto (org.sonar.db.rule.RuleDto)1 FileData (org.sonar.scanner.protocol.input.FileData)1