use of com.google.gerrit.extensions.api.projects.ConfigInput in project gerrit by GerritCodeReview.
the class ProjectIT method configChangeCausesRefUpdate.
@Test
public void configChangeCausesRefUpdate() throws Exception {
RevCommit initialHead = getRemoteHead(project, RefNames.REFS_CONFIG);
ConfigInfo info = gApi.projects().name(project.get()).config();
assertThat(info.submitType).isEqualTo(SubmitType.MERGE_IF_NECESSARY);
ConfigInput input = new ConfigInput();
input.submitType = SubmitType.CHERRY_PICK;
info = gApi.projects().name(project.get()).config(input);
assertThat(info.submitType).isEqualTo(SubmitType.CHERRY_PICK);
info = gApi.projects().name(project.get()).config();
assertThat(info.submitType).isEqualTo(SubmitType.CHERRY_PICK);
RevCommit updatedHead = getRemoteHead(project, RefNames.REFS_CONFIG);
eventRecorder.assertRefUpdatedEvents(project.get(), RefNames.REFS_CONFIG, initialHead, updatedHead);
}
use of com.google.gerrit.extensions.api.projects.ConfigInput in project gerrit by GerritCodeReview.
the class ProjectIT method setPartialConfig.
@Test
public void setPartialConfig() throws Exception {
ConfigInput input = createTestConfigInput();
ConfigInfo info = gApi.projects().name(project.get()).config(input);
ConfigInput partialInput = new ConfigInput();
partialInput.useContributorAgreements = InheritableBoolean.FALSE;
info = gApi.projects().name(project.get()).config(partialInput);
assertThat(info.description).isNull();
assertThat(info.useContributorAgreements.configuredValue).isEqualTo(partialInput.useContributorAgreements);
assertThat(info.useContentMerge.configuredValue).isEqualTo(input.useContentMerge);
assertThat(info.useSignedOffBy.configuredValue).isEqualTo(input.useSignedOffBy);
assertThat(info.createNewChangeForAllNotInTarget.configuredValue).isEqualTo(input.createNewChangeForAllNotInTarget);
assertThat(info.requireChangeId.configuredValue).isEqualTo(input.requireChangeId);
assertThat(info.rejectImplicitMerges.configuredValue).isEqualTo(input.rejectImplicitMerges);
assertThat(info.enableReviewerByEmail.configuredValue).isEqualTo(input.enableReviewerByEmail);
assertThat(info.createNewChangeForAllNotInTarget.configuredValue).isEqualTo(input.createNewChangeForAllNotInTarget);
assertThat(info.maxObjectSizeLimit.configuredValue).isEqualTo(input.maxObjectSizeLimit);
assertThat(info.submitType).isEqualTo(input.submitType);
assertThat(info.state).isEqualTo(input.state);
}
use of com.google.gerrit.extensions.api.projects.ConfigInput in project gerrit by GerritCodeReview.
the class ProjectIT method createTestConfigInput.
private ConfigInput createTestConfigInput() {
ConfigInput input = new ConfigInput();
input.description = "some description";
input.useContributorAgreements = InheritableBoolean.TRUE;
input.useContentMerge = InheritableBoolean.TRUE;
input.useSignedOffBy = InheritableBoolean.TRUE;
input.createNewChangeForAllNotInTarget = InheritableBoolean.TRUE;
input.requireChangeId = InheritableBoolean.TRUE;
input.rejectImplicitMerges = InheritableBoolean.TRUE;
input.enableReviewerByEmail = InheritableBoolean.TRUE;
input.createNewChangeForAllNotInTarget = InheritableBoolean.TRUE;
input.maxObjectSizeLimit = "5m";
input.submitType = SubmitType.CHERRY_PICK;
input.state = ProjectState.HIDDEN;
return input;
}
use of com.google.gerrit.extensions.api.projects.ConfigInput in project gerrit by GerritCodeReview.
the class ChangeReviewersByEmailIT method rejectWhenFeatureIsDisabled.
@Test
public void rejectWhenFeatureIsDisabled() throws Exception {
assume().that(notesMigration.readChanges()).isTrue();
ConfigInput conf = new ConfigInput();
conf.enableReviewerByEmail = InheritableBoolean.FALSE;
gApi.projects().name(project.get()).config(conf);
PushOneCommit.Result r = createChange();
AddReviewerResult result = gApi.changes().id(r.getChangeId()).addReviewer("Foo Bar <foo.bar@gerritcodereview.com>");
assertThat(result.error).isEqualTo("Foo Bar <foo.bar@gerritcodereview.com> does not identify a registered user or group");
assertThat(result.reviewers).isNull();
}
use of com.google.gerrit.extensions.api.projects.ConfigInput in project gerrit by GerritCodeReview.
the class SetProjectCommand method run.
@Override
protected void run() throws Failure {
ConfigInput configInput = new ConfigInput();
configInput.requireChangeId = requireChangeID;
configInput.submitType = submitType;
configInput.useContentMerge = contentMerge;
configInput.useContributorAgreements = contributorAgreements;
configInput.useSignedOffBy = signedOffBy;
configInput.state = state;
configInput.maxObjectSizeLimit = maxObjectSizeLimit;
// keeping the existing description, it would delete it.
if (Strings.emptyToNull(projectDescription) != null) {
configInput.description = projectDescription;
} else {
configInput.description = projectControl.getProject().getDescription();
}
try {
putConfig.apply(new ProjectResource(projectControl), configInput);
} catch (RestApiException e) {
throw die(e);
}
}
Aggregations