Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 24592 invoked from network); 14 Jan 2010 14:05:15 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 14 Jan 2010 14:05:15 -0000 Received: (qmail 67882 invoked by uid 500); 14 Jan 2010 14:05:15 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 67826 invoked by uid 500); 14 Jan 2010 14:05:15 -0000 Mailing-List: contact commits-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 commits@activemq.apache.org Received: (qmail 67816 invoked by uid 99); 14 Jan 2010 14:05:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jan 2010 14:05:15 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jan 2010 14:05:14 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 1F564238890A; Thu, 14 Jan 2010 14:04:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r899205 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/JMSDurableTopicNoLocalTest.java Date: Thu, 14 Jan 2010 14:04:54 -0000 To: commits@activemq.apache.org From: rajdavies@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100114140454.1F564238890A@eris.apache.org> Author: rajdavies Date: Thu Jan 14 14:04:53 2010 New Revision: 899205 URL: http://svn.apache.org/viewvc?rev=899205&view=rev Log: Added test case for https://issues.apache.org/activemq/browse/AMQ-2561 Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/JMSDurableTopicNoLocalTest.java (with props) Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/JMSDurableTopicNoLocalTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/JMSDurableTopicNoLocalTest.java?rev=899205&view=auto ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/JMSDurableTopicNoLocalTest.java (added) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/JMSDurableTopicNoLocalTest.java Thu Jan 14 14:04:53 2010 @@ -0,0 +1,83 @@ +/** + * 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.bugs; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import javax.jms.Connection; +import javax.jms.Message; +import javax.jms.MessageListener; +import javax.jms.MessageProducer; +import javax.jms.Session; +import javax.jms.TextMessage; +import javax.jms.Topic; +import javax.jms.TopicSubscriber; +import org.apache.activemq.EmbeddedBrokerTestSupport; +import org.apache.activemq.broker.BrokerService; + +/** + * @version $Revision: 1.4 $ + */ +public class JMSDurableTopicNoLocalTest extends EmbeddedBrokerTestSupport { + protected String bindAddress; + + public void testConsumeNoLocal() throws Exception { + final String TEST_NAME = getClass().getName(); + Connection connection = createConnection(); + connection.setClientID(TEST_NAME); + + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + + TopicSubscriber subscriber = session.createDurableSubscriber((Topic) destination, "topicUser2", null, true); + + + final CountDownLatch latch = new CountDownLatch(1); + subscriber.setMessageListener(new MessageListener() { + public void onMessage(Message message) { + System.out.println("Receive a message " + message); + latch.countDown(); + } + }); + + connection.start(); + + MessageProducer producer = session.createProducer(destination); + TextMessage message = session.createTextMessage("THIS IS A TEST"); + producer.send(message); + producer.close(); + latch.await(5,TimeUnit.SECONDS); + assertEquals(latch.getCount(),1); + } + + @Override + protected void setUp() throws Exception { + bindAddress = "vm://localhost"; + useTopic=true; + super.setUp(); + } + + @Override + protected BrokerService createBroker() throws Exception { + BrokerService answer = new BrokerService(); + answer.setUseJmx(false); + answer.setPersistent(true); + answer.setDeleteAllMessagesOnStartup(true); + answer.addConnector(bindAddress); + return answer; + } + +} Propchange: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/JMSDurableTopicNoLocalTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/JMSDurableTopicNoLocalTest.java ------------------------------------------------------------------------------ svn:mime-type = text/plain