Skip to content

Commit

Permalink
Enhance poller logging
Browse files Browse the repository at this point in the history
  • Loading branch information
santhosh committed Apr 15, 2024
1 parent fbe2cab commit 366654f
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public void shouldSuccessfullyProcessManyUpdatesToSameRecipeId() throws Exceptio
.put(eventFactory.renameRecipeEntity("Final Name"));

new Poller().pollUntilFound(() -> {
System.out.printf("Polling for query response body to contain 'Final Name' for recipeId: %s", recipeId);
if (querier.queryForRecipe(recipeId).body().contains("Final Name")) {
return of(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ private List<UUID> getEventIds() throws Exception {
private Optional<SystemCommandStatus> commandNoLongerInProgress(final SystemCommanderMBean systemCommanderMBean, final UUID commandId) {

final SystemCommandStatus systemCommandStatus = systemCommanderMBean.getCommandStatus(commandId);
System.out.printf("Polling for command state to be COMMAND_COMPLETE||COMMAND_FAILED for commandId: %s", commandId);

final CommandState commandState = systemCommandStatus.getCommandState();
if (commandState == COMMAND_COMPLETE || commandState == COMMAND_FAILED) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ private List<PublishedEvent> getPublishedEvents(final long startNumber) {

final List<PublishedEvent> events = doGetPublishedEvents();

System.out.printf("Polling published_event table. Expected events count: %d, found: %d", 3, events.size());
if (events.size() == 3) {
final Optional<Long> eventNumber = events.get(0).getEventNumber();
if(eventNumber.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ public void shouldReplaySingleEventToEventIndexerUsingTheReplayEventToEventIndex
}

final Optional<ProcessedEvent> processedEvent = poller.pollUntilFound(
() -> processedEventFinder.findProcessedEvent(publishedEvent.getId())
() -> {
System.out.printf("Polling processed_event table for existence of event id: %s", publishedEvent.getId());
return processedEventFinder.findProcessedEvent(publishedEvent.getId());
}
);

if (processedEvent.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ public void shouldReplaySingleEventToEventListenerUsingTheReplayEventToEventList
}

final Optional<ProcessedEvent> processedEvent = poller.pollUntilFound(
() -> processedEventFinder.findProcessedEvent(publishedEvent.getId())
() -> {
System.out.printf("Polling processed_event table for existence of event id: %s", publishedEvent.getId());
return processedEventFinder.findProcessedEvent(publishedEvent.getId());
}
);

if (processedEvent.isPresent()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public void cleanup() throws Exception {
final UUID commandId = systemCommanderMBean.call(UNSUSPEND);

final Optional<SystemCommandStatus> unsuspendStatus = poller.pollUntilFound(() -> {
System.out.printf("Polling for command state to be COMMAND_COMPLETE for commandId: %s", commandId);
final SystemCommandStatus commandStatus = systemCommanderMBean.getCommandStatus(commandId);
if (commandStatus.getCommandState() == COMMAND_COMPLETE) {
return of(commandStatus);
Expand Down Expand Up @@ -121,6 +122,7 @@ public void shouldNotReturnRecipesAfterSuspending() throws Exception {
final UUID commandId = systemCommanderMBean.call(SUSPEND);

final Optional<SystemCommandStatus> suspendStatus = poller.pollUntilFound(() -> {
System.out.printf("Polling for command state to be COMMAND_COMPLETE for commandId: %s", commandId);
final SystemCommandStatus commandStatus = systemCommanderMBean.getCommandStatus(commandId);
if (commandStatus.getCommandState() == COMMAND_COMPLETE) {
return of(commandStatus);
Expand Down Expand Up @@ -160,6 +162,7 @@ public void shouldQueryForRecipesAfterUnShuttering() throws Exception {
final UUID suspendCommandId = systemCommanderMBean.call(SUSPEND);

final Optional<SystemCommandStatus> suspendStatus = poller.pollUntilFound(() -> {
System.out.printf("Polling for command state to be COMMAND_COMPLETE for commandId: %s", suspendCommandId);
final SystemCommandStatus commandStatus = systemCommanderMBean.getCommandStatus(suspendCommandId);
if (commandStatus.getCommandState() == COMMAND_COMPLETE) {
return of(commandStatus);
Expand All @@ -186,6 +189,7 @@ public void shouldQueryForRecipesAfterUnShuttering() throws Exception {
final UUID unsuspendCommandId = systemCommanderMBean.call(UNSUSPEND);

final Optional<SystemCommandStatus> unsuspendStatus = poller.pollUntilFound(() -> {
System.out.printf("Polling for command state to be COMMAND_COMPLETE for commandId: %s", unsuspendCommandId);
final SystemCommandStatus commandStatus = systemCommanderMBean.getCommandStatus(unsuspendCommandId);
if (commandStatus.getCommandState() == COMMAND_COMPLETE) {
return of(commandStatus);
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
<properties>
<cpp.repo.name>cake-shop</cpp.repo.name>

<framework-libraries.version>8.0.4</framework-libraries.version>
<framework-libraries.version>8.0.7</framework-libraries.version>
<framework.version>8.10.0-M2</framework.version>
<event-store.version>8.10.0-M4-SNAPSHOT</event-store.version>
<event-store.version>8.10.0-M4</event-store.version>
</properties>

<dependencyManagement>
Expand Down

0 comments on commit 366654f

Please sign in to comment.