01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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: */package org.apache.geronimo.clustering.wadi;
17:
18: import javax.management.MBeanServer;
19:
20: import org.apache.geronimo.clustering.LocalNode;
21: import org.apache.geronimo.jmxremoting.JMXConnector;
22:
23: import com.agical.rmock.extension.junit.RMockTestCase;
24:
25: /**
26: *
27: * @version $Rev$ $Date$
28: */
29: public class BasicNodeServiceTest extends RMockTestCase {
30:
31: public void testGetConnectionInfo() throws Exception {
32: LocalNode localNode = (LocalNode) mock(LocalNode.class);
33: localNode.getJMXConnectorInfo();
34:
35: JMXConnector connector = new JMXConnector((MBeanServer) null,
36: "name", null);
37: String host = "host";
38: connector.setHost(host);
39: int port = 1;
40: connector.setPort(port);
41: modify().returnValue(connector);
42:
43: startVerification();
44:
45: BasicNodeService nodeService = new BasicNodeService(localNode);
46: NodeConnectionInfo connectionInfo = nodeService
47: .getConnectionInfo();
48: assertEquals(host, connectionInfo.getHost());
49: assertEquals(port, connectionInfo.getPort());
50: }
51:
52: }
|