in javatests/com/googlesource/gerrit/plugins/supermanifest/JiriSuperManifestIT.java [198:263]
public void ImportTagWorks() throws Exception {
setupTestRepos("project");
// Make sure the manifest exists so the configuration loads successfully.
Project.NameKey manifest1Key = projectOperations.newProject().name(name("manifest1")).create();
TestRepository<InMemoryRepository> manifest1Repo = cloneProject(manifest1Key, admin);
Project.NameKey manifest2Key = projectOperations.newProject().name(name("manifest2")).create();
TestRepository<InMemoryRepository> manifest2Repo = cloneProject(manifest2Key, admin);
Project.NameKey superKey = projectOperations.newProject().name(name("superproject")).create();
cloneProject(superKey, admin);
pushConfig(
"[superproject \""
+ superKey.get()
+ ":refs/heads/destbranch\"]\n"
+ " srcRepo = "
+ manifest1Key.get()
+ "\n"
+ " srcRef = refs/heads/srcbranch\n"
+ " srcPath = default\n"
+ " toolType = jiri\n");
// XML change will trigger commit to superproject.
String xml1 =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<manifest>\n<imports>\n"
+ "<import name=\""
+ manifest2Key.get()
+ "\" manifest=\"default\" remote=\""
+ canonicalWebUrl.get()
+ manifest2Key.get()
+ "\" />\n</imports>"
+ "<projects>\n"
+ "<project name=\""
+ testRepoKeys[0].get()
+ "\" remote=\""
+ canonicalWebUrl.get()
+ testRepoKeys[0].get()
+ "\" path=\"project1\" />\n"
+ "</projects>\n</manifest>\n";
String xml2 =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<manifest>\n<projects>\n"
+ "<project name=\""
+ manifest2Key.get()
+ "\" remote=\""
+ canonicalWebUrl.get()
+ manifest2Key.get()
+ "\" path=\"manifest2\" />\n"
+ "</projects>\n</manifest>\n";
pushFactory
.create(admin.newIdent(), manifest2Repo, "Subject", "default", xml2)
.to("refs/heads/master")
.assertOkStatus();
pushFactory
.create(admin.newIdent(), manifest1Repo, "Subject", "default", xml1)
.to("refs/heads/srcbranch")
.assertOkStatus();
BranchApi branch = gApi.projects().name(superKey.get()).branch("refs/heads/destbranch");
assertThat(branch.file("project1").getContentType()).isEqualTo("x-git/gitlink; charset=UTF-8");
assertThat(branch.file("manifest2").getContentType()).isEqualTo("x-git/gitlink; charset=UTF-8");
}