001: package com.mockrunner.ejb;
002:
003: import javax.jms.ConnectionFactory;
004: import javax.jms.Destination;
005:
006: import junit.framework.TestCase;
007:
008: import org.mockejb.BasicEjbDescriptor;
009: import org.mockejb.TransactionPolicy;
010:
011: import com.mockrunner.mock.ejb.EJBMockObjectFactory;
012:
013: /**
014: * Delegator for {@link com.mockrunner.ejb.EJBTestModule}. You can
015: * subclass this adapter or use {@link com.mockrunner.ejb.EJBTestModule}
016: * directly (so your test case can use another base class).
017: * This basic adapter can be used if you don't need any other modules. It
018: * does not extend {@link com.mockrunner.base.BaseTestCase}. If you want
019: * to use several modules in conjunction, consider subclassing
020: * {@link com.mockrunner.ejb.EJBTestCaseAdapter}.
021: * <b>This class is generated from the {@link com.mockrunner.ejb.EJBTestModule}
022: * and should not be edited directly</b>.
023: */
024: public abstract class BasicEJBTestCaseAdapter extends TestCase {
025: private EJBTestModule ejbTestModule;
026: private EJBMockObjectFactory ejbMockObjectFactory;
027:
028: public BasicEJBTestCaseAdapter() {
029:
030: }
031:
032: public BasicEJBTestCaseAdapter(String name) {
033: super (name);
034: }
035:
036: protected void tearDown() throws Exception {
037: super .tearDown();
038: if (null != ejbMockObjectFactory) {
039: ejbMockObjectFactory.resetMockContextFactory();
040: }
041: ejbTestModule = null;
042: ejbMockObjectFactory = null;
043: }
044:
045: /**
046: * Creates the {@link com.mockrunner.ejb.EJBTestModule}. If you
047: * overwrite this method, you must call <code>super.setUp()</code>.
048: */
049: protected void setUp() throws Exception {
050: super .setUp();
051: ejbTestModule = createEJBTestModule(getEJBMockObjectFactory());
052: }
053:
054: /**
055: * Creates a {@link com.mockrunner.mock.ejb.EJBMockObjectFactory}.
056: * @return the created {@link com.mockrunner.mock.ejb.EJBMockObjectFactory}
057: */
058: protected EJBMockObjectFactory createEJBMockObjectFactory() {
059: return new EJBMockObjectFactory();
060: }
061:
062: /**
063: * Gets the {@link com.mockrunner.mock.ejb.EJBMockObjectFactory}.
064: * @return the {@link com.mockrunner.mock.ejb.EJBMockObjectFactory}
065: */
066: protected EJBMockObjectFactory getEJBMockObjectFactory() {
067: synchronized (EJBMockObjectFactory.class) {
068: if (ejbMockObjectFactory == null) {
069: ejbMockObjectFactory = createEJBMockObjectFactory();
070: }
071: }
072: return ejbMockObjectFactory;
073: }
074:
075: /**
076: * Sets the {@link com.mockrunner.mock.ejb.EJBMockObjectFactory}.
077: * @param ejbMockObjectFactory the {@link com.mockrunner.mock.ejb.EJBMockObjectFactory}
078: */
079: protected void setEJBMockObjectFactory(
080: EJBMockObjectFactory ejbMockObjectFactory) {
081: this .ejbMockObjectFactory = ejbMockObjectFactory;
082: }
083:
084: /**
085: * Creates a {@link com.mockrunner.ejb.EJBTestModule} based on the current
086: * {@link com.mockrunner.mock.ejb.EJBMockObjectFactory}.
087: * Same as <code>createEJBTestModule(getEJBMockObjectFactory())</code>.
088: * @return the created {@link com.mockrunner.ejb.EJBTestModule}
089: */
090: protected EJBTestModule createEJBTestModule() {
091: return new EJBTestModule(getEJBMockObjectFactory());
092: }
093:
094: /**
095: * Creates a {@link com.mockrunner.ejb.EJBTestModule} with the specified
096: * {@link com.mockrunner.mock.ejb.EJBMockObjectFactory}.
097: * @return the created {@link com.mockrunner.ejb.EJBTestModule}
098: */
099: protected EJBTestModule createEJBTestModule(
100: EJBMockObjectFactory mockFactory) {
101: return new EJBTestModule(mockFactory);
102: }
103:
104: /**
105: * Gets the {@link com.mockrunner.ejb.EJBTestModule}.
106: * @return the {@link com.mockrunner.ejb.EJBTestModule}
107: */
108: protected EJBTestModule getEJBTestModule() {
109: return ejbTestModule;
110: }
111:
112: /**
113: * Sets the {@link com.mockrunner.ejb.EJBTestModule}.
114: * @param ejbTestModule the {@link com.mockrunner.ejb.EJBTestModule}
115: */
116: protected void setEJBTestModule(EJBTestModule ejbTestModule) {
117: this .ejbTestModule = ejbTestModule;
118: }
119:
120: /**
121: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#setImplementationSuffix(String)}
122: */
123: protected void setImplementationSuffix(String impSuffix) {
124: ejbTestModule.setImplementationSuffix(impSuffix);
125: }
126:
127: /**
128: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#setBusinessInterfaceSuffix(String)}
129: */
130: protected void setBusinessInterfaceSuffix(
131: String businessInterfaceSuffix) {
132: ejbTestModule
133: .setBusinessInterfaceSuffix(businessInterfaceSuffix);
134: }
135:
136: /**
137: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#setHomeInterfaceSuffix(String)}
138: */
139: protected void setHomeInterfaceSuffix(String homeInterfaceSuffix) {
140: ejbTestModule.setHomeInterfaceSuffix(homeInterfaceSuffix);
141: }
142:
143: /**
144: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#setInterfacePackage(String)}
145: */
146: protected void setInterfacePackage(String interfacePackage) {
147: ejbTestModule.setInterfacePackage(interfacePackage);
148: }
149:
150: /**
151: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#setHomeInterfacePackage(String)}
152: */
153: protected void setHomeInterfacePackage(String homeInterfacePackage) {
154: ejbTestModule.setHomeInterfacePackage(homeInterfacePackage);
155: }
156:
157: /**
158: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#setBusinessInterfacePackage(String)}
159: */
160: protected void setBusinessInterfacePackage(
161: String businessInterfacePackage) {
162: ejbTestModule
163: .setBusinessInterfacePackage(businessInterfacePackage);
164: }
165:
166: /**
167: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#deploy(BasicEjbDescriptor)}
168: */
169: protected void deploy(BasicEjbDescriptor descriptor) {
170: ejbTestModule.deploy(descriptor);
171: }
172:
173: /**
174: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#deploy(BasicEjbDescriptor, TransactionPolicy)}
175: */
176: protected void deploy(BasicEjbDescriptor descriptor,
177: TransactionPolicy policy) {
178: ejbTestModule.deploy(descriptor, policy);
179: }
180:
181: /**
182: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#deploySessionBean(String, Class, TransactionPolicy)}
183: */
184: protected void deploySessionBean(String jndiName, Class beanClass,
185: TransactionPolicy policy) {
186: ejbTestModule.deploySessionBean(jndiName, beanClass, policy);
187: }
188:
189: /**
190: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#deploySessionBean(String, Class)}
191: */
192: protected void deploySessionBean(String jndiName, Class beanClass) {
193: ejbTestModule.deploySessionBean(jndiName, beanClass);
194: }
195:
196: /**
197: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#deploySessionBean(String, Class, boolean)}
198: */
199: protected void deploySessionBean(String jndiName, Class beanClass,
200: boolean stateful) {
201: ejbTestModule.deploySessionBean(jndiName, beanClass, stateful);
202: }
203:
204: /**
205: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#deploySessionBean(String, Object, TransactionPolicy)}
206: */
207: protected void deploySessionBean(String jndiName, Object bean,
208: TransactionPolicy policy) {
209: ejbTestModule.deploySessionBean(jndiName, bean, policy);
210: }
211:
212: /**
213: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#deploySessionBean(String, Class, boolean, TransactionPolicy)}
214: */
215: protected void deploySessionBean(String jndiName, Class beanClass,
216: boolean stateful, TransactionPolicy policy) {
217: ejbTestModule.deploySessionBean(jndiName, beanClass, stateful,
218: policy);
219: }
220:
221: /**
222: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#deploySessionBean(String, Object)}
223: */
224: protected void deploySessionBean(String jndiName, Object bean) {
225: ejbTestModule.deploySessionBean(jndiName, bean);
226: }
227:
228: /**
229: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#deploySessionBean(String, Object, boolean)}
230: */
231: protected void deploySessionBean(String jndiName, Object bean,
232: boolean stateful) {
233: ejbTestModule.deploySessionBean(jndiName, bean, stateful);
234: }
235:
236: /**
237: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#deploySessionBean(String, Object, boolean, TransactionPolicy)}
238: */
239: protected void deploySessionBean(String jndiName, Object bean,
240: boolean stateful, TransactionPolicy policy) {
241: ejbTestModule.deploySessionBean(jndiName, bean, stateful,
242: policy);
243: }
244:
245: /**
246: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#deployEntityBean(String, Class, TransactionPolicy)}
247: */
248: protected void deployEntityBean(String jndiName, Class beanClass,
249: TransactionPolicy policy) {
250: ejbTestModule.deployEntityBean(jndiName, beanClass, policy);
251: }
252:
253: /**
254: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#deployEntityBean(String, Class)}
255: */
256: protected void deployEntityBean(String jndiName, Class beanClass) {
257: ejbTestModule.deployEntityBean(jndiName, beanClass);
258: }
259:
260: /**
261: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#deployMessageBean(String, String, ConnectionFactory, Destination, Object, TransactionPolicy)}
262: */
263: protected void deployMessageBean(String connectionFactoryJndiName,
264: String destinationJndiName,
265: ConnectionFactory connectionFactory,
266: Destination destination, Object bean,
267: TransactionPolicy policy) {
268: ejbTestModule.deployMessageBean(connectionFactoryJndiName,
269: destinationJndiName, connectionFactory, destination,
270: bean, policy);
271: }
272:
273: /**
274: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#deployMessageBean(String, String, ConnectionFactory, Destination, Object)}
275: */
276: protected void deployMessageBean(String connectionFactoryJndiName,
277: String destinationJndiName,
278: ConnectionFactory connectionFactory,
279: Destination destination, Object bean) {
280: ejbTestModule.deployMessageBean(connectionFactoryJndiName,
281: destinationJndiName, connectionFactory, destination,
282: bean);
283: }
284:
285: /**
286: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#bindToContext(String, Object)}
287: */
288: protected void bindToContext(String name, Object object) {
289: ejbTestModule.bindToContext(name, object);
290: }
291:
292: /**
293: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#lookupBean(String)}
294: * @deprecated
295: */
296: protected Object lookupBean(String name) {
297: return ejbTestModule.lookupBean(name);
298: }
299:
300: /**
301: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#lookupBean(String, String, Object[])}
302: * @deprecated
303: */
304: protected Object lookupBean(String name, String createMethod,
305: Object[] parameters) {
306: return ejbTestModule.lookupBean(name, createMethod, parameters);
307: }
308:
309: /**
310: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#lookupBean(String, Object[])}
311: * @deprecated
312: */
313: protected Object lookupBean(String name, Object[] parameters) {
314: return ejbTestModule.lookupBean(name, parameters);
315: }
316:
317: /**
318: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#createBean(String)}
319: */
320: protected Object createBean(String name) {
321: return ejbTestModule.createBean(name);
322: }
323:
324: /**
325: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#createBean(String, String, Object[])}
326: */
327: protected Object createBean(String name, String createMethod,
328: Object[] parameters) {
329: return ejbTestModule.createBean(name, createMethod, parameters);
330: }
331:
332: /**
333: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#createBean(String, String, Object[], Class[])}
334: */
335: protected Object createBean(String name, String createMethod,
336: Object[] parameters, Class[] parameterTypes) {
337: return ejbTestModule.createBean(name, createMethod, parameters,
338: parameterTypes);
339: }
340:
341: /**
342: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#createBean(String, Object[])}
343: */
344: protected Object createBean(String name, Object[] parameters) {
345: return ejbTestModule.createBean(name, parameters);
346: }
347:
348: /**
349: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#createEntityBean(String, String, Object[], Class[], Object)}
350: */
351: protected Object createEntityBean(String name, String createMethod,
352: Object[] parameters, Class[] parameterTypes,
353: Object primaryKey) {
354: return ejbTestModule.createEntityBean(name, createMethod,
355: parameters, parameterTypes, primaryKey);
356: }
357:
358: /**
359: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#createEntityBean(String, String, Object[], Object)}
360: */
361: protected Object createEntityBean(String name, String createMethod,
362: Object[] parameters, Object primaryKey) {
363: return ejbTestModule.createEntityBean(name, createMethod,
364: parameters, primaryKey);
365: }
366:
367: /**
368: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#createEntityBean(String, Object)}
369: */
370: protected Object createEntityBean(String name, Object primaryKey) {
371: return ejbTestModule.createEntityBean(name, primaryKey);
372: }
373:
374: /**
375: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#createEntityBean(String, Object[], Object)}
376: */
377: protected Object createEntityBean(String name, Object[] parameters,
378: Object primaryKey) {
379: return ejbTestModule.createEntityBean(name, parameters,
380: primaryKey);
381: }
382:
383: /**
384: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#findByPrimaryKey(String, Object)}
385: */
386: protected Object findByPrimaryKey(String name, Object primaryKey) {
387: return ejbTestModule.findByPrimaryKey(name, primaryKey);
388: }
389:
390: /**
391: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#resetUserTransaction}
392: */
393: protected void resetUserTransaction() {
394: ejbTestModule.resetUserTransaction();
395: }
396:
397: /**
398: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#verifyCommitted}
399: */
400: protected void verifyCommitted() {
401: ejbTestModule.verifyCommitted();
402: }
403:
404: /**
405: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#verifyNotCommitted}
406: */
407: protected void verifyNotCommitted() {
408: ejbTestModule.verifyNotCommitted();
409: }
410:
411: /**
412: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#verifyRolledBack}
413: */
414: protected void verifyRolledBack() {
415: ejbTestModule.verifyRolledBack();
416: }
417:
418: /**
419: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#verifyNotRolledBack}
420: */
421: protected void verifyNotRolledBack() {
422: ejbTestModule.verifyNotRolledBack();
423: }
424:
425: /**
426: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#verifyMarkedForRollback}
427: */
428: protected void verifyMarkedForRollback() {
429: ejbTestModule.verifyMarkedForRollback();
430: }
431:
432: /**
433: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#verifyNotMarkedForRollback}
434: */
435: protected void verifyNotMarkedForRollback() {
436: ejbTestModule.verifyNotMarkedForRollback();
437: }
438:
439: /**
440: * Delegates to {@link com.mockrunner.ejb.EJBTestModule#lookup(String)}
441: */
442: protected Object lookup(String name) {
443: return ejbTestModule.lookup(name);
444: }
445: }
|