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

Commit 2f7ed87

Browse files
committed
Storing projectKey and repoSlug #238
1 parent e55509d commit 2f7ed87

File tree

4 files changed

+93
-4
lines changed

4 files changed

+93
-4
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,23 @@
33
Changelog of Pull Request Notifier for Bitbucket.
44

55
## Unreleased
6+
### No issue
7+
doc
8+
9+
[a9fbe75c3fcca7d](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/a9fbe75c3fcca7d) Tomas Bjerre *2017-07-30 19:28:12*
10+
11+
## 3.7
12+
### GitHub [#238](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/238) Project and Repo not shown correctly in dropboxes in global admin GUI
13+
Storing projectKey and repoSlug
14+
15+
[74ac44bb6ae5648](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/74ac44bb6ae5648) Tomas Bjerre *2017-07-30 19:24:31*
16+
17+
### No issue
18+
doc
19+
20+
[34ef39f654c3a36](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/34ef39f654c3a36) Tomas Bjerre *2017-07-30 17:21:43*
21+
22+
## 3.6
623
### GitHub [#236](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/236) username and password missing from saved configuration and HTTP requests
724
Bugfix setting credentials correctly
825

src/main/java/se/bjurr/prnfb/settings/PrnfbNotification.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public boolean equals(Object obj) {
106106
if (getClass() != obj.getClass()) {
107107
return false;
108108
}
109-
PrnfbNotification other = (PrnfbNotification) obj;
109+
final PrnfbNotification other = (PrnfbNotification) obj;
110110
if (filterRegexp == null) {
111111
if (other.filterRegexp != null) {
112112
return false;

src/main/java/se/bjurr/prnfb/settings/PrnfbNotificationBuilder.java

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,68 @@
99
import java.util.List;
1010
import java.util.UUID;
1111

12-
import com.atlassian.bitbucket.pull.PullRequestState;
13-
1412
import se.bjurr.prnfb.http.UrlInvoker.HTTP_METHOD;
1513
import se.bjurr.prnfb.listener.PrnfbPullRequestAction;
1614
import se.bjurr.prnfb.service.PrnfbRenderer.ENCODE_FOR;
1715

16+
import com.atlassian.bitbucket.pull.PullRequestState;
17+
1818
public class PrnfbNotificationBuilder {
1919
public static PrnfbNotificationBuilder prnfbNotificationBuilder() {
2020
return new PrnfbNotificationBuilder();
2121
}
2222

23+
public PrnfbNotificationBuilder(
24+
String filterRegexp,
25+
String filterString,
26+
List<PrnfbHeader> headers,
27+
String injectionUrl,
28+
String injectionUrlRegexp,
29+
HTTP_METHOD method,
30+
String name,
31+
String password,
32+
String postContent,
33+
String projectKey,
34+
String proxyPassword,
35+
Integer proxyPort,
36+
String proxyServer,
37+
String proxyUser,
38+
String repositorySlug,
39+
TRIGGER_IF_MERGE triggerIfCanMerge,
40+
List<PullRequestState> triggerIgnoreStateList,
41+
List<PrnfbPullRequestAction> triggers,
42+
String url,
43+
String user,
44+
UUID uuid,
45+
ENCODE_FOR postContentEncoding,
46+
String proxySchema) {
47+
this.filterRegexp = filterRegexp;
48+
this.filterString = filterString;
49+
this.headers = headers;
50+
this.injectionUrl = injectionUrl;
51+
this.injectionUrlRegexp = injectionUrlRegexp;
52+
this.method = method;
53+
this.name = name;
54+
this.password = password;
55+
this.postContent = postContent;
56+
this.projectKey = projectKey;
57+
this.proxyPassword = proxyPassword;
58+
this.proxyPort = proxyPort;
59+
this.proxyServer = proxyServer;
60+
this.proxyUser = proxyUser;
61+
this.repositorySlug = repositorySlug;
62+
this.triggerIfCanMerge = triggerIfCanMerge;
63+
this.triggerIgnoreStateList = triggerIgnoreStateList;
64+
this.triggers = triggers;
65+
this.url = url;
66+
this.user = user;
67+
this.uuid = uuid;
68+
this.postContentEncoding = postContentEncoding;
69+
this.proxySchema = proxySchema;
70+
}
71+
2372
public static PrnfbNotificationBuilder prnfbNotificationBuilder(PrnfbNotification from) {
24-
PrnfbNotificationBuilder b = new PrnfbNotificationBuilder();
73+
final PrnfbNotificationBuilder b = new PrnfbNotificationBuilder();
2574

2675
b.uuid = from.getUuid();
2776
b.password = from.getPassword().orNull();
@@ -39,6 +88,8 @@ public static PrnfbNotificationBuilder prnfbNotificationBuilder(PrnfbNotificatio
3988
b.proxyServer = from.getProxyServer().orNull();
4089
b.proxySchema = from.getProxySchema().orNull();
4190
b.proxyPort = from.getProxyPort();
91+
b.projectKey = from.getProjectKey().orNull();
92+
b.repositorySlug = from.getRepositorySlug().orNull();
4293
b.name = from.getName();
4394
b.injectionUrl = from.getInjectionUrl().orNull();
4495
b.injectionUrlRegexp = from.getInjectionUrlRegexp().orNull();
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package se.bjurr.prnfb.settings;
2+
3+
import static org.assertj.core.api.Assertions.assertThat;
4+
import static se.bjurr.prnfb.settings.PrnfbNotificationBuilder.prnfbNotificationBuilder;
5+
import static se.bjurr.prnfb.test.Podam.populatedInstanceOf;
6+
7+
import org.junit.Test;
8+
9+
public class PrnfbNotificationBuilderTest {
10+
11+
@Test
12+
public void testBuild() throws ValidationException {
13+
final PrnfbNotificationBuilder originalBuilder =
14+
populatedInstanceOf(PrnfbNotificationBuilder.class);
15+
originalBuilder.withUrl("http://bjurr.com/");
16+
final PrnfbNotification original = originalBuilder.build();
17+
final PrnfbNotificationBuilder builder = prnfbNotificationBuilder(original);
18+
final PrnfbNotification built = builder.build();
19+
assertThat(built).isEqualTo(original);
20+
}
21+
}

0 commit comments

Comments
 (0)