You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by tabish121 <gi...@git.apache.org> on 2016/10/07 16:10:35 UTC

[GitHub] activemq-artemis pull request #824: ARTEMIS-775 Tests for AMQP credit handli...

GitHub user tabish121 opened a pull request:

    https://github.com/apache/activemq-artemis/pull/824

    ARTEMIS-775 Tests for AMQP credit handling

    Some new tests that cover some AMQP credit handling scenarios.  Test
    case 'testCloseBusyReceiver' currently fails due to being dispatched a
    duplicate message.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/tabish121/activemq-artemis ARTEMIS-775

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/activemq-artemis/pull/824.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #824
    
----
commit 3cb18ff9633b686b2f9cd81133491aa82538dbe0
Author: Timothy Bish <ta...@gmail.com>
Date:   2016-10-07T16:09:28Z

    ARTEMIS-775 Tests for AMQP credit handling
    
    Some new tests that cover some AMQP credit handling scenarios.  Test
    case 'testCloseBusyReceiver' currently fails due to being dispatched a
    duplicate message.

----


---
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.
---

[GitHub] activemq-artemis pull request #824: ARTEMIS-775 Tests for AMQP credit handli...

Posted by clebertsuconic <gi...@git.apache.org>.
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.
---

[GitHub] activemq-artemis pull request #824: ARTEMIS-775 Tests for AMQP credit handli...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/activemq-artemis/pull/824


---
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.
---

[GitHub] activemq-artemis pull request #824: ARTEMIS-775 Tests for AMQP credit handli...

Posted by clebertsuconic <gi...@git.apache.org>.
Github user clebertsuconic commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/824#discussion_r82449213
  
    --- 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 --
    
    The connection.close here will leak a thread if your test failed..
    
    I changed some of these on your other commit, this connection.close() should be on a finally block. I think that should be the same on AMQ5 code as well.



---
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.
---

[GitHub] activemq-artemis pull request #824: ARTEMIS-775 Tests for AMQP credit handli...

Posted by clebertsuconic <gi...@git.apache.org>.
Github user clebertsuconic commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/824#discussion_r82481427
  
    --- 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 --
    
    I didn't realize you had addConnection.. sorry about that


---
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.
---