Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 66852749D for ; Tue, 18 Oct 2011 18:48:06 +0000 (UTC) Received: (qmail 63303 invoked by uid 500); 18 Oct 2011 18:48:06 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 63263 invoked by uid 500); 18 Oct 2011 18:48:06 -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 63253 invoked by uid 99); 18 Oct 2011 18:48:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Oct 2011 18:48:06 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.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; Tue, 18 Oct 2011 18:48:04 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id A4685238888F for ; Tue, 18 Oct 2011 18:47:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1185792 - /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2200Test.java Date: Tue, 18 Oct 2011 18:47:44 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111018184744.A4685238888F@eris.apache.org> Author: tabish Date: Tue Oct 18 18:47:44 2011 New Revision: 1185792 URL: http://svn.apache.org/viewvc?rev=1185792&view=rev Log: test for: https://issues.apache.org/jira/browse/AMQ-2200 Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2200Test.java (with props) Added: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2200Test.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2200Test.java?rev=1185792&view=auto ============================================================================== --- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2200Test.java (added) +++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2200Test.java Tue Oct 18 18:47:44 2011 @@ -0,0 +1,100 @@ +/** + * 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 static org.junit.Assert.*; +import java.io.File; +import java.util.concurrent.TimeUnit; + +import javax.jms.MessageConsumer; +import javax.jms.Session; +import javax.jms.Topic; +import javax.jms.TopicConnection; +import javax.jms.TopicSession; +import javax.management.ObjectName; + +import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.broker.jmx.TopicSubscriptionViewMBean; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class AMQ2200Test { + + private static final String bindAddress = "tcp://0.0.0.0:0"; + private BrokerService broker; + private ActiveMQConnectionFactory cf; + + @Before + public void setUp() throws Exception { + broker = new BrokerService(); + broker.setDataDirectory("target" + File.separator + "activemq-data"); + broker.setPersistent(true); + broker.setUseJmx(true); + broker.setAdvisorySupport(false); + broker.setDeleteAllMessagesOnStartup(true); + broker.addConnector(bindAddress); + String address = broker.getTransportConnectors().get(0).getPublishableConnectString(); + broker.start(); + broker.waitUntilStarted(); + + cf = new ActiveMQConnectionFactory(address); + } + + @After + public void tearDown() throws Exception { + if (broker != null) { + broker.stop(); + broker.waitUntilStopped(); + } + } + + @Test + public void testTopicSubscriptionView() throws Exception { + TopicConnection connection = cf.createTopicConnection(); + TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE); + + Topic destination = session.createTopic("TopicViewTestTopic"); + MessageConsumer consumer = session.createConsumer(destination); + assertNotNull(consumer); + TimeUnit.SECONDS.sleep(1); + + ObjectName subscriptionNames[] = broker.getAdminView().getTopicSubscribers(); + assertTrue(subscriptionNames.length > 0); + + boolean fail = true; + for(ObjectName name : subscriptionNames) { + if (name.toString().contains("TopicViewTestTopic")) { + TopicSubscriptionViewMBean sub = (TopicSubscriptionViewMBean) + broker.getManagementContext().newProxyInstance(name, TopicSubscriptionViewMBean.class, true); + assertNotNull(sub); + assertTrue(sub.getSessionId() != -1); + // Check that its the default value then configure something new. + assertTrue(sub.getMaximumPendingQueueSize() == -1); + sub.setMaximumPendingQueueSize(1000); + assertTrue(sub.getMaximumPendingQueueSize() != -1); + fail = false; + } + } + + if (fail) { + fail("Didn't find the TopicSubscriptionView"); + } + } + +} Propchange: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/bugs/AMQ2200Test.java ------------------------------------------------------------------------------ svn:eol-style = native