01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19:
20: package org.apache.geronimo.openejb.deployment.cluster;
21:
22: import java.util.List;
23:
24: import junit.framework.TestCase;
25:
26: import org.apache.openejb.config.AppModule;
27: import org.apache.openejb.config.EjbModule;
28: import org.apache.openejb.jee.EjbJar;
29: import org.apache.openejb.jee.EntityBean;
30: import org.apache.openejb.jee.MessageDrivenBean;
31: import org.apache.openejb.jee.StatefulBean;
32: import org.apache.openejb.jee.StatelessBean;
33: import org.apache.openejb.jee.oejb3.EjbDeployment;
34: import org.apache.openejb.jee.oejb3.OpenejbJar;
35:
36: /**
37: *
38: * @version $Rev:$ $Date:$
39: */
40: public class MapSFSBToContainerIDDeployerTest extends TestCase {
41:
42: public void testContainerIdAreSetForSFSB() throws Exception {
43: AppModule appModule = new AppModule(
44: getClass().getClassLoader(), "dummy.jar");
45: List<EjbModule> ejbModules = appModule.getEjbModules();
46:
47: EjbJar ejbJar = new EjbJar();
48:
49: StatefulBean sfsb = new StatefulBean();
50: String sfsbName = "SFSB";
51: sfsb.setEjbName(sfsbName);
52: ejbJar.addEnterpriseBean(sfsb);
53:
54: StatelessBean slsb = new StatelessBean();
55: String slsbName = "SLSB";
56: slsb.setEjbName(slsbName);
57: ejbJar.addEnterpriseBean(slsb);
58:
59: EntityBean entity = new EntityBean();
60: entity.setEjbName("entity");
61: ejbJar.addEnterpriseBean(entity);
62:
63: MessageDrivenBean mdb = new MessageDrivenBean();
64: mdb.setEjbName("mdb");
65: ejbJar.addEnterpriseBean(mdb);
66:
67: EjbModule ejbModule = new EjbModule(ejbJar);
68:
69: OpenejbJar openejbJar = new OpenejbJar();
70: EjbDeployment sfsbDeployment = new EjbDeployment();
71: sfsbDeployment.setEjbName(sfsbName);
72: openejbJar.addEjbDeployment(sfsbDeployment);
73:
74: ejbModule.setOpenejbJar(openejbJar);
75:
76: ejbModules.add(ejbModule);
77:
78: String targetContainerId = "targetContainerId";
79: MapSFSBToContainerIDDeployer deployer = new MapSFSBToContainerIDDeployer(
80: targetContainerId);
81: deployer.deploy(appModule);
82:
83: assertEquals(targetContainerId, sfsbDeployment.getContainerId());
84: }
85:
86: }
|