1 22 package org.jboss.ejb3.test.servicedependency.unit; 23 24 import javax.management.MBeanServerConnection ; 25 import javax.management.ObjectName ; 26 import javax.naming.InitialContext ; 27 28 import org.jboss.ejb3.test.stateless.RunAsStateless; 29 import org.jboss.logging.Logger; 30 import org.jboss.test.JBossTestCase; 31 import junit.framework.Test; 32 33 import org.jboss.ejb3.test.servicedependency.Account; 34 35 39 public class ServiceUnitTestCase 40 extends JBossTestCase 41 { 42 private static final Logger log = Logger.getLogger(ServiceUnitTestCase.class); 43 44 public ServiceUnitTestCase(String name) 45 { 46 super(name); 47 } 48 49 public void testNoDependency() throws Exception 50 { 51 InitialContext jndiContext = new InitialContext (); 52 Account account = (Account) jndiContext.lookup("AccountBean/remote"); 53 assertNotNull(account); 54 55 account.debit("account", 1); 56 } 57 58 public void testDependency() throws Exception 59 { 60 MBeanServerConnection server = getServer(); 61 ObjectName testerName = new ObjectName ("acme:service=pinnumber"); 62 Object [] params = {}; 63 String [] sig = {}; 64 server.invoke(testerName, "createRandom", params, sig); 65 } 66 67 public static Test suite() throws Exception 68 { 69 return getDeploySetup(ServiceUnitTestCase.class, "servicedependency.jar"); 70 } 71 72 } 73 | Popular Tags |