use of com.google.gerrit.extensions.api.projects.TagInfo in project gerrit by GerritCodeReview.
the class TagsIT method emptyBaseRevision.
@Test
public void emptyBaseRevision() throws Exception {
grantTagPermissions();
// If revision is not specified, the tag is created based on HEAD, which points to master.
RevCommit expectedRevision = projectOperations.project(project).getHead("master");
TagInput input = new TagInput();
input.ref = "test";
input.revision = "";
TagInfo result = tag(input.ref).create(input).get();
assertThat(result.ref).isEqualTo(R_TAGS + input.ref);
assertThat(result.revision).isEqualTo(expectedRevision.name());
}
use of com.google.gerrit.extensions.api.projects.TagInfo in project gerrit by GerritCodeReview.
the class TagsIT method lightweightTag.
@Test
public void lightweightTag() throws Exception {
grantTagPermissions();
PushOneCommit push = pushFactory.create(admin.newIdent(), 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();
assertThat(result.created.toInstant()).isEqualTo(instant(r));
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();
assertThat(result.created.toInstant()).isEqualTo(instant(r));
requestScopeOperations.setApiUser(user.id());
result = tag(input.ref).get();
assertThat(result.canDelete).isNull();
eventRecorder.assertRefUpdatedEvents(project.get(), result.ref, null, result.revision);
}
use of com.google.gerrit.extensions.api.projects.TagInfo in project gerrit by GerritCodeReview.
the class TagsIT method noBaseRevision.
@Test
public void noBaseRevision() throws Exception {
grantTagPermissions();
// If revision is not specified, the tag is created based on HEAD, which points to master.
RevCommit expectedRevision = projectOperations.project(project).getHead("master");
TagInput input = new TagInput();
input.ref = "test";
input.revision = null;
TagInfo result = tag(input.ref).create(input).get();
assertThat(result.ref).isEqualTo(R_TAGS + input.ref);
assertThat(result.revision).isEqualTo(expectedRevision.name());
}
use of com.google.gerrit.extensions.api.projects.TagInfo in project gerrit by GerritCodeReview.
the class TagsIT method baseRevisionIsTrimmed.
@Test
public void baseRevisionIsTrimmed() throws Exception {
grantTagPermissions();
RevCommit revision = projectOperations.project(project).getHead("master");
TagInput input = new TagInput();
input.ref = "test";
input.revision = "\t" + revision.name();
TagInfo result = tag(input.ref).create(input).get();
assertThat(result.ref).isEqualTo(R_TAGS + input.ref);
assertThat(result.revision).isEqualTo(revision.name());
}
use of com.google.gerrit.extensions.api.projects.TagInfo in project gerrit by GerritCodeReview.
the class TagsIT method assertTagList.
private void assertTagList(FluentIterable<String> expected, List<TagInfo> actual) throws Exception {
assertThat(actual).hasSize(expected.size());
for (int i = 0; i < expected.size(); i++) {
TagInfo info = actual.get(i);
assertThat(info.created).isNotNull();
assertThat(info.ref).isEqualTo(R_TAGS + expected.get(i));
}
}
Aggregations