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 4deed8b3dc7850cb89ccbbbc7572e870853a5e39 Author: Benoit Tellier <[email protected]> AuthorDate: Wed Jun 19 13:38:16 2019 +0700 JAMES-2794 s/EnQueueId/EnqueueId --- .../org/apache/james/queue/rabbitmq/Dequeuer.java | 20 +++++------ .../rabbitmq/{EnQueueId.java => EnqueueId.java} | 18 +++++----- .../apache/james/queue/rabbitmq/EnqueuedItem.java | 28 +++++++-------- .../org/apache/james/queue/rabbitmq/Enqueuer.java | 6 ++-- .../apache/james/queue/rabbitmq/MailLoader.java | 4 +-- .../apache/james/queue/rabbitmq/MailReference.java | 10 +++--- .../james/queue/rabbitmq/MailReferenceDTO.java | 24 ++++++------- .../queue/rabbitmq/RabbitMQMailQueueFactory.java | 2 +- .../queue/rabbitmq/view/api/DeleteCondition.java | 16 ++++----- .../queue/rabbitmq/view/api/MailQueueView.java | 4 +-- .../view/cassandra/CassandraMailQueueBrowser.java | 2 +- .../cassandra/CassandraMailQueueMailDelete.java | 10 +++--- .../view/cassandra/CassandraMailQueueView.java | 14 ++++---- .../rabbitmq/view/cassandra/DeletedMailsDAO.java | 14 ++++---- .../rabbitmq/view/cassandra/EnqueuedMailsDAO.java | 2 +- .../view/cassandra/EnqueuedMailsDaoUtil.java | 6 ++-- .../james/queue/rabbitmq/EnqueuedItemTest.java | 10 +++--- .../apache/james/queue/rabbitmq/MailDTOTest.java | 2 +- .../rabbitmq/view/api/DeleteConditionTest.java | 42 +++++++++++----------- .../view/cassandra/DeletedMailsDAOTest.java | 28 +++++++-------- .../view/cassandra/EnqueuedMailsDaoTest.java | 12 +++---- .../{EnQueueIdTest.java => EnqueueIdTest.java} | 20 +++++------ .../model/EnqueuedItemWithSlicingContextTest.java | 4 +-- .../src/test/resources/json/mail1.json | 2 +- .../src/test/resources/json/mail_min.json | 2 +- 25 files changed, 151 insertions(+), 151 deletions(-) diff --git a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/Dequeuer.java b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/Dequeuer.java index e697cc2..db5352c 100644 --- a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/Dequeuer.java +++ b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/Dequeuer.java @@ -47,12 +47,12 @@ class Dequeuer { private static class RabbitMQMailQueueItem implements MailQueue.MailQueueItem { private final Consumer<Boolean> ack; - private final EnQueueId enQueueId; + private final EnqueueId enqueueId; private final Mail mail; - private RabbitMQMailQueueItem(Consumer<Boolean> ack, EnQueueId enQueueId, Mail mail) { + private RabbitMQMailQueueItem(Consumer<Boolean> ack, EnqueueId enqueueId, Mail mail) { this.ack = ack; - this.enQueueId = enQueueId; + this.enqueueId = enqueueId; this.mail = mail; } @@ -61,8 +61,8 @@ class Dequeuer { return mail; } - public EnQueueId getEnQueueId() { - return enQueueId; + public EnqueueId getEnqueueId() { + return enqueueId; } @Override @@ -71,12 +71,12 @@ class Dequeuer { } } - private final Function<MailReferenceDTO, Pair<EnQueueId, Mail>> mailLoader; + private final Function<MailReferenceDTO, Pair<EnqueueId, Mail>> mailLoader; private final Metric dequeueMetric; private final MailReferenceSerializer mailReferenceSerializer; private final MailQueueView mailQueueView; - Dequeuer(MailQueueName name, RabbitClient rabbitClient, Function<MailReferenceDTO, Pair<EnQueueId, Mail>> mailLoader, + Dequeuer(MailQueueName name, RabbitClient rabbitClient, Function<MailReferenceDTO, Pair<EnqueueId, Mail>> mailLoader, MailReferenceSerializer serializer, MetricFactory metricFactory, MailQueueView mailQueueView) { this.mailLoader = mailLoader; @@ -94,7 +94,7 @@ class Dequeuer { } private Mono<RabbitMQMailQueueItem> filterIfDeleted(RabbitMQMailQueueItem item) { - return mailQueueView.isPresent(item.getEnQueueId()) + return mailQueueView.isPresent(item.getEnqueueId()) .flatMap(isPresent -> { if (isPresent) { return Mono.just(item); @@ -106,7 +106,7 @@ class Dequeuer { private Mono<RabbitMQMailQueueItem> loadItem(AcknowledgableDelivery response) { try { - Pair<EnQueueId, Mail> idAndMail = loadMail(response); + Pair<EnqueueId, Mail> idAndMail = loadMail(response); Mail mail = idAndMail.getRight(); ThrowingConsumer<Boolean> ack = ack(response, mail); return Mono.just(new RabbitMQMailQueueItem(ack, idAndMail.getLeft(), mail)); @@ -127,7 +127,7 @@ class Dequeuer { }; } - private Pair<EnQueueId, Mail> loadMail(Delivery response) throws MailQueue.MailQueueException { + private Pair<EnqueueId, Mail> loadMail(Delivery response) throws MailQueue.MailQueueException { MailReferenceDTO mailDTO = toMailReference(response); return mailLoader.apply(mailDTO); } diff --git a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/EnQueueId.java b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/EnqueueId.java similarity index 83% rename from server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/EnQueueId.java rename to server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/EnqueueId.java index 133172d..e2057ac 100644 --- a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/EnQueueId.java +++ b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/EnqueueId.java @@ -25,25 +25,25 @@ import java.util.UUID; import com.datastax.driver.core.utils.UUIDs; import com.google.common.base.Preconditions; -public class EnQueueId { +public class EnqueueId { - public static EnQueueId generate() { + public static EnqueueId generate() { return of(UUIDs.timeBased()); } - public static EnQueueId of(UUID uuid) { + public static EnqueueId of(UUID uuid) { Preconditions.checkNotNull(uuid); - return new EnQueueId(uuid); + return new EnqueueId(uuid); } - public static EnQueueId ofSerialized(String serialized) { + public static EnqueueId ofSerialized(String serialized) { Preconditions.checkNotNull(serialized); return of(UUID.fromString(serialized)); } private final UUID id; - private EnQueueId(UUID id) { + private EnqueueId(UUID id) { this.id = id; } @@ -57,10 +57,10 @@ public class EnQueueId { @Override public final boolean equals(Object o) { - if (o instanceof EnQueueId) { - EnQueueId enQueueId = (EnQueueId) o; + if (o instanceof EnqueueId) { + EnqueueId enqueueId = (EnqueueId) o; - return Objects.equals(this.id, enQueueId.id); + return Objects.equals(this.id, enqueueId.id); } return false; } diff --git a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/EnqueuedItem.java b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/EnqueuedItem.java index d693906..4bdc4a9 100644 --- a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/EnqueuedItem.java +++ b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/EnqueuedItem.java @@ -33,7 +33,7 @@ public class EnqueuedItem { @FunctionalInterface interface RequireEnqueueId { - RequireMailQueueName enQueueId(EnQueueId id); + RequireMailQueueName enqueueId(EnqueueId id); } @FunctionalInterface @@ -57,20 +57,20 @@ public class EnqueuedItem { } class ReadyToBuild { - private final EnQueueId enQueueId; + private final EnqueueId enqueueId; private final MailQueueName mailQueueName; private final Mail mail; private final Instant enqueuedTime; private final MimeMessagePartsId partsId; - ReadyToBuild(EnQueueId enQueueId, MailQueueName mailQueueName, Mail mail, Instant enqueuedTime, MimeMessagePartsId partsId) { - Preconditions.checkNotNull(enQueueId, "'enQueueId' is mandatory"); + ReadyToBuild(EnqueueId enqueueId, MailQueueName mailQueueName, Mail mail, Instant enqueuedTime, MimeMessagePartsId partsId) { + Preconditions.checkNotNull(enqueueId, "'enqueueId' is mandatory"); Preconditions.checkNotNull(mailQueueName, "'mailQueueName' is mandatory"); Preconditions.checkNotNull(mail, "'mail' is mandatory"); Preconditions.checkNotNull(enqueuedTime, "'enqueuedTime' is mandatory"); Preconditions.checkNotNull(partsId, "'partsId' is mandatory"); - this.enQueueId = enQueueId; + this.enqueueId = enqueueId; this.mailQueueName = mailQueueName; this.mail = mail; this.enqueuedTime = enqueuedTime; @@ -78,31 +78,31 @@ public class EnqueuedItem { } public EnqueuedItem build() { - return new EnqueuedItem(enQueueId, mailQueueName, mail, enqueuedTime, partsId); + return new EnqueuedItem(enqueueId, mailQueueName, mail, enqueuedTime, partsId); } } } public static Builder.RequireEnqueueId builder() { - return enQueueId -> queueName -> mail -> enqueuedTime -> partsId -> new Builder.ReadyToBuild(enQueueId, queueName, mail, enqueuedTime, partsId); + return enqueueId -> queueName -> mail -> enqueuedTime -> partsId -> new Builder.ReadyToBuild(enqueueId, queueName, mail, enqueuedTime, partsId); } - private final EnQueueId enQueueId; + private final EnqueueId enqueueId; private final MailQueueName mailQueueName; private final Mail mail; private final Instant enqueuedTime; private final MimeMessagePartsId partsId; - EnqueuedItem(EnQueueId enQueueId, MailQueueName mailQueueName, Mail mail, Instant enqueuedTime, MimeMessagePartsId partsId) { - this.enQueueId = enQueueId; + EnqueuedItem(EnqueueId enqueueId, MailQueueName mailQueueName, Mail mail, Instant enqueuedTime, MimeMessagePartsId partsId) { + this.enqueueId = enqueueId; this.mailQueueName = mailQueueName; this.mail = mail; this.enqueuedTime = enqueuedTime; this.partsId = partsId; } - public EnQueueId getEnQueueId() { - return enQueueId; + public EnqueueId getEnqueueId() { + return enqueueId; } public MailQueueName getMailQueueName() { @@ -126,7 +126,7 @@ public class EnqueuedItem { if (o instanceof EnqueuedItem) { EnqueuedItem that = (EnqueuedItem) o; - return Objects.equals(this.enQueueId, that.enQueueId) + return Objects.equals(this.enqueueId, that.enqueueId) && Objects.equals(this.mailQueueName, that.mailQueueName) && Objects.equals(this.mail, that.mail) && Objects.equals(this.enqueuedTime, that.enqueuedTime) @@ -137,6 +137,6 @@ public class EnqueuedItem { @Override public final int hashCode() { - return Objects.hash(enQueueId, mailQueueName, mail, enqueuedTime, partsId); + return Objects.hash(enqueueId, mailQueueName, mail, enqueuedTime, partsId); } } diff --git a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/Enqueuer.java b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/Enqueuer.java index 8f0c0fd..776a739 100644 --- a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/Enqueuer.java +++ b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/Enqueuer.java @@ -61,9 +61,9 @@ class Enqueuer { } void enQueue(Mail mail) throws MailQueue.MailQueueException { - EnQueueId enQueueId = EnQueueId.generate(); + EnqueueId enqueueId = EnqueueId.generate(); saveMail(mail) - .map(partIds -> new MailReference(enQueueId, mail, partIds)) + .map(partIds -> new MailReference(enqueueId, mail, partIds)) .map(Throwing.function(this::publishReferenceToRabbit).sneakyThrow()) .flatMap(mailQueueView::storeMail) .thenEmpty(Mono.fromRunnable(enqueueMetric::increment)) @@ -82,7 +82,7 @@ class Enqueuer { rabbitClient.publish(name, getMailReferenceBytes(mailReference)); return EnqueuedItem.builder() - .enQueueId(mailReference.getEnQueueId()) + .enqueueId(mailReference.getEnqueueId()) .mailQueueName(name) .mail(mailReference.getMail()) .enqueuedTime(clock.instant()) diff --git a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/MailLoader.java b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/MailLoader.java index ca7df53..98fdc5c 100644 --- a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/MailLoader.java +++ b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/MailLoader.java @@ -39,14 +39,14 @@ class MailLoader { this.blobIdFactory = blobIdFactory; } - Pair<EnQueueId, Mail> load(MailReferenceDTO dto) throws MailQueue.MailQueueException { + Pair<EnqueueId, Mail> load(MailReferenceDTO dto) throws MailQueue.MailQueueException { try { MailReference mailReference = dto.toMailReference(blobIdFactory); Mail mail = mailReference.getMail(); MimeMessage mimeMessage = mimeMessageStore.read(mailReference.getPartsId()).block(); mail.setMessage(mimeMessage); - return Pair.of(mailReference.getEnQueueId(), mail); + return Pair.of(mailReference.getEnqueueId(), mail); } catch (AddressException e) { throw new MailQueue.MailQueueException("Failed to parse mail address", e); } catch (MessagingException e) { diff --git a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/MailReference.java b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/MailReference.java index 031d97b..16165d1 100644 --- a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/MailReference.java +++ b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/MailReference.java @@ -24,18 +24,18 @@ import org.apache.mailet.Mail; public class MailReference { - private final EnQueueId enQueueId; + private final EnqueueId enqueueId; private final Mail mail; private final MimeMessagePartsId partsId; - public MailReference(EnQueueId enQueueId, Mail mail, MimeMessagePartsId partsId) { - this.enQueueId = enQueueId; + public MailReference(EnqueueId enqueueId, Mail mail, MimeMessagePartsId partsId) { + this.enqueueId = enqueueId; this.mail = mail; this.partsId = partsId; } - public EnQueueId getEnQueueId() { - return enQueueId; + public EnqueueId getEnqueueId() { + return enqueueId; } public Mail getMail() { diff --git a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/MailReferenceDTO.java b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/MailReferenceDTO.java index f63458f..4d88292 100644 --- a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/MailReferenceDTO.java +++ b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/MailReferenceDTO.java @@ -55,7 +55,7 @@ class MailReferenceDTO { MimeMessagePartsId partsId = mailReference.getPartsId(); return new MailReferenceDTO( - mailReference.getEnQueueId().serialize(), + mailReference.getEnqueueId().serialize(), Optional.ofNullable(mail.getRecipients()).map(Collection::stream) .orElse(Stream.empty()) .map(MailAddress::asString) @@ -91,7 +91,7 @@ class MailReferenceDTO { .collect(Guavate.toImmutableMap(name, value)); } - private final String enQueueId; + private final String enqueueId; private final ImmutableList<String> recipients; private final String name; private final Optional<String> sender; @@ -106,7 +106,7 @@ class MailReferenceDTO { private final String bodyBlobId; @JsonCreator - private MailReferenceDTO(@JsonProperty("enQueueId") String enQueueId, + private MailReferenceDTO(@JsonProperty("enqueueId") String enqueueId, @JsonProperty("recipients") ImmutableList<String> recipients, @JsonProperty("name") String name, @JsonProperty("sender") Optional<String> sender, @@ -119,7 +119,7 @@ class MailReferenceDTO { @JsonProperty("perRecipientHeaders") Map<String, HeadersDto> perRecipientHeaders, @JsonProperty("headerBlobId") String headerBlobId, @JsonProperty("bodyBlobId") String bodyBlobId) { - this.enQueueId = enQueueId; + this.enqueueId = enqueueId; this.recipients = recipients; this.name = name; this.sender = sender; @@ -134,9 +134,9 @@ class MailReferenceDTO { this.bodyBlobId = bodyBlobId; } - @JsonProperty("enQueueId") - public String getEnQueueId() { - return enQueueId; + @JsonProperty("enqueueId") + public String getEnqueueId() { + return enqueueId; } @JsonProperty("recipients") @@ -199,8 +199,8 @@ class MailReferenceDTO { return bodyBlobId; } - EnQueueId retrieveEnqueueId() { - return EnQueueId.ofSerialized(enQueueId); + EnqueueId retrieveEnqueueId() { + return EnqueueId.ofSerialized(enQueueId); } MailReference toMailReference(BlobId.Factory blobIdFactory) { @@ -209,7 +209,7 @@ class MailReferenceDTO { .bodyBlobId(blobIdFactory.from(bodyBlobId)) .build(); - return new MailReference(EnQueueId.ofSerialized(enQueueId), mailMetadata(), messagePartsId); + return new MailReference(EnqueueId.ofSerialized(enqueueId), mailMetadata(), messagePartsId); } private MailImpl mailMetadata() { @@ -255,7 +255,7 @@ class MailReferenceDTO { if (o instanceof MailReferenceDTO) { MailReferenceDTO mailDTO = (MailReferenceDTO) o; - return Objects.equals(this.enQueueId, mailDTO.enQueueId) + return Objects.equals(this.enqueueId, mailDTO.enqueueId) && Objects.equals(this.recipients, mailDTO.recipients) && Objects.equals(this.name, mailDTO.name) && Objects.equals(this.sender, mailDTO.sender) @@ -274,6 +274,6 @@ class MailReferenceDTO { @Override public final int hashCode() { - return Objects.hash(enQueueId, recipients, name, sender, state, errorMessage, lastUpdated, attributes, remoteAddr, remoteHost, perRecipientHeaders, headerBlobId, bodyBlobId); + return Objects.hash(enqueueId, recipients, name, sender, state, errorMessage, lastUpdated, attributes, remoteAddr, remoteHost, perRecipientHeaders, headerBlobId, bodyBlobId); } } diff --git a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/RabbitMQMailQueueFactory.java b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/RabbitMQMailQueueFactory.java index 3660d12..fdf24a1 100644 --- a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/RabbitMQMailQueueFactory.java +++ b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/RabbitMQMailQueueFactory.java @@ -54,7 +54,7 @@ public class RabbitMQMailQueueFactory implements MailQueueFactory<RabbitMQMailQu private final RabbitClient rabbitClient; private final Store<MimeMessage, MimeMessagePartsId> mimeMessageStore; private final MailReferenceSerializer mailReferenceSerializer; - private final Function<MailReferenceDTO, Pair<EnQueueId, Mail>> mailLoader; + private final Function<MailReferenceDTO, Pair<EnqueueId, Mail>> mailLoader; private final MailQueueView.Factory mailQueueViewFactory; private final Clock clock; private final MailQueueItemDecoratorFactory decoratorFactory; diff --git a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/api/DeleteCondition.java b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/api/DeleteCondition.java index aa3973a..12aba7b 100644 --- a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/api/DeleteCondition.java +++ b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/api/DeleteCondition.java @@ -23,7 +23,7 @@ import java.util.Objects; import org.apache.commons.lang3.NotImplementedException; import org.apache.james.queue.api.ManageableMailQueue; -import org.apache.james.queue.rabbitmq.EnQueueId; +import org.apache.james.queue.rabbitmq.EnqueueId; import org.apache.james.queue.rabbitmq.EnqueuedItem; import com.google.common.base.Preconditions; @@ -113,20 +113,20 @@ public interface DeleteCondition { } class WithEnqueueId implements DeleteCondition { - private final EnQueueId enQueueId; + private final EnqueueId enqueueId; - WithEnqueueId(EnQueueId enQueueId) { - this.enQueueId = enQueueId; + WithEnqueueId(EnqueueId enqueueId) { + this.enqueueId = enqueueId; } - public EnQueueId getEnQueueId() { - return enQueueId; + public EnqueueId getEnqueueId() { + return enqueueId; } @Override public boolean shouldBeDeleted(EnqueuedItem enqueuedItem) { Preconditions.checkNotNull(enqueuedItem); - return enqueuedItem.getEnQueueId().equals(enQueueId); + return enqueuedItem.getEnqueueId().equals(enqueueId); } } @@ -191,7 +191,7 @@ public interface DeleteCondition { return new WithName(value); } - static WithEnqueueId withEnqueueId(EnQueueId value) { + static WithEnqueueId withEnqueueId(EnqueueId value) { Preconditions.checkNotNull(value); return new WithEnqueueId(value); } diff --git a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/api/MailQueueView.java b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/api/MailQueueView.java index a641484..33eec80 100644 --- a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/api/MailQueueView.java +++ b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/api/MailQueueView.java @@ -20,7 +20,7 @@ package org.apache.james.queue.rabbitmq.view.api; import org.apache.james.queue.api.ManageableMailQueue; -import org.apache.james.queue.rabbitmq.EnQueueId; +import org.apache.james.queue.rabbitmq.EnqueueId; import org.apache.james.queue.rabbitmq.EnqueuedItem; import org.apache.james.queue.rabbitmq.MailQueueName; @@ -38,7 +38,7 @@ public interface MailQueueView { long delete(DeleteCondition deleteCondition); - Mono<Boolean> isPresent(EnQueueId id); + Mono<Boolean> isPresent(EnqueueId id); ManageableMailQueue.MailQueueIterator browse(); diff --git a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/CassandraMailQueueBrowser.java b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/CassandraMailQueueBrowser.java index baf19a3..b5a5d7f 100644 --- a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/CassandraMailQueueBrowser.java +++ b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/CassandraMailQueueBrowser.java @@ -139,7 +139,7 @@ public class CassandraMailQueueBrowser { private Flux<EnqueuedItemWithSlicingContext> browseBucket(MailQueueName queueName, Slice slice, BucketId bucketId) { return enqueuedMailsDao.selectEnqueuedMails(queueName, slice, bucketId) - .filterWhen(mailReference -> deletedMailsDao.isStillEnqueued(queueName, mailReference.getEnqueuedItem().getEnQueueId())); + .filterWhen(mailReference -> deletedMailsDao.isStillEnqueued(queueName, mailReference.getEnqueuedItem().getEnqueueId())); } private Flux<Slice> allSlicesStartingAt(Instant browseStart) { diff --git a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/CassandraMailQueueMailDelete.java b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/CassandraMailQueueMailDelete.java index b326eb4..a08318e 100644 --- a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/CassandraMailQueueMailDelete.java +++ b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/CassandraMailQueueMailDelete.java @@ -24,7 +24,7 @@ import java.util.concurrent.ThreadLocalRandom; import javax.inject.Inject; -import org.apache.james.queue.rabbitmq.EnQueueId; +import org.apache.james.queue.rabbitmq.EnqueueId; import org.apache.james.queue.rabbitmq.MailQueueName; import org.apache.james.queue.rabbitmq.view.cassandra.configuration.CassandraMailQueueViewConfiguration; @@ -49,14 +49,14 @@ public class CassandraMailQueueMailDelete { this.configuration = configuration; } - Mono<Void> considerDeleted(EnQueueId enQueueId, MailQueueName mailQueueName) { + Mono<Void> considerDeleted(EnqueueId enqueueId, MailQueueName mailQueueName) { return deletedMailsDao - .markAsDeleted(mailQueueName, enQueueId) + .markAsDeleted(mailQueueName, enqueueId) .doOnNext(ignored -> maybeUpdateBrowseStart(mailQueueName)); } - Mono<Boolean> isDeleted(EnQueueId enQueueId, MailQueueName mailQueueName) { - return deletedMailsDao.isDeleted(mailQueueName, enQueueId); + Mono<Boolean> isDeleted(EnqueueId enqueueId, MailQueueName mailQueueName) { + return deletedMailsDao.isDeleted(mailQueueName, enqueueId); } void updateBrowseStart(MailQueueName mailQueueName) { diff --git a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/CassandraMailQueueView.java b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/CassandraMailQueueView.java index a2cabda..0c5af4c 100644 --- a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/CassandraMailQueueView.java +++ b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/CassandraMailQueueView.java @@ -22,7 +22,7 @@ package org.apache.james.queue.rabbitmq.view.cassandra; import javax.inject.Inject; import org.apache.james.queue.api.ManageableMailQueue; -import org.apache.james.queue.rabbitmq.EnQueueId; +import org.apache.james.queue.rabbitmq.EnqueueId; import org.apache.james.queue.rabbitmq.EnqueuedItem; import org.apache.james.queue.rabbitmq.MailQueueName; import org.apache.james.queue.rabbitmq.view.api.DeleteCondition; @@ -101,8 +101,8 @@ public class CassandraMailQueueView implements MailQueueView { @Override public long delete(DeleteCondition deleteCondition) { if (deleteCondition instanceof DeleteCondition.WithEnqueueId) { - DeleteCondition.WithEnqueueId enQueueIdCondition = (DeleteCondition.WithEnqueueId) deleteCondition; - delete(enQueueIdCondition.getEnQueueId()).block(); + DeleteCondition.WithEnqueueId enqueueIdCondition = (DeleteCondition.WithEnqueueId) deleteCondition; + delete(enqueueIdCondition.getEnqueueId()).block(); return 1L; } return browseThenDelete(deleteCondition); @@ -112,18 +112,18 @@ public class CassandraMailQueueView implements MailQueueView { return cassandraMailQueueBrowser.browseReferences(mailQueueName) .map(EnqueuedItemWithSlicingContext::getEnqueuedItem) .filter(deleteCondition::shouldBeDeleted) - .flatMap(mailReference -> cassandraMailQueueMailDelete.considerDeleted(mailReference.getEnQueueId(), mailQueueName)) + .flatMap(mailReference -> cassandraMailQueueMailDelete.considerDeleted(mailReference.getEnqueueId(), mailQueueName)) .count() .doOnNext(ignored -> cassandraMailQueueMailDelete.updateBrowseStart(mailQueueName)) .block(); } - private Mono<Void> delete(EnQueueId enQueueId) { - return cassandraMailQueueMailDelete.considerDeleted(enQueueId, mailQueueName); + private Mono<Void> delete(EnqueueId enqueueId) { + return cassandraMailQueueMailDelete.considerDeleted(enqueueId, mailQueueName); } @Override - public Mono<Boolean> isPresent(EnQueueId id) { + public Mono<Boolean> isPresent(EnqueueId id) { return cassandraMailQueueMailDelete.isDeleted(id, mailQueueName) .map(bool -> !bool); } diff --git a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/DeletedMailsDAO.java b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/DeletedMailsDAO.java index 7f44c6f..a0551e9 100644 --- a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/DeletedMailsDAO.java +++ b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/DeletedMailsDAO.java @@ -30,7 +30,7 @@ import static org.apache.james.queue.rabbitmq.view.cassandra.CassandraMailQueueV import javax.inject.Inject; import org.apache.james.backends.cassandra.utils.CassandraAsyncExecutor; -import org.apache.james.queue.rabbitmq.EnQueueId; +import org.apache.james.queue.rabbitmq.EnqueueId; import org.apache.james.queue.rabbitmq.MailQueueName; import com.datastax.driver.core.PreparedStatement; @@ -64,21 +64,21 @@ public class DeletedMailsDAO { .and(eq(ENQUEUE_ID, bindMarker(ENQUEUE_ID)))); } - Mono<Void> markAsDeleted(MailQueueName mailQueueName, EnQueueId enQueueId) { + Mono<Void> markAsDeleted(MailQueueName mailQueueName, EnqueueId enqueueId) { return executor.executeVoid(insertOne.bind() .setString(QUEUE_NAME, mailQueueName.asString()) - .setUUID(ENQUEUE_ID, enQueueId.asUUID())); + .setUUID(ENQUEUE_ID, enqueueId.asUUID())); } - Mono<Boolean> isDeleted(MailQueueName mailQueueName, EnQueueId enQueueId) { + Mono<Boolean> isDeleted(MailQueueName mailQueueName, EnqueueId enqueueId) { return executor.executeReturnExists( selectOne.bind() .setString(QUEUE_NAME, mailQueueName.asString()) - .setUUID(ENQUEUE_ID, enQueueId.asUUID())); + .setUUID(ENQUEUE_ID, enqueueId.asUUID())); } - Mono<Boolean> isStillEnqueued(MailQueueName mailQueueName, EnQueueId enQueueId) { - return isDeleted(mailQueueName, enQueueId) + Mono<Boolean> isStillEnqueued(MailQueueName mailQueueName, EnqueueId enqueueId) { + return isDeleted(mailQueueName, enqueueId) .map(b -> !b); } } diff --git a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/EnqueuedMailsDAO.java b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/EnqueuedMailsDAO.java index 1c8627e..55f0e43 100644 --- a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/EnqueuedMailsDAO.java +++ b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/EnqueuedMailsDAO.java @@ -125,7 +125,7 @@ public class EnqueuedMailsDAO { .setTimestamp(TIME_RANGE_START, Date.from(slicingContext.getTimeRangeStart())) .setInt(BUCKET_ID, slicingContext.getBucketId().getValue()) .setTimestamp(ENQUEUED_TIME, Date.from(enqueuedItem.getEnqueuedTime())) - .setUUID(ENQUEUE_ID, enqueuedItem.getEnQueueId().asUUID()) + .setUUID(ENQUEUE_ID, enqueuedItem.getEnqueueId().asUUID()) .setString(NAME, mail.getName()) .setString(HEADER_BLOB_ID, mimeMessagePartsId.getHeaderBlobId().asString()) .setString(BODY_BLOB_ID, mimeMessagePartsId.getBodyBlobId().asString()) diff --git a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/EnqueuedMailsDaoUtil.java b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/EnqueuedMailsDaoUtil.java index 004e9af..04c6cec 100644 --- a/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/EnqueuedMailsDaoUtil.java +++ b/server/queue/queue-rabbitmq/src/main/java/org/apache/james/queue/rabbitmq/view/cassandra/EnqueuedMailsDaoUtil.java @@ -58,7 +58,7 @@ import org.apache.james.backends.cassandra.init.CassandraTypesProvider; import org.apache.james.blob.api.BlobId; import org.apache.james.blob.mail.MimeMessagePartsId; import org.apache.james.core.MailAddress; -import org.apache.james.queue.rabbitmq.EnQueueId; +import org.apache.james.queue.rabbitmq.EnqueueId; import org.apache.james.queue.rabbitmq.EnqueuedItem; import org.apache.james.queue.rabbitmq.MailQueueName; import org.apache.james.queue.rabbitmq.view.cassandra.model.BucketedSlices; @@ -81,7 +81,7 @@ public class EnqueuedMailsDaoUtil { static EnqueuedItemWithSlicingContext toEnqueuedMail(Row row, BlobId.Factory blobFactory) { MailQueueName queueName = MailQueueName.fromString(row.getString(QUEUE_NAME)); - EnQueueId enQueueId = EnQueueId.of(row.getUUID(ENQUEUE_ID)); + EnqueueId enqueueId = EnqueueId.of(row.getUUID(ENQUEUE_ID)); Instant timeRangeStart = row.getTimestamp(TIME_RANGE_START).toInstant(); BucketedSlices.BucketId bucketId = BucketedSlices.BucketId.of(row.getInt(BUCKET_ID)); Instant enqueuedTime = row.getTimestamp(ENQUEUED_TIME).toInstant(); @@ -122,7 +122,7 @@ public class EnqueuedMailsDaoUtil { .addAttributes(toAttributes(rawAttributes)) .build(); EnqueuedItem enqueuedItem = EnqueuedItem.builder() - .enQueueId(enQueueId) + .enqueueId(enqueueId) .mailQueueName(queueName) .mail(mail) .enqueuedTime(enqueuedTime) diff --git a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/EnqueuedItemTest.java b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/EnqueuedItemTest.java index 73c8302..d7b5e66 100644 --- a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/EnqueuedItemTest.java +++ b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/EnqueuedItemTest.java @@ -59,7 +59,7 @@ class EnqueuedItemTest { @Test void buildShouldThrowWhenEnqueueIdIsNull() { assertThatThrownBy(() -> EnqueuedItem.builder() - .enQueueId(null) + .enqueueId(null) .mailQueueName(mailQueueName) .mail(mail) .enqueuedTime(enqueuedTime) @@ -71,7 +71,7 @@ class EnqueuedItemTest { @Test void buildShouldThrowWhenMailQueueNameIsNull() { assertThatThrownBy(() -> EnqueuedItem.builder() - .enQueueId(EnQueueId.generate()) + .enqueueId(EnqueueId.generate()) .mailQueueName(null) .mail(mail) .enqueuedTime(enqueuedTime) @@ -83,7 +83,7 @@ class EnqueuedItemTest { @Test void buildShouldThrowWhenMailIsNull() { assertThatThrownBy(() -> EnqueuedItem.builder() - .enQueueId(EnQueueId.generate()) + .enqueueId(EnqueueId.generate()) .mailQueueName(mailQueueName) .mail(null) .enqueuedTime(enqueuedTime) @@ -95,7 +95,7 @@ class EnqueuedItemTest { @Test void buildShouldThrowWhenEnqueuedTimeIsNull() { assertThatThrownBy(() -> EnqueuedItem.builder() - .enQueueId(EnQueueId.generate()) + .enqueueId(EnqueueId.generate()) .mailQueueName(mailQueueName) .mail(mail) .enqueuedTime(null) @@ -107,7 +107,7 @@ class EnqueuedItemTest { @Test void buildShouldThrowWhenMimeMessagePartsIdIsNull() { assertThatThrownBy(() -> EnqueuedItem.builder() - .enQueueId(EnQueueId.generate()) + .enqueueId(EnqueueId.generate()) .mailQueueName(mailQueueName) .mail(mail) .enqueuedTime(enqueuedTime) diff --git a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/MailDTOTest.java b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/MailDTOTest.java index 2b110fa..c4dd573 100644 --- a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/MailDTOTest.java +++ b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/MailDTOTest.java @@ -46,7 +46,7 @@ import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; class MailDTOTest { - static final EnQueueId EN_QUEUE_ID = EnQueueId.ofSerialized("110e8400-e29b-11d4-a716-446655440000"); + static final EnqueueId EN_QUEUE_ID = EnqueueId.ofSerialized("110e8400-e29b-11d4-a716-446655440000"); static final HashBlobId.Factory BLOB_ID_FACTORY = new HashBlobId.Factory(); static final Date LAST_UPDATED = Date.from(Instant.parse("2016-09-08T14:25:52.000Z")); diff --git a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/api/DeleteConditionTest.java b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/api/DeleteConditionTest.java index d7d34fa..ddcd5da 100644 --- a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/api/DeleteConditionTest.java +++ b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/api/DeleteConditionTest.java @@ -28,7 +28,7 @@ import org.apache.james.blob.api.HashBlobId; import org.apache.james.blob.mail.MimeMessagePartsId; import org.apache.james.core.MailAddress; import org.apache.james.queue.api.ManageableMailQueue; -import org.apache.james.queue.rabbitmq.EnQueueId; +import org.apache.james.queue.rabbitmq.EnqueueId; import org.apache.james.queue.rabbitmq.EnqueuedItem; import org.apache.james.queue.rabbitmq.MailQueueName; import org.apache.mailet.base.test.FakeMail; @@ -42,8 +42,8 @@ class DeleteConditionTest { private static final String ADDRESS_2 = "[email protected]"; private static final String NAME = "name"; private static final String VALUE = "value"; - private static final EnQueueId EN_QUEUE_ID_1 = EnQueueId.ofSerialized("110e8400-e29b-11d4-a716-446655440000"); - private static final EnQueueId EN_QUEUE_ID_2 = EnQueueId.ofSerialized("464765a0-e4e7-11e4-aba4-710c1de3782b"); + private static final EnqueueId ENQUEUE_ID_1 = EnqueueId.ofSerialized("110e8400-e29b-11d4-a716-446655440000"); + private static final EnqueueId ENQUEUE_ID_2 = EnqueueId.ofSerialized("464765a0-e4e7-11e4-aba4-710c1de3782b"); private static final MailQueueName OUT_GOING_1 = MailQueueName.fromString("OUT_GOING_1"); private static final Instant ENQUEUE_TIME = Instant.now(); private static final MimeMessagePartsId MESSAGE_PARTS_ID = MimeMessagePartsId.builder() @@ -57,7 +57,7 @@ class DeleteConditionTest { void allShouldReturnTrue() throws Exception { assertThat( DeleteCondition.all() - .shouldBeDeleted(enQueueItemForMail(FakeMail.builder().name("name").build()))) + .shouldBeDeleted(enqueuedItemForMail(FakeMail.builder().name("name").build()))) .isTrue(); } @@ -76,7 +76,7 @@ class DeleteConditionTest { } @Nested - class WithEnQueueIdTest { + class WithEnqueueIdTest { @Test void withSenderShouldThrowOnNullCondition() { assertThatThrownBy(() -> @@ -87,7 +87,7 @@ class DeleteConditionTest { @Test void shouldBeDeletedShouldReturnTrueWhenSameId() throws Exception { EnqueuedItem enqueuedItem = EnqueuedItem.builder() - .enQueueId(EN_QUEUE_ID_1) + .enqueueId(ENQUEUE_ID_1) .mailQueueName(OUT_GOING_1) .mail(FakeMail.builder() .name("name") @@ -97,14 +97,14 @@ class DeleteConditionTest { .mimeMessagePartsId(MESSAGE_PARTS_ID) .build(); - assertThat(DeleteCondition.withEnqueueId(EN_QUEUE_ID_1).shouldBeDeleted(enqueuedItem)) + assertThat(DeleteCondition.withEnqueueId(ENQUEUE_ID_1).shouldBeDeleted(enqueuedItem)) .isTrue(); } @Test void shouldBeDeletedShouldReturnFalseWhenDifferentId() throws Exception { EnqueuedItem enqueuedItem = EnqueuedItem.builder() - .enQueueId(EN_QUEUE_ID_2) + .enqueueId(ENQUEUE_ID_2) .mailQueueName(OUT_GOING_1) .mail(FakeMail.builder() .name("name") @@ -114,7 +114,7 @@ class DeleteConditionTest { .mimeMessagePartsId(MESSAGE_PARTS_ID) .build(); - assertThat(DeleteCondition.withEnqueueId(EN_QUEUE_ID_1).shouldBeDeleted(enqueuedItem)) + assertThat(DeleteCondition.withEnqueueId(ENQUEUE_ID_1).shouldBeDeleted(enqueuedItem)) .isFalse(); } } @@ -140,7 +140,7 @@ class DeleteConditionTest { void withSenderShouldReturnTrueWhenSameAddress() throws Exception { assertThat( DeleteCondition.withSender(ADDRESS) - .shouldBeDeleted(enQueueItemForMail(FakeMail.builder() + .shouldBeDeleted(enqueuedItemForMail(FakeMail.builder() .name("name") .sender(ADDRESS) .build()))) @@ -151,7 +151,7 @@ class DeleteConditionTest { void withSenderShouldReturnFalseWhenDifferentAddress() throws Exception { assertThat( DeleteCondition.withSender(ADDRESS) - .shouldBeDeleted(enQueueItemForMail(FakeMail.builder() + .shouldBeDeleted(enqueuedItemForMail(FakeMail.builder() .name("name") .sender(ADDRESS_2) .recipient(ADDRESS) @@ -163,7 +163,7 @@ class DeleteConditionTest { void withSenderShouldNotThrowOnNullSender() throws Exception { assertThat( DeleteCondition.withSender(ADDRESS) - .shouldBeDeleted(enQueueItemForMail(FakeMail.builder() + .shouldBeDeleted(enqueuedItemForMail(FakeMail.builder() .name("name") .sender(MailAddress.nullSender()) .build()))) @@ -174,7 +174,7 @@ class DeleteConditionTest { void withSenderShouldAllowNullSenderMatchingNullSender() throws Exception { assertThat( DeleteCondition.withSender(MailAddress.NULL_SENDER_AS_STRING) - .shouldBeDeleted(enQueueItemForMail(FakeMail.builder() + .shouldBeDeleted(enqueuedItemForMail(FakeMail.builder() .name("name") .sender(MailAddress.nullSender()) .build()))) @@ -208,7 +208,7 @@ class DeleteConditionTest { void withNameShouldReturnTrueWhenSameName() throws Exception { assertThat( DeleteCondition.withName(NAME) - .shouldBeDeleted(enQueueItemForMail(FakeMail.builder() + .shouldBeDeleted(enqueuedItemForMail(FakeMail.builder() .name(NAME) .build()))) .isTrue(); @@ -218,7 +218,7 @@ class DeleteConditionTest { void withSenderShouldReturnFalseWhenDifferentAddress() throws Exception { assertThat( DeleteCondition.withName(NAME) - .shouldBeDeleted(enQueueItemForMail(FakeMail.builder() + .shouldBeDeleted(enqueuedItemForMail(FakeMail.builder() .name("other") .build()))) .isFalse(); @@ -251,7 +251,7 @@ class DeleteConditionTest { void withRecipientShouldReturnTrueWhenSameAddress() throws Exception { assertThat( DeleteCondition.withRecipient(ADDRESS) - .shouldBeDeleted(enQueueItemForMail(FakeMail.builder() + .shouldBeDeleted(enqueuedItemForMail(FakeMail.builder() .name("name") .recipient(ADDRESS) .build()))) @@ -262,7 +262,7 @@ class DeleteConditionTest { void withRecipientShouldReturnTrueWhenAtListOneMatches() throws Exception { assertThat( DeleteCondition.withRecipient(ADDRESS) - .shouldBeDeleted(enQueueItemForMail(FakeMail.builder() + .shouldBeDeleted(enqueuedItemForMail(FakeMail.builder() .name("name") .recipients(ADDRESS, ADDRESS_2) .build()))) @@ -273,7 +273,7 @@ class DeleteConditionTest { void withRecipientShouldReturnFalseWhenDifferentAddress() throws Exception { assertThat( DeleteCondition.withRecipient(ADDRESS) - .shouldBeDeleted(enQueueItemForMail(FakeMail.builder() + .shouldBeDeleted(enqueuedItemForMail(FakeMail.builder() .name("name") .sender(ADDRESS) .recipient(ADDRESS_2) @@ -285,7 +285,7 @@ class DeleteConditionTest { void withRecipientShouldReturnFalseWhenNoRecipient() throws Exception { assertThat( DeleteCondition.withRecipient(ADDRESS) - .shouldBeDeleted(enQueueItemForMail(FakeMail.builder() + .shouldBeDeleted(enqueuedItemForMail(FakeMail.builder() .name("name") .build()))) .isFalse(); @@ -318,9 +318,9 @@ class DeleteConditionTest { } } - private EnqueuedItem enQueueItemForMail(FakeMail mail) { + private EnqueuedItem enqueuedItemForMail(FakeMail mail) { return EnqueuedItem.builder() - .enQueueId(EN_QUEUE_ID_1) + .enqueueId(ENQUEUE_ID_1) .mailQueueName(OUT_GOING_1) .mail(mail) .enqueuedTime(ENQUEUE_TIME) diff --git a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/DeletedMailsDAOTest.java b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/DeletedMailsDAOTest.java index 73f0f27..98c918a 100644 --- a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/DeletedMailsDAOTest.java +++ b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/DeletedMailsDAOTest.java @@ -25,7 +25,7 @@ import org.apache.james.backends.cassandra.CassandraCluster; import org.apache.james.backends.cassandra.CassandraClusterExtension; import org.apache.james.backends.cassandra.components.CassandraModule; import org.apache.james.backends.cassandra.versions.CassandraSchemaVersionModule; -import org.apache.james.queue.rabbitmq.EnQueueId; +import org.apache.james.queue.rabbitmq.EnqueueId; import org.apache.james.queue.rabbitmq.MailQueueName; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -35,8 +35,8 @@ class DeletedMailsDAOTest { private static final MailQueueName OUT_GOING_1 = MailQueueName.fromString("OUT_GOING_1"); private static final MailQueueName OUT_GOING_2 = MailQueueName.fromString("OUT_GOING_2"); - private static final EnQueueId EN_QUEUE_ID_1 = EnQueueId.ofSerialized("110e8400-e29b-11d4-a716-446655440000"); - private static final EnQueueId EN_QUEUE_ID_2 = EnQueueId.ofSerialized("464765a0-e4e7-11e4-aba4-710c1de3782b"); + private static final EnqueueId ENQUEUE_ID_1 = EnqueueId.ofSerialized("110e8400-e29b-11d4-a716-446655440000"); + private static final EnqueueId ENQUEUE_ID_2 = EnqueueId.ofSerialized("464765a0-e4e7-11e4-aba4-710c1de3782b"); @RegisterExtension static CassandraClusterExtension cassandraCluster = new CassandraClusterExtension( @@ -54,14 +54,14 @@ class DeletedMailsDAOTest { @Test void markAsDeletedShouldWork() { Boolean isDeletedBeforeMark = testee - .isDeleted(OUT_GOING_1, EN_QUEUE_ID_1) + .isDeleted(OUT_GOING_1, ENQUEUE_ID_1) .block(); assertThat(isDeletedBeforeMark).isFalse(); - testee.markAsDeleted(OUT_GOING_1, EN_QUEUE_ID_1).block(); + testee.markAsDeleted(OUT_GOING_1, ENQUEUE_ID_1).block(); Boolean isDeletedAfterMark = testee - .isDeleted(OUT_GOING_1, EN_QUEUE_ID_1) + .isDeleted(OUT_GOING_1, ENQUEUE_ID_1) .block(); assertThat(isDeletedAfterMark).isTrue(); @@ -69,10 +69,10 @@ class DeletedMailsDAOTest { @Test void checkDeletedShouldReturnFalseWhenTableDoesntContainBothMailQueueAndMailKey() { - testee.markAsDeleted(OUT_GOING_2, EN_QUEUE_ID_2).block(); + testee.markAsDeleted(OUT_GOING_2, ENQUEUE_ID_2).block(); Boolean isDeleted = testee - .isDeleted(OUT_GOING_1, EN_QUEUE_ID_1) + .isDeleted(OUT_GOING_1, ENQUEUE_ID_1) .block(); assertThat(isDeleted).isFalse(); @@ -80,10 +80,10 @@ class DeletedMailsDAOTest { @Test void checkDeletedShouldReturnFalseWhenTableContainsMailQueueButNotMailKey() { - testee.markAsDeleted(OUT_GOING_1, EN_QUEUE_ID_2).block(); + testee.markAsDeleted(OUT_GOING_1, ENQUEUE_ID_2).block(); Boolean isDeleted = testee - .isDeleted(OUT_GOING_1, EN_QUEUE_ID_1) + .isDeleted(OUT_GOING_1, ENQUEUE_ID_1) .block(); assertThat(isDeleted).isFalse(); @@ -91,10 +91,10 @@ class DeletedMailsDAOTest { @Test void checkDeletedShouldReturnFalseWhenTableContainsMailKeyButNotMailQueue() { - testee.markAsDeleted(OUT_GOING_2, EN_QUEUE_ID_1).block(); + testee.markAsDeleted(OUT_GOING_2, ENQUEUE_ID_1).block(); Boolean isDeleted = testee - .isDeleted(OUT_GOING_1, EN_QUEUE_ID_1) + .isDeleted(OUT_GOING_1, ENQUEUE_ID_1) .block(); assertThat(isDeleted).isFalse(); @@ -102,10 +102,10 @@ class DeletedMailsDAOTest { @Test void checkDeletedShouldReturnTrueWhenTableContainsMailItem() { - testee.markAsDeleted(OUT_GOING_1, EN_QUEUE_ID_1).block(); + testee.markAsDeleted(OUT_GOING_1, ENQUEUE_ID_1).block(); Boolean isDeleted = testee - .isDeleted(OUT_GOING_1, EN_QUEUE_ID_1) + .isDeleted(OUT_GOING_1, ENQUEUE_ID_1) .block(); assertThat(isDeleted).isTrue(); diff --git a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/EnqueuedMailsDaoTest.java b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/EnqueuedMailsDaoTest.java index 7dce6e5..94145c5 100644 --- a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/EnqueuedMailsDaoTest.java +++ b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/EnqueuedMailsDaoTest.java @@ -30,7 +30,7 @@ import org.apache.james.backends.cassandra.CassandraClusterExtension; import org.apache.james.blob.api.BlobId; import org.apache.james.blob.api.HashBlobId; import org.apache.james.blob.mail.MimeMessagePartsId; -import org.apache.james.queue.rabbitmq.EnQueueId; +import org.apache.james.queue.rabbitmq.EnqueueId; import org.apache.james.queue.rabbitmq.EnqueuedItem; import org.apache.james.queue.rabbitmq.MailQueueName; import org.apache.james.queue.rabbitmq.view.cassandra.model.BucketedSlices.BucketId; @@ -44,7 +44,7 @@ import org.junit.jupiter.api.extension.RegisterExtension; class EnqueuedMailsDaoTest { private static final MailQueueName OUT_GOING_1 = MailQueueName.fromString("OUT_GOING_1"); - private static final EnQueueId EN_QUEUE_ID = EnQueueId.ofSerialized("110e8400-e29b-11d4-a716-446655440000"); + private static final EnqueueId ENQUEUE_ID = EnqueueId.ofSerialized("110e8400-e29b-11d4-a716-446655440000"); private static final String NAME = "name"; private static int BUCKET_ID_VALUE = 10; private static final BucketId BUCKET_ID = BucketId.of(BUCKET_ID_VALUE); @@ -76,7 +76,7 @@ class EnqueuedMailsDaoTest { void insertShouldWork() throws Exception { testee.insert(EnqueuedItemWithSlicingContext.builder() .enqueuedItem(EnqueuedItem.builder() - .enQueueId(EN_QUEUE_ID) + .enqueueId(ENQUEUE_ID) .mailQueueName(OUT_GOING_1) .mail(FakeMail.builder() .name(NAME) @@ -99,7 +99,7 @@ class EnqueuedMailsDaoTest { void selectEnqueuedMailsShouldWork() throws Exception { testee.insert(EnqueuedItemWithSlicingContext.builder() .enqueuedItem(EnqueuedItem.builder() - .enQueueId(EN_QUEUE_ID) + .enqueueId(ENQUEUE_ID) .mailQueueName(OUT_GOING_1) .mail(FakeMail.builder() .name(NAME) @@ -113,7 +113,7 @@ class EnqueuedMailsDaoTest { testee.insert(EnqueuedItemWithSlicingContext.builder() .enqueuedItem(EnqueuedItem.builder() - .enQueueId(EN_QUEUE_ID) + .enqueueId(ENQUEUE_ID) .mailQueueName(OUT_GOING_1) .mail(FakeMail.builder() .name(NAME) @@ -138,7 +138,7 @@ class EnqueuedMailsDaoTest { softly.assertThat(slicingContext.getTimeRangeStart()).isEqualTo(NOW); softly.assertThat(enqueuedItem.getMailQueueName()).isEqualTo(OUT_GOING_1); softly.assertThat(enqueuedItem.getEnqueuedTime()).isEqualTo(NOW); - softly.assertThat(enqueuedItem.getEnQueueId()).isEqualTo(EN_QUEUE_ID); + softly.assertThat(enqueuedItem.getEnqueueId()).isEqualTo(ENQUEUE_ID); softly.assertThat(enqueuedItem.getMail().getName()).isEqualTo(NAME); softly.assertThat(enqueuedItem.getPartsId()).isEqualTo(MIME_MESSAGE_PARTS_ID); }); diff --git a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/model/EnQueueIdTest.java b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/model/EnqueueIdTest.java similarity index 79% rename from server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/model/EnQueueIdTest.java rename to server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/model/EnqueueIdTest.java index 2f21c34..3ee99ad 100644 --- a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/model/EnQueueIdTest.java +++ b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/model/EnqueueIdTest.java @@ -23,39 +23,39 @@ import static org.assertj.core.api.Assertions.assertThat; import java.util.UUID; -import org.apache.james.queue.rabbitmq.EnQueueId; +import org.apache.james.queue.rabbitmq.EnqueueId; import org.junit.jupiter.api.Test; import nl.jqno.equalsverifier.EqualsVerifier; -class EnQueueIdTest { +class EnqueueIdTest { private static final UUID UUID_1 = UUID.fromString("110e8400-e29b-11d4-a716-446655440000"); @Test void shouldMatchBeanContract() { - EqualsVerifier.forClass(EnQueueId.class) + EqualsVerifier.forClass(EnqueueId.class) .verify(); } @Test void ofSerializedShouldDeserializeTheGivenEnqueueId() { - assertThat(EnQueueId.ofSerialized(UUID_1.toString())) - .isEqualTo(EnQueueId.of(UUID_1)); + assertThat(EnqueueId.ofSerialized(UUID_1.toString())) + .isEqualTo(EnqueueId.of(UUID_1)); } @Test void serializeShouldReturnAStringRepresentation() { - EnQueueId enQueueId = EnQueueId.of(UUID_1); + EnqueueId enqueueId = EnqueueId.of(UUID_1); - assertThat(enQueueId.serialize()) + assertThat(enqueueId.serialize()) .isEqualTo(UUID_1.toString()); } @Test void ofSerializedShouldRevertSerialize() { - EnQueueId enQueueId = EnQueueId.of(UUID_1); + EnqueueId enqueueId = EnqueueId.of(UUID_1); - assertThat(EnQueueId.ofSerialized(enQueueId.serialize())) - .isEqualTo(enQueueId); + assertThat(EnqueueId.ofSerialized(enqueueId.serialize())) + .isEqualTo(enqueueId); } } \ No newline at end of file diff --git a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/model/EnqueuedItemWithSlicingContextTest.java b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/model/EnqueuedItemWithSlicingContextTest.java index f1c2729..990ebe8 100644 --- a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/model/EnqueuedItemWithSlicingContextTest.java +++ b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/view/cassandra/model/EnqueuedItemWithSlicingContextTest.java @@ -27,7 +27,7 @@ import javax.mail.MessagingException; import org.apache.james.blob.api.HashBlobId; import org.apache.james.blob.mail.MimeMessagePartsId; -import org.apache.james.queue.rabbitmq.EnQueueId; +import org.apache.james.queue.rabbitmq.EnqueueId; import org.apache.james.queue.rabbitmq.EnqueuedItem; import org.apache.james.queue.rabbitmq.MailQueueName; import org.apache.mailet.base.test.FakeMail; @@ -42,7 +42,7 @@ class EnqueuedItemWithSlicingContextTest { private EnqueuedItemWithSlicingContextTest() throws MessagingException { enqueuedItem = EnqueuedItem.builder() - .enQueueId(EnQueueId.generate()) + .enqueueId(EnqueueId.generate()) .mailQueueName(MailQueueName.fromString("mailQueueName")) .mail(FakeMail.builder() .name("name") diff --git a/server/queue/queue-rabbitmq/src/test/resources/json/mail1.json b/server/queue/queue-rabbitmq/src/test/resources/json/mail1.json index 9bfbee0..04d40d2 100644 --- a/server/queue/queue-rabbitmq/src/test/resources/json/mail1.json +++ b/server/queue/queue-rabbitmq/src/test/resources/json/mail1.json @@ -1,5 +1,5 @@ { - "enQueueId": "110e8400-e29b-11d4-a716-446655440000", + "enqueueId": "110e8400-e29b-11d4-a716-446655440000", "recipients": [ "recipient1@localhost", "recipient2@localhost" diff --git a/server/queue/queue-rabbitmq/src/test/resources/json/mail_min.json b/server/queue/queue-rabbitmq/src/test/resources/json/mail_min.json index 21dcd7c..8f737c6 100644 --- a/server/queue/queue-rabbitmq/src/test/resources/json/mail_min.json +++ b/server/queue/queue-rabbitmq/src/test/resources/json/mail_min.json @@ -1,5 +1,5 @@ { - "enQueueId": "110e8400-e29b-11d4-a716-446655440000", + "enqueueId": "110e8400-e29b-11d4-a716-446655440000", "recipients":[], "name":"mail-name-558", "sender":null, --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
