Search in sources :

Example 21 with SubmoduleSubscription

use of com.google.gerrit.entities.SubmoduleSubscription in project gerrit by GerritCodeReview.

the class SubmoduleSectionParserTest method withAnotherURI.

@Test
public void withAnotherURI() throws Exception {
    Project.NameKey p = Project.nameKey("a");
    Config cfg = new Config();
    cfg.fromText("" + "[submodule \"a\"]\n" + "path = a\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"));
    assertThat(res).containsExactlyElementsIn(expected);
}
Also used : Project(com.google.gerrit.entities.Project) BranchNameKey(com.google.gerrit.entities.BranchNameKey) Config(org.eclipse.jgit.lib.Config) SubmoduleSubscription(com.google.gerrit.entities.SubmoduleSubscription) Test(org.junit.Test)

Example 22 with SubmoduleSubscription

use of com.google.gerrit.entities.SubmoduleSubscription in project gerrit by GerritCodeReview.

the class SubmoduleSectionParserTest method withSubProjectFound.

@Test
public void withSubProjectFound() throws Exception {
    Project.NameKey p1 = Project.nameKey("a/b");
    Project.NameKey p2 = Project.nameKey("b");
    Config cfg = new Config();
    cfg.fromText("\n" + "[submodule \"a/b\"]\n" + "path = a/b\n" + "url = ssh://localhost/" + p1.get() + "\n" + "branch = .\n" + "[submodule \"b\"]\n" + "path = b\n" + "url = http://localhost/" + p2.get() + "\n" + "branch = .\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(p2, "master"), "b"), new SubmoduleSubscription(targetBranch, BranchNameKey.create(p1, "master"), "a/b"));
    assertThat(res).containsExactlyElementsIn(expected);
}
Also used : Project(com.google.gerrit.entities.Project) BranchNameKey(com.google.gerrit.entities.BranchNameKey) Config(org.eclipse.jgit.lib.Config) SubmoduleSubscription(com.google.gerrit.entities.SubmoduleSubscription) Test(org.junit.Test)

Aggregations

SubmoduleSubscription (com.google.gerrit.entities.SubmoduleSubscription)22 BranchNameKey (com.google.gerrit.entities.BranchNameKey)18 Test (org.junit.Test)18 Project (com.google.gerrit.entities.Project)16 Config (org.eclipse.jgit.lib.Config)16 CodeReviewCommit (com.google.gerrit.server.git.CodeReviewCommit)4 ObjectId (org.eclipse.jgit.lib.ObjectId)4 RevCommit (org.eclipse.jgit.revwalk.RevCommit)3 StorageException (com.google.gerrit.exceptions.StorageException)2 NoSuchProjectException (com.google.gerrit.server.project.NoSuchProjectException)2 OpenRepo (com.google.gerrit.server.submit.MergeOpRepoManager.OpenRepo)2 DefaultFactory (com.google.gerrit.server.submit.SubscriptionGraph.DefaultFactory)2 IOException (java.io.IOException)2 DirCache (org.eclipse.jgit.dircache.DirCache)2 DirCacheEditor (org.eclipse.jgit.dircache.DirCacheEditor)2 AnyObjectId (org.eclipse.jgit.lib.AnyObjectId)2 CommitBuilder (org.eclipse.jgit.lib.CommitBuilder)2 GerritPersonIdent (com.google.gerrit.server.GerritPersonIdent)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1