use of com.google.gerrit.entities.Project in project gerrit by GerritCodeReview.
the class ChangeOperationsImplTest method changeCanBeCreatedInEmptyRepository.
@Test
public void changeCanBeCreatedInEmptyRepository() throws Exception {
Project.NameKey project = projectOperations.newProject().noEmptyCommit().create();
Change.Id changeId = changeOperations.newChange().project(project).create();
ChangeInfo change = getChangeFromServer(changeId);
assertThat(change.project).isEqualTo(project.get());
}
use of com.google.gerrit.entities.Project in project gerrit by GerritCodeReview.
the class ChangeOperationsImplTest method createdChangeIsInSpecifiedProject.
@Test
public void createdChangeIsInSpecifiedProject() throws Exception {
Project.NameKey project = projectOperations.newProject().create();
Change.Id changeId = changeOperations.newChange().project(project).create();
ChangeInfo change = getChangeFromServer(changeId);
assertThat(change.project).isEqualTo(project.get());
}
use of com.google.gerrit.entities.Project in project gerrit by GerritCodeReview.
the class ChangeOperationsImplTest method specifiedParentBranchMayHaveShortName.
@Test
public void specifiedParentBranchMayHaveShortName() throws Exception {
Project.NameKey project = projectOperations.newProject().branches("test-branch").create();
Change.Id changeId = changeOperations.newChange().project(project).childOf().tipOfBranch("test-branch").create();
ChangeInfo change = getChangeFromServer(changeId);
CommitInfo currentPatchsetCommit = change.revisions.get(change.currentRevision).commit;
ObjectId parentCommitId = projectOperations.project(project).getHead("test-branch").getId();
assertThat(currentPatchsetCommit).parents().onlyElement().commit().isEqualTo(parentCommitId.name());
}
use of com.google.gerrit.entities.Project in project gerrit by GerritCodeReview.
the class ChangeOperationsImplTest method changeOwnerDoesNotNeedAnyPermissionsForChangeCreation.
@Test
public void changeOwnerDoesNotNeedAnyPermissionsForChangeCreation() throws Exception {
Account.Id changeOwner = accountOperations.newAccount().create();
Project.NameKey project = projectOperations.newProject().branches("test-branch").create();
// Remove any read and push permissions which might potentially exist. Without read, users
// shouldn't be able to do anything. The newly created project should only inherit from
// All-Projects.
projectOperations.project(project).forUpdate().remove(permissionKey(Permission.READ).ref("refs/heads/test-branch")).remove(permissionKey(Permission.PUSH).ref("refs/heads/test-branch")).update();
projectOperations.allProjectsForUpdate().remove(permissionKey(Permission.READ).ref("refs/heads/test-branch")).remove(permissionKey(Permission.PUSH).ref("refs/heads/test-branch")).update();
Change.Id changeId = changeOperations.newChange().owner(changeOwner).branch("test-branch").project(project).create();
ChangeInfo change = getChangeFromServer(changeId);
assertThat(change.owner._accountId).isEqualTo(changeOwner.get());
}
use of com.google.gerrit.entities.Project in project gerrit by GerritCodeReview.
the class ChangeOperationsImplTest method createdChangeUsesTipOfTargetBranchAsParentByDefault.
@Test
public void createdChangeUsesTipOfTargetBranchAsParentByDefault() throws Exception {
Project.NameKey project = projectOperations.newProject().branches("test-branch").create();
ObjectId parentCommitId = projectOperations.project(project).getHead("test-branch").getId();
Change.Id changeId = changeOperations.newChange().project(project).branch("test-branch").create();
ChangeInfo change = getChangeFromServer(changeId);
CommitInfo currentPatchsetCommit = change.revisions.get(change.currentRevision).commit;
assertThat(currentPatchsetCommit).parents().onlyElement().commit().isEqualTo(parentCommitId.name());
}
Aggregations