JAMES-2541 MailQueueFactory tests do not require cassandra
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/2279c6b6 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/2279c6b6 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/2279c6b6 Branch: refs/heads/master Commit: 2279c6b6af7a5f7cb21762008aab0c6cf7a691fd Parents: 46b1bfc Author: Benoit Tellier <btell...@linagora.com> Authored: Wed Sep 12 16:30:30 2018 +0700 Committer: Antoine Duprat <adup...@linagora.com> Committed: Mon Sep 17 08:14:14 2018 +0200 ---------------------------------------------------------------------- .../rabbitmq/RabbitMqMailQueueFactoryTest.java | 33 +++----------------- 1 file changed, 4 insertions(+), 29 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/2279c6b6/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMqMailQueueFactoryTest.java ---------------------------------------------------------------------- diff --git a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMqMailQueueFactoryTest.java b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMqMailQueueFactoryTest.java index dc086d6..18cca28 100644 --- a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMqMailQueueFactoryTest.java +++ b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMqMailQueueFactoryTest.java @@ -19,6 +19,8 @@ package org.apache.james.queue.rabbitmq; +import static org.mockito.Mockito.mock; + import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; @@ -33,43 +35,26 @@ import org.apache.james.backend.rabbitmq.RabbitChannelPool; import org.apache.james.backend.rabbitmq.RabbitMQConfiguration; import org.apache.james.backend.rabbitmq.RabbitMQConnectionFactory; import org.apache.james.backend.rabbitmq.ReusableDockerRabbitMQExtension; -import org.apache.james.backends.cassandra.CassandraCluster; -import org.apache.james.backends.cassandra.DockerCassandraExtension; -import org.apache.james.backends.cassandra.init.configuration.CassandraConfiguration; import org.apache.james.blob.api.HashBlobId; import org.apache.james.blob.api.Store; -import org.apache.james.blob.cassandra.CassandraBlobModule; -import org.apache.james.blob.cassandra.CassandraBlobsDAO; import org.apache.james.blob.mail.MimeMessagePartsId; -import org.apache.james.blob.mail.MimeMessageStore; import org.apache.james.metrics.api.NoopMetricFactory; import org.apache.james.queue.api.MailQueueFactory; import org.apache.james.queue.api.MailQueueFactoryContract; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.extension.ExtendWith; import com.nurkiewicz.asyncretry.AsyncRetryExecutor; -@ExtendWith({ReusableDockerRabbitMQExtension.class, DockerCassandraExtension.class}) +@ExtendWith(ReusableDockerRabbitMQExtension.class) class RabbitMqMailQueueFactoryTest implements MailQueueFactoryContract<RabbitMQMailQueue> { private static final HashBlobId.Factory BLOB_ID_FACTORY = new HashBlobId.Factory(); - private static CassandraCluster cassandra; - private RabbitMQMailQueueFactory mailQueueFactory; - @BeforeAll - static void setUpClass(DockerCassandraExtension.DockerCassandra dockerCassandra) { - cassandra = CassandraCluster.create(CassandraBlobModule.MODULE, dockerCassandra.getHost()); - } - @BeforeEach void setup(DockerRabbitMQ rabbitMQ) throws IOException, TimeoutException, URISyntaxException { - CassandraBlobsDAO blobsDAO = new CassandraBlobsDAO(cassandra.getConf(), CassandraConfiguration.DEFAULT_CONFIGURATION, BLOB_ID_FACTORY); - Store<MimeMessage, MimeMessagePartsId> mimeMessageStore = MimeMessageStore.factory(blobsDAO).mimeMessageStore(); + Store<MimeMessage, MimeMessagePartsId> mimeMessageStore = mock(Store.class); URI amqpUri = new URIBuilder() .setScheme("amqp") @@ -99,16 +84,6 @@ class RabbitMqMailQueueFactoryTest implements MailQueueFactoryContract<RabbitMQM mailQueueFactory = new RabbitMQMailQueueFactory(rabbitClient, mqManagementApi, factory); } - @AfterEach - void tearDown() { - cassandra.clearTables(); - } - - @AfterAll - static void tearDownClass() { - cassandra.closeCluster(); - } - @Override public MailQueueFactory<RabbitMQMailQueue> getMailQueueFactory() { return mailQueueFactory; --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org