1   /*
2    * $Id: DefaultJmxSupportAgentTestCase.java 7976 2007-08-21 14:26:13Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.management.agents;
12  
13  import org.mule.tck.AbstractMuleTestCase;
14  
15  import java.util.Map;
16  
17  import javax.management.remote.rmi.RMIConnectorServer;
18  
19  public class DefaultJmxSupportAgentTestCase extends AbstractMuleTestCase
20  {
21      public void testHostPropertyEnablesClientSocketFactory () throws Exception
22      {
23          DefaultJmxSupportAgent agent = new DefaultJmxSupportAgent();
24          agent.setHost("127.0.0.1");
25          JmxAgent jmxAgent = agent.createJmxAgent();
26          Map props = jmxAgent.getConnectorServerProperties();
27          assertNotNull(props);
28          assertEquals("JMX ConnectorServer properties should've been merged",
29                       2, props.size());
30          assertTrue("Property shouldn't have been removed",
31                     props.containsKey(RMIConnectorServer.JNDI_REBIND_ATTRIBUTE));
32          assertTrue("Property should've been added",
33                     props.containsKey(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE));
34          Object ref = props.get(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE);
35          assertNotNull(ref);
36          assertTrue(ref instanceof FixedHostRmiClientSocketFactory);
37      }
38  }