Source Code Cross Referenced for TestEngineScripted.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: TestEngineScripted.java 3634 2007-01-08 21:42:24Z gbevin $
007:         */
008:        package com.uwyn.rife.engine;
009:
010:        import com.meterware.httpunit.*;
011:
012:        import com.uwyn.rife.TestCaseServerside;
013:        import com.uwyn.rife.config.RifeConfig;
014:        import com.uwyn.rife.resources.ResourceFinder;
015:        import com.uwyn.rife.resources.ResourceFinderClasspath;
016:        import com.uwyn.rife.tools.ExceptionUtils;
017:        import com.uwyn.rife.tools.FileUtils;
018:        import com.uwyn.rife.tools.exceptions.FileUtilsErrorException;
019:        import java.io.File;
020:        import java.io.IOException;
021:        import java.net.URL;
022:
023:        public class TestEngineScripted extends TestCaseServerside {
024:            private static final boolean BENCHMARK = false;
025:            private static final int BENCHMARK_ITERATIONS = 200;
026:
027:            public TestEngineScripted(int siteType, String name) {
028:                super (siteType, name);
029:            }
030:
031:            public void testReloadScriptedJavaElement() throws Exception {
032:                // setup the temporary directory
033:                String site_dir = RifeConfig.Global.getTempPath()
034:                        + File.separator + "reloadsite";
035:                File site_dir_file = new File(site_dir);
036:                site_dir_file.mkdirs();
037:                String element_dir = RifeConfig.Global.getTempPath()
038:                        + File.separator + "reloadelement";
039:                File element_dir_file = new File(element_dir);
040:                element_dir_file.mkdirs();
041:                String scriptedjava_dir = RifeConfig.Global.getTempPath()
042:                        + File.separator + "reloadscript";
043:                File scriptedjava_dir_file = new File(scriptedjava_dir);
044:                scriptedjava_dir_file.mkdirs();
045:
046:                // setup the site xml file
047:                ResourceFinder resource_finder = null;
048:                URL resource = null;
049:                File site_file = null;
050:                File element_file = null;
051:                File scriptedjava_file = null;
052:
053:                resource_finder = ResourceFinderClasspath.getInstance();
054:                site_file = new File(site_dir + File.separator + "site.xml");
055:                site_file.delete();
056:                element_file = new File(element_dir + File.separator
057:                        + "scriptedjava.xml");
058:                element_file.delete();
059:                scriptedjava_file = new File(scriptedjava_dir + File.separator
060:                        + "scriptedjava.java");
061:                scriptedjava_file.delete();
062:
063:                // create the site xml file
064:                resource = resource_finder
065:                        .getResource("site/reload_scriptedjava_blueprint.xml");
066:                try {
067:                    FileUtils.copy(resource.openStream(), site_file);
068:                } catch (FileUtilsErrorException e) {
069:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
070:                    return;
071:                } catch (IOException e) {
072:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
073:                    return;
074:                }
075:
076:                // create the first element xml file
077:                resource = resource_finder
078:                        .getResource("element/scripted/reload_scriptedjava_blueprint.xml");
079:                try {
080:                    FileUtils.copy(resource.openStream(), element_file);
081:                } catch (FileUtilsErrorException e) {
082:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
083:                    return;
084:                } catch (IOException e) {
085:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
086:                    return;
087:                }
088:
089:                // wait a second, in case a previous test xas executed
090:                // to ensure that the new file is considered as modified
091:                try {
092:                    Thread.sleep(1000);
093:                } catch (InterruptedException e) {
094:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
095:                }
096:
097:                // create the first script java element file
098:                resource = resource_finder
099:                        .getResource("elementjava/reloadtest1.jav");
100:                try {
101:                    FileUtils.copy(resource.openStream(), scriptedjava_file);
102:                } catch (FileUtilsErrorException e) {
103:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
104:                    return;
105:                } catch (IOException e) {
106:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
107:                    return;
108:                }
109:
110:                // test the site
111:                setupSite("reloadsite/site.xml");
112:                WebConversation conversation = new WebConversation();
113:                WebRequest request = null;
114:                WebResponse response = null;
115:
116:                request = new GetMethodWebRequest(
117:                        "http://localhost:8181/scriptedjava");
118:
119:                // get the content of the first element
120:                response = conversation.getResponse(request);
121:                assertEquals("outer 1 : reloadtest1", response.getText());
122:
123:                // wait a second
124:                try {
125:                    Thread.sleep(1000);
126:                } catch (InterruptedException e) {
127:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
128:                }
129:
130:                // overwrite the element file with new content
131:                resource = resource_finder
132:                        .getResource("elementjava/reloadtest2.jav");
133:                try {
134:                    FileUtils.copy(resource.openStream(), scriptedjava_file);
135:                } catch (FileUtilsErrorException e) {
136:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
137:                    return;
138:                } catch (IOException e) {
139:                    assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
140:                    return;
141:                }
142:
143:                // get the content of the new element
144:                response = conversation.getResponse(request);
145:                assertEquals("outer 2 : reloadtest2", response.getText());
146:
147:                // perform a reload to see if the new element is properly being used afterwards
148:                response = conversation.getResponse(request);
149:                assertEquals("outer 2 : reloadtest2", response.getText());
150:
151:                // clean up the copied files
152:                scriptedjava_file.delete();
153:                element_file.delete();
154:                site_file.delete();
155:            }
156:
157:            public void testScriptedJavaPackageTest() throws Exception {
158:                setupSite("site/scripted.xml");
159:                WebConversation conversation = new WebConversation();
160:                WebRequest request = null;
161:                WebResponse response = null;
162:
163:                request = new GetMethodWebRequest(
164:                        "http://localhost:8181/scripted/java/package");
165:                response = conversation.getResponse(request);
166:                assertEquals("this is a package test", response.getText());
167:            }
168:
169:            public void testScriptedJava() throws Exception {
170:                setupSite("site/scripted.xml");
171:                WebConversation conversation = new WebConversation();
172:                WebRequest request = null;
173:                WebResponse response = null;
174:                WebForm form = null;
175:
176:                long start = System.currentTimeMillis();
177:                int i = 0;
178:                do {
179:                    request = new GetMethodWebRequest(
180:                            "http://localhost:8181/scripted/java");
181:                    request.setParameter("input1", "these values");
182:                    request.setParameter("input2", "are scripted");
183:                    response = conversation.getResponse(request);
184:
185:                    assertEquals("these values,are scripted", response
186:                            .getText());
187:
188:                    request = new GetMethodWebRequest(
189:                            "http://localhost:8181/scripted/java");
190:                    request.setParameter("input1", "form");
191:                    response = conversation.getResponse(request);
192:                    form = response.getForms()[0];
193:                    form.setParameter("login", "gbevin");
194:                    form.setParameter("password", "mypassword");
195:                    response = form.submit();
196:
197:                    assertEquals("gbevin,mypassword", response.getText());
198:                } while (BENCHMARK && i++ <= BENCHMARK_ITERATIONS);
199:                if (BENCHMARK)
200:                    System.out.println("JAVA took "
201:                            + (System.currentTimeMillis() - start));
202:            }
203:
204:            public void testScriptedRhino() throws Exception {
205:                setupSite("site/scripted.xml");
206:                WebConversation conversation = new WebConversation();
207:                WebRequest request = null;
208:                WebResponse response = null;
209:                WebForm form = null;
210:
211:                long start = System.currentTimeMillis();
212:                int i = 0;
213:                do {
214:                    request = new GetMethodWebRequest(
215:                            "http://localhost:8181/scripted/rhino");
216:                    request.setParameter("input1", "these values");
217:                    request.setParameter("input2", "are scripted");
218:                    response = conversation.getResponse(request);
219:
220:                    assertEquals("these values,are scripted", response
221:                            .getText());
222:
223:                    request = new GetMethodWebRequest(
224:                            "http://localhost:8181/scripted/rhino");
225:                    request.setParameter("input1", "form");
226:                    response = conversation.getResponse(request);
227:                    form = response.getForms()[0];
228:                    form.setParameter("login", "gbevin");
229:                    form.setParameter("password", "mypassword");
230:                    response = form.submit();
231:
232:                    assertEquals("gbevin,mypassword", response.getText());
233:                } while (BENCHMARK && i++ <= BENCHMARK_ITERATIONS);
234:                if (BENCHMARK)
235:                    System.out.println("RHINO took "
236:                            + (System.currentTimeMillis() - start));
237:            }
238:
239:            public void testScriptedJython() throws Exception {
240:                setupSite("site/scripted.xml");
241:                WebConversation conversation = new WebConversation();
242:                WebRequest request = null;
243:                WebResponse response = null;
244:                WebForm form = null;
245:
246:                long start = System.currentTimeMillis();
247:                int i = 0;
248:                do {
249:                    request = new GetMethodWebRequest(
250:                            "http://localhost:8181/scripted/jython");
251:                    request.setParameter("input1", "these values");
252:                    request.setParameter("input2", "are scripted");
253:                    response = conversation.getResponse(request);
254:
255:                    assertEquals("these values,are scripted", response
256:                            .getText());
257:
258:                    request = new GetMethodWebRequest(
259:                            "http://localhost:8181/scripted/jython");
260:                    request.setParameter("input1", "form");
261:                    response = conversation.getResponse(request);
262:                    form = response.getForms()[0];
263:                    form.setParameter("login", "gbevin");
264:                    form.setParameter("password", "mypassword");
265:                    response = form.submit();
266:
267:                    assertEquals("gbevin,mypassword", response.getText());
268:                } while (BENCHMARK && i++ <= BENCHMARK_ITERATIONS);
269:                if (BENCHMARK)
270:                    System.out.println("JYTHON took "
271:                            + (System.currentTimeMillis() - start));
272:            }
273:
274:            public void testScriptedJruby() throws Exception {
275:                setupSite("site/scripted.xml");
276:                WebConversation conversation = new WebConversation();
277:                WebRequest request = null;
278:                WebResponse response = null;
279:                WebForm form = null;
280:
281:                long start = System.currentTimeMillis();
282:                int i = 0;
283:                do {
284:                    request = new GetMethodWebRequest(
285:                            "http://localhost:8181/scripted/jruby");
286:                    request.setParameter("input1", "these values");
287:                    request.setParameter("input2", "are scripted");
288:                    try {
289:                        response = conversation.getResponse(request);
290:                    } catch (Throwable e) {
291:                        getLogSink().getInternalException().printStackTrace();
292:                    }
293:
294:                    assertEquals("these values,are scripted", response
295:                            .getText());
296:
297:                    request = new GetMethodWebRequest(
298:                            "http://localhost:8181/scripted/jruby");
299:                    request.setParameter("input1", "form");
300:                    response = conversation.getResponse(request);
301:                    form = response.getForms()[0];
302:                    form.setParameter("login", "gbevin");
303:                    form.setParameter("password", "mypassword");
304:                    response = form.submit();
305:
306:                    assertEquals("gbevin,mypassword", response.getText());
307:                } while (BENCHMARK && i++ <= BENCHMARK_ITERATIONS);
308:                if (BENCHMARK)
309:                    System.out.println("JRUBY took "
310:                            + (System.currentTimeMillis() - start));
311:            }
312:
313:            public void testScriptedJacl() throws Exception {
314:                setupSite("site/scripted.xml");
315:                WebConversation conversation = new WebConversation();
316:                WebRequest request = null;
317:                WebResponse response = null;
318:                WebForm form = null;
319:
320:                long start = System.currentTimeMillis();
321:                int i = 0;
322:                do {
323:                    request = new GetMethodWebRequest(
324:                            "http://localhost:8181/scripted/jacl");
325:                    request.setParameter("input1", "these values");
326:                    request.setParameter("input2", "are scripted");
327:                    response = conversation.getResponse(request);
328:
329:                    assertEquals("these values,are scripted", response
330:                            .getText());
331:
332:                    request = new GetMethodWebRequest(
333:                            "http://localhost:8181/scripted/jacl");
334:                    request.setParameter("input1", "form");
335:                    response = conversation.getResponse(request);
336:                    form = response.getForms()[0];
337:                    form.setParameter("login", "gbevin");
338:                    form.setParameter("password", "mypassword");
339:                    response = form.submit();
340:
341:                    assertEquals("gbevin,mypassword", response.getText());
342:                } while (BENCHMARK && i++ <= BENCHMARK_ITERATIONS);
343:                if (BENCHMARK)
344:                    System.out.println("JACL took "
345:                            + (System.currentTimeMillis() - start));
346:            }
347:
348:            public void testScriptedBeanshell() throws Exception {
349:                setupSite("site/scripted.xml");
350:                WebConversation conversation = new WebConversation();
351:                WebRequest request = null;
352:                WebResponse response = null;
353:                WebForm form = null;
354:
355:                long start = System.currentTimeMillis();
356:                int i = 0;
357:                do {
358:                    request = new GetMethodWebRequest(
359:                            "http://localhost:8181/scripted/beanshell");
360:                    request.setParameter("input1", "these values");
361:                    request.setParameter("input2", "are scripted");
362:                    response = conversation.getResponse(request);
363:
364:                    assertEquals("these values,are scripted", response
365:                            .getText());
366:
367:                    request = new GetMethodWebRequest(
368:                            "http://localhost:8181/scripted/beanshell");
369:                    request.setParameter("input1", "form");
370:                    response = conversation.getResponse(request);
371:                    form = response.getForms()[0];
372:                    form.setParameter("login", "gbevin");
373:                    form.setParameter("password", "mypassword");
374:                    response = form.submit();
375:
376:                    assertEquals("gbevin,mypassword", response.getText());
377:                } while (BENCHMARK && i++ <= BENCHMARK_ITERATIONS);
378:                if (BENCHMARK)
379:                    System.out.println("BEANSHELL took "
380:                            + (System.currentTimeMillis() - start));
381:            }
382:
383:            public void testScriptedPnuts() throws Exception {
384:                setupSite("site/scripted.xml");
385:                WebConversation conversation = new WebConversation();
386:                WebRequest request = null;
387:                WebResponse response = null;
388:                WebForm form = null;
389:
390:                long start = System.currentTimeMillis();
391:                int i = 0;
392:                do {
393:                    request = new GetMethodWebRequest(
394:                            "http://localhost:8181/scripted/pnuts");
395:                    request.setParameter("input1", "these values");
396:                    request.setParameter("input2", "are scripted");
397:                    response = conversation.getResponse(request);
398:
399:                    assertEquals("these values,are scripted", response
400:                            .getText());
401:
402:                    request = new GetMethodWebRequest(
403:                            "http://localhost:8181/scripted/pnuts");
404:                    request.setParameter("input1", "form");
405:                    response = conversation.getResponse(request);
406:                    form = response.getForms()[0];
407:                    form.setParameter("login", "gbevin");
408:                    form.setParameter("password", "mypassword");
409:                    response = form.submit();
410:
411:                    assertEquals("gbevin,mypassword", response.getText());
412:                } while (BENCHMARK && i++ <= BENCHMARK_ITERATIONS);
413:                if (BENCHMARK)
414:                    System.out.println("PNUTS took "
415:                            + (System.currentTimeMillis() - start));
416:            }
417:
418:            public void testScriptedGroovy() throws Exception {
419:                setupSite("site/scripted.xml");
420:                WebConversation conversation = new WebConversation();
421:                WebRequest request = null;
422:                WebResponse response = null;
423:                WebForm form = null;
424:
425:                long start = System.currentTimeMillis();
426:                int i = 0;
427:                do {
428:                    request = new GetMethodWebRequest(
429:                            "http://localhost:8181/scripted/groovy");
430:                    request.setParameter("input1", "these values");
431:                    request.setParameter("input2", "are scripted");
432:                    response = conversation.getResponse(request);
433:
434:                    assertEquals("these values,are scripted", response
435:                            .getText());
436:
437:                    request = new GetMethodWebRequest(
438:                            "http://localhost:8181/scripted/groovy");
439:                    request.setParameter("input1", "form");
440:                    response = conversation.getResponse(request);
441:                    form = response.getForms()[0];
442:                    form.setParameter("login", "gbevin");
443:                    form.setParameter("password", "mypassword");
444:                    response = form.submit();
445:
446:                    assertEquals("gbevin,mypassword", response.getText());
447:                } while (BENCHMARK && i++ <= BENCHMARK_ITERATIONS);
448:                if (BENCHMARK)
449:                    System.out.println("GROOVY took "
450:                            + (System.currentTimeMillis() - start));
451:            }
452:
453:            public void testScriptedJanino() throws Exception {
454:                setupSite("site/scripted.xml");
455:                WebConversation conversation = new WebConversation();
456:                WebRequest request = null;
457:                WebResponse response = null;
458:                WebForm form = null;
459:
460:                long start = System.currentTimeMillis();
461:                int i = 0;
462:                do {
463:                    request = new GetMethodWebRequest(
464:                            "http://localhost:8181/scripted/janino");
465:                    request.setParameter("input1", "these values");
466:                    request.setParameter("input2", "are scripted");
467:                    try {
468:                        response = conversation.getResponse(request);
469:                    } catch (Throwable e) {
470:                        getLogSink().getInternalException().printStackTrace();
471:                        return;
472:                    }
473:
474:                    assertEquals("these values,are scripted", response
475:                            .getText());
476:
477:                    request = new GetMethodWebRequest(
478:                            "http://localhost:8181/scripted/janino");
479:                    request.setParameter("input1", "form");
480:                    response = conversation.getResponse(request);
481:                    form = response.getForms()[0];
482:                    form.setParameter("login", "gbevin");
483:                    form.setParameter("password", "mypassword");
484:                    response = form.submit();
485:
486:                    assertEquals("gbevin,mypassword", response.getText());
487:                } while (BENCHMARK && i++ <= BENCHMARK_ITERATIONS);
488:                if (BENCHMARK)
489:                    System.out.println("JANINO took "
490:                            + (System.currentTimeMillis() - start));
491:            }
492:
493:            //
494:            public void testScriptedDefaultdirJava() throws Exception {
495:                setupSite("site/scripted.xml");
496:                WebConversation conversation = new WebConversation();
497:                WebRequest request = null;
498:                WebResponse response = null;
499:                WebForm form = null;
500:
501:                request = new GetMethodWebRequest(
502:                        "http://localhost:8181/scripted/defaultdir/java");
503:                request.setParameter("input1", "these values");
504:                request.setParameter("input2", "are scripted");
505:                try {
506:                    response = conversation.getResponse(request);
507:                } catch (Throwable e) {
508:                    getLogSink().getInternalException().printStackTrace();
509:                }
510:
511:                assertEquals("defaultdir these values,are scripted", response
512:                        .getText());
513:
514:                request = new GetMethodWebRequest(
515:                        "http://localhost:8181/scripted/defaultdir/java");
516:                request.setParameter("input1", "form");
517:                response = conversation.getResponse(request);
518:                form = response.getForms()[0];
519:                form.setParameter("login", "gbevin");
520:                form.setParameter("password", "mypassword");
521:                response = form.submit();
522:
523:                assertEquals("defaultdir gbevin,mypassword", response.getText());
524:            }
525:
526:            public void testScriptedDefaultdirRhino() throws Exception {
527:                setupSite("site/scripted.xml");
528:                WebConversation conversation = new WebConversation();
529:                WebRequest request = null;
530:                WebResponse response = null;
531:                WebForm form = null;
532:
533:                request = new GetMethodWebRequest(
534:                        "http://localhost:8181/scripted/defaultdir/rhino");
535:                request.setParameter("input1", "these values");
536:                request.setParameter("input2", "are scripted");
537:                response = conversation.getResponse(request);
538:
539:                assertEquals("defaultdir these values,are scripted", response
540:                        .getText());
541:
542:                request = new GetMethodWebRequest(
543:                        "http://localhost:8181/scripted/defaultdir/rhino");
544:                request.setParameter("input1", "form");
545:                response = conversation.getResponse(request);
546:                form = response.getForms()[0];
547:                form.setParameter("login", "gbevin");
548:                form.setParameter("password", "mypassword");
549:                response = form.submit();
550:
551:                assertEquals("defaultdir gbevin,mypassword", response.getText());
552:            }
553:
554:            public void testScriptedDefaultdirJython() throws Exception {
555:                setupSite("site/scripted.xml");
556:                WebConversation conversation = new WebConversation();
557:                WebRequest request = null;
558:                WebResponse response = null;
559:                WebForm form = null;
560:
561:                request = new GetMethodWebRequest(
562:                        "http://localhost:8181/scripted/defaultdir/jython");
563:                request.setParameter("input1", "these values");
564:                request.setParameter("input2", "are scripted");
565:                response = conversation.getResponse(request);
566:
567:                assertEquals("defaultdir these values,are scripted", response
568:                        .getText());
569:
570:                request = new GetMethodWebRequest(
571:                        "http://localhost:8181/scripted/defaultdir/jython");
572:                request.setParameter("input1", "form");
573:                response = conversation.getResponse(request);
574:                form = response.getForms()[0];
575:                form.setParameter("login", "gbevin");
576:                form.setParameter("password", "mypassword");
577:                response = form.submit();
578:
579:                assertEquals("defaultdir gbevin,mypassword", response.getText());
580:            }
581:
582:            public void testScriptedDefaultdirJruby() throws Exception {
583:                setupSite("site/scripted.xml");
584:                WebConversation conversation = new WebConversation();
585:                WebRequest request = null;
586:                WebResponse response = null;
587:                WebForm form = null;
588:
589:                request = new GetMethodWebRequest(
590:                        "http://localhost:8181/scripted/defaultdir/jruby");
591:                request.setParameter("input1", "these values");
592:                request.setParameter("input2", "are scripted");
593:                response = conversation.getResponse(request);
594:
595:                assertEquals("defaultdir these values,are scripted", response
596:                        .getText());
597:
598:                request = new GetMethodWebRequest(
599:                        "http://localhost:8181/scripted/defaultdir/jruby");
600:                request.setParameter("input1", "form");
601:                response = conversation.getResponse(request);
602:                form = response.getForms()[0];
603:                form.setParameter("login", "gbevin");
604:                form.setParameter("password", "mypassword");
605:                response = form.submit();
606:
607:                assertEquals("defaultdir gbevin,mypassword", response.getText());
608:            }
609:
610:            public void testScriptedDefaultdirJacl() throws Exception {
611:                setupSite("site/scripted.xml");
612:                WebConversation conversation = new WebConversation();
613:                WebRequest request = null;
614:                WebResponse response = null;
615:                WebForm form = null;
616:
617:                request = new GetMethodWebRequest(
618:                        "http://localhost:8181/scripted/defaultdir/jacl");
619:                request.setParameter("input1", "these values");
620:                request.setParameter("input2", "are scripted");
621:                response = conversation.getResponse(request);
622:
623:                assertEquals("defaultdir these values,are scripted", response
624:                        .getText());
625:
626:                request = new GetMethodWebRequest(
627:                        "http://localhost:8181/scripted/defaultdir/jacl");
628:                request.setParameter("input1", "form");
629:                response = conversation.getResponse(request);
630:                form = response.getForms()[0];
631:                form.setParameter("login", "gbevin");
632:                form.setParameter("password", "mypassword");
633:                response = form.submit();
634:
635:                assertEquals("defaultdir gbevin,mypassword", response.getText());
636:            }
637:
638:            public void testScriptedDefaultdirBeanshell() throws Exception {
639:                setupSite("site/scripted.xml");
640:                WebConversation conversation = new WebConversation();
641:                WebRequest request = null;
642:                WebResponse response = null;
643:                WebForm form = null;
644:
645:                request = new GetMethodWebRequest(
646:                        "http://localhost:8181/scripted/defaultdir/beanshell");
647:                request.setParameter("input1", "these values");
648:                request.setParameter("input2", "are scripted");
649:                response = conversation.getResponse(request);
650:
651:                assertEquals("defaultdir these values,are scripted", response
652:                        .getText());
653:
654:                request = new GetMethodWebRequest(
655:                        "http://localhost:8181/scripted/defaultdir/beanshell");
656:                request.setParameter("input1", "form");
657:                response = conversation.getResponse(request);
658:                form = response.getForms()[0];
659:                form.setParameter("login", "gbevin");
660:                form.setParameter("password", "mypassword");
661:                response = form.submit();
662:
663:                assertEquals("defaultdir gbevin,mypassword", response.getText());
664:            }
665:
666:            public void testScriptedDefaultdirPnuts() throws Exception {
667:                setupSite("site/scripted.xml");
668:                WebConversation conversation = new WebConversation();
669:                WebRequest request = null;
670:                WebResponse response = null;
671:                WebForm form = null;
672:
673:                request = new GetMethodWebRequest(
674:                        "http://localhost:8181/scripted/defaultdir/pnuts");
675:                request.setParameter("input1", "these values");
676:                request.setParameter("input2", "are scripted");
677:                response = conversation.getResponse(request);
678:
679:                assertEquals("defaultdir these values,are scripted", response
680:                        .getText());
681:
682:                request = new GetMethodWebRequest(
683:                        "http://localhost:8181/scripted/defaultdir/pnuts");
684:                request.setParameter("input1", "form");
685:                response = conversation.getResponse(request);
686:                form = response.getForms()[0];
687:                form.setParameter("login", "gbevin");
688:                form.setParameter("password", "mypassword");
689:                response = form.submit();
690:
691:                assertEquals("defaultdir gbevin,mypassword", response.getText());
692:            }
693:
694:            public void testScriptedDefaultdirGroovy() throws Exception {
695:                setupSite("site/scripted.xml");
696:                WebConversation conversation = new WebConversation();
697:                WebRequest request = null;
698:                WebResponse response = null;
699:                WebForm form = null;
700:
701:                request = new GetMethodWebRequest(
702:                        "http://localhost:8181/scripted/defaultdir/groovy");
703:                request.setParameter("input1", "these values");
704:                request.setParameter("input2", "are scripted");
705:                response = conversation.getResponse(request);
706:
707:                assertEquals("defaultdir these values,are scripted", response
708:                        .getText());
709:
710:                request = new GetMethodWebRequest(
711:                        "http://localhost:8181/scripted/defaultdir/groovy");
712:                request.setParameter("input1", "form");
713:                response = conversation.getResponse(request);
714:                form = response.getForms()[0];
715:                form.setParameter("login", "gbevin");
716:                form.setParameter("password", "mypassword");
717:                response = form.submit();
718:
719:                assertEquals("defaultdir gbevin,mypassword", response.getText());
720:            }
721:
722:            public void testScriptedDefaultdirJanino() throws Exception {
723:                setupSite("site/scripted.xml");
724:                WebConversation conversation = new WebConversation();
725:                WebRequest request = null;
726:                WebResponse response = null;
727:                WebForm form = null;
728:
729:                request = new GetMethodWebRequest(
730:                        "http://localhost:8181/scripted/defaultdir/janino");
731:                request.setParameter("input1", "these values");
732:                request.setParameter("input2", "are scripted");
733:                response = conversation.getResponse(request);
734:
735:                assertEquals("defaultdir these values,are scripted", response
736:                        .getText());
737:
738:                request = new GetMethodWebRequest(
739:                        "http://localhost:8181/scripted/defaultdir/janino");
740:                request.setParameter("input1", "form");
741:                response = conversation.getResponse(request);
742:                form = response.getForms()[0];
743:                form.setParameter("login", "gbevin");
744:                form.setParameter("password", "mypassword");
745:                response = form.submit();
746:
747:                assertEquals("defaultdir gbevin,mypassword", response.getText());
748:            }
749:
750:            public void testScriptedInheritanceJava() throws Exception {
751:                setupSite("site/scripted.xml");
752:                WebConversation conversation = new WebConversation();
753:                WebRequest request = null;
754:                WebResponse response = null;
755:                WebLink link = null;
756:
757:                request = new GetMethodWebRequest(
758:                        "http://localhost:8181/scripted/java/inheritance");
759:                response = conversation.getResponse(request);
760:                assertTrue(!response.getText().equals("This is the child"));
761:
762:                request = new GetMethodWebRequest(
763:                        "http://localhost:8181/scripted/java/inheritance");
764:                response = conversation.getResponse(request);
765:                link = response.getLinkWith("activate child");
766:                response = link.click();
767:
768:                assertEquals("This is the child", response.getText());
769:            }
770:
771:            public void testScriptedInheritanceRhino() throws Exception {
772:                setupSite("site/scripted.xml");
773:                WebConversation conversation = new WebConversation();
774:                WebRequest request = null;
775:                WebResponse response = null;
776:                WebLink link = null;
777:
778:                request = new GetMethodWebRequest(
779:                        "http://localhost:8181/scripted/rhino/inheritance");
780:                response = conversation.getResponse(request);
781:                assertTrue(!response.getText().equals("This is the child"));
782:
783:                request = new GetMethodWebRequest(
784:                        "http://localhost:8181/scripted/rhino/inheritance");
785:                response = conversation.getResponse(request);
786:                link = response.getLinkWith("activate child");
787:                response = link.click();
788:
789:                assertEquals("This is the child", response.getText());
790:            }
791:
792:            public void testScriptedInheritanceJython() throws Exception {
793:                setupSite("site/scripted.xml");
794:                WebConversation conversation = new WebConversation();
795:                WebRequest request = null;
796:                WebResponse response = null;
797:                WebLink link = null;
798:
799:                request = new GetMethodWebRequest(
800:                        "http://localhost:8181/scripted/jython/inheritance");
801:                response = conversation.getResponse(request);
802:                assertTrue(!response.getText().equals("This is the child"));
803:
804:                request = new GetMethodWebRequest(
805:                        "http://localhost:8181/scripted/jython/inheritance");
806:                response = conversation.getResponse(request);
807:                link = response.getLinkWith("activate child");
808:                response = link.click();
809:
810:                assertEquals("This is the child", response.getText());
811:            }
812:
813:            public void testScriptedInheritanceJruby() throws Exception {
814:                setupSite("site/scripted.xml");
815:                WebConversation conversation = new WebConversation();
816:                WebRequest request = null;
817:                WebResponse response = null;
818:                WebLink link = null;
819:
820:                request = new GetMethodWebRequest(
821:                        "http://localhost:8181/scripted/jruby/inheritance");
822:                response = conversation.getResponse(request);
823:                assertTrue(!response.getText().equals("This is the child"));
824:
825:                request = new GetMethodWebRequest(
826:                        "http://localhost:8181/scripted/jruby/inheritance");
827:                response = conversation.getResponse(request);
828:                link = response.getLinkWith("activate child");
829:                response = link.click();
830:
831:                assertEquals("This is the child", response.getText());
832:            }
833:
834:            public void testScriptedInheritanceJacl() throws Exception {
835:                setupSite("site/scripted.xml");
836:                WebConversation conversation = new WebConversation();
837:                WebRequest request = null;
838:                WebResponse response = null;
839:                WebLink link = null;
840:
841:                request = new GetMethodWebRequest(
842:                        "http://localhost:8181/scripted/jacl/inheritance");
843:                response = conversation.getResponse(request);
844:                assertTrue(!response.getText().equals("This is the child"));
845:
846:                request = new GetMethodWebRequest(
847:                        "http://localhost:8181/scripted/jacl/inheritance");
848:                response = conversation.getResponse(request);
849:                link = response.getLinkWith("activate child");
850:                response = link.click();
851:
852:                assertEquals("This is the child", response.getText());
853:            }
854:
855:            public void testScriptedInheritanceBeanshell() throws Exception {
856:                setupSite("site/scripted.xml");
857:                WebConversation conversation = new WebConversation();
858:                WebRequest request = null;
859:                WebResponse response = null;
860:                WebLink link = null;
861:
862:                request = new GetMethodWebRequest(
863:                        "http://localhost:8181/scripted/beanshell/inheritance");
864:                response = conversation.getResponse(request);
865:                assertTrue(!response.getText().equals("This is the child"));
866:
867:                request = new GetMethodWebRequest(
868:                        "http://localhost:8181/scripted/beanshell/inheritance");
869:                response = conversation.getResponse(request);
870:                link = response.getLinkWith("activate child");
871:                response = link.click();
872:
873:                assertEquals("This is the child", response.getText());
874:            }
875:
876:            public void testScriptedInheritancePnuts() throws Exception {
877:                setupSite("site/scripted.xml");
878:                WebConversation conversation = new WebConversation();
879:                WebRequest request = null;
880:                WebResponse response = null;
881:                WebLink link = null;
882:
883:                request = new GetMethodWebRequest(
884:                        "http://localhost:8181/scripted/pnuts/inheritance");
885:                response = conversation.getResponse(request);
886:                assertTrue(!response.getText().equals("This is the child"));
887:
888:                request = new GetMethodWebRequest(
889:                        "http://localhost:8181/scripted/pnuts/inheritance");
890:                response = conversation.getResponse(request);
891:                link = response.getLinkWith("activate child");
892:                response = link.click();
893:
894:                assertEquals("This is the child", response.getText());
895:            }
896:
897:            public void testScriptedInheritanceGroovy() throws Exception {
898:                setupSite("site/scripted.xml");
899:                WebConversation conversation = new WebConversation();
900:                WebRequest request = null;
901:                WebResponse response = null;
902:                WebLink link = null;
903:
904:                request = new GetMethodWebRequest(
905:                        "http://localhost:8181/scripted/groovy/inheritance");
906:                response = conversation.getResponse(request);
907:                assertTrue(!response.getText().equals("This is the child"));
908:
909:                request = new GetMethodWebRequest(
910:                        "http://localhost:8181/scripted/groovy/inheritance");
911:                response = conversation.getResponse(request);
912:                link = response.getLinkWith("activate child");
913:                response = link.click();
914:
915:                assertEquals("This is the child", response.getText());
916:            }
917:
918:            public void testScriptedInheritanceJanino() throws Exception {
919:                setupSite("site/scripted.xml");
920:                WebConversation conversation = new WebConversation();
921:                WebRequest request = null;
922:                WebResponse response = null;
923:                WebLink link = null;
924:
925:                request = new GetMethodWebRequest(
926:                        "http://localhost:8181/scripted/janino/inheritance");
927:                response = conversation.getResponse(request);
928:                assertTrue(!response.getText().equals("This is the child"));
929:
930:                request = new GetMethodWebRequest(
931:                        "http://localhost:8181/scripted/groovy/inheritance");
932:                response = conversation.getResponse(request);
933:                link = response.getLinkWith("activate child");
934:                response = link.click();
935:
936:                assertEquals("This is the child", response.getText());
937:            }
938:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.