From commits-return-8159-apmail-activemq-commits-archive=activemq.apache.org@activemq.apache.org Thu Mar 06 14:40:40 2008 Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 78018 invoked from network); 6 Mar 2008 14:40:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Mar 2008 14:40:39 -0000 Received: (qmail 23973 invoked by uid 500); 6 Mar 2008 14:40:36 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 23952 invoked by uid 500); 6 Mar 2008 14:40:36 -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 23943 invoked by uid 99); 6 Mar 2008 14:40:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Mar 2008 06:40:36 -0800 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.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Mar 2008 14:39:55 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id EE4E31A9832; Thu, 6 Mar 2008 06:40:15 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r634281 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/advisory/DestinationSource.java test/java/org/apache/activemq/advisory/DestinationListenerTest.java Date: Thu, 06 Mar 2008 14:40:15 -0000 To: commits@activemq.apache.org From: jstrachan@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080306144015.EE4E31A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jstrachan Date: Thu Mar 6 06:40:14 2008 New Revision: 634281 URL: http://svn.apache.org/viewvc?rev=634281&view=rev Log: updated the test case for http://issues.apache.org/activemq/browse/AMQ-1199 to make it a better test Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/advisory/DestinationSource.java activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/DestinationListenerTest.java Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/advisory/DestinationSource.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/advisory/DestinationSource.java?rev=634281&r1=634280&r2=634281&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/advisory/DestinationSource.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/advisory/DestinationSource.java Thu Mar 6 06:40:14 2008 @@ -67,7 +67,7 @@ return listener; } - public void setConsumerListener(DestinationListener listener) { + public void setDestinationListener(DestinationListener listener) { this.listener = listener; } Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/DestinationListenerTest.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/DestinationListenerTest.java?rev=634281&r1=634280&r2=634281&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/DestinationListenerTest.java (original) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/advisory/DestinationListenerTest.java Thu Mar 6 06:40:14 2008 @@ -16,6 +16,8 @@ */ package org.apache.activemq.advisory; +import java.util.Set; + import org.apache.activemq.ActiveMQConnection; import org.apache.activemq.EmbeddedBrokerTestSupport; import org.apache.activemq.broker.BrokerService; @@ -29,23 +31,36 @@ * @version $Revision$ */ public class DestinationListenerTest extends EmbeddedBrokerTestSupport implements DestinationListener { - private static final Log LOG = LogFactory.getLog(DestinationListenerTest.class); + private static final transient Log LOG = LogFactory.getLog(DestinationListenerTest.class); + protected ActiveMQConnection connection; - protected DestinationSource destinationSource; + protected ActiveMQQueue sampleQueue = new ActiveMQQueue("foo.bar"); + protected ActiveMQTopic sampleTopic = new ActiveMQTopic("cheese"); public void testDestiationSource() throws Exception { Thread.sleep(1000); - System.out.println("Queues: " + destinationSource.getQueues()); - System.out.println("Topics: " + destinationSource.getTopics()); + + DestinationSource destinationSource = connection.getDestinationSource(); + Set queues = destinationSource.getQueues(); + Set topics = destinationSource.getTopics(); + + LOG.info("Queues: " + queues); + LOG.info("Topics: " + topics); + + assertTrue("The queues should not be empty!", !queues.isEmpty()); + assertTrue("The topics should not be empty!", !topics.isEmpty()); + + assertTrue("queues contains initial queue: " + queues, queues.contains(sampleQueue)); + assertTrue("topics contains initial topic: " + queues, topics.contains(sampleTopic)); } public void onDestinationEvent(DestinationEvent event) { ActiveMQDestination destination = event.getDestination(); if (event.isAddOperation()) { - System.out.println("Added: " + destination); + LOG.info("Added: " + destination); } else { - System.out.println("Removed: " + destination); + LOG.info("Removed: " + destination); } } @@ -54,16 +69,15 @@ connection = (ActiveMQConnection) createConnection(); connection.start(); - - destinationSource = connection.getDestinationSource(); + connection.getDestinationSource().setDestinationListener(this); } @Override protected BrokerService createBroker() throws Exception { BrokerService broker = super.createBroker(); broker.setDestinations(new ActiveMQDestination[]{ - new ActiveMQQueue("foo.bar"), - new ActiveMQTopic("cheese") + sampleQueue, + sampleTopic }); return broker; }