Skip to content
This repository has been archived by the owner on Jun 9, 2021. It is now read-only.

Commit

Permalink
Adjustments after merge of #173
Browse files Browse the repository at this point in the history
 * Adding fmt-maven-plugin to format code on Google Java Format.
 * Correcting warnings from Grunt / JSHint.
 * Adding, and using, enum, RENDER_FOR, in PrnfbRenderer.
  • Loading branch information
tomasbjerre committed Dec 25, 2016
1 parent 96f3584 commit 649638d
Show file tree
Hide file tree
Showing 75 changed files with 8,407 additions and 7,267 deletions.
25 changes: 24 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,33 @@
Changelog of Pull Request Notifier for Bitbucket.

## Unreleased
### GitHub [#173](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/pull/173) Add the ability to specify forms for buttons
Adjustments after merge of

* Adding fmt-maven-plugin to format code on Google Java Format.
* Correcting warnings from Grunt / JSHint.
* Adding, and using, enum, RENDER_FOR, in PrnfbRenderer.

[95fcfc4f334fb1e](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/95fcfc4f334fb1e) Tomas Bjerre *2016-12-25 21:29:22*

### No issue
Add interactive forms to buttons

This change adds the ability to specify a JSON-based form for a given
button, which will get automatically rendered when the button is pressed.
The submitted data is available as serialized JSON in the ${BUTTON_FORM_DATA}
variable.

For the specification of what a form looks like and it's serialized result,
look at README.md in the change.

[2a5c79347b713c8](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/2a5c79347b713c8) Itay Neeman *2016-12-24 20:55:47*

## 2.43
### GitHub [#169](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/169) What about pull request description ?
Removing PULL_REQUEST_DESCRIPTION from EVERYTHING_URL

[c616c4c575be53a](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/c616c4c575be53a) Tomas Bjerre *2016-12-15 21:18:37*
[5af97f531cae647](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/5af97f531cae647) Tomas Bjerre *2016-12-15 21:19:12*

## 2.42
### GitHub [#169](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/169) What about pull request description ?
Expand Down
22 changes: 17 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ Changelog of Pull Request Notifier for Bitbucket.
<enableQuickReload>true</enableQuickReload>
<pluginArtifacts>
<pluginArtifact>
<groupId>com.atlassian.labs.plugins</groupId>
<artifactId>quickreload</artifactId>
<version>${quick.reload.version}</version>
<groupId>com.atlassian.labs.plugins</groupId>
<artifactId>quickreload</artifactId>
<version>${quick.reload.version}</version>
</pluginArtifact>
</pluginArtifacts>
<products>
Expand Down Expand Up @@ -244,6 +244,18 @@ Changelog of Pull Request Notifier for Bitbucket.
</includes>
</configuration>
</plugin>
<plugin>
<groupId>com.coveo</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>1.3.0</version>
<executions>
<execution>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
Expand Down Expand Up @@ -275,7 +287,7 @@ Changelog of Pull Request Notifier for Bitbucket.
<properties>
<bitbucket.version>4.11.1</bitbucket.version>
<bitbucket.data.version>${bitbucket.version}</bitbucket.data.version>
<quick.reload.version>2.0.0</quick.reload.version>
<quick.reload.version>2.0.0</quick.reload.version>
<amps.version>6.1.0</amps.version>
</properties>
</project>
</project>
61 changes: 31 additions & 30 deletions src/main/java/se/bjurr/prnfb/http/ClientKeyStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,39 +19,40 @@
*/
public class ClientKeyStore {

private KeyStore keyStore = null;
private char[] password = null;

public ClientKeyStore(PrnfbSettingsData settings) {
if (settings.getKeyStore().isPresent()) {
File keyStoreFile = new File(settings.getKeyStore().get());
try {
this.keyStore = getKeyStore(settings.getKeyStoreType());

if (settings.getKeyStorePassword().isPresent()) {
this.password = settings.getKeyStorePassword().get().toCharArray();
private KeyStore keyStore = null;
private char[] password = null;

public ClientKeyStore(PrnfbSettingsData settings) {
if (settings.getKeyStore().isPresent()) {
File keyStoreFile = new File(settings.getKeyStore().get());
try {
this.keyStore = getKeyStore(settings.getKeyStoreType());

if (settings.getKeyStorePassword().isPresent()) {
this.password = settings.getKeyStorePassword().get().toCharArray();
}

this.keyStore.load(new FileInputStream(keyStoreFile), this.password);
} catch (Exception e) {
throw new RuntimeException(
"Unable to build keystore from " + keyStoreFile.getAbsolutePath(), e);
}
}

this.keyStore.load(new FileInputStream(keyStoreFile), this.password);
} catch (Exception e) {
throw new RuntimeException("Unable to build keystore from " + keyStoreFile.getAbsolutePath(), e);
}
}
}

public Optional<KeyStore> getKeyStore() {
return fromNullable(this.keyStore);
}
public Optional<KeyStore> getKeyStore() {
return fromNullable(this.keyStore);
}

public char[] getPassword() {
return this.password;
}
public char[] getPassword() {
return this.password;
}

private KeyStore getKeyStore(String keyStoreType) throws KeyStoreException {
if (keyStoreType != null) {
return KeyStore.getInstance(keyStoreType);
} else {
return KeyStore.getInstance(KeyStore.getDefaultType());
private KeyStore getKeyStore(String keyStoreType) throws KeyStoreException {
if (keyStoreType != null) {
return KeyStore.getInstance(keyStoreType);
} else {
return KeyStore.getInstance(KeyStore.getDefaultType());
}
}
}
}
}
126 changes: 66 additions & 60 deletions src/main/java/se/bjurr/prnfb/http/HttpResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,74 +3,80 @@
import java.net.URI;

public class HttpResponse {
private final String content;
private final String content;

private final int status;
private final int status;

private final URI uri;
private final URI uri;

public HttpResponse(URI uri, int status, String content) {
this.uri = uri;
this.status = status;
this.content = content;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
public HttpResponse(URI uri, int status, String content) {
this.uri = uri;
this.status = status;
this.content = content;
}
HttpResponse other = (HttpResponse) obj;
if (this.content == null) {
if (other.content != null) {
return false;
}
} else if (!this.content.equals(other.content)) {
return false;
}
if (this.status != other.status) {
return false;
}
if (this.uri == null) {
if (other.uri != null) {
return false;
}
} else if (!this.uri.equals(other.uri)) {
return false;

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
HttpResponse other = (HttpResponse) obj;
if (this.content == null) {
if (other.content != null) {
return false;
}
} else if (!this.content.equals(other.content)) {
return false;
}
if (this.status != other.status) {
return false;
}
if (this.uri == null) {
if (other.uri != null) {
return false;
}
} else if (!this.uri.equals(other.uri)) {
return false;
}
return true;
}
return true;
}

public String getContent() {
return this.content;
}
public String getContent() {
return this.content;
}

public int getStatus() {
return this.status;
}
public int getStatus() {
return this.status;
}

public URI getUri() {
return this.uri;
}
public URI getUri() {
return this.uri;
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((this.content == null) ? 0 : this.content.hashCode());
result = prime * result + this.status;
result = prime * result + ((this.uri == null) ? 0 : this.uri.hashCode());
return result;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((this.content == null) ? 0 : this.content.hashCode());
result = prime * result + this.status;
result = prime * result + ((this.uri == null) ? 0 : this.uri.hashCode());
return result;
}

@Override
public String toString() {
return "HttpResponse [content=" + this.content + ", status=" + this.status + ", uri=" + this.uri + "]";
}
@Override
public String toString() {
return "HttpResponse [content="
+ this.content
+ ", status="
+ this.status
+ ", uri="
+ this.uri
+ "]";
}
}
2 changes: 1 addition & 1 deletion src/main/java/se/bjurr/prnfb/http/Invoker.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package se.bjurr.prnfb.http;

public interface Invoker {
HttpResponse invoke(UrlInvoker urlInvoker);
HttpResponse invoke(UrlInvoker urlInvoker);
}
Loading

0 comments on commit 649638d

Please sign in to comment.