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}");
}
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}");
}
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"));
}
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");
}
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");
}
Aggregations