Add extension API and acceptance tests for submit type rules

Change-Id: I23ffb1f78ee3919994fba9797edcf7f132c92a65
This commit is contained in:
Dave Borowitz
2015-12-16 09:42:48 -05:00
parent 18ae9168c0
commit d85051ab5f
10 changed files with 304 additions and 33 deletions

View File

@@ -14,10 +14,12 @@
package com.google.gerrit.extensions.api.changes;
import com.google.gerrit.extensions.client.SubmitType;
import com.google.gerrit.extensions.common.ActionInfo;
import com.google.gerrit.extensions.common.CommentInfo;
import com.google.gerrit.extensions.common.FileInfo;
import com.google.gerrit.extensions.common.MergeableInfo;
import com.google.gerrit.extensions.common.TestSubmitRuleInput;
import com.google.gerrit.extensions.restapi.BinaryResult;
import com.google.gerrit.extensions.restapi.NotImplementedException;
import com.google.gerrit.extensions.restapi.RestApiException;
@@ -28,6 +30,7 @@ import java.util.Set;
public interface RevisionApi {
void delete() throws RestApiException;
void review(ReviewInput in) throws RestApiException;
void submit() throws RestApiException;
@@ -65,6 +68,9 @@ public interface RevisionApi {
Map<String, ActionInfo> actions() throws RestApiException;
SubmitType submitType() throws RestApiException;
SubmitType testSubmitType(TestSubmitRuleInput in) throws RestApiException;
/**
* A default implementation which allows source compatibility
* when adding new methods to the interface.
@@ -194,5 +200,16 @@ public interface RevisionApi {
public Map<String, ActionInfo> actions() throws RestApiException {
throw new NotImplementedException();
}
@Override
public SubmitType submitType() throws RestApiException {
throw new NotImplementedException();
}
@Override
public SubmitType testSubmitType(TestSubmitRuleInput in)
throws RestApiException {
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,27 @@
// Copyright (C) 2015 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.gerrit.extensions.common;
import com.google.gerrit.extensions.restapi.DefaultInput;
public class TestSubmitRuleInput {
public enum Filters {
RUN, SKIP
}
@DefaultInput
public String rule;
public Filters filters;
}