1 22 package org.jboss.test; 23 24 import java.net.MalformedURLException ; 25 import java.net.URL ; 26 27 import javax.management.MBeanServerConnection ; 28 import javax.management.MalformedObjectNameException ; 29 import javax.management.ObjectName ; 30 import javax.naming.InitialContext ; 31 32 import junit.extensions.TestSetup; 33 import junit.framework.Test; 34 35 import org.jboss.logging.Logger; 36 37 54 public class JBossTestSetup 55 extends AbstractTestSetup 56 { 57 protected JBossTestServices delegate; 58 59 65 public JBossTestSetup(final Class clazz, Test test) throws Exception 66 { 67 super(clazz, test); 68 } 69 public JBossTestSetup(Test test) throws Exception 70 { 71 super(JBossTestCase.class, test); 72 } 73 74 @Override 75 protected void setUp() throws Exception 76 { 77 super.setUp(); 78 this.delegate = (JBossTestServices) AbstractTestSetup.delegate; 79 } 80 81 @Override 82 protected void tearDown() throws Exception 83 { 84 super.tearDown(); 86 } 87 88 89 95 protected InitialContext getInitialContext() throws Exception 96 { 97 return delegate.getInitialContext(); 98 } 99 100 106 protected MBeanServerConnection getServer() throws Exception 107 { 108 return delegate.getServer(); 109 } 110 111 116 protected Logger getLog() 117 { 118 return delegate.getLog(); 119 } 120 121 127 protected ObjectName getDeployerName() throws MalformedObjectNameException 128 { 129 return delegate.getDeployerName(); 130 } 131 132 142 protected URL getDeployURL(final String filename) throws MalformedURLException 143 { 144 return delegate.getDeployURL(filename); 145 } 146 147 protected String getResourceURL(final String path) 148 { 149 ClassLoader loader = Thread.currentThread().getContextClassLoader(); 150 URL resURL = loader.getResource(path); 151 String resPath = resURL != null ? resURL.toString() : null; 152 return resPath; 153 } 154 155 166 protected Object invoke(ObjectName name, String method, Object [] args, String [] sig) throws Exception 167 { 168 return delegate.invoke(name, method, args, sig); 169 } 170 171 178 protected void deploy(String name) throws Exception 179 { 180 delegate.deploy(name); 181 } 182 183 protected void redeploy(String name) throws Exception 184 { 185 delegate.redeploy(name); 186 } 187 188 195 protected void undeploy(String name) throws Exception 196 { 197 delegate.undeploy(name); 198 } 199 200 201 protected void flushAuthCache() throws Exception 202 { 203 flushAuthCache("other"); 204 } 205 206 protected void flushAuthCache(String domain) throws Exception 207 { 208 delegate.flushAuthCache(domain); 209 } 210 211 214 protected void restartDBPool() throws Exception 215 { 216 delegate.restartDBPool(); 217 } 218 219 protected String getJndiURL() 220 { 221 return delegate.getJndiURL(); 222 } 223 224 protected String getJndiInitFactory() 225 { 226 return delegate.getJndiInitFactory(); 227 } 228 229 protected int getThreadCount() 230 { 231 return delegate.getThreadCount(); 232 } 233 234 protected int getIterationCount() 235 { 236 return delegate.getIterationCount(); 237 } 238 239 protected int getBeanCount() 240 { 241 return delegate.getBeanCount(); 242 } 243 244 250 public String getServerHost() 251 { 252 return delegate.getServerHost(); 253 } 254 } 255 | Popular Tags |