Skip to content

Commit

Permalink
Change messagingServiceId to serviceId
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmeldrum committed Nov 23, 2023
1 parent 8566602 commit 8e90b88
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ public class CommandMessage extends MOPMessage {

private String correlationId;
private String context;
private String messagingServiceId;
private String serviceId;
private List<CommandBundle> commandBundles;

public CommandMessage() {
super();
}

public CommandMessage(String messagingServiceId,
public CommandMessage(String serviceId,
String correlationId,
String context,
List<CommandBundle> commandBundles) {
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public CommandManager(TerraformManager terraformManager, MessagingServiceDelegat
}

public void execute(CommandRequest request) {
Map<String, String> envVars = setBrokerSpecificEnvVars(request.getMessagingServiceId());
Map<String, String> envVars = setBrokerSpecificEnvVars(request.getServiceId());
for (CommandBundle bundle : request.getCommandBundles()) {
// For now everything is run serially
for (Command command : bundle.getCommands()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
public class CommandRequest {
private String correlationId;
private String context;
private String messagingServiceId;
private String serviceId;
private List<CommandBundle> commandBundles;
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void saveLogToFile(CommandRequest request, List<String> logs) throws IOEx
+ File.separator
+ request.getContext()
+ "-"
+ request.getMessagingServiceId()
+ request.getServiceId()
+ File.separator
+ "logs"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ public TerraformManager(TerraformLogProcessingService terraformLogProcessingServ
public void execute(CommandRequest request, Command command, Map<String, String> 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()) {
Expand Down Expand Up @@ -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
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down Expand Up @@ -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()) {

Expand Down Expand Up @@ -237,7 +237,7 @@ private static CommandRequest generateCommandRequest(Command commandRequest) {
.build()))
.correlationId("234")
.context("app123")
.messagingServiceId("ms1234")
.serviceId("ms1234")
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ private List<CommandBundle> executeTerraformCommand(String hclFileName, String t
.commands(List.of(commandRequest))
.build()))
.context(context)
.messagingServiceId("abc123")
.serviceId("abc123")
.correlationId("myCorrelationId")
.build();

Expand Down

0 comments on commit 8e90b88

Please sign in to comment.