Skip to content

Commit

Permalink
Exctract the process suspenders for command handler into their own jar
Browse files Browse the repository at this point in the history
  • Loading branch information
amckenzie committed Jan 24, 2020
1 parent a0a8556 commit 16bf606
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>event-store-management</artifactId>
<groupId>uk.gov.justice.event-store</groupId>
<version>2.4.7-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>event-store-management-command-handler-extension</artifactId>

<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>uk.gov.justice.services</groupId>
<artifactId>framework-management</artifactId>
<version>${framework.version}</version>
</dependency>
<dependency>
<groupId>uk.gov.justice.event-store</groupId>
<artifactId>event-store-util</artifactId>
<version>${project.version}</version>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package uk.gov.justice.services.eventstore.management.shuttering.observers;
package uk.gov.justice.services.eventstore.management.extension.suspension;

import static java.lang.String.format;
import static uk.gov.justice.services.management.suspension.api.SuspensionResult.suspensionFailed;
import static uk.gov.justice.services.management.suspension.api.SuspensionResult.suspensionSucceeded;

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.management.suspension.api.Suspendable;
import uk.gov.justice.services.management.suspension.api.SuspensionResult;
import uk.gov.justice.services.management.suspension.commands.SuspensionCommand;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.services.eventstore.management.shuttering.process;
package uk.gov.justice.services.eventstore.management.extension.suspension;

import uk.gov.justice.services.common.polling.MultiIteratingPoller;
import uk.gov.justice.services.common.polling.MultiIteratingPollerFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.services.eventstore.management.shuttering.process;
package uk.gov.justice.services.eventstore.management.extension.suspension;

import uk.gov.justice.services.messaging.jms.JmsCommandHandlerDestinationNameProvider;
import uk.gov.justice.services.messaging.jms.JmsQueueBrowser;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package uk.gov.justice.services.eventstore.management.shuttering.observers;
package uk.gov.justice.services.eventstore.management.extension.suspension;

import static java.util.Optional.empty;
import static java.util.UUID.randomUUID;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.inOrder;
Expand All @@ -10,7 +11,6 @@
import static uk.gov.justice.services.jmx.api.domain.CommandState.COMMAND_FAILED;

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.management.suspension.api.SuspensionResult;
import uk.gov.justice.services.management.suspension.commands.SuspensionCommand;

Expand Down Expand Up @@ -50,7 +50,7 @@ public void shouldSuspendButNotUnsuspend() throws Exception {
@Test
public void shouldWaitForCommandHandlerQueueToDrainAndReturnSuccess() throws Exception {

final UUID commandId = UUID.randomUUID();
final UUID commandId = randomUUID();
final StopWatch stopWatch = mock(StopWatch.class);
final SuspensionCommand suspensionCommand = mock(SuspensionCommand.class);

Expand Down Expand Up @@ -79,7 +79,7 @@ public void shouldWaitForCommandHandlerQueueToDrainAndReturnSuccess() throws Exc
@Test
public void shouldReturnFailureIfQueueDoesNotDrainInTime() throws Exception {

final UUID commandId = UUID.randomUUID();
final UUID commandId = randomUUID();
final StopWatch stopWatch = mock(StopWatch.class);
final SuspensionCommand applicationShutteringCommand = mock(SuspensionCommand.class);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.services.eventstore.management.shuttering.process;
package uk.gov.justice.services.eventstore.management.extension.suspension;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package uk.gov.justice.services.eventstore.management.shuttering.process;
package uk.gov.justice.services.eventstore.management.extension.suspension;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@
import java.util.UUID;

import org.apache.commons.lang3.time.StopWatch;
import org.hamcrest.CoreMatchers;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InOrder;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
import org.slf4j.Logger;

Expand Down
1 change: 1 addition & 0 deletions event-store-management/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<module>event-store-management-core</module>
<module>event-store-management-events</module>
<module>event-store-management-commands</module>
<module>event-store-management-command-handler-extension</module>
</modules>

</project>

0 comments on commit 16bf606

Please sign in to comment.