コード例 #1
0
  @Test
  public void prepopulatedFields() throws Exception {
    assume().that(notesMigration.enabled()).isFalse();
    TestRepository<Repo> repo = createProject("repo");
    Change change = newChange(repo, null, null, null, null).insert();

    db = new DisabledReviewDb();
    requestContext.setContext(newRequestContext(userId));
    // Use QueryProcessor directly instead of API so we get ChangeDatas back.
    List<ChangeData> cds =
        queryProcessor.queryChanges(queryBuilder.parse(change.getId().toString())).changes();
    assertThat(cds).hasSize(1);

    ChangeData cd = cds.get(0);
    cd.change();
    cd.patchSets();
    cd.currentApprovals();
    cd.changedLines();
    cd.reviewedBy();

    // TODO(dborowitz): Swap out GitRepositoryManager somehow? Will probably be
    // necessary for notedb anyway.
    cd.isMergeable();

    // Don't use ExpectedException since that wouldn't distinguish between
    // failures here and on the previous calls.
    try {
      cd.messages();
    } catch (AssertionError e) {
      assertThat(e.getMessage()).isEqualTo(DisabledReviewDb.MESSAGE);
    }
  }
コード例 #2
0
 @Test
 public void byHashtagWithoutNotedb() throws Exception {
   assume().that(notesMigration.enabled()).isFalse();
   setUpHashtagChanges();
   assertQuery("hashtag:foo");
   assertQuery("hashtag:bar");
   assertQuery("hashtag:\" bar \"");
   assertQuery("hashtag:\"a tag\"");
   assertQuery("hashtag:\" a tag \"");
   assertQuery("hashtag:#foo");
   assertQuery("hashtag:\"# #foo\"");
 }
コード例 #3
0
 @Test
 public void byHashtagWithNotedb() throws Exception {
   assume().that(notesMigration.enabled()).isTrue();
   List<Change> changes = setUpHashtagChanges();
   assertQuery("hashtag:foo", changes.get(1), changes.get(0));
   assertQuery("hashtag:bar", changes.get(1));
   assertQuery("hashtag:\"a tag\"", changes.get(1));
   assertQuery("hashtag:\"a tag \"", changes.get(1));
   assertQuery("hashtag:\" a tag \"", changes.get(1));
   assertQuery("hashtag:\"#a tag\"", changes.get(1));
   assertQuery("hashtag:\"# #a tag\"", changes.get(1));
 }
コード例 #4
0
 @ConfigSuite.Config
 public static Config noteDbEnabled() {
   return updateConfig(NotesMigration.allEnabledConfig());
 }