From cdee8368f294a5b04cd199992e6e98712a990d18 Mon Sep 17 00:00:00 2001
From: Stephanie Buadu <47737608+acn-sbuad@users.noreply.github.com>
Date: Tue, 5 Sep 2023 11:49:24 +0200
Subject: [PATCH 1/5] Consistent topic naming (#230)
---
src/Altinn.Notifications/appsettings.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Altinn.Notifications/appsettings.json b/src/Altinn.Notifications/appsettings.json
index 9dd6f0bf..103db7f8 100644
--- a/src/Altinn.Notifications/appsettings.json
+++ b/src/Altinn.Notifications/appsettings.json
@@ -22,14 +22,14 @@
},
"PastDueOrdersTopicName": "altinn.notifications.orders.pastdue",
"PastDueOrdersRetryTopicName": "altinn.notifications.orders.pastdue.retry",
- "EmailQueueTopicName": "altinn.notification.email.queue",
+ "EmailQueueTopicName": "altinn.notifications.email.queue",
"HealthCheckTopic": "altinn.notifications.health.check",
"Admin": {
"TopicList": [
"altinn.notifications.health.check",
"altinn.notifications.orders.pastdue",
"altinn.notifications.orders.pastdue.retry",
- "altinn.notification.email.queue"
+ "altinn.notifications.email.queue"
]
}
},
From 76b28dd94fe23e8606b1ac4bd9ebc5521e48a068 Mon Sep 17 00:00:00 2001
From: Stephanie Buadu <47737608+acn-sbuad@users.noreply.github.com>
Date: Tue, 5 Sep 2023 12:39:03 +0200
Subject: [PATCH 2/5] id -> notificationId on email object (#231)
---
src/Altinn.Notifications.Core/Models/Email.cs | 6 +++---
.../Services/EmailNotificationService.cs | 2 +-
.../Notifications.Core/TestingModels/EmailTests.cs | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/Altinn.Notifications.Core/Models/Email.cs b/src/Altinn.Notifications.Core/Models/Email.cs
index 0c0d1813..83e04f1b 100644
--- a/src/Altinn.Notifications.Core/Models/Email.cs
+++ b/src/Altinn.Notifications.Core/Models/Email.cs
@@ -13,7 +13,7 @@ public class Email
///
/// Gets or sets the id of the email.
///
- public Guid Id { get; set; }
+ public Guid NotificationId { get; set; }
///
/// Gets or sets the subject of the email.
@@ -43,9 +43,9 @@ public class Email
///
/// Initializes a new instance of the class.
///
- public Email(Guid id, string subject, string body, string fromAddress, string toAddress, EmailContentType contentType)
+ public Email(Guid notificationId, string subject, string body, string fromAddress, string toAddress, EmailContentType contentType)
{
- Id = id;
+ NotificationId = notificationId;
Subject = subject;
Body = body;
FromAddress = fromAddress;
diff --git a/src/Altinn.Notifications.Core/Services/EmailNotificationService.cs b/src/Altinn.Notifications.Core/Services/EmailNotificationService.cs
index 426506f4..2e4374cf 100644
--- a/src/Altinn.Notifications.Core/Services/EmailNotificationService.cs
+++ b/src/Altinn.Notifications.Core/Services/EmailNotificationService.cs
@@ -66,7 +66,7 @@ public async Task SendNotifications()
bool success = await _producer.ProduceAsync(_emailQueueTopicName, email.Serialize());
if (!success)
{
- await _repository.SetResultStatus(email.Id, EmailNotificationResultType.New);
+ await _repository.SetResultStatus(email.NotificationId, EmailNotificationResultType.New);
}
}
}
diff --git a/test/Altinn.Notifications.Tests/Notifications.Core/TestingModels/EmailTests.cs b/test/Altinn.Notifications.Tests/Notifications.Core/TestingModels/EmailTests.cs
index 5afc4b7a..bf15041d 100644
--- a/test/Altinn.Notifications.Tests/Notifications.Core/TestingModels/EmailTests.cs
+++ b/test/Altinn.Notifications.Tests/Notifications.Core/TestingModels/EmailTests.cs
@@ -18,7 +18,7 @@ public EmailTests()
_email = new Email(id, "subject", "body", "from@domain.com", "to@domain.com", EmailContentType.Html);
_serializedEmail = new JsonObject()
{
- { "id", id },
+ { "notificationId", id },
{ "subject", "subject" },
{"body", "body" },
{"fromAddress", "from@domain.com" },
From 5ca67a2410fec80bec3d67e4f0981b5e9ed28a8e Mon Sep 17 00:00:00 2001
From: Stephanie Buadu <47737608+acn-sbuad@users.noreply.github.com>
Date: Tue, 5 Sep 2023 13:01:41 +0200
Subject: [PATCH 3/5] set from address ink6 test to altinn.cloud
---
test/k6/src/data/orders/01-email-request.json | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/k6/src/data/orders/01-email-request.json b/test/k6/src/data/orders/01-email-request.json
index a2910fc4..fc85b687 100644
--- a/test/k6/src/data/orders/01-email-request.json
+++ b/test/k6/src/data/orders/01-email-request.json
@@ -2,5 +2,5 @@
"subject": "Automated email from Altinn",
"body": "This is an automated email generated during testing of Altinn Notifications",
"content-type": "Html",
- "fromAddress": "noreply@altinn.no"
-}
\ No newline at end of file
+ "fromAddress": "noreply@altinn.cloud"
+}
From d7e4becc881f960a0a0cd55ff83c20829a1accfc Mon Sep 17 00:00:00 2001
From: Stephanie Buadu <47737608+acn-sbuad@users.noreply.github.com>
Date: Tue, 5 Sep 2023 13:11:32 +0200
Subject: [PATCH 4/5] set from address ink6 test to DoNotReply
---
test/k6/src/data/orders/01-email-request.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/k6/src/data/orders/01-email-request.json b/test/k6/src/data/orders/01-email-request.json
index fc85b687..4de4f085 100644
--- a/test/k6/src/data/orders/01-email-request.json
+++ b/test/k6/src/data/orders/01-email-request.json
@@ -2,5 +2,5 @@
"subject": "Automated email from Altinn",
"body": "This is an automated email generated during testing of Altinn Notifications",
"content-type": "Html",
- "fromAddress": "noreply@altinn.cloud"
+ "fromAddress": "DoNotReply@altinn.cloud"
}
From f89497aa2077e05084f9055f92df02fdc9a18bc2 Mon Sep 17 00:00:00 2001
From: Stephanie Buadu <47737608+acn-sbuad@users.noreply.github.com>
Date: Tue, 5 Sep 2023 13:48:05 +0200
Subject: [PATCH 5/5] minor code fixes (#232)
---
.../Validators/EmailNotificationOrderRequestValidator.cs | 4 ++--
.../EmailNotificationOrderRequestValidatorTests.cs | 2 +-
test/k6/docker-compose.yml | 2 +-
test/k6/src/data/orders/01-email-request.json | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/Altinn.Notifications/Validators/EmailNotificationOrderRequestValidator.cs b/src/Altinn.Notifications/Validators/EmailNotificationOrderRequestValidator.cs
index 9ffb8301..d3560ef7 100644
--- a/src/Altinn.Notifications/Validators/EmailNotificationOrderRequestValidator.cs
+++ b/src/Altinn.Notifications/Validators/EmailNotificationOrderRequestValidator.cs
@@ -5,7 +5,7 @@
namespace Altinn.Notifications.Validators;
///
-/// Claass contining validation logic for the model
+/// Class containing validation logic for the model
///
public class EmailNotificationOrderRequestValidator : AbstractValidator
{
@@ -22,7 +22,7 @@ public EmailNotificationOrderRequestValidator()
RuleFor(order => order.RequestedSendTime)
.Must(sendTime => sendTime >= DateTime.UtcNow.AddMinutes(-5))
- .WithMessage("Send time must be in the future. Leave blank to send immediatly.");
+ .WithMessage("Send time must be in the future. Leave blank to send immediately.");
RuleFor(order => order.Body).NotEmpty();
RuleFor(order => order.Subject).NotEmpty();
diff --git a/test/Altinn.Notifications.Tests/Notifications/TestingValidators/EmailNotificationOrderRequestValidatorTests.cs b/test/Altinn.Notifications.Tests/Notifications/TestingValidators/EmailNotificationOrderRequestValidatorTests.cs
index 3d54cb36..a27fc247 100644
--- a/test/Altinn.Notifications.Tests/Notifications/TestingValidators/EmailNotificationOrderRequestValidatorTests.cs
+++ b/test/Altinn.Notifications.Tests/Notifications/TestingValidators/EmailNotificationOrderRequestValidatorTests.cs
@@ -68,7 +68,7 @@ public void Validate_SendTimePassed_ReturnsFalse()
var actual = _validator.Validate(order);
Assert.False(actual.IsValid);
- Assert.Contains(actual.Errors, a => a.ErrorMessage.Equals("Send time must be in the future. Leave blank to send immediatly."));
+ Assert.Contains(actual.Errors, a => a.ErrorMessage.Equals("Send time must be in the future. Leave blank to send immediately."));
}
[Fact]
diff --git a/test/k6/docker-compose.yml b/test/k6/docker-compose.yml
index 366f3ce1..5006baf2 100644
--- a/test/k6/docker-compose.yml
+++ b/test/k6/docker-compose.yml
@@ -5,7 +5,7 @@ networks:
services:
k6:
- image: loadimpact/k6:0.46.0
+ image: grafana/k6:0.46.0
networks:
- k6
ports:
diff --git a/test/k6/src/data/orders/01-email-request.json b/test/k6/src/data/orders/01-email-request.json
index 4de4f085..fc85b687 100644
--- a/test/k6/src/data/orders/01-email-request.json
+++ b/test/k6/src/data/orders/01-email-request.json
@@ -2,5 +2,5 @@
"subject": "Automated email from Altinn",
"body": "This is an automated email generated during testing of Altinn Notifications",
"content-type": "Html",
- "fromAddress": "DoNotReply@altinn.cloud"
+ "fromAddress": "noreply@altinn.cloud"
}