Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 56E65200D2B for ; Thu, 2 Nov 2017 13:58:21 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 55798160BE5; Thu, 2 Nov 2017 12:58:21 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9CF991609EE for ; Thu, 2 Nov 2017 13:58:20 +0100 (CET) Received: (qmail 18643 invoked by uid 500); 2 Nov 2017 12:58:19 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 18629 invoked by uid 99); 2 Nov 2017 12:58:19 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Nov 2017 12:58:19 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 49472DFC32; Thu, 2 Nov 2017 12:58:19 +0000 (UTC) From: clebertsuconic To: dev@activemq.apache.org Reply-To: dev@activemq.apache.org References: In-Reply-To: Subject: [GitHub] activemq-artemis pull request #1629: ARTEMIS-1486 Core client should be noti... Content-Type: text/plain Message-Id: <20171102125819.49472DFC32@git1-us-west.apache.org> Date: Thu, 2 Nov 2017 12:58:19 +0000 (UTC) archived-at: Thu, 02 Nov 2017 12:58:21 -0000 Github user clebertsuconic commented on a diff in the pull request: https://github.com/apache/activemq-artemis/pull/1629#discussion_r148523746 --- Diff: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java --- @@ -1978,6 +1980,36 @@ public void testConnectorServiceManagement() throws Exception { Assert.assertEquals("myconn2", managementControl.getConnectorServices()[0]); } + @Test + public void testCloseConsumer() throws Exception { + SimpleString address = RandomUtil.randomSimpleString(); + SimpleString name = RandomUtil.randomSimpleString(); + boolean durable = true; + + ActiveMQServerControl serverControl = createManagementControl(); + + checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name, RoutingType.ANYCAST)); + serverControl.createAddress(address.toString(), "ANYCAST"); + serverControl.createQueue(address.toString(), "ANYCAST", name.toString(), null, durable, -1, false, false); + + ServerLocator receiveLocator = createInVMNonHALocator(); + ClientSessionFactory receiveCsf = createSessionFactory(receiveLocator); + ClientSession receiveClientSession = receiveCsf.createSession(true, false, false); + final ClientConsumer consumer = receiveClientSession.createConsumer(name); + final ClientProducer producer = receiveClientSession.createProducer(name); + + ServerSession ss = server.getSessions().iterator().next(); + ServerConsumer sc = ss.getServerConsumers().iterator().next(); + + producer.send(receiveClientSession.createMessage(true)); + consumer.receive(1000); + + Assert.assertFalse(consumer.isClosed()); + serverControl.closeConsumerWithID(((ClientSessionImpl)receiveClientSession).getName(), Long.toString(sc.sequentialID())); + Wait.waitFor(() -> consumer.isClosed(), 1000, 100); --- End diff -- With my pull request on Wait, you would been able to do Wait.assertTrue(consumer::isClosed) ---