@Test void loadMimeMessageShouldPublishLoadMimeMessageTimerMetrics() { Mono.from(messageVault.loadMimeMessage(USERNAME, MESSAGE_ID)) .block(); Mono.from(messageVault.loadMimeMessage(USERNAME, MESSAGE_ID)) .block(); assertThat(metricFactory.executionTimesFor(LOAD_MIME_MESSAGE_METRIC_NAME)) .hasSize(2); }
@Override public Publisher<InputStream> loadMimeMessage(Username username, MessageId messageId) { Preconditions.checkNotNull(username); Preconditions.checkNotNull(messageId); return metricFactory.decoratePublisherWithTimerMetric( LOAD_MIME_MESSAGE_METRIC_NAME, Mono.from(messageMetadataVault.retrieveStorageInformation(username, messageId)) .flatMap(storageInformation -> loadMimeMessage(storageInformation, username, messageId))); }
BlobStoreDeletedMessageVault implements DeletedMessageVault { @Override public Publisher<InputStream> loadMimeMessage(Username username, MessageId messageId) { Preconditions.checkNotNull(username); Preconditions.checkNotNull(messageId); return metricFactory.decoratePublisherWithTimerMetric( LOAD_MIME_MESSAGE_METRIC_NAME, Mono.from(messageMetadataVault.retrieveStorageInformation(username, messageId)) .flatMap(storageInformation -> loadMimeMessage(storageInformation, username, messageId))); } }
BlobStoreDeletedMessageVault implements DeletedMessageVault { @Override public Publisher<InputStream> loadMimeMessage(Username username, MessageId messageId) { Preconditions.checkNotNull(username); Preconditions.checkNotNull(messageId); return metricFactory.decoratePublisherWithTimerMetric( LOAD_MIME_MESSAGE_METRIC_NAME, Mono.from(messageMetadataVault.retrieveStorageInformation(username, messageId)) .flatMap(storageInformation -> loadMimeMessage(storageInformation, username, messageId))); } @Inject  BlobStoreDeletedMessageVault(MetricFactory metricFactory, DeletedMessageMetadataVault messageMetadataVault,
                                        BlobStore blobStore, BlobStoreDAO blobStoreDAO, BucketNameGenerator nameGenerator,
                                        Clock clock,
                                        RetentionConfiguration retentionConfiguration); }
BlobStoreDeletedMessageVault implements DeletedMessageVault { @Override public Publisher<InputStream> loadMimeMessage(Username username, MessageId messageId) { Preconditions.checkNotNull(username); Preconditions.checkNotNull(messageId); return metricFactory.decoratePublisherWithTimerMetric( LOAD_MIME_MESSAGE_METRIC_NAME, Mono.from(messageMetadataVault.retrieveStorageInformation(username, messageId)) .flatMap(storageInformation -> loadMimeMessage(storageInformation, username, messageId))); } @Inject  BlobStoreDeletedMessageVault(MetricFactory metricFactory, DeletedMessageMetadataVault messageMetadataVault,
                                        BlobStore blobStore, BlobStoreDAO blobStoreDAO, BucketNameGenerator nameGenerator,
                                        Clock clock,
                                        RetentionConfiguration retentionConfiguration); @Override Publisher<Void> append(DeletedMessage deletedMessage, InputStream mimeMessage); @Override Publisher<InputStream> loadMimeMessage(Username username, MessageId messageId); @Override Publisher<DeletedMessage> search(Username username, Query query); @Override Publisher<Void> delete(Username username, MessageId messageId); @Override Task deleteExpiredMessagesTask(); }
BlobStoreDeletedMessageVault implements DeletedMessageVault { @Override public Publisher<InputStream> loadMimeMessage(Username username, MessageId messageId) { Preconditions.checkNotNull(username); Preconditions.checkNotNull(messageId); return metricFactory.decoratePublisherWithTimerMetric( LOAD_MIME_MESSAGE_METRIC_NAME, Mono.from(messageMetadataVault.retrieveStorageInformation(username, messageId)) .flatMap(storageInformation -> loadMimeMessage(storageInformation, username, messageId))); } @Inject  BlobStoreDeletedMessageVault(MetricFactory metricFactory, DeletedMessageMetadataVault messageMetadataVault,
                                        BlobStore blobStore, BlobStoreDAO blobStoreDAO, BucketNameGenerator nameGenerator,
                                        Clock clock,
                                        RetentionConfiguration retentionConfiguration); @Override Publisher<Void> append(DeletedMessage deletedMessage, InputStream mimeMessage); @Override Publisher<InputStream> loadMimeMessage(Username username, MessageId messageId); @Override Publisher<DeletedMessage> search(Username username, Query query); @Override Publisher<Void> delete(Username username, MessageId messageId); @Override Task deleteExpiredMessagesTask();  }