Source Code Cross Referenced for TestEngineEmbedding.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) 


0001:        /*
0002:         * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
0003:         * Distributed under the terms of either:
0004:         * - the common development and distribution license (CDDL), v1.0; or
0005:         * - the GNU Lesser General Public License, v2.1 or later
0006:         * $Id: TestEngineEmbedding.java 3634 2007-01-08 21:42:24Z gbevin $
0007:         */
0008:        package com.uwyn.rife.engine;
0009:
0010:        import com.meterware.httpunit.*;
0011:
0012:        import com.uwyn.rife.TestCaseServerside;
0013:        import com.uwyn.rife.config.Config;
0014:        import com.uwyn.rife.config.RifeConfig;
0015:        import com.uwyn.rife.engine.ReservedParameters;
0016:        import com.uwyn.rife.resources.ResourceFinderClasspath;
0017:        import com.uwyn.rife.test.MockConversation;
0018:        import com.uwyn.rife.test.MockForm;
0019:        import com.uwyn.rife.test.MockResponse;
0020:        import com.uwyn.rife.test.ParsedHtml;
0021:        import com.uwyn.rife.tools.StringUtils;
0022:        import java.net.InetAddress;
0023:        import java.util.List;
0024:
0025:        public class TestEngineEmbedding extends TestCaseServerside {
0026:            public TestEngineEmbedding(int siteType, String name) {
0027:                super (siteType, name);
0028:            }
0029:
0030:            public void testSimple() throws Exception {
0031:                setupSite("site/embedding.xml");
0032:                WebConversation conversation = new WebConversation();
0033:                WebRequest request = null;
0034:                WebResponse response = null;
0035:
0036:                // Get the host name
0037:                String hostname = InetAddress.getByName("127.0.0.1")
0038:                        .getHostName();
0039:
0040:                request = new GetMethodWebRequest(
0041:                        "http://localhost:8181/simple");
0042:                response = conversation.getResponse(request);
0043:                assertEquals("Embedded: false" + "The element \"Value: null"
0044:                        + "Embedded: true" + "Just some text 127.0.0.1:"
0045:                        + hostname + ":\" is being embedded.", response
0046:                        .getText());
0047:            }
0048:
0049:            public void testValue() throws Exception {
0050:                setupSite("site/embedding.xml");
0051:                WebConversation conversation = new WebConversation();
0052:                WebRequest request = null;
0053:                WebResponse response = null;
0054:
0055:                // Get the host name
0056:                String hostname = InetAddress.getByName("127.0.0.1")
0057:                        .getHostName();
0058:
0059:                request = new GetMethodWebRequest("http://localhost:8181/value");
0060:                response = conversation.getResponse(request);
0061:                assertEquals("The element \"" + "Value: this is the value"
0062:                        + "Embedded: true" + "Just some text 127.0.0.1:"
0063:                        + hostname + ":" + "\" is being embedded.\n"
0064:                        + "Value: this is the value" + "Embedded: true"
0065:                        + "Just some text 127.0.0.1:" + hostname + ":" + "\n"
0066:                        + "Value: this is another value" + "Embedded: true"
0067:                        + "Just some text 127.0.0.1:" + hostname + ":" + "\n"
0068:                        + "Value: this is the third value" + "Embedded: true"
0069:                        + "Just some text 127.0.0.1:" + hostname + ":" + "\n",
0070:                        response.getText());
0071:            }
0072:
0073:            public void testData() throws Exception {
0074:                setupSite("site/embedding.xml");
0075:                WebConversation conversation = new WebConversation();
0076:                WebRequest request = null;
0077:                WebResponse response = null;
0078:
0079:                request = new GetMethodWebRequest("http://localhost:8181/data");
0080:                response = conversation.getResponse(request);
0081:                assertEquals(
0082:                        "The element \"Data: value1\" is being embedded.\n"
0083:                                + "Data: value1\n" + "Data: value2\n"
0084:                                + "Data: value3\n", response.getText());
0085:            }
0086:
0087:            public void testProperties() throws Exception {
0088:                setupSite("site/embedding.xml");
0089:                WebConversation conversation = new WebConversation();
0090:                WebRequest request = null;
0091:                WebResponse response = null;
0092:
0093:                request = new GetMethodWebRequest(
0094:                        "http://localhost:8181/properties");
0095:                response = conversation.getResponse(request);
0096:                assertEquals("The element \"Properties" + "yes" + "no" + "else"
0097:                        + "yeah" + "null" + "\" is being embedded.\n", response
0098:                        .getText());
0099:            }
0100:
0101:            public void testClearTemplate() throws Exception {
0102:                setupSite("site/embedding.xml");
0103:                WebConversation conversation = new WebConversation();
0104:                WebRequest request = null;
0105:                WebResponse response = null;
0106:
0107:                // Get the host name
0108:                String hostname = InetAddress.getByName("127.0.0.1")
0109:                        .getHostName();
0110:
0111:                request = new GetMethodWebRequest(
0112:                        "http://localhost:8181/clear_template");
0113:                response = conversation.getResponse(request);
0114:                assertEquals(
0115:                        "The element \"Value: nullEmbedded: trueJust some text 127.0.0.1:"
0116:                                + hostname
0117:                                + ":\" is being embedded."
0118:                                + "The element \"Value: nullEmbedded: trueJust some text 127.0.0.1:"
0119:                                + hostname + ":\" is being embedded.", response
0120:                                .getText());
0121:            }
0122:
0123:            public void testSubmission() throws Exception {
0124:                setupSite("site/embedding.xml");
0125:                WebConversation conversation = new WebConversation();
0126:                WebRequest request = null;
0127:                WebResponse response = null;
0128:                WebForm form = null;
0129:
0130:                request = new GetMethodWebRequest(
0131:                        "http://localhost:8181/submission");
0132:                response = conversation.getResponse(request);
0133:                assertEquals(
0134:                        "The element \"<form method=\"post\" action=\"/submission/embedded\" name=\"embedded\">\n"
0135:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0136:                                + Base64.encode(".SUBMISSION_EMBEDDED")
0137:                                + "\" />\n"
0138:                                + "<input type=\"text\" name=\"login\">\n"
0139:                                + "<input type=\"text\" name=\"password\">\n"
0140:                                + "</form>\n\" is being embedded.", response
0141:                                .getText());
0142:                form = response.getForms()[0];
0143:                form.setParameter("login", "the login");
0144:                form.setParameter("password", "its password");
0145:                response = form.submit();
0146:                assertEquals("the login,its password", response.getText());
0147:            }
0148:
0149:            public void testList() throws Exception {
0150:                setupSite("site/embedding.xml");
0151:                WebConversation conversation = new WebConversation();
0152:                WebRequest request = null;
0153:                WebResponse response = null;
0154:                WebForm form = null;
0155:
0156:                String hostname = InetAddress.getByName("127.0.0.1")
0157:                        .getHostName();
0158:
0159:                request = new GetMethodWebRequest("http://localhost:8181/list");
0160:                response = conversation.getResponse(request);
0161:                assertEquals(
0162:                        "Value: null" + "Embedded: true"
0163:                                + "Just some text 127.0.0.1:"
0164:                                + hostname
0165:                                + ":\n"
0166:                                + "<div>0\n"
0167:                                + "<form method=\"post\" action=\"/list\" name=\"form0\">\n"
0168:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0169:                                + Base64
0170:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:0^.LISTENTRY_EMBEDDED")
0171:                                + "\" />\n"
0172:                                + "<input type=\"text\" name=\"value\">\n"
0173:                                + "<input type=\"submit\" />\n"
0174:                                + "</form>\n"
0175:                                + "</div>\n"
0176:                                + "<div>1\n"
0177:                                + "<form method=\"post\" action=\"/list\" name=\"form1\">\n"
0178:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0179:                                + Base64
0180:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:1^.LISTENTRY_EMBEDDED")
0181:                                + "\" />\n"
0182:                                + "<input type=\"text\" name=\"value\">\n"
0183:                                + "<input type=\"submit\" />\n"
0184:                                + "</form>\n"
0185:                                + "</div>\n"
0186:                                + "<div>2\n"
0187:                                + "<form method=\"post\" action=\"/list\" name=\"form2\">\n"
0188:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0189:                                + Base64
0190:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:2^.LISTENTRY_EMBEDDED")
0191:                                + "\" />\n"
0192:                                + "<input type=\"text\" name=\"value\">\n"
0193:                                + "<input type=\"submit\" />\n"
0194:                                + "</form>\n"
0195:                                + "</div>\n"
0196:                                + "<div>3\n"
0197:                                + "<form method=\"post\" action=\"/list\" name=\"form3\">\n"
0198:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0199:                                + Base64
0200:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:3^.LISTENTRY_EMBEDDED")
0201:                                + "\" />\n"
0202:                                + "<input type=\"text\" name=\"value\">\n"
0203:                                + "<input type=\"submit\" />\n"
0204:                                + "</form>\n"
0205:                                + "</div>\n"
0206:                                + "<div>4\n"
0207:                                + "<form method=\"post\" action=\"/list\" name=\"form4\">\n"
0208:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0209:                                + Base64
0210:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:4^.LISTENTRY_EMBEDDED")
0211:                                + "\" />\n"
0212:                                + "<input type=\"text\" name=\"value\">\n"
0213:                                + "<input type=\"submit\" />\n"
0214:                                + "</form>\n"
0215:                                + "</div>\n"
0216:                                + "<div>5\n"
0217:                                + "<form method=\"post\" action=\"/list\" name=\"form5\">\n"
0218:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0219:                                + Base64
0220:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:5^.LISTENTRY_EMBEDDED")
0221:                                + "\" />\n"
0222:                                + "<input type=\"text\" name=\"value\">\n"
0223:                                + "<input type=\"submit\" />\n"
0224:                                + "</form>\n"
0225:                                + "</div>\n"
0226:                                + "<div>6\n"
0227:                                + "<form method=\"post\" action=\"/list\" name=\"form6\">\n"
0228:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0229:                                + Base64
0230:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:6^.LISTENTRY_EMBEDDED")
0231:                                + "\" />\n"
0232:                                + "<input type=\"text\" name=\"value\">\n"
0233:                                + "<input type=\"submit\" />\n"
0234:                                + "</form>\n"
0235:                                + "</div>\n"
0236:                                + "<div>7\n"
0237:                                + "<form method=\"post\" action=\"/list\" name=\"form7\">\n"
0238:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0239:                                + Base64
0240:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:7^.LISTENTRY_EMBEDDED")
0241:                                + "\" />\n"
0242:                                + "<input type=\"text\" name=\"value\">\n"
0243:                                + "<input type=\"submit\" />\n"
0244:                                + "</form>\n"
0245:                                + "</div>\n"
0246:                                + "<div>8\n"
0247:                                + "<form method=\"post\" action=\"/list\" name=\"form8\">\n"
0248:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0249:                                + Base64
0250:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:8^.LISTENTRY_EMBEDDED")
0251:                                + "\" />\n"
0252:                                + "<input type=\"text\" name=\"value\">\n"
0253:                                + "<input type=\"submit\" />\n"
0254:                                + "</form>\n"
0255:                                + "</div>\n"
0256:                                + "<div>9\n"
0257:                                + "<form method=\"post\" action=\"/list\" name=\"form9\">\n"
0258:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0259:                                + Base64
0260:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:9^.LISTENTRY_EMBEDDED")
0261:                                + "\" />\n"
0262:                                + "<input type=\"text\" name=\"value\">\n"
0263:                                + "<input type=\"submit\" />\n"
0264:                                + "</form>\n"
0265:                                + "</div>\n" + "\n" + "\n", response.getText());
0266:
0267:                form = response.getFormWithName("form3");
0268:                form.setParameter("value", "formvalue3");
0269:                response = form.submit();
0270:                assertEquals(
0271:                        "Value: null" + "Embedded: true"
0272:                                + "Just some text 127.0.0.1:"
0273:                                + hostname
0274:                                + ":\n"
0275:                                + "<div>0\n"
0276:                                + "<form method=\"post\" action=\"/list\" name=\"form0\">\n"
0277:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0278:                                + Base64
0279:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:0^.LISTENTRY_EMBEDDED")
0280:                                + "\" />\n"
0281:                                + "<input type=\"text\" name=\"value\">\n"
0282:                                + "<input type=\"submit\" />\n"
0283:                                + "</form>\n"
0284:                                + "</div>\n"
0285:                                + "<div>1\n"
0286:                                + "<form method=\"post\" action=\"/list\" name=\"form1\">\n"
0287:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0288:                                + Base64
0289:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:1^.LISTENTRY_EMBEDDED")
0290:                                + "\" />\n"
0291:                                + "<input type=\"text\" name=\"value\">\n"
0292:                                + "<input type=\"submit\" />\n"
0293:                                + "</form>\n"
0294:                                + "</div>\n"
0295:                                + "<div>2\n"
0296:                                + "<form method=\"post\" action=\"/list\" name=\"form2\">\n"
0297:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0298:                                + Base64
0299:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:2^.LISTENTRY_EMBEDDED")
0300:                                + "\" />\n"
0301:                                + "<input type=\"text\" name=\"value\">\n"
0302:                                + "<input type=\"submit\" />\n"
0303:                                + "</form>\n"
0304:                                + "</div>\n"
0305:                                + "<div>3\n"
0306:                                + "formvalue3</div>\n"
0307:                                + "<div>4\n"
0308:                                + "<form method=\"post\" action=\"/list\" name=\"form4\">\n"
0309:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0310:                                + Base64
0311:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:4^.LISTENTRY_EMBEDDED")
0312:                                + "\" />\n"
0313:                                + "<input type=\"text\" name=\"value\">\n"
0314:                                + "<input type=\"submit\" />\n"
0315:                                + "</form>\n"
0316:                                + "</div>\n"
0317:                                + "<div>5\n"
0318:                                + "<form method=\"post\" action=\"/list\" name=\"form5\">\n"
0319:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0320:                                + Base64
0321:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:5^.LISTENTRY_EMBEDDED")
0322:                                + "\" />\n"
0323:                                + "<input type=\"text\" name=\"value\">\n"
0324:                                + "<input type=\"submit\" />\n"
0325:                                + "</form>\n"
0326:                                + "</div>\n"
0327:                                + "<div>6\n"
0328:                                + "<form method=\"post\" action=\"/list\" name=\"form6\">\n"
0329:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0330:                                + Base64
0331:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:6^.LISTENTRY_EMBEDDED")
0332:                                + "\" />\n"
0333:                                + "<input type=\"text\" name=\"value\">\n"
0334:                                + "<input type=\"submit\" />\n"
0335:                                + "</form>\n"
0336:                                + "</div>\n"
0337:                                + "<div>7\n"
0338:                                + "<form method=\"post\" action=\"/list\" name=\"form7\">\n"
0339:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0340:                                + Base64
0341:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:7^.LISTENTRY_EMBEDDED")
0342:                                + "\" />\n"
0343:                                + "<input type=\"text\" name=\"value\">\n"
0344:                                + "<input type=\"submit\" />\n"
0345:                                + "</form>\n"
0346:                                + "</div>\n"
0347:                                + "<div>8\n"
0348:                                + "<form method=\"post\" action=\"/list\" name=\"form8\">\n"
0349:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0350:                                + Base64
0351:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:8^.LISTENTRY_EMBEDDED")
0352:                                + "\" />\n"
0353:                                + "<input type=\"text\" name=\"value\">\n"
0354:                                + "<input type=\"submit\" />\n"
0355:                                + "</form>\n"
0356:                                + "</div>\n"
0357:                                + "<div>9\n"
0358:                                + "<form method=\"post\" action=\"/list\" name=\"form9\">\n"
0359:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0360:                                + Base64
0361:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:9^.LISTENTRY_EMBEDDED")
0362:                                + "\" />\n"
0363:                                + "<input type=\"text\" name=\"value\">\n"
0364:                                + "<input type=\"submit\" />\n"
0365:                                + "</form>\n"
0366:                                + "</div>\n" + "\n" + "\n", response.getText());
0367:
0368:                form = response.getFormWithName("form7");
0369:                form.setParameter("value", "formvalue7");
0370:                response = form.submit();
0371:                assertEquals(
0372:                        "Value: null" + "Embedded: true"
0373:                                + "Just some text 127.0.0.1:"
0374:                                + hostname
0375:                                + ":\n"
0376:                                + "<div>0\n"
0377:                                + "<form method=\"post\" action=\"/list\" name=\"form0\">\n"
0378:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0379:                                + Base64
0380:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:0^.LISTENTRY_EMBEDDED")
0381:                                + "\" />\n"
0382:                                + "<input type=\"text\" name=\"value\">\n"
0383:                                + "<input type=\"submit\" />\n"
0384:                                + "</form>\n"
0385:                                + "</div>\n"
0386:                                + "<div>1\n"
0387:                                + "<form method=\"post\" action=\"/list\" name=\"form1\">\n"
0388:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0389:                                + Base64
0390:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:1^.LISTENTRY_EMBEDDED")
0391:                                + "\" />\n"
0392:                                + "<input type=\"text\" name=\"value\">\n"
0393:                                + "<input type=\"submit\" />\n"
0394:                                + "</form>\n"
0395:                                + "</div>\n"
0396:                                + "<div>2\n"
0397:                                + "<form method=\"post\" action=\"/list\" name=\"form2\">\n"
0398:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0399:                                + Base64
0400:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:2^.LISTENTRY_EMBEDDED")
0401:                                + "\" />\n"
0402:                                + "<input type=\"text\" name=\"value\">\n"
0403:                                + "<input type=\"submit\" />\n"
0404:                                + "</form>\n"
0405:                                + "</div>\n"
0406:                                + "<div>3\n"
0407:                                + "<form method=\"post\" action=\"/list\" name=\"form3\">\n"
0408:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0409:                                + Base64
0410:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:3^.LISTENTRY_EMBEDDED")
0411:                                + "\" />\n"
0412:                                + "<input type=\"text\" name=\"value\">\n"
0413:                                + "<input type=\"submit\" />\n"
0414:                                + "</form>\n"
0415:                                + "</div>\n"
0416:                                + "<div>4\n"
0417:                                + "<form method=\"post\" action=\"/list\" name=\"form4\">\n"
0418:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0419:                                + Base64
0420:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:4^.LISTENTRY_EMBEDDED")
0421:                                + "\" />\n"
0422:                                + "<input type=\"text\" name=\"value\">\n"
0423:                                + "<input type=\"submit\" />\n"
0424:                                + "</form>\n"
0425:                                + "</div>\n"
0426:                                + "<div>5\n"
0427:                                + "<form method=\"post\" action=\"/list\" name=\"form5\">\n"
0428:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0429:                                + Base64
0430:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:5^.LISTENTRY_EMBEDDED")
0431:                                + "\" />\n"
0432:                                + "<input type=\"text\" name=\"value\">\n"
0433:                                + "<input type=\"submit\" />\n"
0434:                                + "</form>\n"
0435:                                + "</div>\n"
0436:                                + "<div>6\n"
0437:                                + "<form method=\"post\" action=\"/list\" name=\"form6\">\n"
0438:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0439:                                + Base64
0440:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:6^.LISTENTRY_EMBEDDED")
0441:                                + "\" />\n"
0442:                                + "<input type=\"text\" name=\"value\">\n"
0443:                                + "<input type=\"submit\" />\n"
0444:                                + "</form>\n"
0445:                                + "</div>\n"
0446:                                + "<div>7\n"
0447:                                + "formvalue7</div>\n"
0448:                                + "<div>8\n"
0449:                                + "<form method=\"post\" action=\"/list\" name=\"form8\">\n"
0450:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0451:                                + Base64
0452:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:8^.LISTENTRY_EMBEDDED")
0453:                                + "\" />\n"
0454:                                + "<input type=\"text\" name=\"value\">\n"
0455:                                + "<input type=\"submit\" />\n"
0456:                                + "</form>\n"
0457:                                + "</div>\n"
0458:                                + "<div>9\n"
0459:                                + "<form method=\"post\" action=\"/list\" name=\"form9\">\n"
0460:                                + "<input name=\"submission\" type=\"hidden\" value=\"changeEntry\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0461:                                + Base64
0462:                                        .encode(".LIST::engine_embedding_list:.LISTENTRY_EMBEDDED:9^.LISTENTRY_EMBEDDED")
0463:                                + "\" />\n"
0464:                                + "<input type=\"text\" name=\"value\">\n"
0465:                                + "<input type=\"submit\" />\n"
0466:                                + "</form>\n"
0467:                                + "</div>\n" + "\n" + "\n", response.getText());
0468:            }
0469:
0470:            public void testSubmissionExit() throws Exception {
0471:                setupSite("site/embedding.xml");
0472:                WebConversation conversation = new WebConversation();
0473:                WebRequest request = null;
0474:                WebResponse response = null;
0475:                WebForm form = null;
0476:
0477:                request = new GetMethodWebRequest(
0478:                        "http://localhost:8181/submission_exit");
0479:                response = conversation.getResponse(request);
0480:                assertEquals(
0481:                        "The element \"<form method=\"post\" action=\"/submission_exit/embedded\" name=\"embedded\">\n"
0482:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0483:                                + Base64.encode(".SUBMISSION_EXIT_EMBEDDED")
0484:                                + "\" />\n"
0485:                                + "<input type=\"text\" name=\"login\">\n"
0486:                                + "<input type=\"text\" name=\"password\">\n"
0487:                                + "</form>\n\" is being embedded.\n", response
0488:                                .getText());
0489:                form = response.getForms()[0];
0490:                form.setParameter("login", "the login");
0491:                form.setParameter("password", "its password");
0492:                response = form.submit();
0493:                assertEquals(
0494:                        "The element \"<form method=\"post\" action=\"/submission_exit/embedded\" name=\"embedded\">\n"
0495:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0496:                                + Base64.encode(".SUBMISSION_EXIT_EMBEDDED")
0497:                                + "\" />\n"
0498:                                + "<input type=\"text\" name=\"login\">\n"
0499:                                + "<input type=\"text\" name=\"password\">\n"
0500:                                + "</form>\n\" is being embedded here too.\n",
0501:                        response.getText());
0502:            }
0503:
0504:            public void testSubmissionExitNourl() throws Exception {
0505:                setupSite("site/embedding.xml");
0506:                WebConversation conversation = new WebConversation();
0507:                WebRequest request = null;
0508:                WebResponse response = null;
0509:                WebForm form = null;
0510:
0511:                request = new GetMethodWebRequest(
0512:                        "http://localhost:8181/submission_exit_nourl");
0513:                response = conversation.getResponse(request);
0514:                assertEquals(
0515:                        "The element nourl \"<form method=\"post\" action=\"/submission_exit_nourl\" name=\"embedded\">\n"
0516:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0517:                                + Base64
0518:                                        .encode(".SUBMISSION_EXIT_NOURL::engine_embedding_submission_exit_nourl:.SUBMISSION_EXIT_EMBEDDED_NOURL^.SUBMISSION_EXIT_EMBEDDED_NOURL")
0519:                                + "\" />\n"
0520:                                + "<input type=\"text\" name=\"login\">\n"
0521:                                + "<input type=\"text\" name=\"password\">\n"
0522:                                + "</form>\n\" is being embedded.\n", response
0523:                                .getText());
0524:                form = response.getForms()[0];
0525:                form.setParameter("login", "the login");
0526:                form.setParameter("password", "its password");
0527:                response = form.submit();
0528:                assertEquals(
0529:                        "The element nourl \"The element \"<form method=\"post\" action=\"/submission_exit/embedded\" name=\"embedded\">\n"
0530:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0531:                                + Base64.encode(".SUBMISSION_EXIT_EMBEDDED")
0532:                                + "\" />\n"
0533:                                + "<input type=\"text\" name=\"login\">\n"
0534:                                + "<input type=\"text\" name=\"password\">\n"
0535:                                + "</form>\n\" is being embedded here too.\n\" is being embedded.\n",
0536:                        response.getText());
0537:            }
0538:
0539:            public void testSubmissionExitCancelEmbedding() throws Exception {
0540:                setupSite("site/embedding.xml");
0541:                WebConversation conversation = new WebConversation();
0542:                WebRequest request = null;
0543:                WebResponse response = null;
0544:                WebForm form = null;
0545:
0546:                request = new GetMethodWebRequest(
0547:                        "http://localhost:8181/submission_exit_cancel");
0548:                response = conversation.getResponse(request);
0549:                assertEquals(
0550:                        "The element cancel \"<form method=\"post\" action=\"/submission_exit_cancel\" name=\"embedded\">\n"
0551:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0552:                                + Base64
0553:                                        .encode(".SUBMISSION_EXIT_CANCEL::engine_embedding_submission_exit_cancel:.SUBMISSION_EXIT_EMBEDDED_CANCEL^.SUBMISSION_EXIT_EMBEDDED_CANCEL")
0554:                                + "\" />\n"
0555:                                + "<input type=\"text\" name=\"login\">\n"
0556:                                + "<input type=\"text\" name=\"password\">\n"
0557:                                + "</form>\n\" is being embedded.\n", response
0558:                                .getText());
0559:                form = response.getForms()[0];
0560:                form.setParameter("login", "the login");
0561:                form.setParameter("password", "its password");
0562:                response = form.submit();
0563:                assertEquals(
0564:                        "The element \"<form method=\"post\" action=\"/submission_exit/embedded\" name=\"embedded\">\n"
0565:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0566:                                + Base64.encode(".SUBMISSION_EXIT_EMBEDDED")
0567:                                + "\" />\n"
0568:                                + "<input type=\"text\" name=\"login\">\n"
0569:                                + "<input type=\"text\" name=\"password\">\n"
0570:                                + "</form>\n\" is being embedded here too.\n",
0571:                        response.getText());
0572:            }
0573:
0574:            public void testSubmissionNourl() throws Exception {
0575:                setupSite("site/embedding.xml");
0576:                WebConversation conversation = new WebConversation();
0577:                WebRequest request = null;
0578:                WebResponse response = null;
0579:                WebForm form = null;
0580:
0581:                request = new GetMethodWebRequest(
0582:                        "http://localhost:8181/submission_nourl");
0583:                response = conversation.getResponse(request);
0584:                assertEquals(
0585:                        "The element \"<form method=\"post\" action=\"/submission_nourl\" name=\"embedded\">\n"
0586:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0587:                                + Base64
0588:                                        .encode(".SUBMISSION_NOURL::engine_embedding_submission_nourl:.SUBMISSION_NOURL_EMBEDDED^.SUBMISSION_NOURL_EMBEDDED")
0589:                                + "\" />\n"
0590:                                + "<input type=\"text\" name=\"login\">\n"
0591:                                + "<input type=\"text\" name=\"password\">\n"
0592:                                + "</form>\n\" is being embedded.\n", response
0593:                                .getText());
0594:                form = response.getForms()[0];
0595:                form.setParameter("login", "the login");
0596:                form.setParameter("password", "its password");
0597:                response = form.submit();
0598:                assertEquals(
0599:                        "The element \"the login,its password\" is being embedded.\n",
0600:                        response.getText());
0601:            }
0602:
0603:            public void testSubmissionNourlPathinfo() throws Exception {
0604:                setupSite("site/embedding.xml");
0605:                WebConversation conversation = new WebConversation();
0606:                WebRequest request = null;
0607:                WebResponse response = null;
0608:                WebForm form = null;
0609:
0610:                request = new GetMethodWebRequest(
0611:                        "http://localhost:8181/submission_nourl_pathinfo");
0612:                response = conversation.getResponse(request);
0613:                assertEquals(
0614:                        "The element \"<form method=\"post\" action=\"/submission_nourl_pathinfo/\" name=\"embedded\">\n"
0615:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0616:                                + Base64
0617:                                        .encode(".SUBMISSION_NOURL_PATHINFO::engine_embedding_submission_nourl_pathinfo:.SUBMISSION_NOURL_PATHINFO_EMBEDDED^.SUBMISSION_NOURL_PATHINFO_EMBEDDED")
0618:                                + "\" />\n"
0619:                                + "<input type=\"text\" name=\"login\">\n"
0620:                                + "<input type=\"text\" name=\"password\">\n"
0621:                                + "</form>\n\" is being embedded.\n", response
0622:                                .getText());
0623:                form = response.getForms()[0];
0624:                form.setParameter("login", "the login");
0625:                form.setParameter("password", "its password");
0626:                response = form.submit();
0627:                assertEquals(
0628:                        "The element \"the login,its password\" is being embedded.\n",
0629:                        response.getText());
0630:
0631:                request = new GetMethodWebRequest(
0632:                        "http://localhost:8181/submission_nourl_pathinfo/somepathinfo");
0633:                response = conversation.getResponse(request);
0634:                assertEquals(
0635:                        "The element \"<form method=\"post\" action=\"/submission_nourl_pathinfo/somepathinfo\" name=\"embedded\">\n"
0636:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0637:                                + Base64
0638:                                        .encode(".SUBMISSION_NOURL_PATHINFO::engine_embedding_submission_nourl_pathinfo:.SUBMISSION_NOURL_PATHINFO_EMBEDDED^.SUBMISSION_NOURL_PATHINFO_EMBEDDED")
0639:                                + "\" />\n"
0640:                                + "<input type=\"text\" name=\"login\">\n"
0641:                                + "<input type=\"text\" name=\"password\">\n"
0642:                                + "</form>\n\" is being embedded.\n", response
0643:                                .getText());
0644:                form = response.getForms()[0];
0645:                form.setParameter("login", "the login");
0646:                form.setParameter("password", "its password");
0647:                response = form.submit();
0648:                assertEquals(
0649:                        "The element \"the login,its password\" is being embedded.\n",
0650:                        response.getText());
0651:            }
0652:
0653:            public void testSubmissionSame() throws Exception {
0654:                setupSite("site/embedding.xml");
0655:                WebConversation conversation = new WebConversation();
0656:                WebRequest request = null;
0657:                WebResponse response = null;
0658:                WebForm form = null;
0659:
0660:                request = new GetMethodWebRequest(
0661:                        "http://localhost:8181/submission_same");
0662:                request.setParameter("language", "dutch");
0663:                response = conversation.getResponse(request);
0664:                assertEquals(
0665:                        "The element \"<form method=\"post\" action=\"/submission_same/embedded\" name=\"embedded\">\n"
0666:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0667:                                + Base64.encode(".SUBMISSION_SAME_EMBEDDED")
0668:                                + "\" /><input name=\"inputs\" type=\"hidden\" value=\"bGFuZ3VhZ2VuAGR1dGNo\" />\n"
0669:                                + "<input type=\"text\" name=\"login\">\n"
0670:                                + "<input type=\"text\" name=\"password\">\n"
0671:                                + "<input type=\"text\" name=\"language\">\n"
0672:                                + "</form>\n\" is being embedded.\n"
0673:                                + "<form method=\"post\" action=\"/submission_same\" name=\"embedding\">\n"
0674:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0675:                                + Base64.encode(".SUBMISSION_SAME")
0676:                                + "\" /><input name=\"inputs\" type=\"hidden\" value=\"LlNVQk1JU1NJT05fU0FNRWMAbGFuZ3VhZ2VuAGR1dGNo\" />\n"
0677:                                + "<input type=\"text\" name=\"login\">\n"
0678:                                + "<input type=\"text\" name=\"password\">\n"
0679:                                + "</form>,dutch\n", response.getText());
0680:
0681:                form = response.getFormWithName("embedded");
0682:                form.setParameter("login", "the login");
0683:                form.setParameter("password", "its password");
0684:                form.setParameter("language", "english");
0685:                assertEquals("the login,its password,english", form.submit()
0686:                        .getText());
0687:
0688:                form = response.getFormWithName("embedding");
0689:                form.setParameter("login", "the login");
0690:                form.setParameter("password", "its password");
0691:                response = form.submit();
0692:                assertEquals(
0693:                        "The element \"<form method=\"post\" action=\"/submission_same/embedded\" name=\"embedded\">\n"
0694:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0695:                                + Base64.encode(".SUBMISSION_SAME_EMBEDDED")
0696:                                + "\" /><input name=\"inputs\" type=\"hidden\" value=\"bGFuZ3VhZ2VuAGR1dGNo\" /><input name=\"ctxt\" type=\"hidden\" value=\"LlNVQk1JU1NJT05fU0FNRWMAbGFuZ3VhZ2VuAGR1dGNo\" />\n"
0697:                                + "<input type=\"text\" name=\"login\">\n"
0698:                                + "<input type=\"text\" name=\"password\">\n"
0699:                                + "<input type=\"text\" name=\"language\">\n"
0700:                                + "</form>\n\" is being embedded.\n"
0701:                                + "the login,its password,dutch\n", form
0702:                                .submit().getText());
0703:            }
0704:
0705:            public void testSubmissionSameNourl() throws Exception {
0706:                setupSite("site/embedding.xml");
0707:                WebConversation conversation = new WebConversation();
0708:                WebRequest request = null;
0709:                WebResponse response = null;
0710:                WebForm form = null;
0711:
0712:                request = new GetMethodWebRequest(
0713:                        "http://localhost:8181/submission_same_nourl");
0714:                request.setParameter("language", "dutch");
0715:                response = conversation.getResponse(request);
0716:                assertEquals(
0717:                        "The element \"<form method=\"post\" action=\"/submission_same_nourl\" name=\"embedded\">\n"
0718:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0719:                                + Base64
0720:                                        .encode(".SUBMISSION_SAME_NOURL::engine_embedding_submission_same_nourl:.SUBMISSION_SAME_NOURL_EMBEDDED^.SUBMISSION_SAME_NOURL_EMBEDDED")
0721:                                + "\" /><input name=\"inputs\" type=\"hidden\" value=\"bGFuZ3VhZ2VuAGR1dGNo\" />\n"
0722:                                + "<input type=\"text\" name=\"login\">\n"
0723:                                + "<input type=\"text\" name=\"password\">\n"
0724:                                + "<input type=\"text\" name=\"language\">\n"
0725:                                + "</form>\n\" is being embedded.\n"
0726:                                + "<form method=\"post\" action=\"/submission_same_nourl\" name=\"embedding\">\n"
0727:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0728:                                + Base64.encode(".SUBMISSION_SAME_NOURL")
0729:                                + "\" /><input name=\"inputs\" type=\"hidden\" value=\"LlNVQk1JU1NJT05fU0FNRV9OT1VSTGMAbGFuZ3VhZ2VuAGR1dGNo\" />\n"
0730:                                + "<input type=\"text\" name=\"login\">\n"
0731:                                + "<input type=\"text\" name=\"password\">\n"
0732:                                + "</form>,dutch\n", response.getText());
0733:
0734:                form = response.getFormWithName("embedded");
0735:                form.setParameter("login", "the login");
0736:                form.setParameter("password", "its password");
0737:                form.setParameter("language", "english");
0738:                assertEquals(
0739:                        "The element \"the login,its password,english\" is being embedded.\n"
0740:                                + "<form method=\"post\" action=\"/submission_same_nourl\" name=\"embedding\">\n"
0741:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0742:                                + Base64.encode(".SUBMISSION_SAME_NOURL")
0743:                                + "\" /><input name=\"inputs\" type=\"hidden\" value=\"LlNVQk1JU1NJT05fU0FNRV9OT1VSTGMAbGFuZ3VhZ2VuAGR1dGNo\" />\n"
0744:                                + "<input type=\"text\" name=\"login\">\n"
0745:                                + "<input type=\"text\" name=\"password\">\n"
0746:                                + "</form>,dutch\n", form.submit().getText());
0747:
0748:                form = response.getFormWithName("embedding");
0749:                form.setParameter("login", "the login");
0750:                form.setParameter("password", "its password");
0751:                response = form.submit();
0752:                assertEquals(
0753:                        "The element \"<form method=\"post\" action=\"/submission_same_nourl\" name=\"embedded\">\n"
0754:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0755:                                + Base64
0756:                                        .encode(".SUBMISSION_SAME_NOURL::engine_embedding_submission_same_nourl:.SUBMISSION_SAME_NOURL_EMBEDDED^.SUBMISSION_SAME_NOURL_EMBEDDED")
0757:                                + "\" /><input name=\"inputs\" type=\"hidden\" value=\"bGFuZ3VhZ2VuAGR1dGNo\" /><input name=\"ctxt\" type=\"hidden\" value=\"LlNVQk1JU1NJT05fU0FNRV9OT1VSTGMAbGFuZ3VhZ2VuAGR1dGNo\" />\n"
0758:                                + "<input type=\"text\" name=\"login\">\n"
0759:                                + "<input type=\"text\" name=\"password\">\n"
0760:                                + "<input type=\"text\" name=\"language\">\n"
0761:                                + "</form>\n\" is being embedded.\n"
0762:                                + "the login,its password,dutch\n", form
0763:                                .submit().getText());
0764:            }
0765:
0766:            public void testSubmissionGlobalSameNourl() throws Exception {
0767:                setupSite("site/embedding.xml");
0768:                WebConversation conversation = new WebConversation();
0769:                WebRequest request = null;
0770:                WebResponse response = null;
0771:                WebForm form = null;
0772:
0773:                request = new GetMethodWebRequest(
0774:                        "http://localhost:8181/submission_global_same_nourl");
0775:                request.setParameter("language", "dutch");
0776:                response = conversation.getResponse(request);
0777:                assertEquals(
0778:                        "The element \"<form method=\"post\" action=\"/submission_global_same_nourl\" name=\"embedded\">\n"
0779:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"inputs\" type=\"hidden\" value=\"bGFuZ3VhZ2VuAGR1dGNo\" />\n"
0780:                                + "<input type=\"text\" name=\"login\">\n"
0781:                                + "<input type=\"text\" name=\"password\">\n"
0782:                                + "<input type=\"text\" name=\"language\">\n"
0783:                                + "</form>\n\" is being embedded.\n"
0784:                                + "<form method=\"post\" action=\"/submission_global_same_nourl\" name=\"embedding\">\n"
0785:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"inputs\" type=\"hidden\" value=\"LlNVQk1JU1NJT05fR0xPQkFMX1NBTUVfTk9VUkxjAGxhbmd1YWdlbgBkdXRjaA==\" />\n"
0786:                                + "<input type=\"text\" name=\"login\">\n"
0787:                                + "<input type=\"text\" name=\"password\">\n"
0788:                                + "</form>,dutch\n", response.getText());
0789:
0790:                form = response.getFormWithName("embedded");
0791:                form.setParameter("login", "the login");
0792:                form.setParameter("password", "its password");
0793:                form.setParameter("language", "english");
0794:                assertEquals(
0795:                        "The element \"the login,its password,english\" is being embedded.\n"
0796:                                + "the login,its password,dutch\n", form
0797:                                .submit().getText());
0798:            }
0799:
0800:            public void testSubmissionMultiple() throws Exception {
0801:                setupSite("site/embedding.xml");
0802:                WebConversation conversation = new WebConversation();
0803:                WebRequest request = null;
0804:                WebResponse response = null;
0805:                WebForm form = null;
0806:
0807:                request = new GetMethodWebRequest(
0808:                        "http://localhost:8181/submission_multiple");
0809:                response = conversation.getResponse(request);
0810:                assertEquals(
0811:                        "Element1 \"<form method=\"post\" action=\"/submission_multiple/embedded\" name=\"embedded0\">\n"
0812:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0813:                                + Base64
0814:                                        .encode(".SUBMISSION_MULTIPLE_EMBEDDED")
0815:                                + "\" />\n"
0816:                                + "<input type=\"text\" name=\"login\">\n"
0817:                                + "<input type=\"text\" name=\"password\">\n"
0818:                                + "</form>\n"
0819:                                + "\" being embedded.\n"
0820:                                + "Element2 \"<form method=\"post\" action=\"/submission_multiple/embedded\" name=\"embedded1\">\n"
0821:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0822:                                + Base64
0823:                                        .encode(".SUBMISSION_MULTIPLE_EMBEDDED")
0824:                                + "\" />\n"
0825:                                + "<input type=\"text\" name=\"login\">\n"
0826:                                + "<input type=\"text\" name=\"password\">\n"
0827:                                + "</form>\n"
0828:                                + "\" being embedded.\n"
0829:                                + "Element3 \"<form method=\"post\" action=\"/submission_multiple/embedded\" name=\"embedded2\">\n"
0830:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0831:                                + Base64
0832:                                        .encode(".SUBMISSION_MULTIPLE_EMBEDDED")
0833:                                + "\" />\n"
0834:                                + "<input type=\"text\" name=\"login\">\n"
0835:                                + "<input type=\"text\" name=\"password\">\n"
0836:                                + "</form>\n"
0837:                                + "\" being embedded.\n"
0838:                                + "Element4 \"<form method=\"post\" action=\"/submission_multiple/embedded\" name=\"embedded3\">\n"
0839:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0840:                                + Base64
0841:                                        .encode(".SUBMISSION_MULTIPLE_EMBEDDED")
0842:                                + "\" />\n"
0843:                                + "<input type=\"text\" name=\"login\">\n"
0844:                                + "<input type=\"text\" name=\"password\">\n"
0845:                                + "</form>\n" + "\" being embedded.\n",
0846:                        response.getText());
0847:
0848:                form = response.getForms()[0];
0849:                form.setParameter("login", "the login 0");
0850:                form.setParameter("password", "its password 0");
0851:                assertEquals("the login 0,its password 0,", form.submit()
0852:                        .getText());
0853:
0854:                form = response.getForms()[1];
0855:                form.setParameter("login", "the login 1");
0856:                form.setParameter("password", "its password 1");
0857:                assertEquals("the login 1,its password 1,", form.submit()
0858:                        .getText());
0859:
0860:                form = response.getForms()[2];
0861:                form.setParameter("login", "the login 2");
0862:                form.setParameter("password", "its password 2");
0863:                assertEquals("the login 2,its password 2,", form.submit()
0864:                        .getText());
0865:
0866:                form = response.getForms()[3];
0867:                form.setParameter("login", "the login 3");
0868:                form.setParameter("password", "its password 3");
0869:                assertEquals("the login 3,its password 3,", form.submit()
0870:                        .getText());
0871:            }
0872:
0873:            public void testSubmissionMultipleNourl() throws Exception {
0874:                setupSite("site/embedding.xml");
0875:                WebConversation conversation = new WebConversation();
0876:                WebRequest request = null;
0877:                WebResponse response = null;
0878:                WebForm form = null;
0879:
0880:                request = new GetMethodWebRequest(
0881:                        "http://localhost:8181/submission_multiple_nourl");
0882:                response = conversation.getResponse(request);
0883:                assertEquals(
0884:                        "Element1 \"<form method=\"post\" action=\"/submission_multiple_nourl\" name=\"embedded0\">\n"
0885:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0886:                                + Base64
0887:                                        .encode(".SUBMISSION_MULTIPLE_NOURL::engine_embedding_submission_multiple_nourl:.SUBMISSION_MULTIPLE_NOURL_EMBEDDED^.SUBMISSION_MULTIPLE_NOURL_EMBEDDED")
0888:                                + "\" />\n"
0889:                                + "<input type=\"text\" name=\"login\">\n"
0890:                                + "<input type=\"text\" name=\"password\">\n"
0891:                                + "</form>\n"
0892:                                + "\" being embedded.\n"
0893:                                + "Element2 \"<form method=\"post\" action=\"/submission_multiple_nourl\" name=\"embedded1\">\n"
0894:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0895:                                + Base64
0896:                                        .encode(".SUBMISSION_MULTIPLE_NOURL::engine_embedding_submission_multiple_nourl:.SUBMISSION_MULTIPLE_NOURL_EMBEDDED:nr1^.SUBMISSION_MULTIPLE_NOURL_EMBEDDED")
0897:                                + "\" />\n"
0898:                                + "<input type=\"text\" name=\"login\">\n"
0899:                                + "<input type=\"text\" name=\"password\">\n"
0900:                                + "</form>\n"
0901:                                + "\" being embedded.\n"
0902:                                + "Element3 \"<form method=\"post\" action=\"/submission_multiple_nourl\" name=\"embedded2\">\n"
0903:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0904:                                + Base64
0905:                                        .encode(".SUBMISSION_MULTIPLE_NOURL::engine_embedding_submission_multiple_nourl:.SUBMISSION_MULTIPLE_NOURL_EMBEDDED:nr2^.SUBMISSION_MULTIPLE_NOURL_EMBEDDED")
0906:                                + "\" />\n"
0907:                                + "<input type=\"text\" name=\"login\">\n"
0908:                                + "<input type=\"text\" name=\"password\">\n"
0909:                                + "</form>\n"
0910:                                + "\" being embedded.\n"
0911:                                + "Element4 \"<form method=\"post\" action=\"/submission_multiple_nourl\" name=\"embedded3\">\n"
0912:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0913:                                + Base64
0914:                                        .encode(".SUBMISSION_MULTIPLE_NOURL::engine_embedding_submission_multiple_nourl:.SUBMISSION_MULTIPLE_NOURL_EMBEDDED:nr3^.SUBMISSION_MULTIPLE_NOURL_EMBEDDED")
0915:                                + "\" />\n"
0916:                                + "<input type=\"text\" name=\"login\">\n"
0917:                                + "<input type=\"text\" name=\"password\">\n"
0918:                                + "</form>\n" + "\" being embedded.\n",
0919:                        response.getText());
0920:
0921:                form = response.getForms()[0];
0922:                form.setParameter("login", "the login 0");
0923:                form.setParameter("password", "its password 0");
0924:                assertEquals(
0925:                        "Element1 \"the login 0,its password 0,0\" being embedded.\n"
0926:                                + "Element2 \"<form method=\"post\" action=\"/submission_multiple_nourl\" name=\"embedded1\">\n"
0927:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0928:                                + Base64
0929:                                        .encode(".SUBMISSION_MULTIPLE_NOURL::engine_embedding_submission_multiple_nourl:.SUBMISSION_MULTIPLE_NOURL_EMBEDDED:nr1^.SUBMISSION_MULTIPLE_NOURL_EMBEDDED")
0930:                                + "\" />\n"
0931:                                + "<input type=\"text\" name=\"login\">\n"
0932:                                + "<input type=\"text\" name=\"password\">\n"
0933:                                + "</form>\n"
0934:                                + "\" being embedded.\n"
0935:                                + "Element3 \"<form method=\"post\" action=\"/submission_multiple_nourl\" name=\"embedded2\">\n"
0936:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0937:                                + Base64
0938:                                        .encode(".SUBMISSION_MULTIPLE_NOURL::engine_embedding_submission_multiple_nourl:.SUBMISSION_MULTIPLE_NOURL_EMBEDDED:nr2^.SUBMISSION_MULTIPLE_NOURL_EMBEDDED")
0939:                                + "\" />\n"
0940:                                + "<input type=\"text\" name=\"login\">\n"
0941:                                + "<input type=\"text\" name=\"password\">\n"
0942:                                + "</form>\n"
0943:                                + "\" being embedded.\n"
0944:                                + "Element4 \"<form method=\"post\" action=\"/submission_multiple_nourl\" name=\"embedded3\">\n"
0945:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0946:                                + Base64
0947:                                        .encode(".SUBMISSION_MULTIPLE_NOURL::engine_embedding_submission_multiple_nourl:.SUBMISSION_MULTIPLE_NOURL_EMBEDDED:nr3^.SUBMISSION_MULTIPLE_NOURL_EMBEDDED")
0948:                                + "\" />\n"
0949:                                + "<input type=\"text\" name=\"login\">\n"
0950:                                + "<input type=\"text\" name=\"password\">\n"
0951:                                + "</form>\n" + "\" being embedded.\n", form
0952:                                .submit().getText());
0953:
0954:                form = response.getForms()[1];
0955:                form.setParameter("login", "the login 1");
0956:                form.setParameter("password", "its password 1");
0957:                assertEquals(
0958:                        "Element1 \"<form method=\"post\" action=\"/submission_multiple_nourl\" name=\"embedded0\">\n"
0959:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0960:                                + Base64
0961:                                        .encode(".SUBMISSION_MULTIPLE_NOURL::engine_embedding_submission_multiple_nourl:.SUBMISSION_MULTIPLE_NOURL_EMBEDDED^.SUBMISSION_MULTIPLE_NOURL_EMBEDDED")
0962:                                + "\" />\n"
0963:                                + "<input type=\"text\" name=\"login\">\n"
0964:                                + "<input type=\"text\" name=\"password\">\n"
0965:                                + "</form>\n"
0966:                                + "\" being embedded.\n"
0967:                                + "Element2 \"the login 1,its password 1,1\" being embedded.\n"
0968:                                + "Element3 \"<form method=\"post\" action=\"/submission_multiple_nourl\" name=\"embedded2\">\n"
0969:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0970:                                + Base64
0971:                                        .encode(".SUBMISSION_MULTIPLE_NOURL::engine_embedding_submission_multiple_nourl:.SUBMISSION_MULTIPLE_NOURL_EMBEDDED:nr2^.SUBMISSION_MULTIPLE_NOURL_EMBEDDED")
0972:                                + "\" />\n"
0973:                                + "<input type=\"text\" name=\"login\">\n"
0974:                                + "<input type=\"text\" name=\"password\">\n"
0975:                                + "</form>\n"
0976:                                + "\" being embedded.\n"
0977:                                + "Element4 \"<form method=\"post\" action=\"/submission_multiple_nourl\" name=\"embedded3\">\n"
0978:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0979:                                + Base64
0980:                                        .encode(".SUBMISSION_MULTIPLE_NOURL::engine_embedding_submission_multiple_nourl:.SUBMISSION_MULTIPLE_NOURL_EMBEDDED:nr3^.SUBMISSION_MULTIPLE_NOURL_EMBEDDED")
0981:                                + "\" />\n"
0982:                                + "<input type=\"text\" name=\"login\">\n"
0983:                                + "<input type=\"text\" name=\"password\">\n"
0984:                                + "</form>\n" + "\" being embedded.\n", form
0985:                                .submit().getText());
0986:
0987:                form = response.getForms()[2];
0988:                form.setParameter("login", "the login 2");
0989:                form.setParameter("password", "its password 2");
0990:                assertEquals(
0991:                        "Element1 \"<form method=\"post\" action=\"/submission_multiple_nourl\" name=\"embedded0\">\n"
0992:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
0993:                                + Base64
0994:                                        .encode(".SUBMISSION_MULTIPLE_NOURL::engine_embedding_submission_multiple_nourl:.SUBMISSION_MULTIPLE_NOURL_EMBEDDED^.SUBMISSION_MULTIPLE_NOURL_EMBEDDED")
0995:                                + "\" />\n"
0996:                                + "<input type=\"text\" name=\"login\">\n"
0997:                                + "<input type=\"text\" name=\"password\">\n"
0998:                                + "</form>\n"
0999:                                + "\" being embedded.\n"
1000:                                + "Element2 \"<form method=\"post\" action=\"/submission_multiple_nourl\" name=\"embedded1\">\n"
1001:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
1002:                                + Base64
1003:                                        .encode(".SUBMISSION_MULTIPLE_NOURL::engine_embedding_submission_multiple_nourl:.SUBMISSION_MULTIPLE_NOURL_EMBEDDED:nr1^.SUBMISSION_MULTIPLE_NOURL_EMBEDDED")
1004:                                + "\" />\n"
1005:                                + "<input type=\"text\" name=\"login\">\n"
1006:                                + "<input type=\"text\" name=\"password\">\n"
1007:                                + "</form>\n"
1008:                                + "\" being embedded.\n"
1009:                                + "Element3 \"the login 2,its password 2,2\" being embedded.\n"
1010:                                + "Element4 \"<form method=\"post\" action=\"/submission_multiple_nourl\" name=\"embedded3\">\n"
1011:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
1012:                                + Base64
1013:                                        .encode(".SUBMISSION_MULTIPLE_NOURL::engine_embedding_submission_multiple_nourl:.SUBMISSION_MULTIPLE_NOURL_EMBEDDED:nr3^.SUBMISSION_MULTIPLE_NOURL_EMBEDDED")
1014:                                + "\" />\n"
1015:                                + "<input type=\"text\" name=\"login\">\n"
1016:                                + "<input type=\"text\" name=\"password\">\n"
1017:                                + "</form>\n" + "\" being embedded.\n", form
1018:                                .submit().getText());
1019:
1020:                form = response.getForms()[3];
1021:                form.setParameter("login", "the login 3");
1022:                form.setParameter("password", "its password 3");
1023:                assertEquals(
1024:                        "Element1 \"<form method=\"post\" action=\"/submission_multiple_nourl\" name=\"embedded0\">\n"
1025:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
1026:                                + Base64
1027:                                        .encode(".SUBMISSION_MULTIPLE_NOURL::engine_embedding_submission_multiple_nourl:.SUBMISSION_MULTIPLE_NOURL_EMBEDDED^.SUBMISSION_MULTIPLE_NOURL_EMBEDDED")
1028:                                + "\" />\n"
1029:                                + "<input type=\"text\" name=\"login\">\n"
1030:                                + "<input type=\"text\" name=\"password\">\n"
1031:                                + "</form>\n"
1032:                                + "\" being embedded.\n"
1033:                                + "Element2 \"<form method=\"post\" action=\"/submission_multiple_nourl\" name=\"embedded1\">\n"
1034:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
1035:                                + Base64
1036:                                        .encode(".SUBMISSION_MULTIPLE_NOURL::engine_embedding_submission_multiple_nourl:.SUBMISSION_MULTIPLE_NOURL_EMBEDDED:nr1^.SUBMISSION_MULTIPLE_NOURL_EMBEDDED")
1037:                                + "\" />\n"
1038:                                + "<input type=\"text\" name=\"login\">\n"
1039:                                + "<input type=\"text\" name=\"password\">\n"
1040:                                + "</form>\n"
1041:                                + "\" being embedded.\n"
1042:                                + "Element3 \"<form method=\"post\" action=\"/submission_multiple_nourl\" name=\"embedded2\">\n"
1043:                                + "<input name=\"submission\" type=\"hidden\" value=\"credentials\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
1044:                                + Base64
1045:                                        .encode(".SUBMISSION_MULTIPLE_NOURL::engine_embedding_submission_multiple_nourl:.SUBMISSION_MULTIPLE_NOURL_EMBEDDED:nr2^.SUBMISSION_MULTIPLE_NOURL_EMBEDDED")
1046:                                + "\" />\n"
1047:                                + "<input type=\"text\" name=\"login\">\n"
1048:                                + "<input type=\"text\" name=\"password\">\n"
1049:                                + "</form>\n"
1050:                                + "\" being embedded.\n"
1051:                                + "Element4 \"the login 3,its password 3,3\" being embedded.\n",
1052:                        form.submit().getText());
1053:            }
1054:
1055:            public void testGlobalvar() throws Exception {
1056:                setupSite("site/embedding.xml");
1057:                WebConversation conversation = new WebConversation();
1058:                WebRequest request = null;
1059:                WebResponse response = null;
1060:                WebForm form = null;
1061:
1062:                request = new GetMethodWebRequest(
1063:                        "http://localhost:8181/globalvar");
1064:                response = conversation.getResponse(request);
1065:                assertEquals(
1066:                        "value 1,"
1067:                                + "value 2,"
1068:                                + "value 3,"
1069:                                + "value 4,"
1070:                                + "<!--V 'OUTPUT:var5'/-->,"
1071:                                + "<form action=\"/globalvar\"><input name=\"submission\" type=\"hidden\" value=\"submission\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
1072:                                + Base64
1073:                                        .encode(".GLOBALVAR::engine_embedding_globalvar:.GLOBALVAR_EMBEDDED^.GLOBALVAR_EMBEDDED")
1074:                                + "\" /><input type=\"submit\" /></form>\n",
1075:                        response.getText());
1076:                form = response.getForms()[0];
1077:                response = form.submit();
1078:                assertEquals("embedded value 1," + "<!--V 'OUTPUT:var2'/-->,"
1079:                        + "value 3," + "value 4,"
1080:                        + "<!--V 'OUTPUT:var5'/-->,submitted\n", response
1081:                        .getText());
1082:            }
1083:
1084:            public void testEmbedderInputs() throws Exception {
1085:                SiteBuilder builder = new SiteBuilder("site/embedding.xml",
1086:                        ResourceFinderClasspath.getInstance());
1087:                MockConversation conversation = new MockConversation(builder
1088:                        .getSite());
1089:                MockForm form;
1090:                ParsedHtml parsed;
1091:                MockResponse response;
1092:
1093:                response = conversation
1094:                        .doRequest("/embedder_inputs?var1=value%201&var2=value%202&var3=value%203&var4=value%204");
1095:                assertEquals(
1096:                        "value 1,"
1097:                                + "value 2,"
1098:                                + "value 3,"
1099:                                + "value 4,"
1100:                                + "<!--V 'INPUT:var5'/-->,"
1101:                                + "<!--V 'INPUT:var6'/-->,"
1102:                                + "<form action=\"/embedder_inputs/\"><input name=\"submission\" type=\"hidden\" value=\"submission\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
1103:                                + Base64
1104:                                        .encode(".EMBEDDER_INPUTS::engine_embedding_embedderinputs:.EMBEDDER_INPUTS_EMBEDDED^.EMBEDDER_INPUTS_EMBEDDED")
1105:                                + "\" /><input name=\"inputs\" type=\"hidden\" value=\"dmFyMW4AdmFsdWUgMXAAdmFyMm4AdmFsdWUgMnAAdmFyM24AdmFsdWUgM3AAdmFyNG4AdmFsdWUgNA==_LkVNQkVEREVSX0lOUFVUUzo6ZW5naW5lX2VtYmVkZGluZ19lbWJlZGRlcmlucHV0czouRU1CRURERVJfSU5QVVRTX0VNQkVEREVEYwB2YXIzbgB2YWx1ZSAzcAB2YXI0bgB2YWx1ZSA0\" /><input type=\"submit\" /></form>\n",
1106:                        response.getText());
1107:                parsed = response.getParsedHtml();
1108:                form = parsed.getForms().get(0);
1109:                response = form.submit();
1110:                assertEquals("value 1," + "value 2," + "value 3," + "value 4,"
1111:                        + "<!--V 'INPUT:var5'/-->," + "<!--V 'INPUT:var6'/-->,"
1112:                        + "embedded no var6," + "submitted\n", response
1113:                        .getText());
1114:
1115:                response = conversation
1116:                        .doRequest("/embedder_inputs/test/value5/value6?var1=value%201&var2=value%202&var3=value%203&var4=value%204");
1117:                assertEquals(
1118:                        "value 1,"
1119:                                + "value 2,"
1120:                                + "value 3,"
1121:                                + "value 4,"
1122:                                + "value5,"
1123:                                + "value6,"
1124:                                + "<form action=\"/embedder_inputs/test/value5/value6\"><input name=\"submission\" type=\"hidden\" value=\"submission\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
1125:                                + Base64
1126:                                        .encode(".EMBEDDER_INPUTS::engine_embedding_embedderinputs:.EMBEDDER_INPUTS_EMBEDDED^.EMBEDDER_INPUTS_EMBEDDED")
1127:                                + "\" /><input name=\"inputs\" type=\"hidden\" value=\"dmFyMW4AdmFsdWUgMXAAdmFyMm4AdmFsdWUgMnAAdmFyM24AdmFsdWUgM3AAdmFyNW4AdmFsdWU1cAB2YXI2bgB2YWx1ZTZwAHZhcjRuAHZhbHVlIDQ=_LkVNQkVEREVSX0lOUFVUUzo6ZW5naW5lX2VtYmVkZGluZ19lbWJlZGRlcmlucHV0czouRU1CRURERVJfSU5QVVRTX0VNQkVEREVEYwB2YXIzbgB2YWx1ZSAzcAB2YXI0bgB2YWx1ZSA0cAB2YXI1bgB2YWx1ZTU=\" /><input type=\"submit\" /></form>\n",
1128:                        response.getText());
1129:                parsed = response.getParsedHtml();
1130:                form = parsed.getForms().get(0);
1131:                response = form.submit();
1132:                assertEquals("value 1," + "value 2," + "value 3," + "value 4,"
1133:                        + "value5," + "value6," + "embedded value6,"
1134:                        + "submitted\n", response.getText());
1135:
1136:                response = conversation
1137:                        .doRequest("/embedder_inputs/test/value5/value6?var1=value%201&var2=value%202&var3=value%203&var4=value%204");
1138:                assertEquals(
1139:                        "value 1,"
1140:                                + "value 2,"
1141:                                + "value 3,"
1142:                                + "value 4,"
1143:                                + "value5,"
1144:                                + "value6,"
1145:                                + "<form action=\"/embedder_inputs/test/value5/value6\"><input name=\"submission\" type=\"hidden\" value=\"submission\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
1146:                                + Base64
1147:                                        .encode(".EMBEDDER_INPUTS::engine_embedding_embedderinputs:.EMBEDDER_INPUTS_EMBEDDED^.EMBEDDER_INPUTS_EMBEDDED")
1148:                                + "\" /><input name=\"inputs\" type=\"hidden\" value=\"dmFyMW4AdmFsdWUgMXAAdmFyMm4AdmFsdWUgMnAAdmFyM24AdmFsdWUgM3AAdmFyNW4AdmFsdWU1cAB2YXI2bgB2YWx1ZTZwAHZhcjRuAHZhbHVlIDQ=_LkVNQkVEREVSX0lOUFVUUzo6ZW5naW5lX2VtYmVkZGluZ19lbWJlZGRlcmlucHV0czouRU1CRURERVJfSU5QVVRTX0VNQkVEREVEYwB2YXIzbgB2YWx1ZSAzcAB2YXI0bgB2YWx1ZSA0cAB2YXI1bgB2YWx1ZTU=\" /><input type=\"submit\" /></form>\n",
1149:                        response.getText());
1150:                parsed = response.getParsedHtml();
1151:                form = parsed.getForms().get(0);
1152:                form.setParameter("var6", "submission value6");
1153:                response = form.submit();
1154:                assertEquals("value 1," + "value 2," + "value 3," + "value 4,"
1155:                        + "value5," + "value6," + "embedded submission value6,"
1156:                        + "submitted\n", response.getText());
1157:            }
1158:
1159:            public void testCookies() throws Exception {
1160:                setupSite("site/embedding.xml");
1161:                WebConversation conversation = new WebConversation();
1162:                WebRequest request = null;
1163:                WebResponse response = null;
1164:                WebForm form = null;
1165:
1166:                request = new GetMethodWebRequest(
1167:                        "http://localhost:8181/cookies");
1168:                response = conversation.getResponse(request);
1169:                assertEquals(
1170:                        "value 1,"
1171:                                + "value 2,"
1172:                                + "value 3,"
1173:                                + "value 4,"
1174:                                + "<!--V 'OUTCOOKIE:cookie5'/-->,"
1175:                                + "<form action=\"/cookies\"><input name=\"submission\" type=\"hidden\" value=\"submission\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
1176:                                + Base64
1177:                                        .encode(".COOKIES::engine_embedding_cookies:.COOKIES_EMBEDDED^.COOKIES_EMBEDDED")
1178:                                + "\" /><input type=\"submit\" /></form>\n",
1179:                        response.getText());
1180:                form = response.getForms()[0];
1181:                response = form.submit();
1182:                assertEquals("embedded value 1," + "embedded value 2,"
1183:                        + "value 3," + "embedded value 4,"
1184:                        + "<!--V 'OUTCOOKIE:cookie5'/-->,submitted\n", response
1185:                        .getText());
1186:            }
1187:
1188:            public void testCookiesOutjection() throws Exception {
1189:                setupSite("site/embedding.xml");
1190:                WebConversation conversation = new WebConversation();
1191:                WebRequest request = null;
1192:                WebResponse response = null;
1193:                WebForm form = null;
1194:
1195:                request = new GetMethodWebRequest(
1196:                        "http://localhost:8181/cookies/outjection");
1197:                response = conversation.getResponse(request);
1198:                assertEquals(
1199:                        "value 1,"
1200:                                + "value 2,"
1201:                                + "value 3,"
1202:                                + "value 4,"
1203:                                + "<!--V 'OUTCOOKIE:cookie5'/-->,"
1204:                                + "<form action=\"/cookies/outjection\"><input name=\"submission\" type=\"hidden\" value=\"submission\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
1205:                                + Base64
1206:                                        .encode(".COOKIES_OUTJECTION::engine_embedding_cookies_outjection:.COOKIES_OUTJECTION_EMBEDDED^.COOKIES_OUTJECTION_EMBEDDED")
1207:                                + "\" /><input type=\"submit\" /></form>\n",
1208:                        response.getText());
1209:                form = response.getForms()[0];
1210:                response = form.submit();
1211:                assertEquals("embedded value 1," + "embedded value 2,"
1212:                        + "value 3," + "embedded value 4,"
1213:                        + "<!--V 'OUTCOOKIE:cookie5'/-->,submitted\n", response
1214:                        .getText());
1215:            }
1216:
1217:            public void testSuccessiveGlobalcookie() throws Exception {
1218:                setupSite("site/embedding.xml");
1219:                WebConversation conversation = new WebConversation();
1220:                WebRequest request = null;
1221:                WebResponse response = null;
1222:
1223:                request = new GetMethodWebRequest(
1224:                        "http://localhost:8181/successive_globalcookie");
1225:                response = conversation.getResponse(request);
1226:                assertEquals(
1227:                        "embedded value 1,embedded value 2,<!--V 'OUTCOOKIE:cookie3'/-->,<!--V 'OUTCOOKIE:cookie4'/-->,<!--V 'OUTCOOKIE:cookie5'/-->\n"
1228:                                + "first: embedded\n"
1229:                                + "second: embedded value 1embedded value 2no cookie3\n",
1230:                        response.getText());
1231:            }
1232:
1233:            public void testInheritanceEmbedded() throws Exception {
1234:                setupSite("site/embedding.xml");
1235:                WebConversation conversation = new WebConversation();
1236:                WebRequest request = null;
1237:                WebResponse response = null;
1238:                WebLink link = null;
1239:
1240:                request = new GetMethodWebRequest(
1241:                        "http://localhost:8181/inheritance/embedded");
1242:                response = conversation.getResponse(request);
1243:                assertEquals(
1244:                        "The element \"<html><body><a href=\"/inheritance/embedded/target?submission=activatechild&submissioncontext="
1245:                                + StringUtils
1246:                                        .encodeUrl(Base64
1247:                                                .encode(".INHERITANCE_EMBEDDED_TARGET^.INHERITANCE_EMBEDDED_TARGET_PARENT"))
1248:                                + "&childrequest=ZWxlbWVudC9lbWJlZGRpbmcvZW1iZWRkZWQvaW5oZXJpdGFuY2VfY2hpbGQueG1seABHRVRtAA%3D%3D&triggerlist=\">activate child</a></body></html>\" is being embedded.\n",
1249:                        response.getText());
1250:                link = response.getLinkWith("activate child");
1251:                response = link.click();
1252:                assertEquals("This is the child", response.getText());
1253:            }
1254:
1255:            public void testInheritanceEmbeddedNourl() throws Exception {
1256:                setupSite("site/embedding.xml");
1257:                WebConversation conversation = new WebConversation();
1258:                WebRequest request = null;
1259:                WebResponse response = null;
1260:                WebLink link = null;
1261:
1262:                request = new GetMethodWebRequest(
1263:                        "http://localhost:8181/inheritance/embedded/nourl");
1264:                response = conversation.getResponse(request);
1265:                assertEquals(
1266:                        "The element \"<html><body><a href=\"/inheritance/embedded/nourl?submission=activatechild&submissioncontext="
1267:                                + StringUtils
1268:                                        .encodeUrl(Base64
1269:                                                .encode(".INHERITANCE_EMBEDDED_NOURL::engine_embedding_inheritance_embedded_nourl:.INHERITANCE_EMBEDDED_NOURL_TARGET^.INHERITANCE_EMBEDDED_NOURL_TARGET_PARENT"))
1270:                                + "&childrequest=ZWxlbWVudC9lbWJlZGRpbmcvZW1iZWRkZWQvaW5oZXJpdGFuY2VfY2hpbGQueG1seABHRVRtAA%3D%3D&triggerlist=\">activate child</a></body></html>\" is being embedded.\n",
1271:                        response.getText());
1272:                link = response.getLinkWith("activate child");
1273:                response = link.click();
1274:                assertEquals(
1275:                        "The element \"This is the child\" is being embedded.\n",
1276:                        response.getText());
1277:            }
1278:
1279:            public void testSuccessiveInheritanceEmbeddedNourl()
1280:                    throws Exception {
1281:                setupSite("site/embedding.xml");
1282:                WebConversation conversation = new WebConversation();
1283:                WebRequest request = null;
1284:                WebResponse response = null;
1285:                WebLink link = null;
1286:
1287:                request = new GetMethodWebRequest(
1288:                        "http://localhost:8181/inheritance_successive/embedded/nourl");
1289:                response = conversation.getResponse(request);
1290:                assertEquals(
1291:                        "The element \"<html><body><a href=\"/inheritance_successive/embedded/nourl?submission=activatechild&submissioncontext="
1292:                                + StringUtils
1293:                                        .encodeUrl(Base64
1294:                                                .encode(".INHERITANCE_SUCCESSIVE_EMBEDDED_NOURL::engine_embedding_inheritance_embedded_nourl:.INHERITANCE_EMBEDDED_NOURL_TARGET^.INHERITANCE_EMBEDDED_NOURL_TARGET_PARENT"))
1295:                                + "&childrequest=ZWxlbWVudC9lbWJlZGRpbmcvZW1iZWRkZWQvaW5oZXJpdGFuY2VfY2hpbGQueG1seABHRVRtAA%3D%3D&triggerlist=\">activate child</a></body></html>\" is being embedded.\n",
1296:                        response.getText());
1297:                link = response.getLinkWith("activate child");
1298:                response = link.click();
1299:                assertEquals(
1300:                        "The element \"This is the child\" is being embedded.\n",
1301:                        response.getText());
1302:            }
1303:
1304:            public void testInheritanceCookieEmbedding() throws Exception {
1305:                setupSite("site/embedding.xml");
1306:                WebConversation conversation = new WebConversation();
1307:                WebRequest request = null;
1308:                WebResponse response = null;
1309:                WebLink link = null;
1310:
1311:                request = new GetMethodWebRequest(
1312:                        "http://localhost:8181/inheritance/cookie/embedding");
1313:                response = conversation.getResponse(request);
1314:                assertEquals(
1315:                        "<html><body><a href=\"/inheritance/cookie/embedding?submission=activatechild&submissioncontext="
1316:                                + StringUtils
1317:                                        .encodeUrl(Base64
1318:                                                .encode(".INHERITANCE_COOKIE_EMBEDDING^.INHERITANCE_COOKIE_EMBEDDING_PARENT"))
1319:                                + "&childrequest=ZWxlbWVudC9lbWJlZGRpbmcvaW5oZXJpdGFuY2VfY29va2llX2VtYmVkZGluZy54bWx4AEdFVG0A&triggerlist=\">activate child</a></body></html>",
1320:                        response.getText());
1321:                link = response.getLinkWith("activate child");
1322:                response = link.click();
1323:                assertEquals(
1324:                        "The element \"This is the child\" is being embedded.\n",
1325:                        response.getText());
1326:            }
1327:
1328:            public void testInheritanceGlobalvarEmbedding() throws Exception {
1329:                setupSite("site/embedding.xml");
1330:                WebConversation conversation = new WebConversation();
1331:                WebRequest request = null;
1332:                WebResponse response = null;
1333:                WebLink link = null;
1334:
1335:                request = new GetMethodWebRequest(
1336:                        "http://localhost:8181/inheritance/globalvar/embedding");
1337:                response = conversation.getResponse(request);
1338:                assertEquals(
1339:                        "<html><body><a href=\"/inheritance/globalvar/embedding?submission=activatechild&submissioncontext="
1340:                                + StringUtils
1341:                                        .encodeUrl(Base64
1342:                                                .encode(".INHERITANCE_GLOBALVAR_EMBEDDING^.INHERITANCE_GLOBALVAR_EMBEDDING_PARENT"))
1343:                                + "&childrequest=ZWxlbWVudC9lbWJlZGRpbmcvaW5oZXJpdGFuY2VfZ2xvYmFsdmFyX2VtYmVkZGluZy54bWx4AEdFVG0A&triggerlist=\">activate child</a></body></html>",
1344:                        response.getText());
1345:                link = response.getLinkWith("activate child");
1346:                response = link.click();
1347:                assertEquals(
1348:                        "The element \"This is the child\" is being embedded.\n",
1349:                        response.getText());
1350:            }
1351:
1352:            public void testScripted() throws Exception {
1353:                setupSite("site/embedding.xml");
1354:                WebConversation conversation = new WebConversation();
1355:                WebRequest request = null;
1356:                WebResponse response = null;
1357:                WebForm form = null;
1358:
1359:                request = new GetMethodWebRequest(
1360:                        "http://localhost:8181/scripted");
1361:                request.setParameter("input1", "these values");
1362:                request.setParameter("input2", "are scripted");
1363:                response = conversation.getResponse(request);
1364:                assertEquals(
1365:                        "The element \"these values,are scripted\" is being embedded.",
1366:                        response.getText());
1367:
1368:                request = new GetMethodWebRequest(
1369:                        "http://localhost:8181/scripted");
1370:                request.setParameter("input1", "form");
1371:                response = conversation.getResponse(request);
1372:                assertEquals(
1373:                        "The element \"<html><body>\n"
1374:                                + "\t\t\t\t<form action=\"/scripted/embedded\" method=\"post\">\n"
1375:                                + "\t\t\t\t<input name=\"submission\" type=\"hidden\" value=\"login\" /><input name=\"submissioncontext\" type=\"hidden\" value=\""
1376:                                + Base64.encode(".SCRIPTED_EMBEDDED")
1377:                                + "\" /><input name=\"inputs\" type=\"hidden\" value=\"LlNDUklQVEVEX0VNQkVEREVEYwBpbnB1dDFuAGZvcm0=\" /><input name=\"login\" type=\"text\">\n"
1378:                                + "\t\t\t\t<input name=\"password\" type=\"password\">\n"
1379:                                + "\t\t\t\t<input type=\"submit\">\n"
1380:                                + "\t\t\t\t</form>\n"
1381:                                + "\t\t\t\t</body></html>\" is being embedded.",
1382:                        response.getText());
1383:                form = response.getForms()[0];
1384:                form.setParameter("login", "mylogin");
1385:                form.setParameter("password", "mypassword");
1386:                response = form.submit();
1387:
1388:                assertEquals("mylogin,mypassword", response.getText());
1389:            }
1390:
1391:            public void testExits() throws Exception {
1392:                setupSite("site/embedding.xml");
1393:                WebConversation conversation = new WebConversation();
1394:                WebRequest request = null;
1395:                WebResponse response = null;
1396:
1397:                request = new GetMethodWebRequest("http://localhost:8181/exits");
1398:                response = conversation.getResponse(request);
1399:                assertEquals("The element \"destination\" is being embedded.",
1400:                        response.getText());
1401:            }
1402:
1403:            public void testExitNourlReflective() throws Exception {
1404:                setupSite("site/embedding.xml");
1405:                WebConversation conversation = new WebConversation();
1406:                WebRequest request = null;
1407:                WebResponse response = null;
1408:
1409:                request = new GetMethodWebRequest(
1410:                        "http://localhost:8181/exit_nourlreflective");
1411:                response = conversation.getResponse(request);
1412:                assertEquals("no embedderinput", response.getElementWithID(
1413:                        "embedder_value1").getAttribute("value"));
1414:                assertEquals("no embeddedinput", response.getElementWithID(
1415:                        "embedder_value2").getAttribute("value"));
1416:                assertEquals("no input", response.getElementWithID(
1417:                        "embedded_inputvalue").getAttribute("value"));
1418:                assertEquals("/exit_nourlreflective?embeddedinput=outputvalue",
1419:                        response.getLinks()[0].getURLString());
1420:
1421:                response = response.getLinks()[0].click();
1422:                assertEquals("no embedderinput", response.getElementWithID(
1423:                        "embedder_value1").getAttribute("value"));
1424:                assertEquals("outputvalue", response.getElementWithID(
1425:                        "embedder_value2").getAttribute("value"));
1426:                assertEquals("outputvalue", response.getElementWithID(
1427:                        "embedded_inputvalue").getAttribute("value"));
1428:
1429:                request = new GetMethodWebRequest(
1430:                        "http://localhost:8181/exit_nourlreflective?embedderinput=embeddervalue1&embeddedinput=embeddervalue2");
1431:                response = conversation.getResponse(request);
1432:                assertEquals("embeddervalue1", response.getElementWithID(
1433:                        "embedder_value1").getAttribute("value"));
1434:                assertEquals("embeddervalue2", response.getElementWithID(
1435:                        "embedder_value2").getAttribute("value"));
1436:                assertEquals("embeddervalue2", response.getElementWithID(
1437:                        "embedded_inputvalue").getAttribute("value"));
1438:                assertEquals(
1439:                        "/exit_nourlreflective?embedderinput=embeddervalue1&embeddedinput=outputvalue",
1440:                        response.getLinks()[0].getURLString());
1441:
1442:                response = response.getLinks()[0].click();
1443:                assertEquals("embeddervalue1", response.getElementWithID(
1444:                        "embedder_value1").getAttribute("value"));
1445:                assertEquals("outputvalue", response.getElementWithID(
1446:                        "embedder_value2").getAttribute("value"));
1447:                assertEquals("outputvalue", response.getElementWithID(
1448:                        "embedded_inputvalue").getAttribute("value"));
1449:            }
1450:
1451:            public void testRelative() throws Exception {
1452:                setupSite("site/embedding.xml");
1453:                WebConversation conversation = new WebConversation();
1454:                WebRequest request = null;
1455:                WebResponse response = null;
1456:
1457:                request = new GetMethodWebRequest(
1458:                        "http://localhost:8181/relative1/toplevel");
1459:                response = conversation.getResponse(request);
1460:                assertEquals(
1461:                        "The element \"Relative1 embedded\" is being embedded.",
1462:                        response.getText());
1463:
1464:                request = new GetMethodWebRequest(
1465:                        "http://localhost:8181/relative2/toplevel");
1466:                response = conversation.getResponse(request);
1467:                assertEquals(
1468:                        "The element \"Relative2 embedded\" is being embedded.",
1469:                        response.getText());
1470:            }
1471:
1472:            public void testParent() throws Exception {
1473:                setupSite("site/embedding.xml");
1474:                WebConversation conversation = new WebConversation();
1475:                WebRequest request = null;
1476:                WebResponse response = null;
1477:
1478:                request = new GetMethodWebRequest(
1479:                        "http://localhost:8181/relative1/parent");
1480:                response = conversation.getResponse(request);
1481:                assertEquals(
1482:                        "The element \"Relative2 embedded\" is being embedded.",
1483:                        response.getText());
1484:
1485:                request = new GetMethodWebRequest(
1486:                        "http://localhost:8181/relative2/parent");
1487:                response = conversation.getResponse(request);
1488:                assertEquals(
1489:                        "The element \"Relative1 embedded\" is being embedded.",
1490:                        response.getText());
1491:            }
1492:
1493:            public void testExplicitProcessing() throws Exception {
1494:                setupSite("site/embedding.xml");
1495:                WebConversation conversation = new WebConversation();
1496:                WebRequest request = null;
1497:                WebResponse response = null;
1498:                WebLink link = null;
1499:
1500:                request = new GetMethodWebRequest(
1501:                        "http://localhost:8181/explicit_processing");
1502:                response = conversation.getResponse(request);
1503:                link = response.getLinkWith("late");
1504:                response = link.click();
1505:                link = response.getLinkWith("result");
1506:                response = link.click();
1507:                assertTrue(response.getText().indexOf("Input \"value2\"") != -1);
1508:                assertTrue(response.getText().indexOf(
1509:                        "Input \"embedded_value2\"") == -1);
1510:
1511:                request = new GetMethodWebRequest(
1512:                        "http://localhost:8181/explicit_processing");
1513:                response = conversation.getResponse(request);
1514:                link = response.getLinkWith("early");
1515:                response = link.click();
1516:                link = response.getLinkWith("result");
1517:                response = link.click();
1518:                assertTrue(response.getText().indexOf("Input \"value2\"") == -1);
1519:                assertTrue(response.getText().indexOf(
1520:                        "Input \"embedded_value2\"") != -1);
1521:            }
1522:
1523:            public void testPriorities() throws Exception {
1524:                setupSite("site/embedding.xml");
1525:                WebConversation conversation = new WebConversation();
1526:                WebRequest request = null;
1527:                WebResponse response = null;
1528:
1529:                request = new GetMethodWebRequest(
1530:                        "http://localhost:8181/priorities");
1531:                response = conversation.getResponse(request);
1532:                assertEquals("These elements are embedded:\n"
1533:                        + ".PRIORITIES_EMBEDDED_LATE\n"
1534:                        + ".PRIORITIES_EMBEDDED_NORMAL\n"
1535:                        + ".PRIORITIES_EMBEDDED_EARLY\n" + "done.\n"
1536:                        + ".PRIORITIES_EMBEDDED_EARLY\n"
1537:                        + ".PRIORITIES_EMBEDDED_NORMAL\n" + ".PRIORITIES\n"
1538:                        + ".PRIORITIES_EMBEDDED_LATE\n", response.getText());
1539:            }
1540:
1541:            public void testGlobalVarSiblingEmbedded() throws Exception {
1542:                setupSite("site/embedding.xml");
1543:                WebConversation conversation = new WebConversation();
1544:                WebRequest request = null;
1545:                WebResponse response = null;
1546:
1547:                request = new GetMethodWebRequest(
1548:                        "http://localhost:8181/globalvar_sibling");
1549:                response = conversation.getResponse(request);
1550:                assertEquals(
1551:                        "embedded2: .GLOBALVAR_SIBLING_EMBEDDED2: inheritancevalue\n"
1552:                                + "embedded3: .GLOBALVAR_SIBLING_EMBEDDED3: null\n"
1553:                                + "embedded1: .GLOBALVAR_SIBLING_EMBEDDED1b: .GLOBALVAR_SIBLING_EMBEDDED1: inheritancevalue\n"
1554:                                + "embedded3b: .GLOBALVAR_SIBLING_EMBEDDED3: inheritancevalue\n"
1555:                                + "embedded4: .GLOBALVAR_SIBLING_EMBEDDED4: inheritancevalue\n",
1556:                        response.getText());
1557:
1558:                request = new GetMethodWebRequest(
1559:                        "http://localhost:8181/globalvar_sibling?clear=true");
1560:                response = conversation.getResponse(request);
1561:                assertEquals(
1562:                        "embedded2: .GLOBALVAR_SIBLING_EMBEDDED2: null\n"
1563:                                + "embedded3: .GLOBALVAR_SIBLING_EMBEDDED3: null\n"
1564:                                + "embedded1: .GLOBALVAR_SIBLING_EMBEDDED1b: .GLOBALVAR_SIBLING_EMBEDDED1: inheritancevalue\n"
1565:                                + "embedded3b: .GLOBALVAR_SIBLING_EMBEDDED3: inheritancevalue\n"
1566:                                + "embedded4: .GLOBALVAR_SIBLING_EMBEDDED4: inheritancevalue\n",
1567:                        response.getText());
1568:            }
1569:
1570:            public void testGlobalVarSiblingEmbeddedBijection()
1571:                    throws Exception {
1572:                setupSite("site/embedding.xml");
1573:                WebConversation conversation = new WebConversation();
1574:                WebRequest request = null;
1575:                WebResponse response = null;
1576:
1577:                request = new GetMethodWebRequest(
1578:                        "http://localhost:8181/globalvar_sibling/bijection");
1579:                response = conversation.getResponse(request);
1580:                assertEquals(
1581:                        "embedded2: .GLOBALVAR_SIBLING_BIJECTION_EMBEDDED2: inheritancevalue\n"
1582:                                + "embedded3: .GLOBALVAR_SIBLING_BIJECTION_EMBEDDED3: null\n"
1583:                                + "embedded1: .GLOBALVAR_SIBLING_BIJECTION_EMBEDDED1b: .GLOBALVAR_SIBLING_BIJECTION_EMBEDDED1: inheritancevalue\n"
1584:                                + "embedded3b: .GLOBALVAR_SIBLING_BIJECTION_EMBEDDED3: inheritancevalue\n"
1585:                                + "embedded4: .GLOBALVAR_SIBLING_BIJECTION_EMBEDDED4: inheritancevalue\n",
1586:                        response.getText());
1587:
1588:                request = new GetMethodWebRequest(
1589:                        "http://localhost:8181/globalvar_sibling/bijection?clear=true");
1590:                response = conversation.getResponse(request);
1591:                assertEquals(
1592:                        "embedded2: .GLOBALVAR_SIBLING_BIJECTION_EMBEDDED2: null\n"
1593:                                + "embedded3: .GLOBALVAR_SIBLING_BIJECTION_EMBEDDED3: null\n"
1594:                                + "embedded1: .GLOBALVAR_SIBLING_BIJECTION_EMBEDDED1b: .GLOBALVAR_SIBLING_BIJECTION_EMBEDDED1: inheritancevalue\n"
1595:                                + "embedded3b: .GLOBALVAR_SIBLING_BIJECTION_EMBEDDED3: inheritancevalue\n"
1596:                                + "embedded4: .GLOBALVAR_SIBLING_BIJECTION_EMBEDDED4: inheritancevalue\n",
1597:                        response.getText());
1598:            }
1599:
1600:            public void testPrintAndWriteBuffer() throws Exception {
1601:                setupSite("site/embedding.xml");
1602:
1603:                WebConversation conversation = new WebConversation();
1604:                WebRequest request = null;
1605:                WebResponse response = null;
1606:
1607:                request = new GetMethodWebRequest(
1608:                        "http://localhost:8181/printandwrite_buffer");
1609:                response = conversation.getResponse(request);
1610:                assertEquals(
1611:                        "The element \"write2write4print1print3\" is being embedded.\n",
1612:                        response.getText());
1613:            }
1614:
1615:            public void testPrintAndWriteNobuffer() throws Exception {
1616:                setupSite("site/embedding.xml");
1617:
1618:                WebConversation conversation = new WebConversation();
1619:                WebRequest request = null;
1620:                WebResponse response = null;
1621:
1622:                request = new GetMethodWebRequest(
1623:                        "http://localhost:8181/printandwrite_nobuffer");
1624:                response = conversation.getResponse(request);
1625:                assertEquals(
1626:                        "The element \"print1write2print3write4\" is being embedded.\n",
1627:                        response.getText());
1628:            }
1629:
1630:            public void testStatefulElementsCounter() throws Exception {
1631:                Site site = new SiteBuilder("site/embedding.xml").getSite();
1632:
1633:                MockConversation conversation = new MockConversation(site);
1634:
1635:                MockResponse response1 = conversation.doRequest("/counter");
1636:                List<MockResponse> responses1 = response1
1637:                        .getEmbeddedResponses();
1638:                assertEquals(2, responses1.size());
1639:                assertEquals("0", responses1.get(0).getTemplate().getValue(
1640:                        "counter"));
1641:                assertEquals("0", responses1.get(1).getTemplate().getValue(
1642:                        "counter"));
1643:                ParsedHtml parsed1 = response1.getParsedHtml();
1644:
1645:                MockResponse response2 = parsed1.getFormWithId("increase1")
1646:                        .submit();
1647:                List<MockResponse> responses2 = response2
1648:                        .getEmbeddedResponses();
1649:                assertEquals(2, responses2.size());
1650:                assertEquals("1", responses2.get(0).getTemplate().getValue(
1651:                        "counter"));
1652:                assertEquals("0", responses2.get(1).getTemplate().getValue(
1653:                        "counter"));
1654:                ParsedHtml parsed2 = response2.getParsedHtml();
1655:
1656:                MockResponse response3 = parsed2.getFormWithId("increase2")
1657:                        .submit();
1658:                List<MockResponse> responses3 = response3
1659:                        .getEmbeddedResponses();
1660:                assertEquals(2, responses3.size());
1661:                assertEquals("1", responses3.get(0).getTemplate().getValue(
1662:                        "counter"));
1663:                assertEquals("1", responses3.get(1).getTemplate().getValue(
1664:                        "counter"));
1665:                ParsedHtml parsed3 = response3.getParsedHtml();
1666:
1667:                MockResponse response4 = parsed3.getFormWithId("increase2")
1668:                        .submit();
1669:                List<MockResponse> responses4 = response4
1670:                        .getEmbeddedResponses();
1671:                assertEquals(2, responses4.size());
1672:                assertEquals("1", responses4.get(0).getTemplate().getValue(
1673:                        "counter"));
1674:                assertEquals("2", responses4.get(1).getTemplate().getValue(
1675:                        "counter"));
1676:                ParsedHtml parsed4 = response4.getParsedHtml();
1677:
1678:                MockResponse response5 = parsed4.getFormWithId("increase2")
1679:                        .submit();
1680:                List<MockResponse> responses5 = response5
1681:                        .getEmbeddedResponses();
1682:                assertEquals(2, responses5.size());
1683:                assertEquals("1", responses5.get(0).getTemplate().getValue(
1684:                        "counter"));
1685:                assertEquals("3", responses5.get(1).getTemplate().getValue(
1686:                        "counter"));
1687:                ParsedHtml parsed5 = response5.getParsedHtml();
1688:
1689:                MockResponse response6 = parsed5.getFormWithId("increase1")
1690:                        .submit();
1691:                List<MockResponse> responses6 = response6
1692:                        .getEmbeddedResponses();
1693:                assertEquals(2, responses6.size());
1694:                assertEquals("2", responses6.get(0).getTemplate().getValue(
1695:                        "counter"));
1696:                assertEquals("3", responses6.get(1).getTemplate().getValue(
1697:                        "counter"));
1698:                ParsedHtml parsed6 = response6.getParsedHtml();
1699:
1700:                MockResponse response7 = parsed6.getFormWithId("decrease2")
1701:                        .submit();
1702:                List<MockResponse> responses7 = response7
1703:                        .getEmbeddedResponses();
1704:                assertEquals(2, responses7.size());
1705:                assertEquals("2", responses7.get(0).getTemplate().getValue(
1706:                        "counter"));
1707:                assertEquals("2", responses7.get(1).getTemplate().getValue(
1708:                        "counter"));
1709:                ParsedHtml parsed7 = response7.getParsedHtml();
1710:
1711:                MockResponse response8 = parsed7.getFormWithId("decrease1")
1712:                        .submit();
1713:                List<MockResponse> responses8 = response8
1714:                        .getEmbeddedResponses();
1715:                assertEquals(2, responses8.size());
1716:                assertEquals("1", responses8.get(0).getTemplate().getValue(
1717:                        "counter"));
1718:                assertEquals("2", responses8.get(1).getTemplate().getValue(
1719:                        "counter"));
1720:
1721:                MockResponse response7b = parsed6.getFormWithId("increase2")
1722:                        .submit();
1723:                List<MockResponse> responses7b = response7b
1724:                        .getEmbeddedResponses();
1725:                assertEquals(2, responses7b.size());
1726:                assertEquals("2", responses7b.get(0).getTemplate().getValue(
1727:                        "counter"));
1728:                assertEquals("4", responses7b.get(1).getTemplate().getValue(
1729:                        "counter"));
1730:            }
1731:
1732:            public void testStatefulElementsCounterSessionState()
1733:                    throws Exception {
1734:                Site site = new SiteBuilder("site/embedding.xml").getSite();
1735:
1736:                MockConversation conversation = new MockConversation(site);
1737:
1738:                MockResponse response1 = conversation
1739:                        .doRequest("/counter_session");
1740:                List<MockResponse> responses1 = response1
1741:                        .getEmbeddedResponses();
1742:                assertEquals(2, responses1.size());
1743:                assertEquals("0", responses1.get(0).getTemplate().getValue(
1744:                        "counter"));
1745:                assertEquals("0", responses1.get(1).getTemplate().getValue(
1746:                        "counter"));
1747:                ParsedHtml parsed1 = response1.getParsedHtml();
1748:
1749:                MockForm form1 = parsed1.getFormWithId("increase1");
1750:                assertEquals(1, form1.getParameters().size());
1751:                assertNotNull(form1
1752:                        .getParameterValue(ReservedParameters.STATEID));
1753:                MockResponse response2 = form1.submit();
1754:                List<MockResponse> responses2 = response2
1755:                        .getEmbeddedResponses();
1756:                assertEquals(2, responses2.size());
1757:                assertEquals("1", responses2.get(0).getTemplate().getValue(
1758:                        "counter"));
1759:                assertEquals("0", responses2.get(1).getTemplate().getValue(
1760:                        "counter"));
1761:                ParsedHtml parsed2 = response2.getParsedHtml();
1762:
1763:                MockForm form2 = parsed2.getFormWithId("increase2");
1764:                assertEquals(1, form2.getParameters().size());
1765:                assertNotNull(form2
1766:                        .getParameterValue(ReservedParameters.STATEID));
1767:                MockResponse response3 = form2.submit();
1768:                List<MockResponse> responses3 = response3
1769:                        .getEmbeddedResponses();
1770:                assertEquals(2, responses3.size());
1771:                assertEquals("1", responses3.get(0).getTemplate().getValue(
1772:                        "counter"));
1773:                assertEquals("1", responses3.get(1).getTemplate().getValue(
1774:                        "counter"));
1775:                ParsedHtml parsed3 = response3.getParsedHtml();
1776:
1777:                MockForm form3 = parsed3.getFormWithId("increase2");
1778:                assertEquals(1, form3.getParameters().size());
1779:                assertNotNull(form3
1780:                        .getParameterValue(ReservedParameters.STATEID));
1781:                MockResponse response4 = form3.submit();
1782:                List<MockResponse> responses4 = response4
1783:                        .getEmbeddedResponses();
1784:                assertEquals(2, responses4.size());
1785:                assertEquals("1", responses4.get(0).getTemplate().getValue(
1786:                        "counter"));
1787:                assertEquals("2", responses4.get(1).getTemplate().getValue(
1788:                        "counter"));
1789:                ParsedHtml parsed4 = response4.getParsedHtml();
1790:
1791:                MockForm form4 = parsed4.getFormWithId("increase2");
1792:                assertEquals(1, form4.getParameters().size());
1793:                assertNotNull(form4
1794:                        .getParameterValue(ReservedParameters.STATEID));
1795:                MockResponse response5 = form4.submit();
1796:                List<MockResponse> responses5 = response5
1797:                        .getEmbeddedResponses();
1798:                assertEquals(2, responses5.size());
1799:                assertEquals("1", responses5.get(0).getTemplate().getValue(
1800:                        "counter"));
1801:                assertEquals("3", responses5.get(1).getTemplate().getValue(
1802:                        "counter"));
1803:                ParsedHtml parsed5 = response5.getParsedHtml();
1804:
1805:                MockForm form5 = parsed5.getFormWithId("increase1");
1806:                assertEquals(1, form5.getParameters().size());
1807:                assertNotNull(form5
1808:                        .getParameterValue(ReservedParameters.STATEID));
1809:                MockResponse response6 = form5.submit();
1810:                List<MockResponse> responses6 = response6
1811:                        .getEmbeddedResponses();
1812:                assertEquals(2, responses6.size());
1813:                assertEquals("2", responses6.get(0).getTemplate().getValue(
1814:                        "counter"));
1815:                assertEquals("3", responses6.get(1).getTemplate().getValue(
1816:                        "counter"));
1817:                ParsedHtml parsed6 = response6.getParsedHtml();
1818:
1819:                MockForm form6 = parsed6.getFormWithId("decrease2");
1820:                assertEquals(1, form6.getParameters().size());
1821:                assertNotNull(form6
1822:                        .getParameterValue(ReservedParameters.STATEID));
1823:                MockResponse response7 = form6.submit();
1824:                List<MockResponse> responses7 = response7
1825:                        .getEmbeddedResponses();
1826:                assertEquals(2, responses7.size());
1827:                assertEquals("2", responses7.get(0).getTemplate().getValue(
1828:                        "counter"));
1829:                assertEquals("2", responses7.get(1).getTemplate().getValue(
1830:                        "counter"));
1831:                ParsedHtml parsed7 = response7.getParsedHtml();
1832:
1833:                MockForm form7 = parsed7.getFormWithId("decrease1");
1834:                assertEquals(1, form7.getParameters().size());
1835:                assertNotNull(form7
1836:                        .getParameterValue(ReservedParameters.STATEID));
1837:                MockResponse response8 = form7.submit();
1838:                List<MockResponse> responses8 = response8
1839:                        .getEmbeddedResponses();
1840:                assertEquals(2, responses8.size());
1841:                assertEquals("1", responses8.get(0).getTemplate().getValue(
1842:                        "counter"));
1843:                assertEquals("2", responses8.get(1).getTemplate().getValue(
1844:                        "counter"));
1845:
1846:                MockForm form8 = parsed6.getFormWithId("increase2");
1847:                assertEquals(1, form8.getParameters().size());
1848:                assertNotNull(form8
1849:                        .getParameterValue(ReservedParameters.STATEID));
1850:                MockResponse response7b = form8.submit();
1851:                List<MockResponse> responses7b = response7b
1852:                        .getEmbeddedResponses();
1853:                assertEquals(2, responses7b.size());
1854:                assertEquals("2", responses7b.get(0).getTemplate().getValue(
1855:                        "counter"));
1856:                assertEquals("4", responses7b.get(1).getTemplate().getValue(
1857:                        "counter"));
1858:            }
1859:
1860:            public void testStatefulElementsCounterContinuations()
1861:                    throws Exception {
1862:                Site site = new SiteBuilder("site/embedding.xml").getSite();
1863:
1864:                MockConversation conversation = new MockConversation(site);
1865:
1866:                MockResponse response1 = conversation
1867:                        .doRequest("/countercontinuations");
1868:                List<MockResponse> responses1 = response1
1869:                        .getEmbeddedResponses();
1870:                assertEquals(2, responses1.size());
1871:                assertEquals("0", responses1.get(0).getTemplate().getValue(
1872:                        "counter"));
1873:                assertEquals("0", responses1.get(1).getTemplate().getValue(
1874:                        "counter"));
1875:                ParsedHtml parsed1 = response1.getParsedHtml();
1876:
1877:                MockResponse response2 = parsed1.getFormWithId("increase1")
1878:                        .submit();
1879:                List<MockResponse> responses2 = response2
1880:                        .getEmbeddedResponses();
1881:                assertEquals(2, responses2.size());
1882:                assertEquals("1", responses2.get(0).getTemplate().getValue(
1883:                        "counter"));
1884:                assertEquals("0", responses2.get(1).getTemplate().getValue(
1885:                        "counter"));
1886:                ParsedHtml parsed2 = response2.getParsedHtml();
1887:
1888:                MockResponse response3 = parsed2.getFormWithId("increase2")
1889:                        .submit();
1890:                List<MockResponse> responses3 = response3
1891:                        .getEmbeddedResponses();
1892:                assertEquals(2, responses3.size());
1893:                assertEquals("1", responses3.get(0).getTemplate().getValue(
1894:                        "counter"));
1895:                assertEquals("1", responses3.get(1).getTemplate().getValue(
1896:                        "counter"));
1897:                ParsedHtml parsed3 = response3.getParsedHtml();
1898:
1899:                MockResponse response4 = parsed3.getFormWithId("increase2")
1900:                        .submit();
1901:                List<MockResponse> responses4 = response4
1902:                        .getEmbeddedResponses();
1903:                assertEquals(2, responses4.size());
1904:                assertEquals("1", responses4.get(0).getTemplate().getValue(
1905:                        "counter"));
1906:                assertEquals("2", responses4.get(1).getTemplate().getValue(
1907:                        "counter"));
1908:                ParsedHtml parsed4 = response4.getParsedHtml();
1909:
1910:                MockResponse response5 = parsed4.getFormWithId("increase2")
1911:                        .submit();
1912:                List<MockResponse> responses5 = response5
1913:                        .getEmbeddedResponses();
1914:                assertEquals(2, responses5.size());
1915:                assertEquals("1", responses5.get(0).getTemplate().getValue(
1916:                        "counter"));
1917:                assertEquals("3", responses5.get(1).getTemplate().getValue(
1918:                        "counter"));
1919:                ParsedHtml parsed5 = response5.getParsedHtml();
1920:
1921:                MockResponse response6 = parsed5.getFormWithId("increase1")
1922:                        .submit();
1923:                List<MockResponse> responses6 = response6
1924:                        .getEmbeddedResponses();
1925:                assertEquals(2, responses6.size());
1926:                assertEquals("2", responses6.get(0).getTemplate().getValue(
1927:                        "counter"));
1928:                assertEquals("3", responses6.get(1).getTemplate().getValue(
1929:                        "counter"));
1930:                ParsedHtml parsed6 = response6.getParsedHtml();
1931:
1932:                MockResponse response7 = parsed6.getFormWithId("decrease2")
1933:                        .submit();
1934:                List<MockResponse> responses7 = response7
1935:                        .getEmbeddedResponses();
1936:                assertEquals(2, responses7.size());
1937:                assertEquals("2", responses7.get(0).getTemplate().getValue(
1938:                        "counter"));
1939:                assertEquals("2", responses7.get(1).getTemplate().getValue(
1940:                        "counter"));
1941:                ParsedHtml parsed7 = response7.getParsedHtml();
1942:
1943:                MockResponse response8 = parsed7.getFormWithId("decrease1")
1944:                        .submit();
1945:                List<MockResponse> responses8 = response8
1946:                        .getEmbeddedResponses();
1947:                assertEquals(2, responses8.size());
1948:                assertEquals("1", responses8.get(0).getTemplate().getValue(
1949:                        "counter"));
1950:                assertEquals("2", responses8.get(1).getTemplate().getValue(
1951:                        "counter"));
1952:
1953:                MockResponse response7b = parsed6.getFormWithId("increase2")
1954:                        .submit();
1955:                List<MockResponse> responses7b = response7b
1956:                        .getEmbeddedResponses();
1957:                assertEquals(2, responses7b.size());
1958:                assertEquals("2", responses7b.get(0).getTemplate().getValue(
1959:                        "counter"));
1960:                assertEquals("4", responses7b.get(1).getTemplate().getValue(
1961:                        "counter"));
1962:            }
1963:
1964:            public void testStatefulElementsCounterSessionStateNoclone()
1965:                    throws Exception {
1966:                Config.getRepInstance().setParameter(
1967:                        RifeConfig.Engine.PARAM_SESSION_STATE_STORE_CLONING,
1968:                        false);
1969:                try {
1970:                    Site site = new SiteBuilder("site/embedding.xml").getSite();
1971:
1972:                    MockConversation conversation = new MockConversation(site);
1973:
1974:                    MockResponse response1 = conversation
1975:                            .doRequest("/counter_session");
1976:                    List<MockResponse> responses1 = response1
1977:                            .getEmbeddedResponses();
1978:                    assertEquals(2, responses1.size());
1979:                    assertEquals("0", responses1.get(0).getTemplate().getValue(
1980:                            "counter"));
1981:                    assertEquals("0", responses1.get(1).getTemplate().getValue(
1982:                            "counter"));
1983:                    ParsedHtml parsed1 = response1.getParsedHtml();
1984:
1985:                    MockForm form1 = parsed1.getFormWithId("increase1");
1986:                    assertEquals(1, form1.getParameters().size());
1987:                    assertNotNull(form1
1988:                            .getParameterValue(ReservedParameters.STATEID));
1989:                    MockResponse response2 = form1.submit();
1990:                    List<MockResponse> responses2 = response2
1991:                            .getEmbeddedResponses();
1992:                    assertEquals(2, responses2.size());
1993:                    assertEquals("1", responses2.get(0).getTemplate().getValue(
1994:                            "counter"));
1995:                    assertEquals("0", responses2.get(1).getTemplate().getValue(
1996:                            "counter"));
1997:                    ParsedHtml parsed2 = response2.getParsedHtml();
1998:
1999:                    MockForm form2 = parsed2.getFormWithId("increase2");
2000:                    assertEquals(1, form2.getParameters().size());
2001:                    assertNotNull(form2
2002:                            .getParameterValue(ReservedParameters.STATEID));
2003:                    MockResponse response3 = form2.submit();
2004:                    List<MockResponse> responses3 = response3
2005:                            .getEmbeddedResponses();
2006:                    assertEquals(2, responses3.size());
2007:                    assertEquals("1", responses3.get(0).getTemplate().getValue(
2008:                            "counter"));
2009:                    assertEquals("1", responses3.get(1).getTemplate().getValue(
2010:                            "counter"));
2011:                    ParsedHtml parsed3 = response3.getParsedHtml();
2012:
2013:                    MockForm form3 = parsed3.getFormWithId("increase2");
2014:                    assertEquals(1, form3.getParameters().size());
2015:                    assertNotNull(form3
2016:                            .getParameterValue(ReservedParameters.STATEID));
2017:                    MockResponse response4 = form3.submit();
2018:                    List<MockResponse> responses4 = response4
2019:                            .getEmbeddedResponses();
2020:                    assertEquals(2, responses4.size());
2021:                    assertEquals("1", responses4.get(0).getTemplate().getValue(
2022:                            "counter"));
2023:                    assertEquals("2", responses4.get(1).getTemplate().getValue(
2024:                            "counter"));
2025:                    ParsedHtml parsed4 = response4.getParsedHtml();
2026:
2027:                    MockForm form4 = parsed4.getFormWithId("increase2");
2028:                    assertEquals(1, form4.getParameters().size());
2029:                    assertNotNull(form4
2030:                            .getParameterValue(ReservedParameters.STATEID));
2031:                    MockResponse response5 = form4.submit();
2032:                    List<MockResponse> responses5 = response5
2033:                            .getEmbeddedResponses();
2034:                    assertEquals(2, responses5.size());
2035:                    assertEquals("1", responses5.get(0).getTemplate().getValue(
2036:                            "counter"));
2037:                    assertEquals("3", responses5.get(1).getTemplate().getValue(
2038:                            "counter"));
2039:                    ParsedHtml parsed5 = response5.getParsedHtml();
2040:
2041:                    MockForm form5 = parsed5.getFormWithId("increase1");
2042:                    assertEquals(1, form5.getParameters().size());
2043:                    assertNotNull(form5
2044:                            .getParameterValue(ReservedParameters.STATEID));
2045:                    MockResponse response6 = form5.submit();
2046:                    List<MockResponse> responses6 = response6
2047:                            .getEmbeddedResponses();
2048:                    assertEquals(2, responses6.size());
2049:                    assertEquals("2", responses6.get(0).getTemplate().getValue(
2050:                            "counter"));
2051:                    assertEquals("3", responses6.get(1).getTemplate().getValue(
2052:                            "counter"));
2053:                    ParsedHtml parsed6 = response6.getParsedHtml();
2054:
2055:                    MockForm form6 = parsed6.getFormWithId("decrease2");
2056:                    assertEquals(1, form6.getParameters().size());
2057:                    assertNotNull(form6
2058:                            .getParameterValue(ReservedParameters.STATEID));
2059:                    MockResponse response7 = form6.submit();
2060:                    List<MockResponse> responses7 = response7
2061:                            .getEmbeddedResponses();
2062:                    assertEquals(2, responses7.size());
2063:                    assertEquals("2", responses7.get(0).getTemplate().getValue(
2064:                            "counter"));
2065:                    assertEquals("2", responses7.get(1).getTemplate().getValue(
2066:                            "counter"));
2067:                    ParsedHtml parsed7 = response7.getParsedHtml();
2068:
2069:                    MockForm form7 = parsed7.getFormWithId("decrease1");
2070:                    assertEquals(1, form7.getParameters().size());
2071:                    assertNotNull(form7
2072:                            .getParameterValue(ReservedParameters.STATEID));
2073:                    MockResponse response8 = form7.submit();
2074:                    List<MockResponse> responses8 = response8
2075:                            .getEmbeddedResponses();
2076:                    assertEquals(2, responses8.size());
2077:                    assertEquals("1", responses8.get(0).getTemplate().getValue(
2078:                            "counter"));
2079:                    assertEquals("2", responses8.get(1).getTemplate().getValue(
2080:                            "counter"));
2081:
2082:                    MockForm form8 = parsed6.getFormWithId("increase2");
2083:                    assertEquals(1, form8.getParameters().size());
2084:                    assertNotNull(form8
2085:                            .getParameterValue(ReservedParameters.STATEID));
2086:                    MockResponse response7b = form8.submit();
2087:                    List<MockResponse> responses7b = response7b
2088:                            .getEmbeddedResponses();
2089:                    assertEquals(2, responses7b.size());
2090:                    assertEquals("1", responses7b.get(0).getTemplate()
2091:                            .getValue("counter"));
2092:                    assertEquals("4", responses7b.get(1).getTemplate()
2093:                            .getValue("counter"));
2094:                } finally {
2095:                    Config
2096:                            .getRepInstance()
2097:                            .setParameter(
2098:                                    RifeConfig.Engine.PARAM_SESSION_STATE_STORE_CLONING,
2099:                                    true);
2100:                }
2101:            }
2102:
2103:            public void testStatefulExplicitProcessing() throws Exception {
2104:                Site site = new SiteBuilder("site/embedding.xml").getSite();
2105:
2106:                MockConversation conversation = new MockConversation(site);
2107:                List<MockForm> forms;
2108:
2109:                MockResponse response = conversation
2110:                        .doRequest("/statefulexplicitprocessing");
2111:                forms = response.getParsedHtml().getForms();
2112:                assertEquals(7, forms.size());
2113:
2114:                assertEquals("two", forms.get(1).getName());
2115:                response = forms.get(1).submit();
2116:                assertEquals("two", response.xpathString(
2117:                        "//div[@id='id_two']/text()").trim());
2118:                forms = response.getParsedHtml().getForms();
2119:                assertEquals(6, forms.size());
2120:                assertEquals("three", forms.get(1).getName());
2121:
2122:                assertEquals("one", forms.get(0).getName());
2123:                response = forms.get(0).submit();
2124:                assertEquals("one", response.xpathString(
2125:                        "//div[@id='id_one']/text()").trim());
2126:                assertEquals("two", response.xpathString(
2127:                        "//div[@id='id_two']/text()").trim());
2128:                forms = response.getParsedHtml().getForms();
2129:                assertEquals(5, forms.size());
2130:                assertEquals("three", forms.get(0).getName());
2131:
2132:                assertEquals("six", forms.get(3).getName());
2133:                response = forms.get(3).submit();
2134:                assertEquals("one", response.xpathString(
2135:                        "//div[@id='id_one']/text()").trim());
2136:                assertEquals("two", response.xpathString(
2137:                        "//div[@id='id_two']/text()").trim());
2138:                assertEquals("six", response.xpathString(
2139:                        "//div[@id='id_six']/text()").trim());
2140:                forms = response.getParsedHtml().getForms();
2141:                assertEquals(4, forms.size());
2142:                assertEquals("seven", forms.get(3).getName());
2143:
2144:                assertEquals("four", forms.get(1).getName());
2145:                response = forms.get(1).submit();
2146:                assertEquals("one", response.xpathString(
2147:                        "//div[@id='id_one']/text()").trim());
2148:                assertEquals("two", response.xpathString(
2149:                        "//div[@id='id_two']/text()").trim());
2150:                assertEquals("four", response.xpathString(
2151:                        "//div[@id='id_four']/text()").trim());
2152:                assertEquals("six", response.xpathString(
2153:                        "//div[@id='id_six']/text()").trim());
2154:                forms = response.getParsedHtml().getForms();
2155:                assertEquals(3, forms.size());
2156:                assertEquals("five", forms.get(1).getName());
2157:
2158:                assertEquals("three", forms.get(0).getName());
2159:                response = forms.get(0).submit();
2160:                assertEquals("one", response.xpathString(
2161:                        "//div[@id='id_one']/text()").trim());
2162:                assertEquals("two", response.xpathString(
2163:                        "//div[@id='id_two']/text()").trim());
2164:                assertEquals("three", response.xpathString(
2165:                        "//div[@id='id_three']/text()").trim());
2166:                assertEquals("four", response.xpathString(
2167:                        "//div[@id='id_four']/text()").trim());
2168:                assertEquals("six", response.xpathString(
2169:                        "//div[@id='id_six']/text()").trim());
2170:                forms = response.getParsedHtml().getForms();
2171:                assertEquals(2, forms.size());
2172:                assertEquals("five", forms.get(0).getName());
2173:
2174:                assertEquals("seven", forms.get(1).getName());
2175:                response = forms.get(1).submit();
2176:                assertEquals("one", response.xpathString(
2177:                        "//div[@id='id_one']/text()").trim());
2178:                assertEquals("two", response.xpathString(
2179:                        "//div[@id='id_two']/text()").trim());
2180:                assertEquals("three", response.xpathString(
2181:                        "//div[@id='id_three']/text()").trim());
2182:                assertEquals("four", response.xpathString(
2183:                        "//div[@id='id_four']/text()").trim());
2184:                assertEquals("six", response.xpathString(
2185:                        "//div[@id='id_six']/text()").trim());
2186:                assertEquals("seven", response.xpathString(
2187:                        "//div[@id='id_seven']/text()").trim());
2188:                forms = response.getParsedHtml().getForms();
2189:                assertEquals(1, forms.size());
2190:                assertEquals("five", forms.get(0).getName());
2191:
2192:                assertEquals("five", forms.get(0).getName());
2193:                response = forms.get(0).submit();
2194:                assertEquals("one", response.xpathString(
2195:                        "//div[@id='id_one']/text()").trim());
2196:                assertEquals("two", response.xpathString(
2197:                        "//div[@id='id_two']/text()").trim());
2198:                assertEquals("three", response.xpathString(
2199:                        "//div[@id='id_three']/text()").trim());
2200:                assertEquals("four", response.xpathString(
2201:                        "//div[@id='id_four']/text()").trim());
2202:                assertEquals("five", response.xpathString(
2203:                        "//div[@id='id_five']/text()").trim());
2204:                assertEquals("six", response.xpathString(
2205:                        "//div[@id='id_six']/text()").trim());
2206:                assertEquals("seven", response.xpathString(
2207:                        "//div[@id='id_seven']/text()").trim());
2208:                forms = response.getParsedHtml().getForms();
2209:                assertEquals(0, forms.size());
2210:            }
2211:
2212:            public void testStatefulExplicitProcessingSessionState()
2213:                    throws Exception {
2214:                Site site = new SiteBuilder("site/embedding.xml").getSite();
2215:
2216:                MockConversation conversation = new MockConversation(site);
2217:                List<MockForm> forms;
2218:
2219:                MockResponse response = conversation
2220:                        .doRequest("/statefulexplicitprocessing_session");
2221:                forms = response.getParsedHtml().getForms();
2222:                assertEquals(7, forms.size());
2223:                for (MockForm form : forms) {
2224:                    assertEquals(1, form.getParameters().size());
2225:                    assertNotNull(form
2226:                            .getParameterValue(ReservedParameters.STATEID));
2227:                }
2228:
2229:                assertEquals("two", forms.get(1).getName());
2230:                response = forms.get(1).submit();
2231:                assertEquals("two", response.xpathString(
2232:                        "//div[@id='id_two']/text()").trim());
2233:                forms = response.getParsedHtml().getForms();
2234:                assertEquals(6, forms.size());
2235:                assertEquals("three", forms.get(1).getName());
2236:                for (MockForm form : forms) {
2237:                    assertEquals(1, form.getParameters().size());
2238:                    assertNotNull(form
2239:                            .getParameterValue(ReservedParameters.STATEID));
2240:                }
2241:
2242:                assertEquals("one", forms.get(0).getName());
2243:                response = forms.get(0).submit();
2244:                assertEquals("one", response.xpathString(
2245:                        "//div[@id='id_one']/text()").trim());
2246:                assertEquals("two", response.xpathString(
2247:                        "//div[@id='id_two']/text()").trim());
2248:                forms = response.getParsedHtml().getForms();
2249:                assertEquals(5, forms.size());
2250:                assertEquals("three", forms.get(0).getName());
2251:                for (MockForm form : forms) {
2252:                    assertEquals(1, form.getParameters().size());
2253:                    assertNotNull(form
2254:                            .getParameterValue(ReservedParameters.STATEID));
2255:                }
2256:
2257:                assertEquals("six", forms.get(3).getName());
2258:                response = forms.get(3).submit();
2259:                assertEquals("one", response.xpathString(
2260:                        "//div[@id='id_one']/text()").trim());
2261:                assertEquals("two", response.xpathString(
2262:                        "//div[@id='id_two']/text()").trim());
2263:                assertEquals("six", response.xpathString(
2264:                        "//div[@id='id_six']/text()").trim());
2265:                forms = response.getParsedHtml().getForms();
2266:                assertEquals(4, forms.size());
2267:                assertEquals("seven", forms.get(3).getName());
2268:                for (MockForm form : forms) {
2269:                    assertEquals(1, form.getParameters().size());
2270:                    assertNotNull(form
2271:                            .getParameterValue(ReservedParameters.STATEID));
2272:                }
2273:
2274:                assertEquals("four", forms.get(1).getName());
2275:                response = forms.get(1).submit();
2276:                assertEquals("one", response.xpathString(
2277:                        "//div[@id='id_one']/text()").trim());
2278:                assertEquals("two", response.xpathString(
2279:                        "//div[@id='id_two']/text()").trim());
2280:                assertEquals("four", response.xpathString(
2281:                        "//div[@id='id_four']/text()").trim());
2282:                assertEquals("six", response.xpathString(
2283:                        "//div[@id='id_six']/text()").trim());
2284:                forms = response.getParsedHtml().getForms();
2285:                assertEquals(3, forms.size());
2286:                assertEquals("five", forms.get(1).getName());
2287:                for (MockForm form : forms) {
2288:                    assertEquals(1, form.getParameters().size());
2289:                    assertNotNull(form
2290:                            .getParameterValue(ReservedParameters.STATEID));
2291:                }
2292:
2293:                assertEquals("three", forms.get(0).getName());
2294:                response = forms.get(0).submit();
2295:                assertEquals("one", response.xpathString(
2296:                        "//div[@id='id_one']/text()").trim());
2297:                assertEquals("two", response.xpathString(
2298:                        "//div[@id='id_two']/text()").trim());
2299:                assertEquals("three", response.xpathString(
2300:                        "//div[@id='id_three']/text()").trim());
2301:                assertEquals("four", response.xpathString(
2302:                        "//div[@id='id_four']/text()").trim());
2303:                assertEquals("six", response.xpathString(
2304:                        "//div[@id='id_six']/text()").trim());
2305:                forms = response.getParsedHtml().getForms();
2306:                assertEquals(2, forms.size());
2307:                assertEquals("five", forms.get(0).getName());
2308:                for (MockForm form : forms) {
2309:                    assertEquals(1, form.getParameters().size());
2310:                    assertNotNull(form
2311:                            .getParameterValue(ReservedParameters.STATEID));
2312:                }
2313:
2314:                assertEquals("seven", forms.get(1).getName());
2315:                response = forms.get(1).submit();
2316:                assertEquals("one", response.xpathString(
2317:                        "//div[@id='id_one']/text()").trim());
2318:                assertEquals("two", response.xpathString(
2319:                        "//div[@id='id_two']/text()").trim());
2320:                assertEquals("three", response.xpathString(
2321:                        "//div[@id='id_three']/text()").trim());
2322:                assertEquals("four", response.xpathString(
2323:                        "//div[@id='id_four']/text()").trim());
2324:                assertEquals("six", response.xpathString(
2325:                        "//div[@id='id_six']/text()").trim());
2326:                assertEquals("seven", response.xpathString(
2327:                        "//div[@id='id_seven']/text()").trim());
2328:                forms = response.getParsedHtml().getForms();
2329:                assertEquals(1, forms.size());
2330:                assertEquals("five", forms.get(0).getName());
2331:                for (MockForm form : forms) {
2332:                    assertEquals(1, form.getParameters().size());
2333:                    assertNotNull(form
2334:                            .getParameterValue(ReservedParameters.STATEID));
2335:                }
2336:
2337:                assertEquals("five", forms.get(0).getName());
2338:                response = forms.get(0).submit();
2339:                assertEquals("one", response.xpathString(
2340:                        "//div[@id='id_one']/text()").trim());
2341:                assertEquals("two", response.xpathString(
2342:                        "//div[@id='id_two']/text()").trim());
2343:                assertEquals("three", response.xpathString(
2344:                        "//div[@id='id_three']/text()").trim());
2345:                assertEquals("four", response.xpathString(
2346:                        "//div[@id='id_four']/text()").trim());
2347:                assertEquals("five", response.xpathString(
2348:                        "//div[@id='id_five']/text()").trim());
2349:                assertEquals("six", response.xpathString(
2350:                        "//div[@id='id_six']/text()").trim());
2351:                assertEquals("seven", response.xpathString(
2352:                        "//div[@id='id_seven']/text()").trim());
2353:                forms = response.getParsedHtml().getForms();
2354:                assertEquals(0, forms.size());
2355:            }
2356:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.