use of org.sonar.db.newcodeperiod.NewCodePeriodDto in project sonarqube by SonarSource.
the class ShowActionTest method show_inherited_branch_setting_from_global.
@Test
public void show_inherited_branch_setting_from_global() {
ComponentDto project = componentDb.insertPublicProject();
logInAsProjectAdministrator(project);
ComponentDto branch = componentDb.insertProjectBranch(project, b -> b.setKey("branch"));
tester.insert(new NewCodePeriodDto().setType(NewCodePeriodType.NUMBER_OF_DAYS).setValue("3"));
ShowWSResponse response = ws.newRequest().setParam("project", project.getKey()).setParam("branch", "branch").executeProtobuf(ShowWSResponse.class);
assertResponse(response, project.getKey(), "branch", NewCodePeriods.NewCodePeriodType.NUMBER_OF_DAYS, "3", true);
}
use of org.sonar.db.newcodeperiod.NewCodePeriodDto in project sonarqube by SonarSource.
the class ShowActionTest method show_inherited_project_setting.
@Test
public void show_inherited_project_setting() {
ComponentDto project = componentDb.insertPublicProject();
logInAsProjectAdministrator(project);
tester.insert(new NewCodePeriodDto().setType(NewCodePeriodType.PREVIOUS_VERSION));
ShowWSResponse response = ws.newRequest().setParam("project", project.getKey()).executeProtobuf(ShowWSResponse.class);
assertResponse(response, project.getKey(), "", NewCodePeriods.NewCodePeriodType.PREVIOUS_VERSION, "", true);
}
use of org.sonar.db.newcodeperiod.NewCodePeriodDto in project sonarqube by SonarSource.
the class ShowActionTest method show_inherited_if_project_not_found.
@Test
public void show_inherited_if_project_not_found() {
tester.insert(new NewCodePeriodDto().setType(NewCodePeriodType.NUMBER_OF_DAYS).setValue("3"));
ShowWSResponse response = ws.newRequest().setParam("project", "unknown").executeProtobuf(ShowWSResponse.class);
assertResponse(response, "", "", NewCodePeriods.NewCodePeriodType.NUMBER_OF_DAYS, "3", true);
}
use of org.sonar.db.newcodeperiod.NewCodePeriodDto in project sonarqube by SonarSource.
the class ShowActionTest method show_branch_setting.
@Test
public void show_branch_setting() {
ComponentDto project = componentDb.insertPublicProject();
logInAsProjectAdministrator(project);
ComponentDto branch = componentDb.insertProjectBranch(project, b -> b.setKey("branch"));
tester.insert(new NewCodePeriodDto().setProjectUuid(project.uuid()).setBranchUuid(branch.uuid()).setType(NewCodePeriodType.NUMBER_OF_DAYS).setValue("1"));
ShowWSResponse response = ws.newRequest().setParam("project", project.getKey()).setParam("branch", "branch").executeProtobuf(ShowWSResponse.class);
assertResponse(response, project.getKey(), "branch", NewCodePeriods.NewCodePeriodType.NUMBER_OF_DAYS, "1", false);
}
use of org.sonar.db.newcodeperiod.NewCodePeriodDto in project sonarqube by SonarSource.
the class SetBaselineActionTest method set_baseline_on_main_branch.
@Test
@UseDataProvider("nullOrEmpty")
public void set_baseline_on_main_branch(@Nullable String branchName) {
ComponentDto project = tester.insertPrivateProject();
SnapshotDto analysis = db.components().insertSnapshot(project);
logInAsProjectAdministrator(project);
call(project.getKey(), branchName, analysis.getUuid());
NewCodePeriodDto loaded = dbClient.newCodePeriodDao().selectByBranch(dbSession, project.uuid(), project.uuid()).get();
assertThat(loaded.getValue()).isEqualTo(analysis.getUuid());
assertThat(loaded.getType()).isEqualTo(SPECIFIC_ANALYSIS);
}
Aggregations