Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
b5e8e839
Unverified
Commit
b5e8e839
authored
Mar 22, 2021
by
Gautier de Saint Martin Lacaze
Committed by
GitHub
Mar 22, 2021
Browse files
Merge pull request #673 from gitlab4j/pr-662-add-tests
test: Add tests for EmailOnPushService
parents
d1556748
2b8bdcf0
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/services/EmailOnPushService.java
View file @
b5e8e839
...
@@ -32,7 +32,7 @@ public class EmailOnPushService extends NotificationService {
...
@@ -32,7 +32,7 @@ public class EmailOnPushService extends NotificationService {
@JsonIgnore
@JsonIgnore
public
String
getRecipients
()
{
public
String
getRecipients
()
{
return
(
(
String
)
getProperty
(
RECIPIENT_PROP
));
return
(
getProperty
(
RECIPIENT_PROP
));
}
}
public
void
setRecipients
(
String
recipients
)
{
public
void
setRecipients
(
String
recipients
)
{
setProperty
(
RECIPIENT_PROP
,
recipients
);
setProperty
(
RECIPIENT_PROP
,
recipients
);
...
@@ -45,7 +45,7 @@ public class EmailOnPushService extends NotificationService {
...
@@ -45,7 +45,7 @@ public class EmailOnPushService extends NotificationService {
@JsonIgnore
@JsonIgnore
public
Boolean
getDisableDiffs
()
{
public
Boolean
getDisableDiffs
()
{
return
Boolean
.
valueOf
(
getProperty
(
DISABLE_DIFFS_PROP
,
"
false
"
));
return
Boolean
.
valueOf
(
getProperty
(
DISABLE_DIFFS_PROP
,
false
));
}
}
public
void
setDisableDiffs
(
Boolean
disableDiffs
)
{
public
void
setDisableDiffs
(
Boolean
disableDiffs
)
{
setProperty
(
DISABLE_DIFFS_PROP
,
disableDiffs
);
setProperty
(
DISABLE_DIFFS_PROP
,
disableDiffs
);
...
@@ -54,10 +54,10 @@ public class EmailOnPushService extends NotificationService {
...
@@ -54,10 +54,10 @@ public class EmailOnPushService extends NotificationService {
setDisableDiffs
(
disableDiffs
);
setDisableDiffs
(
disableDiffs
);
return
this
;
return
this
;
}
}
@JsonIgnore
@JsonIgnore
public
Boolean
getSendFromCommitterEmail
()
{
public
Boolean
getSendFromCommitterEmail
()
{
return
Boolean
.
valueOf
(
getProperty
(
SEND_FROM_COMMITTER_EMAIL_PROP
,
"
false
"
));
return
Boolean
.
valueOf
(
getProperty
(
SEND_FROM_COMMITTER_EMAIL_PROP
,
false
));
}
}
public
void
setSendFromCommitterEmail
(
Boolean
sendFromCommitterEmail
)
{
public
void
setSendFromCommitterEmail
(
Boolean
sendFromCommitterEmail
)
{
setProperty
(
SEND_FROM_COMMITTER_EMAIL_PROP
,
sendFromCommitterEmail
);
setProperty
(
SEND_FROM_COMMITTER_EMAIL_PROP
,
sendFromCommitterEmail
);
...
@@ -68,16 +68,20 @@ public class EmailOnPushService extends NotificationService {
...
@@ -68,16 +68,20 @@ public class EmailOnPushService extends NotificationService {
}
}
@JsonIgnore
@JsonIgnore
public
String
getBranchesToBeNotified
()
{
public
BranchesToBeNotified
getBranchesToBeNotified
()
{
return
((
String
)
getProperty
(
BRANCHES_TO_BE_NOTIFIED_PROP
));
String
branchesToBeNotified
=
getProperty
(
BRANCHES_TO_BE_NOTIFIED_PROP
);
if
(
branchesToBeNotified
==
null
||
branchesToBeNotified
.
isEmpty
())
{
return
null
;
}
return
(
BranchesToBeNotified
.
valueOf
(
branchesToBeNotified
.
toUpperCase
()));
}
}
public
void
setBranchesToBeNotified
(
String
branchesToBeNotified
)
{
public
void
setBranchesToBeNotified
(
BranchesToBeNotified
branchesToBeNotified
)
{
setProperty
(
BRANCHES_TO_BE_NOTIFIED_PROP
,
branchesToBeNotified
);
setProperty
(
BRANCHES_TO_BE_NOTIFIED_PROP
,
branchesToBeNotified
.
toString
()
);
}
}
public
EmailOnPushService
withBranchesToBeNotified
(
String
branchesToBeNotified
)
{
public
EmailOnPushService
withBranchesToBeNotified
(
BranchesToBeNotified
branchesToBeNotified
)
{
setBranchesToBeNotified
(
branchesToBeNotified
);
setBranchesToBeNotified
(
branchesToBeNotified
);
return
this
;
return
this
;
}
}
}
}
src/main/java/org/gitlab4j/api/services/NotificationService.java
View file @
b5e8e839
...
@@ -34,10 +34,12 @@ public abstract class NotificationService {
...
@@ -34,10 +34,12 @@ public abstract class NotificationService {
private
Integer
id
;
private
Integer
id
;
private
String
title
;
private
String
title
;
private
String
slug
;
private
Date
createdAt
;
private
Date
createdAt
;
private
Date
updatedAt
;
private
Date
updatedAt
;
private
Boolean
active
;
private
Boolean
active
;
private
Boolean
commitEvents
;
private
Boolean
pushEvents
;
private
Boolean
pushEvents
;
private
Boolean
issuesEvents
;
private
Boolean
issuesEvents
;
private
Boolean
confidentialIssuesEvents
;
private
Boolean
confidentialIssuesEvents
;
...
@@ -61,6 +63,14 @@ public abstract class NotificationService {
...
@@ -61,6 +63,14 @@ public abstract class NotificationService {
this
.
id
=
id
;
this
.
id
=
id
;
}
}
public
String
getSlug
()
{
return
slug
;
}
public
void
setSlug
(
String
slug
)
{
this
.
slug
=
slug
;
}
public
String
getTitle
()
{
public
String
getTitle
()
{
return
title
;
return
title
;
}
}
...
@@ -97,6 +107,19 @@ public abstract class NotificationService {
...
@@ -97,6 +107,19 @@ public abstract class NotificationService {
// The following methods can be used to configure the notification service
// The following methods can be used to configure the notification service
// *******************************************************************************
// *******************************************************************************
public
Boolean
getCommitEvents
()
{
return
commitEvents
;
}
public
void
setCommitEvents
(
Boolean
commitEvents
)
{
this
.
commitEvents
=
commitEvents
;
}
protected
<
T
>
T
withCommitEvents
(
Boolean
commitEvents
,
T
derivedInstance
)
{
this
.
commitEvents
=
commitEvents
;
return
(
derivedInstance
);
}
public
Boolean
getPushEvents
()
{
public
Boolean
getPushEvents
()
{
return
pushEvents
;
return
pushEvents
;
}
}
...
@@ -237,7 +260,7 @@ public abstract class NotificationService {
...
@@ -237,7 +260,7 @@ public abstract class NotificationService {
@JsonIgnore
@JsonIgnore
protected
String
getProperty
(
String
prop
)
{
protected
String
getProperty
(
String
prop
)
{
return
(
(
String
)
getProperty
(
prop
,
""
));
return
(
getProperty
(
prop
,
""
));
}
}
@JsonIgnore
@JsonIgnore
...
@@ -270,4 +293,13 @@ public abstract class NotificationService {
...
@@ -270,4 +293,13 @@ public abstract class NotificationService {
public
String
toString
()
{
public
String
toString
()
{
return
(
JacksonJson
.
toJsonString
(
this
));
return
(
JacksonJson
.
toJsonString
(
this
));
}
}
public
enum
BranchesToBeNotified
{
ALL
,
DEFAULT
,
PROTECTED
,
DEFAULT_AND_PROTECTED
;
@Override
public
String
toString
()
{
return
(
name
().
toLowerCase
());
}
}
}
}
src/test/java/org/gitlab4j/api/TestServicesApi.java
View file @
b5e8e839
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment