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 2019/12/06 02:34:20 UTC

[james-project] 10/21: JAMES-2998 MessageFastViewProjection with retrieve hit & miss metric count

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 8f0ca105341c77fd13ec9a720760bc59439883a0
Author: Tran Tien Duc <dt...@linagora.com>
AuthorDate: Thu Nov 28 17:55:15 2019 +0700

    JAMES-2998 MessageFastViewProjection with retrieve hit & miss metric count
---
 server/data/data-jmap-cassandra/pom.xml            |  5 ++
 .../CassandraMessageFastViewProjection.java        | 16 ++++++-
 .../CassandraMessageFastViewProjectionTest.java    | 10 +++-
 server/data/data-jmap/pom.xml                      |  9 ++++
 .../api/projections/MessageFastViewProjection.java |  4 ++
 .../MemoryMessageFastViewProjection.java           | 15 +++++-
 .../MessageFastViewProjectionContract.java         | 54 +++++++++++++++++++++-
 .../MemoryMessageFastViewProjectionTest.java       | 10 +++-
 .../jmap/draft/methods/GetMessagesMethodTest.java  |  5 +-
 .../jmap/draft/methods/MessageSenderTest.java      |  3 +-
 .../methods/SetMessagesCreationProcessorTest.java  |  2 +-
 .../message/view/MessageFastViewFactoryTest.java   |  5 +-
 .../message/view/MessageFullViewFactoryTest.java   |  3 +-
 13 files changed, 126 insertions(+), 15 deletions(-)

diff --git a/server/data/data-jmap-cassandra/pom.xml b/server/data/data-jmap-cassandra/pom.xml
index 058ca36..e0162ff 100644
--- a/server/data/data-jmap-cassandra/pom.xml
+++ b/server/data/data-jmap-cassandra/pom.xml
@@ -76,6 +76,11 @@
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
+            <artifactId>metrics-tests</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
             <artifactId>testing-base</artifactId>
             <scope>test</scope>
         </dependency>
diff --git a/server/data/data-jmap-cassandra/src/main/java/org/apache/james/jmap/cassandra/projections/CassandraMessageFastViewProjection.java b/server/data/data-jmap-cassandra/src/main/java/org/apache/james/jmap/cassandra/projections/CassandraMessageFastViewProjection.java
index 47fa83d..9b0ac29 100644
--- a/server/data/data-jmap-cassandra/src/main/java/org/apache/james/jmap/cassandra/projections/CassandraMessageFastViewProjection.java
+++ b/server/data/data-jmap-cassandra/src/main/java/org/apache/james/jmap/cassandra/projections/CassandraMessageFastViewProjection.java
@@ -36,6 +36,8 @@ import org.apache.james.jmap.api.projections.MessageFastViewPrecomputedPropertie
 import org.apache.james.jmap.api.projections.MessageFastViewProjection;
 import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
 import org.apache.james.mailbox.model.MessageId;
+import org.apache.james.metrics.api.Metric;
+import org.apache.james.metrics.api.MetricFactory;
 import org.reactivestreams.Publisher;
 
 import com.datastax.driver.core.PreparedStatement;
@@ -44,8 +46,13 @@ import com.datastax.driver.core.Session;
 import com.datastax.driver.core.querybuilder.QueryBuilder;
 import com.google.common.base.Preconditions;
 
+import reactor.core.publisher.Mono;
+
 public class CassandraMessageFastViewProjection implements MessageFastViewProjection {
 
+    private final Metric metricRetrieveHitCount;
+    private final Metric metricRetrieveMissCount;
+
     private final CassandraAsyncExecutor cassandraAsyncExecutor;
 
     private final PreparedStatement storeStatement;
@@ -53,7 +60,7 @@ public class CassandraMessageFastViewProjection implements MessageFastViewProjec
     private final PreparedStatement deleteStatement;
 
     @Inject
-    CassandraMessageFastViewProjection(Session session) {
+    CassandraMessageFastViewProjection(MetricFactory metricFactory, Session session) {
         this.cassandraAsyncExecutor = new CassandraAsyncExecutor(session);
 
         this.deleteStatement = session.prepare(QueryBuilder.delete()
@@ -68,6 +75,9 @@ public class CassandraMessageFastViewProjection implements MessageFastViewProjec
         this.retrieveStatement = session.prepare(select()
             .from(TABLE_NAME)
             .where(eq(MESSAGE_ID, bindMarker(MESSAGE_ID))));
+
+        this.metricRetrieveHitCount = metricFactory.generate(METRIC_RETRIEVE_HIT_COUNT);
+        this.metricRetrieveMissCount = metricFactory.generate(METRIC_RETRIEVE_MISS_COUNT);
     }
 
     @Override
@@ -86,7 +96,9 @@ public class CassandraMessageFastViewProjection implements MessageFastViewProjec
 
         return cassandraAsyncExecutor.executeSingleRow(retrieveStatement.bind()
                 .setUUID(MESSAGE_ID, ((CassandraMessageId) messageId).get()))
-            .map(this::fromRow);
+            .map(this::fromRow)
+            .doOnNext(preview -> metricRetrieveHitCount.increment())
+            .switchIfEmpty(Mono.fromRunnable(metricRetrieveMissCount::increment));
     }
 
     @Override
diff --git a/server/data/data-jmap-cassandra/src/test/java/org/apache/james/jmap/cassandra/projections/CassandraMessageFastViewProjectionTest.java b/server/data/data-jmap-cassandra/src/test/java/org/apache/james/jmap/cassandra/projections/CassandraMessageFastViewProjectionTest.java
index 36f1b25..9612b43 100644
--- a/server/data/data-jmap-cassandra/src/test/java/org/apache/james/jmap/cassandra/projections/CassandraMessageFastViewProjectionTest.java
+++ b/server/data/data-jmap-cassandra/src/test/java/org/apache/james/jmap/cassandra/projections/CassandraMessageFastViewProjectionTest.java
@@ -27,6 +27,7 @@ import org.apache.james.jmap.api.projections.MessageFastViewProjectionContract;
 import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
 import org.apache.james.mailbox.model.MessageId;
 import org.apache.james.mailbox.model.TestMessageId;
+import org.apache.james.metrics.tests.RecordingMetricFactory;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.RegisterExtension;
@@ -38,11 +39,13 @@ class CassandraMessageFastViewProjectionTest implements MessageFastViewProjectio
 
     private CassandraMessageFastViewProjection testee;
     private CassandraMessageId.Factory cassandraMessageIdFactory;
+    private RecordingMetricFactory metricFactory;
 
     @BeforeEach
     void setUp() {
+        metricFactory = new RecordingMetricFactory();
         cassandraMessageIdFactory = new CassandraMessageId.Factory();
-        testee = new CassandraMessageFastViewProjection(cassandra.getCassandraCluster().getConf());
+        testee = new CassandraMessageFastViewProjection(metricFactory, cassandra.getCassandraCluster().getConf());
     }
 
     @Override
@@ -55,6 +58,11 @@ class CassandraMessageFastViewProjectionTest implements MessageFastViewProjectio
         return cassandraMessageIdFactory.generate();
     }
 
+    @Override
+    public RecordingMetricFactory metricFactory() {
+        return metricFactory;
+    }
+
     @Test
     void storeShouldThrowWhenMessageIdIsNotCassandraType() {
         assertThatThrownBy(() -> testee.store(TestMessageId.of(1), MESSAGE_FAST_VIEW_PRECOMPUTED_PROPERTIES_1))
diff --git a/server/data/data-jmap/pom.xml b/server/data/data-jmap/pom.xml
index 3626162..cc74155 100644
--- a/server/data/data-jmap/pom.xml
+++ b/server/data/data-jmap/pom.xml
@@ -68,6 +68,15 @@
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
+            <artifactId>metrics-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>metrics-tests</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
             <artifactId>testing-base</artifactId>
             <scope>test</scope>
         </dependency>
diff --git a/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/projections/MessageFastViewProjection.java b/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/projections/MessageFastViewProjection.java
index a93f582..3233366 100644
--- a/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/projections/MessageFastViewProjection.java
+++ b/server/data/data-jmap/src/main/java/org/apache/james/jmap/api/projections/MessageFastViewProjection.java
@@ -34,6 +34,10 @@ import reactor.core.scheduler.Schedulers;
 
 public interface MessageFastViewProjection {
 
+    String MESSAGE_FAST_VIEW_PROJECTION = "MessageFastViewProjection";
+    String METRIC_RETRIEVE_HIT_COUNT = MESSAGE_FAST_VIEW_PROJECTION + ":retrieveHitCount";
+    String METRIC_RETRIEVE_MISS_COUNT = MESSAGE_FAST_VIEW_PROJECTION + ":retrieveMissCount";
+
     Publisher<Void> store(MessageId messageId, MessageFastViewPrecomputedProperties preview);
 
     Publisher<MessageFastViewPrecomputedProperties> retrieve(MessageId messageId);
diff --git a/server/data/data-jmap/src/main/java/org/apache/james/jmap/memory/projections/MemoryMessageFastViewProjection.java b/server/data/data-jmap/src/main/java/org/apache/james/jmap/memory/projections/MemoryMessageFastViewProjection.java
index c599b8c..9492ab3 100644
--- a/server/data/data-jmap/src/main/java/org/apache/james/jmap/memory/projections/MemoryMessageFastViewProjection.java
+++ b/server/data/data-jmap/src/main/java/org/apache/james/jmap/memory/projections/MemoryMessageFastViewProjection.java
@@ -21,9 +21,13 @@ package org.apache.james.jmap.memory.projections;
 
 import java.util.concurrent.ConcurrentHashMap;
 
+import javax.inject.Inject;
+
 import org.apache.james.jmap.api.projections.MessageFastViewPrecomputedProperties;
 import org.apache.james.jmap.api.projections.MessageFastViewProjection;
 import org.apache.james.mailbox.model.MessageId;
+import org.apache.james.metrics.api.Metric;
+import org.apache.james.metrics.api.MetricFactory;
 import org.reactivestreams.Publisher;
 
 import com.google.common.base.Preconditions;
@@ -33,9 +37,14 @@ import reactor.core.publisher.Mono;
 public class MemoryMessageFastViewProjection implements MessageFastViewProjection {
 
     private final ConcurrentHashMap<MessageId, MessageFastViewPrecomputedProperties> previews;
+    private final Metric metricRetrieveHitCount;
+    private final Metric metricRetrieveMissCount;
 
-    public MemoryMessageFastViewProjection() {
+    @Inject
+    public MemoryMessageFastViewProjection(MetricFactory metricFactory) {
         this.previews = new ConcurrentHashMap<>();
+        this.metricRetrieveHitCount = metricFactory.generate(METRIC_RETRIEVE_HIT_COUNT);
+        this.metricRetrieveMissCount = metricFactory.generate(METRIC_RETRIEVE_MISS_COUNT);
     }
 
     @Override
@@ -50,7 +59,9 @@ public class MemoryMessageFastViewProjection implements MessageFastViewProjectio
     public Publisher<MessageFastViewPrecomputedProperties> retrieve(MessageId messageId) {
         Preconditions.checkNotNull(messageId);
 
-        return Mono.fromSupplier(() -> previews.get(messageId));
+        return Mono.fromSupplier(() -> previews.get(messageId))
+            .doOnNext(preview -> metricRetrieveHitCount.increment())
+            .switchIfEmpty(Mono.fromRunnable(metricRetrieveMissCount::increment));
     }
 
     @Override
diff --git a/server/data/data-jmap/src/test/java/org/apache/james/jmap/api/projections/MessageFastViewProjectionContract.java b/server/data/data-jmap/src/test/java/org/apache/james/jmap/api/projections/MessageFastViewProjectionContract.java
index 7c11d05..1e5fa66 100644
--- a/server/data/data-jmap/src/test/java/org/apache/james/jmap/api/projections/MessageFastViewProjectionContract.java
+++ b/server/data/data-jmap/src/test/java/org/apache/james/jmap/api/projections/MessageFastViewProjectionContract.java
@@ -19,18 +19,20 @@
 
 package org.apache.james.jmap.api.projections;
 
+import static org.apache.james.jmap.api.projections.MessageFastViewProjection.METRIC_RETRIEVE_HIT_COUNT;
+import static org.apache.james.jmap.api.projections.MessageFastViewProjection.METRIC_RETRIEVE_MISS_COUNT;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatCode;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.time.Duration;
+import java.util.List;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.IntStream;
 
 import org.apache.james.jmap.api.model.Preview;
-import java.util.List;
-
 import org.apache.james.mailbox.model.MessageId;
+import org.apache.james.metrics.tests.RecordingMetricFactory;
 import org.apache.james.util.concurrency.ConcurrentTestRunner;
 import org.assertj.core.api.SoftAssertions;
 import org.junit.jupiter.api.Test;
@@ -57,6 +59,8 @@ public interface MessageFastViewProjectionContract {
 
     MessageId newMessageId();
 
+    RecordingMetricFactory metricFactory();
+
     @Test
     default void retrieveShouldThrowWhenNullMessageId() {
         assertThatThrownBy(() -> Mono.from(testee().retrieve((MessageId) null)).block())
@@ -309,4 +313,50 @@ public interface MessageFastViewProjectionContract {
         assertThat(Mono.from(testee().retrieve(messageId1)).blockOptional())
             .isEmpty();
     }
+
+    @Test
+    default void retrieveShouldIncrementMetricHitCountWhenPreviewIsFound() {
+        MessageId messageId1 = newMessageId();
+        Mono.from(testee().store(messageId1, MESSAGE_FAST_VIEW_PRECOMPUTED_PROPERTIES_1))
+            .block();
+
+        Mono.from(testee().retrieve(messageId1))
+            .block();
+
+        assertThat(metricFactory().countFor(METRIC_RETRIEVE_HIT_COUNT))
+            .isEqualTo(1);
+    }
+
+    @Test
+    default void retrieveShouldNotIncrementMetricMissCountWhenPreviewIsFound() {
+        MessageId messageId1 = newMessageId();
+        Mono.from(testee().store(messageId1, MESSAGE_FAST_VIEW_PRECOMPUTED_PROPERTIES_1))
+            .block();
+
+        Mono.from(testee().retrieve(messageId1))
+            .block();
+
+        assertThat(metricFactory().countFor(METRIC_RETRIEVE_MISS_COUNT))
+            .isEqualTo(0);
+    }
+
+    @Test
+    default void retrieveShouldIncrementMetricMissCountWhenPreviewIsNotFound() {
+        MessageId messageId1 = newMessageId();
+        Mono.from(testee().retrieve(messageId1))
+            .block();
+
+        assertThat(metricFactory().countFor(METRIC_RETRIEVE_MISS_COUNT))
+            .isEqualTo(1);
+    }
+
+    @Test
+    default void retrieveShouldNotIncrementMetricHitCountWhenPreviewIsNotFound() {
+        MessageId messageId1 = newMessageId();
+        Mono.from(testee().retrieve(messageId1))
+            .block();
+
+        assertThat(metricFactory().countFor(METRIC_RETRIEVE_HIT_COUNT))
+            .isEqualTo(0);
+    }
 }
\ No newline at end of file
diff --git a/server/data/data-jmap/src/test/java/org/apache/james/jmap/memory/projections/MemoryMessageFastViewProjectionTest.java b/server/data/data-jmap/src/test/java/org/apache/james/jmap/memory/projections/MemoryMessageFastViewProjectionTest.java
index 275c176..c7b0243 100644
--- a/server/data/data-jmap/src/test/java/org/apache/james/jmap/memory/projections/MemoryMessageFastViewProjectionTest.java
+++ b/server/data/data-jmap/src/test/java/org/apache/james/jmap/memory/projections/MemoryMessageFastViewProjectionTest.java
@@ -23,17 +23,20 @@ import org.apache.james.jmap.api.projections.MessageFastViewProjection;
 import org.apache.james.jmap.api.projections.MessageFastViewProjectionContract;
 import org.apache.james.mailbox.model.MessageId;
 import org.apache.james.mailbox.model.TestMessageId;
+import org.apache.james.metrics.tests.RecordingMetricFactory;
 import org.junit.jupiter.api.BeforeEach;
 
 class MemoryMessageFastViewProjectionTest implements MessageFastViewProjectionContract {
 
     private MemoryMessageFastViewProjection testee;
     private TestMessageId.Factory messageIdFactory;
+    private RecordingMetricFactory metricFactory;
 
     @BeforeEach
     void setUp() {
+        metricFactory = new RecordingMetricFactory();
         messageIdFactory = new TestMessageId.Factory();
-        testee = new MemoryMessageFastViewProjection();
+        testee = new MemoryMessageFastViewProjection(metricFactory);
     }
 
     @Override
@@ -45,4 +48,9 @@ class MemoryMessageFastViewProjectionTest implements MessageFastViewProjectionCo
     public MessageId newMessageId() {
         return messageIdFactory.generate();
     }
+
+    @Override
+    public RecordingMetricFactory metricFactory() {
+        return metricFactory;
+    }
 }
\ No newline at end of file
diff --git a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/methods/GetMessagesMethodTest.java b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/methods/GetMessagesMethodTest.java
index fdd7059..8b38bd8 100644
--- a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/methods/GetMessagesMethodTest.java
+++ b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/methods/GetMessagesMethodTest.java
@@ -67,6 +67,7 @@ import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.model.MessageId;
 import org.apache.james.mailbox.store.StoreMailboxManager;
+import org.apache.james.metrics.api.NoopMetricFactory;
 import org.apache.james.metrics.logger.DefaultMetricFactory;
 import org.apache.james.mime4j.message.BodyPartBuilder;
 import org.apache.james.mime4j.message.MultipartBuilder;
@@ -124,9 +125,9 @@ public class GetMessagesMethodTest {
         messageMetadataViewFactory = spy(new MessageMetadataViewFactory(blobManager, messageIdManager));
         MessageFullViewFactory messageFullViewFactory = new MessageFullViewFactory(blobManager, messageContentExtractor,
             htmlTextExtractor, messageIdManager,
-            new MemoryMessageFastViewProjection());
+            new MemoryMessageFastViewProjection(new NoopMetricFactory()));
         MessageFastViewFactory messageFastViewFactory = new MessageFastViewFactory(blobManager, messageIdManager,
-            new MemoryMessageFastViewProjection(), messageFullViewFactory);
+            new MemoryMessageFastViewProjection(new NoopMetricFactory()), messageFullViewFactory);
 
         MetaMessageViewFactory metaMessageViewFactory = new MetaMessageViewFactory(
             messageFullViewFactory,
diff --git a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/methods/MessageSenderTest.java b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/methods/MessageSenderTest.java
index f4a7573..1da53f4 100644
--- a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/methods/MessageSenderTest.java
+++ b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/methods/MessageSenderTest.java
@@ -48,6 +48,7 @@ import org.apache.james.mailbox.inmemory.InMemoryId;
 import org.apache.james.mailbox.model.BlobId;
 import org.apache.james.mailbox.model.MessageId;
 import org.apache.james.mailbox.model.TestMessageId;
+import org.apache.james.metrics.api.NoopMetricFactory;
 import org.apache.james.server.core.Envelope;
 import org.apache.james.util.mime.MessageContentExtractor;
 import org.apache.mailet.Mail;
@@ -91,7 +92,7 @@ class MessageSenderTest {
         when(blobManager.toBlobId(any(MessageId.class))).thenReturn(BlobId.fromString("fake"));
         MessageIdManager messageIdManager = mock(MessageIdManager.class);
         MessageFullViewFactory messageFullViewFactory = new MessageFullViewFactory(blobManager, messageContentExtractor, htmlTextExtractor, messageIdManager,
-            new MemoryMessageFastViewProjection());
+            new MemoryMessageFastViewProjection(new NoopMetricFactory()));
         jmapMessage = messageFullViewFactory.fromMetaDataWithContent(message);
         envelope = EnvelopeUtils.fromMessage(jmapMessage);
     }
diff --git a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/methods/SetMessagesCreationProcessorTest.java b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/methods/SetMessagesCreationProcessorTest.java
index 6965932..f5059d6 100644
--- a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/methods/SetMessagesCreationProcessorTest.java
+++ b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/methods/SetMessagesCreationProcessorTest.java
@@ -128,7 +128,7 @@ public class SetMessagesCreationProcessorTest {
         MessageIdManager messageIdManager = mock(MessageIdManager.class);
         messageFullViewFactory = new MessageFullViewFactory(blobManager, messageContentExtractor, htmlTextExtractor,
             messageIdManager,
-            new MemoryMessageFastViewProjection());
+            new MemoryMessageFastViewProjection(new NoopMetricFactory()));
         mockedMailSpool = mock(MailSpool.class);
         mockedAttachmentManager = mock(AttachmentManager.class);
         mockedMailboxManager = mock(MailboxManager.class);
diff --git a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/model/message/view/MessageFastViewFactoryTest.java b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/model/message/view/MessageFastViewFactoryTest.java
index c7da512..2dcc64c 100644
--- a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/model/message/view/MessageFastViewFactoryTest.java
+++ b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/model/message/view/MessageFastViewFactoryTest.java
@@ -55,6 +55,7 @@ import org.apache.james.mailbox.model.ComposedMessageId;
 import org.apache.james.mailbox.model.MailboxId;
 import org.apache.james.mailbox.model.MailboxPath;
 import org.apache.james.mailbox.store.StoreBlobManager;
+import org.apache.james.metrics.api.NoopMetricFactory;
 import org.apache.james.util.ClassLoaderUtils;
 import org.apache.james.util.mime.MessageContentExtractor;
 import org.assertj.core.api.SoftAssertions;
@@ -134,7 +135,7 @@ class MessageFastViewFactoryTest {
                 .build(ClassLoaderUtils.getSystemResourceAsSharedStream("fullMessage.eml")),
             session);
 
-        fastViewProjection = new MemoryMessageFastViewProjection();
+        fastViewProjection = new MemoryMessageFastViewProjection(new NoopMetricFactory());
 
         Mono.from(fastViewProjection.store(previewComputedMessage1.getMessageId(), PROJECTION_1))
             .block();
@@ -145,7 +146,7 @@ class MessageFastViewFactoryTest {
 
         blobManager = resources.getBlobManager();
         messageFullViewFactory = new MessageFullViewFactory(blobManager, messageContentExtractor, htmlTextExtractor, messageIdManager,
-            new MemoryMessageFastViewProjection());
+            new MemoryMessageFastViewProjection(new NoopMetricFactory()));
         messageFastViewFactory = new MessageFastViewFactory(blobManager, messageIdManager, fastViewProjection, messageFullViewFactory);
     }
 
diff --git a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/model/message/view/MessageFullViewFactoryTest.java b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/model/message/view/MessageFullViewFactoryTest.java
index c3fb39f..b1dd9f8 100644
--- a/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/model/message/view/MessageFullViewFactoryTest.java
+++ b/server/protocols/jmap-draft/src/test/java/org/apache/james/jmap/draft/model/message/view/MessageFullViewFactoryTest.java
@@ -69,6 +69,7 @@ import org.apache.james.mailbox.model.MessageId;
 import org.apache.james.mailbox.model.MessageRange;
 import org.apache.james.mailbox.model.MessageResult;
 import org.apache.james.mailbox.model.TestMessageId;
+import org.apache.james.metrics.api.NoopMetricFactory;
 import org.apache.james.util.ClassLoaderUtils;
 import org.apache.james.util.mime.MessageContentExtractor;
 import org.assertj.core.api.SoftAssertions;
@@ -118,7 +119,7 @@ class MessageFullViewFactoryTest {
                 .build(ClassLoaderUtils.getSystemResourceAsSharedStream("fullMessage.eml")),
             session);
 
-        fastViewProjection = spy(new MemoryMessageFastViewProjection());
+        fastViewProjection = spy(new MemoryMessageFastViewProjection(new NoopMetricFactory()));
         messageFullViewFactory = new MessageFullViewFactory(resources.getBlobManager(), messageContentExtractor, htmlTextExtractor,
             messageIdManager,
             fastViewProjection);


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org