1 22 package org.jboss.test.system.controller.integration.test; 23 24 import java.net.URL ; 25 26 import org.jboss.dependency.spi.ControllerContext; 27 import org.jboss.dependency.spi.ControllerState; 28 import org.jboss.kernel.spi.deployment.KernelDeployment; 29 import org.jboss.test.AbstractTestDelegate; 30 import org.jboss.test.system.controller.AbstractControllerTest; 31 32 38 public abstract class AbstractIntegrationTest extends AbstractControllerTest 39 { 40 45 public AbstractIntegrationTest(String name) 46 { 47 super(name); 48 } 49 50 public static AbstractTestDelegate getDelegate(Class clazz) throws Exception 51 { 52 IntegrationTestDelegate delegate = new IntegrationTestDelegate(clazz); 53 return delegate; 55 } 56 57 64 protected Object getBean(Object name) 65 { 66 return getBean(name, ControllerState.INSTALLED); 67 } 68 69 77 protected Object getBean(Object name, ControllerState state) 78 { 79 return getIntegrationDelegate().getBean(name, state); 80 } 81 82 89 protected ControllerContext getControllerContext(Object name) 90 { 91 return getControllerContext(name, ControllerState.INSTALLED); 92 } 93 94 102 protected ControllerContext getControllerContext(Object name, ControllerState state) 103 { 104 return getIntegrationDelegate().getControllerContext(name, state); 105 } 106 107 114 protected KernelDeployment deployMC(URL url) throws Exception 115 { 116 return getIntegrationDelegate().deployMC(url); 117 } 118 119 126 protected KernelDeployment deployMC(String resource) throws Exception 127 { 128 URL url = getClass().getResource(resource); 129 if (url == null) 130 throw new IllegalArgumentException ("Resource not found: " + resource); 131 return getIntegrationDelegate().deployMC(url); 132 } 133 134 139 protected void undeployMC(KernelDeployment deployment) 140 { 141 getIntegrationDelegate().undeployMC(deployment); 142 } 143 144 149 protected void undeployMC(String resource) 150 { 151 URL url = getClass().getResource(resource); 152 if (url == null) 153 throw new IllegalArgumentException ("Resource not found: " + resource); 154 getIntegrationDelegate().undeployMC(url); 155 } 156 157 162 protected void validateMC() throws Exception 163 { 164 getIntegrationDelegate().validateMC(); 165 } 166 167 protected IntegrationTestDelegate getIntegrationDelegate() 168 { 169 return (IntegrationTestDelegate) getDelegate(); 170 } 171 } 172 | Popular Tags |