in javatests/com/googlesource/gerrit/plugins/supermanifest/RepoSuperManifestIT.java [228:275]
public void httpEndpoint() throws Exception {
setupTestRepos("project");
String remoteXml = " <remote name=\"origin\" fetch=\"" + canonicalWebUrl.get() + "\" />\n";
String defaultXml = " <default remote=\"origin\" revision=\"refs/heads/master\" />\n";
String xml =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<manifest>\n"
+ remoteXml
+ defaultXml
+ " <project name=\""
+ testRepoKeys[0].get()
+ "\" path=\"project1\" />\n"
+ "</manifest>\n";
pushFactory
.create(admin.newIdent(), manifestRepo, "Subject", "default.xml", xml)
.to("refs/heads/srcbranch")
.assertOkStatus();
pushFactory
.create(admin.newIdent(), manifestRepo, "Subject", "default.xml", xml)
.to("refs/heads/anotherbranch")
.assertOkStatus();
// Push config after XML. Needs a manual trigger to create the destination.
pushConfig(
"[superproject \""
+ superKey.get()
+ ":refs/heads/destbranch\"]\n"
+ " srcRepo = "
+ manifestKey.get()
+ "\n"
+ " srcRef = refs/heads/srcbranch\n"
+ " srcPath = default.xml\n");
RestResponse r =
userRestSession.post("/projects/" + manifestKey + "/branches/srcbranch/update_manifest");
r.assertForbidden();
r = adminRestSession.post("/projects/" + manifestKey + "/branches/srcbranch/update_manifest");
r.assertOK();
r =
adminRestSession.post(
"/projects/" + manifestKey + "/branches/anotherbranch/update_manifest");
r.assertNoContent();
BranchApi branch = gApi.projects().name(superKey.get()).branch("refs/heads/destbranch");
assertThat(branch.file("project1").getContentType()).isEqualTo("x-git/gitlink; charset=UTF-8");
}