aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorValerij Fredriksen <valerijf@verizonmedia.com>2021-04-22 15:10:46 +0200
committerValerij Fredriksen <valerijf@verizonmedia.com>2021-04-22 15:10:46 +0200
commit3f231170ffb5cc3705651a4e3eb6317e0c8d1952 (patch)
tree1fdc514a09b91a8c496f88e43b141528e158058c
parent85ac36c4f093bed851408f2bbbc5c65a6d70bc3d (diff)
Rename to setNotification()
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java4
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java2
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java6
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDbTest.java4
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java4
5 files changed, 10 insertions, 10 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java
index 0d6ec682a19..85401f1e033 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java
@@ -22,7 +22,6 @@ import com.yahoo.vespa.flags.FetchVector;
import com.yahoo.vespa.flags.FlagSource;
import com.yahoo.vespa.flags.PermanentFlags;
import com.yahoo.vespa.flags.StringFlag;
-import com.yahoo.vespa.hosted.controller.application.ActivateResult;
import com.yahoo.vespa.hosted.controller.api.application.v4.model.DeploymentData;
import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId;
import com.yahoo.vespa.hosted.controller.api.identifiers.InstanceId;
@@ -43,6 +42,7 @@ import com.yahoo.vespa.hosted.controller.api.integration.deployment.JobId;
import com.yahoo.vespa.hosted.controller.api.integration.deployment.TesterId;
import com.yahoo.vespa.hosted.controller.api.integration.noderepository.RestartFilter;
import com.yahoo.vespa.hosted.controller.api.integration.secrets.TenantSecretStore;
+import com.yahoo.vespa.hosted.controller.application.ActivateResult;
import com.yahoo.vespa.hosted.controller.application.ApplicationPackage;
import com.yahoo.vespa.hosted.controller.application.ApplicationPackageValidator;
import com.yahoo.vespa.hosted.controller.application.Deployment;
@@ -402,7 +402,7 @@ public class ApplicationController {
.map(logs -> logs.stream().filter(log -> LogLevel.parse(log.level).intValue() >= Level.WARNING.intValue()).map(log -> log.message).collect(Collectors.toList()))
.orElseGet(List::of);
if (warnings.isEmpty()) controller.notificationsDb().removeNotification(source, Notification.Type.APPLICATION_PACKAGE_WARNING);
- else controller.notificationsDb().addNotification(source, Notification.Type.APPLICATION_PACKAGE_WARNING, warnings);
+ else controller.notificationsDb().setNotification(source, Notification.Type.APPLICATION_PACKAGE_WARNING, warnings);
lockApplicationOrThrow(applicationId, application ->
store(application.with(job.application().instance(),
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java
index 12b3316d335..a907cbe2406 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/InternalStepRunner.java
@@ -712,7 +712,7 @@ public class InternalStepRunner implements StepRunner {
private void updateConsoleNotification(Run run) {
NotificationSource source = NotificationSource.from(run.id());
- Consumer<String> updater = msg -> controller.notificationsDb().addNotification(source, Notification.Type.DEPLOYMENT_FAILURE, msg);
+ Consumer<String> updater = msg -> controller.notificationsDb().setNotification(source, Notification.Type.DEPLOYMENT_FAILURE, msg);
switch (run.status()) {
case running:
case aborted:
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java
index 1f85be2ea43..d470415f521 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDb.java
@@ -35,15 +35,15 @@ public class NotificationsDb {
.collect(Collectors.toUnmodifiableList());
}
- public void addNotification(NotificationSource source, Notification.Type type, String message) {
- addNotification(source, type, List.of(message));
+ public void setNotification(NotificationSource source, Notification.Type type, String message) {
+ setNotification(source, type, List.of(message));
}
/**
* Add a notification with given source and type. If a notification with same source and type
* already exists, it'll be replaced by this one instead
*/
- public void addNotification(NotificationSource source, Notification.Type type, List<String> messages) {
+ public void setNotification(NotificationSource source, Notification.Type type, List<String> messages) {
try (Lock lock = curatorDb.lockNotifications(source.tenant())) {
List<Notification> notifications = curatorDb.readNotifications(source.tenant()).stream()
.filter(notification -> !source.equals(notification.source()) || type != notification.type())
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDbTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDbTest.java
index 3804fd43d52..d08e9b89d08 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDbTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/notification/NotificationsDbTest.java
@@ -59,10 +59,10 @@ public class NotificationsDbTest {
Notification notification2 = notification(12345, Notification.Type.DEPLOYMENT_FAILURE, NotificationSource.from(ApplicationId.from(tenant.value(), "app3", "instance2")), "instance msg #3");
// Replace the 3rd notification
- notificationsDb.addNotification(notification1.source(), notification1.type(), notification1.messages());
+ notificationsDb.setNotification(notification1.source(), notification1.type(), notification1.messages());
// Notification for a new app, add without replacement
- notificationsDb.addNotification(notification2.source(), notification2.type(), notification2.messages());
+ notificationsDb.setNotification(notification2.source(), notification2.type(), notification2.messages());
List<Notification> expected = notificationIndices(0, 1, 3, 4, 5);
expected.addAll(List.of(notification1, notification2));
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
index 4419921cdfd..abea055dde8 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
@@ -1639,11 +1639,11 @@ public class ApplicationApiTest extends ControllerContainerTest {
}
private void addNotifications(TenantName tenantName) {
- tester.controller().notificationsDb().addNotification(
+ tester.controller().notificationsDb().setNotification(
NotificationSource.from(TenantAndApplicationId.from(tenantName.value(), "app1")),
Notification.Type.APPLICATION_PACKAGE_WARNING,
"Something something deprecated...");
- tester.controller().notificationsDb().addNotification(
+ tester.controller().notificationsDb().setNotification(
NotificationSource.from(new RunId(ApplicationId.from(tenantName.value(), "app2", "instance1"), JobType.systemTest, 12)),
Notification.Type.DEPLOYMENT_FAILURE,
"Failed to deploy: Out of capacity");