use of org.sonar.db.source.FileSourceDto in project sonarqube by SonarSource.
the class LinesActionTest method branch.
@Test
public void branch() {
ComponentDto project = db.components().insertPrivateProject();
userSession.addProjectPermission(UserRole.USER, project);
ComponentDto branch = db.components().insertProjectBranch(project);
ComponentDto file = db.components().insertComponent(newFileDto(branch));
db.getDbClient().fileSourceDao().insert(db.getSession(), new FileSourceDto().setUuid(Uuids.createFast()).setProjectUuid(branch.uuid()).setFileUuid(file.uuid()).setSourceData(FileSourceTesting.newFakeData(3).build()));
db.commit();
userSession.logIn("login").addProjectPermission(UserRole.CODEVIEWER, project, file);
tester.newRequest().setParam("key", file.getKey()).setParam("branch", file.getBranch()).execute().assertJson(getClass(), "show_source.json");
}
use of org.sonar.db.source.FileSourceDto in project sonarqube by SonarSource.
the class ScmActionTest method return_empty_value_when_no_scm.
@Test
public void return_empty_value_when_no_scm() {
userSessionRule.addProjectPermission(UserRole.CODEVIEWER, project, file);
dbTester.getDbClient().fileSourceDao().insert(dbSession, new FileSourceDto().setUuid(Uuids.createFast()).setProjectUuid(PROJECT_UUID).setFileUuid(FILE_UUID).setSourceData(DbFileSources.Data.newBuilder().build()));
dbSession.commit();
tester.newRequest().setParam("key", FILE_KEY).execute().assertJson(getClass(), "return_empty_value_when_no_scm.json");
}
use of org.sonar.db.source.FileSourceDto in project sonarqube by SonarSource.
the class ScmActionTest method show_scm_from_given_range_lines.
@Test
public void show_scm_from_given_range_lines() {
userSessionRule.addProjectPermission(UserRole.CODEVIEWER, project, file);
dbTester.getDbClient().fileSourceDao().insert(dbSession, new FileSourceDto().setUuid(Uuids.createFast()).setProjectUuid(PROJECT_UUID).setFileUuid(FILE_UUID).setSourceData(DbFileSources.Data.newBuilder().addLines(newSourceLine("julien", "123-456-789", DateUtils.parseDateTime("2015-03-30T12:34:56+0000"), 1)).addLines(newSourceLine("julien", "123-456-789", DateUtils.parseDateTime("2015-03-30T12:34:56+0000"), 2)).addLines(newSourceLine("julien", "456-789-101", DateUtils.parseDateTime("2015-03-27T12:34:56+0000"), 3)).addLines(newSourceLine("simon", "789-101-112", DateUtils.parseDateTime("2015-03-31T12:34:56+0000"), 4)).build()));
dbSession.commit();
tester.newRequest().setParam("key", FILE_KEY).setParam("from", "2").setParam("to", "3").execute().assertJson(getClass(), "show_scm_from_given_range_lines.json");
}
Aggregations