use of com.google.gerrit.server.git.receive.PluginPushOption in project gerrit by GerritCodeReview.
the class AbstractPushForReview method pluginPushOptionsHelp.
@Test
public void pluginPushOptionsHelp() throws Exception {
PluginPushOption fooOption = new TestPluginPushOption("foo", "some description");
PluginPushOption barOption = new TestPluginPushOption("bar", "other description");
try (Registration registration = extensionRegistry.newRegistration().add(fooOption).add(barOption)) {
PushOneCommit push = pushFactory.create(admin.newIdent(), testRepo, "change2", "b.txt", "content");
push.setPushOptions(ImmutableList.of("help"));
PushOneCommit.Result r = push.to("refs/for/master");
r.assertErrorStatus("see help");
r.assertMessage("-o gerrit~bar: other description\n-o gerrit~foo: some description\n");
}
}
use of com.google.gerrit.server.git.receive.PluginPushOption in project gerrit by GerritCodeReview.
the class AbstractPushForReview method pushOptionsArePassedToCommitValidationListener.
@Test
public void pushOptionsArePassedToCommitValidationListener() throws Exception {
TestValidator validator = new TestValidator();
PluginPushOption fooOption = new TestPluginPushOption("foo", "some description");
PluginPushOption barOption = new TestPluginPushOption("bar", "other description");
try (Registration registration = extensionRegistry.newRegistration().add(validator).add(fooOption).add(barOption)) {
PushOneCommit push = pushFactory.create(admin.newIdent(), testRepo, "change2", "b.txt", "content");
push.setPushOptions(ImmutableList.of("trace=123", "gerrit~foo", "gerrit~bar=456"));
PushOneCommit.Result r = push.to("refs/for/master");
r.assertOkStatus();
assertThat(validator.getReceivedEvent().pushOptions).containsExactly("trace", "123", "gerrit~foo", "", "gerrit~bar", "456");
}
}
Aggregations