当前位置: 首页>>代码示例>>Java>>正文


Java ChangeInserter类代码示例

本文整理汇总了Java中com.google.gerrit.server.change.ChangeInserter的典型用法代码示例。如果您正苦于以下问题:Java ChangeInserter类的具体用法?Java ChangeInserter怎么用?Java ChangeInserter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ChangeInserter类属于com.google.gerrit.server.change包,在下文中一共展示了ChangeInserter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CreateAccessChange

import com.google.gerrit.server.change.ChangeInserter; //导入依赖的package包/类
@Inject
CreateAccessChange(
    PermissionBackend permissionBackend,
    ChangeInserter.Factory changeInserterFactory,
    BatchUpdate.Factory updateFactory,
    Sequences seq,
    Provider<MetaDataUpdate.User> metaDataUpdateFactory,
    Provider<ReviewDb> db,
    SetAccessUtil accessUtil,
    ChangeJson.Factory jsonFactory) {
  this.permissionBackend = permissionBackend;
  this.seq = seq;
  this.changeInserterFactory = changeInserterFactory;
  this.updateFactory = updateFactory;
  this.metaDataUpdateFactory = metaDataUpdateFactory;
  this.db = db;
  this.setAccess = accessUtil;
  this.jsonFactory = jsonFactory;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:20,代码来源:CreateAccessChange.java

示例2: insertChange

import com.google.gerrit.server.change.ChangeInserter; //导入依赖的package包/类
private ChangeNotes insertChange(TestAccount owner, String dest) throws Exception {
  Change.Id id = new Change.Id(sequences.nextChangeId());
  ChangeInserter ins;
  try (BatchUpdate bu = newUpdate(owner.getId())) {
    RevCommit commit = patchSetCommit(new PatchSet.Id(id, 1));
    ins =
        changeInserterFactory
            .create(id, commit, dest)
            .setValidate(false)
            .setNotify(NotifyHandling.NONE)
            .setFireRevisionCreated(false)
            .setSendMail(false);
    bu.insertChange(ins).execute();
  }
  return changeNotesFactory.create(db, project, ins.getChange().getId());
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:17,代码来源:ConsistencyCheckerIT.java

示例3: byStatus

import com.google.gerrit.server.change.ChangeInserter; //导入依赖的package包/类
@Test
public void byStatus() throws Exception {
  TestRepository<Repo> repo = createProject("repo");
  ChangeInserter ins1 = newChangeWithStatus(repo, Change.Status.NEW);
  Change change1 = insert(repo, ins1);
  ChangeInserter ins2 = newChangeWithStatus(repo, Change.Status.MERGED);
  Change change2 = insert(repo, ins2);

  assertQuery("status:new", change1);
  assertQuery("status:NEW", change1);
  assertQuery("is:new", change1);
  assertQuery("status:merged", change2);
  assertQuery("is:merged", change2);
  assertQuery("status:draft");
  assertQuery("is:draft");
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:17,代码来源:AbstractQueryChangesTest.java

示例4: byStatusOpen

import com.google.gerrit.server.change.ChangeInserter; //导入依赖的package包/类
@Test
public void byStatusOpen() throws Exception {
  TestRepository<Repo> repo = createProject("repo");
  ChangeInserter ins1 = newChangeWithStatus(repo, Change.Status.NEW);
  Change change1 = insert(repo, ins1);
  insert(repo, newChangeWithStatus(repo, Change.Status.MERGED));

  Change[] expected = new Change[] {change1};
  assertQuery("status:open", expected);
  assertQuery("status:OPEN", expected);
  assertQuery("status:o", expected);
  assertQuery("status:op", expected);
  assertQuery("status:ope", expected);
  assertQuery("status:pending", expected);
  assertQuery("status:PENDING", expected);
  assertQuery("status:p", expected);
  assertQuery("status:pe", expected);
  assertQuery("status:pen", expected);
  assertQuery("is:open", expected);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:21,代码来源:AbstractQueryChangesTest.java

示例5: byStatusClosed

import com.google.gerrit.server.change.ChangeInserter; //导入依赖的package包/类
@Test
public void byStatusClosed() throws Exception {
  TestRepository<Repo> repo = createProject("repo");
  ChangeInserter ins1 = newChangeWithStatus(repo, Change.Status.MERGED);
  Change change1 = insert(repo, ins1);
  ChangeInserter ins2 = newChangeWithStatus(repo, Change.Status.ABANDONED);
  Change change2 = insert(repo, ins2);
  insert(repo, newChangeWithStatus(repo, Change.Status.NEW));

  Change[] expected = new Change[] {change2, change1};
  assertQuery("status:closed", expected);
  assertQuery("status:CLOSED", expected);
  assertQuery("status:c", expected);
  assertQuery("status:cl", expected);
  assertQuery("status:clo", expected);
  assertQuery("status:clos", expected);
  assertQuery("status:close", expected);
  assertQuery("status:closed", expected);
  assertQuery("is:closed", expected);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:21,代码来源:AbstractQueryChangesTest.java

示例6: byStatusPrefix

import com.google.gerrit.server.change.ChangeInserter; //导入依赖的package包/类
@Test
public void byStatusPrefix() throws Exception {
  TestRepository<Repo> repo = createProject("repo");
  ChangeInserter ins1 = newChangeWithStatus(repo, Change.Status.NEW);
  Change change1 = insert(repo, ins1);
  insert(repo, newChangeWithStatus(repo, Change.Status.MERGED));

  assertQuery("status:n", change1);
  assertQuery("status:ne", change1);
  assertQuery("status:new", change1);
  assertQuery("status:N", change1);
  assertQuery("status:nE", change1);
  assertQuery("status:neW", change1);
  assertQuery("status:nx");
  assertQuery("status:newx");
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:17,代码来源:AbstractQueryChangesTest.java

示例7: byTopic

import com.google.gerrit.server.change.ChangeInserter; //导入依赖的package包/类
@Test
public void byTopic() throws Exception {
  TestRepository<Repo> repo = createProject("repo");
  ChangeInserter ins1 = newChangeWithTopic(repo, "feature1");
  Change change1 = insert(repo, ins1);

  ChangeInserter ins2 = newChangeWithTopic(repo, "feature2");
  Change change2 = insert(repo, ins2);

  ChangeInserter ins3 = newChangeWithTopic(repo, "Cherrypick-feature2");
  Change change3 = insert(repo, ins3);

  ChangeInserter ins4 = newChangeWithTopic(repo, "feature2-fixup");
  Change change4 = insert(repo, ins4);

  Change change5 = insert(repo, newChange(repo));

  assertQuery("intopic:foo");
  assertQuery("intopic:feature1", change1);
  assertQuery("intopic:feature2", change4, change3, change2);
  assertQuery("topic:feature2", change2);
  assertQuery("intopic:feature2", change4, change3, change2);
  assertQuery("intopic:fixup", change4);
  assertQuery("topic:\"\"", change5);
  assertQuery("intopic:\"\"", change5);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:27,代码来源:AbstractQueryChangesTest.java

示例8: byTopicRegex

import com.google.gerrit.server.change.ChangeInserter; //导入依赖的package包/类
@Test
public void byTopicRegex() throws Exception {
  TestRepository<Repo> repo = createProject("repo");

  ChangeInserter ins1 = newChangeWithTopic(repo, "feature1");
  Change change1 = insert(repo, ins1);

  ChangeInserter ins2 = newChangeWithTopic(repo, "Cherrypick-feature1");
  Change change2 = insert(repo, ins2);

  ChangeInserter ins3 = newChangeWithTopic(repo, "feature1-fixup");
  Change change3 = insert(repo, ins3);

  assertQuery("intopic:^feature1.*", change3, change1);
  assertQuery("intopic:{^.*feature1$}", change2, change1);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:17,代码来源:AbstractQueryChangesTest.java

示例9: updatedOrder

import com.google.gerrit.server.change.ChangeInserter; //导入依赖的package包/类
@Test
public void updatedOrder() throws Exception {
  resetTimeWithClockStep(1, SECONDS);
  TestRepository<Repo> repo = createProject("repo");
  ChangeInserter ins1 = newChange(repo);
  Change change1 = insert(repo, ins1);
  Change change2 = insert(repo, newChange(repo));

  assertThat(lastUpdatedMs(change1)).isLessThan(lastUpdatedMs(change2));
  assertQuery("status:new", change2, change1);

  gApi.changes().id(change1.getId().get()).topic("new-topic");
  change1 = notesFactory.create(db, change1.getProject(), change1.getId()).getChange();

  assertThat(lastUpdatedMs(change1)).isGreaterThan(lastUpdatedMs(change2));
  assertThat(lastUpdatedMs(change1) - lastUpdatedMs(change2))
      .isAtLeast(MILLISECONDS.convert(1, SECONDS));

  // change1 moved to the top.
  assertQuery("status:new", change1, change2);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:22,代码来源:AbstractQueryChangesTest.java

示例10: insert

import com.google.gerrit.server.change.ChangeInserter; //导入依赖的package包/类
protected Change insert(
    TestRepository<Repo> repo,
    ChangeInserter ins,
    @Nullable Account.Id owner,
    Timestamp createdOn)
    throws Exception {
  Project.NameKey project =
      new Project.NameKey(repo.getRepository().getDescription().getRepositoryName());
  Account.Id ownerId = owner != null ? owner : userId;
  IdentifiedUser user = userFactory.create(ownerId);
  try (BatchUpdate bu = updateFactory.create(db, project, user, createdOn)) {
    bu.insertChange(ins);
    bu.execute();
    return ins.getChange();
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:17,代码来源:AbstractQueryChangesTest.java

示例11: PullRequestCreateChange

import com.google.gerrit.server.change.ChangeInserter; //导入依赖的package包/类
@Inject
PullRequestCreateChange(
    ChangeInserter.Factory changeInserterFactory,
    PatchSetInserter.Factory patchSetInserterFactory,
    ProjectControl.Factory projectControlFactory,
    IdentifiedUser.GenericFactory userFactory,
    Provider<InternalChangeQuery> queryProvider,
    BatchUpdate.Factory batchUpdateFactory,
    ChangeQueryProcessor qp,
    ChangeQueryBuilder changeQuery) {
  this.changeInserterFactory = changeInserterFactory;
  this.patchSetInserterFactory = patchSetInserterFactory;
  this.projectControlFactory = projectControlFactory;
  this.userFactory = userFactory;
  this.queryProvider = queryProvider;
  this.updateFactory = batchUpdateFactory;
  this.qp = qp;
  this.changeQuery = changeQuery;
}
 
开发者ID:GerritCodeReview,项目名称:plugins_github,代码行数:20,代码来源:PullRequestCreateChange.java

示例12: newInserter

import com.google.gerrit.server.change.ChangeInserter; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private ChangeInserter newInserter(Change.Id changeId, RevCommit commit) {
  return changeInserterFactory
      .create(changeId, commit, RefNames.REFS_CONFIG)
      .setMessage(
          // Same message as in ReceiveCommits.CreateRequest.
          ApprovalsUtil.renderMessageWithApprovals(1, ImmutableMap.of(), ImmutableMap.of()))
      .setValidate(false)
      .setUpdateRef(false);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:11,代码来源:CreateAccessChange.java

示例13: byCommit

import com.google.gerrit.server.change.ChangeInserter; //导入依赖的package包/类
@Test
public void byCommit() throws Exception {
  TestRepository<Repo> repo = createProject("repo");
  ChangeInserter ins = newChange(repo);
  insert(repo, ins);
  String sha = ins.getCommitId().name();

  assertQuery("0000000000000000000000000000000000000000");
  for (int i = 0; i <= 36; i++) {
    String q = sha.substring(0, 40 - i);
    assertQuery(q, ins.getChange());
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:14,代码来源:AbstractQueryChangesTest.java

示例14: byLabelNotOwner

import com.google.gerrit.server.change.ChangeInserter; //导入依赖的package包/类
@Test
public void byLabelNotOwner() throws Exception {
  TestRepository<Repo> repo = createProject("repo");
  ChangeInserter ins = newChange(repo, null, null, null, null, false);
  Account.Id user1 = createAccount("user1");

  Change reviewPlus1Change = insert(repo, ins);

  // post a review with user1
  requestContext.setContext(newRequestContext(user1));
  gApi.changes().id(reviewPlus1Change.getId().get()).current().review(ReviewInput.recommend());

  assertQuery("label:Code-Review=+1,user=user1", reviewPlus1Change);
  assertQuery("label:Code-Review=+1,owner");
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:16,代码来源:AbstractQueryChangesTest.java

示例15: byDefault

import com.google.gerrit.server.change.ChangeInserter; //导入依赖的package包/类
@Test
public void byDefault() throws Exception {
  TestRepository<Repo> repo = createProject("repo");

  Change change1 = insert(repo, newChange(repo));

  RevCommit commit2 = repo.parseBody(repo.commit().message("foosubject").create());
  Change change2 = insert(repo, newChangeForCommit(repo, commit2));

  RevCommit commit3 = repo.parseBody(repo.commit().add("Foo.java", "foo contents").create());
  Change change3 = insert(repo, newChangeForCommit(repo, commit3));

  ChangeInserter ins4 = newChange(repo);
  Change change4 = insert(repo, ins4);
  ReviewInput ri4 = new ReviewInput();
  ri4.message = "toplevel";
  ri4.labels = ImmutableMap.<String, Short>of("Code-Review", (short) 1);
  gApi.changes().id(change4.getId().get()).current().review(ri4);

  ChangeInserter ins5 = newChangeWithTopic(repo, "feature5");
  Change change5 = insert(repo, ins5);

  Change change6 = insert(repo, newChangeForBranch(repo, "branch6"));

  assertQuery(change1.getId().get(), change1);
  assertQuery(ChangeTriplet.format(change1), change1);
  assertQuery("foosubject", change2);
  assertQuery("Foo.java", change3);
  assertQuery("Code-Review+1", change4);
  assertQuery("toplevel", change4);
  assertQuery("feature5", change5);
  assertQuery("branch6", change6);
  assertQuery("refs/heads/branch6", change6);

  Change[] expected = new Change[] {change6, change5, change4, change3, change2, change1};
  assertQuery("[email protected]", expected);
  assertQuery("repo", expected);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:39,代码来源:AbstractQueryChangesTest.java


注:本文中的com.google.gerrit.server.change.ChangeInserter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。