1 22 package org.jboss.test.system.controller; 23 24 import java.net.URL ; 25 import java.util.Collections ; 26 import java.util.List ; 27 28 import javax.management.MBeanServer ; 29 import javax.management.ObjectName ; 30 31 import junit.framework.AssertionFailedError; 32 33 import org.jboss.system.ServiceControllerMBean; 34 import org.jboss.test.AbstractSystemTest; 35 import org.jboss.test.system.controller.legacy.OldServiceController; 36 37 43 public class OldControllerTestDelegate extends ControllerTestDelegate 44 { 45 public OldControllerTestDelegate(Class clazz) 46 { 47 super(clazz); 48 } 49 50 public ServiceControllerMBean createServiceController() 51 { 52 return new OldServiceController(); 53 } 54 55 public void assertMBeanFailed(ObjectName name, boolean registered) throws Exception 56 { 57 MBeanServer server = getServer(); 58 if (registered == false && server.isRegistered(name)) 59 throw new AssertionFailedError(name + " should not be registered after a failure"); 60 if (registered && server.isRegistered(name) == false) 61 throw new AssertionFailedError(name + " should be registered after a failure"); 62 } 63 64 public List <ObjectName > assertMaybeDeployFailure(URL url, ObjectName name, Class <? extends Throwable > expected) throws Exception 65 { 66 if (expected != null) 67 { 68 try 69 { 70 deploy(url, true); 71 throw new AssertionFailedError("Should have got a " + expected.getName()); 72 } 73 catch (Throwable throwable) 74 { 75 AbstractSystemTest.checkThrowableDeep(expected, throwable); 76 return Collections.emptyList(); 77 } 78 } 79 else 80 { 81 return super.assertMaybeDeployFailure(url, name, expected); 82 } 83 } 84 85 public void assertMaybeParseFailure(URL url, ObjectName name, Class <? extends Throwable > expected) throws Exception 86 { 87 assertInitialDeployFailure(url, name, expected); 88 } 89 } 90 | Popular Tags |