1 22 package org.jboss.test.varia.deployment; 23 24 import javax.management.*; import junit.framework.Test; 25 import org.jboss.test.JBossTestCase; 26 27 33 public class BeanShellTestCase 34 extends JBossTestCase 35 { 36 37 38 public BeanShellTestCase (String name) 39 { 40 super(name); 41 } 42 43 public void testBasic() throws Exception 44 { 45 String file = "../resources/deployers/bsh/test.bsh"; 46 ObjectName on = new ObjectName("jboss.test:service=test.bsh"); 47 ObjectName dep = new ObjectName("jboss:name=SystemProperties,type=Service"); 48 deploy(file); 49 try 50 { 51 String c = Object .class.getName(); 52 Integer i = (Integer )invoke(on, "compare", 53 new Object [] { "x", "x" }, 54 new String [] { c, c }); 55 assertEquals(2, i.intValue()); 56 invoke(dep, "stop", null, null); 57 i = (Integer )invoke(on, "compare", 58 new Object [] { "x", "x" }, 59 new String [] { c, c }); 60 assertEquals(3, i.intValue()); 61 } 62 finally 63 { 64 undeploy(file); 65 invoke(dep, "start", new Object [0], new String [0]); 66 } 67 } 68 69 public void testFailing() throws Exception 70 { 71 String file = "../resources/deployers/bsh/test2.bsh"; 72 try 73 { 74 deploy(file); 75 fail("shouldn't have deployed"); 76 } 77 catch (Exception e) 78 { 79 getLog().debug(e, e); 80 } 81 finally 82 { 83 undeploy(file); 84 } 85 } 86 87 public void testSimple() throws Exception 88 { 89 String file = "../resources/deployers/bsh/test3.bsh"; 90 ObjectName on = new ObjectName("jboss.test:service=test3.bsh"); 91 deploy(file); 92 try 93 { 94 assertTrue("registered", getServer().isRegistered(on)); 95 } 96 finally 97 { 98 undeploy(file); 99 } 100 } 101 102 } 103 | Popular Tags |