Source Code Cross Referenced for SetterInjectionStatelessBean.java in  » J2EE » openejb3 » org » apache » openejb » test » stateless » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » openejb3 » org.apache.openejb.test.stateless 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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.openejb.test.stateless;
017:
018:        import org.apache.openejb.test.entity.bmp.BasicBmpHome;
019:        import org.apache.openejb.test.stateful.BasicStatefulHome;
020:        import org.apache.openejb.test.stateful.BasicStatefulBusinessLocal;
021:        import org.apache.openejb.test.stateful.BasicStatefulBusinessRemote;
022:        import org.apache.openejb.test.TestFailureException;
023:
024:        import javax.ejb.SessionBean;
025:        import javax.ejb.SessionContext;
026:        import javax.ejb.CreateException;
027:        import javax.ejb.EJBException;
028:        import javax.sql.DataSource;
029:        import javax.persistence.EntityManagerFactory;
030:        import javax.persistence.EntityManager;
031:        import javax.jms.ConnectionFactory;
032:        import javax.jms.Session;
033:        import javax.jms.Topic;
034:        import javax.jms.MessageProducer;
035:        import javax.jms.QueueConnectionFactory;
036:        import javax.jms.TopicConnectionFactory;
037:        import javax.jms.JMSException;
038:
039:        import junit.framework.Assert;
040:        import junit.framework.AssertionFailedError;
041:
042:        import java.rmi.RemoteException;
043:
044:        /**
045:         * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
046:         * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
047:         */
048:        public class SetterInjectionStatelessBean implements  SessionBean {
049:
050:            private SessionContext ejbContextField;
051:            private BasicBmpHome bmpHomeField;
052:            private BasicStatefulHome statefulHomeField;
053:            private BasicStatelessHome statelessHomeField;
054:            private String striingField;
055:            private Double dooubleField;
056:            private Long loongField;
057:            private Float flooatField;
058:            private Integer inteegerField;
059:            private Short shoortField;
060:            private Boolean boooleanField;
061:            private Byte byyteField;
062:            private Character chaaracterField;
063:            private DataSource daataSourceField;
064:            private ConnectionFactory coonnectionFactory;
065:            private QueueConnectionFactory queueCoonnectionFactory;
066:            private TopicConnectionFactory topicCoonnectionFactory;
067:            private EntityManagerFactory emfField;
068:            private EntityManager emField;
069:            private EntityManager eemField;
070:            private EntityManager pemField;
071:            private BasicStatelessBusinessLocal statelessBusinessLocalField;
072:            private BasicStatelessBusinessRemote statelessBusinessRemoteField;
073:            private BasicStatefulBusinessLocal statefulBusinessLocalField;
074:            private BasicStatefulBusinessRemote statefulBusinessRemoteField;
075:
076:            public BasicStatefulBusinessLocal getStatefulBusinessLocal() {
077:                return statefulBusinessLocalField;
078:            }
079:
080:            public void setStatefulBusinessLocal(
081:                    BasicStatefulBusinessLocal statefulBusinessLocal) {
082:                this .statefulBusinessLocalField = statefulBusinessLocal;
083:            }
084:
085:            public BasicStatefulBusinessRemote getStatefulBusinessRemote() {
086:                return statefulBusinessRemoteField;
087:            }
088:
089:            public void setStatefulBusinessRemote(
090:                    BasicStatefulBusinessRemote statefulBusinessRemote) {
091:                this .statefulBusinessRemoteField = statefulBusinessRemote;
092:            }
093:
094:            public BasicStatelessBusinessLocal getStatelessBusinessLocal() {
095:                return statelessBusinessLocalField;
096:            }
097:
098:            public void setStatelessBusinessLocal(
099:                    BasicStatelessBusinessLocal statelessBusinessLocal) {
100:                this .statelessBusinessLocalField = statelessBusinessLocal;
101:            }
102:
103:            public BasicStatelessBusinessRemote getStatelessBusinessRemote() {
104:                return statelessBusinessRemoteField;
105:            }
106:
107:            public void setStatelessBusinessRemote(
108:                    BasicStatelessBusinessRemote statelessBusinessRemote) {
109:                this .statelessBusinessRemoteField = statelessBusinessRemote;
110:            }
111:
112:            public BasicBmpHome getBmpHome() {
113:                return bmpHomeField;
114:            }
115:
116:            public void setBmpHome(BasicBmpHome bmpHome) {
117:                this .bmpHomeField = bmpHome;
118:            }
119:
120:            public Boolean getBooolean() {
121:                return boooleanField;
122:            }
123:
124:            public void setBooolean(Boolean booolean) {
125:                this .boooleanField = booolean;
126:            }
127:
128:            public Byte getByyte() {
129:                return byyteField;
130:            }
131:
132:            public void setByyte(Byte byyte) {
133:                this .byyteField = byyte;
134:            }
135:
136:            public Character getChaaracter() {
137:                return chaaracterField;
138:            }
139:
140:            public void setChaaracter(Character chaaracter) {
141:                this .chaaracterField = chaaracter;
142:            }
143:
144:            public DataSource getDaataSource() {
145:                return daataSourceField;
146:            }
147:
148:            public void setDaataSource(DataSource daataSource) {
149:                this .daataSourceField = daataSource;
150:            }
151:
152:            public ConnectionFactory getCoonnectionFactory() {
153:                return coonnectionFactory;
154:            }
155:
156:            public void setCoonnectionFactory(
157:                    ConnectionFactory coonnectionFactory) {
158:                this .coonnectionFactory = coonnectionFactory;
159:            }
160:
161:            public QueueConnectionFactory getQueueCoonnectionFactory() {
162:                return queueCoonnectionFactory;
163:            }
164:
165:            public void setQueueCoonnectionFactory(
166:                    QueueConnectionFactory queueCoonnectionFactory) {
167:                this .queueCoonnectionFactory = queueCoonnectionFactory;
168:            }
169:
170:            public TopicConnectionFactory getTopicCoonnectionFactory() {
171:                return topicCoonnectionFactory;
172:            }
173:
174:            public void setTopicCoonnectionFactory(
175:                    TopicConnectionFactory topicCoonnectionFactory) {
176:                this .topicCoonnectionFactory = topicCoonnectionFactory;
177:            }
178:
179:            public Double getDoouble() {
180:                return dooubleField;
181:            }
182:
183:            public void setDoouble(Double doouble) {
184:                this .dooubleField = doouble;
185:            }
186:
187:            public EntityManager getEem() {
188:                return eemField;
189:            }
190:
191:            public void setEem(EntityManager eem) {
192:                this .eemField = eem;
193:            }
194:
195:            public SessionContext getEjbContext() {
196:                return ejbContextField;
197:            }
198:
199:            public void setEjbContext(SessionContext ejbContext) {
200:                this .ejbContextField = ejbContext;
201:            }
202:
203:            public EntityManager getEm() {
204:                return emField;
205:            }
206:
207:            public void setEm(EntityManager em) {
208:                this .emField = em;
209:            }
210:
211:            public EntityManagerFactory getEmf() {
212:                return emfField;
213:            }
214:
215:            public void setEmf(EntityManagerFactory emf) {
216:                this .emfField = emf;
217:            }
218:
219:            public Float getFlooat() {
220:                return flooatField;
221:            }
222:
223:            public void setFlooat(Float flooat) {
224:                this .flooatField = flooat;
225:            }
226:
227:            public Integer getInteeger() {
228:                return inteegerField;
229:            }
230:
231:            public void setInteeger(Integer inteeger) {
232:                this .inteegerField = inteeger;
233:            }
234:
235:            public Long getLoong() {
236:                return loongField;
237:            }
238:
239:            public void setLoong(Long loong) {
240:                this .loongField = loong;
241:            }
242:
243:            public EntityManager getPem() {
244:                return pemField;
245:            }
246:
247:            public void setPem(EntityManager pem) {
248:                this .pemField = pem;
249:            }
250:
251:            public Short getShoort() {
252:                return shoortField;
253:            }
254:
255:            public void setShoort(Short shoort) {
256:                this .shoortField = shoort;
257:            }
258:
259:            public BasicStatefulHome getStatefulHome() {
260:                return statefulHomeField;
261:            }
262:
263:            public void setStatefulHome(BasicStatefulHome statefulHome) {
264:                this .statefulHomeField = statefulHome;
265:            }
266:
267:            public BasicStatelessHome getStatelessHome() {
268:                return statelessHomeField;
269:            }
270:
271:            public void setStatelessHome(BasicStatelessHome statelessHome) {
272:                this .statelessHomeField = statelessHome;
273:            }
274:
275:            public String getStriing() {
276:                return striingField;
277:            }
278:
279:            public void setStriing(String striing) {
280:                this .striingField = striing;
281:            }
282:
283:            public void ejbCreate() throws CreateException {
284:            }
285:
286:            public void lookupEntityBean() throws TestFailureException {
287:                try {
288:                    Assert.assertNotNull("The EJBObject is null", bmpHomeField);
289:                } catch (AssertionFailedError afe) {
290:                    throw new TestFailureException(afe);
291:                }
292:            }
293:
294:            public void lookupStatefulBean() throws TestFailureException {
295:                try {
296:                    Assert.assertNotNull("The EJBObject is null",
297:                            statefulHomeField);
298:                } catch (AssertionFailedError afe) {
299:                    throw new TestFailureException(afe);
300:                }
301:            }
302:
303:            public void lookupStatelessBean() throws TestFailureException {
304:                try {
305:                    Assert.assertNotNull("The EJBObject is null",
306:                            statelessHomeField);
307:                } catch (AssertionFailedError afe) {
308:                    throw new TestFailureException(afe);
309:                }
310:            }
311:
312:            public void lookupStatelessBusinessLocal()
313:                    throws TestFailureException {
314:                try {
315:                    Assert.assertNotNull("The EJB BusinessLocal is null",
316:                            statelessBusinessLocalField);
317:                } catch (AssertionFailedError afe) {
318:                    throw new TestFailureException(afe);
319:                }
320:            }
321:
322:            public void lookupStatelessBusinessRemote()
323:                    throws TestFailureException {
324:                try {
325:                    Assert.assertNotNull("The EJB BusinessRemote is null",
326:                            statelessBusinessRemoteField);
327:                } catch (AssertionFailedError afe) {
328:                    throw new TestFailureException(afe);
329:                }
330:            }
331:
332:            public void lookupStatefulBusinessLocal()
333:                    throws TestFailureException {
334:                try {
335:                    Assert.assertNotNull("The EJB BusinessLocal is null",
336:                            statefulBusinessLocalField);
337:                } catch (AssertionFailedError afe) {
338:                    throw new TestFailureException(afe);
339:                }
340:            }
341:
342:            public void lookupStatefulBusinessRemote()
343:                    throws TestFailureException {
344:                try {
345:                    Assert.assertNotNull("The EJB BusinessRemote is null",
346:                            statefulBusinessRemoteField);
347:                } catch (AssertionFailedError afe) {
348:                    throw new TestFailureException(afe);
349:                }
350:            }
351:
352:            public void lookupStringEntry() throws TestFailureException {
353:                try {
354:                    String expected = new String("1");
355:                    Assert.assertNotNull("The String looked up is null",
356:                            striingField);
357:                    Assert.assertEquals(expected, striingField);
358:                } catch (AssertionFailedError afe) {
359:                    throw new TestFailureException(afe);
360:                }
361:            }
362:
363:            public void lookupDoubleEntry() throws TestFailureException {
364:                try {
365:                    Double expected = new Double(1.0D);
366:
367:                    Assert.assertNotNull("The Double looked up is null",
368:                            dooubleField);
369:                    Assert.assertEquals(expected, dooubleField);
370:
371:                } catch (AssertionFailedError afe) {
372:                    throw new TestFailureException(afe);
373:                }
374:            }
375:
376:            public void lookupLongEntry() throws TestFailureException {
377:                try {
378:                    Long expected = new Long(1L);
379:
380:                    Assert.assertNotNull("The Long looked up is null",
381:                            loongField);
382:                    Assert.assertEquals(expected, loongField);
383:                } catch (AssertionFailedError afe) {
384:                    throw new TestFailureException(afe);
385:                }
386:            }
387:
388:            public void lookupFloatEntry() throws TestFailureException {
389:                try {
390:                    Float expected = new Float(1.0F);
391:
392:                    Assert.assertNotNull("The Float looked up is null",
393:                            flooatField);
394:                    Assert.assertEquals(expected, flooatField);
395:                } catch (AssertionFailedError afe) {
396:                    throw new TestFailureException(afe);
397:                }
398:            }
399:
400:            public void lookupIntegerEntry() throws TestFailureException {
401:                try {
402:                    Integer expected = new Integer(1);
403:
404:                    Assert.assertNotNull("The Integer looked up is null",
405:                            inteegerField);
406:                    Assert.assertEquals(expected, inteegerField);
407:
408:                } catch (AssertionFailedError afe) {
409:                    throw new TestFailureException(afe);
410:                }
411:            }
412:
413:            public void lookupShortEntry() throws TestFailureException {
414:                try {
415:                    Short expected = new Short((short) 1);
416:
417:                    Assert.assertNotNull("The Short looked up is null",
418:                            shoortField);
419:                    Assert.assertEquals(expected, shoortField);
420:                } catch (AssertionFailedError afe) {
421:                    throw new TestFailureException(afe);
422:                }
423:            }
424:
425:            public void lookupBooleanEntry() throws TestFailureException {
426:                try {
427:                    Boolean expected = new Boolean(true);
428:
429:                    Assert.assertNotNull("The Boolean looked up is null",
430:                            boooleanField);
431:                    Assert.assertEquals(expected, boooleanField);
432:                } catch (AssertionFailedError afe) {
433:                    throw new TestFailureException(afe);
434:                }
435:            }
436:
437:            public void lookupByteEntry() throws TestFailureException {
438:                try {
439:                    Byte expected = new Byte((byte) 1);
440:
441:                    Assert.assertNotNull("The Byte looked up is null",
442:                            byyteField);
443:                    Assert.assertEquals(expected, byyteField);
444:                } catch (AssertionFailedError afe) {
445:                    throw new TestFailureException(afe);
446:                }
447:            }
448:
449:            public void lookupCharacterEntry() throws TestFailureException {
450:                try {
451:                    Character expected = new Character('D');
452:
453:                    Assert.assertNotNull("The Character looked up is null",
454:                            chaaracterField);
455:                    Assert.assertEquals(expected, chaaracterField);
456:                } catch (AssertionFailedError afe) {
457:                    throw new TestFailureException(afe);
458:                }
459:            }
460:
461:            public void lookupResource() throws TestFailureException {
462:                try {
463:                    Assert.assertNotNull("The DataSource is null",
464:                            daataSourceField);
465:                } catch (AssertionFailedError afe) {
466:                    throw new TestFailureException(afe);
467:                }
468:            }
469:
470:            public void lookupJMSConnectionFactory()
471:                    throws TestFailureException {
472:                try {
473:                    try {
474:                        testJmsConnection(coonnectionFactory.createConnection());
475:                        testJmsConnection(queueCoonnectionFactory
476:                                .createConnection());
477:                        testJmsConnection(topicCoonnectionFactory
478:                                .createConnection());
479:                    } catch (Exception e) {
480:                        e.printStackTrace();
481:                        Assert.fail("Received Exception " + e.getClass()
482:                                + " : " + e.getMessage());
483:                    }
484:                } catch (AssertionFailedError afe) {
485:                    throw new TestFailureException(afe);
486:                }
487:            }
488:
489:            private void testJmsConnection(javax.jms.Connection connection)
490:                    throws JMSException {
491:                Session session = connection.createSession(false,
492:                        Session.DUPS_OK_ACKNOWLEDGE);
493:                Topic topic = session.createTopic("test");
494:                MessageProducer producer = session.createProducer(topic);
495:                producer.send(session.createMessage());
496:                producer.close();
497:                session.close();
498:                connection.close();
499:            }
500:
501:            public void lookupPersistenceUnit() throws TestFailureException {
502:                try {
503:                    Assert.assertNotNull("The EntityManagerFactory is null",
504:                            emfField);
505:                } catch (AssertionFailedError afe) {
506:                    throw new TestFailureException(afe);
507:                }
508:            }
509:
510:            public void lookupPersistenceContext() throws TestFailureException {
511:                try {
512:                    Assert.assertNotNull("The EntityManager is null", emField);
513:
514:                    try {
515:                        // call a do nothing method to assure entity manager actually exists
516:                        emField.getFlushMode();
517:                    } catch (Exception e) {
518:                        Assert.fail("Received Exception " + e.getClass()
519:                                + " : " + e.getMessage());
520:                    }
521:                } catch (AssertionFailedError afe) {
522:                    throw new TestFailureException(afe);
523:                }
524:            }
525:
526:            public void lookupSessionContext() throws TestFailureException {
527:                try {
528:                    // TODO: DMB: Can't seem to find where to make this work
529:                    //            Assert.assertNotNull("The SessionContext is null", ejbContext);
530:                } catch (AssertionFailedError afe) {
531:                    throw new TestFailureException(afe);
532:                }
533:
534:            }
535:
536:            public void ejbActivate() throws EJBException, RemoteException {
537:            }
538:
539:            public void ejbPassivate() throws EJBException, RemoteException {
540:            }
541:
542:            public void ejbRemove() throws EJBException, RemoteException {
543:            }
544:
545:            public void setSessionContext(SessionContext sessionContext)
546:                    throws EJBException, RemoteException {
547:            }
548:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.