in javatests/com/googlesource/gerrit/plugins/supermanifest/JiriSuperManifestIT.java [480:541]
public void wildcardDestBranchWorks() throws Exception {
setupTestRepos("project");
// Make sure the manifest exists so the configuration loads successfully.
Project.NameKey manifestKey = projectOperations.newProject().name(name("manifest")).create();
TestRepository<InMemoryRepository> manifestRepo = cloneProject(manifestKey, admin);
Project.NameKey superKey = projectOperations.newProject().name(name("superproject")).create();
cloneProject(superKey, admin);
pushConfig(
"[superproject \""
+ superKey.get()
+ ":refs/heads/*\"]\n"
+ " srcRepo = "
+ manifestKey.get()
+ "\n"
+ " srcRef = blablabla\n"
+ " srcPath = default\n"
+ " toolType = jiri\n");
// XML change will trigger commit to superproject.
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";
pushFactory
.create(admin.newIdent(), manifestRepo, "Subject", "default", xml)
.to("refs/heads/src1")
.assertOkStatus();
xml =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<manifest>\n<projects>\n"
+ " <project name=\""
+ testRepoKeys[1].get()
+ "\" remote=\""
+ canonicalWebUrl.get()
+ testRepoKeys[1].get()
+ "\" path=\"project2\" />\n"
+ "</projects>\n</manifest>\n";
pushFactory
.create(admin.newIdent(), manifestRepo, "Subject", "default", xml)
.to("refs/heads/src2")
.assertOkStatus();
BranchApi branch1 = gApi.projects().name(superKey.get()).branch("refs/heads/src1");
assertThat(branch1.file("project1").getContentType()).isEqualTo("x-git/gitlink; charset=UTF-8");
assertThrows(ResourceNotFoundException.class, () -> branch1.file("project2"));
BranchApi branch2 = gApi.projects().name(superKey.get()).branch("refs/heads/src2");
assertThat(branch2.file("project2").getContentType()).isEqualTo("x-git/gitlink; charset=UTF-8");
assertThrows(ResourceNotFoundException.class, () -> branch2.file("project1"));
}