Source Code Cross Referenced for TestEngineSubsites.java in  » Web-Framework » rife-1.6.1 » com » uwyn » rife » engine » 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 Framework » rife 1.6.1 » com.uwyn.rife.engine 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
003:         * Distributed under the terms of either:
004:         * - the common development and distribution license (CDDL), v1.0; or
005:         * - the GNU Lesser General Public License, v2.1 or later
006:         * $Id: TestEngineSubsites.java 3634 2007-01-08 21:42:24Z gbevin $
007:         */
008:        package com.uwyn.rife.engine;
009:
010:        import com.meterware.httpunit.GetMethodWebRequest;
011:        import com.meterware.httpunit.WebConversation;
012:        import com.meterware.httpunit.WebRequest;
013:        import com.meterware.httpunit.WebResponse;
014:        import com.uwyn.rife.TestCaseServerside;
015:        import java.net.InetAddress;
016:
017:        public class TestEngineSubsites extends TestCaseServerside {
018:            public TestEngineSubsites(int siteType, String name) {
019:                super (siteType, name);
020:            }
021:
022:            public void testGlobalVarsOverriddenBySubsite() throws Exception {
023:                setupSite("site/subsites.xml");
024:                WebConversation conversation = new WebConversation();
025:                WebRequest request = null;
026:                WebResponse response = null;
027:
028:                request = new GetMethodWebRequest(
029:                        "http://localhost:8181/globalvar/overridden/globalvar");
030:                response = conversation.getResponse(request);
031:                assertEquals("parent1", response.getText());
032:
033:                request = new GetMethodWebRequest(
034:                        "http://localhost:8181/globalvar/overridden/globalvar");
035:                request.setParameter("globalvar1", "request value1");
036:                response = conversation.getResponse(request);
037:                assertEquals("request value1|subsite value2|", response
038:                        .getText());
039:
040:                request = new GetMethodWebRequest(
041:                        "http://localhost:8181/globalvar/overridden/globalvar");
042:                request.setParameter("globalvar1", "request value1");
043:                request.setParameter("globalvar2", "request value2");
044:                request.setParameter("globalvar3", "request value3");
045:                response = conversation.getResponse(request);
046:                assertEquals("request value1|request value2|request value3",
047:                        response.getText());
048:            }
049:
050:            public void testGlobalVarsDefaultTriggeredChild() throws Exception {
051:                setupSite("site/subsites.xml");
052:                WebConversation conversation = new WebConversation();
053:                WebRequest request = null;
054:                WebResponse response = null;
055:
056:                request = new GetMethodWebRequest(
057:                        "http://localhost:8181/globalvar/defaulttriggeredchild/globalvar");
058:                response = conversation.getResponse(request);
059:                assertEquals("default value1|default value2|subsite value3",
060:                        response.getText());
061:
062:                request = new GetMethodWebRequest(
063:                        "http://localhost:8181/globalvar/defaulttriggeredchild/globalvar");
064:                request.setParameter("globalvar1", "request value1");
065:                request.setParameter("globalvar2", "request value2");
066:                request.setParameter("globalvar3", "request value3");
067:                response = conversation.getResponse(request);
068:                assertEquals("request value1|request value2|request value3",
069:                        response.getText());
070:            }
071:
072:            public void testGlobalVarsStraightToSubsite() throws Exception {
073:                setupSite("site/subsites.xml");
074:                WebConversation conversation = new WebConversation();
075:                WebRequest request = null;
076:                WebResponse response = null;
077:
078:                request = new GetMethodWebRequest(
079:                        "http://localhost:8181/globalvar/straight/globalvar");
080:                response = conversation.getResponse(request);
081:                assertEquals("default value1|default value2||subsite value4",
082:                        response.getText());
083:
084:                request = new GetMethodWebRequest(
085:                        "http://localhost:8181/globalvar/straight/globalvar");
086:                request.setParameter("globalvar1", "request value1");
087:                request.setParameter("globalvar2", "request value2");
088:                request.setParameter("globalvar3", "request value3");
089:                request.setParameter("globalvar4", "request value4");
090:                response = conversation.getResponse(request);
091:                assertEquals(
092:                        "request value1|request value2|request value3|request value4",
093:                        response.getText());
094:            }
095:
096:            public void testGlobalDestDataLinking() throws Exception {
097:                setupSite("site/subsites.xml");
098:                WebConversation conversation = new WebConversation();
099:                WebRequest request = null;
100:                WebResponse response = null;
101:
102:                // here data is provided to the destination through the outputs of the source
103:                request = new GetMethodWebRequest(
104:                        "http://localhost:8181/globalexit/isolation/globaldestsource");
105:                request.setParameter("globalvar1", "request value1");
106:                request.setParameter("sourceinput1", "request value1 dest1");
107:                response = conversation.getResponse(request);
108:                assertEquals(
109:                        "globaldest1-request value1|default value2|-request value1 dest1|default input value 2|default output value 3",
110:                        response.getText());
111:
112:                // no data is provided at all to the destination and thus only global vars are available
113:                request = new GetMethodWebRequest(
114:                        "http://localhost:8181/globalexit/isolation/globaldestsource");
115:                request.setParameter("globalvar1", "request value1");
116:                request.setParameter("sourceinput1", "request value1 dest2");
117:                response = conversation.getResponse(request);
118:                assertEquals("globaldest2-request value1|default value2|-||",
119:                        response.getText());
120:            }
121:
122:            /**
123:             * Test a global exit that links to a subsite with an arrival element
124:             */
125:            public void testGlobalDestArrival() throws Exception {
126:                setupSite("site/subsites.xml");
127:                WebConversation conversation = new WebConversation();
128:                WebRequest request = null;
129:                WebResponse response = null;
130:
131:                // toplevel site
132:                request = new GetMethodWebRequest(
133:                        "http://localhost:8181/globalexit/arrival");
134:                response = conversation.getResponse(request);
135:                assertEquals("null" + "null" + "/globalexit/arrival"
136:                        + "arrival", response.getText());
137:
138:                // subsite
139:                request = new GetMethodWebRequest(
140:                        "http://localhost:8181/globalexit/straight/globaldestsource");
141:                request.setParameter("exitselector", "arrival");
142:                response = conversation.getResponse(request);
143:                assertEquals("null" + "null"
144:                        + "/globalexit/straight/globaldestsource" + "arrival",
145:                        response.getText());
146:            }
147:
148:            /**
149:             * Tests a global exit that's only defined in the subsite and not in the parent
150:             **/
151:            public void testGlobalDestIsolation() throws Exception {
152:                setupSite("site/subsites.xml");
153:                WebConversation conversation = new WebConversation();
154:                WebRequest request = null;
155:                WebResponse response = null;
156:
157:                request = new GetMethodWebRequest(
158:                        "http://localhost:8181/globalexit/isolation/globaldestsource");
159:                request.setParameter("globalvar1", "request value1");
160:                request.setParameter("sourceinput1", "request value1 dest3");
161:                response = conversation.getResponse(request);
162:                assertEquals(
163:                        "globaldesttargetfirst-request value1|subsite value2|-||",
164:                        response.getText());
165:            }
166:
167:            // subsites aren't able to override the global exit target by defining elements with the same id
168:            // globalvar is thus also not passed along since the target element lies in a different scope
169:            public void testGlobalDestRemainsInitialDefinition()
170:                    throws Exception {
171:                setupSite("site/subsites.xml");
172:                WebConversation conversation = new WebConversation();
173:                WebRequest request = null;
174:                WebResponse response = null;
175:
176:                request = new GetMethodWebRequest(
177:                        "http://localhost:8181/globalexit/overloading/globaldestsource");
178:                request.setParameter("exitselector", "1");
179:                response = conversation.getResponse(request);
180:                assertEquals("globaldest1-default value1|default value2|-||",
181:                        response.getText());
182:
183:                request = new GetMethodWebRequest(
184:                        "http://localhost:8181/globalexit/overloading/globaldestsource");
185:                request.setParameter("exitselector", "2");
186:                response = conversation.getResponse(request);
187:                assertEquals("globaldest2-default value1|default value2|-||",
188:                        response.getText());
189:            }
190:
191:            public void testGlobalDestStraightToSubsite() throws Exception {
192:                setupSite("site/subsites.xml");
193:                WebConversation conversation = new WebConversation();
194:                WebRequest request = null;
195:                WebResponse response = null;
196:
197:                request = new GetMethodWebRequest(
198:                        "http://localhost:8181/globalexit/straight/globaldestsource");
199:                request.setParameter("exitselector", "1");
200:                response = conversation.getResponse(request);
201:                assertEquals("globaldest1-default value1|default value2|-||",
202:                        response.getText());
203:
204:                request = new GetMethodWebRequest(
205:                        "http://localhost:8181/globalexit/straight/globaldestsource");
206:                request.setParameter("exitselector", "2");
207:                response = conversation.getResponse(request);
208:                assertEquals("globaldest2-default value1|default value2|-||",
209:                        response.getText());
210:
211:                request = new GetMethodWebRequest(
212:                        "http://localhost:8181/globalexit/straight/globaldestsource");
213:                request.setParameter("exitselector", "3");
214:                response = conversation.getResponse(request);
215:                assertEquals(
216:                        "subsite3-globaldesttarget1-default value1|default value2|",
217:                        response.getText());
218:            }
219:
220:            public void testAbsoluteExit() throws Exception {
221:                setupSite("site/subsites.xml");
222:                WebConversation conversation = new WebConversation();
223:                WebRequest request = null;
224:                WebResponse response = null;
225:
226:                // globalvar4 is not passed on due to the different scopes and thus the default value is used
227:                request = new GetMethodWebRequest(
228:                        "http://localhost:8181/absolute");
229:                response = conversation.getResponse(request);
230:                assertEquals(
231:                        "absolute_target:value1absolute|default value2|value3absolute|subsite value4",
232:                        response.getText());
233:            }
234:
235:            public void testInheritanceSingle() throws Exception {
236:                setupSite("site/subsites.xml");
237:                WebConversation conversation = new WebConversation();
238:                WebRequest request = null;
239:                WebResponse response = null;
240:
241:                // single inheritance
242:                request = new GetMethodWebRequest(
243:                        "http://localhost:8181/inheritance/single/targetchild");
244:                response = conversation.getResponse(request);
245:                assertEquals("parent1", response.getText());
246:
247:                request = new GetMethodWebRequest(
248:                        "http://localhost:8181/inheritance/single/targetchild");
249:                request.setParameter("globalvar1", "request value1");
250:                response = conversation.getResponse(request);
251:                assertEquals("targetchild", response.getText());
252:            }
253:
254:            public void testInheritanceStack() throws Exception {
255:                setupSite("site/subsites.xml");
256:                WebConversation conversation = new WebConversation();
257:                WebRequest request = null;
258:                WebResponse response = null;
259:
260:                // inheritance stack
261:                request = new GetMethodWebRequest(
262:                        "http://localhost:8181/inheritance/stack/targetchild");
263:                response = conversation.getResponse(request);
264:                assertEquals("parent1", response.getText());
265:
266:                request = new GetMethodWebRequest(
267:                        "http://localhost:8181/inheritance/stack/targetchild");
268:                request.setParameter("globalvar1", "request value1");
269:                response = conversation.getResponse(request);
270:                assertEquals("inheritance parent 1", response.getText());
271:
272:                request = new GetMethodWebRequest(
273:                        "http://localhost:8181/inheritance/stack/targetchild");
274:                request.setParameter("globalvar1", "request value1");
275:                request.setParameter("globalvar_inheritance1", "request value");
276:                response = conversation.getResponse(request);
277:                assertEquals("targetchild", response.getText());
278:            }
279:
280:            public void testInheritanceElementWithInheritanceStack()
281:                    throws Exception {
282:                setupSite("site/subsites.xml");
283:                WebConversation conversation = new WebConversation();
284:                WebRequest request = null;
285:                WebResponse response = null;
286:
287:                // inheritance from element that has its own inheritance stack
288:                request = new GetMethodWebRequest(
289:                        "http://localhost:8181/inheritance/repeatedstack/targetchild");
290:                request.setParameter("globalvar1", "request value1");
291:                response = conversation.getResponse(request);
292:                assertEquals("inheritance parent 2", response.getText());
293:
294:                request = new GetMethodWebRequest(
295:                        "http://localhost:8181/inheritance/repeatedstack/targetchild");
296:                request.setParameter("globalvar1", "request value1");
297:                request.setParameter("globalvar_inheritance2", "request value");
298:                response = conversation.getResponse(request);
299:                assertEquals("targetchild", response.getText());
300:            }
301:
302:            public void testInheritanceParentSubsiteChildElement()
303:                    throws Exception {
304:                setupSite("site/subsites.xml");
305:                WebConversation conversation = new WebConversation();
306:                WebRequest request = null;
307:                WebResponse response = null;
308:
309:                request = new GetMethodWebRequest(
310:                        "http://localhost:8181/inheritance/parent/childelement");
311:                response = conversation.getResponse(request);
312:                assertEquals("parent1", response.getText());
313:
314:                request = new GetMethodWebRequest(
315:                        "http://localhost:8181/inheritance/parent/childelement");
316:                request.setParameter("globalvar1", "request value1");
317:                response = conversation.getResponse(request);
318:                assertEquals("parent subsite arrival", response.getText());
319:
320:                request = new GetMethodWebRequest(
321:                        "http://localhost:8181/inheritance/parent/childelement");
322:                request.setParameter("globalvar1", "request value1");
323:                request.setParameter("parent_subsite_trigger", "request value");
324:                response = conversation.getResponse(request);
325:                assertEquals("targetchild", response.getText());
326:            }
327:
328:            public void testInheritanceParentSubsiteChildSubsite()
329:                    throws Exception {
330:                setupSite("site/subsites.xml");
331:                WebConversation conversation = new WebConversation();
332:                WebRequest request = null;
333:                WebResponse response = null;
334:
335:                request = new GetMethodWebRequest(
336:                        "http://localhost:8181/inheritance/parent/childsubsite/targetchild");
337:                response = conversation.getResponse(request);
338:                assertEquals("parent1", response.getText());
339:
340:                request = new GetMethodWebRequest(
341:                        "http://localhost:8181/inheritance/parent/childsubsite/targetchild");
342:                request.setParameter("globalvar1", "request value1");
343:                response = conversation.getResponse(request);
344:                assertEquals("parent subsite arrival", response.getText());
345:
346:                request = new GetMethodWebRequest(
347:                        "http://localhost:8181/inheritance/parent/childsubsite/targetchild");
348:                request.setParameter("globalvar1", "request value1");
349:                request.setParameter("parent_subsite_trigger", "request value");
350:                response = conversation.getResponse(request);
351:                assertEquals("targetchild", response.getText());
352:            }
353:
354:            public void testArrivalSimple() throws Exception {
355:                setupSite("site/subsites.xml");
356:                WebConversation conversation = new WebConversation();
357:                WebRequest request = null;
358:                WebResponse response = null;
359:
360:                request = new GetMethodWebRequest("http://localhost:8181");
361:                response = conversation.getResponse(request);
362:                assertEquals("output value 1output value 2" + "/" + "arrival",
363:                        response.getText());
364:            }
365:
366:            public void testArrivalSimpleRedirect() throws Exception {
367:                setupSite("site/subsites.xml");
368:                WebConversation conversation = new WebConversation();
369:                WebRequest request = null;
370:                WebResponse response = null;
371:
372:                request = new GetMethodWebRequest(
373:                        "http://localhost:8181/arrival_redirect");
374:                response = conversation.getResponse(request);
375:                assertEquals("output value 1output value 2"
376:                        + "/subsite/arrival_redirect/arrival" + "arrival",
377:                        response.getText());
378:            }
379:
380:            public void testArrivalNourlRedirect() throws Exception {
381:                setupSite("site/subsites.xml");
382:                WebConversation conversation = new WebConversation();
383:                WebRequest request = null;
384:                WebResponse response = null;
385:
386:                request = new GetMethodWebRequest(
387:                        "http://localhost:8181/arrival_redirect_nourl");
388:                response = conversation.getResponse(request);
389:                assertEquals("output value 1output value 2"
390:                        + "/subsite/arrival_redirect_nourl/" + "arrival",
391:                        response.getText());
392:            }
393:
394:            public void testArrivalExitToSubsite() throws Exception {
395:                setupSite("site/subsites.xml");
396:                WebConversation conversation = new WebConversation();
397:                WebRequest request = null;
398:                WebResponse response = null;
399:
400:                // element with flowlink to subsite (and thus arrival element)
401:                request = new GetMethodWebRequest(
402:                        "http://localhost:8181/arrival_target_subsite");
403:                response = conversation.getResponse(request);
404:                assertEquals("output value 1" + "output value 2"
405:                        + "/arrival_target_subsite" + "arrival", response
406:                        .getText());
407:
408:                // direct access of subsite's url prefix (and thus arrival element)
409:                request = new GetMethodWebRequest(
410:                        "http://localhost:8181/subsite/arrival");
411:                request.setParameter("input1", "output value 1a");
412:                request.setParameter("input2", "output value 2a");
413:                response = conversation.getResponse(request);
414:                assertEquals("output value 1a" + "output value 2a"
415:                        + "/subsite/arrival" + "arrival", response.getText());
416:
417:                // direct access of arrival element
418:                request = new GetMethodWebRequest(
419:                        "http://localhost:8181/subsite/arrival/arrival");
420:                request.setParameter("input1", "output value 1b");
421:                request.setParameter("input2", "output value 2b");
422:                response = conversation.getResponse(request);
423:                assertEquals("output value 1b" + "output value 2b"
424:                        + "/subsite/arrival/arrival" + "arrival", response
425:                        .getText());
426:            }
427:
428:            public void testArrivalInheritance() throws Exception {
429:                setupSite("site/subsites.xml");
430:                WebConversation conversation = new WebConversation();
431:                WebRequest request = null;
432:                WebResponse response = null;
433:
434:                // element with flowlink to subsite (and thus arrival element)
435:                // without a child trigger
436:                request = new GetMethodWebRequest(
437:                        "http://localhost:8181/arrival_inheritance");
438:                response = conversation.getResponse(request);
439:                assertEquals("parent1", response.getText());
440:
441:                // element with flowlink to subsite (and thus arrival element)
442:                // with a valid child trigger
443:                request = new GetMethodWebRequest(
444:                        "http://localhost:8181/arrival_inheritance");
445:                request.setParameter("globalvar1", "request value1");
446:                response = conversation.getResponse(request);
447:                assertEquals("output value 1" + "output value 2"
448:                        + "/arrival_inheritance" + "arrival", response
449:                        .getText());
450:
451:                // direct access of subsite's url prefix (and thus arrival element)
452:                // without a child trigger
453:                request = new GetMethodWebRequest(
454:                        "http://localhost:8181/subsite/arrival_inheritance");
455:                request.setParameter("input1", "output value 1a");
456:                request.setParameter("input2", "output value 2a");
457:                response = conversation.getResponse(request);
458:                assertEquals("parent1", response.getText());
459:
460:                // direct access of subsite's url prefix (and thus arrival element)
461:                // with a valid child trigger
462:                request = new GetMethodWebRequest(
463:                        "http://localhost:8181/subsite/arrival_inheritance");
464:                request.setParameter("globalvar1", "request value1");
465:                request.setParameter("input1", "output value 1a");
466:                request.setParameter("input2", "output value 2a");
467:                response = conversation.getResponse(request);
468:                assertEquals("output value 1a" + "output value 2a"
469:                        + "/subsite/arrival_inheritance" + "arrival", response
470:                        .getText());
471:
472:                // direct access of arrival element
473:                // without a child trigger
474:                request = new GetMethodWebRequest(
475:                        "http://localhost:8181/subsite/arrival_inheritance/arrival");
476:                request.setParameter("input1", "output value 1a");
477:                request.setParameter("input2", "output value 2a");
478:                response = conversation.getResponse(request);
479:                assertEquals("parent1", response.getText());
480:
481:                // direct access of arrival element
482:                // with a valid child trigger
483:                request = new GetMethodWebRequest(
484:                        "http://localhost:8181/subsite/arrival_inheritance/arrival");
485:                request.setParameter("globalvar1", "request value1");
486:                request.setParameter("input1", "output value 1a");
487:                request.setParameter("input2", "output value 2a");
488:                response = conversation.getResponse(request);
489:                assertEquals("output value 1a" + "output value 2a"
490:                        + "/subsite/arrival_inheritance/arrival" + "arrival",
491:                        response.getText());
492:            }
493:
494:            public void testArrivalNoUrl() throws Exception {
495:                setupSite("site/subsites.xml");
496:                WebConversation conversation = new WebConversation();
497:                WebRequest request = null;
498:                WebResponse response = null;
499:
500:                // element with flowlink to subsite (and thus arrival element)
501:                request = new GetMethodWebRequest(
502:                        "http://localhost:8181/arrival_nourl");
503:                response = conversation.getResponse(request);
504:                assertEquals("output value 1" + "output value 2"
505:                        + "/arrival_nourl" + "arrival", response.getText());
506:
507:                // direct access of subsite's url prefix, since the arrival element has
508:                // no url, the site url prefix doesn't refer to the actual arrival element
509:                request = new GetMethodWebRequest(
510:                        "http://localhost:8181/subsite/arrival_nourl");
511:                request.setParameter("input1", "output value 1a");
512:                request.setParameter("input2", "output value 2a");
513:                response = conversation.getResponse(request);
514:                assertEquals("output value 1a" + "output value 2a"
515:                        + "/subsite/arrival_nourl" + "arrival", response
516:                        .getText());
517:            }
518:
519:            public void testDeparture() throws Exception {
520:                setupSite("site/subsites.xml");
521:                WebConversation conversation = new WebConversation();
522:                WebRequest request = null;
523:                WebResponse response = null;
524:
525:                request = new GetMethodWebRequest(
526:                        "http://localhost:8181/departure/source");
527:                request.setParameter("globalvar2", "request value1");
528:                request.setParameter("globalvar3", "request value2");
529:                request
530:                        .setParameter("globalvar_inheritance1",
531:                                "request value3");
532:                request
533:                        .setParameter("globalvar_inheritance2",
534:                                "request value4");
535:                request
536:                        .setParameter("globalvar_inheritance3",
537:                                "request value5");
538:                response = conversation.getResponse(request);
539:                assertEquals("default value1" + "request value1"
540:                        + "request value2" + "source value1" + "some"
541:                        + "another value" + "null" + "set by source" + "some"
542:                        + "null", response.getText());
543:            }
544:
545:            public void testArrivalStraightToSubsite() throws Exception {
546:                setupSite("site/subsites.xml");
547:                WebConversation conversation = new WebConversation();
548:                WebRequest request = null;
549:                WebResponse response = null;
550:
551:                // access arrival directly
552:                request = new GetMethodWebRequest(
553:                        "http://localhost:8181/subsite/arrival_subsite");
554:                request.setParameter("input1", "input value 1");
555:                request.setParameter("input2", "input value 2");
556:
557:                response = conversation.getResponse(request);
558:
559:                assertEquals("input value 1" + "input value 2"
560:                        + "/subsite/arrival_subsite" + "arrival", response
561:                        .getText());
562:
563:                // access arrival directly with additional slash
564:                request = new GetMethodWebRequest(
565:                        "http://localhost:8181/subsite/arrival_subsite/");
566:                request.setParameter("input1", "input value 1");
567:                request.setParameter("input2", "input value 2");
568:
569:                response = conversation.getResponse(request);
570:
571:                assertEquals("input value 1" + "input value 2"
572:                        + "/subsite/arrival_subsite/" + "arrival", response
573:                        .getText());
574:
575:                // direct access of arrival element
576:                request = new GetMethodWebRequest(
577:                        "http://localhost:8181/subsite/arrival_subsite/arrival");
578:                request.setParameter("input1", "input value 1b");
579:                request.setParameter("input2", "input value 2b");
580:                response = conversation.getResponse(request);
581:                assertEquals("input value 1b" + "input value 2b"
582:                        + "/subsite/arrival_subsite/arrival" + "arrival",
583:                        response.getText());
584:            }
585:
586:            public void testArrivalStraightToSubsiteTrailingSlash()
587:                    throws Exception {
588:                setupSite("site/subsites.xml");
589:                WebConversation conversation = new WebConversation();
590:                WebRequest request = null;
591:                WebResponse response = null;
592:
593:                // access arrival directly
594:                request = new GetMethodWebRequest(
595:                        "http://localhost:8181/subsite/arrival_subsite_slash/");
596:                request.setParameter("input1", "input value 1");
597:                request.setParameter("input2", "input value 2");
598:
599:                response = conversation.getResponse(request);
600:
601:                assertEquals("input value 1" + "input value 2"
602:                        + "/subsite/arrival_subsite_slash/" + "arrival",
603:                        response.getText());
604:
605:                // access arrival directly without the slash
606:                request = new GetMethodWebRequest(
607:                        "http://localhost:8181/subsite/arrival_subsite_slash");
608:                request.setParameter("input1", "input value 1");
609:                request.setParameter("input2", "input value 2");
610:
611:                response = conversation.getResponse(request);
612:
613:                assertEquals("input value 1" + "input value 2"
614:                        + "/subsite/arrival_subsite_slash" + "arrival",
615:                        response.getText());
616:
617:                // direct access of arrival element
618:                request = new GetMethodWebRequest(
619:                        "http://localhost:8181/subsite/arrival_subsite_slash/arrival");
620:                request.setParameter("input1", "input value 1b");
621:                request.setParameter("input2", "input value 2b");
622:                response = conversation.getResponse(request);
623:                assertEquals("input value 1b" + "input value 2b"
624:                        + "/subsite/arrival_subsite_slash/arrival" + "arrival",
625:                        response.getText());
626:            }
627:
628:            public void testSubsiteMultipleSlash() throws Exception {
629:                setupSite("site/subsites.xml");
630:                WebConversation conversation = new WebConversation();
631:                WebRequest request = null;
632:                WebResponse response = null;
633:
634:                // access arrival directly
635:                request = new GetMethodWebRequest(
636:                        "http://localhost:8181/subsite/multiple_slash/simple");
637:
638:                response = conversation.getResponse(request);
639:
640:                // Get the host name
641:                String hostname = InetAddress.getByName("127.0.0.1")
642:                        .getHostName();
643:                assertEquals("Just some text 127.0.0.1:" + hostname
644:                        + ":.MULTIPLE_SLASH.simple_html:", response.getText());
645:            }
646:
647:            public void testSubsiteNoFile() throws Exception {
648:                setupSite("site/subsites.xml");
649:                WebConversation conversation = new WebConversation();
650:                WebRequest request = null;
651:                WebResponse response = null;
652:
653:                // access arrival directly
654:                request = new GetMethodWebRequest(
655:                        "http://localhost:8181/nofile/simple");
656:
657:                response = conversation.getResponse(request);
658:
659:                // Get the host name
660:                String hostname = InetAddress.getByName("127.0.0.1")
661:                        .getHostName();
662:                assertEquals("Just some text 127.0.0.1:" + hostname
663:                        + ":.NOFILE.SIMPLE:", response.getText());
664:            }
665:
666:            public void testArrivalDefaultTemplate() throws Exception {
667:                setupSite("site/subsites.xml");
668:                WebConversation conversation = new WebConversation();
669:                WebRequest request = null;
670:                WebResponse response = null;
671:
672:                request = new GetMethodWebRequest(
673:                        "http://localhost:8181/subsite/arrival_default_template");
674:                response = conversation.getResponse(request);
675:                assertEquals("arrival default template\n"
676:                        + ".ARRIVAL_DEFAULT_TEMPLATE.\n"
677:                        + ".ARRIVAL_DEFAULT_TEMPLATE.DefaultTemplate\n"
678:                        + "/subsite/arrival_default_template\n", response
679:                        .getText());
680:
681:                request = new GetMethodWebRequest(
682:                        "http://localhost:8181/subsite/arrival_default_template/arrival");
683:                response = conversation.getResponse(request);
684:                assertEquals("arrival default template\n"
685:                        + ".ARRIVAL_DEFAULT_TEMPLATE.DefaultTemplate\n"
686:                        + ".ARRIVAL_DEFAULT_TEMPLATE.DefaultTemplate\n"
687:                        + "/subsite/arrival_default_template/arrival\n",
688:                        response.getText());
689:            }
690:
691:            public void testAnnotationsDestClassIdPrefix() throws Exception {
692:                setupSite("site/subsites.xml");
693:
694:                WebConversation conversation = new WebConversation();
695:                WebRequest request = null;
696:                WebResponse response = null;
697:
698:                // access arrival directly
699:                request = new GetMethodWebRequest(
700:                        "http://localhost:8181/annotationssource");
701:                response = conversation.getResponse(request);
702:                assertEquals("output value 1:output value 2", response
703:                        .getText());
704:            }
705:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.