use of com.google.gerrit.reviewdb.client.Project in project gerrit by GerritCodeReview.
the class SubmoduleSectionParserIT method withSectionToOtherServer.
@Test
public void withSectionToOtherServer() throws Exception {
Project.NameKey p1 = createProject("a");
Config cfg = new Config();
cfg.fromText("" + "[submodule \"a\"]" + "path = a" + "url = ssh://non-localhost/" + p1.get() + "\n" + "branch = .");
Branch.NameKey targetBranch = new Branch.NameKey(new Project.NameKey("project"), "master");
Set<SubmoduleSubscription> res = new SubmoduleSectionParser(cfg, THIS_SERVER, targetBranch).parseAllSections();
assertThat(res).isEmpty();
}
use of com.google.gerrit.reviewdb.client.Project in project gerrit by GerritCodeReview.
the class SubmoduleSectionParserIT method followMasterBranch.
@Test
public void followMasterBranch() throws Exception {
Project.NameKey p = createProject("a");
Config cfg = new Config();
cfg.fromText("" + "[submodule \"a\"]\n" + "path = localpath-to-a\n" + "url = ssh://localhost/" + p.get() + "\n" + "branch = master\n");
Branch.NameKey targetBranch = new Branch.NameKey(new Project.NameKey("project"), "master");
Set<SubmoduleSubscription> res = new SubmoduleSectionParser(cfg, THIS_SERVER, targetBranch).parseAllSections();
Set<SubmoduleSubscription> expected = Sets.newHashSet(new SubmoduleSubscription(targetBranch, new Branch.NameKey(p, "master"), "localpath-to-a"));
assertThat(res).containsExactlyElementsIn(expected);
}
use of com.google.gerrit.reviewdb.client.Project in project gerrit by GerritCodeReview.
the class SubmoduleSectionParserIT method withAnotherURI.
@Test
public void withAnotherURI() throws Exception {
Project.NameKey p = createProject("a");
Config cfg = new Config();
cfg.fromText("" + "[submodule \"a\"]\n" + "path = a\n" + "url = http://localhost:80/" + p.get() + "\n" + "branch = master\n");
Branch.NameKey targetBranch = new Branch.NameKey(new Project.NameKey("project"), "master");
Set<SubmoduleSubscription> res = new SubmoduleSectionParser(cfg, THIS_SERVER, targetBranch).parseAllSections();
Set<SubmoduleSubscription> expected = Sets.newHashSet(new SubmoduleSubscription(targetBranch, new Branch.NameKey(p, "master"), "a"));
assertThat(res).containsExactlyElementsIn(expected);
}
use of com.google.gerrit.reviewdb.client.Project in project gerrit by GerritCodeReview.
the class SubmoduleSectionParserIT method followMatchingBranch.
@Test
public void followMatchingBranch() throws Exception {
Project.NameKey p = createProject("a");
Config cfg = new Config();
cfg.fromText("" + "[submodule \"a\"]\n" + "path = a\n" + "url = ssh://localhost/" + p.get() + "\n" + "branch = .\n");
Branch.NameKey targetBranch1 = new Branch.NameKey(new Project.NameKey("project"), "master");
Set<SubmoduleSubscription> res1 = new SubmoduleSectionParser(cfg, THIS_SERVER, targetBranch1).parseAllSections();
Set<SubmoduleSubscription> expected1 = Sets.newHashSet(new SubmoduleSubscription(targetBranch1, new Branch.NameKey(p, "master"), "a"));
assertThat(res1).containsExactlyElementsIn(expected1);
Branch.NameKey targetBranch2 = new Branch.NameKey(new Project.NameKey("project"), "somebranch");
Set<SubmoduleSubscription> res2 = new SubmoduleSectionParser(cfg, THIS_SERVER, targetBranch2).parseAllSections();
Set<SubmoduleSubscription> expected2 = Sets.newHashSet(new SubmoduleSubscription(targetBranch2, new Branch.NameKey(p, "somebranch"), "a"));
assertThat(res2).containsExactlyElementsIn(expected2);
}
use of com.google.gerrit.reviewdb.client.Project in project gerrit by GerritCodeReview.
the class ChangeRebuilderIT method ignoreChangeMessageBeyondCurrentPatchSet.
@Test
public void ignoreChangeMessageBeyondCurrentPatchSet() throws Exception {
PushOneCommit.Result r = createChange();
PatchSet.Id psId1 = r.getPatchSetId();
Change.Id id = psId1.getParentKey();
gApi.changes().id(id.get()).current().review(ReviewInput.recommend());
r = amendChange(r.getChangeId());
PatchSet.Id psId2 = r.getPatchSetId();
assertThat(db.patchSets().byChange(id)).hasSize(2);
assertThat(db.changeMessages().byPatchSet(psId2)).hasSize(1);
db.patchSets().deleteKeys(Collections.singleton(psId2));
checker.rebuildAndCheckChanges(psId2.getParentKey());
setNotesMigration(true, true);
ChangeData cd = changeDataFactory.create(db, project, id);
assertThat(cd.change().currentPatchSetId()).isEqualTo(psId1);
assertThat(cd.patchSets().stream().map(ps -> ps.getId()).collect(toList())).containsExactly(psId1);
PatchSet ps = cd.currentPatchSet();
assertThat(ps).isNotNull();
assertThat(ps.getId()).isEqualTo(psId1);
}
Aggregations