Skip to content

Commit 2eb460e

Browse files
authored
Fix single notification meta issue (#268)
- Fix single notification issue so that multiple notification metas are now accepted on the backend. - Updated tests to test this. - Updated lombok version. The current version didnt seem to work with openJDK.
1 parent dbe82f0 commit 2eb460e

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@
269269
<dependency>
270270
<groupId>org.projectlombok</groupId>
271271
<artifactId>lombok</artifactId>
272-
<version>1.16.20</version>
272+
<version>1.18.6</version>
273273
<scope>provided</scope>
274274
</dependency>
275275

src/integrationtests/java/com/ericsson/ei/integrationtests/FlowStepsIT.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,8 @@ public void the_jenkins_job_should_be_deleted() throws Throwable {
235235
jenkinsManager.deleteJob(this.jenkinsJobName);
236236
}
237237

238-
@Then("^mongodb should contain mail\\.$")
239-
public void mongodb_should_contain_mails() throws Throwable {
238+
@Then("^mongodb should contain \"([^\"]*)\" mails\\.$")
239+
public void mongodb_should_contain_mails(int amountOfMails) throws Exception {
240240
long stopTime = System.currentTimeMillis() + 30000;
241241
Boolean mailHasBeenDelivered = false;
242242
long createdDateInMillis = 0;
@@ -245,6 +245,9 @@ public void mongodb_should_contain_mails() throws Throwable {
245245
JsonNode newestMailJson = getNewestMailFromDatabase();
246246

247247
if (newestMailJson != null) {
248+
JsonNode to = newestMailJson.get("to");
249+
assertEquals("Sent mails " + to.size() + ". Expected " + amountOfMails, amountOfMails, to.size());
250+
248251
String createdDate = newestMailJson.get("created")
249252
.get("$date")
250253
.asText();

src/integrationtests/resources/features/ArtifactFlowIT.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ Feature: Artifact flow Integrationtest
3030
Then the expected aggregated object ID is "aacc3c87-75e0-4b6d-88f5-b1a5d4e62b43"
3131
# Setup subscription
3232
Given subscription object for "MAIL" with name "MailTestSubscription" is created
33-
When notification meta "some.cool.email@ericsson.com" is set in subscription
33+
When notification meta "some.cool.email@ericsson.com,some.other.cool.email@ericsson.com" is set in subscription
3434
And paremeter form key "" and form value "to_string(@)" is added in subscription
3535
And condition "id=='aacc3c87-75e0-4b6d-88f5-b1a5d4e62b43'" at requirement index '0' is added in subscription
3636
Then subscription is uploaded
3737
# Send Events and Check job triggered
3838
Given all previous steps passed
3939
When the upstream input events are sent
4040
And the eiffel events are sent
41-
Then mongodb should contain mail.
41+
Then mongodb should contain "2" mails.

src/main/java/com/ericsson/ei/subscriptionhandler/SubscriptionValidator.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,6 @@ private static void validateNotificationMeta(String notificationMeta, String not
139139
for (String address : addresses) {
140140
validateEmail(address.trim());
141141
}
142-
143-
String regexEmailCheck = "^[\\w-\\+]+(\\.[\\w]+)*@[\\w-]+(\\.[\\w]+)*(\\.[a-zA-Z]{2,})$";
144-
boolean isInvalidEmailAddress = !Pattern.matches(regexEmailCheck, notificationMeta);
145-
if (isInvalidEmailAddress) {
146-
throw new SubscriptionValidationException(
147-
"Notification type is set to [MAIL] but the given notificatioMeta is not a valid e-mail ["
148-
+ notificationMeta + "]");
149-
}
150142
}
151143
}
152144

0 commit comments

Comments
 (0)