@Test public void createMailboxesIfNeededShouldNotGenerateExceptionsInConcurrentEnvironment() throws Exception { ConcurrentTestRunner.builder() .operation((threadNumber, step) -> testee.createMailboxesIfNeeded(session).block()) .threadCount(10) .runSuccessfullyWithin(Duration.ofSeconds(10)); assertThat(mailboxManager.list(session)) .containsOnlyElementsOf(DefaultMailboxes.DEFAULT_MAILBOXES .stream() .map(mailboxName -> MailboxPath.forUser(USERNAME, mailboxName)) .collect(Guavate.toImmutableList())); }
Mono<Void> createMailboxesIfNeeded(MailboxSession session) { return metricFactory.decorateSupplierWithTimerMetric("JMAP-mailboxes-provisioning", () -> { Username username = session.getUser(); return createDefaultMailboxes(username); }); }
DefaultMailboxesProvisioner { Mono<Void> createMailboxesIfNeeded(MailboxSession session) { return metricFactory.decorateSupplierWithTimerMetric("JMAP-mailboxes-provisioning", () -> { Username username = session.getUser(); return createDefaultMailboxes(username); }); } }
DefaultMailboxesProvisioner { Mono<Void> createMailboxesIfNeeded(MailboxSession session) { return metricFactory.decorateSupplierWithTimerMetric("JMAP-mailboxes-provisioning", () -> { Username username = session.getUser(); return createDefaultMailboxes(username); }); } @Inject @VisibleForTesting  DefaultMailboxesProvisioner(MailboxManager mailboxManager,
                                SubscriptionManager subscriptionManager,
                                MetricFactory metricFactory); }
DefaultMailboxesProvisioner { Mono<Void> createMailboxesIfNeeded(MailboxSession session) { return metricFactory.decorateSupplierWithTimerMetric("JMAP-mailboxes-provisioning", () -> { Username username = session.getUser(); return createDefaultMailboxes(username); }); } @Inject @VisibleForTesting  DefaultMailboxesProvisioner(MailboxManager mailboxManager,
                                SubscriptionManager subscriptionManager,
                                MetricFactory metricFactory);  }
DefaultMailboxesProvisioner { Mono<Void> createMailboxesIfNeeded(MailboxSession session) { return metricFactory.decorateSupplierWithTimerMetric("JMAP-mailboxes-provisioning", () -> { Username username = session.getUser(); return createDefaultMailboxes(username); }); } @Inject @VisibleForTesting  DefaultMailboxesProvisioner(MailboxManager mailboxManager,
                                SubscriptionManager subscriptionManager,
                                MetricFactory metricFactory);   }