1 22 package org.objectweb.petals.kernel.jmx; 23 24 import javax.management.remote.JMXConnectorServer ; 25 import javax.management.remote.JMXServiceURL ; 26 27 import junit.framework.TestCase; 28 29 import org.easymock.classextension.EasyMock; 30 import org.objectweb.petals.util.LoggingUtil; 31 32 37 public class StopJMXServerThreadTest extends TestCase { 38 39 public void testRun() throws Throwable { 40 LoggingUtil log = EasyMock.createMock(LoggingUtil.class); 41 JMXConnectorServer connectorServer = EasyMock 42 .createMock(JMXConnectorServer .class); 43 String sJmxURL = "service:jmx:rmi:///jndi/rmi://127.0.0.1:8081/management/rmi-jmx-connector"; 44 JMXServiceURL jmxUrl = new JMXServiceURL (sJmxURL); 45 StopJMXServerThread stopJMXServerThread = new StopJMXServerThread( 46 connectorServer, log); 47 48 log.debug("JMX server at " + sJmxURL + " stopped"); 49 connectorServer.stop(); 50 EasyMock.expect(connectorServer.getAddress()).andReturn(jmxUrl); 51 52 EasyMock.replay(log); 53 EasyMock.replay(connectorServer); 54 55 stopJMXServerThread.log = log; 56 57 stopJMXServerThread.run(); 58 } 59 } 60 | Popular Tags |