1 15 package org.apache.hivemind.management; 16 17 import java.io.InputStream ; 18 import java.net.HttpURLConnection ; 19 import java.net.URL ; 20 21 import javax.management.remote.JMXConnectorServerMBean ; 22 23 import mx4j.tools.adaptor.http.HttpAdaptorMBean; 24 25 import org.apache.hivemind.Registry; 26 import org.apache.hivemind.xml.XmlTestCase; 27 28 34 public class TestConnectors extends XmlTestCase 35 { 36 39 public void testMx4jHttpAdaptor() throws Exception 40 { 41 Registry registry = buildFrameworkRegistry("testConnectors.xml"); 42 Object service = registry.getService(HttpAdaptorMBean.class); 43 assertNotNull(service); 44 45 URL url = new URL ("http://localhost:9000"); 47 HttpURLConnection connection = (HttpURLConnection ) url.openConnection(); 48 connection.setDoOutput(true); 49 connection.connect(); 50 InputStream inputStream = connection.getInputStream(); 51 assertTrue(inputStream.read() != 0); 52 53 registry.shutdown(); 54 } 55 56 public void testJsr160Connector() throws Exception 57 { 58 Registry registry = buildFrameworkRegistry("testConnectors.xml"); 59 Object service = registry.getService(JMXConnectorServerMBean .class); 60 assertNotNull(service); 61 } 62 63 } | Popular Tags |