use of com.google.gerrit.reviewdb.client.Project in project gerrit by GerritCodeReview.
the class SubmoduleSectionParserIT method withDeepRelativeURI.
@Test
public void withDeepRelativeURI() throws Exception {
Project.NameKey p1 = createProject("a");
Config cfg = new Config();
cfg.fromText("" + "[submodule \"a\"]\n" + "path = a\n" + "url = ../../" + p1.get() + "\n" + "branch = master\n");
Branch.NameKey targetBranch = new Branch.NameKey(new Project.NameKey("nested/project"), "master");
Set<SubmoduleSubscription> res = new SubmoduleSectionParser(cfg, THIS_SERVER, targetBranch).parseAllSections();
Set<SubmoduleSubscription> expected = Sets.newHashSet(new SubmoduleSubscription(targetBranch, new Branch.NameKey(p1, "master"), "a"));
assertThat(res).containsExactlyElementsIn(expected);
}
use of com.google.gerrit.reviewdb.client.Project in project gerrit by GerritCodeReview.
the class SubmoduleSectionParserIT method withOverlyDeepRelativeURI.
@Test
public void withOverlyDeepRelativeURI() throws Exception {
Project.NameKey p1 = createProject("nested/a");
Config cfg = new Config();
cfg.fromText("" + "[submodule \"a\"]\n" + "path = a\n" + "url = ../../" + p1.get() + "\n" + "branch = master\n");
Branch.NameKey targetBranch = new Branch.NameKey(new Project.NameKey("nested/project"), "master");
Set<SubmoduleSubscription> res = new SubmoduleSectionParser(cfg, THIS_SERVER, targetBranch).parseAllSections();
Set<SubmoduleSubscription> expected = Sets.newHashSet(new SubmoduleSubscription(targetBranch, new Branch.NameKey(p1, "master"), "a"));
assertThat(res).containsExactlyElementsIn(expected);
}
use of com.google.gerrit.reviewdb.client.Project in project gerrit by GerritCodeReview.
the class SubmoduleSectionParserIT method withRelativeURI.
@Test
public void withRelativeURI() throws Exception {
Project.NameKey p1 = createProject("a");
Config cfg = new Config();
cfg.fromText("" + "[submodule \"a\"]\n" + "path = a\n" + "url = ../" + p1.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(p1, "master"), "a"));
assertThat(res).containsExactlyElementsIn(expected);
}
use of com.google.gerrit.reviewdb.client.Project in project gerrit by GerritCodeReview.
the class SubmoduleSectionParserIT 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");
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 withMoreSections.
@Test
public void withMoreSections() throws Exception {
Project.NameKey p1 = createProject("a");
Project.NameKey p2 = createProject("b");
Config cfg = new Config();
cfg.fromText("" + "[submodule \"a\"]\n" + " path = a\n" + " url = ssh://localhost/" + p1.get() + "\n" + " branch = .\n" + "[submodule \"b\"]\n" + " path = b\n" + " url = http://localhost:80/" + p2.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(p1, "master"), "a"), new SubmoduleSubscription(targetBranch, new Branch.NameKey(p2, "master"), "b"));
assertThat(res).containsExactlyElementsIn(expected);
}
Aggregations