in javatests/com/googlesource/gerrit/plugins/supermanifest/JiriSuperManifestIT.java [637:693]
public void manifestIncludesOtherManifest() throws Exception {
setupTestRepos("project");
String xml =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<manifest>\n<projects>\n"
+ "<project name=\""
+ testRepoKeys[0].get()
+ "\" remote=\""
+ canonicalWebUrl.get()
+ testRepoKeys[0].get()
+ "\" path=\"project1\" />\n"
+ "</projects>\n</manifest>\n";
Project.NameKey manifestKey = projectOperations.newProject().name(name("manifest")).create();
TestRepository<InMemoryRepository> manifestRepo = cloneProject(manifestKey, admin);
pushFactory
.create(admin.newIdent(), manifestRepo, "Subject", "default", xml)
.to("refs/heads/master")
.assertOkStatus();
String superXml =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ "<manifest>\n<imports>\n"
+ " <localimport file=\"default\"/>"
+ "</imports>\n</manifest>";
pushFactory
.create(admin.newIdent(), manifestRepo, "Subject", "super", superXml)
.to("refs/heads/master")
.assertOkStatus();
Project.NameKey superKey = projectOperations.newProject().name(name("superproject")).create();
cloneProject(superKey, admin);
pushConfig(
"[superproject \""
+ superKey.get()
+ ":refs/heads/master\"]\n"
+ " srcRepo = "
+ manifestKey.get()
+ "\n"
+ " srcRef = refs/heads/master\n"
+ " srcPath = super\n"
+ " toolType = jiri\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 eluding nops.
pushFactory
.create(admin.newIdent(), manifestRepo, "Subject", "default", 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");
}