From 45b9c9a29154f314dec79340f42fb038475cf61c Mon Sep 17 00:00:00 2001 From: amckenzie Date: Wed, 6 Nov 2019 11:08:03 +0000 Subject: [PATCH] Change command handlers to be called using Strings --- CHANGELOG.md | 4 + .../helpers/DummySystemCommandStore.java | 5 - .../integration/RebuildPerformanceIT.java | 4 +- .../helpers/DummySystemCommandStore.java | 24 ++ event-sourcing/subscription-manager/pom.xml | 5 + .../ConcurrentEventStreamConsumerManager.java | 2 +- .../manager/EventStreamConsumerManager.java | 2 +- .../consumer/task/ConsumeEventQueueBean.java | 2 +- .../consumer/task/ConsumeEventQueueTask.java | 2 +- .../task/ConsumeEventQueueTaskFactory.java | 2 +- .../task/ConsumeEventQueueTaskManager.java | 2 +- .../task/EventProcessingFailedHandler.java | 2 +- .../consumer/task/EventQueueConsumer.java | 2 +- .../catchup/DummySystemCommandStore.java | 5 - ...currentEventStreamConsumerManagerTest.java | 4 +- .../task/ConsumeEventQueueBeanTest.java | 4 +- .../ConsumeEventQueueTaskFactoryTest.java | 4 +- .../ConsumeEventQueueTaskManagerTest.java | 4 +- .../task/ConsumeEventQueueTaskTest.java | 4 +- .../EventProcessingFailedHandlerTest.java | 4 +- .../consumer/task/EventQueueConsumerTest.java | 4 +- .../consumer/util/TestCatchupBean.java | 2 +- .../event-store-management-commands/pom.xml | 22 ++ .../commands/AddTriggerCommand.java | 13 ++ .../management/commands/CatchupCommand.java | 13 ++ .../commands/DisablePublishingCommand.java | 13 ++ .../commands/EnablePublishingCommand.java | 13 ++ .../commands/EventCatchupCommand.java | 13 ++ .../commands/IndexerCatchupCommand.java | 13 ++ .../commands/PublishingCommand.java | 6 + .../management/commands/RebuildCommand.java | 13 ++ .../commands/RemoveTriggerCommand.java | 13 ++ .../ValidatePublishedEventsCommand.java | 13 ++ .../commands/VerifyCatchupCommand.java | 13 ++ .../src/main/resources/META-INF/beans.xml | 8 + .../commands/CatchupCommandHandler.java | 8 +- .../CatchupCompletionEventFirer.java | 2 +- .../catchup/observers/CatchupObserver.java | 2 +- .../observers/CatchupProcessCompleter.java | 2 +- .../process/CatchupSubscriptionContext.java | 2 +- .../catchup/process/CatchupTypeSelector.java | 2 +- .../EventCatchupByComponentRunner.java | 2 +- .../process/EventCatchupProcessor.java | 2 +- .../catchup/process/EventCatchupRunner.java | 2 +- .../RunCatchupForComponentSelector.java | 2 +- .../catchup/state/CatchupError.java | 2 +- .../state/CatchupErrorStateManager.java | 2 +- .../catchup/state/CatchupStateManager.java | 2 +- .../EnablePublishingCommandHandler.java | 8 +- .../publishing/EnablePublishingProcessor.java | 2 +- .../publishing/PublishingEnabler.java | 4 +- .../commands/RebuildCommandHandler.java | 4 +- ...HandlerQueueDrainedShutteringExecutor.java | 2 +- ...PublishQueueDrainedShutteringExecutor.java | 2 +- .../AddRemoveTriggerCommandHandler.java | 8 +- .../ValidatePublishedEventCommandHandler.java | 4 +- .../process/SingleEventValidator.java | 5 + .../commands/VerifyCatchupCommandHandler.java | 4 +- .../commands/CatchupCommandHandlerTest.java | 4 +- .../CatchupCompletionEventFirerTest.java | 4 +- .../observers/CatchupObserverTest.java | 4 +- .../CatchupProcessCompleterTest.java | 4 +- .../process/CatchupTypeSelectorTest.java | 4 +- .../EventCatchupByComponentRunnerTest.java | 2 +- .../process/EventCatchupProcessorTest.java | 4 +- .../process/EventCatchupRunnerTest.java | 4 +- .../RunCatchupForComponentSelectorTest.java | 2 +- .../state/CatchupErrorStateManagerTest.java | 4 +- .../state/CatchupStateManagerTest.java | 4 +- .../commands/EventCatchupCommandTest.java | 22 ++ .../commands/IndexerCatchupCommandTest.java | 22 ++ .../EnablePublishingCommandHandlerTest.java | 4 +- .../EnablePublishingProcessorTest.java | 4 +- .../publishing/PublishingEnablerTest.java | 4 +- .../commands/RebuildCommandHandlerTest.java | 2 +- ...lerQueueDrainedShutteringExecutorTest.java | 2 +- ...ishQueueDrainedShutteringExecutorTest.java | 2 +- .../AddRemoveTriggerCommandHandlerTest.java | 4 +- ...idatePublishedEventCommandHandlerTest.java | 2 +- .../VerifyCatchupCommandHandlerTest.java | 2 +- .../event-store-management-events/pom.xml | 5 + .../CatchupCompletedForSubscriptionEvent.java | 2 +- .../CatchupProcessingOfEventFailedEvent.java | 2 +- .../events/catchup/CatchupRequestedEvent.java | 2 +- .../CatchupStartedForSubscriptionEvent.java | 2 +- event-store-management/pom.xml | 1 + pom.xml | 2 +- .../test-utils-event/pom.xml | 15 ++ .../jmx/EventStoreSystemCommandCaller.java | 86 ++++++++ .../EventStoreSystemCommandCallerTest.java | 206 ++++++++++++++++++ 90 files changed, 660 insertions(+), 107 deletions(-) create mode 100644 event-sourcing/event-publisher/published-event-processor/src/test/java/uk/gov/justice/services/eventsourcing/publishedevent/rebuild/integration/helpers/DummySystemCommandStore.java create mode 100644 event-store-management/event-store-management-commands/pom.xml create mode 100644 event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/AddTriggerCommand.java create mode 100644 event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/CatchupCommand.java create mode 100644 event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/DisablePublishingCommand.java create mode 100644 event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/EnablePublishingCommand.java create mode 100644 event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/EventCatchupCommand.java create mode 100644 event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/IndexerCatchupCommand.java create mode 100644 event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/PublishingCommand.java create mode 100644 event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/RebuildCommand.java create mode 100644 event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/RemoveTriggerCommand.java create mode 100644 event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/ValidatePublishedEventsCommand.java create mode 100644 event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/VerifyCatchupCommand.java create mode 100644 event-store-management/event-store-management-commands/src/main/resources/META-INF/beans.xml create mode 100644 event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/commands/EventCatchupCommandTest.java create mode 100644 event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/commands/IndexerCatchupCommandTest.java create mode 100644 test-utils-event-store/test-utils-event/src/main/java/uk/gov/justice/services/test/utils/jmx/EventStoreSystemCommandCaller.java create mode 100644 test-utils-event-store/test-utils-event/src/test/java/uk/gov/justice/services/test/utils/jmx/EventStoreSystemCommandCallerTest.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 5467efd47..d24515200 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,12 @@ on [Keep a CHANGELOG](http://keepachangelog.com/). This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] + +## [2.3.0] - 2019-12-07 ### Added - Added event_id to the processed_event table to aid debugging of publishing +### Changed +- Event-Store SystemCommands moved into this project to break the dependency on framework ## [2.2.7] - 2019-12-04 ### Added diff --git a/event-sourcing/event-publisher/event-publisher-timer/src/test/java/uk/gov/justice/services/eventsourcing/publishedevent/prepublish/helpers/DummySystemCommandStore.java b/event-sourcing/event-publisher/event-publisher-timer/src/test/java/uk/gov/justice/services/eventsourcing/publishedevent/prepublish/helpers/DummySystemCommandStore.java index 583884ec3..8c3bdc560 100644 --- a/event-sourcing/event-publisher/event-publisher-timer/src/test/java/uk/gov/justice/services/eventsourcing/publishedevent/prepublish/helpers/DummySystemCommandStore.java +++ b/event-sourcing/event-publisher/event-publisher-timer/src/test/java/uk/gov/justice/services/eventsourcing/publishedevent/prepublish/helpers/DummySystemCommandStore.java @@ -13,11 +13,6 @@ @Default public class DummySystemCommandStore implements SystemCommandStore { - @Override - public boolean isSupported(final SystemCommand systemCommand) { - return false; - } - @Override public SystemCommandHandlerProxy findCommandProxy(final SystemCommand systemCommand) { throw new UnsupportedOperationException(); diff --git a/event-sourcing/event-publisher/published-event-processor/src/test/java/uk/gov/justice/services/eventsourcing/publishedevent/rebuild/integration/RebuildPerformanceIT.java b/event-sourcing/event-publisher/published-event-processor/src/test/java/uk/gov/justice/services/eventsourcing/publishedevent/rebuild/integration/RebuildPerformanceIT.java index 3285099f2..08fbe7507 100644 --- a/event-sourcing/event-publisher/published-event-processor/src/test/java/uk/gov/justice/services/eventsourcing/publishedevent/rebuild/integration/RebuildPerformanceIT.java +++ b/event-sourcing/event-publisher/published-event-processor/src/test/java/uk/gov/justice/services/eventsourcing/publishedevent/rebuild/integration/RebuildPerformanceIT.java @@ -13,6 +13,7 @@ import uk.gov.justice.services.eventsourcing.publishedevent.rebuild.ActiveEventStreamIdProvider; import uk.gov.justice.services.eventsourcing.publishedevent.rebuild.PublishedEventConverter; import uk.gov.justice.services.eventsourcing.publishedevent.rebuild.PublishedEventRebuilder; +import uk.gov.justice.services.eventsourcing.publishedevent.rebuild.integration.helpers.DummySystemCommandStore; import uk.gov.justice.services.eventsourcing.publishedevent.rebuild.integration.helpers.EventInserter; import uk.gov.justice.services.eventsourcing.publishedevent.rebuild.integration.helpers.StreamIdGenerator; import uk.gov.justice.services.eventsourcing.publishedevent.rebuild.integration.helpers.StreamStatusInserter; @@ -101,7 +102,8 @@ public Properties postgresqlConfiguration() { ObjectMapperProducer.class, LoggerProducer.class, DefaultJsonEnvelopeProvider.class, - DefaultEnvelopeProvider.class + DefaultEnvelopeProvider.class, + DummySystemCommandStore.class }) @Default public WebApp war() { diff --git a/event-sourcing/event-publisher/published-event-processor/src/test/java/uk/gov/justice/services/eventsourcing/publishedevent/rebuild/integration/helpers/DummySystemCommandStore.java b/event-sourcing/event-publisher/published-event-processor/src/test/java/uk/gov/justice/services/eventsourcing/publishedevent/rebuild/integration/helpers/DummySystemCommandStore.java new file mode 100644 index 000000000..0507e6b08 --- /dev/null +++ b/event-sourcing/event-publisher/published-event-processor/src/test/java/uk/gov/justice/services/eventsourcing/publishedevent/rebuild/integration/helpers/DummySystemCommandStore.java @@ -0,0 +1,24 @@ +package uk.gov.justice.services.eventsourcing.publishedevent.rebuild.integration.helpers; + +import uk.gov.justice.services.jmx.api.command.SystemCommand; +import uk.gov.justice.services.jmx.command.SystemCommandHandlerProxy; +import uk.gov.justice.services.jmx.command.SystemCommandStore; + +import java.util.List; + +import javax.enterprise.inject.Default; +import javax.faces.bean.ApplicationScoped; + +@ApplicationScoped +@Default +public class DummySystemCommandStore implements SystemCommandStore { + + @Override + public SystemCommandHandlerProxy findCommandProxy(final SystemCommand systemCommand) { + throw new UnsupportedOperationException(); + } + + @Override + public void store(final List systemCommandProxies) { + } +} diff --git a/event-sourcing/subscription-manager/pom.xml b/event-sourcing/subscription-manager/pom.xml index a3eec19a2..4a15987e4 100644 --- a/event-sourcing/subscription-manager/pom.xml +++ b/event-sourcing/subscription-manager/pom.xml @@ -63,6 +63,11 @@ event-store-management-events ${project.version} + + uk.gov.justice.event-store + event-store-management-commands + ${project.version} + diff --git a/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/manager/ConcurrentEventStreamConsumerManager.java b/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/manager/ConcurrentEventStreamConsumerManager.java index 9843b430a..9fdda2dcd 100644 --- a/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/manager/ConcurrentEventStreamConsumerManager.java +++ b/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/manager/ConcurrentEventStreamConsumerManager.java @@ -3,7 +3,7 @@ import uk.gov.justice.services.event.sourcing.subscription.catchup.consumer.task.ConsumeEventQueueTaskManager; import uk.gov.justice.services.event.sourcing.subscription.catchup.consumer.task.EventQueueConsumer; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.PublishedEvent; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import java.util.Queue; import java.util.UUID; diff --git a/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/manager/EventStreamConsumerManager.java b/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/manager/EventStreamConsumerManager.java index abcb13c55..b88680696 100644 --- a/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/manager/EventStreamConsumerManager.java +++ b/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/manager/EventStreamConsumerManager.java @@ -1,7 +1,7 @@ package uk.gov.justice.services.event.sourcing.subscription.catchup.consumer.manager; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.PublishedEvent; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import java.util.UUID; diff --git a/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueBean.java b/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueBean.java index a4679187f..d3eea3806 100644 --- a/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueBean.java +++ b/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueBean.java @@ -4,7 +4,7 @@ import static javax.transaction.Transactional.TxType.NEVER; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.PublishedEvent; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import java.util.Queue; import java.util.UUID; diff --git a/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTask.java b/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTask.java index 27484f2fe..b29344657 100644 --- a/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTask.java +++ b/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTask.java @@ -1,7 +1,7 @@ package uk.gov.justice.services.event.sourcing.subscription.catchup.consumer.task; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.PublishedEvent; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import java.util.Queue; import java.util.UUID; diff --git a/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTaskFactory.java b/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTaskFactory.java index d9ec53d1b..75347899c 100644 --- a/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTaskFactory.java +++ b/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTaskFactory.java @@ -1,7 +1,7 @@ package uk.gov.justice.services.event.sourcing.subscription.catchup.consumer.task; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.PublishedEvent; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import java.util.Queue; import java.util.UUID; diff --git a/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTaskManager.java b/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTaskManager.java index c3d514732..de701a1f6 100644 --- a/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTaskManager.java +++ b/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTaskManager.java @@ -1,7 +1,7 @@ package uk.gov.justice.services.event.sourcing.subscription.catchup.consumer.task; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.PublishedEvent; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import java.util.Queue; import java.util.UUID; diff --git a/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/EventProcessingFailedHandler.java b/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/EventProcessingFailedHandler.java index 131c46854..7926b7a73 100644 --- a/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/EventProcessingFailedHandler.java +++ b/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/EventProcessingFailedHandler.java @@ -3,8 +3,8 @@ import static java.lang.String.format; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.PublishedEvent; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import uk.gov.justice.services.eventstore.management.events.catchup.CatchupProcessingOfEventFailedEvent; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; import java.util.UUID; diff --git a/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/EventQueueConsumer.java b/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/EventQueueConsumer.java index 51f3209d4..b103d8c96 100644 --- a/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/EventQueueConsumer.java +++ b/event-sourcing/subscription-manager/src/main/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/EventQueueConsumer.java @@ -4,7 +4,7 @@ import uk.gov.justice.services.event.sourcing.subscription.catchup.consumer.manager.FinishedProcessingMessage; import uk.gov.justice.services.event.sourcing.subscription.manager.TransactionalEventProcessor; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.PublishedEvent; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import java.util.Queue; import java.util.UUID; diff --git a/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/DummySystemCommandStore.java b/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/DummySystemCommandStore.java index a1109bec1..93b37ac04 100644 --- a/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/DummySystemCommandStore.java +++ b/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/DummySystemCommandStore.java @@ -13,11 +13,6 @@ @Default public class DummySystemCommandStore implements SystemCommandStore { - @Override - public boolean isSupported(final SystemCommand systemCommand) { - return false; - } - @Override public SystemCommandHandlerProxy findCommandProxy(final SystemCommand systemCommand) { throw new UnsupportedOperationException(); diff --git a/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/manager/ConcurrentEventStreamConsumerManagerTest.java b/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/manager/ConcurrentEventStreamConsumerManagerTest.java index bbbd36574..1ccfbe19b 100644 --- a/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/manager/ConcurrentEventStreamConsumerManagerTest.java +++ b/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/manager/ConcurrentEventStreamConsumerManagerTest.java @@ -12,8 +12,8 @@ import uk.gov.justice.services.event.sourcing.subscription.catchup.consumer.task.ConsumeEventQueueTaskManager; import uk.gov.justice.services.event.sourcing.subscription.catchup.consumer.task.EventQueueConsumer; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.PublishedEvent; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; -import uk.gov.justice.services.jmx.api.command.EventCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand; import java.util.List; import java.util.Queue; diff --git a/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueBeanTest.java b/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueBeanTest.java index 5c26102f9..e9d5b3dab 100644 --- a/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueBeanTest.java +++ b/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueBeanTest.java @@ -8,8 +8,8 @@ import static org.mockito.Mockito.when; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.PublishedEvent; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; -import uk.gov.justice.services.jmx.api.command.EventCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand; import java.util.Queue; import java.util.UUID; diff --git a/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTaskFactoryTest.java b/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTaskFactoryTest.java index f76f16d31..161f337b2 100644 --- a/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTaskFactoryTest.java +++ b/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTaskFactoryTest.java @@ -7,8 +7,8 @@ import static uk.gov.justice.services.test.utils.core.reflection.ReflectionUtil.getValueOfField; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.PublishedEvent; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; -import uk.gov.justice.services.jmx.api.command.EventCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand; import java.util.Queue; import java.util.UUID; diff --git a/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTaskManagerTest.java b/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTaskManagerTest.java index 022d3bba1..c709e173d 100644 --- a/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTaskManagerTest.java +++ b/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTaskManagerTest.java @@ -6,8 +6,8 @@ import static org.mockito.Mockito.when; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.PublishedEvent; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; -import uk.gov.justice.services.jmx.api.command.EventCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand; import java.util.Queue; import java.util.UUID; diff --git a/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTaskTest.java b/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTaskTest.java index 9765b8a10..24ff06e28 100644 --- a/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTaskTest.java +++ b/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/ConsumeEventQueueTaskTest.java @@ -5,8 +5,8 @@ import static org.mockito.Mockito.verify; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.PublishedEvent; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; -import uk.gov.justice.services.jmx.api.command.EventCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand; import java.util.Queue; import java.util.UUID; diff --git a/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/EventProcessingFailedHandlerTest.java b/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/EventProcessingFailedHandlerTest.java index 5ef497d27..ba0668610 100644 --- a/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/EventProcessingFailedHandlerTest.java +++ b/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/EventProcessingFailedHandlerTest.java @@ -8,9 +8,9 @@ import static org.mockito.Mockito.when; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.PublishedEvent; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand; import uk.gov.justice.services.eventstore.management.events.catchup.CatchupProcessingOfEventFailedEvent; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; -import uk.gov.justice.services.jmx.api.command.EventCatchupCommand; import java.util.UUID; diff --git a/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/EventQueueConsumerTest.java b/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/EventQueueConsumerTest.java index e099e4835..0f1fdabaa 100644 --- a/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/EventQueueConsumerTest.java +++ b/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/task/EventQueueConsumerTest.java @@ -11,8 +11,8 @@ import uk.gov.justice.services.event.sourcing.subscription.catchup.consumer.manager.FinishedProcessingMessage; import uk.gov.justice.services.event.sourcing.subscription.manager.TransactionalEventProcessor; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.PublishedEvent; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; -import uk.gov.justice.services.jmx.api.command.EventCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand; import java.util.Queue; import java.util.UUID; diff --git a/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/util/TestCatchupBean.java b/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/util/TestCatchupBean.java index 0a014db59..f9d46f850 100644 --- a/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/util/TestCatchupBean.java +++ b/event-sourcing/subscription-manager/src/test/java/uk/gov/justice/services/event/sourcing/subscription/catchup/consumer/util/TestCatchupBean.java @@ -4,7 +4,7 @@ import uk.gov.justice.services.event.sourcing.subscription.catchup.consumer.manager.ConcurrentEventStreamConsumerManager; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.PublishedEvent; -import uk.gov.justice.services.jmx.api.command.EventCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand; import java.util.UUID; import java.util.stream.Stream; diff --git a/event-store-management/event-store-management-commands/pom.xml b/event-store-management/event-store-management-commands/pom.xml new file mode 100644 index 000000000..d2e1c6ae5 --- /dev/null +++ b/event-store-management/event-store-management-commands/pom.xml @@ -0,0 +1,22 @@ + + + + event-store-management + uk.gov.justice.event-store + 2.2.8-SNAPSHOT + + 4.0.0 + + event-store-management-commands + + + + uk.gov.justice.services + jmx-api + ${framework.version} + + + + diff --git a/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/AddTriggerCommand.java b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/AddTriggerCommand.java new file mode 100644 index 000000000..1da8d4c9a --- /dev/null +++ b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/AddTriggerCommand.java @@ -0,0 +1,13 @@ +package uk.gov.justice.services.eventstore.management.commands; + +import uk.gov.justice.services.jmx.api.command.BaseSystemCommand; + +public class AddTriggerCommand extends BaseSystemCommand { + + public static final String ADD_TRIGGER = "ADD_TRIGGER"; + private static final String DESCRIPTION = "Adds the 'queue_publish_event' trigger to the event log table so that new events inserted into the event_log table will trigger publishing."; + + public AddTriggerCommand() { + super(ADD_TRIGGER, DESCRIPTION); + } +} diff --git a/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/CatchupCommand.java b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/CatchupCommand.java new file mode 100644 index 000000000..0f6eb014b --- /dev/null +++ b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/CatchupCommand.java @@ -0,0 +1,13 @@ +package uk.gov.justice.services.eventstore.management.commands; + +import static uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand.CATCHUP; + +import uk.gov.justice.services.jmx.api.command.SystemCommand; + + +public interface CatchupCommand extends SystemCommand { + + default boolean isEventCatchup() { + return CATCHUP.equals(getName()); + } +} diff --git a/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/DisablePublishingCommand.java b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/DisablePublishingCommand.java new file mode 100644 index 000000000..60afe754e --- /dev/null +++ b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/DisablePublishingCommand.java @@ -0,0 +1,13 @@ +package uk.gov.justice.services.eventstore.management.commands; + +import uk.gov.justice.services.jmx.api.command.BaseSystemCommand; + +public class DisablePublishingCommand extends BaseSystemCommand implements PublishingCommand { + + public static final String DISABLE_PUBLISHING = "DISABLE_PUBLISHING"; + public static final String DESCRIPTION = "Disables the publishing of any newly received events"; + + public DisablePublishingCommand() { + super(DISABLE_PUBLISHING, DESCRIPTION); + } +} diff --git a/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/EnablePublishingCommand.java b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/EnablePublishingCommand.java new file mode 100644 index 000000000..8d108a3ee --- /dev/null +++ b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/EnablePublishingCommand.java @@ -0,0 +1,13 @@ +package uk.gov.justice.services.eventstore.management.commands; + +import uk.gov.justice.services.jmx.api.command.BaseSystemCommand; + +public class EnablePublishingCommand extends BaseSystemCommand implements PublishingCommand { + + public static final String ENABLE_PUBLISHING = "ENABLE_PUBLISHING"; + public static final String DESCRIPTION = "Enables the publishing of any newly received events"; + + public EnablePublishingCommand() { + super(ENABLE_PUBLISHING, DESCRIPTION); + } +} diff --git a/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/EventCatchupCommand.java b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/EventCatchupCommand.java new file mode 100644 index 000000000..5ba04df33 --- /dev/null +++ b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/EventCatchupCommand.java @@ -0,0 +1,13 @@ +package uk.gov.justice.services.eventstore.management.commands; + +import uk.gov.justice.services.jmx.api.command.BaseSystemCommand; + +public class EventCatchupCommand extends BaseSystemCommand implements CatchupCommand { + + public static final String CATCHUP = "CATCHUP"; + private static final String DESCRIPTION = "Catches up and publishes all Events missing from the View Store"; + + public EventCatchupCommand() { + super(CATCHUP, DESCRIPTION); + } +} diff --git a/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/IndexerCatchupCommand.java b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/IndexerCatchupCommand.java new file mode 100644 index 000000000..ea44daa4c --- /dev/null +++ b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/IndexerCatchupCommand.java @@ -0,0 +1,13 @@ +package uk.gov.justice.services.eventstore.management.commands; + +import uk.gov.justice.services.jmx.api.command.BaseSystemCommand; + +public class IndexerCatchupCommand extends BaseSystemCommand implements CatchupCommand { + + public static final String INDEXER_CATCHUP = "INDEXER_CATCHUP"; + private static final String DESCRIPTION = "Rebuilds the application search indexes"; + + public IndexerCatchupCommand() { + super(INDEXER_CATCHUP, DESCRIPTION); + } +} diff --git a/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/PublishingCommand.java b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/PublishingCommand.java new file mode 100644 index 000000000..788e7a10a --- /dev/null +++ b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/PublishingCommand.java @@ -0,0 +1,6 @@ +package uk.gov.justice.services.eventstore.management.commands; + +import uk.gov.justice.services.jmx.api.command.SystemCommand; + +public interface PublishingCommand extends SystemCommand { +} diff --git a/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/RebuildCommand.java b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/RebuildCommand.java new file mode 100644 index 000000000..47c2afb5e --- /dev/null +++ b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/RebuildCommand.java @@ -0,0 +1,13 @@ +package uk.gov.justice.services.eventstore.management.commands; + +import uk.gov.justice.services.jmx.api.command.BaseSystemCommand; + +public class RebuildCommand extends BaseSystemCommand { + + public static final String REBUILD = "REBUILD"; + private static final String DESCRIPTION = "Rebuilds PublishedEvents and renumbers the Events"; + + public RebuildCommand() { + super(REBUILD, DESCRIPTION); + } +} diff --git a/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/RemoveTriggerCommand.java b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/RemoveTriggerCommand.java new file mode 100644 index 000000000..2447de756 --- /dev/null +++ b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/RemoveTriggerCommand.java @@ -0,0 +1,13 @@ +package uk.gov.justice.services.eventstore.management.commands; + +import uk.gov.justice.services.jmx.api.command.BaseSystemCommand; + +public class RemoveTriggerCommand extends BaseSystemCommand { + + public static final String REMOVE_TRIGGER = "REMOVE_TRIGGER"; + private static final String DESCRIPTION = "Removes the 'queue_publish_event' trigger from the event log table so that new events inserted into the event_log table will no longer trigger publishing."; + + public RemoveTriggerCommand() { + super(REMOVE_TRIGGER, DESCRIPTION); + } +} diff --git a/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/ValidatePublishedEventsCommand.java b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/ValidatePublishedEventsCommand.java new file mode 100644 index 000000000..925743450 --- /dev/null +++ b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/ValidatePublishedEventsCommand.java @@ -0,0 +1,13 @@ +package uk.gov.justice.services.eventstore.management.commands; + +import uk.gov.justice.services.jmx.api.command.BaseSystemCommand; + +public class ValidatePublishedEventsCommand extends BaseSystemCommand { + + public static final String VALIDATE_EVENTS = "VALIDATE_EVENTS"; + public static final String DESCRIPTION = "Validates that all payloads of published events abide by their schemas."; + + public ValidatePublishedEventsCommand() { + super(VALIDATE_EVENTS, DESCRIPTION); + } +} diff --git a/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/VerifyCatchupCommand.java b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/VerifyCatchupCommand.java new file mode 100644 index 000000000..09e79c120 --- /dev/null +++ b/event-store-management/event-store-management-commands/src/main/java/uk/gov/justice/services/eventstore/management/commands/VerifyCatchupCommand.java @@ -0,0 +1,13 @@ +package uk.gov.justice.services.eventstore.management.commands; + +import uk.gov.justice.services.jmx.api.command.BaseSystemCommand; + +public class VerifyCatchupCommand extends BaseSystemCommand { + + public static final String VERIFY_CATCHUP = "VERIFY_CATCHUP"; + private static final String DESCRIPTION = "Runs various verifications on event_log, published_event, processed_event and stream_buffer to check that catchup has run successfully"; + + public VerifyCatchupCommand() { + super(VERIFY_CATCHUP, DESCRIPTION); + } +} diff --git a/event-store-management/event-store-management-commands/src/main/resources/META-INF/beans.xml b/event-store-management/event-store-management-commands/src/main/resources/META-INF/beans.xml new file mode 100644 index 000000000..a0aaf4421 --- /dev/null +++ b/event-store-management/event-store-management-commands/src/main/resources/META-INF/beans.xml @@ -0,0 +1,8 @@ + + + + diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/commands/CatchupCommandHandler.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/commands/CatchupCommandHandler.java index 50aefce46..54dc6f996 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/commands/CatchupCommandHandler.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/commands/CatchupCommandHandler.java @@ -1,13 +1,13 @@ package uk.gov.justice.services.eventstore.management.catchup.commands; import static java.lang.String.format; -import static uk.gov.justice.services.jmx.api.command.EventCatchupCommand.CATCHUP; -import static uk.gov.justice.services.jmx.api.command.IndexerCatchupCommand.INDEXER_CATCHUP; +import static uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand.CATCHUP; +import static uk.gov.justice.services.eventstore.management.commands.IndexerCatchupCommand.INDEXER_CATCHUP; import uk.gov.justice.services.common.util.UtcClock; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.IndexerCatchupCommand; import uk.gov.justice.services.eventstore.management.events.catchup.CatchupRequestedEvent; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; -import uk.gov.justice.services.jmx.api.command.IndexerCatchupCommand; import uk.gov.justice.services.jmx.command.HandlesSystemCommand; import java.time.ZonedDateTime; diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupCompletionEventFirer.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupCompletionEventFirer.java index 1c988f484..0c152e432 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupCompletionEventFirer.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupCompletionEventFirer.java @@ -7,7 +7,7 @@ import uk.gov.justice.services.common.util.UtcClock; import uk.gov.justice.services.eventstore.management.CommandResult; import uk.gov.justice.services.eventstore.management.catchup.state.CatchupError; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import uk.gov.justice.services.jmx.state.events.SystemCommandStateChangedEvent; import java.time.ZonedDateTime; diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupObserver.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupObserver.java index baa505149..cb31edd76 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupObserver.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupObserver.java @@ -10,11 +10,11 @@ import uk.gov.justice.services.eventstore.management.catchup.state.CatchupError; import uk.gov.justice.services.eventstore.management.catchup.state.CatchupErrorStateManager; import uk.gov.justice.services.eventstore.management.catchup.state.CatchupStateManager; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import uk.gov.justice.services.eventstore.management.events.catchup.CatchupCompletedForSubscriptionEvent; import uk.gov.justice.services.eventstore.management.events.catchup.CatchupProcessingOfEventFailedEvent; import uk.gov.justice.services.eventstore.management.events.catchup.CatchupRequestedEvent; import uk.gov.justice.services.eventstore.management.events.catchup.CatchupStartedForSubscriptionEvent; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; import uk.gov.justice.services.jmx.logging.MdcLoggerInterceptor; import uk.gov.justice.services.jmx.state.events.SystemCommandStateChangedEvent; diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupProcessCompleter.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupProcessCompleter.java index c62882f1c..e4c7adc2c 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupProcessCompleter.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupProcessCompleter.java @@ -2,7 +2,7 @@ import uk.gov.justice.services.eventstore.management.catchup.state.CatchupError; import uk.gov.justice.services.eventstore.management.catchup.state.CatchupErrorStateManager; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import java.util.List; import java.util.UUID; diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/CatchupSubscriptionContext.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/CatchupSubscriptionContext.java index 06a5a20e3..0afb1b7aa 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/CatchupSubscriptionContext.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/CatchupSubscriptionContext.java @@ -1,6 +1,6 @@ package uk.gov.justice.services.eventstore.management.catchup.process; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import uk.gov.justice.subscription.domain.subscriptiondescriptor.Subscription; import java.util.Objects; diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/CatchupTypeSelector.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/CatchupTypeSelector.java index e5025a7cb..10f58c544 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/CatchupTypeSelector.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/CatchupTypeSelector.java @@ -3,7 +3,7 @@ import static uk.gov.justice.services.core.annotation.Component.EVENT_INDEXER; import static uk.gov.justice.services.core.annotation.Component.EVENT_LISTENER; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; public class CatchupTypeSelector { diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupByComponentRunner.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupByComponentRunner.java index 7371dd7af..ab3e3b379 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupByComponentRunner.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupByComponentRunner.java @@ -2,7 +2,7 @@ import static java.lang.String.format; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import uk.gov.justice.subscription.domain.subscriptiondescriptor.Subscription; import uk.gov.justice.subscription.domain.subscriptiondescriptor.SubscriptionsDescriptor; diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupProcessor.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupProcessor.java index 27cffa670..0c578def1 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupProcessor.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupProcessor.java @@ -7,9 +7,9 @@ import uk.gov.justice.services.event.sourcing.subscription.catchup.consumer.manager.ConcurrentEventStreamConsumerManager; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.MissingEventNumberException; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.PublishedEvent; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import uk.gov.justice.services.eventstore.management.events.catchup.CatchupCompletedForSubscriptionEvent; import uk.gov.justice.services.eventstore.management.events.catchup.CatchupStartedForSubscriptionEvent; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; import uk.gov.justice.subscription.domain.subscriptiondescriptor.Subscription; import java.util.UUID; diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupRunner.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupRunner.java index e48bb4872..7f7da095b 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupRunner.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupRunner.java @@ -1,6 +1,6 @@ package uk.gov.justice.services.eventstore.management.catchup.process; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import uk.gov.justice.subscription.registry.SubscriptionsDescriptorsRegistry; import java.util.UUID; diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/RunCatchupForComponentSelector.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/RunCatchupForComponentSelector.java index b85e16089..f4144010d 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/RunCatchupForComponentSelector.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/process/RunCatchupForComponentSelector.java @@ -1,6 +1,6 @@ package uk.gov.justice.services.eventstore.management.catchup.process; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import javax.inject.Inject; diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/state/CatchupError.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/state/CatchupError.java index bac36b3f9..748789cb3 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/state/CatchupError.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/state/CatchupError.java @@ -1,6 +1,6 @@ package uk.gov.justice.services.eventstore.management.catchup.state; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import java.util.Objects; import java.util.UUID; diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/state/CatchupErrorStateManager.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/state/CatchupErrorStateManager.java index 28aa347ae..4eda863c9 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/state/CatchupErrorStateManager.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/state/CatchupErrorStateManager.java @@ -2,7 +2,7 @@ import static com.google.common.collect.ImmutableList.copyOf; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/state/CatchupStateManager.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/state/CatchupStateManager.java index dc82ec49e..d48fe96d0 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/state/CatchupStateManager.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/catchup/state/CatchupStateManager.java @@ -1,7 +1,7 @@ package uk.gov.justice.services.eventstore.management.catchup.state; import uk.gov.justice.services.eventstore.management.catchup.process.CatchupInProgress; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import java.util.ArrayList; import java.util.List; diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/publishing/EnablePublishingCommandHandler.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/publishing/EnablePublishingCommandHandler.java index 3ff031812..bd4152d16 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/publishing/EnablePublishingCommandHandler.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/publishing/EnablePublishingCommandHandler.java @@ -1,10 +1,10 @@ package uk.gov.justice.services.eventstore.management.publishing; -import static uk.gov.justice.services.jmx.api.command.DisablePublishingCommand.DISABLE_PUBLISHING; -import static uk.gov.justice.services.jmx.api.command.EnablePublishingCommand.ENABLE_PUBLISHING; +import static uk.gov.justice.services.eventstore.management.commands.DisablePublishingCommand.DISABLE_PUBLISHING; +import static uk.gov.justice.services.eventstore.management.commands.EnablePublishingCommand.ENABLE_PUBLISHING; -import uk.gov.justice.services.jmx.api.command.DisablePublishingCommand; -import uk.gov.justice.services.jmx.api.command.EnablePublishingCommand; +import uk.gov.justice.services.eventstore.management.commands.DisablePublishingCommand; +import uk.gov.justice.services.eventstore.management.commands.EnablePublishingCommand; import uk.gov.justice.services.jmx.command.HandlesSystemCommand; import uk.gov.justice.services.jmx.logging.MdcLoggerInterceptor; diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/publishing/EnablePublishingProcessor.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/publishing/EnablePublishingProcessor.java index d82a9e95b..146879a66 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/publishing/EnablePublishingProcessor.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/publishing/EnablePublishingProcessor.java @@ -5,7 +5,7 @@ import static uk.gov.justice.services.jmx.api.domain.CommandState.COMMAND_IN_PROGRESS; import uk.gov.justice.services.common.util.UtcClock; -import uk.gov.justice.services.jmx.api.command.PublishingCommand; +import uk.gov.justice.services.eventstore.management.commands.PublishingCommand; import uk.gov.justice.services.jmx.state.events.SystemCommandStateChangedEvent; import java.util.UUID; diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/publishing/PublishingEnabler.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/publishing/PublishingEnabler.java index 6969fcba1..251f9ec75 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/publishing/PublishingEnabler.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/publishing/PublishingEnabler.java @@ -1,10 +1,10 @@ package uk.gov.justice.services.eventstore.management.publishing; -import static uk.gov.justice.services.jmx.api.command.EnablePublishingCommand.ENABLE_PUBLISHING; +import static uk.gov.justice.services.eventstore.management.commands.EnablePublishingCommand.ENABLE_PUBLISHING; import uk.gov.justice.services.eventsourcing.publishedevent.prepublish.PrePublisherTimerConfig; import uk.gov.justice.services.eventsourcing.publishedevent.publishing.PublisherTimerConfig; -import uk.gov.justice.services.jmx.api.command.PublishingCommand; +import uk.gov.justice.services.eventstore.management.commands.PublishingCommand; import javax.inject.Inject; diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/rebuild/commands/RebuildCommandHandler.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/rebuild/commands/RebuildCommandHandler.java index f8797f608..69f149be0 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/rebuild/commands/RebuildCommandHandler.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/rebuild/commands/RebuildCommandHandler.java @@ -2,14 +2,14 @@ import static java.lang.String.format; import static java.time.temporal.ChronoUnit.MILLIS; -import static uk.gov.justice.services.jmx.api.command.RebuildCommand.REBUILD; +import static uk.gov.justice.services.eventstore.management.commands.RebuildCommand.REBUILD; import static uk.gov.justice.services.jmx.api.domain.CommandState.COMMAND_COMPLETE; import static uk.gov.justice.services.jmx.api.domain.CommandState.COMMAND_FAILED; import static uk.gov.justice.services.jmx.api.domain.CommandState.COMMAND_IN_PROGRESS; import uk.gov.justice.services.common.util.UtcClock; import uk.gov.justice.services.eventsourcing.publishedevent.rebuild.PublishedEventRebuilder; -import uk.gov.justice.services.jmx.api.command.RebuildCommand; +import uk.gov.justice.services.eventstore.management.commands.RebuildCommand; import uk.gov.justice.services.jmx.command.HandlesSystemCommand; import uk.gov.justice.services.jmx.logging.MdcLoggerInterceptor; import uk.gov.justice.services.jmx.state.events.SystemCommandStateChangedEvent; diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/shuttering/observers/CommandHandlerQueueDrainedShutteringExecutor.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/shuttering/observers/CommandHandlerQueueDrainedShutteringExecutor.java index e9241034f..40ed54062 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/shuttering/observers/CommandHandlerQueueDrainedShutteringExecutor.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/shuttering/observers/CommandHandlerQueueDrainedShutteringExecutor.java @@ -6,9 +6,9 @@ import uk.gov.justice.services.eventsourcing.util.jee.timer.StopWatchFactory; import uk.gov.justice.services.eventstore.management.shuttering.process.CommandHandlerQueueInterrogator; -import uk.gov.justice.services.jmx.api.command.ApplicationShutteringCommand; import uk.gov.justice.services.management.shuttering.api.ShutteringExecutor; import uk.gov.justice.services.management.shuttering.api.ShutteringResult; +import uk.gov.justice.services.management.shuttering.commands.ApplicationShutteringCommand; import java.util.UUID; diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/shuttering/observers/PublishQueueDrainedShutteringExecutor.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/shuttering/observers/PublishQueueDrainedShutteringExecutor.java index ce9e9b14f..769e43a6c 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/shuttering/observers/PublishQueueDrainedShutteringExecutor.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/shuttering/observers/PublishQueueDrainedShutteringExecutor.java @@ -6,9 +6,9 @@ import uk.gov.justice.services.eventsourcing.util.jee.timer.StopWatchFactory; import uk.gov.justice.services.eventstore.management.shuttering.process.PublishQueueInterrogator; -import uk.gov.justice.services.jmx.api.command.ApplicationShutteringCommand; import uk.gov.justice.services.management.shuttering.api.ShutteringExecutor; import uk.gov.justice.services.management.shuttering.api.ShutteringResult; +import uk.gov.justice.services.management.shuttering.commands.ApplicationShutteringCommand; import java.util.UUID; diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/trigger/commands/AddRemoveTriggerCommandHandler.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/trigger/commands/AddRemoveTriggerCommandHandler.java index d777702e1..3a4fd6696 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/trigger/commands/AddRemoveTriggerCommandHandler.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/trigger/commands/AddRemoveTriggerCommandHandler.java @@ -1,16 +1,16 @@ package uk.gov.justice.services.eventstore.management.trigger.commands; import static java.lang.String.format; -import static uk.gov.justice.services.jmx.api.command.AddTriggerCommand.ADD_TRIGGER; -import static uk.gov.justice.services.jmx.api.command.RemoveTriggerCommand.REMOVE_TRIGGER; +import static uk.gov.justice.services.eventstore.management.commands.AddTriggerCommand.ADD_TRIGGER; +import static uk.gov.justice.services.eventstore.management.commands.RemoveTriggerCommand.REMOVE_TRIGGER; import static uk.gov.justice.services.jmx.api.domain.CommandState.COMMAND_COMPLETE; import static uk.gov.justice.services.jmx.api.domain.CommandState.COMMAND_FAILED; import static uk.gov.justice.services.jmx.api.domain.CommandState.COMMAND_IN_PROGRESS; import uk.gov.justice.services.common.util.UtcClock; +import uk.gov.justice.services.eventstore.management.commands.AddTriggerCommand; +import uk.gov.justice.services.eventstore.management.commands.RemoveTriggerCommand; import uk.gov.justice.services.eventstore.management.trigger.process.EventLogTriggerManipulator; -import uk.gov.justice.services.jmx.api.command.AddTriggerCommand; -import uk.gov.justice.services.jmx.api.command.RemoveTriggerCommand; import uk.gov.justice.services.jmx.command.HandlesSystemCommand; import uk.gov.justice.services.jmx.logging.MdcLoggerInterceptor; import uk.gov.justice.services.jmx.state.events.SystemCommandStateChangedEvent; diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/validation/commands/ValidatePublishedEventCommandHandler.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/validation/commands/ValidatePublishedEventCommandHandler.java index 000aff74b..51b065548 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/validation/commands/ValidatePublishedEventCommandHandler.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/validation/commands/ValidatePublishedEventCommandHandler.java @@ -1,14 +1,14 @@ package uk.gov.justice.services.eventstore.management.validation.commands; import static java.lang.String.format; -import static uk.gov.justice.services.jmx.api.command.ValidatePublishedEventsCommand.VALIDATE_EVENTS; +import static uk.gov.justice.services.eventstore.management.commands.ValidatePublishedEventsCommand.VALIDATE_EVENTS; import static uk.gov.justice.services.jmx.api.domain.CommandState.COMMAND_FAILED; import static uk.gov.justice.services.jmx.api.domain.CommandState.COMMAND_IN_PROGRESS; import uk.gov.justice.services.common.util.UtcClock; import uk.gov.justice.services.eventstore.management.CommandResult; +import uk.gov.justice.services.eventstore.management.commands.ValidatePublishedEventsCommand; import uk.gov.justice.services.eventstore.management.validation.process.EventValidationProcess; -import uk.gov.justice.services.jmx.api.command.ValidatePublishedEventsCommand; import uk.gov.justice.services.jmx.command.HandlesSystemCommand; import uk.gov.justice.services.jmx.logging.MdcLoggerInterceptor; import uk.gov.justice.services.jmx.state.events.SystemCommandStateChangedEvent; diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/validation/process/SingleEventValidator.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/validation/process/SingleEventValidator.java index 0e9d80bef..9eef5089b 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/validation/process/SingleEventValidator.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/validation/process/SingleEventValidator.java @@ -37,8 +37,13 @@ public Optional validate(final PublishedEvent publishedEvent) { final Schema schema = schemaProvider.getForEvent(eventName); + logger.error(format("Validating event with id '%s'", publishedEvent.getId())); + logger.error(format("Payload '%s'", payload)); + try { schema.validate(jsonObject); + logger.error("event validated successfully"); + } catch (final ValidationException e) { final String message = format( "Event '%s' with id '%s' failed to validate against schema: %s", diff --git a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/verification/commands/VerifyCatchupCommandHandler.java b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/verification/commands/VerifyCatchupCommandHandler.java index 2765d28f2..fa2f8b251 100644 --- a/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/verification/commands/VerifyCatchupCommandHandler.java +++ b/event-store-management/event-store-management-core/src/main/java/uk/gov/justice/services/eventstore/management/verification/commands/VerifyCatchupCommandHandler.java @@ -1,14 +1,14 @@ package uk.gov.justice.services.eventstore.management.verification.commands; import static java.lang.String.format; -import static uk.gov.justice.services.jmx.api.command.VerifyCatchupCommand.VERIFY_CATCHUP; +import static uk.gov.justice.services.eventstore.management.commands.VerifyCatchupCommand.VERIFY_CATCHUP; import static uk.gov.justice.services.jmx.api.domain.CommandState.COMMAND_FAILED; import static uk.gov.justice.services.jmx.api.domain.CommandState.COMMAND_IN_PROGRESS; import uk.gov.justice.services.common.util.UtcClock; import uk.gov.justice.services.eventstore.management.CommandResult; +import uk.gov.justice.services.eventstore.management.commands.VerifyCatchupCommand; import uk.gov.justice.services.eventstore.management.verification.process.CatchupVerificationProcess; -import uk.gov.justice.services.jmx.api.command.VerifyCatchupCommand; import uk.gov.justice.services.jmx.command.HandlesSystemCommand; import uk.gov.justice.services.jmx.logging.MdcLoggerInterceptor; import uk.gov.justice.services.jmx.state.events.SystemCommandStateChangedEvent; diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/commands/CatchupCommandHandlerTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/commands/CatchupCommandHandlerTest.java index dfddd099d..51faf9725 100644 --- a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/commands/CatchupCommandHandlerTest.java +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/commands/CatchupCommandHandlerTest.java @@ -7,9 +7,9 @@ import static org.mockito.Mockito.when; import uk.gov.justice.services.common.util.UtcClock; +import uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.IndexerCatchupCommand; import uk.gov.justice.services.eventstore.management.events.catchup.CatchupRequestedEvent; -import uk.gov.justice.services.jmx.api.command.EventCatchupCommand; -import uk.gov.justice.services.jmx.api.command.IndexerCatchupCommand; import java.time.ZonedDateTime; import java.util.UUID; diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupCompletionEventFirerTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupCompletionEventFirerTest.java index 18793c274..eedd143c8 100644 --- a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupCompletionEventFirerTest.java +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupCompletionEventFirerTest.java @@ -14,8 +14,8 @@ import uk.gov.justice.services.common.util.UtcClock; import uk.gov.justice.services.eventstore.management.CommandResult; import uk.gov.justice.services.eventstore.management.catchup.state.CatchupError; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; -import uk.gov.justice.services.jmx.api.command.EventCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand; import uk.gov.justice.services.jmx.state.events.SystemCommandStateChangedEvent; import java.time.ZonedDateTime; diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupObserverTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupObserverTest.java index add16f004..b5a5d1e21 100644 --- a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupObserverTest.java +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupObserverTest.java @@ -22,12 +22,12 @@ import uk.gov.justice.services.eventstore.management.catchup.state.CatchupError; import uk.gov.justice.services.eventstore.management.catchup.state.CatchupErrorStateManager; import uk.gov.justice.services.eventstore.management.catchup.state.CatchupStateManager; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand; import uk.gov.justice.services.eventstore.management.events.catchup.CatchupCompletedForSubscriptionEvent; import uk.gov.justice.services.eventstore.management.events.catchup.CatchupProcessingOfEventFailedEvent; import uk.gov.justice.services.eventstore.management.events.catchup.CatchupRequestedEvent; import uk.gov.justice.services.eventstore.management.events.catchup.CatchupStartedForSubscriptionEvent; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; -import uk.gov.justice.services.jmx.api.command.EventCatchupCommand; import uk.gov.justice.services.jmx.state.events.SystemCommandStateChangedEvent; import java.time.Duration; diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupProcessCompleterTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupProcessCompleterTest.java index a8d3d0f52..d25696852 100644 --- a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupProcessCompleterTest.java +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/observers/CatchupProcessCompleterTest.java @@ -9,8 +9,8 @@ import uk.gov.justice.services.eventstore.management.catchup.state.CatchupError; import uk.gov.justice.services.eventstore.management.catchup.state.CatchupErrorStateManager; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; -import uk.gov.justice.services.jmx.api.command.EventCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand; import java.util.List; import java.util.UUID; diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/process/CatchupTypeSelectorTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/process/CatchupTypeSelectorTest.java index 83ce87b50..f3fefa6a0 100644 --- a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/process/CatchupTypeSelectorTest.java +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/process/CatchupTypeSelectorTest.java @@ -3,8 +3,8 @@ import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; -import uk.gov.justice.services.jmx.api.command.EventCatchupCommand; -import uk.gov.justice.services.jmx.api.command.IndexerCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.IndexerCatchupCommand; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupByComponentRunnerTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupByComponentRunnerTest.java index 0c935327d..43732a688 100644 --- a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupByComponentRunnerTest.java +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupByComponentRunnerTest.java @@ -7,7 +7,7 @@ import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; -import uk.gov.justice.services.jmx.api.command.EventCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand; import uk.gov.justice.subscription.domain.subscriptiondescriptor.Subscription; import uk.gov.justice.subscription.domain.subscriptiondescriptor.SubscriptionsDescriptor; diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupProcessorTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupProcessorTest.java index f392054fb..62a72c450 100644 --- a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupProcessorTest.java +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupProcessorTest.java @@ -17,10 +17,10 @@ import uk.gov.justice.services.event.sourcing.subscription.catchup.consumer.manager.ConcurrentEventStreamConsumerManager; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.MissingEventNumberException; import uk.gov.justice.services.eventsourcing.repository.jdbc.event.PublishedEvent; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand; import uk.gov.justice.services.eventstore.management.events.catchup.CatchupCompletedForSubscriptionEvent; import uk.gov.justice.services.eventstore.management.events.catchup.CatchupStartedForSubscriptionEvent; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; -import uk.gov.justice.services.jmx.api.command.EventCatchupCommand; import uk.gov.justice.subscription.domain.subscriptiondescriptor.Subscription; import java.time.ZonedDateTime; diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupRunnerTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupRunnerTest.java index ac69453ce..9bdab9edd 100644 --- a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupRunnerTest.java +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/process/EventCatchupRunnerTest.java @@ -6,8 +6,8 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; -import uk.gov.justice.services.jmx.api.command.EventCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand; import uk.gov.justice.subscription.domain.subscriptiondescriptor.SubscriptionsDescriptor; import uk.gov.justice.subscription.registry.SubscriptionsDescriptorsRegistry; diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/process/RunCatchupForComponentSelectorTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/process/RunCatchupForComponentSelectorTest.java index af57b8057..11bb742e5 100644 --- a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/process/RunCatchupForComponentSelectorTest.java +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/process/RunCatchupForComponentSelectorTest.java @@ -4,7 +4,7 @@ import static org.junit.Assert.assertThat; import static org.mockito.Mockito.when; -import uk.gov.justice.services.jmx.api.command.EventCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/state/CatchupErrorStateManagerTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/state/CatchupErrorStateManagerTest.java index c5cb2037d..d170071e5 100644 --- a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/state/CatchupErrorStateManagerTest.java +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/state/CatchupErrorStateManagerTest.java @@ -5,8 +5,8 @@ import static org.junit.Assert.assertThat; import static org.mockito.Mockito.mock; -import uk.gov.justice.services.jmx.api.command.EventCatchupCommand; -import uk.gov.justice.services.jmx.api.command.IndexerCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.IndexerCatchupCommand; import java.util.List; diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/state/CatchupStateManagerTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/state/CatchupStateManagerTest.java index 0ca068824..cc4d4c7af 100644 --- a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/state/CatchupStateManagerTest.java +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/catchup/state/CatchupStateManagerTest.java @@ -7,8 +7,8 @@ import uk.gov.justice.services.common.util.UtcClock; import uk.gov.justice.services.eventstore.management.catchup.process.CatchupInProgress; -import uk.gov.justice.services.jmx.api.command.EventCatchupCommand; -import uk.gov.justice.services.jmx.api.command.IndexerCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.IndexerCatchupCommand; import java.time.ZonedDateTime; import java.util.List; diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/commands/EventCatchupCommandTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/commands/EventCatchupCommandTest.java new file mode 100644 index 000000000..826f63797 --- /dev/null +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/commands/EventCatchupCommandTest.java @@ -0,0 +1,22 @@ +package uk.gov.justice.services.eventstore.management.commands; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.runners.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.class) +public class EventCatchupCommandTest { + + @InjectMocks + private EventCatchupCommand eventCatchupCommand; + + @Test + public void shouldBeEventCatchupCommand() throws Exception { + + assertThat(eventCatchupCommand.isEventCatchup(), is(true)); + } +} diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/commands/IndexerCatchupCommandTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/commands/IndexerCatchupCommandTest.java new file mode 100644 index 000000000..75c5648d0 --- /dev/null +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/commands/IndexerCatchupCommandTest.java @@ -0,0 +1,22 @@ +package uk.gov.justice.services.eventstore.management.commands; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.runners.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.class) +public class IndexerCatchupCommandTest { + + @InjectMocks + private IndexerCatchupCommand indexerCatchupCommand; + + @Test + public void shouldBeIndexerCatchupCommand() throws Exception { + + assertThat(indexerCatchupCommand.isEventCatchup(), is(false)); + } +} diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/publishing/EnablePublishingCommandHandlerTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/publishing/EnablePublishingCommandHandlerTest.java index 4c05196fb..d32efedd3 100644 --- a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/publishing/EnablePublishingCommandHandlerTest.java +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/publishing/EnablePublishingCommandHandlerTest.java @@ -3,8 +3,8 @@ import static java.util.UUID.randomUUID; import static org.mockito.Mockito.verify; -import uk.gov.justice.services.jmx.api.command.DisablePublishingCommand; -import uk.gov.justice.services.jmx.api.command.EnablePublishingCommand; +import uk.gov.justice.services.eventstore.management.commands.DisablePublishingCommand; +import uk.gov.justice.services.eventstore.management.commands.EnablePublishingCommand; import java.util.UUID; diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/publishing/EnablePublishingProcessorTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/publishing/EnablePublishingProcessorTest.java index 976eaa908..41cabc7d0 100644 --- a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/publishing/EnablePublishingProcessorTest.java +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/publishing/EnablePublishingProcessorTest.java @@ -9,8 +9,8 @@ import static uk.gov.justice.services.jmx.api.domain.CommandState.COMMAND_IN_PROGRESS; import uk.gov.justice.services.common.util.UtcClock; -import uk.gov.justice.services.jmx.api.command.EnablePublishingCommand; -import uk.gov.justice.services.jmx.api.command.PublishingCommand; +import uk.gov.justice.services.eventstore.management.commands.EnablePublishingCommand; +import uk.gov.justice.services.eventstore.management.commands.PublishingCommand; import uk.gov.justice.services.jmx.state.events.SystemCommandStateChangedEvent; import java.time.ZonedDateTime; diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/publishing/PublishingEnablerTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/publishing/PublishingEnablerTest.java index b8ecc77b1..2b81189d9 100644 --- a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/publishing/PublishingEnablerTest.java +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/publishing/PublishingEnablerTest.java @@ -4,8 +4,8 @@ import uk.gov.justice.services.eventsourcing.publishedevent.prepublish.PrePublisherTimerConfig; import uk.gov.justice.services.eventsourcing.publishedevent.publishing.PublisherTimerConfig; -import uk.gov.justice.services.jmx.api.command.DisablePublishingCommand; -import uk.gov.justice.services.jmx.api.command.EnablePublishingCommand; +import uk.gov.justice.services.eventstore.management.commands.DisablePublishingCommand; +import uk.gov.justice.services.eventstore.management.commands.EnablePublishingCommand; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/rebuild/commands/RebuildCommandHandlerTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/rebuild/commands/RebuildCommandHandlerTest.java index b631ee0eb..290201867 100644 --- a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/rebuild/commands/RebuildCommandHandlerTest.java +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/rebuild/commands/RebuildCommandHandlerTest.java @@ -14,7 +14,7 @@ import uk.gov.justice.services.common.util.UtcClock; import uk.gov.justice.services.eventsourcing.publishedevent.rebuild.PublishedEventRebuilder; -import uk.gov.justice.services.jmx.api.command.RebuildCommand; +import uk.gov.justice.services.eventstore.management.commands.RebuildCommand; import uk.gov.justice.services.jmx.state.events.SystemCommandStateChangedEvent; import java.time.ZonedDateTime; diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/shuttering/observers/CommandHandlerQueueDrainedShutteringExecutorTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/shuttering/observers/CommandHandlerQueueDrainedShutteringExecutorTest.java index 0b79d6a64..4a3a2acd2 100644 --- a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/shuttering/observers/CommandHandlerQueueDrainedShutteringExecutorTest.java +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/shuttering/observers/CommandHandlerQueueDrainedShutteringExecutorTest.java @@ -11,8 +11,8 @@ import uk.gov.justice.services.eventsourcing.util.jee.timer.StopWatchFactory; import uk.gov.justice.services.eventstore.management.shuttering.process.CommandHandlerQueueInterrogator; -import uk.gov.justice.services.jmx.api.command.ApplicationShutteringCommand; import uk.gov.justice.services.management.shuttering.api.ShutteringResult; +import uk.gov.justice.services.management.shuttering.commands.ApplicationShutteringCommand; import java.util.UUID; diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/shuttering/observers/PublishQueueDrainedShutteringExecutorTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/shuttering/observers/PublishQueueDrainedShutteringExecutorTest.java index 97ae60949..6c82f1d9d 100644 --- a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/shuttering/observers/PublishQueueDrainedShutteringExecutorTest.java +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/shuttering/observers/PublishQueueDrainedShutteringExecutorTest.java @@ -12,8 +12,8 @@ import uk.gov.justice.services.eventsourcing.util.jee.timer.StopWatchFactory; import uk.gov.justice.services.eventstore.management.shuttering.process.PublishQueueInterrogator; -import uk.gov.justice.services.jmx.api.command.ApplicationShutteringCommand; import uk.gov.justice.services.management.shuttering.api.ShutteringResult; +import uk.gov.justice.services.management.shuttering.commands.ApplicationShutteringCommand; import java.util.UUID; diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/trigger/commands/AddRemoveTriggerCommandHandlerTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/trigger/commands/AddRemoveTriggerCommandHandlerTest.java index 13f76064d..f906d087a 100644 --- a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/trigger/commands/AddRemoveTriggerCommandHandlerTest.java +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/trigger/commands/AddRemoveTriggerCommandHandlerTest.java @@ -11,9 +11,9 @@ import static uk.gov.justice.services.jmx.api.domain.CommandState.COMMAND_IN_PROGRESS; import uk.gov.justice.services.common.util.UtcClock; +import uk.gov.justice.services.eventstore.management.commands.AddTriggerCommand; +import uk.gov.justice.services.eventstore.management.commands.RemoveTriggerCommand; import uk.gov.justice.services.eventstore.management.trigger.process.EventLogTriggerManipulator; -import uk.gov.justice.services.jmx.api.command.AddTriggerCommand; -import uk.gov.justice.services.jmx.api.command.RemoveTriggerCommand; import uk.gov.justice.services.jmx.state.events.SystemCommandStateChangedEvent; import java.time.ZonedDateTime; diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/validation/commands/ValidatePublishedEventCommandHandlerTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/validation/commands/ValidatePublishedEventCommandHandlerTest.java index a771fc8f5..93aeec83c 100644 --- a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/validation/commands/ValidatePublishedEventCommandHandlerTest.java +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/validation/commands/ValidatePublishedEventCommandHandlerTest.java @@ -12,8 +12,8 @@ import uk.gov.justice.services.common.util.UtcClock; import uk.gov.justice.services.eventstore.management.CommandResult; +import uk.gov.justice.services.eventstore.management.commands.ValidatePublishedEventsCommand; import uk.gov.justice.services.eventstore.management.validation.process.EventValidationProcess; -import uk.gov.justice.services.jmx.api.command.ValidatePublishedEventsCommand; import uk.gov.justice.services.jmx.state.events.SystemCommandStateChangedEvent; import java.time.ZonedDateTime; diff --git a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/verification/commands/VerifyCatchupCommandHandlerTest.java b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/verification/commands/VerifyCatchupCommandHandlerTest.java index 2b3b2ba63..c04d57174 100644 --- a/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/verification/commands/VerifyCatchupCommandHandlerTest.java +++ b/event-store-management/event-store-management-core/src/test/java/uk/gov/justice/services/eventstore/management/verification/commands/VerifyCatchupCommandHandlerTest.java @@ -12,8 +12,8 @@ import uk.gov.justice.services.common.util.UtcClock; import uk.gov.justice.services.eventstore.management.CommandResult; +import uk.gov.justice.services.eventstore.management.commands.VerifyCatchupCommand; import uk.gov.justice.services.eventstore.management.verification.process.CatchupVerificationProcess; -import uk.gov.justice.services.jmx.api.command.VerifyCatchupCommand; import uk.gov.justice.services.jmx.state.events.SystemCommandStateChangedEvent; import java.time.ZonedDateTime; diff --git a/event-store-management/event-store-management-events/pom.xml b/event-store-management/event-store-management-events/pom.xml index 2f349288f..7d539f7de 100644 --- a/event-store-management/event-store-management-events/pom.xml +++ b/event-store-management/event-store-management-events/pom.xml @@ -17,6 +17,11 @@ jmx-api ${framework.version} + + uk.gov.justice.event-store + event-store-management-commands + ${project.version} + diff --git a/event-store-management/event-store-management-events/src/main/java/uk/gov/justice/services/eventstore/management/events/catchup/CatchupCompletedForSubscriptionEvent.java b/event-store-management/event-store-management-events/src/main/java/uk/gov/justice/services/eventstore/management/events/catchup/CatchupCompletedForSubscriptionEvent.java index 6b7116038..88ee2a96a 100644 --- a/event-store-management/event-store-management-events/src/main/java/uk/gov/justice/services/eventstore/management/events/catchup/CatchupCompletedForSubscriptionEvent.java +++ b/event-store-management/event-store-management-events/src/main/java/uk/gov/justice/services/eventstore/management/events/catchup/CatchupCompletedForSubscriptionEvent.java @@ -1,6 +1,6 @@ package uk.gov.justice.services.eventstore.management.events.catchup; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import java.time.ZonedDateTime; import java.util.Objects; diff --git a/event-store-management/event-store-management-events/src/main/java/uk/gov/justice/services/eventstore/management/events/catchup/CatchupProcessingOfEventFailedEvent.java b/event-store-management/event-store-management-events/src/main/java/uk/gov/justice/services/eventstore/management/events/catchup/CatchupProcessingOfEventFailedEvent.java index fcd26fbb6..a8a6ee47c 100644 --- a/event-store-management/event-store-management-events/src/main/java/uk/gov/justice/services/eventstore/management/events/catchup/CatchupProcessingOfEventFailedEvent.java +++ b/event-store-management/event-store-management-events/src/main/java/uk/gov/justice/services/eventstore/management/events/catchup/CatchupProcessingOfEventFailedEvent.java @@ -1,6 +1,6 @@ package uk.gov.justice.services.eventstore.management.events.catchup; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import java.util.Objects; import java.util.UUID; diff --git a/event-store-management/event-store-management-events/src/main/java/uk/gov/justice/services/eventstore/management/events/catchup/CatchupRequestedEvent.java b/event-store-management/event-store-management-events/src/main/java/uk/gov/justice/services/eventstore/management/events/catchup/CatchupRequestedEvent.java index a53e97192..f730b3763 100644 --- a/event-store-management/event-store-management-events/src/main/java/uk/gov/justice/services/eventstore/management/events/catchup/CatchupRequestedEvent.java +++ b/event-store-management/event-store-management-events/src/main/java/uk/gov/justice/services/eventstore/management/events/catchup/CatchupRequestedEvent.java @@ -1,6 +1,6 @@ package uk.gov.justice.services.eventstore.management.events.catchup; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import java.time.ZonedDateTime; import java.util.Objects; diff --git a/event-store-management/event-store-management-events/src/main/java/uk/gov/justice/services/eventstore/management/events/catchup/CatchupStartedForSubscriptionEvent.java b/event-store-management/event-store-management-events/src/main/java/uk/gov/justice/services/eventstore/management/events/catchup/CatchupStartedForSubscriptionEvent.java index 1dca6ecec..0067e745f 100644 --- a/event-store-management/event-store-management-events/src/main/java/uk/gov/justice/services/eventstore/management/events/catchup/CatchupStartedForSubscriptionEvent.java +++ b/event-store-management/event-store-management-events/src/main/java/uk/gov/justice/services/eventstore/management/events/catchup/CatchupStartedForSubscriptionEvent.java @@ -1,6 +1,6 @@ package uk.gov.justice.services.eventstore.management.events.catchup; -import uk.gov.justice.services.jmx.api.command.CatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.CatchupCommand; import java.time.ZonedDateTime; import java.util.Objects; diff --git a/event-store-management/pom.xml b/event-store-management/pom.xml index 2fe6c0a34..2e1630adb 100644 --- a/event-store-management/pom.xml +++ b/event-store-management/pom.xml @@ -15,6 +15,7 @@ event-store-management-core event-store-management-events + event-store-management-commands diff --git a/pom.xml b/pom.xml index cb128f9f1..a3e0099b1 100644 --- a/pom.xml +++ b/pom.xml @@ -40,7 +40,7 @@ event-store 4.1.0 - 6.2.5 + 6.3.0 2.4.0 1.7.6 1.20.3 diff --git a/test-utils-event-store/test-utils-event/pom.xml b/test-utils-event-store/test-utils-event/pom.xml index 0c761dc07..6e1493177 100644 --- a/test-utils-event-store/test-utils-event/pom.xml +++ b/test-utils-event-store/test-utils-event/pom.xml @@ -32,6 +32,21 @@ event-domain ${project.version} + + uk.gov.justice.services + jmx-command-client + ${framework.version} + + + uk.gov.justice.services + test-utils-jmx + ${framework.version} + + + uk.gov.justice.event-store + event-store-management-commands + ${project.version} + diff --git a/test-utils-event-store/test-utils-event/src/main/java/uk/gov/justice/services/test/utils/jmx/EventStoreSystemCommandCaller.java b/test-utils-event-store/test-utils-event/src/main/java/uk/gov/justice/services/test/utils/jmx/EventStoreSystemCommandCaller.java new file mode 100644 index 000000000..ab1560013 --- /dev/null +++ b/test-utils-event-store/test-utils-event/src/main/java/uk/gov/justice/services/test/utils/jmx/EventStoreSystemCommandCaller.java @@ -0,0 +1,86 @@ +package uk.gov.justice.services.test.utils.jmx; + +import static uk.gov.justice.services.jmx.system.command.client.connection.JmxParametersBuilder.jmxParameters; +import static uk.gov.justice.services.test.utils.common.host.TestHostProvider.getHost; + +import uk.gov.justice.services.eventstore.management.commands.AddTriggerCommand; +import uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.IndexerCatchupCommand; +import uk.gov.justice.services.eventstore.management.commands.RebuildCommand; +import uk.gov.justice.services.eventstore.management.commands.RemoveTriggerCommand; +import uk.gov.justice.services.eventstore.management.commands.ValidatePublishedEventsCommand; +import uk.gov.justice.services.eventstore.management.commands.VerifyCatchupCommand; +import uk.gov.justice.services.jmx.api.command.SystemCommand; +import uk.gov.justice.services.jmx.system.command.client.SystemCommanderClient; +import uk.gov.justice.services.jmx.system.command.client.TestSystemCommanderClientFactory; +import uk.gov.justice.services.jmx.system.command.client.connection.JmxParameters; + +import com.google.common.annotations.VisibleForTesting; + +public class EventStoreSystemCommandCaller { + + private static final String HOST = getHost(); + private static final int JMX_PORT = 9990; + private static final String USERNAME = "admin"; + + @SuppressWarnings("squid:S2068") + private static final String PASSWORD = "admin"; + + + private final TestSystemCommanderClientFactory testSystemCommanderClientFactory; + private final JmxParameters jmxParameters; + + public EventStoreSystemCommandCaller(final String contextName) { + this(jmxParameters() + .withContextName(contextName) + .withHost(HOST) + .withPort(JMX_PORT) + .withUsername(USERNAME) + .withPassword(PASSWORD) + .build()); + } + + public EventStoreSystemCommandCaller(final JmxParameters jmxParameters) { + this(jmxParameters, new TestSystemCommanderClientFactory()); + } + + @VisibleForTesting + EventStoreSystemCommandCaller(final JmxParameters jmxParameters, final TestSystemCommanderClientFactory testSystemCommanderClientFactory) { + this.jmxParameters = jmxParameters; + this.testSystemCommanderClientFactory = testSystemCommanderClientFactory; + } + + public void callRebuild() { + callSystemCommand(new RebuildCommand()); + } + + public void callCatchup() { + callSystemCommand(new EventCatchupCommand()); + } + + public void callIndexerCatchup() { + callSystemCommand(new IndexerCatchupCommand()); + } + + public void callAddTrigger() { + callSystemCommand(new AddTriggerCommand()); + } + + public void callRemoveTrigger() { + callSystemCommand(new RemoveTriggerCommand()); + } + + public void callValidateCatchup() { + callSystemCommand(new VerifyCatchupCommand()); + } + + public void callValidatePublishedEvents() { + callSystemCommand(new ValidatePublishedEventsCommand()); + } + + private void callSystemCommand(final SystemCommand systemCommand) { + try (final SystemCommanderClient systemCommanderClient = testSystemCommanderClientFactory.create(jmxParameters)) { + systemCommanderClient.getRemote(jmxParameters.getContextName()).call(systemCommand.getName()); + } + } +} diff --git a/test-utils-event-store/test-utils-event/src/test/java/uk/gov/justice/services/test/utils/jmx/EventStoreSystemCommandCallerTest.java b/test-utils-event-store/test-utils-event/src/test/java/uk/gov/justice/services/test/utils/jmx/EventStoreSystemCommandCallerTest.java new file mode 100644 index 000000000..51bc370f9 --- /dev/null +++ b/test-utils-event-store/test-utils-event/src/test/java/uk/gov/justice/services/test/utils/jmx/EventStoreSystemCommandCallerTest.java @@ -0,0 +1,206 @@ +package uk.gov.justice.services.test.utils.jmx; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import static uk.gov.justice.services.eventstore.management.commands.AddTriggerCommand.ADD_TRIGGER; +import static uk.gov.justice.services.eventstore.management.commands.EventCatchupCommand.CATCHUP; +import static uk.gov.justice.services.eventstore.management.commands.IndexerCatchupCommand.INDEXER_CATCHUP; +import static uk.gov.justice.services.eventstore.management.commands.RebuildCommand.REBUILD; +import static uk.gov.justice.services.eventstore.management.commands.RemoveTriggerCommand.REMOVE_TRIGGER; +import static uk.gov.justice.services.eventstore.management.commands.ValidatePublishedEventsCommand.VALIDATE_EVENTS; +import static uk.gov.justice.services.eventstore.management.commands.VerifyCatchupCommand.VERIFY_CATCHUP; +import static uk.gov.justice.services.test.utils.common.host.TestHostProvider.getHost; +import static uk.gov.justice.services.test.utils.core.reflection.ReflectionUtil.getValueOfField; + +import uk.gov.justice.services.jmx.api.mbean.SystemCommanderMBean; +import uk.gov.justice.services.jmx.system.command.client.SystemCommanderClient; +import uk.gov.justice.services.jmx.system.command.client.TestSystemCommanderClientFactory; +import uk.gov.justice.services.jmx.system.command.client.connection.Credentials; +import uk.gov.justice.services.jmx.system.command.client.connection.JmxParameters; + +import java.util.Optional; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.class) +public class EventStoreSystemCommandCallerTest { + + @Mock + private TestSystemCommanderClientFactory testSystemCommanderClientFactory; + + @Test + public void shouldCallRebuild() throws Exception { + + final String contextName = "contextName"; + + final JmxParameters jmxParameters = mock(JmxParameters.class); + final SystemCommanderClient systemCommanderClient = mock(SystemCommanderClient.class); + final SystemCommanderMBean systemCommanderMBean = mock(SystemCommanderMBean.class); + + final EventStoreSystemCommandCaller eventStoreSystemCommandCaller = new EventStoreSystemCommandCaller(jmxParameters, testSystemCommanderClientFactory); + + when(jmxParameters.getContextName()).thenReturn(contextName); + when(testSystemCommanderClientFactory.create(jmxParameters)).thenReturn(systemCommanderClient); + when(systemCommanderClient.getRemote(contextName)).thenReturn(systemCommanderMBean); + + eventStoreSystemCommandCaller.callRebuild(); + + verify(systemCommanderMBean).call(REBUILD); + verify(systemCommanderClient).close(); + } + + @Test + public void shouldCallCatchup() throws Exception { + + final String contextName = "contextName"; + + final JmxParameters jmxParameters = mock(JmxParameters.class); + final SystemCommanderClient systemCommanderClient = mock(SystemCommanderClient.class); + final SystemCommanderMBean systemCommanderMBean = mock(SystemCommanderMBean.class); + + final EventStoreSystemCommandCaller eventStoreSystemCommandCaller = new EventStoreSystemCommandCaller(jmxParameters, testSystemCommanderClientFactory); + + when(jmxParameters.getContextName()).thenReturn(contextName); + when(testSystemCommanderClientFactory.create(jmxParameters)).thenReturn(systemCommanderClient); + when(systemCommanderClient.getRemote(contextName)).thenReturn(systemCommanderMBean); + + eventStoreSystemCommandCaller.callCatchup(); + + verify(systemCommanderMBean).call(CATCHUP); + verify(systemCommanderClient).close(); + } + + @Test + public void shouldCallIndexerCatchup() throws Exception { + + final String contextName = "contextName"; + + final JmxParameters jmxParameters = mock(JmxParameters.class); + final SystemCommanderClient systemCommanderClient = mock(SystemCommanderClient.class); + final SystemCommanderMBean systemCommanderMBean = mock(SystemCommanderMBean.class); + + final EventStoreSystemCommandCaller eventStoreSystemCommandCaller = new EventStoreSystemCommandCaller(jmxParameters, testSystemCommanderClientFactory); + + when(jmxParameters.getContextName()).thenReturn(contextName); + when(testSystemCommanderClientFactory.create(jmxParameters)).thenReturn(systemCommanderClient); + when(systemCommanderClient.getRemote(contextName)).thenReturn(systemCommanderMBean); + + eventStoreSystemCommandCaller.callIndexerCatchup(); + + verify(systemCommanderMBean).call(INDEXER_CATCHUP); + verify(systemCommanderClient).close(); + } + + @Test + public void shouldCallAddTrigger() throws Exception { + + final String contextName = "contextName"; + + final JmxParameters jmxParameters = mock(JmxParameters.class); + final SystemCommanderClient systemCommanderClient = mock(SystemCommanderClient.class); + final SystemCommanderMBean systemCommanderMBean = mock(SystemCommanderMBean.class); + + final EventStoreSystemCommandCaller eventStoreSystemCommandCaller = new EventStoreSystemCommandCaller(jmxParameters, testSystemCommanderClientFactory); + + when(jmxParameters.getContextName()).thenReturn(contextName); + when(testSystemCommanderClientFactory.create(jmxParameters)).thenReturn(systemCommanderClient); + when(systemCommanderClient.getRemote(contextName)).thenReturn(systemCommanderMBean); + + eventStoreSystemCommandCaller.callAddTrigger(); + + verify(systemCommanderMBean).call(ADD_TRIGGER); + verify(systemCommanderClient).close(); + } + + @Test + public void shouldCallRemoveTrigger() throws Exception { + + final String contextName = "contextName"; + + final JmxParameters jmxParameters = mock(JmxParameters.class); + final SystemCommanderClient systemCommanderClient = mock(SystemCommanderClient.class); + final SystemCommanderMBean systemCommanderMBean = mock(SystemCommanderMBean.class); + + final EventStoreSystemCommandCaller eventStoreSystemCommandCaller = new EventStoreSystemCommandCaller(jmxParameters, testSystemCommanderClientFactory); + + when(jmxParameters.getContextName()).thenReturn(contextName); + when(testSystemCommanderClientFactory.create(jmxParameters)).thenReturn(systemCommanderClient); + when(systemCommanderClient.getRemote(contextName)).thenReturn(systemCommanderMBean); + + eventStoreSystemCommandCaller.callRemoveTrigger(); + + verify(systemCommanderMBean).call(REMOVE_TRIGGER); + verify(systemCommanderClient).close(); + } + + @Test + public void shouldCallValidateCatchup() throws Exception { + + final String contextName = "contextName"; + + final JmxParameters jmxParameters = mock(JmxParameters.class); + final SystemCommanderClient systemCommanderClient = mock(SystemCommanderClient.class); + final SystemCommanderMBean systemCommanderMBean = mock(SystemCommanderMBean.class); + + final EventStoreSystemCommandCaller eventStoreSystemCommandCaller = new EventStoreSystemCommandCaller(jmxParameters, testSystemCommanderClientFactory); + + when(jmxParameters.getContextName()).thenReturn(contextName); + when(testSystemCommanderClientFactory.create(jmxParameters)).thenReturn(systemCommanderClient); + when(systemCommanderClient.getRemote(contextName)).thenReturn(systemCommanderMBean); + + eventStoreSystemCommandCaller.callValidateCatchup(); + + verify(systemCommanderMBean).call(VERIFY_CATCHUP); + verify(systemCommanderClient).close(); + } + + @Test + public void shouldCallValidatePublishedEvents() throws Exception { + + final String contextName = "contextName"; + + final JmxParameters jmxParameters = mock(JmxParameters.class); + final SystemCommanderClient systemCommanderClient = mock(SystemCommanderClient.class); + final SystemCommanderMBean systemCommanderMBean = mock(SystemCommanderMBean.class); + + final EventStoreSystemCommandCaller eventStoreSystemCommandCaller = new EventStoreSystemCommandCaller(jmxParameters, testSystemCommanderClientFactory); + + when(jmxParameters.getContextName()).thenReturn(contextName); + when(testSystemCommanderClientFactory.create(jmxParameters)).thenReturn(systemCommanderClient); + when(systemCommanderClient.getRemote(contextName)).thenReturn(systemCommanderMBean); + + eventStoreSystemCommandCaller.callValidatePublishedEvents(); + + verify(systemCommanderMBean).call(VALIDATE_EVENTS); + verify(systemCommanderClient).close(); + } + + @Test + public void shouldCreateWithCorrectDefaultParametersIfInstantiatingUsingTheContextName() throws Exception { + + final String contextName = "contextName"; + final EventStoreSystemCommandCaller eventStoreSystemCommandCaller = new EventStoreSystemCommandCaller(contextName); + + final JmxParameters jmxParameters = getValueOfField(eventStoreSystemCommandCaller, "jmxParameters", JmxParameters.class); + + assertThat(jmxParameters.getContextName(), is(contextName)); + assertThat(jmxParameters.getHost(), is(getHost())); + assertThat(jmxParameters.getPort(), is(9990)); + + final Optional credentials = jmxParameters.getCredentials(); + + if (credentials.isPresent()) { + assertThat(credentials.get().getUsername(), is("admin")); + assertThat(credentials.get().getPassword(), is("admin")); + } else { + fail(); + } + } +}