001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.geronimo.j2ee.deployment;
017:
018: import junit.framework.Assert;
019: import org.apache.geronimo.common.DeploymentException;
020: import org.apache.geronimo.gbean.AbstractName;
021: import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
022: import org.apache.geronimo.kernel.config.ConfigurationStore;
023: import org.apache.geronimo.kernel.repository.Artifact;
024: import org.apache.geronimo.kernel.repository.Environment;
025: import org.apache.geronimo.kernel.Naming;
026: import org.apache.geronimo.deployment.ModuleIDBuilder;
027:
028: import java.io.File;
029: import java.net.URL;
030: import java.util.jar.JarFile;
031: import java.util.Collection;
032:
033: /**
034: * @version $Rev:385692 $ $Date: 2007-03-14 20:06:17 -0700 (Wed, 14 Mar 2007) $
035: */
036: public class MockEJBConfigBuilder extends Assert implements
037: ModuleBuilder {
038: private EARContext earContext;
039: private ClassLoader cl;
040: public EJBModule ejbModule;
041:
042: public Module createModule(File plan, JarFile moduleFile,
043: Naming naming, ModuleIDBuilder idBuilder)
044: throws DeploymentException {
045: AbstractName earName = naming.createRootName(new Artifact(
046: "test", "test-ejb-jar", "", "jar"), NameFactory.NULL,
047: NameFactory.J2EE_APPLICATION);
048: AbstractName moduleName = naming.createChildName(earName,
049: "ejb-jar", NameFactory.EJB_MODULE);
050: return new EJBModule(true, moduleName, null, moduleFile,
051: "ejb.jar", null, null, null, null);
052: }
053:
054: public Module createModule(Object plan, JarFile moduleFile,
055: String targetPath, URL specDDUrl, Environment environment,
056: Object moduleContextInfo, AbstractName earName,
057: Naming naming, ModuleIDBuilder idBuilder)
058: throws DeploymentException {
059: AbstractName moduleName = naming.createChildName(earName,
060: "ejb-jar", NameFactory.EJB_MODULE);
061: return new EJBModule(false, moduleName, null, moduleFile,
062: targetPath, null, null, null, null);
063: }
064:
065: public void installModule(JarFile earFile, EARContext earContext,
066: Module ejbModule, Collection configurationStores,
067: ConfigurationStore targetConfigurationStore,
068: Collection repository) {
069: assertNotNull(earFile);
070: assertNotNull(earContext);
071: this .earContext = earContext;
072: // assertEquals(this.ejbModule, ejbModule);
073: // if ( null != this.ejbModule.getAltSpecDD() ) {
074: // assertEquals(this.ejbModule.getAltSpecDD(), ejbModule.getAltSpecDD());
075: // }
076: // if ( null != this.ejbModule.getAltVendorDD() ) {
077: // assertEquals(this.ejbModule.getAltVendorDD(), ejbModule.getAltVendorDD());
078: // }
079: }
080:
081: public void initContext(EARContext earContext, Module ejbModule,
082: ClassLoader cl) {
083: assertEquals(this .earContext, earContext);
084: // assertEquals(this.ejbModule, ejbModule);
085: assertNotNull(cl);
086: this .cl = cl;
087: }
088:
089: public void addGBeans(EARContext earContext, Module ejbModule,
090: ClassLoader cl, Collection repository) {
091: assertEquals(this .earContext, earContext);
092: // assertEquals(this.ejbModule, ejbModule);
093: assertEquals(this .cl, cl);
094: }
095:
096: public String getSchemaNamespace() {
097: return null;
098: }
099:
100: }
|