1 22 package org.jboss.test.jmx.test; 23 24 import javax.management.ObjectName ; 25 26 import org.jboss.mx.util.ObjectNameFactory; 27 import org.jboss.system.ServiceMBean; 28 29 import junit.framework.Test; 30 31 37 public class JBAS3050URLDeploymentScannerUnitTestCase extends AbstractURLDeploymentScannerTest 38 { 39 ObjectName test = ObjectNameFactory.create("test:name=PauseInStart"); 40 41 protected class DeployInBackground implements Runnable 42 { 43 Throwable background; 44 45 String fileName; 46 47 public DeployInBackground(String fileName) 48 { 49 this.fileName = fileName; 50 } 51 52 public void run() 53 { 54 try 55 { 56 hotDeploy(fileName, 2000); 57 } 58 catch (Throwable t) 59 { 60 background = t; 61 } 62 } 63 } 64 65 public void testDeadlock() throws Exception 66 { 67 DeployInBackground background = new DeployInBackground("pauseinstart.sar"); 68 Thread thread = new Thread (background); 69 thread.start(); 70 try 71 { 72 Thread.sleep(4000); 73 stopScanner(); 74 assertEquals(new Integer (ServiceMBean.STARTED), getServer().getAttribute(test, "State")); 75 hotDeploy("pauseinstart.sar"); 76 startScanner(); 77 assertEquals(new Integer (ServiceMBean.STARTED), getServer().getAttribute(test, "State")); 78 } 79 finally 80 { 81 thread.join(); 82 hotUndeploy("pauseinstart.sar"); 83 } 84 } 85 86 public static Test suite() throws Exception 87 { 88 return getTestSuite(JBAS3050URLDeploymentScannerUnitTestCase.class); 89 } 90 91 public JBAS3050URLDeploymentScannerUnitTestCase(String name) 92 { 93 super(name); 94 } 95 } 96 | Popular Tags |