Skip to content

Commit

Permalink
Changing username to workspace for repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed Feb 2, 2020
1 parent bb8277e commit 0bb3a5b
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 16 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,29 @@

Changelog of Violation comments to bitbucket cloud lib.

## Unreleased
### GitHub [#1](https://github.com/tomasbjerre/violation-comments-to-bitbucket-cloud-lib/issues/1) Delete Comments Endpoint passes Username in the place of Workspace

**Changing username to workspace for repositories**

* tomasbjerre/violation-comments-to-bitbucket-cloud-lib

[bb8277e72183021](https://github.com/tomasbjerre/violation-comments-to-bitbucket-cloud-lib/commit/bb8277e72183021) Tomas Bjerre *2020-02-02 18:02:27*


### No issue

**doc**


[56f72b3c2fc0ff9](https://github.com/tomasbjerre/violation-comments-to-bitbucket-cloud-lib/commit/56f72b3c2fc0ff9) Tomas Bjerre *2019-10-09 17:10:11*

**Create FUNDING.yml**


[ca9ee2bee584efd](https://github.com/tomasbjerre/violation-comments-to-bitbucket-cloud-lib/commit/ca9ee2bee584efd) Tomas Bjerre *2019-09-28 07:04:27*


## 1.11
### No issue

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ apply from: project.buildscript.classLoader.getResource('release.gradle').toURI(

dependencies {
compile 'se.bjurr.violations:violation-comments-lib:1.98'
compile 'se.bjurr.bitbucketcloud:bitbucket-cloud-java-rest-api:1.9'
compile 'se.bjurr.bitbucketcloud:bitbucket-cloud-java-rest-api:1.11'
compile 'org.jboss.resteasy:resteasy-client:4.0.0.Final'
compile 'org.slf4j:slf4j-simple:1.7.26'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void createComment(final String commentString) {
new se.bjurr.bitbucketcloud.gen.model.Comment();
comment.setContent(content);

repositoryClient.repositoriesUsernameRepoSlugPullrequestsPullRequestIdCommentsPost(
repositoryClient.repositoriesWorkspaceRepoSlugPullrequestsPullRequestIdCommentsPost(
api.getWorkspace(), api.getRepositorySlug(), api.getPullRequestId(), comment);
}

Expand All @@ -80,14 +80,14 @@ public void createSingleFileComment(
comment.setContent(content);
comment.setInline(inline);

repositoryClient.repositoriesUsernameRepoSlugPullrequestsPullRequestIdCommentsPost(
repositoryClient.repositoriesWorkspaceRepoSlugPullrequestsPullRequestIdCommentsPost(
api.getWorkspace(), api.getRepositorySlug(), api.getPullRequestId(), comment);
}

@Override
public List<Comment> getComments() {
final PaginatedActivities activities =
repositoryClient.repositoriesUsernameRepoSlugPullrequestsPullRequestIdActivityGet(
repositoryClient.repositoriesWorkspaceRepoSlugPullrequestsPullRequestIdActivityGet(
api.getWorkspace(), api.getRepositorySlug(), api.getPullRequestId());

final List<Comment> comments =
Expand All @@ -100,7 +100,7 @@ public List<Comment> getComments() {
.collect(Collectors.toList());

final PaginatedPullrequestComments prComments =
repositoryClient.repositoriesUsernameRepoSlugPullrequestsPullRequestIdCommentsGet(
repositoryClient.repositoriesWorkspaceRepoSlugPullrequestsPullRequestIdCommentsGet(
api.getWorkspace(), api.getRepositorySlug(), api.getPullRequestId());
comments.addAll(
prComments.getValues().stream().map(COMMENT_TO_COMMENT).collect(Collectors.toList()));
Expand Down Expand Up @@ -130,8 +130,9 @@ public void removeComments(final List<Comment> comments) {
final String repoSlug = api.getRepositorySlug();
for (final Comment comment : comments) {
final String commentId = comment.getIdentifier();
repositoryClient.repositoriesUsernameRepoSlugPullrequestsPullRequestIdCommentsCommentIdDelete(
username, pullRequestId, commentId, repoSlug);
repositoryClient
.repositoriesWorkspaceRepoSlugPullrequestsPullRequestIdCommentsCommentIdDelete(
username, pullRequestId, commentId, repoSlug);
}
}

Expand Down Expand Up @@ -203,7 +204,7 @@ private synchronized String getDiff(final String path) {
final Boolean ignoreWhitespace = null;
final Boolean binary = null;
final String diffString =
repositoryClient.repositoriesUsernameRepoSlugDiffSpecGet(
repositoryClient.repositoriesWorkspaceRepoSlugDiffSpecGet(
username, spec, repoSlug, context, path, ignoreWhitespace, binary);
this.diffsPerFile.put(path, diffString);
}
Expand All @@ -217,7 +218,7 @@ private synchronized List<Diffstat> getDiffstat() {
final String spec = getDiffSpec();
final Boolean ignoreWhitespace = null;
final PaginatedDiffstats diff =
repositoryClient.repositoriesUsernameRepoSlugDiffstatSpecGet(
repositoryClient.repositoriesWorkspaceRepoSlugDiffstatSpecGet(
api.getWorkspace(), api.getRepositorySlug(), spec, ignoreWhitespace);
this.diffStat = diff.getValues();
return this.diffStat;
Expand All @@ -226,7 +227,7 @@ private synchronized List<Diffstat> getDiffstat() {
private synchronized String getDiffSpec() {
if (this.diffSpec == null) {
final Pullrequest pr =
repositoryClient.repositoriesUsernameRepoSlugPullrequestsPullRequestIdGet(
repositoryClient.repositoriesWorkspaceRepoSlugPullrequestsPullRequestIdGet(
api.getWorkspace(), api.getRepositorySlug(), api.getPullRequestId());
diffSpec =
pr.getSource().getCommit().getHash() + ".." + pr.getDestination().getCommit().getHash();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void testGetDiffspec() {
final String spec = "7e23c9a98019..master";
final Boolean ignoreWhitespace = true;
final PaginatedDiffstats actual =
client.repositoriesUsernameRepoSlugDiffstatSpecGet(
client.repositoriesWorkspaceRepoSlugDiffstatSpecGet(
username, repoSlug, spec, ignoreWhitespace);

assertThat(actual).isNotNull();
Expand All @@ -81,7 +81,7 @@ public void testGetDiff() {
final Integer context = null;
final String path = null;
final String actual =
client.repositoriesUsernameRepoSlugDiffSpecGet(
client.repositoriesWorkspaceRepoSlugDiffSpecGet(
username, spec, repoSlug, context, path, ignoreWhitespace, false);

assertThat(actual).isNotNull();
Expand All @@ -102,7 +102,7 @@ public void testGetCommitsInPR() {
final String repoSlug = "violations-test";
final String pullRequestId = "1";
final PaginatedPullrequestsCommits actual =
client.repositoriesUsernameRepoSlugPullrequestsPullRequestIdCommitsGet(
client.repositoriesWorkspaceRepoSlugPullrequestsPullRequestIdCommitsGet(
username, pullRequestId, repoSlug);

assertThat(actual).isNotNull();
Expand All @@ -124,7 +124,7 @@ public String testGetCommentsInPR() {
final String repoSlug = "violations-test";
final String pullRequestId = "1";
final PaginatedPullrequestComments actual =
client.repositoriesUsernameRepoSlugPullrequestsPullRequestIdCommentsGet(
client.repositoriesWorkspaceRepoSlugPullrequestsPullRequestIdCommentsGet(
username, repoSlug, pullRequestId);

assertThat(actual).isNotNull();
Expand All @@ -149,7 +149,7 @@ private void testCreateCommentInPr() {
final Comment comment = new Comment();
comment.setContent(content);
final Comment created =
client.repositoriesUsernameRepoSlugPullrequestsPullRequestIdCommentsPost(
client.repositoriesWorkspaceRepoSlugPullrequestsPullRequestIdCommentsPost(
username, repoSlug, pullRequestId, comment);
System.out.println("created: " + created);
}
Expand All @@ -166,7 +166,7 @@ public void testDeleteCommentsInPR(final String commentId) {
final String username = "tomasbjerre";
final String repoSlug = "violations-test";
final String pullRequestId = "1";
client.repositoriesUsernameRepoSlugPullrequestsPullRequestIdCommentsCommentIdDelete(
client.repositoriesWorkspaceRepoSlugPullrequestsPullRequestIdCommentsCommentIdDelete(
username, pullRequestId, commentId, repoSlug);
}
}

0 comments on commit 0bb3a5b

Please sign in to comment.