Skip to content
This repository has been archived by the owner on May 26, 2020. It is now read-only.

Commit

Permalink
Merge c88864d into 30b01b2
Browse files Browse the repository at this point in the history
  • Loading branch information
allanmckenzie committed Nov 20, 2019
2 parents 30b01b2 + c88864d commit c9e39dc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on [Keep a CHANGELOG](http://keepachangelog.com/). This project adheres to

## [Unreleased]

## [2.4.1] - 2019-11-20
### Fixed
- Successful runs of a command now logs the success message from the server

## [2.4.0] - 2019-11-13
### Changed
- Update to framework 6.4.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public boolean commandComplete(final SystemCommanderMBean systemCommanderMBean,
final ZonedDateTime endTime = clock.now();
final long durationMillis = between(startTime, endTime).toMillis();

toConsolePrinter.println(commandStatus.getMessage());

final String duration = formatDuration(durationMillis, "HH:mm:ss");
toConsolePrinter.println(format("Command %s complete", commandStatus.getSystemCommandName()));
toConsolePrinter.println(format("%s duration %s (hours:minutes:seconds)", commandStatus.getSystemCommandName(), duration));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class CommandCheckerTest {
public void shouldLogAndReturnTrueIfTheCommandIsComplete() throws Exception {

final UUID commandId = randomUUID();
final String message = "Woo hoo it worked";

final ZonedDateTime startTime = new UtcClock().now();
final ZonedDateTime endedAt = startTime.plusMinutes(83);
Expand All @@ -53,15 +54,17 @@ public void shouldLogAndReturnTrueIfTheCommandIsComplete() throws Exception {
when(systemCommanderMBean.getCommandStatus(commandId)).thenReturn(systemCommandStatus);
when(systemCommandStatus.getCommandState()).thenReturn(COMMAND_COMPLETE);
when(systemCommandStatus.getSystemCommandName()).thenReturn("CATCHUP");
when(systemCommandStatus.getMessage()).thenReturn(message);

assertThat(commandChecker.commandComplete(systemCommanderMBean, commandId, startTime), is(true));

verify(toConsolePrinter).println(message);
verify(toConsolePrinter).println("Command CATCHUP complete");
verify(toConsolePrinter).println("CATCHUP duration 01:23:00 (hours:minutes:seconds)");
}

@Test
public void shouldLogAndThrowExceptionfTheCommandFails() throws Exception {
public void shouldLogAndThrowExceptionIfTheCommandFails() throws Exception {

final UUID commandId = randomUUID();

Expand Down

0 comments on commit c9e39dc

Please sign in to comment.