Source Code Cross Referenced for JmsTest.java in  » Web-Services » wsif » jms » 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 » Web Services » wsif » jms 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The Apache Software License, Version 1.1
003:         *
004:         *
005:         * Copyright (c) 2002 The Apache Software Foundation.  All rights 
006:         * reserved.
007:         *
008:         * Redistribution and use in source and binary forms, with or without
009:         * modification, are permitted provided that the following conditions
010:         * are met:
011:         *
012:         * 1. Redistributions of source code must retain the above copyright
013:         *    notice, this list of conditions and the following disclaimer. 
014:         *
015:         * 2. Redistributions in binary form must reproduce the above copyright
016:         *    notice, this list of conditions and the following disclaimer in
017:         *    the documentation and/or other materials provided with the
018:         *    distribution.
019:         *
020:         * 3. The end-user documentation included with the redistribution,
021:         *    if any, must include the following acknowledgment:  
022:         *       "This product includes software developed by the
023:         *        Apache Software Foundation (http://www.apache.org/)."
024:         *    Alternately, this acknowledgment may appear in the software itself,
025:         *    if and wherever such third-party acknowledgments normally appear.
026:         *
027:         * 4. The names "WSIF" and "Apache Software Foundation" must
028:         *    not be used to endorse or promote products derived from this
029:         *    software without prior written permission. For written 
030:         *    permission, please contact apache@apache.org.
031:         *
032:         * 5. Products derived from this software may not be called "Apache",
033:         *    nor may "Apache" appear in their name, without prior written
034:         *    permission of the Apache Software Foundation.
035:         *
036:         * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
037:         * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
038:         * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
039:         * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
040:         * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
041:         * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
042:         * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
043:         * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
044:         * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
045:         * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
046:         * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
047:         * SUCH DAMAGE.
048:         * ====================================================================
049:         *
050:         * This software consists of voluntary contributions made by many
051:         * individuals on behalf of the Apache Software Foundation and was
052:         * originally based on software copyright (c) 2001, 2002, International
053:         * Business Machines, Inc., http://www.apache.org.  For more
054:         * information on the Apache Software Foundation, please see
055:         * <http://www.apache.org/>.
056:         */
057:
058:        package jms;
059:
060:        import java.rmi.RemoteException;
061:        import java.text.DateFormat;
062:        import java.util.Date;
063:
064:        import javax.jms.DeliveryMode;
065:        import javax.xml.namespace.QName;
066:        import junit.framework.Test;
067:        import junit.framework.TestCase;
068:        import junit.framework.TestSuite;
069:
070:        import org.apache.wsif.WSIFException;
071:        import org.apache.wsif.WSIFService;
072:        import org.apache.wsif.WSIFServiceFactory;
073:        import org.apache.wsif.util.WSIFProperties;
074:        import util.AddressUtility;
075:        import util.TestUtilities;
076:
077:        import addressbook.wsifservice.AddressBook;
078:        import addressbook.wsiftypes.Address;
079:        import addressbook.wsiftypes.Phone;
080:
081:        /**
082:         * Junit test to do various JMS tests
083:         * @author Mark Whitlock
084:         */
085:        public class JmsTest extends TestCase {
086:            String wsdlLocation = TestUtilities.getWsdlPath("java\\test\\jms")
087:                    + "jms.wsdl";
088:            static String server = TestUtilities.getSoapServer().toUpperCase();
089:
090:            static String name = "Purdue Boilermaker";
091:            static Address addr = new Address(1, "University Drive",
092:                    "West Lafayette", "IN", 47907,
093:                    new Phone(765, "494", "4900"));
094:
095:            private final static String SOAP = "soap";
096:            private final static String AXIS = "axis";
097:            private final static String JAVA = "java";
098:            private final static String NJMS = "njms";
099:            private final static String REPLYTOQ = "AddressBookReplyTo";
100:            private final static int PERS = DeliveryMode.PERSISTENT;
101:            private final static int NPERS = DeliveryMode.NON_PERSISTENT;
102:            private final static String UP = "user properties";
103:            private final static String APV = "address property values";
104:            private final static String BPV = "binding property values";
105:            private final static String ABPV = "address and binding property values";
106:            private final static String UPV = "user properties values";
107:            private final static String OPV = "overiding property values";
108:            private final static String TO = "timeout";
109:
110:            private interface AddressBookWithAttrs extends AddressBook {
111:                public void addEntry(String name, Address address)
112:                        throws RemoteException;
113:
114:                public void addEntry(String name, Address address,
115:                        int deliveryMode) throws RemoteException;
116:
117:                public void addEntry(String name, Address address,
118:                        int priority, String replyTo, int deliveryMode,
119:                        long timeToLive) throws RemoteException;
120:
121:                public void addEntry(String name, Address address,
122:                        int deliveryMode, boolean boolUp, byte byteUp,
123:                        short shUp, int intUp, long loUp, float flUp,
124:                        double doUp, String strUp, Object obj)
125:                        throws RemoteException;
126:
127:                public Address getAddressFromName(String name)
128:                        throws RemoteException;
129:
130:                public Address getAddressFromName(String name, int deliveryMode)
131:                        throws RemoteException;
132:            }
133:
134:            public JmsTest(String name) {
135:                super (name);
136:            }
137:
138:            public static void main(String[] args) {
139:                TestUtilities.startListeners(TestUtilities.ADDRESSBOOK_LISTENER
140:                        | TestUtilities.NATIVEJMS_LISTENER);
141:
142:                junit.textui.TestRunner.run(suite());
143:                TestUtilities.stopListeners();
144:            }
145:
146:            public static Test suite() {
147:                return new TestSuite(JmsTest.class);
148:            }
149:
150:            public void setUp() {
151:                TestUtilities.setUpExtensionsAndProviders();
152:            }
153:
154:            /* *************** Start of SOAP tests ****************** */
155:
156:            public void testSoapDefault() {
157:                doit("default", SOAP, REPLYTOQ, 3, NPERS, 0, null);
158:            }
159:
160:            public void testSoapDefaultAlt() {
161:                doit("default-alt", SOAP, REPLYTOQ, 3, NPERS, 0, null);
162:            }
163:
164:            public void testSoapBadQcfMixQ() {
165:                doit("bad-qcfmixq", SOAP, REPLYTOQ, 3, NPERS, 0, null);
166:            }
167:
168:            public void testSoapBadMixQ() {
169:                doit("bad-mixq", SOAP, REPLYTOQ, 3, NPERS, 0, null);
170:            }
171:
172:            public void testSoapBadMixIcf() {
173:                doit("bad-mixicf", SOAP, REPLYTOQ, 3, NPERS, 0, null);
174:            }
175:
176:            public void testSoapBadQcf() {
177:                doit("bad-qcf", SOAP, REPLYTOQ, 3, NPERS, 0, null);
178:            }
179:
180:            public void testSoapBadQ() {
181:                doit("bad-queue", SOAP, REPLYTOQ, 3, NPERS, 0, null);
182:            }
183:
184:            public void testSoapBadAltQ() {
185:                doit("bad-altqueue", SOAP, REPLYTOQ, 3, NPERS, 0, null);
186:            }
187:
188:            public void testSoapBadStyle() {
189:                doit("bad-style", SOAP, REPLYTOQ, 3, NPERS, 0, null);
190:            }
191:
192:            public void testSoapBadIcf() {
193:                doit("bad-icf", SOAP, REPLYTOQ, 3, NPERS, 0, null);
194:            }
195:
196:            public void testSoapBadJurl() {
197:                doit("bad-jurl", SOAP, REPLYTOQ, 3, NPERS, 0, null);
198:            }
199:
200:            public void testSoapBadNoQ() {
201:                doit("bad-noq", SOAP, REPLYTOQ, 3, NPERS, 0, null);
202:            }
203:
204:            public void testSoapBadNoStyle() {
205:                doit("bad-nostyle", SOAP, REPLYTOQ, 3, NPERS, 0, null);
206:            }
207:
208:            public void testSoapBadNoQcf() {
209:                doit("bad-noqcf", SOAP, REPLYTOQ, 3, NPERS, 0, null);
210:            }
211:
212:            public void testSoapBadNoIcfJurl() {
213:                doit("bad-noicfjurl", SOAP, REPLYTOQ, 3, NPERS, 0, null);
214:            }
215:
216:            public void testSoapBadAltAndQ() {
217:                doit("bad-altandq", SOAP, REPLYTOQ, 3, NPERS, 0, null);
218:            }
219:
220:            public void testSoapBadTopic() {
221:                doit("bad-topic", SOAP, REPLYTOQ, 3, NPERS, 0, null);
222:            }
223:
224:            public void testSoapBadImplSpec() {
225:                doit("bad-implspec", SOAP, REPLYTOQ, 3, NPERS, 0, null);
226:            }
227:
228:            public void testSoapBadMqAndJndi() {
229:                doit("bad-mqandjndi", SOAP, REPLYTOQ, 3, NPERS, 0, null);
230:            }
231:
232:            public void testSoapBadNothing() {
233:                doit("bad-nothing", SOAP, REPLYTOQ, 3, NPERS, 0, null);
234:            }
235:
236:            public void testSoapBadNoBinding() {
237:                doit("bad-nobinding", SOAP, REPLYTOQ, 3, NPERS, 0, null);
238:            }
239:
240:            public void testSoapHttpNoAttrs() {
241:                doit(server + "-http-noattrs", SOAP, REPLYTOQ, 3, NPERS, 0,
242:                        null);
243:            }
244:
245:            public void testSoapNullReplyTo() {
246:                doit("default", SOAP, null, 3, NPERS, 0, null);
247:            }
248:
249:            public void testSoapShortReplyTo() {
250:                doit("default", SOAP, "", 3, NPERS, 0, null);
251:            }
252:
253:            public void testSoapBadReplyTo() {
254:                doit("baddefault", SOAP, "trash", 3, NPERS, 0, null);
255:            }
256:
257:            public void testSoapZeroPriority() {
258:                doit("default", SOAP, REPLYTOQ, 0, NPERS, 0, null);
259:            }
260:
261:            public void testSoapNegPriority() {
262:                doit("baddefault", SOAP, REPLYTOQ, -1, NPERS, 0, null);
263:            }
264:
265:            public void testSoapBigPriority() {
266:                doit("baddefault", SOAP, REPLYTOQ, 57, NPERS, 0, null);
267:            }
268:
269:            public void testSoapPersistent() {
270:                doit("default", SOAP, REPLYTOQ, 3, PERS, 0, null);
271:            }
272:
273:            public void testSoapBadPers() {
274:                doit("bad-persist", SOAP, REPLYTOQ, 3, PERS, 0, null);
275:            }
276:
277:            public void testSoapNonPers() {
278:                doit("nonpersist", SOAP, REPLYTOQ, 3, NPERS, 0, null);
279:            }
280:
281:            public void testSoapUserProp() {
282:                doit("default", SOAP, REPLYTOQ, 3, NPERS, 0, UP);
283:            }
284:
285:            public void testSoapAddrPrVals() {
286:                doit("addrpv", SOAP, REPLYTOQ, 3, PERS, 0, APV);
287:            }
288:
289:            public void testSoapBindPrVals() {
290:                doit("bindpv", SOAP, REPLYTOQ, 3, PERS, 0, BPV);
291:            }
292:
293:            //    public void testSoapAdBiPrVals() {
294:            //        doit("adbipv", SOAP, REPLYTOQ, 3, PERS, 0, ABPV);
295:            //    }
296:            //    public void testSoapOvAdBiPrVals() {
297:            //        doit("ovpv", SOAP, REPLYTOQ, 3, PERS, 0, OPV);
298:            //    }
299:            //    public void testSoapUserPrVals() {
300:            //        doit("userpv", SOAP, REPLYTOQ, 3, NPERS, 0, UPV);
301:            //    }
302:            //    public void testSoapBadPVNoName() {
303:            //        doit("bad-pvnoname", SOAP, REPLYTOQ, 3, NPERS, 0, APV);
304:            //    }
305:
306:            public void testSoapTimeout() {
307:                doit("timeout", SOAP, REPLYTOQ, 3, NPERS, 0, TO);
308:            }
309:
310:            /* ********** Start of AXIS tests ************ */
311:
312:            public void testAxisDefault() {
313:                doit("default", AXIS, REPLYTOQ, 3, NPERS, 0, null);
314:            }
315:
316:            public void testAxisDefaultAlt() {
317:                doit("default-alt", AXIS, REPLYTOQ, 3, NPERS, 0, null);
318:            }
319:
320:            public void testAxisBadQcfMixQ() {
321:                doit("bad-qcfmixq", AXIS, REPLYTOQ, 3, NPERS, 0, null);
322:            }
323:
324:            public void testAxisBadMixQ() {
325:                doit("bad-mixq", AXIS, REPLYTOQ, 3, NPERS, 0, null);
326:            }
327:
328:            public void testAxisBadMixIcf() {
329:                doit("bad-mixicf", AXIS, REPLYTOQ, 3, NPERS, 0, null);
330:            }
331:
332:            public void testAxisBadQcf() {
333:                doit("bad-qcf", AXIS, REPLYTOQ, 3, NPERS, 0, null);
334:            }
335:
336:            public void testAxisBadQ() {
337:                doit("bad-queue", AXIS, REPLYTOQ, 3, NPERS, 0, null);
338:            }
339:
340:            public void testAxisBadAltQ() {
341:                doit("bad-altqueue", AXIS, REPLYTOQ, 3, NPERS, 0, null);
342:            }
343:
344:            public void testAxisBadStyle() {
345:                doit("bad-style", AXIS, REPLYTOQ, 3, NPERS, 0, null);
346:            }
347:
348:            public void testAxisBadIcf() {
349:                doit("bad-icf", AXIS, REPLYTOQ, 3, NPERS, 0, null);
350:            }
351:
352:            public void testAxisBadJurl() {
353:                doit("bad-jurl", AXIS, REPLYTOQ, 3, NPERS, 0, null);
354:            }
355:
356:            public void testAxisBadNoQ() {
357:                doit("bad-noq", AXIS, REPLYTOQ, 3, NPERS, 0, null);
358:            }
359:
360:            public void testAxisBadNoStyle() {
361:                doit("bad-nostyle", AXIS, REPLYTOQ, 3, NPERS, 0, null);
362:            }
363:
364:            public void testAxisBadNoQcf() {
365:                doit("bad-noqcf", AXIS, REPLYTOQ, 3, NPERS, 0, null);
366:            }
367:
368:            public void testAxisBadNoIcfJurl() {
369:                doit("bad-noicfjurl", AXIS, REPLYTOQ, 3, NPERS, 0, null);
370:            }
371:
372:            public void testAxisBadAltAndQ() {
373:                doit("bad-altandq", AXIS, REPLYTOQ, 3, NPERS, 0, null);
374:            }
375:
376:            public void testAxisBadTopic() {
377:                doit("bad-topic", AXIS, REPLYTOQ, 3, NPERS, 0, null);
378:            }
379:
380:            public void testAxisBadImplSpec() {
381:                doit("bad-implspec", AXIS, REPLYTOQ, 3, NPERS, 0, null);
382:            }
383:
384:            public void testAxisBadMqAndJndi() {
385:                doit("bad-mqandjndi", AXIS, REPLYTOQ, 3, NPERS, 0, null);
386:            }
387:
388:            public void testAxisBadNothing() {
389:                doit("bad-nothing", AXIS, REPLYTOQ, 3, NPERS, 0, null);
390:            }
391:
392:            public void testAxisBadNoBinding() {
393:                doit("bad-nobinding", AXIS, REPLYTOQ, 3, NPERS, 0, null);
394:            }
395:
396:            public void testAxisHttpNoAttrs() {
397:                doit(server + "-http-noattrs", AXIS, REPLYTOQ, 3, NPERS, 0,
398:                        null);
399:            }
400:
401:            public void testAxisNullReplyTo() {
402:                doit("default", AXIS, null, 3, NPERS, 0, null);
403:            }
404:
405:            public void testAxisShortReplyTo() {
406:                doit("default", AXIS, "", 3, NPERS, 0, null);
407:            }
408:
409:            public void testAxisBadReplyTo() {
410:                doit("baddefault", AXIS, "trash", 3, NPERS, 0, null);
411:            }
412:
413:            public void testAxisZeroPriority() {
414:                doit("default", AXIS, REPLYTOQ, 0, NPERS, 0, null);
415:            }
416:
417:            public void testAxisNegPriority() {
418:                doit("baddefault", AXIS, REPLYTOQ, -1, NPERS, 0, null);
419:            }
420:
421:            public void testAxisBigPriority() {
422:                doit("baddefault", AXIS, REPLYTOQ, 57, NPERS, 0, null);
423:            }
424:
425:            public void testAxisPersistent() {
426:                doit("default", AXIS, REPLYTOQ, 3, PERS, 0, null);
427:            }
428:
429:            public void testAxisBadPers() {
430:                doit("bad-persist", AXIS, REPLYTOQ, 3, PERS, 0, null);
431:            }
432:
433:            public void testAxisNonPers() {
434:                doit("nonpersist", AXIS, REPLYTOQ, 3, NPERS, 0, null);
435:            }
436:
437:            public void testAxisUserProp() {
438:                doit("default", AXIS, REPLYTOQ, 3, NPERS, 0, UP);
439:            }
440:
441:            public void testAxisAddrPrVals() {
442:                doit("addrpv", AXIS, REPLYTOQ, 3, PERS, 0, APV);
443:            }
444:
445:            public void testAxisBindPrVals() {
446:                doit("bindpv", AXIS, REPLYTOQ, 3, PERS, 0, BPV);
447:            }
448:
449:            public void testAxisTimeout() {
450:                doit("timeout", AXIS, REPLYTOQ, 3, NPERS, 0, TO);
451:            }
452:
453:            /* ********** Start of Native JMS tests ************ */
454:
455:            public void testNativeJMSDefault() {
456:                doit("NJdefault", NJMS, REPLYTOQ, 3, NPERS, 0, null);
457:            }
458:
459:            public void testNativeJMSDefaultAlt() {
460:                doit("NJdefault-alt", NJMS, REPLYTOQ, 3, NPERS, 0, null);
461:            }
462:
463:            public void testNativeJMSBadQcfMixQ() {
464:                doit("NJbad-qcfmixq", NJMS, REPLYTOQ, 3, NPERS, 0, null);
465:            }
466:
467:            public void testNativeJMSBadMixQ() {
468:                doit("NJbad-mixq", NJMS, REPLYTOQ, 3, NPERS, 0, null);
469:            }
470:
471:            public void testNativeJMSBadMixIcf() {
472:                doit("NJbad-mixicf", NJMS, REPLYTOQ, 3, NPERS, 0, null);
473:            }
474:
475:            public void testNativeJMSBadQcf() {
476:                doit("NJbad-qcf", NJMS, REPLYTOQ, 3, NPERS, 0, null);
477:            }
478:
479:            public void testNativeJMSBadQ() {
480:                doit("NJbad-queue", NJMS, REPLYTOQ, 3, NPERS, 0, null);
481:            }
482:
483:            public void testNativeJMSBadAltQ() {
484:                doit("NJbad-altqueue", NJMS, REPLYTOQ, 3, NPERS, 0, null);
485:            }
486:
487:            public void testNativeJMSBadStyle() {
488:                doit("NJbad-style", NJMS, REPLYTOQ, 3, NPERS, 0, null);
489:            }
490:
491:            public void testNativeJMSBadIcf() {
492:                doit("NJbad-icf", NJMS, REPLYTOQ, 3, NPERS, 0, null);
493:            }
494:
495:            public void testNativeJMSBadJurl() {
496:                doit("NJbad-jurl", NJMS, REPLYTOQ, 3, NPERS, 0, null);
497:            }
498:
499:            public void testNativeJMSBadNoQ() {
500:                doit("NJbad-noq", NJMS, REPLYTOQ, 3, NPERS, 0, null);
501:            }
502:
503:            public void testNativeJMSBadNoStyle() {
504:                doit("NJbad-nostyle", NJMS, REPLYTOQ, 3, NPERS, 0, null);
505:            }
506:
507:            public void testNativeJMSBadNoQcf() {
508:                doit("NJbad-noqcf", NJMS, REPLYTOQ, 3, NPERS, 0, null);
509:            }
510:
511:            public void testNativeJMSBadNoIcfJurl() {
512:                doit("NJbad-noicfjurl", NJMS, REPLYTOQ, 3, NPERS, 0, null);
513:            }
514:
515:            public void testNativeJMSBadAltAndQ() {
516:                doit("NJbad-altandq", NJMS, REPLYTOQ, 3, NPERS, 0, null);
517:            }
518:
519:            public void testNativeJMSBadTopic() {
520:                doit("NJbad-topic", NJMS, REPLYTOQ, 3, NPERS, 0, null);
521:            }
522:
523:            public void testNativeJMSBadImplSpec() {
524:                doit("NJbad-implspec", NJMS, REPLYTOQ, 3, NPERS, 0, null);
525:            }
526:
527:            public void testNativeJMSBadMqAndJndi() {
528:                doit("NJbad-mqandjndi", NJMS, REPLYTOQ, 3, NPERS, 0, null);
529:            }
530:
531:            public void testNativeJMSBadNothing() {
532:                doit("NJbad-nothing", NJMS, REPLYTOQ, 3, NPERS, 0, null);
533:            }
534:
535:            public void testNativeJMSBadNoBinding() {
536:                doit("NJbad-nobinding", NJMS, REPLYTOQ, 3, NPERS, 0, null);
537:            }
538:
539:            public void testNativeJMSNullReplyTo() {
540:                doit("NJdefault", NJMS, null, 3, NPERS, 0, null);
541:            }
542:
543:            public void testNativeJMSShortReplyTo() {
544:                doit("NJdefault", NJMS, "", 3, NPERS, 0, null);
545:            }
546:
547:            public void testNativeJMSBadReplyTo() {
548:                doit("NJbaddefault", NJMS, "trash", 3, NPERS, 0, null);
549:            }
550:
551:            public void testNativeJMSZeroPriority() {
552:                doit("NJdefault", NJMS, REPLYTOQ, 0, NPERS, 0, null);
553:            }
554:
555:            public void testNativeJMSNegPriority() {
556:                doit("NJbaddefault", NJMS, REPLYTOQ, -1, NPERS, 0, null);
557:            }
558:
559:            public void testNativeJMSBigPriority() {
560:                doit("NJbaddefault", NJMS, REPLYTOQ, 57, NPERS, 0, null);
561:            }
562:
563:            public void testNativeJMSPersistent() {
564:                doit("NJdefault", NJMS, REPLYTOQ, 3, PERS, 0, null);
565:            }
566:
567:            public void testNativeJMSBadPers() {
568:                doit("NJbad-persist", NJMS, REPLYTOQ, 3, PERS, 0, null);
569:            }
570:
571:            //	public void testNativeJMSNonPers() { TODO - doesn't work!
572:            //		doit("NJnonpersist", NJMS, REPLYTOQ, 3, NPERS, 0, null);
573:            //	}
574:            public void testNativeJMSUserProp() {
575:                doit("NJdefault", NJMS, REPLYTOQ, 3, NPERS, 0, UP);
576:            }
577:
578:            public void testNativeJMSAddrPrVals() {
579:                doit("NJaddrpv", NJMS, REPLYTOQ, 3, PERS, 0, APV);
580:            }
581:
582:            public void testNativeJMSBindPrVals() {
583:                doit("NJbindpv", NJMS, REPLYTOQ, 3, PERS, 0, BPV);
584:            }
585:
586:            public void testNativeJMSTimeout() {
587:                doit("NJtimeout", NJMS, REPLYTOQ, 3, NPERS, 0, TO);
588:            }
589:
590:            public void testJavaNoAttrs() {
591:                doit("java-noattrs", JAVA, null, 3, NPERS, 0, null);
592:            }
593:
594:            private void doit(String portName, String protocol, String replyTo,
595:                    int priority, int deliveryMode, long timeToLive, String cmd) {
596:
597:                if (!TestUtilities.areWeTesting("jms"))
598:                    return;
599:
600:                TestUtilities.setProviderForProtocol(protocol);
601:
602:                boolean ExceptionExpected = (portName.indexOf("bad") != -1);
603:
604:                try {
605:                    WSIFServiceFactory factory = WSIFServiceFactory
606:                            .newInstance();
607:                    WSIFService service = factory.getService(wsdlLocation,
608:                            null, null, "http://wsifservice.addressbook/",
609:                            "AddressBook");
610:
611:                    service.mapType(new QName("http://wsiftypes.addressbook/",
612:                            "zero"), jms.NumberZero.class);
613:
614:                    AddressBookWithAttrs stub = (AddressBookWithAttrs) service
615:                            .getStub(portName, AddressBookWithAttrs.class);
616:
617:                    if ("timeout".equals(cmd))
618:                        doTimeout(stub, deliveryMode);
619:                    else {
620:                        if (cmd == null)
621:                            stub.addEntry(name, addr, priority, replyTo,
622:                                    deliveryMode, timeToLive);
623:                        else
624:                            doProperties(stub, cmd, deliveryMode);
625:
626:                        Address resp = stub.getAddressFromName(name,
627:                                deliveryMode);
628:                        assertTrue(new AddressUtility(resp).equals(addr));
629:                    }
630:                    assertTrue(!ExceptionExpected);
631:                } catch (Exception e) {
632:                    System.err.println("JmsTest(" + portName
633:                            + ") caught exception " + e);
634:                    if (!ExceptionExpected || !(e instanceof  WSIFException))
635:                        e.printStackTrace();
636:                    assertTrue(ExceptionExpected && e instanceof  WSIFException);
637:                } finally {
638:                    TestUtilities.resetDefaultProviders();
639:                }
640:            }
641:
642:            private void doProperties(AddressBookWithAttrs stub, String cmd,
643:                    int deliveryMode) throws Exception {
644:
645:                if (UP.equals(cmd)) {
646:                    byte b = 52;
647:                    short s = 53;
648:                    int i = 54;
649:                    long l = 55;
650:                    float f = 56.57F;
651:                    double d = 58.59D;
652:                    stub.addEntry(name, addr, deliveryMode, true, b, s, i, l,
653:                            f, d, "60 through 67", new NumberZero());
654:                } else if (APV.equals(cmd) || BPV.equals(cmd)
655:                        || ABPV.equals(cmd) || UPV.equals(cmd)) {
656:                    stub.addEntry(name, addr, deliveryMode);
657:                } else
658:                    assertTrue(false);
659:            }
660:
661:            /**
662:             * This test only tests out synchronous timeouts. Asynchronous timeouts
663:             * are the responsibility of the application since it is the application
664:             * that does the listen or receive for the response message. The asynchronous
665:             * timeout in wsif.properties is also used by the correlation service,
666:             * but this is tested in a separate unit test.
667:             */
668:            private void doTimeout(AddressBookWithAttrs stub, int deliveryMode)
669:                    throws Exception {
670:
671:                boolean caught = false;
672:                Date first = new Date();
673:                try {
674:                    stub.addEntry(name, addr, deliveryMode);
675:                } catch (WSIFException we) {
676:                    System.out.println("Caught expected " + we);
677:                    caught = true;
678:                }
679:                assertTrue(caught);
680:                Date second = new Date();
681:
682:                DateFormat df = DateFormat.getDateTimeInstance();
683:                System.out.println("first date was " + df.format(first));
684:                System.out.println("second date was " + df.format(second));
685:
686:                // getTime() returns milliseconds.
687:                long firstTime = first.getTime();
688:                long secondTime = second.getTime();
689:                System.out.println("first time was " + firstTime);
690:                System.out.println("second time was " + secondTime);
691:
692:                long timeout = WSIFProperties.getSyncTimeout();
693:                assertTrue(firstTime < secondTime);
694:                assertTrue((secondTime - firstTime) > timeout);
695:                assertTrue((secondTime - firstTime) < (timeout * 2));
696:            }
697:
698:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.