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 ma...@apache.org on 2020/02/27 16:20:32 UTC
[james-project] 11/14: JAMES-3009 convert event store memory tests
to scala
This is an automated email from the ASF dual-hosted git repository.
matthieu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit b18869ed37d820166f3f9717b0019e1a120c3211
Author: Rémi KOWALSKI <rk...@linagora.com>
AuthorDate: Thu Dec 12 16:56:38 2019 +0100
JAMES-3009 convert event store memory tests to scala
---
.../memory/InMemoryEventSourcingSystemTest.scala} | 15 +++++------
.../memory/InMemoryEventStoreExtension.scala} | 29 ++++++++--------------
.../memory/InMemoryEventStoreTest.scala} | 17 ++++++-------
3 files changed, 23 insertions(+), 38 deletions(-)
diff --git a/event-sourcing/event-store-memory/src/test/java/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventStoreTest.java b/event-sourcing/event-store-memory/src/test/scala/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventSourcingSystemTest.scala
similarity index 75%
rename from event-sourcing/event-store-memory/src/test/java/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventStoreTest.java
rename to event-sourcing/event-store-memory/src/test/scala/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventSourcingSystemTest.scala
index 11cd197..3fc3388 100644
--- a/event-sourcing/event-store-memory/src/test/java/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventStoreTest.java
+++ b/event-sourcing/event-store-memory/src/test/scala/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventSourcingSystemTest.scala
@@ -1,4 +1,4 @@
-/****************************************************************
+ /***************************************************************
* 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 *
@@ -16,13 +16,10 @@
* specific language governing permissions and limitations *
* under the License. *
****************************************************************/
+package org.apache.james.eventsourcing.eventstore.memory
-package org.apache.james.eventsourcing.eventstore.memory;
+import org.apache.james.eventsourcing.EventSourcingSystemTest
+import org.junit.jupiter.api.extension.ExtendWith
-import org.apache.james.eventsourcing.eventstore.EventStoreTest;
-import org.junit.jupiter.api.extension.ExtendWith;
-
-@ExtendWith(InMemoryEventStoreExtension.class)
-public class InMemoryEventStoreTest implements EventStoreTest {
-
-}
\ No newline at end of file
+@ExtendWith(Array(classOf[InMemoryEventStoreExtension]))
+class InMemoryEventSourcingSystemTest extends EventSourcingSystemTest {}
\ No newline at end of file
diff --git a/event-sourcing/event-store-memory/src/test/java/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventStoreExtension.java b/event-sourcing/event-store-memory/src/test/scala/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventStoreExtension.scala
similarity index 51%
rename from event-sourcing/event-store-memory/src/test/java/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventStoreExtension.java
rename to event-sourcing/event-store-memory/src/test/scala/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventStoreExtension.scala
index 03f61bc..964d6d6 100644
--- a/event-sourcing/event-store-memory/src/test/java/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventStoreExtension.java
+++ b/event-sourcing/event-store-memory/src/test/scala/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventStoreExtension.scala
@@ -7,7 +7,7 @@
* "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 *
+ * 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 *
@@ -15,25 +15,16 @@
* KIND, either express or implied. See the License for the *
* specific language governing permissions and limitations *
* under the License. *
- ****************************************************************/
+ * ***************************************************************/
+package org.apache.james.eventsourcing.eventstore.memory
-package org.apache.james.eventsourcing.eventstore.memory;
+import org.apache.james.eventsourcing.eventstore.EventStore
+import org.junit.jupiter.api.extension.{ExtensionContext, ParameterContext, ParameterResolver}
-import org.apache.james.eventsourcing.eventstore.EventStore;
-import org.junit.jupiter.api.extension.ExtensionContext;
-import org.junit.jupiter.api.extension.ParameterContext;
-import org.junit.jupiter.api.extension.ParameterResolutionException;
-import org.junit.jupiter.api.extension.ParameterResolver;
+class InMemoryEventStoreExtension extends ParameterResolver {
-public class InMemoryEventStoreExtension implements ParameterResolver {
+ override def supportsParameter(parameterContext: ParameterContext, extensionContext: ExtensionContext): Boolean =
+ parameterContext.getParameter.getType eq classOf[EventStore]
- @Override
- public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException {
- return (parameterContext.getParameter().getType() == EventStore.class);
- }
-
- @Override
- public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException {
- return new InMemoryEventStore();
- }
-}
+ override def resolveParameter(parameterContext: ParameterContext, extensionContext: ExtensionContext) = new InMemoryEventStore
+}
\ No newline at end of file
diff --git a/event-sourcing/event-store-memory/src/test/java/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventSourcingSystemTest.java b/event-sourcing/event-store-memory/src/test/scala/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventStoreTest.scala
similarity index 70%
rename from event-sourcing/event-store-memory/src/test/java/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventSourcingSystemTest.java
rename to event-sourcing/event-store-memory/src/test/scala/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventStoreTest.scala
index 4a07c40..919b326 100644
--- a/event-sourcing/event-store-memory/src/test/java/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventSourcingSystemTest.java
+++ b/event-sourcing/event-store-memory/src/test/scala/org/apache/james/eventsourcing/eventstore/memory/InMemoryEventStoreTest.scala
@@ -7,7 +7,7 @@
* "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 *
+ * 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 *
@@ -15,14 +15,11 @@
* KIND, either express or implied. See the License for the *
* specific language governing permissions and limitations *
* under the License. *
- ****************************************************************/
+ * ***************************************************************/
+package org.apache.james.eventsourcing.eventstore.memory
-package org.apache.james.eventsourcing.eventstore.memory;
+import org.apache.james.eventsourcing.eventstore.EventStoreContract
+import org.junit.jupiter.api.extension.ExtendWith
-import org.apache.james.eventsourcing.EventSourcingSystemTest;
-import org.junit.jupiter.api.extension.ExtendWith;
-
-@ExtendWith(InMemoryEventStoreExtension.class)
-public class InMemoryEventSourcingSystemTest implements EventSourcingSystemTest {
-
-}
\ No newline at end of file
+@ExtendWith(Array(classOf[InMemoryEventStoreExtension]))
+class InMemoryEventStoreTest extends EventStoreContract
\ 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