use of com.google.gerrit.entities.Project in project gerrit by GerritCodeReview.
the class WorkInProgressByDefaultIT method createChangeBypassWorkInProgressByDefaultForProjectEnabled.
@Test
public void createChangeBypassWorkInProgressByDefaultForProjectEnabled() throws Exception {
Project.NameKey project = projectOperations.newProject().create();
setWorkInProgressByDefaultForProject(project);
ChangeInput input = new ChangeInput(project.get(), "master", "empty change");
input.workInProgress = false;
assertThat(gApi.changes().create(input).get().workInProgress).isNull();
}
use of com.google.gerrit.entities.Project in project gerrit by GerritCodeReview.
the class WorkInProgressByDefaultIT method createChangeBypassWorkInProgressByDefaultForUserEnabled.
@Test
public void createChangeBypassWorkInProgressByDefaultForUserEnabled() throws Exception {
Project.NameKey project = projectOperations.newProject().create();
setWorkInProgressByDefaultForUser();
ChangeInput input = new ChangeInput(project.get(), "master", "empty change");
input.workInProgress = false;
assertThat(gApi.changes().create(input).get().workInProgress).isNull();
}
use of com.google.gerrit.entities.Project in project gerrit by GerritCodeReview.
the class WorkInProgressByDefaultIT method pushNewPatchSetAndNewChangeAtOnceWithWorkInProgressByDefaultForUserEnabled.
@Test
public void pushNewPatchSetAndNewChangeAtOnceWithWorkInProgressByDefaultForUserEnabled() throws Exception {
Project.NameKey project = projectOperations.newProject().create();
// Create change.
TestRepository<InMemoryRepository> testRepo = cloneProject(project);
RevCommit initialHead = getHead(testRepo.getRepository(), "HEAD");
RevCommit commit1a = testRepo.commit().parent(initialHead).message("Change 1").insertChangeId().create();
String changeId1 = GitUtil.getChangeId(testRepo, commit1a).get();
testRepo.reset(commit1a);
PushResult result = pushHead(testRepo, "refs/for/master", false);
assertPushOk(result, "refs/for/master");
assertThat(gApi.changes().id(changeId1).get().workInProgress).isNull();
setWorkInProgressByDefaultForUser();
// Clone the repo again. The test connection keeps an AccountState internally, so we need to
// create a new connection after changing account properties.
PatchSet.Id ps1OfChange1 = PatchSet.id(Change.id(gApi.changes().id(changeId1).get()._number), 1);
testRepo = cloneProject(project);
testRepo.git().fetch().setRefSpecs(RefNames.patchSetRef(ps1OfChange1) + ":c1").call();
testRepo.reset("c1");
// Create a new patch set on the existing change and in the same push create a new successor
// change.
RevCommit commit1b = testRepo.amend(commit1a).create();
testRepo.reset(commit1b);
RevCommit commit2 = testRepo.commit().parent(commit1b).message("Change 2").insertChangeId().create();
String changeId2 = GitUtil.getChangeId(testRepo, commit2).get();
testRepo.reset(commit2);
result = pushHead(testRepo, "refs/for/master", false);
assertPushOk(result, "refs/for/master");
// Check that the existing change (changeId1) is not marked as WIP, but only the newly created
// change (changeId2).
assertThat(gApi.changes().id(changeId1).get().workInProgress).isNull();
assertThat(gApi.changes().id(changeId2).get().workInProgress).isTrue();
}
use of com.google.gerrit.entities.Project in project gerrit by GerritCodeReview.
the class WorkInProgressByDefaultIT method createChangeWithWorkInProgressByDefaultForUserEnabled.
@Test
public void createChangeWithWorkInProgressByDefaultForUserEnabled() throws Exception {
Project.NameKey project = projectOperations.newProject().create();
setWorkInProgressByDefaultForUser();
ChangeInput input = new ChangeInput(project.get(), "master", "empty change");
assertThat(gApi.changes().create(input).get().workInProgress).isTrue();
}
use of com.google.gerrit.entities.Project in project gerrit by GerritCodeReview.
the class ChangeFieldTest method tolerateNullValuesForInsertion.
@Test
public void tolerateNullValuesForInsertion() {
Project.NameKey project = Project.nameKey("project");
ChangeData cd = ChangeData.createForTest(project, Change.id(1), 1, ObjectId.zeroId());
assertThat(ChangeField.ADDED.setIfPossible(cd, new FakeStoredValue(null))).isTrue();
}
Aggregations