Hoist createChange methods out of AbstractSubmit

Fix to use properly scoped topic names.

Change-Id: Id562334bbb25dccbcdecd027dddff0207afe7fee
This commit is contained in:
Dave Borowitz 2016-06-23 09:25:39 -04:00
parent 72c6449d22
commit 598591536b
2 changed files with 26 additions and 26 deletions

View File

@ -494,6 +494,29 @@ public abstract class AbstractDaemonTest {
return pushTo("refs/drafts/master");
}
protected PushOneCommit.Result createChange(String subject,
String fileName, String content) throws Exception {
PushOneCommit push = pushFactory.create(
db, admin.getIdent(), testRepo, subject, fileName, content);
return push.to("refs/for/master");
}
protected PushOneCommit.Result createChange(String subject,
String fileName, String content, String topic)
throws Exception {
PushOneCommit push = pushFactory.create(
db, admin.getIdent(), testRepo, subject, fileName, content);
return push.to("refs/for/master/" + name(topic));
}
protected PushOneCommit.Result createChange(TestRepository<?> repo,
String branch, String subject, String fileName, String content,
String topic) throws Exception {
PushOneCommit push = pushFactory.create(
db, admin.getIdent(), repo, subject, fileName, content);
return push.to("refs/for/" + branch + "/" + name(topic));
}
protected BranchApi createBranch(Branch.NameKey branch) throws Exception {
return gApi.projects()
.name(branch.getParentKey().get())

View File

@ -128,9 +128,9 @@ public abstract class AbstractSubmit extends AbstractDaemonTest {
approve(change2.getChangeId());
approve(change3.getChangeId());
submit(change3.getChangeId());
change1.assertChange(Change.Status.MERGED, "test-topic", admin);
change2.assertChange(Change.Status.MERGED, "test-topic", admin);
change3.assertChange(Change.Status.MERGED, "test-topic", admin);
change1.assertChange(Change.Status.MERGED, name("test-topic"), admin);
change2.assertChange(Change.Status.MERGED, name("test-topic"), admin);
change3.assertChange(Change.Status.MERGED, name("test-topic"), admin);
// Check for the exact change to have the correct submitter.
assertSubmitter(change3);
// Also check submitters for changes submitted via the topic relationship.
@ -205,29 +205,6 @@ public abstract class AbstractSubmit extends AbstractDaemonTest {
}
}
protected PushOneCommit.Result createChange(String subject,
String fileName, String content) throws Exception {
PushOneCommit push =
pushFactory.create(db, admin.getIdent(), testRepo, subject, fileName, content);
return push.to("refs/for/master");
}
protected PushOneCommit.Result createChange(String subject,
String fileName, String content, String topic)
throws Exception {
PushOneCommit push =
pushFactory.create(db, admin.getIdent(), testRepo, subject, fileName, content);
return push.to("refs/for/master/" + topic);
}
protected PushOneCommit.Result createChange(TestRepository<?> repo,
String branch, String subject, String fileName, String content,
String topic) throws Exception {
PushOneCommit push =
pushFactory.create(db, admin.getIdent(), repo, subject, fileName, content);
return push.to("refs/for/" + branch + "/" + name(topic));
}
protected void submit(String changeId) throws Exception {
submit(changeId, new SubmitInput(), null, null);
}