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