1 22 package org.jboss.test.jmx.test; 23 24 import org.jboss.test.JBossTestCase; 25 import org.jboss.test.jmx.invokerproxy.MyServiceMBean; 26 import org.jboss.test.jmx.invokerproxy.IProxy; 27 import junit.framework.Test; 28 29 import javax.naming.InitialContext ; 30 31 35 public class JMXInvokerProxyUnitTestCase 36 extends JBossTestCase 37 { 38 public JMXInvokerProxyUnitTestCase(String name) 39 { 40 super(name); 41 } 42 43 public static Test suite() 44 throws Exception 45 { 46 return getDeploySetup(JMXInvokerProxyUnitTestCase.class, "invoker-proxy-test.sar"); 47 } 48 49 public void testInvokeTargetMethod() throws Exception 50 { 51 InitialContext ic = new InitialContext (); 52 MyServiceMBean myService = (MyServiceMBean)ic.lookup("MyServiceInvokeTarget"); 53 final String arg = "myAction"; 54 String result = myService.myAction(arg); 55 assertEquals(arg, result); 56 } 57 58 public void testInvoke() throws Exception 59 { 60 InitialContext ic = new InitialContext (); 61 MyServiceMBean myService = (MyServiceMBean)ic.lookup("MyService"); 62 final String arg = "invoke"; 63 String result = myService.myAction(arg); 64 assertEquals(arg, result); 65 } 66 67 public void testProgramaticProxy() throws Exception 68 { 69 InitialContext ic = new InitialContext (); 70 IProxy myService = (IProxy) ic.lookup("IProxy"); 71 String result = myService.echoDate("testProgramaticProxy"); 72 assertTrue(result, result.indexOf("testProgramaticProxy") >= 0); 73 } 74 } 75 | Popular Tags |