in javatests/com/googlesource/gerrit/plugins/supermanifest/RepoSuperManifestIT.java [468:519]
public void manifestIncludesOtherManifest() throws Exception {
setupTestRepos("project");
String remoteXml = " <remote name=\"origin\" fetch=\"" + canonicalWebUrl.get() + "\" />\n";
String originXml = " <default remote=\"origin\" revision=\"refs/heads/master\" />\n";
String xml =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<manifest>\n"
+ remoteXml
+ originXml
+ " <project name=\""
+ testRepoKeys[0].get()
+ "\" path=\"project1\" />\n"
+ "</manifest>\n";
pushFactory
.create(admin.newIdent(), manifestRepo, "Subject", "default.xml", xml)
.to("refs/heads/master")
.assertOkStatus();
String superXml =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<manifest>"
+ " <include name=\"default.xml\"/>"
+ "</manifest>";
pushFactory
.create(admin.newIdent(), manifestRepo, "Subject", "super.xml", superXml)
.to("refs/heads/master")
.assertOkStatus();
pushConfig(
"[superproject \""
+ superKey.get()
+ ":refs/heads/master\"]\n"
+ " srcRepo = "
+ manifestKey.get()
+ "\n"
+ " srcRef = refs/heads/master\n"
+ " srcPath = super.xml\n");
// Push a change to the source branch. We intentionally change the included XML file
// (rather than the one mentioned in srcPath), to double check that we don't try to be too
// smart about eliding nops.
pushFactory
.create(admin.newIdent(), manifestRepo, "Subject", "default.xml", xml + " ")
.to("refs/heads/master")
.assertOkStatus();
BranchApi branch = gApi.projects().name(superKey.get()).branch("refs/heads/master");
assertThat(branch.file("project1").getContentType()).isEqualTo("x-git/gitlink; charset=UTF-8");
}