KickJava   Java API By Example, From Geeks To Geeks.

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


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.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 JavaDoc;
30 import java.net.URL JavaDoc;
31 import java.util.jar.JarFile JavaDoc;
32 import java.util.Collection JavaDoc;
33
34
35 /**
36  * @version $Rev:385692 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
37  */

38 public class MockEJBConfigBuilder extends Assert implements ModuleBuilder {
39     private EARContext earContext;
40     private ClassLoader JavaDoc cl;
41     public EJBModule ejbModule;
42
43     public Module createModule(File JavaDoc plan, JarFile JavaDoc 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 JavaDoc plan, JarFile JavaDoc moduleFile, String JavaDoc targetPath, URL JavaDoc specDDUrl, Environment environment, Object JavaDoc 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 JavaDoc earFile, EARContext earContext, Module ejbModule, Collection JavaDoc configurationStores, ConfigurationStore targetConfigurationStore, Collection JavaDoc repository) {
55         assertNotNull(earFile);
56         assertNotNull(earContext);
57         this.earContext = earContext;
58 // assertEquals(this.ejbModule, ejbModule);
59
// if ( null != this.ejbModule.getAltSpecDD() ) {
60
// assertEquals(this.ejbModule.getAltSpecDD(), ejbModule.getAltSpecDD());
61
// }
62
// if ( null != this.ejbModule.getAltVendorDD() ) {
63
// assertEquals(this.ejbModule.getAltVendorDD(), ejbModule.getAltVendorDD());
64
// }
65
}
66
67     public void initContext(EARContext earContext, Module ejbModule, ClassLoader JavaDoc cl) {
68         assertEquals(this.earContext, earContext);
69 // assertEquals(this.ejbModule, ejbModule);
70
assertNotNull(cl);
71         this.cl = cl;
72     }
73
74     public void addGBeans(EARContext earContext, Module ejbModule, ClassLoader JavaDoc cl, Collection JavaDoc repository) {
75         assertEquals(this.earContext, earContext);
76 // assertEquals(this.ejbModule, ejbModule);
77
assertEquals(this.cl, cl);
78     }
79
80     public String JavaDoc getSchemaNamespace() {
81         return null;
82     }
83
84 }
85
Popular Tags