Search in sources :

Example 56 with PushOneCommit

use of com.google.gerrit.acceptance.PushOneCommit in project gerrit by GerritCodeReview.

the class RobotCommentsIT method setUp.

@Before
public void setUp() throws Exception {
    PushOneCommit push = pushFactory.create(db, admin.getIdent(), testRepo, "Provide files which can be used for fixes", ImmutableMap.of(FILE_NAME, FILE_CONTENT, FILE_NAME2, FILE_CONTENT2));
    PushOneCommit.Result changeResult = push.to("refs/for/master");
    changeId = changeResult.getChangeId();
    fixReplacementInfo = createFixReplacementInfo();
    fixSuggestionInfo = createFixSuggestionInfo(fixReplacementInfo);
    withFixRobotCommentInput = createRobotCommentInput(fixSuggestionInfo);
}
Also used : PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) Before(org.junit.Before)

Example 57 with PushOneCommit

use of com.google.gerrit.acceptance.PushOneCommit in project gerrit by GerritCodeReview.

the class SubmitTypeRuleIT method createChange.

private PushOneCommit.Result createChange(String dest, String subject) throws Exception {
    PushOneCommit push = pushFactory.create(db, admin.getIdent(), testRepo, subject, "file" + fileCounter.incrementAndGet(), PushOneCommit.FILE_CONTENT);
    PushOneCommit.Result r = push.to("refs/for/" + dest);
    r.assertOkStatus();
    return r;
}
Also used : PushOneCommit(com.google.gerrit.acceptance.PushOneCommit)

Example 58 with PushOneCommit

use of com.google.gerrit.acceptance.PushOneCommit in project gerrit by GerritCodeReview.

the class ChangeEditIT method createEditWithoutPushPatchSetPermission.

@Test
public void createEditWithoutPushPatchSetPermission() throws Exception {
    // Create new project with clean permissions
    Project.NameKey p = createProject("addPatchSetEdit");
    // Clone repository as user
    TestRepository<InMemoryRepository> userTestRepo = cloneProject(p, user);
    // Block default permission
    block(p, "refs/for/*", Permission.ADD_PATCH_SET, REGISTERED_USERS);
    // Create change as user
    PushOneCommit push = pushFactory.create(db, user.getIdent(), userTestRepo);
    PushOneCommit.Result r1 = push.to("refs/for/master");
    r1.assertOkStatus();
    // Try to create edit as admin
    exception.expect(AuthException.class);
    createEmptyEditFor(r1.getChangeId());
}
Also used : Project(com.google.gerrit.reviewdb.client.Project) InMemoryRepository(org.eclipse.jgit.internal.storage.dfs.InMemoryRepository) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 59 with PushOneCommit

use of com.google.gerrit.acceptance.PushOneCommit in project gerrit by GerritCodeReview.

the class AbstractPushForReview method pushForMasterWithTopicOption.

@Test
public void pushForMasterWithTopicOption() throws Exception {
    String topicOption = "topic=myTopic";
    List<String> pushOptions = new ArrayList<>();
    pushOptions.add(topicOption);
    PushOneCommit push = pushFactory.create(db, admin.getIdent(), testRepo);
    push.setPushOptions(pushOptions);
    PushOneCommit.Result r = push.to("refs/for/master");
    r.assertOkStatus();
    r.assertChange(Change.Status.NEW, "myTopic");
    r.assertPushOptions(pushOptions);
}
Also used : ArrayList(java.util.ArrayList) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Example 60 with PushOneCommit

use of com.google.gerrit.acceptance.PushOneCommit in project gerrit by GerritCodeReview.

the class AbstractPushForReview method pushNewPatchsetToPatchSetLockedChange.

@Test
public void pushNewPatchsetToPatchSetLockedChange() throws Exception {
    PushOneCommit.Result r = pushTo("refs/for/master");
    r.assertOkStatus();
    PushOneCommit push = pushFactory.create(db, admin.getIdent(), testRepo, PushOneCommit.SUBJECT, "b.txt", "anotherContent", r.getChangeId());
    revision(r).review(new ReviewInput().label("Patch-Set-Lock", 1));
    r = push.to("refs/for/master");
    r.assertErrorStatus("cannot add patch set to " + r.getChange().change().getChangeId() + ". Change is patch set locked.");
}
Also used : ReviewInput(com.google.gerrit.extensions.api.changes.ReviewInput) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Aggregations

PushOneCommit (com.google.gerrit.acceptance.PushOneCommit)91 Test (org.junit.Test)76 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)72 InMemoryRepository (org.eclipse.jgit.internal.storage.dfs.InMemoryRepository)17 ChangeInfo (com.google.gerrit.extensions.common.ChangeInfo)14 ProjectConfig (com.google.gerrit.server.git.ProjectConfig)13 RevCommit (org.eclipse.jgit.revwalk.RevCommit)13 Project (com.google.gerrit.reviewdb.client.Project)11 ReviewInput (com.google.gerrit.extensions.api.changes.ReviewInput)9 BranchInput (com.google.gerrit.extensions.api.projects.BranchInput)7 CommentInput (com.google.gerrit.extensions.api.changes.ReviewInput.CommentInput)6 ImmutableList (com.google.common.collect.ImmutableList)5 DeleteCommentInput (com.google.gerrit.extensions.api.changes.DeleteCommentInput)5 CommentInfo (com.google.gerrit.extensions.common.CommentInfo)5 IdString (com.google.gerrit.extensions.restapi.IdString)5 AccountGroup (com.google.gerrit.reviewdb.client.AccountGroup)5 ArrayList (java.util.ArrayList)5 ObjectId (org.eclipse.jgit.lib.ObjectId)5 AddReviewerInput (com.google.gerrit.extensions.api.changes.AddReviewerInput)4 ChangeApi (com.google.gerrit.extensions.api.changes.ChangeApi)4