activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuconic <...@git.apache.org>
Subject [GitHub] activemq-artemis pull request #824: ARTEMIS-775 Tests for AMQP credit handli...
Date Fri, 07 Oct 2016 18:53:53 GMT
Github user clebertsuconic commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/824#discussion_r82449383
  
    --- Diff: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/AmqpSendReceiveTest.java
---
    @@ -0,0 +1,557 @@
    +/*
    + * 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.activemq.artemis.tests.integration.amqp;
    +
    +import java.util.ArrayList;
    +import java.util.LinkedList;
    +import java.util.List;
    +import java.util.concurrent.CountDownLatch;
    +import java.util.concurrent.ExecutorService;
    +import java.util.concurrent.Executors;
    +import java.util.concurrent.TimeUnit;
    +
    +import org.apache.activemq.artemis.core.server.Queue;
    +import org.apache.activemq.artemis.tests.integration.mqtt.imported.util.Wait;
    +import org.apache.activemq.transport.amqp.client.AmqpClient;
    +import org.apache.activemq.transport.amqp.client.AmqpConnection;
    +import org.apache.activemq.transport.amqp.client.AmqpMessage;
    +import org.apache.activemq.transport.amqp.client.AmqpReceiver;
    +import org.apache.activemq.transport.amqp.client.AmqpSender;
    +import org.apache.activemq.transport.amqp.client.AmqpSession;
    +import org.junit.Test;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +/**
    + * Test basic send and receive scenarios using only AMQP sender and receiver links.
    + */
    +public class AmqpSendReceiveTest extends AmqpClientTestSupport {
    +
    +   protected static final Logger LOG = LoggerFactory.getLogger(AmqpSendReceiveTest.class);
    +
    +   @Test(timeout = 60000)
    +   public void testSimpleSendOneReceiveOne() throws Exception {
    +
    +      AmqpClient client = createAmqpClient();
    +      AmqpConnection connection = addConnection(client.connect());
    +      AmqpSession session = connection.createSession();
    +
    +      AmqpSender sender = session.createSender(getTestName());
    +
    +      AmqpMessage message = new AmqpMessage();
    +
    +      message.setMessageId("msg" + 1);
    +      message.setMessageAnnotation("serialNo", 1);
    +      message.setText("Test-Message");
    +
    +      sender.send(message);
    +      sender.close();
    +
    +      LOG.info("Attempting to read message with receiver");
    +      AmqpReceiver receiver = session.createReceiver(getTestName());
    +      receiver.flow(2);
    +      AmqpMessage received = receiver.receive(10, TimeUnit.SECONDS);
    +      assertNotNull("Should have read message", received);
    +      assertEquals("msg1", received.getMessageId());
    +      received.accept();
    +
    +      receiver.close();
    +
    +      connection.close();
    --- End diff --
    
    This is because we have the ThreadLeakCheckRule on most of our tests. Some times we had
test failures from one test into the other. Making sure there are no leaks improves reliability
of the testsuite.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message