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.GBeanData;
021: import org.apache.geronimo.gbean.AbstractNameQuery;
022: import org.apache.geronimo.gbean.AbstractName;
023: import org.apache.geronimo.kernel.config.Configuration;
024: import org.apache.geronimo.kernel.config.ConfigurationStore;
025: import org.apache.geronimo.kernel.repository.Environment;
026: import org.apache.geronimo.kernel.repository.Artifact;
027: import org.apache.geronimo.kernel.Naming;
028: import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
029: import org.apache.geronimo.deployment.ModuleIDBuilder;
030:
031: import javax.management.ObjectName;
032: import javax.naming.Reference;
033: import java.io.File;
034: import java.net.URL;
035: import java.util.jar.JarFile;
036: import java.util.Collection;
037:
038: /**
039: * @version $Rev:385692 $ $Date: 2007-03-01 16:49:50 -0800 (Thu, 01 Mar 2007) $
040: */
041: public class MockConnectorConfigBuilder extends Assert implements
042: ModuleBuilder, ActivationSpecInfoLocator {
043: private EARContext earContext;
044: private ClassLoader cl;
045: public Module connectorModule;
046:
047: public Module createModule(File plan, JarFile moduleFile,
048: Naming naming, ModuleIDBuilder idBuilder)
049: throws DeploymentException {
050: AbstractName earName = naming.createRootName(new Artifact(
051: "test", "test-war", "", "rar"), NameFactory.NULL,
052: NameFactory.J2EE_APPLICATION);
053: AbstractName moduleName = naming.createChildName(earName,
054: "rar", NameFactory.RESOURCE_ADAPTER_MODULE);
055: return new ConnectorModule(true, moduleName, null, moduleFile,
056: "connector", null, null, null, null);
057: }
058:
059: public Module createModule(Object plan, JarFile moduleFile,
060: String targetPath, URL specDDUrl, Environment environment,
061: Object moduleContextInfo, AbstractName earName,
062: Naming naming, ModuleIDBuilder idBuilder)
063: throws DeploymentException {
064: AbstractName moduleName = naming.createChildName(earName,
065: "rar", NameFactory.RESOURCE_ADAPTER_MODULE);
066: return new ConnectorModule(false, moduleName, null, moduleFile,
067: targetPath, null, null, null, null);
068: }
069:
070: public void installModule(JarFile earFile, EARContext earContext,
071: Module connectorModule, Collection configurationStores,
072: ConfigurationStore targetConfigurationStore,
073: Collection repository) {
074: assertNotNull(earFile);
075: assertNotNull(earContext);
076: this .earContext = earContext;
077: // assertEquals(this.connectorModule, connectorModule);
078: // if ( null != this.connectorModule.getAltSpecDD() ) {
079: // assertEquals(this.connectorModule.getAltSpecDD(), connectorModule.getAltSpecDD());
080: // }
081: // if ( null != this.connectorModule.getAltVendorDD() ) {
082: // assertEquals(this.connectorModule.getAltVendorDD(), connectorModule.getAltVendorDD());
083: // }
084: }
085:
086: public void initContext(EARContext earContext,
087: Module connectorModule, ClassLoader cl) {
088: assertEquals(this .earContext, earContext);
089: // assertEquals(this.connectorModule, connectorModule);
090: assertNotNull(cl);
091: this .cl = cl;
092: }
093:
094: public void addGBeans(EARContext earContext,
095: Module connectorModule, ClassLoader cl,
096: Collection repository) {
097: assertEquals(this .earContext, earContext);
098: // assertEquals(this.connectorModule, connectorModule);
099: assertEquals(this .cl, cl);
100: }
101:
102: public String getSchemaNamespace() {
103: return null;
104: }
105:
106: public Reference createResourceRef(AbstractNameQuery containerId,
107: Class iface, Configuration configuration)
108: throws DeploymentException {
109: return null;
110: }
111:
112: public Reference createAdminObjectRef(
113: AbstractNameQuery containerId, Class iface,
114: Configuration configuration) throws DeploymentException {
115: return null;
116: }
117:
118: public ObjectName locateResourceName(ObjectName query)
119: throws DeploymentException {
120: return null;
121: }
122:
123: public GBeanData locateActivationSpecInfo(
124: AbstractNameQuery nameQuery,
125: String messageListenerInterface, Configuration configuration)
126: throws DeploymentException {
127: return null;
128: }
129:
130: public GBeanData locateResourceAdapterGBeanData(
131: GBeanData resourceAdapterModuleData)
132: throws DeploymentException {
133: return null;
134: }
135:
136: public GBeanData locateAdminObjectInfo(
137: GBeanData resourceAdapterModuleData,
138: String adminObjectInterfaceName) throws DeploymentException {
139: return null;
140: }
141:
142: public GBeanData locateConnectionFactoryInfo(
143: GBeanData resourceAdapterModuleData,
144: String connectionFactoryInterfaceName)
145: throws DeploymentException {
146: return null;
147: }
148: }
|