KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > broker > BrokerServiceTest


1 /**
2  *
3  * Copyright 2005-2006 The Apache Software Foundation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.activemq.broker;
18
19 import org.apache.activemq.network.NetworkConnector;
20
21 import junit.framework.TestCase;
22
23 /**
24  * Tests for the BrokerService class
25  * @author chirino
26  */

27 public class BrokerServiceTest extends TestCase {
28
29     public void testAddRemoveTransportsWithJMX() throws Exception JavaDoc {
30         BrokerService service = new BrokerService();
31         service.setUseJmx(true);
32         service.setPersistent(false);
33         TransportConnector connector = service.addConnector("tcp://localhost:0");
34         service.start();
35         
36         service.removeConnector(connector);
37         connector.stop();
38         service.stop();
39     }
40     
41     public void testAddRemoveTransportsWithoutJMX() throws Exception JavaDoc {
42         BrokerService service = new BrokerService();
43         service.setPersistent(false);
44         service.setUseJmx(false);
45         TransportConnector connector = service.addConnector("tcp://localhost:0");
46         service.start();
47         
48         service.removeConnector(connector);
49         connector.stop();
50         service.stop();
51     }
52     
53     public void testAddRemoveNetworkWithJMX() throws Exception JavaDoc {
54         BrokerService service = new BrokerService();
55         service.setPersistent(false);
56         service.setUseJmx(true);
57         NetworkConnector connector = service.addNetworkConnector("multicast://default");
58         service.start();
59         
60         service.removeNetworkConnector(connector);
61         connector.stop();
62         service.stop();
63     }
64     
65     public void testAddRemoveNetworkWithoutJMX() throws Exception JavaDoc {
66         BrokerService service = new BrokerService();
67         service.setPersistent(false);
68         service.setUseJmx(false);
69         NetworkConnector connector = service.addNetworkConnector("multicast://default");
70         service.start();
71         
72         service.removeNetworkConnector(connector);
73         connector.stop();
74         service.stop();
75     }
76 }
77
Popular Tags