aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
diff options
context:
space:
mode:
authorJonathan Nieder <jrn@google.com>2018-08-20 22:14:35 -0400
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2018-08-20 22:14:35 -0400
commitaf75250a45e49b9cda832287076131db15174410 (patch)
treeb7179e5af4153786f20917b1900f98f161550ab9 /org.eclipse.jgit.test/tst
parent0c12df54f1eff69231822a78fb2230f01dd63561 (diff)
parent58a90f7a70f11ca79fa678086a2425b0eecbae06 (diff)
downloadjgit-af75250a45e49b9cda832287076131db15174410.tar.gz
jgit-af75250a45e49b9cda832287076131db15174410.zip
Merge "Support remove-project node in the manifest parser"
Diffstat (limited to 'org.eclipse.jgit.test/tst')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/ManifestParserTest.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/ManifestParserTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/ManifestParserTest.java
index 69a48cc4b5..024f054807 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/ManifestParserTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/ManifestParserTest.java
@@ -43,6 +43,7 @@
package org.eclipse.jgit.gitrepo;
import static org.eclipse.jgit.lib.Constants.CHARSET;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -51,6 +52,8 @@ import java.io.IOException;
import java.net.URI;
import java.util.HashSet;
import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import org.junit.Test;
import org.xml.sax.SAXException;
@@ -145,6 +148,29 @@ public class ManifestParserTest {
}
}
+ @Test
+ public void testRemoveProject() throws Exception {
+ StringBuilder xmlContent = new StringBuilder();
+ xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
+ .append("<manifest>")
+ .append("<remote name=\"remote1\" fetch=\".\" />")
+ .append("<default revision=\"master\" remote=\"remote1\" />")
+ .append("<project path=\"foo\" name=\"foo\" />")
+ .append("<project path=\"bar\" name=\"bar\" />")
+ .append("<remove-project name=\"foo\" />")
+ .append("<project path=\"foo\" name=\"baz\" />")
+ .append("</manifest>");
+
+ ManifestParser parser = new ManifestParser(null, null, "master",
+ "https://git.google.com/", null, null);
+ parser.read(new ByteArrayInputStream(
+ xmlContent.toString().getBytes(CHARSET)));
+
+ assertEquals(Stream.of("bar", "baz").collect(Collectors.toSet()),
+ parser.getProjects().stream().map(RepoProject::getName)
+ .collect(Collectors.toSet()));
+ }
+
void testNormalize(String in, String want) {
URI got = ManifestParser.normalizeEmptyPath(URI.create(in));
if (!got.toString().equals(want)) {