Search in sources :

Example 1 with ChangeStatus

use of com.google.gerrit.extensions.client.ChangeStatus in project gerrit by GerritCodeReview.

the class DraftChangeIT method markChangeAsDraft.

private void markChangeAsDraft(Change.Id id) throws Exception {
    try (BatchUpdate batchUpdate = batchUpdateFactory.create(db, project, atrScope.get().getUser(), TimeUtil.nowTs())) {
        batchUpdate.addOp(id, new MarkChangeAsDraftUpdateOp());
        batchUpdate.execute();
    }
    ChangeStatus changeStatus = gApi.changes().id(id.get()).get().status;
    assertThat(changeStatus).isEqualTo(ChangeStatus.DRAFT);
}
Also used : ChangeStatus(com.google.gerrit.extensions.client.ChangeStatus) BatchUpdate(com.google.gerrit.server.update.BatchUpdate)

Example 2 with ChangeStatus

use of com.google.gerrit.extensions.client.ChangeStatus in project gerrit by GerritCodeReview.

the class ChangeIT method setChangeStatus.

private void setChangeStatus(Change.Id id, Change.Status newStatus) throws Exception {
    try (BatchUpdate batchUpdate = batchUpdateFactory.create(project, atrScope.get().getUser(), TimeUtil.now())) {
        batchUpdate.addOp(id, new ChangeStatusUpdateOp(newStatus));
        batchUpdate.execute();
    }
    ChangeStatus changeStatus = gApi.changes().id(id.get()).get().status;
    assertThat(changeStatus).isEqualTo(newStatus.asChangeStatus());
}
Also used : ChangeStatus(com.google.gerrit.extensions.client.ChangeStatus) BatchUpdate(com.google.gerrit.server.update.BatchUpdate)

Example 3 with ChangeStatus

use of com.google.gerrit.extensions.client.ChangeStatus in project gerrit by GerritCodeReview.

the class SubmoduleSubscriptionsWholeTopicMergeIT method nonSubmoduleInSameTopic.

@Test
public void nonSubmoduleInSameTopic() throws Exception {
    Project.NameKey standaloneKey = createProjectForPush(getSubmitType());
    TestRepository<?> standAlone = cloneProject(standaloneKey);
    allowMatchingSubmoduleSubscription(subKey, "refs/heads/master", superKey, "refs/heads/master");
    createSubmoduleSubscription(superRepo, "master", subKey, "master");
    ObjectId superPreviousId = pushChangeTo(superRepo, "master");
    ObjectId subId = pushChangeTo(subRepo, "refs/for/master", "some message", "same-topic");
    ObjectId standAloneId = pushChangeTo(standAlone, "refs/for/master", "some message", "same-topic");
    String subChangeId = getChangeId(subRepo, subId).get();
    String standAloneChangeId = getChangeId(standAlone, standAloneId).get();
    approve(subChangeId);
    approve(standAloneChangeId);
    gApi.changes().id(subChangeId).current().submit();
    expectToHaveSubmoduleState(superRepo, "master", subKey, subRepo, "master");
    ChangeStatus status = gApi.changes().id(standAloneChangeId).info().status;
    assertThat(status).isEqualTo(ChangeStatus.MERGED);
    superRepo.git().fetch().setRemote("origin").call().getAdvertisedRef("refs/heads/master").getObjectId();
    assertWithMessage("submodule subscription update should have made one commit").that(superRepo.getRepository().resolve("origin/master^")).isEqualTo(superPreviousId);
}
Also used : Project(com.google.gerrit.entities.Project) ChangeStatus(com.google.gerrit.extensions.client.ChangeStatus) ObjectId(org.eclipse.jgit.lib.ObjectId) Test(org.junit.Test)

Example 4 with ChangeStatus

use of com.google.gerrit.extensions.client.ChangeStatus in project gerrit by GerritCodeReview.

the class AbstractSubmit method assertMerged.

protected void assertMerged(String changeId) throws RestApiException {
    ChangeStatus status = gApi.changes().id(changeId).info().status;
    assertThat(status).isEqualTo(ChangeStatus.MERGED);
}
Also used : ChangeStatus(com.google.gerrit.extensions.client.ChangeStatus)

Aggregations

ChangeStatus (com.google.gerrit.extensions.client.ChangeStatus)4 BatchUpdate (com.google.gerrit.server.update.BatchUpdate)2 Project (com.google.gerrit.entities.Project)1 ObjectId (org.eclipse.jgit.lib.ObjectId)1 Test (org.junit.Test)1