From c053406c820cbebd199d9c4a9af06fae425088a4 Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Wed, 28 Mar 2018 17:31:41 +0300 Subject: [PATCH 1/8] Supporting custom headers in stomp client. --- .../javaclient/stompclient/MyStompClientImpl.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/MyStompClientImpl.java b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/MyStompClientImpl.java index 801203a..c0c325b 100644 --- a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/MyStompClientImpl.java +++ b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/MyStompClientImpl.java @@ -32,6 +32,9 @@ import io.vertx.ext.stomp.impl.StompClientConnectionImpl; import io.vertx.ext.stomp.utils.Headers; +import java.util.Collections; +import java.util.Map; + /** * Default implementation of {@link StompClient}. * @@ -45,11 +48,17 @@ public class MyStompClientImpl implements StompClient { private final StompClientOptions options; private NetClient client; private Handler closeHandler; + private Map customHeaders; public MyStompClientImpl(Vertx vertx, StompClientOptions options) { + this(vertx, options, Collections.emptyMap()); + } + + public MyStompClientImpl(Vertx vertx, StompClientOptions options, Map customHeaders) { this.vertx = vertx; this.options = options; + this.customHeaders = customHeaders; } @Override @@ -143,6 +152,8 @@ private Buffer getConnectFrame(String host) { } headers.put(Frame.HEARTBEAT, Frame.Heartbeat.create(options.getHeartbeat()).toString()); + headers.addAll(customHeaders); + Frame.Command cmd = options.isUseStompFrame() ? Frame.Command.STOMP : Frame.Command.CONNECT; final Frame frame = new Frame(cmd, headers, null); return frame.toBuffer(); From b422f4005e4b4744d589a1687c838d519a960921 Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Wed, 28 Mar 2018 18:12:22 +0300 Subject: [PATCH 2/8] Renaming, --- .../javaclient/stompclient/MyStompClientImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/MyStompClientImpl.java b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/MyStompClientImpl.java index c0c325b..54ec83e 100644 --- a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/MyStompClientImpl.java +++ b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/MyStompClientImpl.java @@ -48,17 +48,17 @@ public class MyStompClientImpl implements StompClient { private final StompClientOptions options; private NetClient client; private Handler closeHandler; - private Map customHeaders; + private Map customConnectHeaders; public MyStompClientImpl(Vertx vertx, StompClientOptions options) { this(vertx, options, Collections.emptyMap()); } - public MyStompClientImpl(Vertx vertx, StompClientOptions options, Map customHeaders) { + public MyStompClientImpl(Vertx vertx, StompClientOptions options, Map customConnectHeaders) { this.vertx = vertx; this.options = options; - this.customHeaders = customHeaders; + this.customConnectHeaders = customConnectHeaders; } @Override @@ -152,7 +152,7 @@ private Buffer getConnectFrame(String host) { } headers.put(Frame.HEARTBEAT, Frame.Heartbeat.create(options.getHeartbeat()).toString()); - headers.addAll(customHeaders); + headers.addAll(customConnectHeaders); Frame.Command cmd = options.isUseStompFrame() ? Frame.Command.STOMP : Frame.Command.CONNECT; final Frame frame = new Frame(cmd, headers, null); From 29e57c1a594627ac9ba376966f2564203c4bc4de Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Thu, 12 Apr 2018 21:54:58 +0300 Subject: [PATCH 3/8] Supporting custom connection headers for the stomp client --- .../javaclient/stompclient/EventuateSTOMPClient.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/EventuateSTOMPClient.java b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/EventuateSTOMPClient.java index c10384f..7d916f2 100644 --- a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/EventuateSTOMPClient.java +++ b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/EventuateSTOMPClient.java @@ -35,14 +35,20 @@ public class EventuateSTOMPClient implements AggregateEvents { private String host; private boolean useSsl; private int port; + private Map customConnectHeaders; public EventuateSTOMPClient(Vertx vertx, EventuateCredentials eventuateCredentials, URI uri) { + this(vertx, eventuateCredentials, uri, Collections.emptyMap()); + } + + public EventuateSTOMPClient(Vertx vertx, EventuateCredentials eventuateCredentials, URI uri, Map customConnectHeaders) { this.vertx = vertx; this.context = VertxUtil.getContext(vertx); this.eventuateCredentials = eventuateCredentials; this.host = uri.getHost(); this.port = uri.getPort(); this.useSsl = uri.getScheme().startsWith("stomp+ssl"); + this.customConnectHeaders = customConnectHeaders; if (logger.isInfoEnabled()) logger.debug("STOMP connection: " + Arrays.asList(host, port, useSsl)); } @@ -69,7 +75,7 @@ public void initialize() { options.setPasscode(eventuateCredentials.getApiKeySecret()); options.setHeartbeat(new JsonObject().put("x", 60 * 1000).put("y", 60 * 1000)); - stompClient = new MyStompClientImpl(vertx, options); + stompClient = new MyStompClientImpl(vertx, options, customConnectHeaders); stompClient.closeHandler(this::handleClose); From 5a88518f1de1924779973165f8f5c8bc789ca84c Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Tue, 21 May 2019 11:58:47 +0300 Subject: [PATCH 4/8] Removed eventuate schema, used EventuateCommonJdbcOperations from the eventuate common project. --- build.gradle | 1 + .../build.gradle | 2 +- .../spring/jdbc/EventuateJdbcAccessImpl.java | 50 ++++++++++++------- .../spring/jdbc/EventuateSchema.java | 40 --------------- eventuate-client-java-jdbc/build.gradle | 1 + ...beddedTestAggregateStoreConfiguration.java | 16 ++++-- .../CustomEventuateJdbcAccessImplTest.java | 1 + .../DefaultEventuateJdbcAccessImplTest.java | 1 + .../EmptyEventuateJdbcAccessImplTest.java | 1 + .../jdbc/EventuateJdbcAccessImplTest.java | 13 ++++- .../spring/jdbc/EventuateSchemaTest.java | 47 ----------------- gradle.properties | 4 +- 12 files changed, 64 insertions(+), 113 deletions(-) delete mode 100644 eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateSchema.java delete mode 100644 eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/EventuateSchemaTest.java diff --git a/build.gradle b/build.gradle index 8682763..397ff62 100644 --- a/build.gradle +++ b/build.gradle @@ -46,6 +46,7 @@ subprojects { repositories { mavenCentral() maven { url "http://mavenrepo.eventuate.io/release"} + eventuateMavenRepoUrl.split(',').each { repoUrl -> maven { url repoUrl } } } dependencies { diff --git a/eventuate-client-java-jdbc-common/build.gradle b/eventuate-client-java-jdbc-common/build.gradle index 99bc43e..d1f78d0 100644 --- a/eventuate-client-java-jdbc-common/build.gradle +++ b/eventuate-client-java-jdbc-common/build.gradle @@ -4,7 +4,7 @@ dependencies { compile project(":eventuate-client-java-common-impl") compile "org.springframework.boot:spring-boot-starter:$springBootVersion" compile "org.springframework.boot:spring-boot-starter-jdbc:$springBootVersion" - + compile "io.eventuate.common:eventuate-common-jdbc:$eventuateCommonVersion" testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion" } \ No newline at end of file diff --git a/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccessImpl.java b/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccessImpl.java index 9ef3842..4f6f4c5 100644 --- a/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccessImpl.java +++ b/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccessImpl.java @@ -8,6 +8,8 @@ import io.eventuate.EventContext; import io.eventuate.Int128; import io.eventuate.OptimisticLockingException; +import io.eventuate.common.jdbc.EventuateCommonJdbcOperations; +import io.eventuate.common.jdbc.EventuateSchema; import io.eventuate.javaclient.commonimpl.AggregateCrudFindOptions; import io.eventuate.javaclient.commonimpl.AggregateCrudSaveOptions; import io.eventuate.javaclient.commonimpl.AggregateCrudUpdateOptions; @@ -30,9 +32,6 @@ import java.util.stream.Collectors; public class EventuateJdbcAccessImpl implements EventuateJdbcAccess { - - public static final String DEFAULT_DATABASE_SCHEMA = "eventuate"; - protected Logger logger = LoggerFactory.getLogger(getClass()); private JdbcTemplate jdbcTemplate; @@ -40,12 +39,19 @@ public class EventuateJdbcAccessImpl implements EventuateJdbcAccess { private String eventTable; private String snapshotTable; - public EventuateJdbcAccessImpl(JdbcTemplate jdbcTemplate) { - this(jdbcTemplate, new EventuateSchema()); + private EventuateCommonJdbcOperations eventuateCommonJdbcOperations; + private EventuateSchema eventuateSchema; + + public EventuateJdbcAccessImpl(JdbcTemplate jdbcTemplate, EventuateCommonJdbcOperations eventuateCommonJdbcOperations) { + this(jdbcTemplate, eventuateCommonJdbcOperations, new EventuateSchema()); } - public EventuateJdbcAccessImpl(JdbcTemplate jdbcTemplate, EventuateSchema eventuateSchema) { + public EventuateJdbcAccessImpl(JdbcTemplate jdbcTemplate, + EventuateCommonJdbcOperations eventuateCommonJdbcOperations, + EventuateSchema eventuateSchema) { this.jdbcTemplate = jdbcTemplate; + this.eventuateCommonJdbcOperations = eventuateCommonJdbcOperations; + this.eventuateSchema = eventuateSchema; entityTable = eventuateSchema.qualifyTable("entities"); eventTable = eventuateSchema.qualifyTable("events"); @@ -70,12 +76,17 @@ public SaveUpdateResult save(String aggregateType, List events } - for (EventIdTypeAndData event : eventsWithIds) - jdbcTemplate.update(String.format("INSERT INTO %s (event_id, event_type, event_data, entity_type, entity_id, triggering_event, metadata) VALUES (?, ?, ?, ?, ?, ?, ?)", eventTable), - event.getId().asString(), event.getEventType(), event.getEventData(), aggregateType, entityId, - saveOptions.flatMap(AggregateCrudSaveOptions::getTriggeringEvent).map(EventContext::getEventToken).orElse(null), - event.getMetadata().orElse(null) - ); + for (EventIdTypeAndData event : eventsWithIds) { + eventuateCommonJdbcOperations.insertIntoEventsTable(event.getId().asString(), + entityId, + event.getEventData(), + event.getEventType(), + aggregateType, + saveOptions.flatMap(AggregateCrudSaveOptions::getTriggeringEvent).map(EventContext::getEventToken), + event.getMetadata(), + eventuateSchema); + } + return new SaveUpdateResult(new EntityIdVersionAndEventIds(entityId, entityVersion, eventsWithIds.stream().map(EventIdTypeAndData::getId).collect(Collectors.toList())), new PublishableEvents(aggregateType, entityId, eventsWithIds)); @@ -225,15 +236,16 @@ public SaveUpdateResult update(EntityIdAndType entityIdAndType, Int128 entityVer }); - for (EventIdTypeAndData event : eventsWithIds) - jdbcTemplate.update(String.format("INSERT INTO %s (event_id, event_type, event_data, entity_type, entity_id, triggering_event, metadata) VALUES (?, ?, ?, ?, ?, ?, ?)", eventTable), - event.getId().asString(), - event.getEventType(), + for (EventIdTypeAndData event : eventsWithIds) { + eventuateCommonJdbcOperations.insertIntoEventsTable(event.getId().asString(), + entityId, event.getEventData(), + event.getEventType(), entityType, - entityId, - updateOptions.flatMap(AggregateCrudUpdateOptions::getTriggeringEvent).map(EventContext::getEventToken).orElse(null), - event.getMetadata().orElse(null)); + updateOptions.flatMap(AggregateCrudUpdateOptions::getTriggeringEvent).map(EventContext::getEventToken), + event.getMetadata(), + eventuateSchema); + } return new SaveUpdateResult(new EntityIdVersionAndEventIds(entityId, diff --git a/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateSchema.java b/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateSchema.java deleted file mode 100644 index 6a513fc..0000000 --- a/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateSchema.java +++ /dev/null @@ -1,40 +0,0 @@ -package io.eventuate.javaclient.spring.jdbc; - -import org.apache.commons.lang.StringUtils; - -import java.util.Objects; - -public class EventuateSchema { - public static final String DEFAULT_SCHEMA = "eventuate"; - public static final String EMPTY_SCHEMA = "none"; - - private final String eventuateDatabaseSchema; - - public EventuateSchema() { - eventuateDatabaseSchema = DEFAULT_SCHEMA; - } - - public EventuateSchema(String eventuateDatabaseSchema) { - this.eventuateDatabaseSchema = StringUtils.isBlank(eventuateDatabaseSchema) ? DEFAULT_SCHEMA : eventuateDatabaseSchema; - } - - public String getEventuateDatabaseSchema() { - return eventuateDatabaseSchema; - } - - public boolean isEmpty() { - return EMPTY_SCHEMA.equals(eventuateDatabaseSchema); - } - - public boolean isDefault() { - return DEFAULT_SCHEMA.equals(eventuateDatabaseSchema); - } - - public String qualifyTable(String table) { - if (isEmpty()) return table; - - String schema = isDefault() ? DEFAULT_SCHEMA : eventuateDatabaseSchema; - - return String.format("%s.%s", schema, table); - } -} diff --git a/eventuate-client-java-jdbc/build.gradle b/eventuate-client-java-jdbc/build.gradle index 2413086..b3bfe93 100644 --- a/eventuate-client-java-jdbc/build.gradle +++ b/eventuate-client-java-jdbc/build.gradle @@ -5,6 +5,7 @@ dependencies { compile project(":eventuate-client-java-spring-common") compile project(":eventuate-client-java-spring") compile "com.h2database:h2:1.3.166" + compile "io.eventuate.common:eventuate-common-jdbc:$eventuateCommonVersion" testCompile project(":eventuate-client-java-test-util") testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion" diff --git a/eventuate-client-java-jdbc/src/main/java/io/eventuate/javaclient/spring/jdbc/EmbeddedTestAggregateStoreConfiguration.java b/eventuate-client-java-jdbc/src/main/java/io/eventuate/javaclient/spring/jdbc/EmbeddedTestAggregateStoreConfiguration.java index 4169b51..5a47863 100644 --- a/eventuate-client-java-jdbc/src/main/java/io/eventuate/javaclient/spring/jdbc/EmbeddedTestAggregateStoreConfiguration.java +++ b/eventuate-client-java-jdbc/src/main/java/io/eventuate/javaclient/spring/jdbc/EmbeddedTestAggregateStoreConfiguration.java @@ -1,5 +1,6 @@ package io.eventuate.javaclient.spring.jdbc; +import io.eventuate.common.jdbc.EventuateCommonJdbcOperations; import io.eventuate.javaclient.commonimpl.AggregateCrud; import io.eventuate.javaclient.commonimpl.AggregateEvents; import io.eventuate.javaclient.commonimpl.adapters.SyncToAsyncAggregateCrudAdapter; @@ -22,9 +23,18 @@ public class EmbeddedTestAggregateStoreConfiguration { @Bean - public EventuateJdbcAccess eventuateJdbcAccess() { - JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource()); - return new EventuateJdbcAccessImpl(jdbcTemplate); + public JdbcTemplate jdbcTemplate() { + return new JdbcTemplate(dataSource()); + } + + @Bean + public EventuateCommonJdbcOperations eventuateCommonJdbcOperations(JdbcTemplate jdbcTemplate) { + return new EventuateCommonJdbcOperations(jdbcTemplate); + } + + @Bean + public EventuateJdbcAccess eventuateJdbcAccess(JdbcTemplate jdbcTemplate, EventuateCommonJdbcOperations eventuateCommonJdbcOperations) { + return new EventuateJdbcAccessImpl(jdbcTemplate, eventuateCommonJdbcOperations); } @Bean diff --git a/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/CustomEventuateJdbcAccessImplTest.java b/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/CustomEventuateJdbcAccessImplTest.java index 297830c..4182bb3 100644 --- a/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/CustomEventuateJdbcAccessImplTest.java +++ b/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/CustomEventuateJdbcAccessImplTest.java @@ -1,5 +1,6 @@ package io.eventuate.javaclient.spring.jdbc; +import io.eventuate.common.jdbc.EventuateSchema; import org.junit.Before; import org.junit.runner.RunWith; import org.springframework.beans.factory.config.ConfigurableBeanFactory; diff --git a/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/DefaultEventuateJdbcAccessImplTest.java b/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/DefaultEventuateJdbcAccessImplTest.java index 6543305..24979d0 100644 --- a/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/DefaultEventuateJdbcAccessImplTest.java +++ b/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/DefaultEventuateJdbcAccessImplTest.java @@ -1,5 +1,6 @@ package io.eventuate.javaclient.spring.jdbc; +import io.eventuate.common.jdbc.EventuateSchema; import org.junit.runner.RunWith; import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.boot.test.IntegrationTest; diff --git a/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/EmptyEventuateJdbcAccessImplTest.java b/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/EmptyEventuateJdbcAccessImplTest.java index ba027f7..bbd636f 100644 --- a/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/EmptyEventuateJdbcAccessImplTest.java +++ b/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/EmptyEventuateJdbcAccessImplTest.java @@ -1,5 +1,6 @@ package io.eventuate.javaclient.spring.jdbc; +import io.eventuate.common.jdbc.EventuateSchema; import org.junit.Before; import org.junit.runner.RunWith; import org.springframework.beans.factory.config.ConfigurableBeanFactory; diff --git a/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccessImplTest.java b/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccessImplTest.java index f95c522..f9c2185 100644 --- a/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccessImplTest.java +++ b/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccessImplTest.java @@ -1,6 +1,8 @@ package io.eventuate.javaclient.spring.jdbc; import io.eventuate.EntityIdAndType; +import io.eventuate.common.jdbc.EventuateCommonJdbcOperations; +import io.eventuate.common.jdbc.EventuateSchema; import io.eventuate.javaclient.commonimpl.AggregateCrudUpdateOptions; import io.eventuate.javaclient.commonimpl.EventTypeAndData; import io.eventuate.javaclient.commonimpl.LoadedEvents; @@ -30,10 +32,17 @@ public JdbcTemplate jdbcTemplate(DataSource dataSource) { return new JdbcTemplate(dataSource); } + @Bean + public EventuateCommonJdbcOperations eventuateCommonJdbcOperations(JdbcTemplate jdbcTemplate) { + return new EventuateCommonJdbcOperations(jdbcTemplate); + } + @Bean @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) - public EventuateJdbcAccess eventuateJdbcAccess(JdbcTemplate jdbcTemplate, EventuateSchema eventuateSchema) { - return new EventuateJdbcAccessImpl(jdbcTemplate, eventuateSchema); + public EventuateJdbcAccess eventuateJdbcAccess(JdbcTemplate jdbcTemplate, + EventuateCommonJdbcOperations eventuateCommonJdbcOperations, + EventuateSchema eventuateSchema) { + return new EventuateJdbcAccessImpl(jdbcTemplate, eventuateCommonJdbcOperations, eventuateSchema); } } diff --git a/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/EventuateSchemaTest.java b/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/EventuateSchemaTest.java deleted file mode 100644 index ce36f10..0000000 --- a/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/EventuateSchemaTest.java +++ /dev/null @@ -1,47 +0,0 @@ -package io.eventuate.javaclient.spring.jdbc; - -import org.junit.Assert; -import org.junit.Test; - -public class EventuateSchemaTest { - - @Test - public void testDefaultConstructor() { - EventuateSchema eventuateSchema = new EventuateSchema(); - - Assert.assertTrue(eventuateSchema.isDefault()); - Assert.assertFalse(eventuateSchema.isEmpty()); - Assert.assertEquals(EventuateSchema.DEFAULT_SCHEMA, eventuateSchema.getEventuateDatabaseSchema()); - Assert.assertEquals(EventuateSchema.DEFAULT_SCHEMA + ".test", eventuateSchema.qualifyTable("test")); - } - - @Test - public void testDefaultSchema() { - EventuateSchema eventuateSchema = new EventuateSchema(EventuateSchema.DEFAULT_SCHEMA); - - Assert.assertTrue(eventuateSchema.isDefault()); - Assert.assertFalse(eventuateSchema.isEmpty()); - Assert.assertEquals(EventuateSchema.DEFAULT_SCHEMA, eventuateSchema.getEventuateDatabaseSchema()); - Assert.assertEquals(EventuateSchema.DEFAULT_SCHEMA + ".test", eventuateSchema.qualifyTable("test")); - } - - @Test - public void testEmptySchema() { - EventuateSchema eventuateSchema = new EventuateSchema(EventuateSchema.EMPTY_SCHEMA); - - Assert.assertFalse(eventuateSchema.isDefault()); - Assert.assertTrue(eventuateSchema.isEmpty()); - Assert.assertEquals(EventuateSchema.EMPTY_SCHEMA, eventuateSchema.getEventuateDatabaseSchema()); - Assert.assertEquals("test", eventuateSchema.qualifyTable("test")); - } - - @Test - public void testCustomSchema() { - EventuateSchema eventuateSchema = new EventuateSchema("custom"); - - Assert.assertFalse(eventuateSchema.isDefault()); - Assert.assertFalse(eventuateSchema.isEmpty()); - Assert.assertEquals("custom", eventuateSchema.getEventuateDatabaseSchema()); - Assert.assertEquals("custom.test", eventuateSchema.qualifyTable("test")); - } -} diff --git a/gradle.properties b/gradle.properties index 2a10b3a..549d7e8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,9 +2,11 @@ org.gradle.jvmargs=-XX:MaxPermSize=512m -Xmx1G deployUrl=file:///Users/cer/.m2/testdeploy +eventuateMavenRepoUrl=file:///Users/cer/.m2/testdeploy -springBootVersion=1.3.3.RELEASE +springBootVersion=1.4.7.RELEASE version=0.20.0-SNAPSHOT rxJavaVersion=1.1.5 +eventuateCommonVersion=0.1.0-SNAPSHOT \ No newline at end of file From 5e167397e6ab382ae3e01630fd852bb910dc9e74 Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Thu, 30 May 2019 20:58:56 +0300 Subject: [PATCH 5/8] Extracted json mapping and id generation. --- .../build.gradle | 3 + .../javaclient/commonimpl/AggregateCrud.java | 1 + .../commonimpl/AggregateCrudMapping.java | 3 +- .../DefaultSerializedEventDeserializer.java | 1 + .../EntityIdVersionAndEventIds.java | 2 +- .../commonimpl/EventIdTypeAndData.java | 2 +- .../EventuateAggregateStoreImpl.java | 2 + .../javaclient/commonimpl/Int128Module.java | 64 --------- .../javaclient/commonimpl/JSonMapper.java | 48 ------- .../commonimpl/SerializedEvent.java | 2 +- .../SerializedSnapshotWithVersion.java | 2 +- .../AsyncToSyncAggregateCrudAdapter.java | 2 +- .../SyncToAsyncAggregateCrudAdapter.java | 2 +- .../commonimpl/sync/AggregateCrud.java | 2 +- .../sync/EventuateAggregateStoreImpl.java | 3 +- .../javaclient/commonimpl/JSonMapperTest.java | 123 ------------------ .../domain/EventHandlerContextImpl.java | 1 + .../domain/EventDispatcherTest.java | 1 + .../restclient/CreateEntityResponse.java | 2 +- .../restclient/EventuateRESTClient.java | 2 + .../restclient/UpdateEntityRequest.java | 2 +- .../restclient/UpdateEntityResponse.java | 2 +- .../stompclient/EventuateSTOMPClient.java | 2 +- .../javaclient/stompclient/StompEvent.java | 2 +- .../restclient/AbstractApiComplianceTest.java | 2 +- .../EventuateRESTClientPactTest.java | 2 +- .../restclient/EventuateRESTClientTest.java | 2 +- .../RequestResponseJsonObjects.java | 2 +- .../restclient/RestApiComplianceTest.java | 2 +- .../stompclient/EventuateSTOMPClientTest.java | 2 +- .../stompclient/StompApiComplianceTest.java | 4 +- .../build.gradle | 2 +- .../jdbc/AbstractJdbcAggregateCrud.java | 2 +- .../spring/jdbc/EventuateJdbcAccess.java | 2 +- .../spring/jdbc/EventuateJdbcAccessImpl.java | 4 +- .../javaclient/spring/jdbc/IdGenerator.java | 7 - .../spring/jdbc/IdGeneratorImpl.java | 73 ----------- .../spring/jdbc/IdGeneratorImplTest.java | 36 ----- ...entuateEmbeddedTestAggregateStoreTest.java | 1 + .../testutil/AbstractTestEventHandler.java | 2 +- .../MockEventHandlerContextInternal.java | 1 + .../io/eventuate/testutil/ReceivedEvent.java | 2 +- .../domain/AccountSnapshotStrategy.java | 2 +- .../banking/domain/SerializationTest.java | 2 +- eventuate-client-java/build.gradle | 2 + .../io/eventuate/AggregateRepository.java | 1 + .../java/io/eventuate/DispatchedEvent.java | 1 + .../java/io/eventuate/EntityIdAndVersion.java | 1 + .../io/eventuate/EntityWithIdAndVersion.java | 1 + .../java/io/eventuate/EntityWithMetadata.java | 2 + .../main/java/io/eventuate/EventEnvelope.java | 2 + .../java/io/eventuate/EventIdAndType.java | 2 + .../java/io/eventuate/EventWithMetadata.java | 2 + .../io/eventuate/EventuateAggregateStore.java | 2 + .../src/main/java/io/eventuate/Int128.java | 59 --------- .../eventuate/OptimisticLockingException.java | 2 + .../java/io/eventuate/SnapshotManager.java | 2 + .../io/eventuate/SnapshotManagerImpl.java | 2 + .../java/io/eventuate/SnapshotStrategy.java | 2 + .../eventuate/sync/AggregateRepository.java | 1 + .../sync/EventuateAggregateStore.java | 1 + .../io/eventuate/AggregateRepositoryTest.java | 1 + .../test/java/io/eventuate/Int128Test.java | 37 ------ 63 files changed, 74 insertions(+), 477 deletions(-) delete mode 100644 eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/Int128Module.java delete mode 100644 eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/JSonMapper.java delete mode 100644 eventuate-client-java-common-impl/src/test/java/io/eventuate/javaclient/commonimpl/JSonMapperTest.java delete mode 100644 eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/IdGenerator.java delete mode 100644 eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/IdGeneratorImpl.java delete mode 100644 eventuate-client-java-jdbc-common/src/test/java/io/eventuate/javaclient/spring/jdbc/IdGeneratorImplTest.java delete mode 100644 eventuate-client-java/src/main/java/io/eventuate/Int128.java delete mode 100644 eventuate-client-java/src/test/java/io/eventuate/Int128Test.java diff --git a/eventuate-client-java-common-impl/build.gradle b/eventuate-client-java-common-impl/build.gradle index 4608dd5..8274422 100644 --- a/eventuate-client-java-common-impl/build.gradle +++ b/eventuate-client-java-common-impl/build.gradle @@ -3,6 +3,9 @@ apply plugin: PrivateModulePlugin dependencies { compile project(":eventuate-client-java") + compile "io.eventuate.common:eventuate-common-json-mapper:$eventuateCommonVersion" + compile "io.eventuate.common:eventuate-common-id-generator:$eventuateCommonVersion" + compile "com.fasterxml.jackson.core:jackson-databind:2.8.8" compile "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.8.8" } \ No newline at end of file diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/AggregateCrud.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/AggregateCrud.java index 99b08c6..c550386 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/AggregateCrud.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/AggregateCrud.java @@ -1,6 +1,7 @@ package io.eventuate.javaclient.commonimpl; import io.eventuate.*; +import io.eventuate.common.id.generator.Int128; import java.util.List; import java.util.Optional; diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/AggregateCrudMapping.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/AggregateCrudMapping.java index 0882aa8..4f147d3 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/AggregateCrudMapping.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/AggregateCrudMapping.java @@ -3,10 +3,11 @@ import io.eventuate.Event; import io.eventuate.EventWithMetadata; import io.eventuate.FindOptions; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import io.eventuate.SaveOptions; import io.eventuate.Snapshot; import io.eventuate.UpdateOptions; +import io.eventuate.common.json.mapper.JSonMapper; import java.util.List; import java.util.Map; diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/DefaultSerializedEventDeserializer.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/DefaultSerializedEventDeserializer.java index 482d10f..70773fb 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/DefaultSerializedEventDeserializer.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/DefaultSerializedEventDeserializer.java @@ -3,6 +3,7 @@ import io.eventuate.DispatchedEvent; import io.eventuate.EndOfCurrentEventsReachedEvent; import io.eventuate.Event; +import io.eventuate.common.json.mapper.JSonMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EntityIdVersionAndEventIds.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EntityIdVersionAndEventIds.java index a78831e..235a6c4 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EntityIdVersionAndEventIds.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EntityIdVersionAndEventIds.java @@ -1,7 +1,7 @@ package io.eventuate.javaclient.commonimpl; import io.eventuate.EntityIdAndVersion; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EventIdTypeAndData.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EventIdTypeAndData.java index ade14bf..2463a5c 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EventIdTypeAndData.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EventIdTypeAndData.java @@ -1,6 +1,6 @@ package io.eventuate.javaclient.commonimpl; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EventuateAggregateStoreImpl.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EventuateAggregateStoreImpl.java index 35f604c..49b0036 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EventuateAggregateStoreImpl.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EventuateAggregateStoreImpl.java @@ -1,6 +1,8 @@ package io.eventuate.javaclient.commonimpl; import io.eventuate.*; +import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.json.mapper.JSonMapper; import io.eventuate.javaclient.commonimpl.schemametadata.EmptyEventSchemaMetadataManager; import io.eventuate.javaclient.commonimpl.schemametadata.EventSchemaMetadataManager; diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/Int128Module.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/Int128Module.java deleted file mode 100644 index ee7fc50..0000000 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/Int128Module.java +++ /dev/null @@ -1,64 +0,0 @@ -package io.eventuate.javaclient.commonimpl; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer; -import com.fasterxml.jackson.databind.module.SimpleModule; -import com.fasterxml.jackson.databind.ser.std.StdScalarSerializer; -import io.eventuate.Int128; - -import java.io.IOException; -import java.lang.reflect.Type; - -public class Int128Module extends SimpleModule { - - class IdDeserializer extends StdScalarDeserializer { - - public IdDeserializer() { - super(Int128.class); - } - - public Int128 deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { - JsonToken token = jp.getCurrentToken(); - if (token == JsonToken.VALUE_STRING) { - String str = jp.getText().trim(); - if (str.isEmpty()) - return null; - else - return Int128.fromString(str); - } else - throw ctxt.mappingException(getValueClass()); - } - } - - class IdSerializer extends StdScalarSerializer { - public IdSerializer() { - super(Int128.class); - } - - public void serialize(Int128 value, JsonGenerator jgen, SerializerProvider provider) throws IOException { - jgen.writeString(value.asString()); - } - - @Override - public JsonNode getSchema(SerializerProvider provider, Type typeHint, boolean isOptional) throws JsonMappingException { - return createSchemaNode("string", true); - } - } - - @Override - public String getModuleName() { - return "IdJsonModule"; - } - - public Int128Module() { - addDeserializer(Int128.class, new IdDeserializer()); - addSerializer(Int128.class, new IdSerializer()); - } - -} \ No newline at end of file diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/JSonMapper.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/JSonMapper.java deleted file mode 100644 index c7b6dd8..0000000 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/JSonMapper.java +++ /dev/null @@ -1,48 +0,0 @@ -package io.eventuate.javaclient.commonimpl; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; - -import java.io.IOException; - -public class JSonMapper { - - public static ObjectMapper objectMapper = new ObjectMapper(); - - static { - objectMapper.configure(com.fasterxml.jackson.core.JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true); - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); - objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - objectMapper.registerModule(new Int128Module()); - objectMapper.registerModule(new Jdk8Module().configureAbsentsAsNulls(true)); - } - - public static String toJson(Object x) { - try { - return objectMapper.writeValueAsString(x); - } catch (JsonProcessingException e) { - throw new RuntimeException(e); - } - } - - public static T fromJson(String json, Class targetType) { - try { - return objectMapper.readValue(json, targetType); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public static T fromJsonByName(String json, String targetType) { - try { - return objectMapper.readValue(json, (Class) JSonMapper.class.getClassLoader().loadClass(targetType)); - } catch (IOException | ClassNotFoundException e) { - throw new RuntimeException(e); - } - } -} diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/SerializedEvent.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/SerializedEvent.java index a0fd367..59eba54 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/SerializedEvent.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/SerializedEvent.java @@ -1,7 +1,7 @@ package io.eventuate.javaclient.commonimpl; import io.eventuate.EventContext; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import org.apache.commons.lang.builder.ToStringBuilder; import java.util.Optional; diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/SerializedSnapshotWithVersion.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/SerializedSnapshotWithVersion.java index a31a104..784a06f 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/SerializedSnapshotWithVersion.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/SerializedSnapshotWithVersion.java @@ -1,6 +1,6 @@ package io.eventuate.javaclient.commonimpl; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; public class SerializedSnapshotWithVersion { diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/adapters/AsyncToSyncAggregateCrudAdapter.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/adapters/AsyncToSyncAggregateCrudAdapter.java index a7ee47e..c1e8ff5 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/adapters/AsyncToSyncAggregateCrudAdapter.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/adapters/AsyncToSyncAggregateCrudAdapter.java @@ -3,7 +3,7 @@ import io.eventuate.Aggregate; import io.eventuate.CompletableFutureUtil; import io.eventuate.EntityIdAndType; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import io.eventuate.javaclient.commonimpl.*; import java.util.List; diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/adapters/SyncToAsyncAggregateCrudAdapter.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/adapters/SyncToAsyncAggregateCrudAdapter.java index b8c5d76..09193ca 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/adapters/SyncToAsyncAggregateCrudAdapter.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/adapters/SyncToAsyncAggregateCrudAdapter.java @@ -3,7 +3,7 @@ import io.eventuate.Aggregate; import io.eventuate.CompletableFutureUtil; import io.eventuate.EntityIdAndType; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import io.eventuate.javaclient.commonimpl.AggregateCrudFindOptions; import io.eventuate.javaclient.commonimpl.AggregateCrudSaveOptions; import io.eventuate.javaclient.commonimpl.AggregateCrudUpdateOptions; diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/sync/AggregateCrud.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/sync/AggregateCrud.java index aa4fde4..e04fb75 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/sync/AggregateCrud.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/sync/AggregateCrud.java @@ -2,7 +2,7 @@ import io.eventuate.Aggregate; import io.eventuate.EntityIdAndType; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import io.eventuate.javaclient.commonimpl.*; import java.util.List; diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/sync/EventuateAggregateStoreImpl.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/sync/EventuateAggregateStoreImpl.java index 76afa8e..17daad3 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/sync/EventuateAggregateStoreImpl.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/sync/EventuateAggregateStoreImpl.java @@ -9,13 +9,14 @@ import io.eventuate.Event; import io.eventuate.EventWithMetadata; import io.eventuate.FindOptions; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import io.eventuate.MissingApplyEventMethodStrategy; import io.eventuate.SaveOptions; import io.eventuate.Snapshot; import io.eventuate.SnapshotManager; import io.eventuate.SubscriberOptions; import io.eventuate.UpdateOptions; +import io.eventuate.common.json.mapper.JSonMapper; import io.eventuate.javaclient.commonimpl.*; import io.eventuate.sync.EventuateAggregateStore; diff --git a/eventuate-client-java-common-impl/src/test/java/io/eventuate/javaclient/commonimpl/JSonMapperTest.java b/eventuate-client-java-common-impl/src/test/java/io/eventuate/javaclient/commonimpl/JSonMapperTest.java deleted file mode 100644 index 17eaf9b..0000000 --- a/eventuate-client-java-common-impl/src/test/java/io/eventuate/javaclient/commonimpl/JSonMapperTest.java +++ /dev/null @@ -1,123 +0,0 @@ -package io.eventuate.javaclient.commonimpl; - -import io.eventuate.Int128; -import org.apache.commons.lang.builder.EqualsBuilder; -import org.junit.Test; - -import java.math.BigDecimal; - -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.CoreMatchers.not; -import static org.junit.Assert.*; - - -public class JSonMapperTest { - - static class EmptyEvent { - - } - - static class SomeEvent { - private Int128 id; - private BigDecimal amount; - private String nullProperty; - private String anotherProperty; - - public SomeEvent() { - } - - public SomeEvent(Int128 id, BigDecimal amount, String anotherProperty) { - this.id = id; - this.amount = amount; - this.anotherProperty = anotherProperty; - } - - public Int128 getId() { - return id; - } - - public void setId(Int128 id) { - this.id = id; - } - - public BigDecimal getAmount() { - return amount; - } - - public void setAmount(BigDecimal amount) { - this.amount = amount; - } - - public String getNullProperty() { - return nullProperty; - } - - public void setNullProperty(String nullProperty) { - this.nullProperty = nullProperty; - } - - public String getAnotherProperty() { - return anotherProperty; - } - - public void setAnotherProperty(String anotherProperty) { - this.anotherProperty = anotherProperty; - } - } - - static class SubsetEvent { - private Int128 id; - private String amount; - - public Int128 getId() { - return id; - } - - public void setId(Int128 id) { - this.id = id; - } - - public String getAmount() { - return amount; - } - - public void setAmount(String amount) { - this.amount = amount; - } - } - - - private final String amountAsString = "1345.13"; - private SomeEvent original = new SomeEvent(new Int128(5, 7), new BigDecimal(amountAsString), "foo"); - - - @Test - public void shouldSerdeEmpty() { - String s = JSonMapper.toJson(new EmptyEvent()); - EmptyEvent x = JSonMapper.fromJson(s, EmptyEvent.class); - assertNotNull(x); - } - - @Test - public void shouldSerdeSomeEvent() { - String s = JSonMapper.toJson(original); - SomeEvent x = JSonMapper.fromJson(s, SomeEvent.class); - - assertThat(s, not(containsString("nullProperty"))); - - assertTrue(EqualsBuilder.reflectionEquals(original, x)); - assertEquals(original.getId(), x.getId()); - assertEquals(original.getAmount(), x.getAmount()); - assertEquals(original.getAnotherProperty(), x.getAnotherProperty()); - assertEquals(original.getNullProperty(), x.getNullProperty()); - } - - - @Test - public void shouldDeserIgnoringUnknowns() { - String s = JSonMapper.toJson(original); - SubsetEvent x = JSonMapper.fromJson(s, SubsetEvent.class); - assertEquals(original.getId(), x.getId()); - assertEquals(amountAsString, x.getAmount()); - } -} \ No newline at end of file diff --git a/eventuate-client-java-event-handling/src/main/java/io/eventuate/javaclient/domain/EventHandlerContextImpl.java b/eventuate-client-java-event-handling/src/main/java/io/eventuate/javaclient/domain/EventHandlerContextImpl.java index 641374c..d50f84f 100644 --- a/eventuate-client-java-event-handling/src/main/java/io/eventuate/javaclient/domain/EventHandlerContextImpl.java +++ b/eventuate-client-java-event-handling/src/main/java/io/eventuate/javaclient/domain/EventHandlerContextImpl.java @@ -1,6 +1,7 @@ package io.eventuate.javaclient.domain; import io.eventuate.*; +import io.eventuate.common.id.generator.Int128; import java.util.Map; import java.util.Optional; diff --git a/eventuate-client-java-event-handling/src/test/java/io/eventuate/javaclient/domain/EventDispatcherTest.java b/eventuate-client-java-event-handling/src/test/java/io/eventuate/javaclient/domain/EventDispatcherTest.java index b542447..ae0a0a3 100644 --- a/eventuate-client-java-event-handling/src/test/java/io/eventuate/javaclient/domain/EventDispatcherTest.java +++ b/eventuate-client-java-event-handling/src/test/java/io/eventuate/javaclient/domain/EventDispatcherTest.java @@ -1,6 +1,7 @@ package io.eventuate.javaclient.domain; import io.eventuate.*; +import io.eventuate.common.id.generator.Int128; import io.eventuate.javaclient.eventhandling.exceptionhandling.EventDeliveryExceptionHandlerManager; import io.eventuate.javaclient.eventhandling.exceptionhandling.EventDeliveryExceptionHandlerWithState; import io.eventuate.javaclient.eventhandling.exceptionhandling.MyException; diff --git a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/CreateEntityResponse.java b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/CreateEntityResponse.java index 7dad564..037ebd9 100644 --- a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/CreateEntityResponse.java +++ b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/CreateEntityResponse.java @@ -1,6 +1,6 @@ package io.eventuate.javaclient.restclient; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import java.util.List; diff --git a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/EventuateRESTClient.java b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/EventuateRESTClient.java index b66d48b..e833d52 100644 --- a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/EventuateRESTClient.java +++ b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/EventuateRESTClient.java @@ -1,6 +1,8 @@ package io.eventuate.javaclient.restclient; import io.eventuate.*; +import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.json.mapper.JSonMapper; import io.eventuate.javaclient.commonimpl.*; import io.eventuate.javaclient.stompclient.EventuateCredentials; import io.vertx.core.Context; diff --git a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/UpdateEntityRequest.java b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/UpdateEntityRequest.java index a24d8b3..5afdac4 100644 --- a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/UpdateEntityRequest.java +++ b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/UpdateEntityRequest.java @@ -1,7 +1,7 @@ package io.eventuate.javaclient.restclient; import io.eventuate.javaclient.commonimpl.EventTypeAndData; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import java.util.List; diff --git a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/UpdateEntityResponse.java b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/UpdateEntityResponse.java index f384b65..286213a 100644 --- a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/UpdateEntityResponse.java +++ b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/UpdateEntityResponse.java @@ -1,6 +1,6 @@ package io.eventuate.javaclient.restclient; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import java.util.List; diff --git a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/EventuateSTOMPClient.java b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/EventuateSTOMPClient.java index 7d916f2..6d016c5 100644 --- a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/EventuateSTOMPClient.java +++ b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/EventuateSTOMPClient.java @@ -2,7 +2,7 @@ import io.eventuate.SubscriberOptions; import io.eventuate.javaclient.commonimpl.AggregateEvents; -import io.eventuate.javaclient.commonimpl.JSonMapper; +import io.eventuate.common.json.mapper.JSonMapper; import io.eventuate.javaclient.commonimpl.SerializedEvent; import io.eventuate.EventContext; import io.eventuate.javaclient.restclient.VertxUtil; diff --git a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/StompEvent.java b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/StompEvent.java index 2d27298..be1c4c0 100644 --- a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/StompEvent.java +++ b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/StompEvent.java @@ -1,6 +1,6 @@ package io.eventuate.javaclient.stompclient; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import org.apache.commons.lang.builder.ToStringBuilder; public class StompEvent { diff --git a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/AbstractApiComplianceTest.java b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/AbstractApiComplianceTest.java index 31b0d2f..0a73011 100644 --- a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/AbstractApiComplianceTest.java +++ b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/AbstractApiComplianceTest.java @@ -1,6 +1,6 @@ package io.eventuate.javaclient.restclient; -import io.eventuate.javaclient.commonimpl.JSonMapper; +import io.eventuate.common.json.mapper.JSonMapper; import org.apache.commons.io.IOUtils; import org.everit.json.schema.Schema; import org.everit.json.schema.ValidationException; diff --git a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/EventuateRESTClientPactTest.java b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/EventuateRESTClientPactTest.java index de0ff45..8ef43c3 100644 --- a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/EventuateRESTClientPactTest.java +++ b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/EventuateRESTClientPactTest.java @@ -10,7 +10,7 @@ import io.eventuate.EntityIdAndType; import io.eventuate.EntityNotFoundException; import io.eventuate.EventuateServerException; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import io.eventuate.OptimisticLockingException; import io.eventuate.javaclient.commonimpl.AggregateCrudFindOptions; import io.eventuate.javaclient.commonimpl.AggregateCrudSaveOptions; diff --git a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/EventuateRESTClientTest.java b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/EventuateRESTClientTest.java index 6b49cd0..61a3865 100644 --- a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/EventuateRESTClientTest.java +++ b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/EventuateRESTClientTest.java @@ -1,7 +1,7 @@ package io.eventuate.javaclient.restclient; import io.eventuate.EntityIdAndType; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import io.eventuate.OptimisticLockingException; import io.eventuate.javaclient.commonimpl.EntityIdVersionAndEventIds; import io.eventuate.javaclient.commonimpl.EventTypeAndData; diff --git a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/RequestResponseJsonObjects.java b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/RequestResponseJsonObjects.java index 41cde1b..62cdadf 100644 --- a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/RequestResponseJsonObjects.java +++ b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/RequestResponseJsonObjects.java @@ -1,7 +1,7 @@ package io.eventuate.javaclient.restclient; import io.eventuate.EventContext; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import org.json.JSONObject; import java.util.Collections; diff --git a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/RestApiComplianceTest.java b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/RestApiComplianceTest.java index f588eb2..85369e7 100644 --- a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/RestApiComplianceTest.java +++ b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/RestApiComplianceTest.java @@ -2,7 +2,7 @@ import io.eventuate.javaclient.commonimpl.EventIdTypeAndData; import io.eventuate.javaclient.commonimpl.EventTypeAndData; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import org.junit.Test; import java.io.FileNotFoundException; diff --git a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/stompclient/EventuateSTOMPClientTest.java b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/stompclient/EventuateSTOMPClientTest.java index 9f36d60..153092d 100644 --- a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/stompclient/EventuateSTOMPClientTest.java +++ b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/stompclient/EventuateSTOMPClientTest.java @@ -1,7 +1,7 @@ package io.eventuate.javaclient.stompclient; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import io.vertx.core.Vertx; import io.vertx.core.logging.Logger; import io.vertx.core.logging.LoggerFactory; diff --git a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/stompclient/StompApiComplianceTest.java b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/stompclient/StompApiComplianceTest.java index 64ab03d..13e23c4 100644 --- a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/stompclient/StompApiComplianceTest.java +++ b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/stompclient/StompApiComplianceTest.java @@ -1,8 +1,8 @@ package io.eventuate.javaclient.stompclient; import io.eventuate.SubscriberOptions; -import io.eventuate.javaclient.commonimpl.JSonMapper; -import io.eventuate.Int128; +import io.eventuate.common.json.mapper.JSonMapper; +import io.eventuate.common.id.generator.Int128; import io.eventuate.javaclient.restclient.AbstractApiComplianceTest; import org.junit.Test; diff --git a/eventuate-client-java-jdbc-common/build.gradle b/eventuate-client-java-jdbc-common/build.gradle index d1f78d0..0d91947 100644 --- a/eventuate-client-java-jdbc-common/build.gradle +++ b/eventuate-client-java-jdbc-common/build.gradle @@ -2,9 +2,9 @@ apply plugin: PublicModulePlugin dependencies { compile project(":eventuate-client-java-common-impl") + compile "io.eventuate.common:eventuate-common-id-generator:$eventuateCommonVersion" compile "org.springframework.boot:spring-boot-starter:$springBootVersion" compile "org.springframework.boot:spring-boot-starter-jdbc:$springBootVersion" compile "io.eventuate.common:eventuate-common-jdbc:$eventuateCommonVersion" - testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion" } \ No newline at end of file diff --git a/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/AbstractJdbcAggregateCrud.java b/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/AbstractJdbcAggregateCrud.java index 76ef7ed..c11dad6 100644 --- a/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/AbstractJdbcAggregateCrud.java +++ b/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/AbstractJdbcAggregateCrud.java @@ -2,7 +2,7 @@ import io.eventuate.Aggregate; import io.eventuate.EntityIdAndType; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import io.eventuate.javaclient.commonimpl.*; import io.eventuate.javaclient.commonimpl.sync.AggregateCrud; diff --git a/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccess.java b/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccess.java index ea89ee6..f864181 100644 --- a/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccess.java +++ b/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccess.java @@ -2,7 +2,7 @@ import io.eventuate.Aggregate; import io.eventuate.EntityIdAndType; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import io.eventuate.javaclient.commonimpl.*; import java.util.List; diff --git a/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccessImpl.java b/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccessImpl.java index 4f6f4c5..b77157b 100644 --- a/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccessImpl.java +++ b/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccessImpl.java @@ -6,7 +6,9 @@ import io.eventuate.EntityIdAndType; import io.eventuate.EntityNotFoundException; import io.eventuate.EventContext; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.IdGenerator; +import io.eventuate.common.id.generator.IdGeneratorImpl; +import io.eventuate.common.id.generator.Int128; import io.eventuate.OptimisticLockingException; import io.eventuate.common.jdbc.EventuateCommonJdbcOperations; import io.eventuate.common.jdbc.EventuateSchema; diff --git a/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/IdGenerator.java b/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/IdGenerator.java deleted file mode 100644 index 90e7929..0000000 --- a/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/IdGenerator.java +++ /dev/null @@ -1,7 +0,0 @@ -package io.eventuate.javaclient.spring.jdbc; - -import io.eventuate.Int128; - -public interface IdGenerator { - Int128 genId(); -} diff --git a/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/IdGeneratorImpl.java b/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/IdGeneratorImpl.java deleted file mode 100644 index d676a07..0000000 --- a/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/IdGeneratorImpl.java +++ /dev/null @@ -1,73 +0,0 @@ -package io.eventuate.javaclient.spring.jdbc; - -import io.eventuate.Int128; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.net.NetworkInterface; -import java.net.SocketException; -import java.util.Enumeration; - -public class IdGeneratorImpl implements IdGenerator { - - private Logger logger = LoggerFactory.getLogger(getClass()); - private static final long MAX_COUNTER = 1 << 16; - - private Long macAddress; - private long currentPeriod = timeNow(); - private long counter = 0; - - - public IdGeneratorImpl() { - try { - Enumeration ifaces = NetworkInterface.getNetworkInterfaces(); - while (ifaces.hasMoreElements()) { - NetworkInterface iface = ifaces.nextElement(); - if (iface.getHardwareAddress() != null) { - macAddress = toLong(iface.getHardwareAddress()); - logger.debug("Mac address {}", macAddress); - break; - } - } - if (macAddress == null) - throw new RuntimeException("Cannot find mac address"); - } catch (SocketException e) { - throw new RuntimeException(e); - } - } - - private Long toLong(byte[] bytes) { - long result = 0L; - for (byte b : bytes) { - result = (result << 8) + (b & 0xff); - } - return result; - } - - private long timeNow() { - return System.currentTimeMillis(); - } - - private Int128 makeId() { - return new Int128(currentPeriod, (macAddress << 16) + counter); - } - - public Int128 genIdInternal() { - long now = timeNow(); - if (currentPeriod != now || counter == MAX_COUNTER) { - long oldPeriod = this.currentPeriod; - while ((this.currentPeriod = timeNow()) <= oldPeriod) { - // Just do nothing - } - counter = 0; - } - Int128 id = makeId(); - counter = counter + 1; - return id; - } - - @Override - public synchronized Int128 genId() { - return genIdInternal(); - } -} diff --git a/eventuate-client-java-jdbc-common/src/test/java/io/eventuate/javaclient/spring/jdbc/IdGeneratorImplTest.java b/eventuate-client-java-jdbc-common/src/test/java/io/eventuate/javaclient/spring/jdbc/IdGeneratorImplTest.java deleted file mode 100644 index 1fac246..0000000 --- a/eventuate-client-java-jdbc-common/src/test/java/io/eventuate/javaclient/spring/jdbc/IdGeneratorImplTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package io.eventuate.javaclient.spring.jdbc; - -import io.eventuate.Int128; -import org.junit.Test; - -import java.util.concurrent.TimeUnit; -import java.util.stream.IntStream; - -import static org.junit.Assert.*; - -public class IdGeneratorImplTest { - - @Test - public void shouldGenerateId() { - IdGeneratorImpl idGen = new IdGeneratorImpl(); - Int128 id = idGen.genId(); - assertNotNull(id); - } - - @Test - public void shouldGenerateMonotonicId() { - IdGeneratorImpl idGen = new IdGeneratorImpl(); - Int128 id1 = idGen.genId(); - Int128 id2 = idGen.genId(); - assertTrue(id1.compareTo(id2) < 0); - } - - @Test - public void shouldGenerateLotsOfIds() throws InterruptedException { - IdGeneratorImpl idGen = new IdGeneratorImpl(); - IntStream.range(1, 1000000).forEach(x -> idGen.genId()); - TimeUnit.SECONDS.sleep(1); - IntStream.range(1, 1000000).forEach(x -> idGen.genId()); - } - -} \ No newline at end of file diff --git a/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/EventuateEmbeddedTestAggregateStoreTest.java b/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/EventuateEmbeddedTestAggregateStoreTest.java index 0920255..06d9161 100644 --- a/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/EventuateEmbeddedTestAggregateStoreTest.java +++ b/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/EventuateEmbeddedTestAggregateStoreTest.java @@ -1,6 +1,7 @@ package io.eventuate.javaclient.spring.jdbc; import io.eventuate.*; +import io.eventuate.common.id.generator.Int128; import io.eventuate.javaclient.commonimpl.*; import io.eventuate.javaclient.commonimpl.sync.AggregateCrud; import io.eventuate.javaclient.commonimpl.sync.AggregateEvents; diff --git a/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/AbstractTestEventHandler.java b/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/AbstractTestEventHandler.java index eea0e17..184f624 100644 --- a/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/AbstractTestEventHandler.java +++ b/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/AbstractTestEventHandler.java @@ -3,7 +3,7 @@ import io.eventuate.DispatchedEvent; import io.eventuate.Event; import io.eventuate.EventHandlerContext; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/MockEventHandlerContextInternal.java b/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/MockEventHandlerContextInternal.java index 1413e84..8a14388 100644 --- a/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/MockEventHandlerContextInternal.java +++ b/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/MockEventHandlerContextInternal.java @@ -1,6 +1,7 @@ package io.eventuate.testutil; import io.eventuate.*; +import io.eventuate.common.id.generator.Int128; import org.mockito.ArgumentCaptor; import java.util.Optional; diff --git a/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/ReceivedEvent.java b/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/ReceivedEvent.java index 92afe2c..e6f8597 100644 --- a/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/ReceivedEvent.java +++ b/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/ReceivedEvent.java @@ -1,7 +1,7 @@ package io.eventuate.testutil; import io.eventuate.Event; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import java.util.Map; import java.util.Optional; diff --git a/eventuate-client-java-tests-example-domain/src/main/java/io/eventuate/example/banking/domain/AccountSnapshotStrategy.java b/eventuate-client-java-tests-example-domain/src/main/java/io/eventuate/example/banking/domain/AccountSnapshotStrategy.java index 79fd83c..d3470e3 100644 --- a/eventuate-client-java-tests-example-domain/src/main/java/io/eventuate/example/banking/domain/AccountSnapshotStrategy.java +++ b/eventuate-client-java-tests-example-domain/src/main/java/io/eventuate/example/banking/domain/AccountSnapshotStrategy.java @@ -4,7 +4,7 @@ import io.eventuate.Aggregates; import io.eventuate.Event; import io.eventuate.EventWithMetadata; -import io.eventuate.Int128; +import io.eventuate.common.id.generator.Int128; import io.eventuate.MissingApplyEventMethodStrategy; import io.eventuate.Snapshot; import io.eventuate.SnapshotStrategy; diff --git a/eventuate-client-java-tests/src/test/java/io/eventuate/example/banking/domain/SerializationTest.java b/eventuate-client-java-tests/src/test/java/io/eventuate/example/banking/domain/SerializationTest.java index aaabae7..3153fd4 100644 --- a/eventuate-client-java-tests/src/test/java/io/eventuate/example/banking/domain/SerializationTest.java +++ b/eventuate-client-java-tests/src/test/java/io/eventuate/example/banking/domain/SerializationTest.java @@ -1,6 +1,6 @@ package io.eventuate.example.banking.domain; -import io.eventuate.javaclient.commonimpl.JSonMapper; +import io.eventuate.common.json.mapper.JSonMapper; import org.junit.Test; import java.math.BigDecimal; diff --git a/eventuate-client-java/build.gradle b/eventuate-client-java/build.gradle index a60259b..ee039be 100644 --- a/eventuate-client-java/build.gradle +++ b/eventuate-client-java/build.gradle @@ -4,6 +4,8 @@ dependencies { compile "commons-lang:commons-lang:2.6" compile "org.slf4j:slf4j-api:1.7.18" + compile "io.eventuate.common:eventuate-common-id-generator:$eventuateCommonVersion" + testCompile project(":eventuate-client-java-tests-example-domain") testCompile 'org.mockito:mockito-all:1.10.19' diff --git a/eventuate-client-java/src/main/java/io/eventuate/AggregateRepository.java b/eventuate-client-java/src/main/java/io/eventuate/AggregateRepository.java index 96b7d59..525dcba 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/AggregateRepository.java +++ b/eventuate-client-java/src/main/java/io/eventuate/AggregateRepository.java @@ -1,6 +1,7 @@ package io.eventuate; +import io.eventuate.common.id.generator.Int128; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/eventuate-client-java/src/main/java/io/eventuate/DispatchedEvent.java b/eventuate-client-java/src/main/java/io/eventuate/DispatchedEvent.java index 3e8d832..32076ee 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/DispatchedEvent.java +++ b/eventuate-client-java/src/main/java/io/eventuate/DispatchedEvent.java @@ -1,5 +1,6 @@ package io.eventuate; +import io.eventuate.common.id.generator.Int128; import org.apache.commons.lang.builder.ToStringBuilder; import java.util.Map; diff --git a/eventuate-client-java/src/main/java/io/eventuate/EntityIdAndVersion.java b/eventuate-client-java/src/main/java/io/eventuate/EntityIdAndVersion.java index f4b4f4f..44ddc95 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/EntityIdAndVersion.java +++ b/eventuate-client-java/src/main/java/io/eventuate/EntityIdAndVersion.java @@ -1,5 +1,6 @@ package io.eventuate; +import io.eventuate.common.id.generator.Int128; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; diff --git a/eventuate-client-java/src/main/java/io/eventuate/EntityWithIdAndVersion.java b/eventuate-client-java/src/main/java/io/eventuate/EntityWithIdAndVersion.java index 9fed700..eea4b04 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/EntityWithIdAndVersion.java +++ b/eventuate-client-java/src/main/java/io/eventuate/EntityWithIdAndVersion.java @@ -1,5 +1,6 @@ package io.eventuate; +import io.eventuate.common.id.generator.Int128; import org.apache.commons.lang.builder.ToStringBuilder; public class EntityWithIdAndVersion { diff --git a/eventuate-client-java/src/main/java/io/eventuate/EntityWithMetadata.java b/eventuate-client-java/src/main/java/io/eventuate/EntityWithMetadata.java index 2d8dadc..b1362a8 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/EntityWithMetadata.java +++ b/eventuate-client-java/src/main/java/io/eventuate/EntityWithMetadata.java @@ -1,5 +1,7 @@ package io.eventuate; +import io.eventuate.common.id.generator.Int128; + import java.util.List; import java.util.Optional; diff --git a/eventuate-client-java/src/main/java/io/eventuate/EventEnvelope.java b/eventuate-client-java/src/main/java/io/eventuate/EventEnvelope.java index 0812f96..1ad6806 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/EventEnvelope.java +++ b/eventuate-client-java/src/main/java/io/eventuate/EventEnvelope.java @@ -1,5 +1,7 @@ package io.eventuate; +import io.eventuate.common.id.generator.Int128; + import java.util.Map; import java.util.Optional; diff --git a/eventuate-client-java/src/main/java/io/eventuate/EventIdAndType.java b/eventuate-client-java/src/main/java/io/eventuate/EventIdAndType.java index 8524b5c..fe8cc6b 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/EventIdAndType.java +++ b/eventuate-client-java/src/main/java/io/eventuate/EventIdAndType.java @@ -1,6 +1,8 @@ package io.eventuate; +import io.eventuate.common.id.generator.Int128; + public class EventIdAndType { private Int128 id; diff --git a/eventuate-client-java/src/main/java/io/eventuate/EventWithMetadata.java b/eventuate-client-java/src/main/java/io/eventuate/EventWithMetadata.java index 0d5c3f6..7c13b25 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/EventWithMetadata.java +++ b/eventuate-client-java/src/main/java/io/eventuate/EventWithMetadata.java @@ -1,5 +1,7 @@ package io.eventuate; +import io.eventuate.common.id.generator.Int128; + import java.util.Map; import java.util.Optional; diff --git a/eventuate-client-java/src/main/java/io/eventuate/EventuateAggregateStore.java b/eventuate-client-java/src/main/java/io/eventuate/EventuateAggregateStore.java index 8426d55..e69ef0b 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/EventuateAggregateStore.java +++ b/eventuate-client-java/src/main/java/io/eventuate/EventuateAggregateStore.java @@ -1,5 +1,7 @@ package io.eventuate; +import io.eventuate.common.id.generator.Int128; + import java.util.List; import java.util.Map; import java.util.Optional; diff --git a/eventuate-client-java/src/main/java/io/eventuate/Int128.java b/eventuate-client-java/src/main/java/io/eventuate/Int128.java deleted file mode 100644 index 7840088..0000000 --- a/eventuate-client-java/src/main/java/io/eventuate/Int128.java +++ /dev/null @@ -1,59 +0,0 @@ -package io.eventuate; - -public class Int128 { - - private long hi; - private long lo; - - public Int128(long hi, long lo) { - this.hi = hi; - this.lo = lo; - } - - public String asString() { - return String.format("%016x-%016x", hi, lo); - } - - @Override - public String toString() { - return "Int128{" + asString() + '}'; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Int128 int128 = (Int128) o; - - return hi == int128.hi && lo == int128.lo; - - } - - @Override - public int hashCode() { - int result = (int) (hi ^ (hi >>> 32)); - result = 31 * result + (int) (lo ^ (lo >>> 32)); - return result; - } - - public static Int128 fromString(String str) { - String[] s = str.split("-"); - if (s.length != 2) - throw new IllegalArgumentException("Should have length of 2: " + str); - return new Int128(Long.parseUnsignedLong(s[0], 16), Long.parseUnsignedLong(s[1], 16)); - } - - public int compareTo(Int128 other) { - int x = Long.compare(hi, other.hi); - return x == 0 ? Long.compare(lo, other.lo) : x; - } - - public long getHi() { - return hi; - } - - public long getLo() { - return lo; - } -} diff --git a/eventuate-client-java/src/main/java/io/eventuate/OptimisticLockingException.java b/eventuate-client-java/src/main/java/io/eventuate/OptimisticLockingException.java index 2068a0d..6e6a22a 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/OptimisticLockingException.java +++ b/eventuate-client-java/src/main/java/io/eventuate/OptimisticLockingException.java @@ -1,5 +1,7 @@ package io.eventuate; +import io.eventuate.common.id.generator.Int128; + public class OptimisticLockingException extends EventuateClientException { private EntityIdAndType entityIdAndType; diff --git a/eventuate-client-java/src/main/java/io/eventuate/SnapshotManager.java b/eventuate-client-java/src/main/java/io/eventuate/SnapshotManager.java index e03797f..08a8e38 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/SnapshotManager.java +++ b/eventuate-client-java/src/main/java/io/eventuate/SnapshotManager.java @@ -1,5 +1,7 @@ package io.eventuate; +import io.eventuate.common.id.generator.Int128; + import java.util.List; import java.util.Optional; diff --git a/eventuate-client-java/src/main/java/io/eventuate/SnapshotManagerImpl.java b/eventuate-client-java/src/main/java/io/eventuate/SnapshotManagerImpl.java index eb8278b..d831410 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/SnapshotManagerImpl.java +++ b/eventuate-client-java/src/main/java/io/eventuate/SnapshotManagerImpl.java @@ -1,5 +1,7 @@ package io.eventuate; +import io.eventuate.common.id.generator.Int128; + import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/eventuate-client-java/src/main/java/io/eventuate/SnapshotStrategy.java b/eventuate-client-java/src/main/java/io/eventuate/SnapshotStrategy.java index ada7333..c58b441 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/SnapshotStrategy.java +++ b/eventuate-client-java/src/main/java/io/eventuate/SnapshotStrategy.java @@ -1,5 +1,7 @@ package io.eventuate; +import io.eventuate.common.id.generator.Int128; + import java.util.List; import java.util.Optional; diff --git a/eventuate-client-java/src/main/java/io/eventuate/sync/AggregateRepository.java b/eventuate-client-java/src/main/java/io/eventuate/sync/AggregateRepository.java index 3b4c5ad..0542f16 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/sync/AggregateRepository.java +++ b/eventuate-client-java/src/main/java/io/eventuate/sync/AggregateRepository.java @@ -2,6 +2,7 @@ import io.eventuate.*; +import io.eventuate.common.id.generator.Int128; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/eventuate-client-java/src/main/java/io/eventuate/sync/EventuateAggregateStore.java b/eventuate-client-java/src/main/java/io/eventuate/sync/EventuateAggregateStore.java index c777774..a24990a 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/sync/EventuateAggregateStore.java +++ b/eventuate-client-java/src/main/java/io/eventuate/sync/EventuateAggregateStore.java @@ -1,6 +1,7 @@ package io.eventuate.sync; import io.eventuate.*; +import io.eventuate.common.id.generator.Int128; import java.util.List; import java.util.Map; diff --git a/eventuate-client-java/src/test/java/io/eventuate/AggregateRepositoryTest.java b/eventuate-client-java/src/test/java/io/eventuate/AggregateRepositoryTest.java index 911acb0..b7d92e0 100644 --- a/eventuate-client-java/src/test/java/io/eventuate/AggregateRepositoryTest.java +++ b/eventuate-client-java/src/test/java/io/eventuate/AggregateRepositoryTest.java @@ -1,5 +1,6 @@ package io.eventuate; +import io.eventuate.common.id.generator.Int128; import io.eventuate.example.banking.domain.Account; import io.eventuate.example.banking.domain.AccountCommand; import io.eventuate.example.banking.domain.AccountCreatedEvent; diff --git a/eventuate-client-java/src/test/java/io/eventuate/Int128Test.java b/eventuate-client-java/src/test/java/io/eventuate/Int128Test.java deleted file mode 100644 index 7f8e93b..0000000 --- a/eventuate-client-java/src/test/java/io/eventuate/Int128Test.java +++ /dev/null @@ -1,37 +0,0 @@ -package io.eventuate; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -public class Int128Test { - - @Test - public void shouldParse() { - String s = "00000153812efe94-0242ac1100800000"; - Int128 x = Int128.fromString(s); - assertEquals(s, x.asString()); - } - - @Test - public void shouldParse2() { - Int128 x = new Int128(15, 3); - String s = "000000000000000f-0000000000000003"; - assertEquals(s, x.asString()); - } - - - @Test - public void shouldParse3() { - String s = "000001568d0065ee-9246580c3b090000"; - Int128 x = Int128.fromString(s); - assertEquals(s, x.asString()); - } - - @Test - public void shouldParse4() { - String s = "900001568d0065ee-9246580c3b090000"; - Int128 x = Int128.fromString(s); - assertEquals(s, x.asString()); - } -} From f6cb8c2dca8ef21a6faeae693296d759bc731953 Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Mon, 3 Jun 2019 16:05:24 +0300 Subject: [PATCH 6/8] Adapted to changes in the common project --- eventuate-client-java-common-impl/build.gradle | 2 +- .../io/eventuate/javaclient/commonimpl/AggregateCrud.java | 2 +- .../javaclient/commonimpl/AggregateCrudMapping.java | 2 +- .../javaclient/commonimpl/EntityIdVersionAndEventIds.java | 2 +- .../eventuate/javaclient/commonimpl/EventIdTypeAndData.java | 2 +- .../javaclient/commonimpl/EventuateAggregateStoreImpl.java | 2 +- .../io/eventuate/javaclient/commonimpl/SerializedEvent.java | 2 +- .../commonimpl/SerializedSnapshotWithVersion.java | 2 +- .../adapters/AsyncToSyncAggregateCrudAdapter.java | 2 +- .../adapters/SyncToAsyncAggregateCrudAdapter.java | 2 +- .../eventuate/javaclient/commonimpl/sync/AggregateCrud.java | 2 +- .../commonimpl/sync/EventuateAggregateStoreImpl.java | 2 +- .../javaclient/domain/EventHandlerContextImpl.java | 2 +- .../io/eventuate/javaclient/domain/EventDispatcherTest.java | 2 +- .../javaclient/restclient/CreateEntityResponse.java | 2 +- .../javaclient/restclient/EventuateRESTClient.java | 2 +- .../javaclient/restclient/UpdateEntityRequest.java | 2 +- .../javaclient/restclient/UpdateEntityResponse.java | 2 +- .../io/eventuate/javaclient/stompclient/StompEvent.java | 2 +- .../javaclient/restclient/EventuateRESTClientPactTest.java | 2 +- .../javaclient/restclient/EventuateRESTClientTest.java | 2 +- .../javaclient/restclient/RequestResponseJsonObjects.java | 2 +- .../javaclient/restclient/RestApiComplianceTest.java | 2 +- .../javaclient/stompclient/EventuateSTOMPClientTest.java | 2 +- .../javaclient/stompclient/StompApiComplianceTest.java | 2 +- eventuate-client-java-jdbc-common/build.gradle | 2 +- .../javaclient/spring/jdbc/AbstractJdbcAggregateCrud.java | 2 +- .../javaclient/spring/jdbc/EventuateJdbcAccess.java | 2 +- .../javaclient/spring/jdbc/EventuateJdbcAccessImpl.java | 6 +++--- .../jdbc/EventuateEmbeddedTestAggregateStoreTest.java | 2 +- .../io/eventuate/testutil/AbstractTestEventHandler.java | 2 +- .../eventuate/testutil/MockEventHandlerContextInternal.java | 2 +- .../src/main/java/io/eventuate/testutil/ReceivedEvent.java | 2 +- .../example/banking/domain/AccountSnapshotStrategy.java | 2 +- eventuate-client-java/build.gradle | 2 +- .../src/main/java/io/eventuate/AggregateRepository.java | 2 +- .../src/main/java/io/eventuate/DispatchedEvent.java | 2 +- .../src/main/java/io/eventuate/EntityIdAndVersion.java | 2 +- .../src/main/java/io/eventuate/EntityWithIdAndVersion.java | 2 +- .../src/main/java/io/eventuate/EntityWithMetadata.java | 2 +- .../src/main/java/io/eventuate/EventEnvelope.java | 2 +- .../src/main/java/io/eventuate/EventIdAndType.java | 2 +- .../src/main/java/io/eventuate/EventWithMetadata.java | 2 +- .../src/main/java/io/eventuate/EventuateAggregateStore.java | 2 +- .../main/java/io/eventuate/OptimisticLockingException.java | 2 +- .../src/main/java/io/eventuate/SnapshotManager.java | 2 +- .../src/main/java/io/eventuate/SnapshotManagerImpl.java | 2 +- .../src/main/java/io/eventuate/SnapshotStrategy.java | 2 +- .../main/java/io/eventuate/sync/AggregateRepository.java | 2 +- .../java/io/eventuate/sync/EventuateAggregateStore.java | 2 +- .../src/test/java/io/eventuate/AggregateRepositoryTest.java | 2 +- 51 files changed, 53 insertions(+), 53 deletions(-) diff --git a/eventuate-client-java-common-impl/build.gradle b/eventuate-client-java-common-impl/build.gradle index 8274422..0768164 100644 --- a/eventuate-client-java-common-impl/build.gradle +++ b/eventuate-client-java-common-impl/build.gradle @@ -4,7 +4,7 @@ dependencies { compile project(":eventuate-client-java") compile "io.eventuate.common:eventuate-common-json-mapper:$eventuateCommonVersion" - compile "io.eventuate.common:eventuate-common-id-generator:$eventuateCommonVersion" + compile "io.eventuate.common:eventuate-common-id:$eventuateCommonVersion" compile "com.fasterxml.jackson.core:jackson-databind:2.8.8" compile "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.8.8" diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/AggregateCrud.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/AggregateCrud.java index c550386..1ca1950 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/AggregateCrud.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/AggregateCrud.java @@ -1,7 +1,7 @@ package io.eventuate.javaclient.commonimpl; import io.eventuate.*; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import java.util.List; import java.util.Optional; diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/AggregateCrudMapping.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/AggregateCrudMapping.java index 4f147d3..a19ac04 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/AggregateCrudMapping.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/AggregateCrudMapping.java @@ -3,7 +3,7 @@ import io.eventuate.Event; import io.eventuate.EventWithMetadata; import io.eventuate.FindOptions; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import io.eventuate.SaveOptions; import io.eventuate.Snapshot; import io.eventuate.UpdateOptions; diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EntityIdVersionAndEventIds.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EntityIdVersionAndEventIds.java index 235a6c4..4422494 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EntityIdVersionAndEventIds.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EntityIdVersionAndEventIds.java @@ -1,7 +1,7 @@ package io.eventuate.javaclient.commonimpl; import io.eventuate.EntityIdAndVersion; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EventIdTypeAndData.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EventIdTypeAndData.java index 2463a5c..4a23272 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EventIdTypeAndData.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EventIdTypeAndData.java @@ -1,6 +1,6 @@ package io.eventuate.javaclient.commonimpl; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EventuateAggregateStoreImpl.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EventuateAggregateStoreImpl.java index 49b0036..d8d9513 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EventuateAggregateStoreImpl.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/EventuateAggregateStoreImpl.java @@ -1,7 +1,7 @@ package io.eventuate.javaclient.commonimpl; import io.eventuate.*; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import io.eventuate.common.json.mapper.JSonMapper; import io.eventuate.javaclient.commonimpl.schemametadata.EmptyEventSchemaMetadataManager; import io.eventuate.javaclient.commonimpl.schemametadata.EventSchemaMetadataManager; diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/SerializedEvent.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/SerializedEvent.java index 59eba54..d40154c 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/SerializedEvent.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/SerializedEvent.java @@ -1,7 +1,7 @@ package io.eventuate.javaclient.commonimpl; import io.eventuate.EventContext; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import org.apache.commons.lang.builder.ToStringBuilder; import java.util.Optional; diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/SerializedSnapshotWithVersion.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/SerializedSnapshotWithVersion.java index 784a06f..401cd0d 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/SerializedSnapshotWithVersion.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/SerializedSnapshotWithVersion.java @@ -1,6 +1,6 @@ package io.eventuate.javaclient.commonimpl; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; public class SerializedSnapshotWithVersion { diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/adapters/AsyncToSyncAggregateCrudAdapter.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/adapters/AsyncToSyncAggregateCrudAdapter.java index c1e8ff5..5378d93 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/adapters/AsyncToSyncAggregateCrudAdapter.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/adapters/AsyncToSyncAggregateCrudAdapter.java @@ -3,7 +3,7 @@ import io.eventuate.Aggregate; import io.eventuate.CompletableFutureUtil; import io.eventuate.EntityIdAndType; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import io.eventuate.javaclient.commonimpl.*; import java.util.List; diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/adapters/SyncToAsyncAggregateCrudAdapter.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/adapters/SyncToAsyncAggregateCrudAdapter.java index 09193ca..cfc7d3e 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/adapters/SyncToAsyncAggregateCrudAdapter.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/adapters/SyncToAsyncAggregateCrudAdapter.java @@ -3,7 +3,7 @@ import io.eventuate.Aggregate; import io.eventuate.CompletableFutureUtil; import io.eventuate.EntityIdAndType; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import io.eventuate.javaclient.commonimpl.AggregateCrudFindOptions; import io.eventuate.javaclient.commonimpl.AggregateCrudSaveOptions; import io.eventuate.javaclient.commonimpl.AggregateCrudUpdateOptions; diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/sync/AggregateCrud.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/sync/AggregateCrud.java index e04fb75..8a024ff 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/sync/AggregateCrud.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/sync/AggregateCrud.java @@ -2,7 +2,7 @@ import io.eventuate.Aggregate; import io.eventuate.EntityIdAndType; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import io.eventuate.javaclient.commonimpl.*; import java.util.List; diff --git a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/sync/EventuateAggregateStoreImpl.java b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/sync/EventuateAggregateStoreImpl.java index 17daad3..00061b5 100644 --- a/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/sync/EventuateAggregateStoreImpl.java +++ b/eventuate-client-java-common-impl/src/main/java/io/eventuate/javaclient/commonimpl/sync/EventuateAggregateStoreImpl.java @@ -9,7 +9,7 @@ import io.eventuate.Event; import io.eventuate.EventWithMetadata; import io.eventuate.FindOptions; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import io.eventuate.MissingApplyEventMethodStrategy; import io.eventuate.SaveOptions; import io.eventuate.Snapshot; diff --git a/eventuate-client-java-event-handling/src/main/java/io/eventuate/javaclient/domain/EventHandlerContextImpl.java b/eventuate-client-java-event-handling/src/main/java/io/eventuate/javaclient/domain/EventHandlerContextImpl.java index d50f84f..e275e42 100644 --- a/eventuate-client-java-event-handling/src/main/java/io/eventuate/javaclient/domain/EventHandlerContextImpl.java +++ b/eventuate-client-java-event-handling/src/main/java/io/eventuate/javaclient/domain/EventHandlerContextImpl.java @@ -1,7 +1,7 @@ package io.eventuate.javaclient.domain; import io.eventuate.*; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import java.util.Map; import java.util.Optional; diff --git a/eventuate-client-java-event-handling/src/test/java/io/eventuate/javaclient/domain/EventDispatcherTest.java b/eventuate-client-java-event-handling/src/test/java/io/eventuate/javaclient/domain/EventDispatcherTest.java index ae0a0a3..156d251 100644 --- a/eventuate-client-java-event-handling/src/test/java/io/eventuate/javaclient/domain/EventDispatcherTest.java +++ b/eventuate-client-java-event-handling/src/test/java/io/eventuate/javaclient/domain/EventDispatcherTest.java @@ -1,7 +1,7 @@ package io.eventuate.javaclient.domain; import io.eventuate.*; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import io.eventuate.javaclient.eventhandling.exceptionhandling.EventDeliveryExceptionHandlerManager; import io.eventuate.javaclient.eventhandling.exceptionhandling.EventDeliveryExceptionHandlerWithState; import io.eventuate.javaclient.eventhandling.exceptionhandling.MyException; diff --git a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/CreateEntityResponse.java b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/CreateEntityResponse.java index 037ebd9..feb0c39 100644 --- a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/CreateEntityResponse.java +++ b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/CreateEntityResponse.java @@ -1,6 +1,6 @@ package io.eventuate.javaclient.restclient; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import java.util.List; diff --git a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/EventuateRESTClient.java b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/EventuateRESTClient.java index e833d52..5192bc8 100644 --- a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/EventuateRESTClient.java +++ b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/EventuateRESTClient.java @@ -1,7 +1,7 @@ package io.eventuate.javaclient.restclient; import io.eventuate.*; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import io.eventuate.common.json.mapper.JSonMapper; import io.eventuate.javaclient.commonimpl.*; import io.eventuate.javaclient.stompclient.EventuateCredentials; diff --git a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/UpdateEntityRequest.java b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/UpdateEntityRequest.java index 5afdac4..2d4c27e 100644 --- a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/UpdateEntityRequest.java +++ b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/UpdateEntityRequest.java @@ -1,7 +1,7 @@ package io.eventuate.javaclient.restclient; import io.eventuate.javaclient.commonimpl.EventTypeAndData; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import java.util.List; diff --git a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/UpdateEntityResponse.java b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/UpdateEntityResponse.java index 286213a..90b9716 100644 --- a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/UpdateEntityResponse.java +++ b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/restclient/UpdateEntityResponse.java @@ -1,6 +1,6 @@ package io.eventuate.javaclient.restclient; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import java.util.List; diff --git a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/StompEvent.java b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/StompEvent.java index be1c4c0..44b9476 100644 --- a/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/StompEvent.java +++ b/eventuate-client-java-http-stomp/src/main/java/io/eventuate/javaclient/stompclient/StompEvent.java @@ -1,6 +1,6 @@ package io.eventuate.javaclient.stompclient; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import org.apache.commons.lang.builder.ToStringBuilder; public class StompEvent { diff --git a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/EventuateRESTClientPactTest.java b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/EventuateRESTClientPactTest.java index 8ef43c3..7d844be 100644 --- a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/EventuateRESTClientPactTest.java +++ b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/EventuateRESTClientPactTest.java @@ -10,7 +10,7 @@ import io.eventuate.EntityIdAndType; import io.eventuate.EntityNotFoundException; import io.eventuate.EventuateServerException; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import io.eventuate.OptimisticLockingException; import io.eventuate.javaclient.commonimpl.AggregateCrudFindOptions; import io.eventuate.javaclient.commonimpl.AggregateCrudSaveOptions; diff --git a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/EventuateRESTClientTest.java b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/EventuateRESTClientTest.java index 61a3865..57ebb57 100644 --- a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/EventuateRESTClientTest.java +++ b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/EventuateRESTClientTest.java @@ -1,7 +1,7 @@ package io.eventuate.javaclient.restclient; import io.eventuate.EntityIdAndType; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import io.eventuate.OptimisticLockingException; import io.eventuate.javaclient.commonimpl.EntityIdVersionAndEventIds; import io.eventuate.javaclient.commonimpl.EventTypeAndData; diff --git a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/RequestResponseJsonObjects.java b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/RequestResponseJsonObjects.java index 62cdadf..eb7d463 100644 --- a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/RequestResponseJsonObjects.java +++ b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/RequestResponseJsonObjects.java @@ -1,7 +1,7 @@ package io.eventuate.javaclient.restclient; import io.eventuate.EventContext; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import org.json.JSONObject; import java.util.Collections; diff --git a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/RestApiComplianceTest.java b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/RestApiComplianceTest.java index 85369e7..02a0ee6 100644 --- a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/RestApiComplianceTest.java +++ b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/restclient/RestApiComplianceTest.java @@ -2,7 +2,7 @@ import io.eventuate.javaclient.commonimpl.EventIdTypeAndData; import io.eventuate.javaclient.commonimpl.EventTypeAndData; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import org.junit.Test; import java.io.FileNotFoundException; diff --git a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/stompclient/EventuateSTOMPClientTest.java b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/stompclient/EventuateSTOMPClientTest.java index 153092d..632d537 100644 --- a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/stompclient/EventuateSTOMPClientTest.java +++ b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/stompclient/EventuateSTOMPClientTest.java @@ -1,7 +1,7 @@ package io.eventuate.javaclient.stompclient; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import io.vertx.core.Vertx; import io.vertx.core.logging.Logger; import io.vertx.core.logging.LoggerFactory; diff --git a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/stompclient/StompApiComplianceTest.java b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/stompclient/StompApiComplianceTest.java index 13e23c4..a2a22a3 100644 --- a/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/stompclient/StompApiComplianceTest.java +++ b/eventuate-client-java-http-stomp/src/test/java/io/eventuate/javaclient/stompclient/StompApiComplianceTest.java @@ -2,7 +2,7 @@ import io.eventuate.SubscriberOptions; import io.eventuate.common.json.mapper.JSonMapper; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import io.eventuate.javaclient.restclient.AbstractApiComplianceTest; import org.junit.Test; diff --git a/eventuate-client-java-jdbc-common/build.gradle b/eventuate-client-java-jdbc-common/build.gradle index 0d91947..327e8dc 100644 --- a/eventuate-client-java-jdbc-common/build.gradle +++ b/eventuate-client-java-jdbc-common/build.gradle @@ -2,7 +2,7 @@ apply plugin: PublicModulePlugin dependencies { compile project(":eventuate-client-java-common-impl") - compile "io.eventuate.common:eventuate-common-id-generator:$eventuateCommonVersion" + compile "io.eventuate.common:eventuate-common-id:$eventuateCommonVersion" compile "org.springframework.boot:spring-boot-starter:$springBootVersion" compile "org.springframework.boot:spring-boot-starter-jdbc:$springBootVersion" compile "io.eventuate.common:eventuate-common-jdbc:$eventuateCommonVersion" diff --git a/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/AbstractJdbcAggregateCrud.java b/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/AbstractJdbcAggregateCrud.java index c11dad6..ca489c6 100644 --- a/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/AbstractJdbcAggregateCrud.java +++ b/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/AbstractJdbcAggregateCrud.java @@ -2,7 +2,7 @@ import io.eventuate.Aggregate; import io.eventuate.EntityIdAndType; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import io.eventuate.javaclient.commonimpl.*; import io.eventuate.javaclient.commonimpl.sync.AggregateCrud; diff --git a/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccess.java b/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccess.java index f864181..110c827 100644 --- a/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccess.java +++ b/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccess.java @@ -2,7 +2,7 @@ import io.eventuate.Aggregate; import io.eventuate.EntityIdAndType; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import io.eventuate.javaclient.commonimpl.*; import java.util.List; diff --git a/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccessImpl.java b/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccessImpl.java index b77157b..4fbe284 100644 --- a/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccessImpl.java +++ b/eventuate-client-java-jdbc-common/src/main/java/io/eventuate/javaclient/spring/jdbc/EventuateJdbcAccessImpl.java @@ -6,9 +6,9 @@ import io.eventuate.EntityIdAndType; import io.eventuate.EntityNotFoundException; import io.eventuate.EventContext; -import io.eventuate.common.id.generator.IdGenerator; -import io.eventuate.common.id.generator.IdGeneratorImpl; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.IdGenerator; +import io.eventuate.common.id.IdGeneratorImpl; +import io.eventuate.common.id.Int128; import io.eventuate.OptimisticLockingException; import io.eventuate.common.jdbc.EventuateCommonJdbcOperations; import io.eventuate.common.jdbc.EventuateSchema; diff --git a/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/EventuateEmbeddedTestAggregateStoreTest.java b/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/EventuateEmbeddedTestAggregateStoreTest.java index 06d9161..654a157 100644 --- a/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/EventuateEmbeddedTestAggregateStoreTest.java +++ b/eventuate-client-java-jdbc/src/test/java/io/eventuate/javaclient/spring/jdbc/EventuateEmbeddedTestAggregateStoreTest.java @@ -1,7 +1,7 @@ package io.eventuate.javaclient.spring.jdbc; import io.eventuate.*; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import io.eventuate.javaclient.commonimpl.*; import io.eventuate.javaclient.commonimpl.sync.AggregateCrud; import io.eventuate.javaclient.commonimpl.sync.AggregateEvents; diff --git a/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/AbstractTestEventHandler.java b/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/AbstractTestEventHandler.java index 184f624..738e3d4 100644 --- a/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/AbstractTestEventHandler.java +++ b/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/AbstractTestEventHandler.java @@ -3,7 +3,7 @@ import io.eventuate.DispatchedEvent; import io.eventuate.Event; import io.eventuate.EventHandlerContext; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/MockEventHandlerContextInternal.java b/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/MockEventHandlerContextInternal.java index 8a14388..c428b8c 100644 --- a/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/MockEventHandlerContextInternal.java +++ b/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/MockEventHandlerContextInternal.java @@ -1,7 +1,7 @@ package io.eventuate.testutil; import io.eventuate.*; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import org.mockito.ArgumentCaptor; import java.util.Optional; diff --git a/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/ReceivedEvent.java b/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/ReceivedEvent.java index e6f8597..72ba517 100644 --- a/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/ReceivedEvent.java +++ b/eventuate-client-java-test-util/src/main/java/io/eventuate/testutil/ReceivedEvent.java @@ -1,7 +1,7 @@ package io.eventuate.testutil; import io.eventuate.Event; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import java.util.Map; import java.util.Optional; diff --git a/eventuate-client-java-tests-example-domain/src/main/java/io/eventuate/example/banking/domain/AccountSnapshotStrategy.java b/eventuate-client-java-tests-example-domain/src/main/java/io/eventuate/example/banking/domain/AccountSnapshotStrategy.java index d3470e3..82d43be 100644 --- a/eventuate-client-java-tests-example-domain/src/main/java/io/eventuate/example/banking/domain/AccountSnapshotStrategy.java +++ b/eventuate-client-java-tests-example-domain/src/main/java/io/eventuate/example/banking/domain/AccountSnapshotStrategy.java @@ -4,7 +4,7 @@ import io.eventuate.Aggregates; import io.eventuate.Event; import io.eventuate.EventWithMetadata; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import io.eventuate.MissingApplyEventMethodStrategy; import io.eventuate.Snapshot; import io.eventuate.SnapshotStrategy; diff --git a/eventuate-client-java/build.gradle b/eventuate-client-java/build.gradle index ee039be..f710c8c 100644 --- a/eventuate-client-java/build.gradle +++ b/eventuate-client-java/build.gradle @@ -4,7 +4,7 @@ dependencies { compile "commons-lang:commons-lang:2.6" compile "org.slf4j:slf4j-api:1.7.18" - compile "io.eventuate.common:eventuate-common-id-generator:$eventuateCommonVersion" + compile "io.eventuate.common:eventuate-common-id:$eventuateCommonVersion" testCompile project(":eventuate-client-java-tests-example-domain") testCompile 'org.mockito:mockito-all:1.10.19' diff --git a/eventuate-client-java/src/main/java/io/eventuate/AggregateRepository.java b/eventuate-client-java/src/main/java/io/eventuate/AggregateRepository.java index 525dcba..0b6bcd4 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/AggregateRepository.java +++ b/eventuate-client-java/src/main/java/io/eventuate/AggregateRepository.java @@ -1,7 +1,7 @@ package io.eventuate; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/eventuate-client-java/src/main/java/io/eventuate/DispatchedEvent.java b/eventuate-client-java/src/main/java/io/eventuate/DispatchedEvent.java index 32076ee..ed70e13 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/DispatchedEvent.java +++ b/eventuate-client-java/src/main/java/io/eventuate/DispatchedEvent.java @@ -1,6 +1,6 @@ package io.eventuate; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import org.apache.commons.lang.builder.ToStringBuilder; import java.util.Map; diff --git a/eventuate-client-java/src/main/java/io/eventuate/EntityIdAndVersion.java b/eventuate-client-java/src/main/java/io/eventuate/EntityIdAndVersion.java index 44ddc95..88c4a94 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/EntityIdAndVersion.java +++ b/eventuate-client-java/src/main/java/io/eventuate/EntityIdAndVersion.java @@ -1,6 +1,6 @@ package io.eventuate; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; diff --git a/eventuate-client-java/src/main/java/io/eventuate/EntityWithIdAndVersion.java b/eventuate-client-java/src/main/java/io/eventuate/EntityWithIdAndVersion.java index eea4b04..2d38347 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/EntityWithIdAndVersion.java +++ b/eventuate-client-java/src/main/java/io/eventuate/EntityWithIdAndVersion.java @@ -1,6 +1,6 @@ package io.eventuate; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import org.apache.commons.lang.builder.ToStringBuilder; public class EntityWithIdAndVersion { diff --git a/eventuate-client-java/src/main/java/io/eventuate/EntityWithMetadata.java b/eventuate-client-java/src/main/java/io/eventuate/EntityWithMetadata.java index b1362a8..eef7902 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/EntityWithMetadata.java +++ b/eventuate-client-java/src/main/java/io/eventuate/EntityWithMetadata.java @@ -1,6 +1,6 @@ package io.eventuate; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import java.util.List; import java.util.Optional; diff --git a/eventuate-client-java/src/main/java/io/eventuate/EventEnvelope.java b/eventuate-client-java/src/main/java/io/eventuate/EventEnvelope.java index 1ad6806..3739d9f 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/EventEnvelope.java +++ b/eventuate-client-java/src/main/java/io/eventuate/EventEnvelope.java @@ -1,6 +1,6 @@ package io.eventuate; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import java.util.Map; import java.util.Optional; diff --git a/eventuate-client-java/src/main/java/io/eventuate/EventIdAndType.java b/eventuate-client-java/src/main/java/io/eventuate/EventIdAndType.java index fe8cc6b..d86e9bf 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/EventIdAndType.java +++ b/eventuate-client-java/src/main/java/io/eventuate/EventIdAndType.java @@ -1,7 +1,7 @@ package io.eventuate; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; public class EventIdAndType { diff --git a/eventuate-client-java/src/main/java/io/eventuate/EventWithMetadata.java b/eventuate-client-java/src/main/java/io/eventuate/EventWithMetadata.java index 7c13b25..d23e014 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/EventWithMetadata.java +++ b/eventuate-client-java/src/main/java/io/eventuate/EventWithMetadata.java @@ -1,6 +1,6 @@ package io.eventuate; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import java.util.Map; import java.util.Optional; diff --git a/eventuate-client-java/src/main/java/io/eventuate/EventuateAggregateStore.java b/eventuate-client-java/src/main/java/io/eventuate/EventuateAggregateStore.java index e69ef0b..19cefd6 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/EventuateAggregateStore.java +++ b/eventuate-client-java/src/main/java/io/eventuate/EventuateAggregateStore.java @@ -1,6 +1,6 @@ package io.eventuate; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import java.util.List; import java.util.Map; diff --git a/eventuate-client-java/src/main/java/io/eventuate/OptimisticLockingException.java b/eventuate-client-java/src/main/java/io/eventuate/OptimisticLockingException.java index 6e6a22a..9dd46a1 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/OptimisticLockingException.java +++ b/eventuate-client-java/src/main/java/io/eventuate/OptimisticLockingException.java @@ -1,6 +1,6 @@ package io.eventuate; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; public class OptimisticLockingException extends EventuateClientException { diff --git a/eventuate-client-java/src/main/java/io/eventuate/SnapshotManager.java b/eventuate-client-java/src/main/java/io/eventuate/SnapshotManager.java index 08a8e38..17fde49 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/SnapshotManager.java +++ b/eventuate-client-java/src/main/java/io/eventuate/SnapshotManager.java @@ -1,6 +1,6 @@ package io.eventuate; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import java.util.List; import java.util.Optional; diff --git a/eventuate-client-java/src/main/java/io/eventuate/SnapshotManagerImpl.java b/eventuate-client-java/src/main/java/io/eventuate/SnapshotManagerImpl.java index d831410..75b6c66 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/SnapshotManagerImpl.java +++ b/eventuate-client-java/src/main/java/io/eventuate/SnapshotManagerImpl.java @@ -1,6 +1,6 @@ package io.eventuate; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import java.util.HashMap; import java.util.List; diff --git a/eventuate-client-java/src/main/java/io/eventuate/SnapshotStrategy.java b/eventuate-client-java/src/main/java/io/eventuate/SnapshotStrategy.java index c58b441..cbfc194 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/SnapshotStrategy.java +++ b/eventuate-client-java/src/main/java/io/eventuate/SnapshotStrategy.java @@ -1,6 +1,6 @@ package io.eventuate; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import java.util.List; import java.util.Optional; diff --git a/eventuate-client-java/src/main/java/io/eventuate/sync/AggregateRepository.java b/eventuate-client-java/src/main/java/io/eventuate/sync/AggregateRepository.java index 0542f16..c4abc28 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/sync/AggregateRepository.java +++ b/eventuate-client-java/src/main/java/io/eventuate/sync/AggregateRepository.java @@ -2,7 +2,7 @@ import io.eventuate.*; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/eventuate-client-java/src/main/java/io/eventuate/sync/EventuateAggregateStore.java b/eventuate-client-java/src/main/java/io/eventuate/sync/EventuateAggregateStore.java index a24990a..3d50387 100644 --- a/eventuate-client-java/src/main/java/io/eventuate/sync/EventuateAggregateStore.java +++ b/eventuate-client-java/src/main/java/io/eventuate/sync/EventuateAggregateStore.java @@ -1,7 +1,7 @@ package io.eventuate.sync; import io.eventuate.*; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import java.util.List; import java.util.Map; diff --git a/eventuate-client-java/src/test/java/io/eventuate/AggregateRepositoryTest.java b/eventuate-client-java/src/test/java/io/eventuate/AggregateRepositoryTest.java index b7d92e0..8224e58 100644 --- a/eventuate-client-java/src/test/java/io/eventuate/AggregateRepositoryTest.java +++ b/eventuate-client-java/src/test/java/io/eventuate/AggregateRepositoryTest.java @@ -1,6 +1,6 @@ package io.eventuate; -import io.eventuate.common.id.generator.Int128; +import io.eventuate.common.id.Int128; import io.eventuate.example.banking.domain.Account; import io.eventuate.example.banking.domain.AccountCommand; import io.eventuate.example.banking.domain.AccountCreatedEvent; From 737a8723c7c34635b43c5e63de83d10f7210e56f Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Tue, 4 Jun 2019 11:09:54 +0300 Subject: [PATCH 7/8] Used released version of the eventuate common --- build.gradle | 1 + gradle.properties | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 397ff62..a22b37a 100644 --- a/build.gradle +++ b/build.gradle @@ -46,6 +46,7 @@ subprojects { repositories { mavenCentral() maven { url "http://mavenrepo.eventuate.io/release"} + maven { url "https://dl.bintray.com/eventuateio-oss/eventuate-maven-release"} eventuateMavenRepoUrl.split(',').each { repoUrl -> maven { url repoUrl } } } diff --git a/gradle.properties b/gradle.properties index 549d7e8..3a92d6b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,4 +9,4 @@ springBootVersion=1.4.7.RELEASE version=0.20.0-SNAPSHOT rxJavaVersion=1.1.5 -eventuateCommonVersion=0.1.0-SNAPSHOT \ No newline at end of file +eventuateCommonVersion=0.4.0.RELEASE \ No newline at end of file From 7609c17fb36b80f853347fc73be0389e4ed3d430 Mon Sep 17 00:00:00 2001 From: Artem Sidorkin Date: Tue, 4 Jun 2019 11:58:38 +0300 Subject: [PATCH 8/8] Fixed dependencies --- build.gradle | 1 - gradle.properties | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index a22b37a..397ff62 100644 --- a/build.gradle +++ b/build.gradle @@ -46,7 +46,6 @@ subprojects { repositories { mavenCentral() maven { url "http://mavenrepo.eventuate.io/release"} - maven { url "https://dl.bintray.com/eventuateio-oss/eventuate-maven-release"} eventuateMavenRepoUrl.split(',').each { repoUrl -> maven { url repoUrl } } } diff --git a/gradle.properties b/gradle.properties index 3a92d6b..d391275 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ org.gradle.jvmargs=-XX:MaxPermSize=512m -Xmx1G deployUrl=file:///Users/cer/.m2/testdeploy -eventuateMavenRepoUrl=file:///Users/cer/.m2/testdeploy +eventuateMavenRepoUrl=file:///Users/cer/.m2/testdeploy,https://dl.bintray.com/eventuateio-oss/eventuate-maven-release springBootVersion=1.4.7.RELEASE