1 17 package org.apache.geronimo.j2ee.deployment; 18 19 import junit.framework.Assert; 20 import org.apache.geronimo.common.DeploymentException; 21 import org.apache.geronimo.kernel.repository.Environment; 22 import org.apache.geronimo.kernel.repository.Artifact; 23 import org.apache.geronimo.kernel.Naming; 24 import org.apache.geronimo.kernel.config.ConfigurationStore; 25 import org.apache.geronimo.gbean.AbstractName; 26 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; 27 import org.apache.geronimo.deployment.ModuleIDBuilder; 28 29 import java.io.File ; 30 import java.net.URL ; 31 import java.util.Map ; 32 import java.util.Collection ; 33 import java.util.jar.JarFile ; 34 35 38 public class MockWARConfigBuilder extends Assert implements ModuleBuilder { 39 private EARContext earContext; 40 private ClassLoader cl; 41 private Map portMap = null; 42 private String namespace = "foo"; 43 public WebModule webModule; 44 public String contextRoot; 45 46 public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException { 47 AbstractName earName = naming.createRootName(new Artifact("test", "test-war", "", "war"), NameFactory.NULL, NameFactory.J2EE_APPLICATION) ; 48 AbstractName moduleName = naming.createChildName(earName, "war", NameFactory.WEB_MODULE); 49 return new WebModule(true, moduleName, null, moduleFile, "war", null, null, null, contextRoot, portMap, namespace); 50 } 51 52 public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException { 53 AbstractName moduleName = naming.createChildName(earName, "war", NameFactory.WEB_MODULE); 54 return new WebModule(false, moduleName, null, moduleFile, targetPath, null, null, null, contextRoot, portMap, namespace); 55 } 56 57 public void installModule(JarFile earFile, EARContext earContext, Module webModule, Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repository) throws DeploymentException { 58 assertNotNull(earFile); 59 assertNotNull(earContext); 60 this.earContext = earContext; 61 } 69 70 public void initContext(EARContext earContext, Module webModule, ClassLoader cl) { 71 assertEquals(this.earContext, earContext); 72 assertNotNull(cl); 74 this.cl = cl; 75 } 76 77 public void addGBeans(EARContext earContext, Module webModule, ClassLoader cl, Collection repository) throws DeploymentException { 78 assertEquals(this.earContext, earContext); 79 assertEquals(this.cl, cl); 81 assertNotNull(contextRoot); 82 this.contextRoot = ((WebModule) webModule).getContextRoot(); 83 } 84 85 public String getSchemaNamespace() { 86 return null; 87 } 88 89 } 90 | Popular Tags |