KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > j2ee > deployment > MockConnectorConfigBuilder


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

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.GBeanData;
22 import org.apache.geronimo.gbean.AbstractNameQuery;
23 import org.apache.geronimo.gbean.AbstractName;
24 import org.apache.geronimo.kernel.config.Configuration;
25 import org.apache.geronimo.kernel.config.ConfigurationStore;
26 import org.apache.geronimo.kernel.repository.Environment;
27 import org.apache.geronimo.kernel.repository.Artifact;
28 import org.apache.geronimo.kernel.Naming;
29 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
30 import org.apache.geronimo.deployment.ModuleIDBuilder;
31
32 import javax.management.ObjectName JavaDoc;
33 import javax.naming.Reference JavaDoc;
34 import java.io.File JavaDoc;
35 import java.net.URL JavaDoc;
36 import java.util.jar.JarFile JavaDoc;
37 import java.util.Collection JavaDoc;
38
39 /**
40  * @version $Rev:385692 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
41  */

42 public class MockConnectorConfigBuilder extends Assert implements ModuleBuilder, ActivationSpecInfoLocator {
43     private EARContext earContext;
44     private ClassLoader JavaDoc cl;
45     public Module connectorModule;
46
47     public Module createModule(File JavaDoc plan, JarFile JavaDoc moduleFile, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
48         AbstractName earName = naming.createRootName(new Artifact("test", "test-war", "", "rar"), NameFactory.NULL, NameFactory.J2EE_APPLICATION) ;
49         AbstractName moduleName = naming.createChildName(earName, "rar", NameFactory.RESOURCE_ADAPTER_MODULE);
50         return new ConnectorModule(true, moduleName, null, moduleFile, "connector", null, null, null);
51     }
52
53     public Module createModule(Object JavaDoc plan, JarFile JavaDoc moduleFile, String JavaDoc targetPath, URL JavaDoc specDDUrl, Environment environment, Object JavaDoc moduleContextInfo, AbstractName earName, Naming naming, ModuleIDBuilder idBuilder) throws DeploymentException {
54         AbstractName moduleName = naming.createChildName(earName, "rar", NameFactory.RESOURCE_ADAPTER_MODULE);
55         return new ConnectorModule(false, moduleName, null, moduleFile, targetPath, null, null, null);
56     }
57
58     public void installModule(JarFile JavaDoc earFile, EARContext earContext, Module connectorModule, Collection JavaDoc configurationStores, ConfigurationStore targetConfigurationStore, Collection JavaDoc repository) {
59         assertNotNull(earFile);
60         assertNotNull(earContext);
61         this.earContext = earContext;
62 // assertEquals(this.connectorModule, connectorModule);
63
// if ( null != this.connectorModule.getAltSpecDD() ) {
64
// assertEquals(this.connectorModule.getAltSpecDD(), connectorModule.getAltSpecDD());
65
// }
66
// if ( null != this.connectorModule.getAltVendorDD() ) {
67
// assertEquals(this.connectorModule.getAltVendorDD(), connectorModule.getAltVendorDD());
68
// }
69
}
70
71     public void initContext(EARContext earContext, Module connectorModule, ClassLoader JavaDoc cl) {
72         assertEquals(this.earContext, earContext);
73 // assertEquals(this.connectorModule, connectorModule);
74
assertNotNull(cl);
75         this.cl = cl;
76     }
77
78     public void addGBeans(EARContext earContext, Module connectorModule, ClassLoader JavaDoc cl, Collection JavaDoc repository) {
79         assertEquals(this.earContext, earContext);
80 // assertEquals(this.connectorModule, connectorModule);
81
assertEquals(this.cl, cl);
82     }
83
84     public String JavaDoc getSchemaNamespace() {
85         return null;
86     }
87
88     public Reference JavaDoc createResourceRef(AbstractNameQuery containerId, Class JavaDoc iface, Configuration configuration) throws DeploymentException {
89         return null;
90     }
91
92     public Reference JavaDoc createAdminObjectRef(AbstractNameQuery containerId, Class JavaDoc iface, Configuration configuration) throws DeploymentException {
93         return null;
94     }
95
96     public ObjectName JavaDoc locateResourceName(ObjectName JavaDoc query) throws DeploymentException {
97         return null;
98     }
99
100     public GBeanData locateActivationSpecInfo(AbstractNameQuery nameQuery, String JavaDoc messageListenerInterface, Configuration configuration) throws DeploymentException {
101         return null;
102     }
103
104     public GBeanData locateResourceAdapterGBeanData(GBeanData resourceAdapterModuleData) throws DeploymentException {
105         return null;
106     }
107
108     public GBeanData locateAdminObjectInfo(GBeanData resourceAdapterModuleData, String JavaDoc adminObjectInterfaceName) throws DeploymentException {
109         return null;
110     }
111
112     public GBeanData locateConnectionFactoryInfo(GBeanData resourceAdapterModuleData, String JavaDoc connectionFactoryInterfaceName) throws DeploymentException {
113         return null;
114     }
115 }
116
Popular Tags