Add missing license header and a tearDown method to ensure the created BrokerService gets stopped.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1200489 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2011-11-10 19:28:59 +00:00
parent 55e7216292
commit 77f9b87294
1 changed files with 24 additions and 0 deletions

View File

@ -1,3 +1,19 @@
/**
* 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.pool; package org.apache.activemq.pool;
import org.apache.activemq.*; import org.apache.activemq.*;
@ -22,6 +38,7 @@ public class PooledSessionExhaustionTest extends TestCase {
private String connectionUri; private String connectionUri;
private int numReceived = 0; private int numReceived = 0;
@Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
broker = new BrokerService(); broker = new BrokerService();
broker.setPersistent(false); broker.setPersistent(false);
@ -34,6 +51,13 @@ public class PooledSessionExhaustionTest extends TestCase {
pooledFactory.setBlockIfSessionPoolIsFull(false); pooledFactory.setBlockIfSessionPoolIsFull(false);
} }
@Override
protected void tearDown() throws Exception {
broker.stop();
broker.waitUntilStopped();
broker = null;
}
public void sendMessages(ConnectionFactory connectionFactory) throws Exception { public void sendMessages(ConnectionFactory connectionFactory) throws Exception {
for (int i = 0; i < NUM_MESSAGES; i++) { for (int i = 0; i < NUM_MESSAGES; i++) {
Connection connection = connectionFactory.createConnection(); Connection connection = connectionFactory.createConnection();