[
https://issues.apache.org/jira/browse/JAMES-2295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16547875#comment-16547875
]
ASF GitHub Bot commented on JAMES-2295:
---------------------------------------
Github user nstdio commented on a diff in the pull request:
https://github.com/apache/james-project/pull/127#discussion_r203388643
--- Diff:
server/queue/queue-activemq/src/test/java/org/apache/james/queue/activemq/ActiveMQConsumerOptionsTest.java
---
@@ -0,0 +1,85 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.queue.activemq;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+class ActiveMQConsumerOptionsTest {
+ private String queueName;
+
+ @BeforeEach
+ void setUp() {
+ // append schema to use URL assertions.
+ queueName = "http://test_queue";
+ }
+
+ @Test
+ void emptyConsumerOptionsShouldNotHaveAnQuery() throws
MalformedURLException {
+ ActiveMQConsumerOptions options =
ActiveMQConsumerOptions.builder().build();
+
+ assertThat(new URL(options.applyForDequeue(queueName)))
+ .hasNoQuery();
+ }
+
+ @Test
+ void consumerOptionsWithAllOptionsShouldHaveAllParameters() throws
MalformedURLException {
+ ActiveMQConsumerOptions options = ActiveMQConsumerOptions.builder()
+ .prefetchSize(100)
+ .dispatchAsync(true)
+ .maximumPendingMessageLimit(10)
+ .exclusive(true)
+ .noLocal(false)
+ .retroactive(false)
+ .selector("selector")
+ .priority(512)
+ .build();
+
+ assertThat(new URL(options.applyForDequeue(queueName)))
+ .hasParameter(ActiveMQSupport.CONSUMER_PREFETCH_SIZE,
"100")
+ .hasParameter(ActiveMQSupport.CONSUMER_DISPATCH_ASYNC,
"true")
+
.hasParameter(ActiveMQSupport.CONSUMER_MAXIMUM_PENDING_MESSAGE_LIMIT, "10")
+ .hasParameter(ActiveMQSupport.CONSUMER_EXCLUSIVE, "true")
+ .hasParameter(ActiveMQSupport.CONSUMER_NO_LOCAL, "false")
+ .hasParameter(ActiveMQSupport.CONSUMER_RETROACTIVE,
"false")
+ .hasParameter(ActiveMQSupport.CONSUMER_SELECTOR,
"selector")
+ .hasParameter(ActiveMQSupport.CONSUMER_PRIORITY, "512");
+ }
+
+ @Test
+ void consumerOptionsWithSomeOptionsMissingShouldNotBeIncluded() throws
MalformedURLException {
+ ActiveMQConsumerOptions options =
ActiveMQConsumerOptions.builder().priority(-1).build();
+
+ assertThat(new URL(options.applyForDequeue(queueName)))
+ .hasQuery(ActiveMQSupport.CONSUMER_PRIORITY + "=-1");
+ }
+
+ @Test
+ void consumerOptionsShouldReturnArgWhenNoOptionsAreGiven() {
+ ActiveMQConsumerOptions options =
ActiveMQConsumerOptions.builder().build();
+
+ assertThat(options.applyForDequeue(queueName)).isSameAs(queueName);
--- End diff --
This is not relevant code anymore :)
> JMS mailqueue deadlock when a single thread issue several consume
> -----------------------------------------------------------------
>
> Key: JAMES-2295
> URL: https://issues.apache.org/jira/browse/JAMES-2295
> Project: James Server
> Issue Type: Bug
> Components: Queue
> Affects Versions: 3.0.0, master, 3.0.1
> Reporter: Tellier Benoit
> Priority: Major
> Labels: bug
>
> This will lead to a dead lock:
> {code:java}
> MailQueue.MailQueueItem mailQueueItem1 = getMailQueue().deQueue();
> MailQueue.MailQueueItem mailQueueItem2 = getMailQueue().deQueue();
> mailQueueItem1.done(true);
> mailQueueItem2.done(true);
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]