use of com.google.gerrit.extensions.api.projects.TagInput in project gerrit by GerritCodeReview.
the class TagsIT method lightweightTag.
@Test
public void lightweightTag() throws Exception {
grantTagPermissions();
PushOneCommit push = pushFactory.create(db, admin.getIdent(), testRepo);
PushOneCommit.Result r = push.to("refs/heads/master");
r.assertOkStatus();
TagInput input = new TagInput();
input.ref = "v1.0";
input.revision = r.getCommit().getName();
TagInfo result = tag(input.ref).create(input).get();
assertThat(result.ref).isEqualTo(R_TAGS + input.ref);
assertThat(result.revision).isEqualTo(input.revision);
assertThat(result.canDelete).isTrue();
input.ref = "refs/tags/v2.0";
result = tag(input.ref).create(input).get();
assertThat(result.ref).isEqualTo(input.ref);
assertThat(result.revision).isEqualTo(input.revision);
assertThat(result.canDelete).isTrue();
setApiUser(user);
result = tag(input.ref).get();
assertThat(result.canDelete).isFalse();
eventRecorder.assertRefUpdatedEvents(project.get(), result.ref, null, result.revision);
}
use of com.google.gerrit.extensions.api.projects.TagInput in project gerrit by GerritCodeReview.
the class TagsIT method createExistingTag.
@Test
public void createExistingTag() throws Exception {
grantTagPermissions();
TagInput input = new TagInput();
input.ref = "test";
TagInfo result = tag(input.ref).create(input).get();
assertThat(result.ref).isEqualTo(R_TAGS + "test");
input.ref = "refs/tags/test";
exception.expect(ResourceConflictException.class);
exception.expectMessage("tag \"" + R_TAGS + "test\" already exists");
tag(input.ref).create(input);
}
use of com.google.gerrit.extensions.api.projects.TagInput in project gerrit by GerritCodeReview.
the class ChangeIncludedInIT method includedInMergedChange.
@Test
public void includedInMergedChange() throws Exception {
Result result = createChange();
gApi.changes().id(result.getChangeId()).revision(result.getCommit().name()).review(ReviewInput.approve());
gApi.changes().id(result.getChangeId()).revision(result.getCommit().name()).submit();
assertThat(gApi.changes().id(result.getChangeId()).includedIn().branches).containsExactly("master");
assertThat(gApi.changes().id(result.getChangeId()).includedIn().tags).isEmpty();
grantTagPermissions();
gApi.projects().name(project.get()).tag("test-tag").create(new TagInput());
assertThat(gApi.changes().id(result.getChangeId()).includedIn().tags).containsExactly("test-tag");
createBranch(new Branch.NameKey(project.get(), "test-branch"));
assertThat(gApi.changes().id(result.getChangeId()).includedIn().branches).containsExactly("master", "test-branch");
}
use of com.google.gerrit.extensions.api.projects.TagInput in project gerrit by GerritCodeReview.
the class TagsIT method invalidBaseRevision.
@Test
public void invalidBaseRevision() throws Exception {
grantTagPermissions();
TagInput input = new TagInput();
input.ref = "test";
input.revision = "abcdefg";
exception.expect(BadRequestException.class);
exception.expectMessage("Invalid base revision");
tag(input.ref).create(input);
}
use of com.google.gerrit.extensions.api.projects.TagInput in project gerrit by GerritCodeReview.
the class TagsIT method createTags.
private void createTags() throws Exception {
grantTagPermissions();
String revision = pushTo("refs/heads/master").getCommit().name();
TagInput input = new TagInput();
input.revision = revision;
for (String tagname : testTags) {
TagInfo result = tag(tagname).create(input).get();
assertThat(result.revision).isEqualTo(input.revision);
assertThat(result.ref).isEqualTo(R_TAGS + tagname);
}
}
Aggregations