Skip to content

Commit

Permalink
Merge a3de563 into 844279c
Browse files Browse the repository at this point in the history
  • Loading branch information
mapingo committed Jan 9, 2019
2 parents 844279c + a3de563 commit 3784bc9
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 54 deletions.
17 changes: 11 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@ on [Keep a CHANGELOG](http://keepachangelog.com/). This project adheres to

## [Unreleased]

## [1.1.0] - 2019-01-09

### Changed
- Update framework-api to 3.1.0-M2
- Update framework to 5.1.0-M3
- Update framework-domain to 1.1.0-M3
- Update event-store to 1.1.0-M1
- Update framework-generators to 1.1.0-M1
- Update test-utils to 1.19.0
- Update framework-api to 3.1.0
- Update framework to 5.1.0
- Update framework-domain to 1.1.0
- Update event-store to 1.1.0
- Update framework-generators to 1.1.0
- Update utilities to 1.16.2
- Update test-utils to 1.19.1
- Update file-service to 1.17.2
- Update json-schema-catalog to 1.4.3

### Added
- Liquibase script to add events into event_log before startup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
event_sources:
- name: private.event.source
- name: event.source
is_default: true
location:
jms_uri: jms:topic:example.event
rest_uri: http://localhost:8080/example/event-source-api/rest
data_source: java:/app/example/DS.eventstore

data_source: java:/app/example-single/DS.eventstore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ subscriptions_descriptor:

- name: example.recipe-photograph-added
schema_uri: http://justice.gov.uk/example/event/example.recipe-photograph-added.json
event_source_name: private.event.source
event_source_name: event.source


Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ event_sources:
location:
jms_uri: jms:topic:example.event
rest_uri: http://localhost:8080/example/event-source-api/rest
data_source: java:/app/example/DS.eventstore
data_source: java:/app/example-single/DS.eventstore

Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,4 @@ event_sources:
location:
jms_uri: jms:topic:other.event
rest_uri: http://localhost:8080/example/event-source-api/rest
data_source: java:/app/example/DS.eventstore
- name: event.source
is_default: true
location:
jms_uri: jms:topic:example.event
rest_uri: http://localhost:8080/example/event-source-api/rest
data_source: java:/app/example-single/DS.eventstore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ public void shouldUpdateEventBufferStatus() throws Exception {

@SuppressWarnings("SameParameterValue")
private Optional<Subscription> subscription(final String recipeId) {
return CAKE_SHOP_REPOSITORY_MANAGER.getSubscriptionJdbcRepository().findByStreamIdAndSource(fromString(recipeId), CONTEXT_NAME);
return CAKE_SHOP_REPOSITORY_MANAGER.getStreamStatusJdbcRepository().findByStreamIdAndSource(fromString(recipeId), CONTEXT_NAME);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package uk.gov.justice.services.example.cakeshop.it;

import static com.jayway.jsonassert.JsonAssert.with;
import static java.util.Optional.empty;
import static java.util.Optional.of;
import static java.util.Optional.ofNullable;
import static java.util.UUID.fromString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
Expand All @@ -15,6 +18,9 @@
import uk.gov.justice.services.example.cakeshop.it.helpers.EventFinder;
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.test.utils.core.messaging.Poller;

import java.util.Optional;

import javax.ws.rs.client.Client;

Expand All @@ -27,9 +33,8 @@ public class CakeShopReplayEventsIT {

private static final CakeShopRepositoryManager CAKE_SHOP_REPOSITORY_MANAGER = new CakeShopRepositoryManager();

private final EventFactory eventFactory = new EventFactory();
private final EventFinder eventFinder = new EventFinder(CAKE_SHOP_REPOSITORY_MANAGER);
private final CommandFactory commandFactory = new CommandFactory();
private final Poller poller = new Poller();


private Client client;
private Querier querier;
Expand All @@ -56,25 +61,36 @@ public void shouldFindReplayedRecipesInViewStore() {
final String recipeId_1 = "489c5e3b-8c0c-4e26-855f-34592604bd98";
final String recipeId_2 = "8440bcc3-a4d6-4bd1-817c-ab89ffd307ae";

final ApiResponse response_1 = querier.queryForRecipe(recipeId_1);
final ApiResponse response_2 = querier.queryForRecipe(recipeId_2);
final Optional<String> response_1 = poller.pollUntilFound(() -> getRecipe(recipeId_1));
final Optional<String> response_2 = poller.pollUntilFound(() -> getRecipe(recipeId_2));
assertThat(response_1.isPresent(), is(true));
assertThat(response_2.isPresent(), is(true));

with(response_1.body())
with(response_1.get())
.assertThat("$.id", equalTo(recipeId_1))
.assertThat("$.name", equalTo("Turnip Cake"));

with(response_2.body())
with(response_2.get())
.assertThat("$.id", equalTo(recipeId_2))
.assertThat("$.name", equalTo("Rock Cake"));

assertThat(subscription(recipeId_1).getPosition(), is(2L));
assertThat(subscription(recipeId_2).getPosition(), is(2L));
}

private Optional<String> getRecipe(final String recipeId) {
final String body = querier.queryForRecipe(recipeId).body();

if (body == null || body.isEmpty()) {
return empty();
}
return of(body);
}

@SuppressWarnings("OptionalGetWithoutIsPresent")
private Subscription subscription(final String recipeId) {
return CAKE_SHOP_REPOSITORY_MANAGER
.getSubscriptionJdbcRepository()
.getStreamStatusJdbcRepository()
.findByStreamIdAndSource(fromString(recipeId), CONTEXT_NAME)
.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;

@Ignore
public class MultipleEventListenerCakeShopIT {

private static final CakeShopRepositoryManager CAKE_SHOP_REPOSITORY_MANAGER = new CakeShopRepositoryManager();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package uk.gov.justice.services.example.cakeshop.it.helpers;

import uk.gov.justice.services.event.buffer.core.repository.subscription.SubscriptionJdbcRepository;
import uk.gov.justice.services.event.buffer.core.repository.subscription.StreamStatusJdbcRepository;
import uk.gov.justice.services.eventsourcing.jdbc.snapshot.SnapshotJdbcRepository;
import uk.gov.justice.services.eventsourcing.jdbc.snapshot.StandaloneSnapshotJdbcRepositoryFactory;
import uk.gov.justice.services.eventsourcing.repository.jdbc.event.EventJdbcRepository;
Expand All @@ -12,12 +12,12 @@ public class CakeShopRepositoryManager {

private final DatabaseManager databaseManager = new DatabaseManager();
private final EventRepositoryFactory eventRepositoryFactory = new EventRepositoryFactory();
private final StandaloneSubscriptionJdbcRepositoryFactory standaloneSubscriptionJdbcRepositoryFactory = new StandaloneSubscriptionJdbcRepositoryFactory();
private final StandaloneStreamStatusJdbcRepositoryFactory standaloneStreamStatusJdbcRepositoryFactory = new StandaloneStreamStatusJdbcRepositoryFactory();
private final StandaloneSnapshotJdbcRepositoryFactory standaloneSnapshotJdbcRepositoryFactory = new StandaloneSnapshotJdbcRepositoryFactory();


private EventJdbcRepository eventJdbcRepository;
private SubscriptionJdbcRepository subscriptionJdbcRepository;
private StreamStatusJdbcRepository streamStatusJdbcRepository;
private SnapshotJdbcRepository snapshotJdbcRepository;


Expand All @@ -27,7 +27,7 @@ public void initialise() throws Exception {
final DataSource viewStoreDatasource = databaseManager.initViewStoreDb();

eventJdbcRepository = eventRepositoryFactory.getEventJdbcRepository(eventStoreDataSource);
subscriptionJdbcRepository = standaloneSubscriptionJdbcRepositoryFactory.getSnapshotSubscriptionJdbcRepository(viewStoreDatasource);
streamStatusJdbcRepository = standaloneStreamStatusJdbcRepositoryFactory.getSnapshotSubscriptionJdbcRepository(viewStoreDatasource);
snapshotJdbcRepository = standaloneSnapshotJdbcRepositoryFactory.getSnapshotJdbcRepository(eventStoreDataSource);

databaseManager.initFileServiceDb();
Expand All @@ -37,8 +37,8 @@ public EventJdbcRepository getEventJdbcRepository() {
return eventJdbcRepository;
}

public SubscriptionJdbcRepository getSubscriptionJdbcRepository() {
return subscriptionJdbcRepository;
public StreamStatusJdbcRepository getStreamStatusJdbcRepository() {
return streamStatusJdbcRepository;
}

public SnapshotJdbcRepository getSnapshotJdbcRepository() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package uk.gov.justice.services.example.cakeshop.it.helpers;


import uk.gov.justice.services.event.buffer.core.repository.subscription.SubscriptionJdbcRepository;
import uk.gov.justice.services.event.buffer.core.repository.subscription.StreamStatusJdbcRepository;

import javax.sql.DataSource;

public class StandaloneSubscriptionJdbcRepository extends SubscriptionJdbcRepository {
public class StandaloneStreamStatusJdbcRepository extends StreamStatusJdbcRepository {

private final DataSource datasource;

public StandaloneSubscriptionJdbcRepository(final DataSource datasource) {
public StandaloneStreamStatusJdbcRepository(final DataSource datasource) {
this.datasource = datasource;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

import static uk.gov.justice.services.test.utils.core.reflection.ReflectionUtil.setField;

import uk.gov.justice.services.event.buffer.core.repository.subscription.SubscriptionJdbcRepository;
import uk.gov.justice.services.event.buffer.core.repository.subscription.StreamStatusJdbcRepository;
import uk.gov.justice.services.jdbc.persistence.JdbcRepositoryHelper;

import javax.sql.DataSource;

public class StandaloneSubscriptionJdbcRepositoryFactory {
public class StandaloneStreamStatusJdbcRepositoryFactory {

public SubscriptionJdbcRepository getSnapshotSubscriptionJdbcRepository(final DataSource dataSource) {
final SubscriptionJdbcRepository snapshotJdbcRepository = new SubscriptionJdbcRepository();
public StreamStatusJdbcRepository getSnapshotSubscriptionJdbcRepository(final DataSource dataSource) {
final StreamStatusJdbcRepository snapshotJdbcRepository = new StreamStatusJdbcRepository();

setField(snapshotJdbcRepository, "dataSource", dataSource);
setField(snapshotJdbcRepository, "jdbcRepositoryHelper", new JdbcRepositoryHelper());
Expand Down
12 changes: 6 additions & 6 deletions example-context/example-service/example-single/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
<version>${project.version}</version>
<classifier>classes</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>other-event-listener</artifactId>
<version>${project.version}</version>
<classifier>classes</classifier>
</dependency>
<!--<dependency>-->
<!--<groupId>${project.groupId}</groupId>-->
<!--<artifactId>other-event-listener</artifactId>-->
<!--<version>${project.version}</version>-->
<!--<classifier>classes</classifier>-->
<!--</dependency>-->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>example-event-processor</artifactId>
Expand Down
18 changes: 9 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,20 @@
<properties>
<cpp.repo.name>cake-shop</cpp.repo.name>
<common-bom.version>1.28.0</common-bom.version>
<framework.version>5.1.0-M3</framework.version>
<framework.version>5.1.0</framework.version>
<embedded-artemis.version>1.2.0</embedded-artemis.version>
<event-store.version>1.1.0-M1</event-store.version>
<framework-domain.version>1.1.0-M3</framework-domain.version>
<framework-generators.version>1.1.0-M1</framework-generators.version>
<file.service.version>1.17.1</file.service.version>
<framework-api.version>3.1.0-M2</framework-api.version>
<event-store.version>1.1.0</event-store.version>
<framework-domain.version>1.1.0</framework-domain.version>
<framework-generators.version>1.1.0</framework-generators.version>
<file.service.version>1.17.2</file.service.version>
<framework-api.version>3.1.0</framework-api.version>
<generator-maven-plugin.version>2.6.1</generator-maven-plugin.version>
<json-schema-catalog.version>1.4.2</json-schema-catalog.version>
<json-schema-catalog.version>1.4.3</json-schema-catalog.version>
<jboss-ejb3-ext-api.version>2.2.0.Final</jboss-ejb3-ext-api.version>
<jboss-vfs.version>3.2.12.Final</jboss-vfs.version>
<raml-maven-plugin.version>1.6.3</raml-maven-plugin.version>
<test-utils.version>1.19.0</test-utils.version>
<utilities.version>1.16.1</utilities.version>
<test-utils.version>1.19.1</test-utils.version>
<utilities.version>1.16.2</utilities.version>
</properties>

<dependencyManagement>
Expand Down

0 comments on commit 3784bc9

Please sign in to comment.