Skip to content

Commit

Permalink
VIOLATIONS_KEYSTORE_PATH #14
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed Sep 1, 2020
1 parent d9ff181 commit 80a7dbc
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 10 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@

Changelog of Violation comments to bitbucket server lib.

## Unreleased
### No issue

**doc**


[d9ff1815255b7dc](https://github.com/tomasbjerre/violation-comments-to-bitbucket-server-lib/commit/d9ff1815255b7dc) Tomas Bjerre *2020-08-29 13:58:10*


## 1.98
### No issue

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public BitbucketServerCommentsProvider(
final Integer proxyHostPort = violationCommentsToBitbucketApi.getProxyHostPort();
final String proxyUser = violationCommentsToBitbucketApi.getProxyUser();
final String proxyPassword = violationCommentsToBitbucketApi.getProxyPassword();
final String keyStorePath = violationCommentsToBitbucketApi.getPropKeyStorePath();
final String keyStorePass = violationCommentsToBitbucketApi.getPropKeyStorePass();
final String keyStorePath = violationCommentsToBitbucketApi.getKeyStorePath();
final String keyStorePass = violationCommentsToBitbucketApi.getKeyStorePass();
this.client =
new BitbucketServerClient(
violationsLogger,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public static ViolationCommentsToBitbucketServerApi violationCommentsToBitbucket
private String propPersonalAccessToken = DEFAULT_PROP_PERSONAL_ACCESS_TOKEN;
private String propKeyStorePath = DEFAULT_PROP_KEYSTORE_PATH;
private String propKeyStorePass = DEFAULT_PROP_KEYSTORE_PASS;
private String keyStorePath;
private String keyStorePass;
private int pullRequestId;
private String repoSlug;
private String username;
Expand Down Expand Up @@ -71,10 +73,10 @@ private ViolationCommentsToBitbucketServerApi() {}
private void checkState() {
final boolean noUsername = isNullOrEmpty(this.username) || isNullOrEmpty(this.password);
final boolean noPat = isNullOrEmpty(this.personalAccessToken);
final boolean noCert = isNullOrEmpty(this.propKeyStorePath);
final boolean noCert = isNullOrEmpty(this.keyStorePath);
if (noUsername && noPat && noCert) {
throw new IllegalStateException(
"User and Password, or personal access token, or keystore path and keystore pass, must be set! They can be set with the API or by setting properties.\n"
"User and Password or personal access token, or keystore path and keystore pass, must be set! They can be set with the API or by setting properties.\n"
+ //
"Username/password:\n"
+ //
Expand Down Expand Up @@ -197,6 +199,14 @@ public String getPropKeyStorePass() {
return this.propKeyStorePass;
}

public String getKeyStorePass() {
return this.keyStorePass;
}

public String getKeyStorePath() {
return this.keyStorePath;
}

private void populateFromEnvironmentVariables() {
if (System.getProperty(this.propUsername) != null) {
this.username = firstNonNull(this.username, System.getProperty(this.propUsername));
Expand All @@ -209,12 +219,12 @@ private void populateFromEnvironmentVariables() {
firstNonNull(this.personalAccessToken, System.getProperty(this.propPersonalAccessToken));
}
if (System.getProperty(this.propKeyStorePath) != null) {
this.propKeyStorePath =
firstNonNull(this.propKeyStorePath, System.getProperty(this.propKeyStorePath));
this.keyStorePath =
firstNonNull(this.keyStorePath, System.getProperty(this.propKeyStorePath));
}
if (System.getProperty(this.propKeyStorePass) != null) {
this.propKeyStorePass =
firstNonNull(this.propKeyStorePass, System.getProperty(this.propKeyStorePass));
this.keyStorePass =
firstNonNull(this.keyStorePass, System.getProperty(this.propKeyStorePass));
}
}

Expand Down Expand Up @@ -351,12 +361,22 @@ public ViolationCommentsToBitbucketServerApi withCommentTemplate(final String co
}

public ViolationCommentsToBitbucketServerApi withKeyStorePath(final String keyStorePath) {
this.propKeyStorePath = keyStorePath;
this.keyStorePath = keyStorePath;
return this;
}

public ViolationCommentsToBitbucketServerApi withKeyStorePass(final String keyStorePass) {
this.propKeyStorePass = keyStorePass;
this.keyStorePass = keyStorePass;
return this;
}

public ViolationCommentsToBitbucketServerApi withPropKeyStorePath(final String propKeyStorePath) {
this.propKeyStorePath = propKeyStorePath;
return this;
}

public ViolationCommentsToBitbucketServerApi withPropKeyStorePass(final String propKeyStorePass) {
this.propKeyStorePass = propKeyStorePass;
return this;
}

Expand Down

0 comments on commit 80a7dbc

Please sign in to comment.