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


Java PatchSetApproval.Key方法代码示例

本文整理汇总了Java中com.google.gerrit.reviewdb.client.PatchSetApproval.Key方法的典型用法代码示例。如果您正苦于以下问题:Java PatchSetApproval.Key方法的具体用法?Java PatchSetApproval.Key怎么用?Java PatchSetApproval.Key使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gerrit.reviewdb.client.PatchSetApproval的用法示例。


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

示例1: addReviewerWithNoteDbWhenDummyApprovalInReviewDbExists

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
@Test
public void addReviewerWithNoteDbWhenDummyApprovalInReviewDbExists() throws Exception {
  assume().that(notesMigration.readChanges()).isTrue();
  assume().that(notesMigration.changePrimaryStorage()).isEqualTo(PrimaryStorage.REVIEW_DB);

  PushOneCommit.Result r = createChange();

  // insert dummy approval in ReviewDb
  PatchSetApproval psa =
      new PatchSetApproval(
          new PatchSetApproval.Key(r.getPatchSetId(), user.id, new LabelId("Code-Review")),
          (short) 0,
          TimeUtil.nowTs());
  db.patchSetApprovals().insert(Collections.singleton(psa));

  AddReviewerInput in = new AddReviewerInput();
  in.reviewer = user.email;
  gApi.changes().id(r.getChangeId()).addReviewer(in);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:20,代码来源:ChangeIT.java

示例2: diffPatchSetApprovals

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
@Test
public void diffPatchSetApprovals() throws Exception {
  Change c = TestChanges.newChange(project, accountId);
  PatchSetApproval a1 =
      new PatchSetApproval(
          new PatchSetApproval.Key(c.currentPatchSetId(), accountId, new LabelId("Code-Review")),
          (short) 1,
          TimeUtil.nowTs());
  PatchSetApproval a2 = clone(a1);
  ChangeBundle b1 =
      new ChangeBundle(
          c, messages(), latest(c), approvals(a1), comments(), reviewers(), REVIEW_DB);
  ChangeBundle b2 =
      new ChangeBundle(
          c, messages(), latest(c), approvals(a2), comments(), reviewers(), REVIEW_DB);

  assertNoDiffs(b1, b2);

  a2.setValue((short) -1);
  assertDiffs(
      b1,
      b2,
      "value differs for PatchSetApproval.Key "
          + c.getId()
          + "%2C1,100,Code-Review: {1} != {-1}");
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:27,代码来源:ChangeBundleTest.java

示例3: patchSetApprovalMap

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
private static Map<PatchSetApproval.Key, PatchSetApproval> patchSetApprovalMap(
    Iterable<PatchSetApproval> in) {
  Map<PatchSetApproval.Key, PatchSetApproval> out =
      new TreeMap<>(
          new Comparator<PatchSetApproval.Key>() {
            @Override
            public int compare(PatchSetApproval.Key a, PatchSetApproval.Key b) {
              return patchSetIdChain(a.getParentKey(), b.getParentKey())
                  .compare(a.getAccountId().get(), b.getAccountId().get())
                  .compare(a.getLabelId(), b.getLabelId())
                  .result();
            }
          });
  for (PatchSetApproval psa : in) {
    out.put(psa.getKey(), psa);
  }
  return out;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:19,代码来源:ChangeBundle.java

示例4: diffPatchSetApprovalKeySets

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
@Test
public void diffPatchSetApprovalKeySets() throws Exception {
  Change c = TestChanges.newChange(project, accountId);
  int id = c.getId().get();
  PatchSetApproval a1 =
      new PatchSetApproval(
          new PatchSetApproval.Key(c.currentPatchSetId(), accountId, new LabelId("Code-Review")),
          (short) 1,
          TimeUtil.nowTs());
  PatchSetApproval a2 =
      new PatchSetApproval(
          new PatchSetApproval.Key(c.currentPatchSetId(), accountId, new LabelId("Verified")),
          (short) 1,
          TimeUtil.nowTs());

  ChangeBundle b1 =
      new ChangeBundle(
          c, messages(), latest(c), approvals(a1), comments(), reviewers(), REVIEW_DB);
  ChangeBundle b2 =
      new ChangeBundle(
          c, messages(), latest(c), approvals(a2), comments(), reviewers(), REVIEW_DB);

  assertDiffs(
      b1,
      b2,
      "PatchSetApproval.Key sets differ:"
          + " ["
          + id
          + "%2C1,100,Code-Review] only in A;"
          + " ["
          + id
          + "%2C1,100,Verified] only in B");
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:34,代码来源:ChangeBundleTest.java

示例5: approve

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
private LabelNormalizer.Result approve(ChangeContext ctx, ChangeUpdate update)
    throws OrmException, IOException {
  PatchSet.Id psId = update.getPatchSetId();
  Map<PatchSetApproval.Key, PatchSetApproval> byKey = new HashMap<>();
  for (PatchSetApproval psa :
      args.approvalsUtil.byPatchSet(
          ctx.getDb(),
          ctx.getNotes(),
          ctx.getUser(),
          psId,
          ctx.getRevWalk(),
          ctx.getRepoView().getConfig())) {
    byKey.put(psa.getKey(), psa);
  }

  submitter =
      ApprovalsUtil.newApproval(psId, ctx.getUser(), LabelId.legacySubmit(), 1, ctx.getWhen());
  byKey.put(submitter.getKey(), submitter);

  // Flatten out existing approvals for this patch set based upon the current
  // permissions. Once the change is closed the approvals are not updated at
  // presentation view time, except for zero votes used to indicate a reviewer
  // was added. So we need to make sure votes are accurate now. This way if
  // permissions get modified in the future, historical records stay accurate.
  LabelNormalizer.Result normalized =
      args.labelNormalizer.normalize(ctx.getNotes(), ctx.getUser(), byKey.values());
  update.putApproval(submitter.getLabel(), submitter.getValue());
  saveApprovals(normalized, ctx, update, false);
  return normalized;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:31,代码来源:SubmitStrategyOp.java

示例6: deletedApproval

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
private PatchSetApproval deletedApproval(ChangeContext ctx) {
  // Set the effective user to the account we're trying to remove, and don't
  // set the real user; this preserves the calling user as the NoteDb
  // committer.
  return new PatchSetApproval(
      new PatchSetApproval.Key(ps.getId(), account.getId(), new LabelId(label)),
      (short) 0,
      ctx.getWhen());
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:10,代码来源:DeleteVote.java

示例7: getAsync

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public com.google.common.util.concurrent.CheckedFuture<PatchSetApproval, OrmException> getAsync(
    PatchSetApproval.Key key) {
  throw new UnsupportedOperationException(MSG);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:7,代码来源:DisallowReadFromChangesReviewDbWrapper.java

示例8: get

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
@Override
public ResultSet<PatchSetApproval> get(Iterable<PatchSetApproval.Key> keys) {
  throw new UnsupportedOperationException(MSG);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:5,代码来源:DisallowReadFromChangesReviewDbWrapper.java

示例9: primaryKey

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
@Override
public PatchSetApproval.Key primaryKey(PatchSetApproval entity) {
  return delegate.primaryKey(entity);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:5,代码来源:ReviewDbWrapper.java

示例10: toMap

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
@Override
public Map<PatchSetApproval.Key, PatchSetApproval> toMap(Iterable<PatchSetApproval> c) {
  return delegate.toMap(c);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:5,代码来源:ReviewDbWrapper.java

示例11: getAsync

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public com.google.common.util.concurrent.CheckedFuture<PatchSetApproval, OrmException> getAsync(
    PatchSetApproval.Key key) {
  return delegate.getAsync(key);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:7,代码来源:ReviewDbWrapper.java

示例12: get

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
@Override
public ResultSet<PatchSetApproval> get(Iterable<PatchSetApproval.Key> keys)
    throws OrmException {
  return delegate.get(keys);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:6,代码来源:ReviewDbWrapper.java

示例13: diffPatchSetApprovalsMixedSourcesAllowsSlop

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
@Test
public void diffPatchSetApprovalsMixedSourcesAllowsSlop() throws Exception {
  Change c = TestChanges.newChange(project, accountId);
  subWindowResolution();
  PatchSetApproval a1 =
      new PatchSetApproval(
          new PatchSetApproval.Key(c.currentPatchSetId(), accountId, new LabelId("Code-Review")),
          (short) 1,
          roundToSecond(TimeUtil.nowTs()));
  PatchSetApproval a2 = clone(a1);
  a2.setGranted(TimeUtil.nowTs());

  // Both are ReviewDb, exact timestamp match is required.
  ChangeBundle b1 =
      new ChangeBundle(
          c, messages(), latest(c), approvals(a1), comments(), reviewers(), REVIEW_DB);
  ChangeBundle b2 =
      new ChangeBundle(
          c, messages(), latest(c), approvals(a2), comments(), reviewers(), REVIEW_DB);
  assertDiffs(
      b1,
      b2,
      "granted differs for PatchSetApproval.Key "
          + c.getId()
          + "%2C1,100,Code-Review:"
          + " {2009-09-30 17:00:07.0} != {2009-09-30 17:00:08.0}");

  // One NoteDb, slop is allowed.
  b1 =
      new ChangeBundle(c, messages(), latest(c), approvals(a1), comments(), reviewers(), NOTE_DB);
  b2 =
      new ChangeBundle(
          c, messages(), latest(c), approvals(a2), comments(), reviewers(), REVIEW_DB);
  assertNoDiffs(b1, b2);

  // But not too much slop.
  superWindowResolution();
  PatchSetApproval a3 = clone(a1);
  a3.setGranted(TimeUtil.nowTs());
  b1 =
      new ChangeBundle(c, messages(), latest(c), approvals(a1), comments(), reviewers(), NOTE_DB);
  ChangeBundle b3 =
      new ChangeBundle(
          c, messages(), latest(c), approvals(a3), comments(), reviewers(), REVIEW_DB);
  String msg =
      "granted differs for PatchSetApproval.Key "
          + c.getId()
          + "%2C1,100,Code-Review in NoteDb vs. ReviewDb:"
          + " {2009-09-30 17:00:07.0} != {2009-09-30 17:00:15.0}";
  assertDiffs(b1, b3, msg);
  assertDiffs(b3, b1, msg);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:53,代码来源:ChangeBundleTest.java

示例14: beginTransaction

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
@Override
public void beginTransaction(PatchSetApproval.Key key) throws OrmException {
  delegate.beginTransaction(key);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:5,代码来源:ReviewDbWrapper.java

示例15: parseAddApproval

import com.google.gerrit.reviewdb.client.PatchSetApproval; //导入方法依赖的package包/类
private PatchSetApproval parseAddApproval(
    PatchSet.Id psId, Account.Id committerId, Account.Id realAccountId, Timestamp ts, String line)
    throws ConfigInvalidException {
  // There are potentially 3 accounts involved here:
  //  1. The account from the commit, which is the effective IdentifiedUser
  //     that produced the update.
  //  2. The account in the label footer itself, which is used during submit
  //     to copy other users' labels to a new patch set.
  //  3. The account in the Real-user footer, indicating that the whole
  //     update operation was executed by this user on behalf of the effective
  //     user.
  Account.Id effectiveAccountId;
  String labelVoteStr;
  int s = line.indexOf(' ');
  if (s > 0) {
    // Account in the label line (2) becomes the effective ID of the
    // approval. If there is a real user (3) different from the commit user
    // (2), we actually don't store that anywhere in this case; it's more
    // important to record that the real user (3) actually initiated submit.
    labelVoteStr = line.substring(0, s);
    PersonIdent ident = RawParseUtils.parsePersonIdent(line.substring(s + 1));
    checkFooter(ident != null, FOOTER_LABEL, line);
    effectiveAccountId = noteUtil.parseIdent(ident, id);
  } else {
    labelVoteStr = line;
    effectiveAccountId = committerId;
  }

  LabelVote l;
  try {
    l = LabelVote.parseWithEquals(labelVoteStr);
  } catch (IllegalArgumentException e) {
    ConfigInvalidException pe = parseException("invalid %s: %s", FOOTER_LABEL, line);
    pe.initCause(e);
    throw pe;
  }

  PatchSetApproval psa =
      new PatchSetApproval(
          new PatchSetApproval.Key(psId, effectiveAccountId, new LabelId(l.label())),
          l.value(),
          ts);
  psa.setTag(tag);
  if (!Objects.equals(realAccountId, committerId)) {
    psa.setRealAccountId(realAccountId);
  }
  ApprovalKey k = ApprovalKey.create(psId, effectiveAccountId, l.label());
  if (!approvals.containsKey(k)) {
    approvals.put(k, psa);
  }
  return psa;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:53,代码来源:ChangeNotesParser.java


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