use of com.google.gerrit.entities.BranchNameKey in project gerrit by GerritCodeReview.
the class SubmoduleSectionParserTest method withSectionOfNonexistingProject.
@Test
public void withSectionOfNonexistingProject() throws Exception {
Config cfg = new Config();
cfg.fromText("\n" + "[submodule \"a\"]\n" + "path = a\n" + "url = ssh://non-localhost/a\n" + // Project "a" doesn't exist
"branch = .\\n");
BranchNameKey targetBranch = BranchNameKey.create(Project.nameKey("project"), "master");
Set<SubmoduleSubscription> res = new SubmoduleSectionParser(cfg, THIS_SERVER, targetBranch).parseAllSections();
assertThat(res).isEmpty();
}
use of com.google.gerrit.entities.BranchNameKey in project gerrit by GerritCodeReview.
the class SubmoduleSectionParserTest method withOverlyDeepRelativeURI.
@Test
public void withOverlyDeepRelativeURI() throws Exception {
Project.NameKey p1 = Project.nameKey("nested/a");
Config cfg = new Config();
cfg.fromText("" + "[submodule \"a\"]\n" + "path = a\n" + "url = ../../" + p1.get() + "\n" + "branch = master\n");
BranchNameKey targetBranch = BranchNameKey.create(Project.nameKey("nested/project"), "master");
Set<SubmoduleSubscription> res = new SubmoduleSectionParser(cfg, THIS_SERVER, targetBranch).parseAllSections();
Set<SubmoduleSubscription> expected = Sets.newHashSet(new SubmoduleSubscription(targetBranch, BranchNameKey.create(p1, "master"), "a"));
assertThat(res).containsExactlyElementsIn(expected);
}
use of com.google.gerrit.entities.BranchNameKey in project gerrit by GerritCodeReview.
the class SubmoduleSectionParserTest method followAnotherBranch.
@Test
public void followAnotherBranch() throws Exception {
Project.NameKey p = Project.nameKey("a");
Config cfg = new Config();
cfg.fromText("" + "[submodule \"a\"]\n" + "path = a\n" + "url = ssh://localhost/" + p.get() + "\n" + "branch = anotherbranch\n");
BranchNameKey targetBranch = BranchNameKey.create(Project.nameKey("project"), "master");
Set<SubmoduleSubscription> res = new SubmoduleSectionParser(cfg, THIS_SERVER, targetBranch).parseAllSections();
Set<SubmoduleSubscription> expected = Sets.newHashSet(new SubmoduleSubscription(targetBranch, BranchNameKey.create(p, "anotherbranch"), "a"));
assertThat(res).containsExactlyElementsIn(expected);
}
use of com.google.gerrit.entities.BranchNameKey in project gerrit by GerritCodeReview.
the class SubmoduleSectionParserTest method withRelativeURI.
@Test
public void withRelativeURI() throws Exception {
Project.NameKey p1 = Project.nameKey("a");
Config cfg = new Config();
cfg.fromText("" + "[submodule \"a\"]\n" + "path = a\n" + "url = ../" + p1.get() + "\n" + "branch = master\n");
BranchNameKey targetBranch = BranchNameKey.create(Project.nameKey("project"), "master");
Set<SubmoduleSubscription> res = new SubmoduleSectionParser(cfg, THIS_SERVER, targetBranch).parseAllSections();
Set<SubmoduleSubscription> expected = Sets.newHashSet(new SubmoduleSubscription(targetBranch, BranchNameKey.create(p1, "master"), "a"));
assertThat(res).containsExactlyElementsIn(expected);
}
use of com.google.gerrit.entities.BranchNameKey in project gerrit by GerritCodeReview.
the class SubmoduleSectionParserTest method withSlashesInPath.
@Test
public void withSlashesInPath() throws Exception {
Project.NameKey p = Project.nameKey("a");
Config cfg = new Config();
cfg.fromText("" + "[submodule \"a\"]\n" + "path = a/b/c/d/e\n" + "url = http://localhost:80/" + p.get() + "\n" + "branch = master\n");
BranchNameKey targetBranch = BranchNameKey.create(Project.nameKey("project"), "master");
Set<SubmoduleSubscription> res = new SubmoduleSectionParser(cfg, THIS_SERVER, targetBranch).parseAllSections();
Set<SubmoduleSubscription> expected = Sets.newHashSet(new SubmoduleSubscription(targetBranch, BranchNameKey.create(p, "master"), "a/b/c/d/e"));
assertThat(res).containsExactlyElementsIn(expected);
}
Aggregations