You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2018/10/02 09:28:40 UTC
[7/9] james-project git commit: JAMES-2544 DTO and DTO module
register for cassandra eventsourcing system
JAMES-2544 DTO and DTO module register for cassandra eventsourcing system
We now can run Test on top of cassandra EventStore
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/43d0441e
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/43d0441e
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/43d0441e
Branch: refs/heads/master
Commit: 43d0441ec715c585d06b8b25a9915ef5db9bb801
Parents: 8fdcf75
Author: duc <dt...@linagora.com>
Authored: Thu Sep 27 11:49:51 2018 +0700
Committer: Benoit Tellier <bt...@linagora.com>
Committed: Tue Oct 2 16:27:43 2018 +0700
----------------------------------------------------------------------
server/queue/queue-rabbitmq/pom.xml | 11 +-
...ssandraMailQueueViewConfigurationModule.java | 34 +++++
.../configuration/ConfigurationChangedDTO.java | 133 +++++++++++++++++++
.../ConfigurationChangedDTOTest.java | 96 +++++++++++++
.../view/cassandra/configuration/DTOTest.java | 74 +++++++++++
...ventsourcingConfigurationManagementTest.java | 66 ++++-----
.../configuration/configuration_changed.json | 8 ++
7 files changed, 388 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/43d0441e/server/queue/queue-rabbitmq/pom.xml
----------------------------------------------------------------------
diff --git a/server/queue/queue-rabbitmq/pom.xml b/server/queue/queue-rabbitmq/pom.xml
index b0fdc90..e8cc08d 100644
--- a/server/queue/queue-rabbitmq/pom.xml
+++ b/server/queue/queue-rabbitmq/pom.xml
@@ -72,11 +72,20 @@
</dependency>
<dependency>
<groupId>${james.groupId}</groupId>
- <artifactId>event-sourcing-event-store-memory</artifactId>
+ <artifactId>event-sourcing-event-store-cassandra</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${james.groupId}</groupId>
+ <artifactId>event-sourcing-event-store-cassandra</artifactId>
+ <type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${james.groupId}</groupId>
+ <artifactId>event-sourcing-pojo</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${james.groupId}</groupId>
<artifactId>james-server-core</artifactId>
</dependency>
<dependency>
http://git-wip-us.apache.org/repos/asf/james-project/blob/43d0441e/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/CassandraMailQueueViewConfigurationModule.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/CassandraMailQueueViewConfigurationModule.java b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/CassandraMailQueueViewConfigurationModule.java
new file mode 100644
index 0000000..74febbc
--- /dev/null
+++ b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/CassandraMailQueueViewConfigurationModule.java
@@ -0,0 +1,34 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.queue.rabbitmq.view.cassandra.configuration;
+
+import org.apache.james.eventsourcing.eventstore.cassandra.dto.EventDTOModule;
+
+public interface CassandraMailQueueViewConfigurationModule {
+
+ String TYPE_NAME = "cassandra-mail-queue-view-configuration";
+
+ EventDTOModule<ConfigurationChanged, ConfigurationChangedDTO> MAIL_QUEUE_VIEW_CONFIGURATION =
+ EventDTOModule
+ .forEvent(ConfigurationChanged.class)
+ .convertToDTO(ConfigurationChangedDTO.class)
+ .convertWith(ConfigurationChangedDTO::from)
+ .typeName(TYPE_NAME);
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/43d0441e/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/ConfigurationChangedDTO.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/ConfigurationChangedDTO.java b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/ConfigurationChangedDTO.java
new file mode 100644
index 0000000..afb959a
--- /dev/null
+++ b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/ConfigurationChangedDTO.java
@@ -0,0 +1,133 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.queue.rabbitmq.view.cassandra.configuration;
+
+import java.time.Duration;
+import java.util.Objects;
+
+import org.apache.james.eventsourcing.Event;
+import org.apache.james.eventsourcing.EventId;
+import org.apache.james.eventsourcing.eventstore.cassandra.dto.EventDTO;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.google.common.base.Preconditions;
+
+class ConfigurationChangedDTO implements EventDTO {
+
+ static ConfigurationChangedDTO from(ConfigurationChanged configurationChanged, String type) {
+ Preconditions.checkNotNull(configurationChanged);
+
+ CassandraMailQueueViewConfiguration configuration = configurationChanged.getConfiguration();
+ return new ConfigurationChangedDTO(
+ configurationChanged.eventId().serialize(),
+ configurationChanged.getAggregateId().asAggregateKey(),
+ type,
+ configuration.getBucketCount(),
+ configuration.getUpdateBrowseStartPace(),
+ configuration.getSliceWindow());
+ }
+
+ static ConfigurationChangedDTO from(ConfigurationChanged configurationChanged) {
+ return from(configurationChanged, CassandraMailQueueViewConfigurationModule.TYPE_NAME);
+ }
+
+ private final int eventId;
+ private final String aggregateKey;
+ private final String type;
+ private final int bucketCount;
+ private final int updateBrowseStartPace;
+ private final Duration sliceWindow;
+
+ @JsonCreator
+ ConfigurationChangedDTO(
+ @JsonProperty("eventId") int eventId,
+ @JsonProperty("aggregateKey") String aggregateKey,
+ @JsonProperty("type") String type,
+ @JsonProperty("bucketCount") int bucketCount,
+ @JsonProperty("updateBrowseStartPace") int updateBrowseStartPace,
+ @JsonProperty("sliceWindow") Duration sliceWindow) {
+
+ this.eventId = eventId;
+ this.aggregateKey = aggregateKey;
+ this.type = type;
+ this.bucketCount = bucketCount;
+ this.updateBrowseStartPace = updateBrowseStartPace;
+ this.sliceWindow = sliceWindow;
+ }
+
+ @JsonIgnore
+ @Override
+ public Event toEvent() {
+ return new ConfigurationChanged(
+ () -> aggregateKey,
+ EventId.fromSerialized(eventId),
+ CassandraMailQueueViewConfiguration.builder()
+ .bucketCount(bucketCount)
+ .updateBrowseStartPace(updateBrowseStartPace)
+ .sliceWindow(sliceWindow)
+ .build());
+ }
+
+ public int getEventId() {
+ return eventId;
+ }
+
+ public String getAggregateKey() {
+ return aggregateKey;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public int getBucketCount() {
+ return bucketCount;
+ }
+
+ public int getUpdateBrowseStartPace() {
+ return updateBrowseStartPace;
+ }
+
+ public Duration getSliceWindow() {
+ return sliceWindow;
+ }
+
+ @Override
+ public final boolean equals(Object o) {
+ if (o instanceof ConfigurationChangedDTO) {
+ ConfigurationChangedDTO that = (ConfigurationChangedDTO) o;
+
+ return Objects.equals(this.eventId, that.eventId)
+ && Objects.equals(this.aggregateKey, that.aggregateKey)
+ && Objects.equals(this.type, that.type)
+ && Objects.equals(this.bucketCount, that.bucketCount)
+ && Objects.equals(this.updateBrowseStartPace, that.updateBrowseStartPace)
+ && Objects.equals(this.sliceWindow, that.sliceWindow);
+ }
+ return false;
+ }
+
+ @Override
+ public final int hashCode() {
+ return Objects.hash(eventId, aggregateKey, type, bucketCount, updateBrowseStartPace, sliceWindow);
+ }
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/43d0441e/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/ConfigurationChangedDTOTest.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/ConfigurationChangedDTOTest.java b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/ConfigurationChangedDTOTest.java
new file mode 100644
index 0000000..7f53030
--- /dev/null
+++ b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/ConfigurationChangedDTOTest.java
@@ -0,0 +1,96 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.queue.rabbitmq.view.cassandra.configuration;
+
+import static org.apache.james.queue.rabbitmq.view.cassandra.configuration.CassandraMailQueueViewConfigurationModule.TYPE_NAME;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import java.time.Duration;
+
+import org.apache.james.eventsourcing.EventId;
+import org.assertj.core.api.SoftAssertions;
+import org.junit.jupiter.api.Test;
+
+import nl.jqno.equalsverifier.EqualsVerifier;
+
+class ConfigurationChangedDTOTest {
+
+ private static final int EVENT_ID_SERIALIZED = 10;
+ private static final EventId EVENT_ID = EventId.fromSerialized(EVENT_ID_SERIALIZED);
+ private static final Duration ONE_HOUR = Duration.ofHours(1L);
+ private static final int BUCKET_COUNT = 2;
+ private static final int UPDATE_PACE = 3;
+ private static final String CONFIGURATION_AGGREGATE_KEY = "aggrKey";
+
+ @Test
+ void shouldMatchBeanContract() {
+ EqualsVerifier.forClass(ConfigurationChangedDTO.class)
+ .verify();
+ }
+
+ @Test
+ void fromShouldThrowWhenConfigurationAddedIsNull() {
+ assertThatThrownBy(() -> ConfigurationChangedDTO.from(null))
+ .isInstanceOf(NullPointerException.class);
+ }
+
+ @Test
+ void fromShouldReturnCorrespondingDTO() {
+ ConfigurationChanged configurationChanged = new ConfigurationChanged(
+ () -> CONFIGURATION_AGGREGATE_KEY,
+ EVENT_ID,
+ CassandraMailQueueViewConfiguration.builder()
+ .bucketCount(BUCKET_COUNT)
+ .updateBrowseStartPace(UPDATE_PACE)
+ .sliceWindow(ONE_HOUR)
+ .build());
+
+
+ ConfigurationChangedDTO dto = ConfigurationChangedDTO.from(configurationChanged);
+ SoftAssertions.assertSoftly(softly -> {
+ softly.assertThat(dto.getEventId()).isEqualTo(EVENT_ID_SERIALIZED);
+ softly.assertThat(dto.getType()).isEqualTo(TYPE_NAME);
+ softly.assertThat(dto.getBucketCount()).isEqualTo(BUCKET_COUNT);
+ softly.assertThat(dto.getUpdateBrowseStartPace()).isEqualTo(UPDATE_PACE);
+ softly.assertThat(dto.getSliceWindow()).isEqualTo(ONE_HOUR);
+ });
+ }
+
+ @Test
+ void toEventShouldReturnCorrespondingConfigurationChangedEvent() {
+ ConfigurationChangedDTO dto = new ConfigurationChangedDTO(
+ EVENT_ID_SERIALIZED,
+ CONFIGURATION_AGGREGATE_KEY,
+ TYPE_NAME,
+ BUCKET_COUNT,
+ UPDATE_PACE,
+ ONE_HOUR);
+ ConfigurationChanged event = (ConfigurationChanged) dto.toEvent();
+ CassandraMailQueueViewConfiguration mailQueueViewConfiguration = event.getConfiguration();
+
+ SoftAssertions.assertSoftly(softly -> {
+ softly.assertThat(event.eventId()).isEqualTo(EVENT_ID);
+ softly.assertThat(event.getAggregateId().asAggregateKey()).isEqualTo(CONFIGURATION_AGGREGATE_KEY);
+ softly.assertThat(mailQueueViewConfiguration.getBucketCount()).isEqualTo(BUCKET_COUNT);
+ softly.assertThat(mailQueueViewConfiguration.getUpdateBrowseStartPace()).isEqualTo(UPDATE_PACE);
+ softly.assertThat(mailQueueViewConfiguration.getSliceWindow()).isEqualTo(ONE_HOUR);
+ });
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/43d0441e/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/DTOTest.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/DTOTest.java b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/DTOTest.java
new file mode 100644
index 0000000..b277995
--- /dev/null
+++ b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/DTOTest.java
@@ -0,0 +1,74 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.queue.rabbitmq.view.cassandra.configuration;
+
+import static net.javacrumbs.jsonunit.assertj.JsonAssertions.assertThatJson;
+import static org.apache.james.queue.rabbitmq.view.cassandra.configuration.CassandraMailQueueViewConfigurationModule.TYPE_NAME;
+import static org.apache.james.util.ClassLoaderUtils.getSystemResourceAsString;
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.time.Duration;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+
+class DTOTest {
+
+ private static final int EVENT_ID = 0;
+ private static final int BUCKET_COUNT = 1;
+ private static final int UPDATE_PACE = 1000;
+ private static final Duration SLICE_WINDOW = Duration.ofHours(1);
+ private static final String CONFIGURATION_AGGREGATE_KEY = "aggKey";
+
+ private final ConfigurationChangedDTO CONFIGURATION_CHANGED_DTO = new ConfigurationChangedDTO(
+ EVENT_ID, CONFIGURATION_AGGREGATE_KEY, TYPE_NAME, BUCKET_COUNT, UPDATE_PACE, SLICE_WINDOW);
+
+ private static final String CONFIGURATION_CHANGED_DTO_JSON = getSystemResourceAsString(
+ "json/mailqueueview/configuration/configuration_changed.json");
+
+ private ObjectMapper objectMapper;
+
+ @BeforeEach
+ void setUp() {
+ objectMapper = new ObjectMapper();
+ objectMapper.registerModule(new Jdk8Module());
+ objectMapper.registerModule(new JavaTimeModule());
+ objectMapper.setSerializationInclusion(JsonInclude.Include.NON_ABSENT);
+ }
+
+ @Test
+ void shouldSerializeConfigurationChangedDTO() throws Exception {
+ assertThatJson(
+ objectMapper.writeValueAsString(CONFIGURATION_CHANGED_DTO))
+ .isEqualTo(CONFIGURATION_CHANGED_DTO_JSON);
+ }
+
+ @Test
+ void shouldDeserializeConfigurationChangedDTO() throws Exception {
+ assertThat(
+ objectMapper.readValue(CONFIGURATION_CHANGED_DTO_JSON, ConfigurationChangedDTO.class))
+ .isEqualTo(CONFIGURATION_CHANGED_DTO);
+ }
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/43d0441e/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/EventsourcingConfigurationManagementTest.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/EventsourcingConfigurationManagementTest.java b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/EventsourcingConfigurationManagementTest.java
index fd5a272..5f96ef3 100644
--- a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/EventsourcingConfigurationManagementTest.java
+++ b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/configuration/EventsourcingConfigurationManagementTest.java
@@ -27,11 +27,17 @@ import java.time.Duration;
import java.util.List;
import org.apache.james.eventsourcing.Event;
-import org.apache.james.eventsourcing.eventstore.memory.InMemoryEventStore;
-import org.junit.jupiter.api.BeforeEach;
+import org.apache.james.eventsourcing.eventstore.EventStore;
+import org.apache.james.eventsourcing.eventstore.cassandra.CassandraEventStoreExtension;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
class EventsourcingConfigurationManagementTest {
+
+ @RegisterExtension
+ static CassandraEventStoreExtension eventStoreExtension = new CassandraEventStoreExtension(
+ CassandraMailQueueViewConfigurationModule.MAIL_QUEUE_VIEW_CONFIGURATION);
+
private static final int DEFAULT_BUCKET_COUNT = 10;
private static final int DEFAULT_UPDATE_PACE = 100;
private static final Duration ONE_HOUR = Duration.ofHours(1);
@@ -54,28 +60,22 @@ class EventsourcingConfigurationManagementTest {
.updateBrowseStartPace(DEFAULT_UPDATE_PACE)
.sliceWindow(ONE_HOUR)
.build();
- private InMemoryEventStore eventStore;
- private EventsourcingConfigurationManagement createConfigurationManagement() {
+ private EventsourcingConfigurationManagement createConfigurationManagement(EventStore eventStore) {
return new EventsourcingConfigurationManagement(eventStore);
}
- @BeforeEach
- void setUp() {
- eventStore = new InMemoryEventStore();
- }
-
@Test
- void loadShouldReturnEmptyIfNoConfigurationStored() {
- EventsourcingConfigurationManagement testee = createConfigurationManagement();
+ void loadShouldReturnEmptyIfNoConfigurationStored(EventStore eventStore) {
+ EventsourcingConfigurationManagement testee = createConfigurationManagement(eventStore);
assertThat(testee.load())
.isEmpty();
}
@Test
- void loadShouldReturnTheLastConfiguration() {
- EventsourcingConfigurationManagement testee = createConfigurationManagement();
+ void loadShouldReturnTheLastConfiguration(EventStore eventStore) {
+ EventsourcingConfigurationManagement testee = createConfigurationManagement(eventStore);
testee.registerConfiguration(FIRST_CONFIGURATION);
testee.registerConfiguration(SECOND_CONFIGURATION);
testee.registerConfiguration(THIRD_CONFIGURATION);
@@ -85,16 +85,16 @@ class EventsourcingConfigurationManagementTest {
}
@Test
- void loadConfigurationShouldThrowWhenConfigurationIsNull() {
- EventsourcingConfigurationManagement testee = createConfigurationManagement();
+ void loadConfigurationShouldThrowWhenConfigurationIsNull(EventStore eventStore) {
+ EventsourcingConfigurationManagement testee = createConfigurationManagement(eventStore);
assertThatThrownBy(() -> testee.registerConfiguration(null))
.isInstanceOf(NullPointerException.class);
}
@Test
- void loadConfigurationShouldThrowWhenBucketCountDecrease() {
- EventsourcingConfigurationManagement testee = createConfigurationManagement();
+ void loadConfigurationShouldThrowWhenBucketCountDecrease(EventStore eventStore) {
+ EventsourcingConfigurationManagement testee = createConfigurationManagement(eventStore);
testee.registerConfiguration(CassandraMailQueueViewConfiguration.builder()
.bucketCount(DEFAULT_BUCKET_COUNT)
.updateBrowseStartPace(DEFAULT_UPDATE_PACE)
@@ -110,8 +110,8 @@ class EventsourcingConfigurationManagementTest {
}
@Test
- void loadConfigurationShouldUpdateStoredConfigurationWhenIncreaseBucketCount() {
- EventsourcingConfigurationManagement testee = createConfigurationManagement();
+ void loadConfigurationShouldUpdateStoredConfigurationWhenIncreaseBucketCount(EventStore eventStore) {
+ EventsourcingConfigurationManagement testee = createConfigurationManagement(eventStore);
testee.registerConfiguration(CassandraMailQueueViewConfiguration.builder()
.bucketCount(DEFAULT_BUCKET_COUNT)
.updateBrowseStartPace(DEFAULT_UPDATE_PACE)
@@ -130,8 +130,8 @@ class EventsourcingConfigurationManagementTest {
}
@Test
- void loadConfigurationShouldStoreConfiguration() {
- EventsourcingConfigurationManagement testee = createConfigurationManagement();
+ void loadConfigurationShouldStoreConfiguration(EventStore eventStore) {
+ EventsourcingConfigurationManagement testee = createConfigurationManagement(eventStore);
testee.registerConfiguration(FIRST_CONFIGURATION);
@@ -140,8 +140,8 @@ class EventsourcingConfigurationManagementTest {
}
@Test
- void loadConfigurationShouldThrowWhenIncreaseSliceWindow() {
- EventsourcingConfigurationManagement testee = createConfigurationManagement();
+ void loadConfigurationShouldThrowWhenIncreaseSliceWindow(EventStore eventStore) {
+ EventsourcingConfigurationManagement testee = createConfigurationManagement(eventStore);
testee.registerConfiguration(CassandraMailQueueViewConfiguration.builder()
.bucketCount(DEFAULT_BUCKET_COUNT)
.updateBrowseStartPace(DEFAULT_UPDATE_PACE)
@@ -157,8 +157,8 @@ class EventsourcingConfigurationManagementTest {
}
@Test
- void loadConfigurationShouldThrowWhenDecreaseSliceWindowByANotDivisibleNumber() {
- EventsourcingConfigurationManagement testee = createConfigurationManagement();
+ void loadConfigurationShouldThrowWhenDecreaseSliceWindowByANotDivisibleNumber(EventStore eventStore) {
+ EventsourcingConfigurationManagement testee = createConfigurationManagement(eventStore);
testee.registerConfiguration(CassandraMailQueueViewConfiguration.builder()
.bucketCount(DEFAULT_BUCKET_COUNT)
.updateBrowseStartPace(DEFAULT_UPDATE_PACE)
@@ -174,8 +174,8 @@ class EventsourcingConfigurationManagementTest {
}
@Test
- void loadConfigurationShouldUpdateConfigurationWhenDecreaseSliceWindowByADivisibleNumber() {
- EventsourcingConfigurationManagement testee = createConfigurationManagement();
+ void loadConfigurationShouldUpdateConfigurationWhenDecreaseSliceWindowByADivisibleNumber(EventStore eventStore) {
+ EventsourcingConfigurationManagement testee = createConfigurationManagement(eventStore);
testee.registerConfiguration(CassandraMailQueueViewConfiguration.builder()
.bucketCount(DEFAULT_BUCKET_COUNT)
.updateBrowseStartPace(DEFAULT_UPDATE_PACE)
@@ -194,8 +194,8 @@ class EventsourcingConfigurationManagementTest {
}
@Test
- void loadConfigurationShouldUpdateConfigurationWhenIncreaseUpdatePace() {
- EventsourcingConfigurationManagement testee = createConfigurationManagement();
+ void loadConfigurationShouldUpdateConfigurationWhenIncreaseUpdatePace(EventStore eventStore) {
+ EventsourcingConfigurationManagement testee = createConfigurationManagement(eventStore);
testee.registerConfiguration(CassandraMailQueueViewConfiguration.builder()
.bucketCount(DEFAULT_BUCKET_COUNT)
.updateBrowseStartPace(DEFAULT_UPDATE_PACE)
@@ -214,8 +214,8 @@ class EventsourcingConfigurationManagementTest {
}
@Test
- void loadConfigurationShouldUpdateConfigurationWhenDecreaseUpdatePace() {
- EventsourcingConfigurationManagement testee = createConfigurationManagement();
+ void loadConfigurationShouldUpdateConfigurationWhenDecreaseUpdatePace(EventStore eventStore) {
+ EventsourcingConfigurationManagement testee = createConfigurationManagement(eventStore);
testee.registerConfiguration(CassandraMailQueueViewConfiguration.builder()
.bucketCount(DEFAULT_BUCKET_COUNT)
.updateBrowseStartPace(DEFAULT_UPDATE_PACE)
@@ -234,8 +234,8 @@ class EventsourcingConfigurationManagementTest {
}
@Test
- void loadConfigurationShouldIgnoreDuplicateWhenStoreTheSameConfigurationTwice() {
- EventsourcingConfigurationManagement testee = createConfigurationManagement();
+ void loadConfigurationShouldIgnoreDuplicateWhenStoreTheSameConfigurationTwice(EventStore eventStore) {
+ EventsourcingConfigurationManagement testee = createConfigurationManagement(eventStore);
testee.registerConfiguration(FIRST_CONFIGURATION);
testee.registerConfiguration(FIRST_CONFIGURATION);
http://git-wip-us.apache.org/repos/asf/james-project/blob/43d0441e/server/queue/queue-rabbitmq/src/test/resources/json/mailqueueview/configuration/configuration_changed.json
----------------------------------------------------------------------
diff --git a/server/queue/queue-rabbitmq/src/test/resources/json/mailqueueview/configuration/configuration_changed.json b/server/queue/queue-rabbitmq/src/test/resources/json/mailqueueview/configuration/configuration_changed.json
new file mode 100644
index 0000000..4045ae7
--- /dev/null
+++ b/server/queue/queue-rabbitmq/src/test/resources/json/mailqueueview/configuration/configuration_changed.json
@@ -0,0 +1,8 @@
+{
+ "type": "cassandra-mail-queue-view-configuration",
+ "eventId": 0,
+ "aggregateKey": "aggKey",
+ "bucketCount": 1,
+ "updateBrowseStartPace": 1000,
+ "sliceWindow": 3600.000000000
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org