Skip to content

Commit

Permalink
Update framework to 6.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
amckenzie committed Aug 21, 2019
1 parent cae5e13 commit fcab615
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@

public class CatchupPerformanceIT {

private static final String CONTEXT_NAME = "example";

private final DataSource eventStoreDataSource = new DatabaseManager().initEventStoreDb();
private final DataSource viewStoreDataSource = new DatabaseManager().initViewStoreDb();
private final EventJdbcRepository eventJdbcRepository = new EventRepositoryFactory().getEventJdbcRepository(eventStoreDataSource);
Expand Down Expand Up @@ -166,15 +168,14 @@ private void addEventsToEventLog(final int numberOfStreams, final int numberOfEv

private void runCatchup() throws Exception {

final String contextName = "example-single";
final JmxParameters jmxParameters = jmxParameters()
.withHost(HOST)
.withPort(PORT)
.build();

try (final SystemCommanderClient systemCommanderClient = systemCommanderClientFactory.create(jmxParameters)) {

systemCommanderClient.getRemote(contextName).call(new CatchupCommand());
systemCommanderClient.getRemote(CONTEXT_NAME).call(new CatchupCommand());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
import org.junit.Test;

public class IndexerCatchUpIT {

private static final String CONTEXT_NAME = "example";

private final DataSource eventStoreDataSource = new DatabaseManager().initEventStoreDb();
private final DataSource viewStoreDataSource = new DatabaseManager().initViewStoreDb();
private final EventJdbcRepository eventJdbcRepository = new EventRepositoryFactory().getEventJdbcRepository(eventStoreDataSource);
Expand Down Expand Up @@ -162,15 +165,14 @@ private List<UUID> addEventsToEventLog(final int numberOfStreams) throws Invalid

private void runCatchup() throws Exception {

final String contextName = "example-single";
final JmxParameters jmxParameters = jmxParameters()
.withHost(HOST)
.withPort(PORT)
.build();

try (final SystemCommanderClient systemCommanderClient = testSystemCommanderClientFactory.create(jmxParameters)) {

systemCommanderClient.getRemote(contextName).call(new IndexerCatchupCommand());
systemCommanderClient.getRemote(CONTEXT_NAME).call(new IndexerCatchupCommand());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

import uk.gov.justice.services.jmx.api.command.CatchupCommand;
import uk.gov.justice.services.jmx.api.command.IndexerCatchupCommand;
import uk.gov.justice.services.jmx.api.command.PingSystemCommand;
import uk.gov.justice.services.jmx.api.command.PingCommand;
import uk.gov.justice.services.jmx.api.command.RebuildCommand;
import uk.gov.justice.services.jmx.api.command.ShutterSystemCommand;
import uk.gov.justice.services.jmx.api.command.ShutterCommand;
import uk.gov.justice.services.jmx.api.command.SystemCommand;
import uk.gov.justice.services.jmx.api.command.UnshutterSystemCommand;
import uk.gov.justice.services.jmx.api.command.UnshutterCommand;
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;
Expand All @@ -27,27 +27,27 @@ public class ListSystemCommandsIT {

private static final String HOST = getHost();
private static final int PORT = valueOf(getProperty("random.management.port"));
private static final String CONTEXT_NAME = "example";


private final TestSystemCommanderClientFactory testSystemCommanderClientFactory = new TestSystemCommanderClientFactory();

@Test
public void shouldListAllSystemCommands() throws Exception {

final String contextName = "example-single";
final JmxParameters jmxParameters = jmxParameters()
.withHost(HOST)
.withPort(PORT)
.build();

try (final SystemCommanderClient systemCommanderClient = testSystemCommanderClientFactory.create(jmxParameters)) {

final List<SystemCommand> systemCommands = systemCommanderClient.getRemote(contextName).listCommands();
final List<SystemCommand> systemCommands = systemCommanderClient.getRemote(CONTEXT_NAME).listCommands();

assertThat(systemCommands.size(), is(6));
assertThat(systemCommands, hasItem(new PingSystemCommand()));
assertThat(systemCommands, hasItem(new ShutterSystemCommand()));
assertThat(systemCommands, hasItem(new UnshutterSystemCommand()));
assertThat(systemCommands, hasItem(new PingCommand()));
assertThat(systemCommands, hasItem(new ShutterCommand()));
assertThat(systemCommands, hasItem(new UnshutterCommand()));
assertThat(systemCommands, hasItem(new RebuildCommand()));
assertThat(systemCommands, hasItem(new CatchupCommand()));
assertThat(systemCommands, hasItem(new IndexerCatchupCommand()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

public class RebuildIT {

private static final String CONTEXT_NAME = "example";
private final DataSource eventStoreDataSource = new DatabaseManager().initEventStoreDb();
private final EventFactory eventFactory = new EventFactory();
private final DatabaseCleaner databaseCleaner = new DatabaseCleaner();
Expand Down Expand Up @@ -106,14 +107,13 @@ public void shouldRenumberTheEventLogTableAndRebuldPublishedEvents() throws Exce

private void invokeRebuild() throws Exception {

final String contextName = "example-single";
final JmxParameters jmxParameters = jmxParameters()
.withHost(HOST)
.withPort(PORT)
.build();

try(final SystemCommanderClient systemCommanderClient = testSystemCommanderClientFactory.create(jmxParameters)) {
systemCommanderClient.getRemote(contextName).call(new RebuildCommand());
systemCommanderClient.getRemote(CONTEXT_NAME).call(new RebuildCommand());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static com.jayway.awaitility.Awaitility.await;
import static com.jayway.jsonassert.JsonAssert.with;
import static java.lang.Integer.parseInt;
import static java.lang.Integer.valueOf;
import static java.lang.String.format;
import static java.lang.System.getProperty;
import static java.util.Optional.empty;
Expand All @@ -26,8 +25,8 @@
import uk.gov.justice.services.example.cakeshop.it.helpers.EventFactory;
import uk.gov.justice.services.example.cakeshop.it.helpers.Querier;
import uk.gov.justice.services.example.cakeshop.it.helpers.RestEasyClientFactory;
import uk.gov.justice.services.jmx.api.command.ShutterSystemCommand;
import uk.gov.justice.services.jmx.api.command.UnshutterSystemCommand;
import uk.gov.justice.services.jmx.api.command.ShutterCommand;
import uk.gov.justice.services.jmx.api.command.UnshutterCommand;
import uk.gov.justice.services.jmx.api.mbean.SystemCommanderMBean;
import uk.gov.justice.services.jmx.api.state.ApplicationManagementState;
import uk.gov.justice.services.jmx.system.command.client.SystemCommanderClient;
Expand All @@ -48,6 +47,8 @@

public class ShutteringIT {

private static final String CONTEXT_NAME = "example";

private static final Logger logger = getLogger(ShutteringIT.class);
private static final String MARBLE_CAKE = "Marble cake";
private static final String CARROT_CAKE = "Carrot cake";
Expand Down Expand Up @@ -81,16 +82,15 @@ public void cleanup() throws Exception {

//invoke unshuttering - Always ensure unshutter is invoked as we cannot guarantee order of execution for other Cakeshop ITs

final String contextName = "example-single";
final JmxParameters jmxParameters = jmxParameters()
.withHost(HOST)
.withPort(PORT)
.build();
try (final SystemCommanderClient systemCommanderClient = testSystemCommanderClientFactory.create(jmxParameters)) {

final SystemCommanderMBean systemCommanderMBean = systemCommanderClient.getRemote(contextName);
final SystemCommanderMBean systemCommanderMBean = systemCommanderClient.getRemote(CONTEXT_NAME);

systemCommanderMBean.call(new UnshutterSystemCommand());
systemCommanderMBean.call(new UnshutterCommand());

final Optional<ApplicationManagementState> applicationManagementState = poller.pollUntilFound(() -> {
final ApplicationManagementState applicationState = systemCommanderMBean.getApplicationState();
Expand All @@ -111,14 +111,13 @@ public void cleanup() throws Exception {
public void shouldNotReturnRecipesAfterShuttering() throws Exception {

//invoke shuttering
final String contextName = "example-single";
final JmxParameters jmxParameters = jmxParameters()
.withHost(HOST)
.withPort(PORT)
.build();
try (final SystemCommanderClient systemCommanderClient = testSystemCommanderClientFactory.create(jmxParameters)) {
final SystemCommanderMBean systemCommanderMBean = systemCommanderClient.getRemote(contextName);
systemCommanderMBean.call(new ShutterSystemCommand());
final SystemCommanderMBean systemCommanderMBean = systemCommanderClient.getRemote(CONTEXT_NAME);
systemCommanderMBean.call(new ShutterCommand());

final Optional<ApplicationManagementState> applicationManagementState = poller.pollUntilFound(() -> {
final ApplicationManagementState applicationState = systemCommanderMBean.getApplicationState();
Expand Down Expand Up @@ -148,17 +147,16 @@ public void shouldNotReturnRecipesAfterShuttering() throws Exception {
@Test
public void shouldQueryForRecipesAfterUnShuttering() throws Exception {

final String contextName = "example-single";
final JmxParameters jmxParameters = jmxParameters()
.withHost(HOST)
.withPort(PORT)
.build();
try (final SystemCommanderClient systemCommanderClient = testSystemCommanderClientFactory.create(jmxParameters)) {

final SystemCommanderMBean systemCommanderMBean = systemCommanderClient.getRemote(contextName);
final SystemCommanderMBean systemCommanderMBean = systemCommanderClient.getRemote(CONTEXT_NAME);

//invoke shuttering
systemCommanderMBean.call(new ShutterSystemCommand());
systemCommanderMBean.call(new ShutterCommand());

final Optional<ApplicationManagementState> applicationManagementState = poller.pollUntilFound(() -> {
final ApplicationManagementState applicationState1 = systemCommanderMBean.getApplicationState();
Expand All @@ -183,7 +181,7 @@ public void shouldQueryForRecipesAfterUnShuttering() throws Exception {
verifyRecipeAdded(recipeId, recipeId2, null, null, false, NOT_FOUND);

//invoke unshuttering
systemCommanderMBean.call(new UnshutterSystemCommand());
systemCommanderMBean.call(new UnshutterCommand());

final Optional<ApplicationManagementState> otherApplicationManagementState = poller.pollUntilFound(() -> {
final ApplicationManagementState applicationState = systemCommanderMBean.getApplicationState();
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
<cpp.repo.name>cake-shop</cpp.repo.name>

<framework-api.version>4.0.1</framework-api.version>
<framework.version>6.0.6</framework.version>
<event-store.version>2.0.6</event-store.version>
<framework-generators.version>2.0.4</framework-generators.version>
<framework.version>6.0.9</framework.version>
<event-store.version>2.0.9</event-store.version>
<framework-generators.version>2.0.6</framework-generators.version>
<file.service.version>1.17.11</file.service.version>

<common-bom.version>2.4.0</common-bom.version>
Expand Down

0 comments on commit fcab615

Please sign in to comment.