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.gbean.AbstractName; 22 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; 23 import org.apache.geronimo.kernel.config.ConfigurationStore; 24 import org.apache.geronimo.kernel.repository.Artifact; 25 import org.apache.geronimo.kernel.repository.Environment; 26 import org.apache.geronimo.kernel.Naming; 27 import org.apache.geronimo.deployment.ModuleIDBuilder; 28 29 import java.io.File ; 30 import java.net.URL ; 31 import java.util.jar.JarFile ; 32 import java.util.Collection ; 33 34 35 38 public class MockEJBConfigBuilder extends Assert implements ModuleBuilder { 39 private EARContext earContext; 40 private ClassLoader cl; 41 public EJBModule ejbModule; 42 43 public Module createModule(File plan, JarFile moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException { 44 AbstractName earName = naming.createRootName(new Artifact("test", "test-ejb-jar", "", "jar"), NameFactory.NULL, NameFactory.J2EE_APPLICATION) ; 45 AbstractName moduleName = naming.createChildName(earName, "ejb-jar", NameFactory.EJB_MODULE); 46 return new EJBModule(true, moduleName, null, moduleFile, "ejb.jar", null, null, null, null); 47 } 48 49 public Module createModule(Object plan, JarFile moduleFile, String targetPath, URL specDDUrl, Environment environment, Object moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException { 50 AbstractName moduleName = naming.createChildName(earName, "ejb-jar", NameFactory.EJB_MODULE); 51 return new EJBModule(false, moduleName, null, moduleFile, targetPath, null, null, null, null); 52 } 53 54 public void installModule(JarFile earFile, EARContext earContext, Module ejbModule, Collection configurationStores, ConfigurationStore targetConfigurationStore, Collection repository) { 55 assertNotNull(earFile); 56 assertNotNull(earContext); 57 this.earContext = earContext; 58 } 66 67 public void initContext(EARContext earContext, Module ejbModule, ClassLoader cl) { 68 assertEquals(this.earContext, earContext); 69 assertNotNull(cl); 71 this.cl = cl; 72 } 73 74 public void addGBeans(EARContext earContext, Module ejbModule, ClassLoader cl, Collection repository) { 75 assertEquals(this.earContext, earContext); 76 assertEquals(this.cl, cl); 78 } 79 80 public String getSchemaNamespace() { 81 return null; 82 } 83 84 } 85 | Popular Tags |