From 8e90b887fcb250fcfa6f659baee827884705b2df Mon Sep 17 00:00:00 2001 From: Greg Meldrum Date: Thu, 23 Nov 2023 16:51:52 -0500 Subject: [PATCH] Change messagingServiceId to serviceId --- .../com/solace/maas/ep/common/messages/CommandMessage.java | 6 +++--- .../ep/event/management/agent/command/CommandManager.java | 2 +- .../agent/plugin/command/model/CommandRequest.java | 2 +- .../terraform/manager/TerraformLogProcessingService.java | 2 +- .../agent/plugin/terraform/manager/TerraformManager.java | 6 +++--- .../agent/plugin/terraform/TerraformCommandIT.java | 6 +++--- .../plugin/terraform/real/TerraformClientRealTests.java | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/service/application/src/main/java/com/solace/maas/ep/common/messages/CommandMessage.java b/service/application/src/main/java/com/solace/maas/ep/common/messages/CommandMessage.java index 2c4870cc1..4ca3a5b0d 100644 --- a/service/application/src/main/java/com/solace/maas/ep/common/messages/CommandMessage.java +++ b/service/application/src/main/java/com/solace/maas/ep/common/messages/CommandMessage.java @@ -14,14 +14,14 @@ public class CommandMessage extends MOPMessage { private String correlationId; private String context; - private String messagingServiceId; + private String serviceId; private List commandBundles; public CommandMessage() { super(); } - public CommandMessage(String messagingServiceId, + public CommandMessage(String serviceId, String correlationId, String context, List commandBundles) { @@ -30,7 +30,7 @@ public CommandMessage(String messagingServiceId, .withProtocol(MOPProtocol.commandProtocol) .withVersion("1") .withUhFlag(MOPUHFlag.ignore); - this.messagingServiceId = messagingServiceId; + this.serviceId = serviceId; this.correlationId = correlationId; this.context = context; this.commandBundles = commandBundles; diff --git a/service/application/src/main/java/com/solace/maas/ep/event/management/agent/command/CommandManager.java b/service/application/src/main/java/com/solace/maas/ep/event/management/agent/command/CommandManager.java index 9acc67015..de5c2a856 100644 --- a/service/application/src/main/java/com/solace/maas/ep/event/management/agent/command/CommandManager.java +++ b/service/application/src/main/java/com/solace/maas/ep/event/management/agent/command/CommandManager.java @@ -26,7 +26,7 @@ public CommandManager(TerraformManager terraformManager, MessagingServiceDelegat } public void execute(CommandRequest request) { - Map envVars = setBrokerSpecificEnvVars(request.getMessagingServiceId()); + Map envVars = setBrokerSpecificEnvVars(request.getServiceId()); for (CommandBundle bundle : request.getCommandBundles()) { // For now everything is run serially for (Command command : bundle.getCommands()) { diff --git a/service/plugin/src/main/java/com/solace/maas/ep/event/management/agent/plugin/command/model/CommandRequest.java b/service/plugin/src/main/java/com/solace/maas/ep/event/management/agent/plugin/command/model/CommandRequest.java index 748c8af3e..f4c62c646 100644 --- a/service/plugin/src/main/java/com/solace/maas/ep/event/management/agent/plugin/command/model/CommandRequest.java +++ b/service/plugin/src/main/java/com/solace/maas/ep/event/management/agent/plugin/command/model/CommandRequest.java @@ -14,6 +14,6 @@ public class CommandRequest { private String correlationId; private String context; - private String messagingServiceId; + private String serviceId; private List commandBundles; } diff --git a/service/terraform-plugin/src/main/java/com/solace/maas/ep/event/management/agent/plugin/terraform/manager/TerraformLogProcessingService.java b/service/terraform-plugin/src/main/java/com/solace/maas/ep/event/management/agent/plugin/terraform/manager/TerraformLogProcessingService.java index 80c026ae2..d1cc7aad1 100644 --- a/service/terraform-plugin/src/main/java/com/solace/maas/ep/event/management/agent/plugin/terraform/manager/TerraformLogProcessingService.java +++ b/service/terraform-plugin/src/main/java/com/solace/maas/ep/event/management/agent/plugin/terraform/manager/TerraformLogProcessingService.java @@ -43,7 +43,7 @@ public void saveLogToFile(CommandRequest request, List logs) throws IOEx + File.separator + request.getContext() + "-" - + request.getMessagingServiceId() + + request.getServiceId() + File.separator + "logs" ); diff --git a/service/terraform-plugin/src/main/java/com/solace/maas/ep/event/management/agent/plugin/terraform/manager/TerraformManager.java b/service/terraform-plugin/src/main/java/com/solace/maas/ep/event/management/agent/plugin/terraform/manager/TerraformManager.java index 536178706..049bd2cab 100644 --- a/service/terraform-plugin/src/main/java/com/solace/maas/ep/event/management/agent/plugin/terraform/manager/TerraformManager.java +++ b/service/terraform-plugin/src/main/java/com/solace/maas/ep/event/management/agent/plugin/terraform/manager/TerraformManager.java @@ -44,11 +44,11 @@ public TerraformManager(TerraformLogProcessingService terraformLogProcessingServ public void execute(CommandRequest request, Command command, Map envVars) { MDC.put(COMMAND_CORRELATION_ID, request.getCorrelationId()); - MDC.put(MESSAGING_SERVICE_ID, request.getMessagingServiceId()); + MDC.put(MESSAGING_SERVICE_ID, request.getServiceId()); String traceId = MDC.get("traceId"); String spanId = MDC.get("spanId"); - log.debug("Executing command {} for ms {} correlationId {} context {}", command.getCommand(), request.getMessagingServiceId(), + log.debug("Executing command {} for ms {} correlationId {} context {}", command.getCommand(), request.getServiceId(), request.getCorrelationId(), request.getContext()); try (TerraformClient terraformClient = terraformClientFactory.createClient()) { @@ -107,7 +107,7 @@ private Path createConfigPath(CommandRequest request) { Path configPath = Paths.get(terraformProperties.getWorkingDirectoryRoot() + File.separator + request.getContext() + "-" - + request.getMessagingServiceId() + + request.getServiceId() + File.separator ); diff --git a/service/terraform-plugin/src/test/java/com/solace/maas/ep/event/management/agent/plugin/terraform/TerraformCommandIT.java b/service/terraform-plugin/src/test/java/com/solace/maas/ep/event/management/agent/plugin/terraform/TerraformCommandIT.java index f3be09412..aa39ae430 100644 --- a/service/terraform-plugin/src/test/java/com/solace/maas/ep/event/management/agent/plugin/terraform/TerraformCommandIT.java +++ b/service/terraform-plugin/src/test/java/com/solace/maas/ep/event/management/agent/plugin/terraform/TerraformCommandIT.java @@ -98,7 +98,7 @@ public void testCreateResourceHappyPath() throws IOException { terraformManager.execute(terraformRequest, command, Map.of()); - // Validate that the plan api is called + // Validate that the plan and apply apis are called verify(terraformClient, times(1)).plan(any()); verify(terraformClient, times(1)).apply(any()); @@ -135,7 +135,7 @@ public void testCreateResourceFailurePath() throws IOException { verify(terraformClient, times(1)).plan(any()); verify(terraformClient, times(1)).apply(any()); - // Check the responses + // Validate that the plan and apply apis are called for (CommandBundle commandBundle : terraformRequest.getCommandBundles()) { for (Command tfCommand : commandBundle.getCommands()) { @@ -237,7 +237,7 @@ private static CommandRequest generateCommandRequest(Command commandRequest) { .build())) .correlationId("234") .context("app123") - .messagingServiceId("ms1234") + .serviceId("ms1234") .build(); } diff --git a/service/terraform-plugin/src/test/java/com/solace/maas/ep/event/management/agent/plugin/terraform/real/TerraformClientRealTests.java b/service/terraform-plugin/src/test/java/com/solace/maas/ep/event/management/agent/plugin/terraform/real/TerraformClientRealTests.java index 25d57189d..92f64e5b8 100644 --- a/service/terraform-plugin/src/test/java/com/solace/maas/ep/event/management/agent/plugin/terraform/real/TerraformClientRealTests.java +++ b/service/terraform-plugin/src/test/java/com/solace/maas/ep/event/management/agent/plugin/terraform/real/TerraformClientRealTests.java @@ -153,7 +153,7 @@ private List executeTerraformCommand(String hclFileName, String t .commands(List.of(commandRequest)) .build())) .context(context) - .messagingServiceId("abc123") + .serviceId("abc123") .correlationId("myCorrelationId") .build();