You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2017/09/07 12:34:45 UTC
qpid-broker-j git commit: NO-JIRA: [Java System Tests] Remove
redundant (and racey) test
Repository: qpid-broker-j
Updated Branches:
refs/heads/master e15fbd93e -> 09ef11365
NO-JIRA: [Java System Tests] Remove redundant (and racey) test
Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/09ef1136
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/09ef1136
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/09ef1136
Branch: refs/heads/master
Commit: 09ef11365a5fbf56886756d85810d1d1d62a94fc
Parents: e15fbd9
Author: Keith Wall <kw...@apache.org>
Authored: Thu Sep 7 13:33:15 2017 +0100
Committer: Keith Wall <kw...@apache.org>
Committed: Thu Sep 7 13:34:06 2017 +0100
----------------------------------------------------------------------
.../client/AMQQueueDeferredOrderingTest.java | 164 -------------------
1 file changed, 164 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/09ef1136/systests/src/test/java/org/apache/qpid/client/AMQQueueDeferredOrderingTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/client/AMQQueueDeferredOrderingTest.java b/systests/src/test/java/org/apache/qpid/client/AMQQueueDeferredOrderingTest.java
deleted file mode 100644
index 8d0d0da..0000000
--- a/systests/src/test/java/org/apache/qpid/client/AMQQueueDeferredOrderingTest.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- *
- * 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.qpid.client;
-
-import java.util.Collections;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.qpid.test.utils.QpidBrokerTestCase;
-
-public class AMQQueueDeferredOrderingTest extends QpidBrokerTestCase
-{
- private static final Logger _logger = LoggerFactory.getLogger(AMQQueueDeferredOrderingTest.class);
- private Connection _con;
- private Queue _queue;
- private MessageConsumer consumer;
- private int _numMessages;
- private ExecutorService _executor;
- private volatile boolean _shutdownThreads;
-
- private class ASyncProducer implements Callable<Exception>
- {
- private MessageProducer producer;
- private final Logger _logger = LoggerFactory.getLogger(ASyncProducer.class);
- private Session session;
- private int start;
- private int end;
-
- ASyncProducer(Queue q, int start, int end) throws JMSException
- {
- this.session = _con.createSession(true, Session.SESSION_TRANSACTED);
- this._logger.info("Create Consumer of Q1");
- this.producer = this.session.createProducer(q);
- this.start = start;
- this.end = end;
- }
-
- @Override
- public Exception call()
- {
- try
- {
- this._logger.info("Starting to send messages");
- for (int i = start; i < end && !_shutdownThreads; i++)
- {
- producer.send(session.createTextMessage(Integer.toString(i)));
- session.commit();
- }
- this._logger.info("Sent " + (end - start) + " messages");
- }
- catch (Exception e)
- {
- return e;
- }
- return null;
- }
- }
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- _numMessages = isBrokerStorePersistent() ? 300 : 1000;
-
- _logger.info("Create Connection");
- _con = getConnectionWithOptions(isBroker10()? Collections.singletonMap("amqp.traceFrames", "true") : Collections.emptyMap());
- _logger.info("Create Session");
- final Session session = _con.createSession(false, Session.AUTO_ACKNOWLEDGE);
- _logger.info("Create Q");
- _queue = createTestQueue(session);
- _logger.info("Create Consumer of Q");
- consumer = session.createConsumer(_queue);
- _logger.info("Start Connection");
- _con.start();
- _executor = Executors.newSingleThreadExecutor();
- }
-
- public void testMessagesSentByTwoThreadsAreDeliveredInOrder() throws Exception
- {
- Future<Exception> f;
- Exception publisherException;
-
- // Setup initial messages
- _logger.info("Creating first producer thread");
- f = _executor.submit(new ASyncProducer(_queue, 0, _numMessages / 2));
- publisherException = f.get(1, TimeUnit.MINUTES);
- assertNull("Publishing first batch failed: " + publisherException, publisherException);
-
- // Setup second set of messages to produce while we consume
- _logger.info("Creating second producer thread");
- f = _executor.submit(new ASyncProducer(_queue, _numMessages / 2, _numMessages));
-
- // Start consuming and checking they're in order
- _logger.info("Consuming messages");
- for (int i = 0; i < _numMessages; i++)
- {
- Message msg = consumer.receive(getReceiveTimeout());
-
- assertNotNull("Message " + i + " should not be null", msg);
- assertTrue("Message " + i + " should be a text message", msg instanceof TextMessage);
- assertEquals("Message content " + i + " does not match expected", Integer.toString(i), ((TextMessage) msg).getText());
- }
- publisherException = f.get(10, TimeUnit.SECONDS);
- assertNull("Publishing second batch failed: " + publisherException, publisherException);
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- try
- {
- _logger.info("Interrupting producer thread");
- _shutdownThreads = true;
- _executor.shutdown();
- assertTrue("Executor service failed to shutdown", _executor.awaitTermination(1, TimeUnit.MINUTES));
- }
- finally
- {
- try
- {
- _logger.info("Closing connection");
- _con.close();
- }
- finally
- {
- super.tearDown();
- }
- }
- }
-}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org