1 17 18 package org.apache.geronimo.tomcat.deployment; 19 20 import java.util.Arrays ; 21 import javax.enterprise.deploy.model.DDBean ; 22 import javax.enterprise.deploy.model.DDBeanRoot ; 23 import javax.enterprise.deploy.spi.DeploymentConfiguration ; 24 25 import junit.framework.TestCase; 26 import org.apache.geronimo.deployment.tools.loader.WebDeployable; 27 28 31 public class WebAppDConfigTest extends TestCase { 32 private DeploymentConfiguration config; 33 private WebDeployable deployable; 34 private DDBeanRoot ddBeanRoot; 35 private WebAppDConfigRoot configRoot; 36 37 public void testWebAppRoot() throws Exception { 38 assertNotNull(configRoot); 39 assertTrue(Arrays.equals(new String []{"web-app"}, configRoot.getXpaths())); 40 assertNotNull(configRoot.getDConfigBean(ddBeanRoot.getChildBean("web-app")[0])); 41 assertNull(configRoot.getDConfigBean(ddBeanRoot.getChildBean("web-app/description")[0])); 42 } 43 44 public void testWebApp() throws Exception { 45 DDBean ddBean = ddBeanRoot.getChildBean("web-app")[0]; 46 WebAppDConfigBean webApp = (WebAppDConfigBean) configRoot.getDConfigBean(ddBean); 47 assertNotNull(webApp); 48 61 } 62 63 81 82 100 101 protected void setUp() throws Exception { 102 super.setUp(); 103 ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); 104 deployable = new WebDeployable(classLoader.getResource("deployables/war1/")); 105 config = new WARConfiguration(deployable); 106 107 ddBeanRoot = deployable.getDDBeanRoot(); 108 configRoot = (WebAppDConfigRoot) config.getDConfigBeanRoot(ddBeanRoot); 109 } 110 111 protected void tearDown() throws Exception { 112 super.tearDown(); 113 } 114 } 115 | Popular Tags |