Source Code Cross Referenced for TestTranslatorHelper.java in  » Portal » Open-Portal » com » sun » portal » rewriter » test » 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 » Portal » Open Portal » com.sun.portal.rewriter.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
0003:         * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms.
0004:         */
0005:        package com.sun.portal.rewriter.test;
0006:
0007:        import com.sun.portal.rewriter.AbsoluteTranslator;
0008:        import com.sun.portal.rewriter.RewriterModule;
0009:        import com.sun.portal.rewriter.Translator;
0010:        import com.sun.portal.rewriter.test.util.BasicTestCase;
0011:        import com.sun.portal.rewriter.util.uri.PageSpec;
0012:        import junit.framework.TestSuite;
0013:
0014:        public class TestTranslatorHelper extends BasicTestCase {
0015:            public TestTranslatorHelper(String aName) {
0016:                super (aName);
0017:            }//constuctor
0018:
0019:            public void testJARProtocolURL() throws Exception {
0020:                String[][] lData = {
0021:                        {
0022:                                "jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class",
0023:                                "jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class", },
0024:
0025:                        {
0026:                                "jar:/baz.jar!/COM/foo/Quux.class",
0027:                                "jar:http://rajanagendra.sun.com/baz.jar!/COM/foo/Quux.class", },
0028:
0029:                        {
0030:                                "jar:../baz.jar!/COM/foo/Quux.class",
0031:                                "jar:http://rajanagendra.sun.com/Base/baz.jar!/COM/foo/Quux.class", },
0032:
0033:                        {
0034:                                "jAr:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class",
0035:                                "jAr:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class", },
0036:
0037:                        {
0038:                                "jaR:/baz.jar!/COM/foo/Quux.class",
0039:                                "jaR:http://rajanagendra.sun.com/baz.jar!/COM/foo/Quux.class", },
0040:
0041:                        {
0042:                                "JAR:../baz.jar!/COM/foo/Quux.class",
0043:                                "JAR:http://rajanagendra.sun.com/Base/baz.jar!/COM/foo/Quux.class", },
0044:
0045:                        {
0046:                                "JAR: ../baz.jar!/COM/foo/Quux.class",
0047:                                "JAR:http://rajanagendra.sun.com/Base/Raja/ ../baz.jar!/COM/foo/Quux.class", },
0048:
0049:                        {
0050:                                "JaR: ../baz.jar!/COM/foo/Quux.class",
0051:                                "JaR:http://rajanagendra.sun.com/Base/Raja/ ../baz.jar!/COM/foo/Quux.class", },
0052:
0053:                        {
0054:                                "JaR/baz.jar!/COM/foo/Quux.class",
0055:                                "http://rajanagendra.sun.com/Base/Raja/JaR/baz.jar!/COM/foo/Quux.class", },
0056:                        {
0057:                                "jar/baz.jar!/COM/foo/Quux.class",
0058:                                "http://rajanagendra.sun.com/Base/Raja/jar/baz.jar!/COM/foo/Quux.class", }, };
0059:
0060:                for (int i = 0; i < lData.length; i++) {
0061:                    assertEquals("Failed at i=" + i + ":", lData[i][1],
0062:                            getDefaultTranslator().translate(lData[i][0]));
0063:                }//for loop
0064:            }//testJARProtocolURL()
0065:
0066:            public void testTranslateHTTPURL() throws Exception {
0067:                String base, path, file;
0068:                base = "http://rajanagendra.sun.com/";
0069:                path = "Base/Raja/";
0070:                file = "raja.html?name=raja";
0071:                String url = base + path + file;
0072:                PageSpec samplePageSpec = new PageSpec(url, "");
0073:                Translator lTranslator = new AbsoluteTranslator(samplePageSpec);
0074:
0075:                String[][] lData = {
0076:                        {
0077:                                "/irj/servlet/prt/portal/prtroot/com.sap.portal.appdesigner.framework.tabcontent?calcProperties=false&url=com.sap.portal.appdesigner.framework.contentStudioWelcomePage&dynamicButtonsUrl=&propEditor=false&actionButtons=false&objectID=Welcome_Page_ID&editorID=0&displayName=Overview&sessionID=20031105172526&",
0078:                                "http://rajanagendra.sun.com/irj/servlet/prt/portal/prtroot/com.sap.portal.appdesigner.framework.tabcontent?calcProperties=false&url=com.sap.portal.appdesigner.framework.contentStudioWelcomePage&dynamicButtonsUrl=&propEditor=false&actionButtons=false&objectID=Welcome_Page_ID&editorID=0&displayName=Overview&sessionID=20031105172526&", },
0079:
0080:                        {
0081:                                "http://d-ehdb03-142-172.Germany.Sun.COM/scripts/wgate/webgui/!",
0082:                                "http://d-ehdb03-142-172.Germany.Sun.COM/scripts/wgate/webgui/!", },
0083:
0084:                        {
0085:                                "/scripts/wgate/webgui/!",
0086:                                "http://rajanagendra.sun.com/scripts/wgate/webgui/!", },
0087:
0088:                        {
0089:                                "../scripts/wgate/webgui/!",
0090:                                "http://rajanagendra.sun.com/Base/scripts/wgate/webgui/!", },
0091:
0092:                        { "ftp://ABC%3A", "ftp://ABC%3A", },
0093:
0094:                        { "http://ABC%3A", "http://ABC%3A", },
0095:
0096:                        { "https://ABC%3A", "https://ABC%3A", },
0097:
0098:                        { "http://ABC%3A8080", "http://ABC%3A8080", },
0099:
0100:                        { "ABC%3A",
0101:                                "http://rajanagendra.sun.com/Base/Raja/ABC%3A", },
0102:
0103:                        {
0104:                                "ABC%3AABC",
0105:                                "http://rajanagendra.sun.com/Base/Raja/ABC%3AABC", },
0106:
0107:                        { "%3ADEF",
0108:                                "http://rajanagendra.sun.com/Base/Raja/%3ADEF", },
0109:
0110:                        {
0111:                                "\"+cssPath+\"menu_\" + application + \"_mozilla.css",
0112:                                "\"+cssPath+\"menu_\" + application + \"_mozilla.css", },
0113:
0114:                        {
0115:                                "\"+cssPath+\"menu_\" ?+ application + \"_mozilla.css",
0116:                                "\"+cssPath+\"menu_\" ?+ application + \"_mozilla.css", },
0117:
0118:                        {
0119:                                "\"+cssPath+\"menu_\" + application + \"?_mozilla.css",
0120:                                "\"+cssPath+\"menu_\" + application + \"?_mozilla.css", },
0121:
0122:                        {
0123:                                "?\"+cssPath+\"menu_\" + application + \"_mozilla.css",
0124:                                "http://rajanagendra.sun.com/Base/Raja/?\"+cssPath+\"menu_\" + application + \"_mozilla.css", },
0125:
0126:                        {
0127:                                "\"?+cssPath+\"menu_\" + application + \"_mozilla.css",
0128:                                "\"http://rajanagendra.sun.com/Base/Raja/?+cssPath+\"menu_\" + application + \"_mozilla.css", },
0129:
0130:                        {
0131:                                "/mail/mstm.nsf/iNotes/Proxy/?OpenDocument&Form=s_ReadViewEntries&PresetFields=FolderName;%28%24Inbox%29,s_UsingHttps;1&Start=1&Count=40",
0132:                                "http://rajanagendra.sun.com/mail/mstm.nsf/iNotes/Proxy/?OpenDocument&Form=s_ReadViewEntries&PresetFields=FolderName;%28%24Inbox%29,s_UsingHttps;1&Start=1&Count=40", },
0133:
0134:                        {
0135:                                "/command.shtml?view=overview&id=bu95rq3r35uq62n2o2p&crc=/()'-/*(+/&group=Keine+Kalendergruppe&date=",
0136:                                "http://rajanagendra.sun.com/command.shtml?view=overview&id=bu95rq3r35uq62n2o2p&crc=/()'-/*(+/&group=Keine+Kalendergruppe&date=" },
0137:
0138:                        {
0139:                                "command.shtml?view=overview&id=bu95rq3r35uq62n2o2p&crc=/()'-/*(+/&group=Keine+Kalendergruppe&date=",
0140:                                "http://rajanagendra.sun.com/Base/Raja/command.shtml?view=overview&id=bu95rq3r35uq62n2o2p&crc=/()'-/*(+/&group=Keine+Kalendergruppe&date=" },
0141:
0142:                        { "../../../http://yahoo.com",
0143:                                "http://rajanagendra.sun.com/http://yahoo.com" },
0144:                        { "../http://yahoo.com",
0145:                                "http://rajanagendra.sun.com/Base/http://yahoo.com" },
0146:                        { "/http://yahoo.com",
0147:                                "http://rajanagendra.sun.com/http://yahoo.com" },
0148:                        { "../", "http://rajanagendra.sun.com/Base/" },
0149:                        { "/../", "http://rajanagendra.sun.com/" },
0150:                        { "/../", "http://rajanagendra.sun.com/" },
0151:                        { "/..", "http://rajanagendra.sun.com" },
0152:                        { "../../abc/../", "http://rajanagendra.sun.com/" },
0153:                        { "../../abc/../../", "http://rajanagendra.sun.com/" },
0154:                        { "/PacSoft/conf/jvw02/#leavens1",
0155:                                "http://rajanagendra.sun.com/PacSoft/conf/jvw02/#leavens1" },
0156:                        { "./?Cmd=navbar",
0157:                                "http://rajanagendra.sun.com/Base/Raja/?Cmd=navbar" },
0158:                        { "/abc/xuz?", "http://rajanagendra.sun.com/abc/xuz?" },
0159:                        { "/ips-static/images/spacer.gif&",
0160:                                "http://rajanagendra.sun.com/ips-static/images/spacer.gif&" },
0161:                        { "/ips-static/images/spacer.gif?&abc=10",
0162:                                "http://rajanagendra.sun.com/ips-static/images/spacer.gif?&abc=10" },
0163:                        { "/ips-static/images/spacer.gif?&abc",
0164:                                "http://rajanagendra.sun.com/ips-static/images/spacer.gif?&abc" },
0165:                        {
0166:                                "/amconsole/base/AMAdminFrame?okmIuDwRL6W5se5rmCbn5hf2jSei7NGUfZO9iAB7tzdb2unPjkHTO2qUelbAcorsIu3fsC7IqtvECNy9",
0167:                                "http://rajanagendra.sun.com/amconsole/base/AMAdminFrame?okmIuDwRL6W5se5rmCbn5hf2jSei7NGUfZO9iAB7tzdb2unPjkHTO2qUelbAcorsIu3fsC7IqtvECNy9" },
0168:
0169:                        { "raja1.html?abc",
0170:                                "http://rajanagendra.sun.com/Base/Raja/raja1.html?abc" },
0171:                        { "../raja.html?10",
0172:                                "http://rajanagendra.sun.com/Base/raja.html?10" },
0173:                        { "raja2.html?true",
0174:                                "http://rajanagendra.sun.com/Base/Raja/raja2.html?true" },
0175:                        { "raja0.html?-12",
0176:                                "http://rajanagendra.sun.com/Base/Raja/raja0.html?-12" },
0177:
0178:                        { "#", "#" }, //BugNo:4790402
0179:                        { "'#'	", "'#'	" },
0180:                        { "	#	", "	#	" },
0181:                        { "	#test	",
0182:                                "	http://rajanagendra.sun.com/Base/Raja/raja.html?name=raja#test	" },
0183:                        { "	?abc=10#test	",
0184:                                "	http://rajanagendra.sun.com/Base/Raja/?abc=10#test	" },
0185:                        { "?", "?" },
0186:                        { "'?'	", "'?'	" },
0187:                        { "	?	", "	?	" },
0188:                        { "	?test	",
0189:                                "	http://rajanagendra.sun.com/Base/Raja/?test	" },
0190:
0191:                        { "&#x27;&#x27;", "&#x27;&#x27;" },
0192:                        { "&#39;&#39;", "&#39;&#39;" },
0193:                        {
0194:                                "&#39;'\"&#39;'&#39;/portal/document1.pdf&#39;'&#39;	'&#39;",
0195:                                "&#39;http://rajanagendra.sun.com/Base/Raja/'\"&#39;'&#39;/portal/document1.pdf&#39;'&#39;\t'&#39;" }, //FixMe: Would get corrected when regEx is implemented
0196:
0197:                        { "'&#39;	/portal/document1.pdf	&#39;'",
0198:                                "'&#39;	http://rajanagendra.sun.com/portal/document1.pdf	&#39;'" },
0199:
0200:                        { "'&#39;/portal/document1.pdf&#39;'",
0201:                                "'&#39;http://rajanagendra.sun.com/portal/document1.pdf&#39;'" },
0202:                        { "'	&#39;/portal/document1.pdf&#39;	'",
0203:                                "'	&#39;http://rajanagendra.sun.com/portal/document1.pdf&#39;	'" },
0204:                        { "&#39;/portal/document1.pdf&#39;",
0205:                                "&#39;http://rajanagendra.sun.com/portal/document1.pdf&#39;" },
0206:                        { "&#x27;&#x27;/portal/document1.pdf&#39;'",
0207:                                "&#x27;&#x27;http://rajanagendra.sun.com/portal/document1.pdf&#39;'" },
0208:                        { "&#34;/portal/document1.pdf&#34;",
0209:                                "&#34;http://rajanagendra.sun.com/portal/document1.pdf&#34;" },
0210:                        { "&#x22;/portal/document1.pdf&#x22;",
0211:                                "&#x22;http://rajanagendra.sun.com/portal/document1.pdf&#x22;" },
0212:                        { "'&#39;&#x22;/portal/document1.pdf&#39;'",
0213:                                "'&#39;&#x22;http://rajanagendra.sun.com/portal/document1.pdf&#39;'" },
0214:                        { "'&#39;/portal/document1.pdf&#39;&#x22;'",
0215:                                "'&#39;http://rajanagendra.sun.com/portal/document1.pdf&#39;&#x22;'" },
0216:                        {
0217:                                "/console/actions/mbean/MBeanFramesetAction?isNew=false&sidebarFrameId=wl_console_frame_1035263303090&frameId=wl_console_frame_1035263303091&MBean=portaldomain%3AName%3Dportaldomain%2CType%3DDomain&bodyFrameId=wl_console_frame_1035263303092",
0218:                                "http://rajanagendra.sun.com/console/actions/mbean/MBeanFramesetAction?isNew=false&sidebarFrameId=wl_console_frame_1035263303090&frameId=wl_console_frame_1035263303091&MBean=portaldomain%3AName%3Dportaldomain%2CType%3DDomain&bodyFrameId=wl_console_frame_1035263303092", },
0219:
0220:                        {
0221:                                //BugNo:4762844
0222:                                "/command.shtml?view=new_cal&amp;id=ebm0q3u6y92m2nv9&amp;crc=3002401687&amp;date=20021005T013040&amp;newCalCalID=tuser&amp;tzid=&amp;e_ACL=@@o^c^WDEIC^g;@@o^a^RSF^g;@^a^sf^g;@^c^^g;@^p^r^g&amp;freebusy=1&amp;tab=1&amp;prevView=monthview&amp;calid=tuser&amp;security=1",
0223:                                "http://rajanagendra.sun.com/command.shtml?view=new_cal&amp;id=ebm0q3u6y92m2nv9&amp;crc=3002401687&amp;date=20021005T013040&amp;newCalCalID=tuser&amp;tzid=&amp;e_ACL=@@o^c^WDEIC^g;@@o^a^RSF^g;@^a^sf^g;@^c^^g;@^p^r^g&amp;freebusy=1&amp;tab=1&amp;prevView=monthview&amp;calid=tuser&amp;security=1", },
0224:
0225:                        {
0226:                                //BugNo:4762844
0227:                                "/command.shtml?view=new_cal&#38;id=ebm0q3u6y92m2nv9&#38;crc=3002401687&#38;date=20021005T013040&#38;newCalCalID=tuser&#38;tzid=&#38;e_ACL=@@o^c^WDEIC^g;@@o^a^RSF^g;@^a^sf^g;@^c^^g;@^p^r^g&#38;freebusy=1&#38;tab=1&#38;prevView=monthview&#38;calid=tuser&#38;security=1",
0228:                                "http://rajanagendra.sun.com/command.shtml?view=new_cal&#38;id=ebm0q3u6y92m2nv9&#38;crc=3002401687&#38;date=20021005T013040&#38;newCalCalID=tuser&#38;tzid=&#38;e_ACL=@@o^c^WDEIC^g;@@o^a^RSF^g;@^a^sf^g;@^c^^g;@^p^r^g&#38;freebusy=1&#38;tab=1&#38;prevView=monthview&#38;calid=tuser&#38;security=1", },
0229:                        { "/", "http://rajanagendra.sun.com/" },
0230:                        { "file:///c:/ghkim/love.txt",
0231:                                "file:///c:/ghkim/love.txt" },
0232:                        {
0233:                                "./EP_SgPgLayView.jsp?pgid=|1E2652&titfont=white",
0234:                                "http://rajanagendra.sun.com/Base/Raja/EP_SgPgLayView.jsp?pgid=|1E2652&titfont=white" },
0235:                        { "#default#homepage",
0236:                                "http://rajanagendra.sun.com/Base/Raja/raja.html?name=raja#default#homepage" },
0237:
0238:                        {
0239:                                "/first.shtml?view=new_cal&#38;id=bl02oe8w2rbhp3t6&#38;crc=2561871368&#38;date=20020925T180701&#38;newCalCalID=tuser&#38;tzid=&#38;freebusy=1&#38;tab=1&#38;prevView=monthview&#38;calid=tuser&#38;security=1",
0240:                                "http://rajanagendra.sun.com/first.shtml?view=new_cal&#38;id=bl02oe8w2rbhp3t6&#38;crc=2561871368&#38;date=20020925T180701&#38;newCalCalID=tuser&#38;tzid=&#38;freebusy=1&#38;tab=1&#38;prevView=monthview&#38;calid=tuser&#38;security=1" },
0241:
0242:                        {
0243:                                "/amserver/login?gw=gatev.red.iplanet.com&org=red.iplanet.com",
0244:                                "http://rajanagendra.sun.com/amserver/login?gw=gatev.red.iplanet.com&org=red.iplanet.com" },
0245:                        {
0246:                                "serverm.stonerunner.red.iplanet.com/amserver/login?gw=gatev.red.iplanet.com&org=red.iplanet.com",
0247:                                "http://rajanagendra.sun.com/Base/Raja/serverm.stonerunner.red.iplanet.com/amserver/login?gw=gatev.red.iplanet.com&org=red.iplanet.com" },
0248:                        {
0249:                                "serverm.stonerunner.red.iplanet.com:80/amserver/login?gw=gatev.red.iplanet.com&org=red.iplanet.com",
0250:                                "serverm.stonerunner.red.iplanet.com:80/amserver/login?gw=gatev.red.iplanet.com&org=red.iplanet.com" },
0251:
0252:                        { "https://rajanagendra.sun.com:443   ",
0253:                                "https://rajanagendra.sun.com   " },
0254:                        { "   https://rajanagendra.sun.com:443",
0255:                                "   https://rajanagendra.sun.com" },
0256:                        { "   https://rajanagendra.sun.com:443   ",
0257:                                "   https://rajanagendra.sun.com   " },
0258:
0259:                        { "", "" }, //135
0260:                        { "''", "''" }, //135
0261:                        { "\"\"", "\"\"" }, //135
0262:
0263:                        { "/abc.com", "http://rajanagendra.sun.com/abc.com" },
0264:                        { "   /abc.com   ",
0265:                                "   http://rajanagendra.sun.com/abc.com   " },
0266:                        { " \t\t   /abc.com   ",
0267:                                " \t\t   http://rajanagendra.sun.com/abc.com   " },
0268:                        { "  \r/abc.com   ",
0269:                                "  \rhttp://rajanagendra.sun.com/abc.com   " },
0270:                        { "  \n/abc.com   ",
0271:                                "  \nhttp://rajanagendra.sun.com/abc.com   " },
0272:
0273:                        {
0274:                                "/abc.com?url=http://pserv6.sun.com/exchange/index.html",
0275:                                "http://rajanagendra.sun.com/abc.com?url=http://pserv6.sun.com/exchange/index.html" },
0276:                        {
0277:                                "abc.com?url=http://pserv6.sun.com/exchange/index.html",
0278:                                "http://rajanagendra.sun.com/Base/Raja/abc.com?url=http://pserv6.sun.com/exchange/index.html" },
0279:                        {
0280:                                "abc.comurl=http://pserv6.sun.com/exchange/index.html",
0281:                                "abc.comurl=http://pserv6.sun.com/exchange/index.html" },
0282:
0283:                        { "/http://pserv6.sun.com/exchange/index.html",
0284:                                "http://rajanagendra.sun.com/http://pserv6.sun.com/exchange/index.html" },
0285:                        {
0286:                                "   /abc.com?url=http://pserv6.sun.com/exchange/index.html",
0287:                                "   http://rajanagendra.sun.com/abc.com?url=http://pserv6.sun.com/exchange/index.html" },
0288:                        {
0289:                                "\t\t/abc.com?url=http://pserv6.sun.com/exchange/index.html",
0290:                                "\t\thttp://rajanagendra.sun.com/abc.com?url=http://pserv6.sun.com/exchange/index.html" },
0291:
0292:                        {
0293:                                "\t\t/abc.com?url=http://pserv6.sun.com/exchange/index.html",
0294:                                "\t\thttp://rajanagendra.sun.com/abc.com?url=http://pserv6.sun.com/exchange/index.html" },
0295:                        {
0296:                                "   /abc.com?url=http://pserv6.sun.com/exchange/index.html",
0297:                                "   http://rajanagendra.sun.com/abc.com?url=http://pserv6.sun.com/exchange/index.html" },
0298:                        { "   /abc.com   ",
0299:                                "   http://rajanagendra.sun.com/abc.com   " },
0300:
0301:                        { "\\\"\\14c.html\\\"",
0302:                                "\\\"http://rajanagendra.sun.com/14c.html\\\"" }, //0
0303:                        { "\\\"\\raj\\k\\14c.html\\\"",
0304:                                "\\\"http://rajanagendra.sun.com/raj\\k\\14c.html\\\"" }, //0
0305:                        { "\\\"raj\\k/14c.html\\\"",
0306:                                "\\\"http://rajanagendra.sun.com/Base/Raja/raj\\k/14c.html\\\"" }, //0
0307:
0308:                        { "\\\"/14c.html\\\"",
0309:                                "\\\"http://rajanagendra.sun.com/14c.html\\\"" }, //0
0310:                        { "\\\'/14c.html\\\'",
0311:                                "\\\'http://rajanagendra.sun.com/14c.html\\\'" }, //1
0312:                        { "\\'./14c.html\\'",
0313:                                "\\'http://rajanagendra.sun.com/Base/Raja/14c.html\\'" }, //2
0314:                        { "\"\\\'./14c.html\\'",
0315:                                "\"\\\'http://rajanagendra.sun.com/Base/Raja/14c.html\\'" }, //3
0316:                        { "\"/14c.html\"",
0317:                                "\"http://rajanagendra.sun.com/14c.html\"" }, //4
0318:                        { "'../14c.html'",
0319:                                "'http://rajanagendra.sun.com/Base/14c.html'" }, //5
0320:                        { "'\"/14c.html\"'",
0321:                                "'\"http://rajanagendra.sun.com/14c.html\"'" }, //6
0322:                        { "'\\\"/14c.html\\\"'",
0323:                                "'\\\"http://rajanagendra.sun.com/14c.html\\\"'" }, //7
0324:
0325:                        { "/14c.html\\\"",
0326:                                "http://rajanagendra.sun.com/14c.html\\\"" }, //0
0327:                        { "/14c.html\\\'",
0328:                                "http://rajanagendra.sun.com/14c.html\\\'" }, //1
0329:                        { "./14c.html\\'",
0330:                                "http://rajanagendra.sun.com/Base/Raja/14c.html\\'" }, //2
0331:                        { "./14c.html\\'",
0332:                                "http://rajanagendra.sun.com/Base/Raja/14c.html\\'" }, //3
0333:                        { "/14c.html\"",
0334:                                "http://rajanagendra.sun.com/14c.html\"" }, //4
0335:                        { "../14c.html'",
0336:                                "http://rajanagendra.sun.com/Base/14c.html'" }, //5
0337:                        { "/14c.html\"'",
0338:                                "http://rajanagendra.sun.com/14c.html\"'" }, //6
0339:                        { "/14c.html\\\"'",
0340:                                "http://rajanagendra.sun.com/14c.html\\\"'" }, //7
0341:
0342:                        { "\\\"/14c.html",
0343:                                "\\\"http://rajanagendra.sun.com/14c.html" }, //0
0344:                        { "\\\'/14c.html",
0345:                                "\\\'http://rajanagendra.sun.com/14c.html" }, //1
0346:                        { "\\'./14c.html",
0347:                                "\\'http://rajanagendra.sun.com/Base/Raja/14c.html" }, //2
0348:                        { "\"\\\'./14c.html",
0349:                                "\"\\\'http://rajanagendra.sun.com/Base/Raja/14c.html" }, //3
0350:                        { "\"/14c.html",
0351:                                "\"http://rajanagendra.sun.com/14c.html" }, //4
0352:                        { "'../14c.html",
0353:                                "'http://rajanagendra.sun.com/Base/14c.html" }, //5
0354:                        { "'\"/14c.html",
0355:                                "'\"http://rajanagendra.sun.com/14c.html" }, //6
0356:                        { "'\\\"/14c.html",
0357:                                "'\\\"http://rajanagendra.sun.com/14c.html" }, //7
0358:
0359:                        { "/", "http://rajanagendra.sun.com/" },
0360:                        { "./", "http://rajanagendra.sun.com/Base/Raja/" },
0361:                        { "/./", "http://rajanagendra.sun.com/" },
0362:                        { "../", "http://rajanagendra.sun.com/Base/" },
0363:                        { "/../", "http://rajanagendra.sun.com/" }, //100
0364:                        { "../../", "http://rajanagendra.sun.com/" },
0365:
0366:                        { "'''\t\t/index.html'''",
0367:                                "'''\t\thttp://rajanagendra.sun.com/index.html'''" }, //30
0368:                        { "'\t\t'\t'/index.html'''",
0369:                                "'\t\t'\t'http://rajanagendra.sun.com/index.html'''" }, //30
0370:                        { "'\t'\t'\t/index.html'''",
0371:                                "'\t'\t'\thttp://rajanagendra.sun.com/index.html'''" }, //30
0372:                        { "\t\"\t\"\t\"\t/index1.html\"\"\"",
0373:                                "\t\"\t\"\t\"\thttp://rajanagendra.sun.com/index1.html\"\"\"" }, //30
0374:                        { "\"  \"  \" \t  /index.html\"\"\"",
0375:                                "\"  \"  \" \t  http://rajanagendra.sun.com/index.html\"\"\"" }, //30
0376:                        { "\"\t\t\"\t\t\t\"\t\t\t\t/index.html\"\"\"",
0377:                                "\"\t\t\"\t\t\t\"\t\t\t\thttp://rajanagendra.sun.com/index.html\"\"\"" }, //30
0378:                        { "'''\t\t/index.html\t'\t'\t'",
0379:                                "'''\t\thttp://rajanagendra.sun.com/index.html\t'\t'\t'" }, //30
0380:                        { "'\t\t'\t'/index.html\t'\t\t''\t\t",
0381:                                "'\t\t'\t'http://rajanagendra.sun.com/index.html\t'\t\t''\t\t" }, //30
0382:                        { "'\t'\t'\t/index.html\t'\t'\t'\t",
0383:                                "'\t'\t'\thttp://rajanagendra.sun.com/index.html\t'\t'\t'\t" }, //41
0384:                        { "\t\"\t\"\t\"\t/index.html\t   \"  \t  \"\t  \"",
0385:                                "\t\"\t\"\t\"\thttp://rajanagendra.sun.com/index.html\t   \"  \t  \"\t  \"" }, //42
0386:                        { "\"  \"  \" \t  /index.html  \t  \"   \"    \"  ",
0387:                                "\"  \"  \" \t  http://rajanagendra.sun.com/index.html  \t  \"   \"    \"  " }, //43
0388:                        { "\"\t\t\"\t\t\"\t\t\t\t/index.html \"  \"  \"  ",
0389:                                "\"\t\t\"\t\t\"\t\t\t\thttp://rajanagendra.sun.com/index.html \"  \"  \"  " }, //30
0390:                        {
0391:                                "\"\t\t\"\t\t\"\t\t\t\thttp://rajanagendra.sun.com/index.html \"  \"  \"",
0392:                                "\"\t\t\"\t\t\"\t\t\t\thttp://rajanagendra.sun.com/index.html \"  \"  \"" }, //30
0393:                        {
0394:                                "\"\t\t\"\t\t\"\t\t\t\thttp://rajanagendra.sun.com:80/index.html \"  \"  \"",
0395:                                "\"\t\t\"\t\t\"\t\t\t\thttp://rajanagendra.sun.com/index.html \"  \"  \"" }, //30
0396:                        {
0397:                                "\"\t\t\"\t\t\"\t\t\t\thttps://rajanagendra.sun.com:80/index.html \"  \"  \"",
0398:                                "\"\t\t\"\t\t\"\t\t\t\thttps://rajanagendra.sun.com:80/index.html \"  \"  \"" }, //30
0399:
0400:                        { "http://user@password@srap.india.sun.com",
0401:                                "http://user@password@srap.india.sun.com" }, //Bug 2 be fixed in JDK-URI
0402:                        {
0403:                                "/abc.com?url=http://pserv6.sun.com/exchange/index.html",
0404:                                "http://rajanagendra.sun.com/abc.com?url=http://pserv6.sun.com/exchange/index.html" },
0405:                        { "\\Image/icon.jpg?ab\\e=eess",
0406:                                "http://rajanagendra.sun.com/Image/icon.jpg?ab\\e=eess" }, //Bug No: 4701655
0407:                        {
0408:                                "/amserver/login?gw=yamaha.India.Sun.COM&dm=yamaha.India.Sun.COM&org=India.Sun.COM",
0409:                                "http://rajanagendra.sun.com/amserver/login?gw=yamaha.India.Sun.COM&dm=yamaha.India.Sun.COM&org=India.Sun.COM" },
0410:                        {
0411:                                "amserver/login?gw=yamaha.india.sun.com&dm=yamaha.india.sun.com&org=India.Sun.COM",
0412:                                "http://rajanagendra.sun.com/Base/Raja/amserver/login?gw=yamaha.india.sun.com&dm=yamaha.india.sun.com&org=India.Sun.COM" },
0413:                        { "//Image/icon.jpg?ab\\e=eess",
0414:                                "http://Image/icon.jpg?ab\\e=eess" },
0415:                        { "Image/icon.jpg?ab\\e=eess",
0416:                                "http://rajanagendra.sun.com/Base/Raja/Image/icon.jpg?ab\\e=eess" },
0417:                        { "Image\\icon.jpg",
0418:                                "http://rajanagendra.sun.com/Base/Raja/Image\\icon.jpg" },
0419:                        { "Image\\\\icon.jpg",
0420:                                "http://rajanagendra.sun.com/Base/Raja/Image\\\\icon.jpg" },
0421:                        {
0422:                                "iPlanet Directory Server Access Management Edition_files/AMHeader",
0423:                                "http://rajanagendra.sun.com/Base/Raja/iPlanet Directory Server Access Management Edition_files/AMHeader" },
0424:                        {
0425:                                "iPlanet%20%20Directory%20Server%20Access%20Management%20Edition_files/AMHeader",
0426:                                "http://rajanagendra.sun.com/Base/Raja/iPlanet%20%20Directory%20Server%20Access%20Management%20Edition_files/AMHeader" },
0427:                        { "tn3270://localhost:30001",
0428:                                "tn3270://localhost:30001" }, //Bug No: 4626345
0429:                        { "tn3270://avc.com:30001/", "tn3270://avc.com:30001/" },
0430:                        { "tn3270://avc.com/", "tn3270://avc.com/" },
0431:                        { "hTTp:../raha.html", "hTTp:../raha.html" },
0432:                        { "HttP:/raha.html", "HttP:/raha.html" },
0433:                        { "HtTp:/../raha.html", "HtTp:/../raha.html" },
0434:                        { "HTTP:///../raha.html", "HTTP:///raha.html" }, //134
0435:                        { "http:../raha.html", "http:../raha.html" },
0436:                        { "http:/raha.html", "http:/raha.html" },
0437:                        { "http:/../raha.html", "http:/../raha.html" },
0438:                        { "http:///../raha.html", "http:///raha.html" },
0439:                        { "../raha.html",
0440:                                "http://rajanagendra.sun.com/Base/raha.html" },
0441:                        { "./raha.html",
0442:                                "http://rajanagendra.sun.com/Base/Raja/raha.html" },
0443:                        { "''\"'\"'''     \"'\"'   ",
0444:                                "''\"'\"'''     \"'\"'   " }, //7
0445:                        { "abc.html", base + path + "abc.html" }, //7
0446:                        { "http://www.sun.com:80/abc.html",
0447:                                "http://www.sun.com/abc.html" }, //3
0448:                        { "index.",
0449:                                "http://rajanagendra.sun.com/Base/Raja/index." }, //-10 - Bug 4658040
0450:                        { "../../index.", "http://rajanagendra.sun.com/index." }, //-9 - Bug 4658040
0451:                        { "../", "http://rajanagendra.sun.com/Base/" }, //-10
0452:                        { "../../", "http://rajanagendra.sun.com/" }, //-9
0453:                        { "././", "http://rajanagendra.sun.com/Base/Raja/" }, //-8
0454:
0455:                        { "..", "http://rajanagendra.sun.com/Base/" }, //-7
0456:                        { "../..", "http://rajanagendra.sun.com/" }, //-6
0457:                        { "./.", "http://rajanagendra.sun.com/Base/Raja/" }, //-5
0458:
0459:                        { "#raj.index",
0460:                                "http://rajanagendra.sun.com/Base/Raja/raja.html?name=raja#raj.index" }, //-4
0461:                        { " ", " " }, //-3
0462:                        { "", "" }, //-2
0463:                        { "http://user:password@sun.com/index.html",
0464:                                "http://user:password@sun.com/index.html" }, //-1
0465:                        { "../../img/background.jpg",
0466:                                base + "img/background.jpg" }, //2
0467:                        { "http://www.sun.com/abc.html",
0468:                                "http://www.sun.com/abc.html" }, //3
0469:                        { "https://www.sun.com/sh.html",
0470:                                "https://www.sun.com/sh.html" }, //4
0471:                        { "https://www.sun.com:78/sh.html",
0472:                                "https://www.sun.com:78/sh.html" }, //5
0473:                        { "htTp://www.sun.com:400/sh.html",
0474:                                "htTp://www.sun.com:400/sh.html" }, //6
0475:                        { "./abc.html", base + path + "abc.html" }, //8
0476:                        { "/abc.html", base + "abc.html" }, //9
0477:                        { "../../abc.html", base + "abc.html" }, //10
0478:                        { "../abc.html", base + "Base/" + "abc.html" }, //11
0479:                        { "../abc.html?turn=true",
0480:                                base + "Base/" + "abc.html?turn=true" }, //12
0481:                        { "./abc.html?turn=true",
0482:                                base + path + "abc.html?turn=true" }, //13
0483:                        { "htTp://www.sun.com:400/sh.html?roja=ramani",
0484:                                "htTp://www.sun.com:400/sh.html?roja=ramani" }, //14
0485:                        { "./././././abc.html", base + path + "abc.html" }, //15
0486:                        { "null", "http://rajanagendra.sun.com/Base/Raja/null" }, //30 - Bug4627258
0487:                        { "../../../../functions/javascript.js",
0488:                                base + "functions/javascript.js" }, //170
0489:                        { "./raja/mahesh/.././abc.html",
0490:                                base + path + "raja/abc.html" }, //16
0491:                        { "\"/index.html\"",
0492:                                "\"http://rajanagendra.sun.com/index.html\"" }, //19
0493:                        { "user:password@./index.html",
0494:                                "user:password@./index.html" }, //0
0495:                        { "user:password@http://sun.com/index.html",
0496:                                "user:password@http://sun.com/index.html" }, //0
0497:                //{"&#47;file.shtml?view=new_cal&#38;id=lakjsdfla&#38;date=99", "http:&#47;&#47;rajanagendra.sun.com&#47;file.shtml?view=new_cal&#38;id=lakjsdfla&#38;date=99"}, //18
0498:                //{"http:&#47;&#47;host.com&#47;file.shtml?view=new_cal&#38;id=lakjsdfla&#38;date=99", "http:&#47;&#47;host.com&#47;file.shtml?view=new_cal&#38;id=lakjsdfla&#38;date=99"}, //17
0499:                //{"//Image/icon.jpg?ab\\e=eess", "http://rajanagendra.sun.com/icon.jpg?ab\\e=eess"},
0500:                };
0501:
0502:                for (int i = 0; i < lData.length; i++) {
0503:                    String result = lTranslator.translate(lData[i][0]);
0504:                    assertEquals("Failed at i=" + i + ":", lData[i][1], result);
0505:                }//for loop
0506:
0507:            }//testTranslateHTTPURL()
0508:
0509:            public void testTranslateFTPURL() throws Exception {
0510:                String base, path, file;
0511:                base = "ftp://rajanagendra.sun.com/";
0512:                path = "Base/Raja/";
0513:                file = "raja.html?name=raja";
0514:                String url = base + path + file;
0515:                PageSpec samplePageSpec = new PageSpec(url, "");
0516:                Translator lTranslator = new AbsoluteTranslator(samplePageSpec);
0517:
0518:                String[][] lData = {
0519:                        { "/", "ftp://rajanagendra.sun.com/" },
0520:                        { "file:///c:/ghkim/love.txt",
0521:                                "file:///c:/ghkim/love.txt" },
0522:                        {
0523:                                "./EP_SgPgLayView.jsp?pgid=|1E2652&titfont=white",
0524:                                "ftp://rajanagendra.sun.com/Base/Raja/EP_SgPgLayView.jsp?pgid=|1E2652&titfont=white" },
0525:
0526:                        { "#default#homepage",
0527:                                "ftp://rajanagendra.sun.com/Base/Raja/raja.html?name=raja#default#homepage" },
0528:
0529:                        {
0530:                                "/first.shtml?view=new_cal&#38;id=bl02oe8w2rbhp3t6&#38;crc=2561871368&#38;date=20020925T180701&#38;newCalCalID=tuser&#38;tzid=&#38;freebusy=1&#38;tab=1&#38;prevView=monthview&#38;calid=tuser&#38;security=1",
0531:                                "ftp://rajanagendra.sun.com/first.shtml?view=new_cal&#38;id=bl02oe8w2rbhp3t6&#38;crc=2561871368&#38;date=20020925T180701&#38;newCalCalID=tuser&#38;tzid=&#38;freebusy=1&#38;tab=1&#38;prevView=monthview&#38;calid=tuser&#38;security=1" },
0532:
0533:                        {
0534:                                "/amserver/login?gw=gatev.red.iplanet.com&org=red.iplanet.com",
0535:                                "ftp://rajanagendra.sun.com/amserver/login?gw=gatev.red.iplanet.com&org=red.iplanet.com" },
0536:                        { "'''\t\t/index.html'''",
0537:                                "'''\t\tftp://rajanagendra.sun.com/index.html'''" }, //30
0538:                        { "'\t\t'\t'/index.html'''",
0539:                                "'\t\t'\t'ftp://rajanagendra.sun.com/index.html'''" }, //30
0540:                        { "'\t'\t'\t/index.html'''",
0541:                                "'\t'\t'\tftp://rajanagendra.sun.com/index.html'''" }, //30
0542:                        { "\t\"\t\"\t\"\t/index1.html\"\"\"",
0543:                                "\t\"\t\"\t\"\tftp://rajanagendra.sun.com/index1.html\"\"\"" }, //30
0544:                        { "\"  \"  \" \t  /index.html\"\"\"",
0545:                                "\"  \"  \" \t  ftp://rajanagendra.sun.com/index.html\"\"\"" }, //30
0546:                        { "\"\t\t\"\t\t\t\"\t\t\t\t/index.html\"\"\"",
0547:                                "\"\t\t\"\t\t\t\"\t\t\t\tftp://rajanagendra.sun.com/index.html\"\"\"" }, //30
0548:                        { "'''\t\t/index.html\t'\t'\t'",
0549:                                "'''\t\tftp://rajanagendra.sun.com/index.html\t'\t'\t'" }, //30
0550:                        { "'\t\t'\t'/index.html\t'\t\t''\t\t",
0551:                                "'\t\t'\t'ftp://rajanagendra.sun.com/index.html\t'\t\t''\t\t" }, //7
0552:                        { "'\t'\t'\t/index.html\t'\t'\t'\t",
0553:                                "'\t'\t'\tftp://rajanagendra.sun.com/index.html\t'\t'\t'\t" }, //8
0554:                        { "\t\"\t\"\t\"\t/index.html\t   \"  \t  \"\t  \"",
0555:                                "\t\"\t\"\t\"\tftp://rajanagendra.sun.com/index.html\t   \"  \t  \"\t  \"" }, //30
0556:                        { "\"  \"  \" \t  /index.html  \t  \"   \"    \"  ",
0557:                                "\"  \"  \" \t  ftp://rajanagendra.sun.com/index.html  \t  \"   \"    \"  " }, //30
0558:                        { "\"\t\t\"\t\t\"\t\t\t\t/index.html \"  \"  \"  ",
0559:                                "\"\t\t\"\t\t\"\t\t\t\tftp://rajanagendra.sun.com/index.html \"  \"  \"  " }, //30
0560:                        {
0561:                                "\"\t\t\"\t\t\"\t\t\t\tftp://rajanagendra.sun.com/index.html \"  \"  \"",
0562:                                "\"\t\t\"\t\t\"\t\t\t\tftp://rajanagendra.sun.com/index.html \"  \"  \"" }, //30
0563:                        {
0564:                                "\"\t\t\"\t\t\"\t\t\t\tftp://rajanagendra.sun.com:21/index.html \"  \"  \"",
0565:                                "\"\t\t\"\t\t\"\t\t\t\tftp://rajanagendra.sun.com/index.html \"  \"  \"" }, //30
0566:                        {
0567:                                "\"\t\t\"\t\t\"\t\t\t\tftp://rajanagendra.sun.com:80/index.html \"  \"  \"",
0568:                                "\"\t\t\"\t\t\"\t\t\t\tftp://rajanagendra.sun.com:80/index.html \"  \"  \"" }, //30
0569:
0570:                        {
0571:                                "iPlanet%20%20Directory%20Server%20Access%20Management%20Edition_files/AMHeader",
0572:                                "ftp://rajanagendra.sun.com/Base/Raja/iPlanet%20%20Directory%20Server%20Access%20Management%20Edition_files/AMHeader" },
0573:
0574:                        { "ftp:../raha.html", "ftp:../raha.html" },
0575:                        { "ftp:/raha.html", "ftp:/raha.html" },
0576:                        { "ftp:/../raha.html", "ftp:/../raha.html" },
0577:                        { "ftp:///../raha.html", "ftp:///raha.html" },
0578:                        { "../raha.html",
0579:                                "ftp://rajanagendra.sun.com/Base/raha.html" },
0580:                        { "./raha.html",
0581:                                "ftp://rajanagendra.sun.com/Base/Raja/raha.html" },
0582:                        { "/0.", "ftp://rajanagendra.sun.com/0." }, //-8
0583:                        { "/0", "ftp://rajanagendra.sun.com/0" }, //-8
0584:                        { "1", "ftp://rajanagendra.sun.com/Base/Raja/1" }, //-8
0585:                        { "././1", "ftp://rajanagendra.sun.com/Base/Raja/1" }, //-8
0586:                        { "././1.html",
0587:                                "ftp://rajanagendra.sun.com/Base/Raja/1.html" }, //-8
0588:                        { "ftp://user:password@sun.com/index.html",
0589:                                "ftp://user:password@sun.com/index.html" }, //-1
0590:                        { "././", "ftp://rajanagendra.sun.com/Base/Raja/" }, //-8
0591:                        { "#raj.index",
0592:                                "ftp://rajanagendra.sun.com/Base/Raja/raja.html?name=raja#raj.index" }, //-4
0593:                        { "./././././abc.html", base + path + "abc.html" }, //15
0594:                        { "\"/index.html\"",
0595:                                "\"ftp://rajanagendra.sun.com/index.html\"" }, //19
0596:                        { "'/index.html'",
0597:                                "'ftp://rajanagendra.sun.com/index.html'" }, //30
0598:                        { "\"\"\"/index.html\"\"\"",
0599:                                "\"\"\"ftp://rajanagendra.sun.com/index.html\"\"\"" }, //30
0600:                        { "'''/index.html'''",
0601:                                "'''ftp://rajanagendra.sun.com/index.html'''" }, //30
0602:                        { "''\"'\"'''     \"'\"'   ",
0603:                                "''\"'\"'''     \"'\"'   " }, //7
0604:                        { "ftp://www.sun.com:21/abc.html",
0605:                                "ftp://www.sun.com/abc.html" }, //3
0606:                        { "index.",
0607:                                "ftp://rajanagendra.sun.com/Base/Raja/index." }, //-10 - Bug 4658040
0608:                        { "../../index.", "ftp://rajanagendra.sun.com/index." }, //-9 - - Bug 4658040
0609:                        { "../", "ftp://rajanagendra.sun.com/Base/" }, //-10
0610:                        { "../../", "ftp://rajanagendra.sun.com/" }, //-9
0611:
0612:                        { "..", "ftp://rajanagendra.sun.com/Base/" }, //-7
0613:                        { "../..", "ftp://rajanagendra.sun.com/" }, //-6
0614:                        { "./.", "ftp://rajanagendra.sun.com/Base/Raja/" }, //-5
0615:
0616:                        { " ", " " }, //-3
0617:                        { "", "" }, //-2
0618:                        { "../../../../functions/javascript.js",
0619:                                base + "functions/javascript.js" }, //1
0620:                        { "../../img/background.jpg",
0621:                                base + "img/background.jpg" }, //2
0622:                        { "ftp://www.sun.com/abc.html",
0623:                                "ftp://www.sun.com/abc.html" }, //3
0624:                        { "ftp://www.sun.com/sh.html",
0625:                                "ftp://www.sun.com/sh.html" }, //4
0626:                        { "ftp://www.sun.com:78/sh.html",
0627:                                "ftp://www.sun.com:78/sh.html" }, //5
0628:                        { "ftp://www.sun.com:400/sh.html",
0629:                                "ftp://www.sun.com:400/sh.html" }, //6
0630:                        { "abc.html", base + path + "abc.html" }, //7
0631:                        { "./abc.html", base + path + "abc.html" }, //8
0632:                        { "/abc.html", base + "abc.html" }, //9
0633:                        { "../../abc.html", base + "abc.html" }, //10
0634:                        { "../abc.html", base + "Base/" + "abc.html" }, //11
0635:                        { "../abc.html?turn=true",
0636:                                base + "Base/" + "abc.html?turn=true" }, //12
0637:                        { "./abc.html?turn=true",
0638:                                base + path + "abc.html?turn=true" }, //13
0639:                        { "ftp://www.sun.com:400/sh.html?roja=ramani",
0640:                                "ftp://www.sun.com:400/sh.html?roja=ramani" }, //14
0641:                        { "./raja/mahesh/.././abc.html",
0642:                                base + path + "raja/abc.html" }, //16
0643:                        { "null", "ftp://rajanagendra.sun.com/Base/Raja/null" }, //30 - Bug4627258
0644:                        { "user:password@./index.html",
0645:                                "user:password@./index.html" }, //0
0646:                        { "user:password@ftp://sun.com/index.html",
0647:                                "user:password@ftp://sun.com/index.html" }, //0
0648:                //{"ftp:&#47;&#47;host.com&#47;file.shtml?view=new_cal&#38;id=lakjsdfla&#38;date=99", "ftp:&#47;&#47;host.com&#47;file.shtml?view=new_cal&#38;id=lakjsdfla&#38;date=99"}, //17
0649:                //{"&#47;file.shtml?view=new_cal&#38;id=lakjsdfla&#38;date=99", "ftp:&#47;&#47;rajanagendra.sun.com&#47;file.shtml?view=new_cal&#38;id=lakjsdfla&#38;date=99"}, //18
0650:                };
0651:
0652:                for (int i = 0; i < lData.length; i++) {
0653:                    String result = lTranslator.translate(lData[i][0]);
0654:                    assertEquals("Failed at i=" + i + ":", lData[i][1], result);
0655:                }
0656:            }//testTranslateFTPURL
0657:
0658:            public void testTranslateHTTPSURL() throws Exception {
0659:                String base, path, file;
0660:                base = "https://rajanagendra.sun.com/";
0661:                path = "Base/Raja/";
0662:                file = "raja.html?name=raja";
0663:                String url = base + path + file;
0664:                PageSpec samplePageSpec = new PageSpec(url, "");
0665:                Translator lTranslator = new AbsoluteTranslator(samplePageSpec);
0666:
0667:                String[][] lData = {
0668:                        { "/", "https://rajanagendra.sun.com/" },
0669:                        { "file:///c:/ghkim/love.txt",
0670:                                "file:///c:/ghkim/love.txt" },
0671:                        {
0672:                                "./EP_SgPgLayView.jsp?pgid=|1E2652&titfont=white",
0673:                                "https://rajanagendra.sun.com/Base/Raja/EP_SgPgLayView.jsp?pgid=|1E2652&titfont=white" },
0674:
0675:                        { "#default#homepage",
0676:                                "https://rajanagendra.sun.com/Base/Raja/raja.html?name=raja#default#homepage" },
0677:
0678:                        {
0679:                                "/first.shtml?view=new_cal&#38;id=bl02oe8w2rbhp3t6&#38;crc=2561871368&#38;date=20020925T180701&#38;newCalCalID=tuser&#38;tzid=&#38;freebusy=1&#38;tab=1&#38;prevView=monthview&#38;calid=tuser&#38;security=1",
0680:                                "https://rajanagendra.sun.com/first.shtml?view=new_cal&#38;id=bl02oe8w2rbhp3t6&#38;crc=2561871368&#38;date=20020925T180701&#38;newCalCalID=tuser&#38;tzid=&#38;freebusy=1&#38;tab=1&#38;prevView=monthview&#38;calid=tuser&#38;security=1" },
0681:
0682:                        {
0683:                                "/amserver/login?gw=gatev.red.iplanet.com&org=red.iplanet.com",
0684:                                "https://rajanagendra.sun.com/amserver/login?gw=gatev.red.iplanet.com&org=red.iplanet.com" },
0685:                        { "'''\t\t/index.html'''",
0686:                                "'''\t\thttps://rajanagendra.sun.com/index.html'''" }, //30
0687:                        { "'\t\t'\t'/index.html'''",
0688:                                "'\t\t'\t'https://rajanagendra.sun.com/index.html'''" }, //30
0689:                        { "'\t'\t'\t/index.html'''",
0690:                                "'\t'\t'\thttps://rajanagendra.sun.com/index.html'''" }, //30
0691:                        { "\t\"\t\"\t\"\t/index1.html\"\"\"",
0692:                                "\t\"\t\"\t\"\thttps://rajanagendra.sun.com/index1.html\"\"\"" }, //3
0693:                        { "\"  \"  \" \t  /index.html\"\"\"",
0694:                                "\"  \"  \" \t  https://rajanagendra.sun.com/index.html\"\"\"" }, //4
0695:                        { "\"\t\t\"\t\t\t\"\t\t\t\t/index.html\"\"\"",
0696:                                "\"\t\t\"\t\t\t\"\t\t\t\thttps://rajanagendra.sun.com/index.html\"\"\"" }, //5
0697:                        { "'''\t\t/index.html\t'\t'\t'",
0698:                                "'''\t\thttps://rajanagendra.sun.com/index.html\t'\t'\t'" }, //6
0699:                        { "'\t\t'\t'/index.html\t'\t\t''\t\t",
0700:                                "'\t\t'\t'https://rajanagendra.sun.com/index.html\t'\t\t''\t\t" }, //7
0701:                        { "'\t'\t'\t/index.html\t'\t'\t'\t",
0702:                                "'\t'\t'\thttps://rajanagendra.sun.com/index.html\t'\t'\t'\t" }, //8
0703:                        { "\t\"\t\"\t\"\t/index.html\t   \"  \t  \"\t  \"",
0704:                                "\t\"\t\"\t\"\thttps://rajanagendra.sun.com/index.html\t   \"  \t  \"\t  \"" }, //9
0705:                        { "\"  \"  \" \t  /index.html  \t  \"   \"    \"  ",
0706:                                "\"  \"  \" \t  https://rajanagendra.sun.com/index.html  \t  \"   \"    \"  " }, //30
0707:                        { "\"\t\t\"\t\t\"\t\t\t\t/index.html \"  \"  \"  ",
0708:                                "\"\t\t\"\t\t\"\t\t\t\thttps://rajanagendra.sun.com/index.html \"  \"  \"  " }, //30
0709:                        {
0710:                                "\"\t\t\"\t\t\"\t\t\t\thttps://rajanagendra.sun.com/index.html \"  \"  \"",
0711:                                "\"\t\t\"\t\t\"\t\t\t\thttps://rajanagendra.sun.com/index.html \"  \"  \"" }, //30
0712:                        {
0713:                                "\"\t\t\"\t\t\"\t\t\t\thttps://rajanagendra.sun.com:443/index.html \"  \"  \"",
0714:                                "\"\t\t\"\t\t\"\t\t\t\thttps://rajanagendra.sun.com/index.html \"  \"  \"" }, //30
0715:                        {
0716:                                "\"\t\t\"\t\t\"\t\t\t\thttps://rajanagendra.sun.com:80/index.html \"  \"  \"",
0717:                                "\"\t\t\"\t\t\"\t\t\t\thttps://rajanagendra.sun.com:80/index.html \"  \"  \"" }, //30
0718:
0719:                        {
0720:                                "iPlanet%20%20Directory%20Server%20Access%20Management%20Edition_files/AMHeader",
0721:                                "https://rajanagendra.sun.com/Base/Raja/iPlanet%20%20Directory%20Server%20Access%20Management%20Edition_files/AMHeader" },
0722:                        { "https:../raha.html", "https:../raha.html" },
0723:                        { "https:/raha.html", "https:/raha.html" },
0724:                        { "https:/../raha.html", "https:/../raha.html" },
0725:                        { "https:///../raha.html", "https:///raha.html" },
0726:                        { "../raha.html",
0727:                                "https://rajanagendra.sun.com/Base/raha.html" },
0728:                        { "./raha.html",
0729:                                "https://rajanagendra.sun.com/Base/Raja/raha.html" },
0730:                        { "''\"'\"'''     \"'\"'   ",
0731:                                "''\"'\"'''     \"'\"'   " }, //7
0732:                        { "https://www.sun.com:443/abc.html",
0733:                                "https://www.sun.com/abc.html" }, //3
0734:                        { "index.",
0735:                                "https://rajanagendra.sun.com/Base/Raja/index." }, //-10 - Bug 4658040
0736:                        { "../../index.", "https://rajanagendra.sun.com/index." }, //-9 - Bug 4658040
0737:                        { "../", "https://rajanagendra.sun.com/Base/" }, //-10
0738:                        { "../../", "https://rajanagendra.sun.com/" }, //-9
0739:                        { "././", "https://rajanagendra.sun.com/Base/Raja/" }, //-8
0740:
0741:                        { "..", "https://rajanagendra.sun.com/Base/" }, //-7
0742:                        { "../..", "https://rajanagendra.sun.com/" }, //-6
0743:                        { "./.", "https://rajanagendra.sun.com/Base/Raja/" }, //-5
0744:
0745:                        { "#raj.index",
0746:                                "https://rajanagendra.sun.com/Base/Raja/raja.html?name=raja#raj.index" }, //-4
0747:                        { " ", " " }, //-3
0748:                        { "", "" }, //-2
0749:                        { "https://user:password@sun.com/index.html",
0750:                                "https://user:password@sun.com/index.html" }, //-1
0751:                        { "../../../../functions/javascript.js",
0752:                                base + "functions/javascript.js" }, //1
0753:                        { "../../img/background.jpg",
0754:                                base + "img/background.jpg" }, //2
0755:                        { "https://www.sun.com/abc.html",
0756:                                "https://www.sun.com/abc.html" }, //3
0757:                        { "https://www.sun.com/sh.html",
0758:                                "https://www.sun.com/sh.html" }, //4
0759:                        { "https://www.sun.com:78/sh.html",
0760:                                "https://www.sun.com:78/sh.html" }, //5
0761:                        { "https://www.sun.com:400/sh.html",
0762:                                "https://www.sun.com:400/sh.html" }, //6
0763:                        { "abc.html", base + path + "abc.html" }, //7
0764:                        { "./abc.html", base + path + "abc.html" }, //8
0765:                        { "/abc.html", base + "abc.html" }, //9
0766:                        { "../../abc.html", base + "abc.html" }, //10
0767:                        { "../abc.html", base + "Base/" + "abc.html" }, //11
0768:                        { "../abc.html?turn=true",
0769:                                base + "Base/" + "abc.html?turn=true" }, //12
0770:                        { "./abc.html?turn=true",
0771:                                base + path + "abc.html?turn=true" }, //13
0772:                        { "https://www.sun.com:400/sh.html?roja=ramani",
0773:                                "https://www.sun.com:400/sh.html?roja=ramani" }, //14
0774:                        { "./././././abc.html", base + path + "abc.html" }, //15
0775:                        { "./raja/mahesh/.././abc.html",
0776:                                base + path + "raja/abc.html" }, //16
0777:                        { "\"/index.html\"",
0778:                                "\"https://rajanagendra.sun.com/index.html\"" }, //19
0779:                        { "'/index.html'",
0780:                                "'https://rajanagendra.sun.com/index.html'" }, //30
0781:                        { "\"\"\"/index.html\"\"\"",
0782:                                "\"\"\"https://rajanagendra.sun.com/index.html\"\"\"" }, //30
0783:                        { "'''/index.html'''",
0784:                                "'''https://rajanagendra.sun.com/index.html'''" }, //30
0785:                        { "null", "https://rajanagendra.sun.com/Base/Raja/null" }, //30 - Bug4627258
0786:                        //{"https:&#47;&#47;host.com&#47;file.shtml?view=new_cal&#38;id=lakjsdfla&#38;date=99", "https:&#47;&#47;host.com&#47;file.shtml?view=new_cal&#38;id=lakjsdfla&#38;date=99"}, //17
0787:                        //{"&#47;file.shtml?view=new_cal&#38;id=lakjsdfla&#38;date=99", "https:&#47;&#47;rajanagendra.sun.com&#47;file.shtml?view=new_cal&#38;id=lakjsdfla&#38;date=99"}, //18
0788:                        { "user:password@./index.html",
0789:                                "user:password@./index.html" }, //0
0790:                        { "user:password@https://sun.com/index.html",
0791:                                "user:password@https://sun.com/index.html" }, //0
0792:                };
0793:
0794:                for (int i = 0; i < lData.length; i++) {
0795:                    String result = lTranslator.translate(lData[i][0]);
0796:                    assertEquals("Failed at i=" + i + ":", lData[i][1], result);
0797:                }//for loop
0798:            }//testTranslateHTTPSURL()
0799:
0800:            public void testBug4681424BaseWithNoPathInfo() throws Exception {
0801:                String[][] lData = {
0802:                        { "/", "http://rajanagendra.sun.com/" },
0803:                        { "file:///c:/ghkim/love.txt",
0804:                                "file:///c:/ghkim/love.txt" },
0805:                        { "#default#homepage",
0806:                                "http://rajanagendra.sun.com/#default#homepage" },
0807:
0808:                        {
0809:                                "/first.shtml?view=new_cal&#38;id=bl02oe8w2rbhp3t6&#38;crc=2561871368&#38;date=20020925T180701&#38;newCalCalID=tuser&#38;tzid=&#38;freebusy=1&#38;tab=1&#38;prevView=monthview&#38;calid=tuser&#38;security=1",
0810:                                "http://rajanagendra.sun.com/first.shtml?view=new_cal&#38;id=bl02oe8w2rbhp3t6&#38;crc=2561871368&#38;date=20020925T180701&#38;newCalCalID=tuser&#38;tzid=&#38;freebusy=1&#38;tab=1&#38;prevView=monthview&#38;calid=tuser&#38;security=1" },
0811:
0812:                        {
0813:                                "/amserver/login?gw=gatev.red.iplanet.com&org=red.iplanet.com",
0814:                                "http://rajanagendra.sun.com/amserver/login?gw=gatev.red.iplanet.com&org=red.iplanet.com" },
0815:
0816:                        { "../..", "http://rajanagendra.sun.com" }, //34
0817:                        { "..", "http://rajanagendra.sun.com" }, //33
0818:                        {
0819:                                "iPlanet%20%20Directory%20Server%20Access%20Management%20Edition_files/AMHeader",
0820:                                "http://rajanagendra.sun.com/iPlanet%20%20Directory%20Server%20Access%20Management%20Edition_files/AMHeader" },
0821:                        {
0822:                                "iPlanet Directory Server Access Management Edition_files/AMHeader",
0823:                                "http://rajanagendra.sun.com/iPlanet Directory Server Access Management Edition_files/AMHeader" },
0824:                        { "''\"'\"'''     \"'\"'   ",
0825:                                "''\"'\"'''     \"'\"'   " }, //1
0826:                        { "abc.html", "http://rajanagendra.sun.com/abc.html" }, //2
0827:                        { "http://www.sun.com:80/abc.html",
0828:                                "http://www.sun.com/abc.html" }, //3
0829:                        { "index.", "http://rajanagendra.sun.com/index." }, //4 - Bug 4658040
0830:                        { "../../index.", "http://rajanagendra.sun.com/index." }, //5 - Bug 4658040
0831:                        { "../", "http://rajanagendra.sun.com/" }, //
0832:                        { "../../", "http://rajanagendra.sun.com/" }, //7
0833:                        { "././", "http://rajanagendra.sun.com/" }, //8
0834:                        { "./.", "http://rajanagendra.sun.com/" }, //9
0835:                        { "#raj.index",
0836:                                "http://rajanagendra.sun.com/#raj.index" }, //10
0837:                        { " ", " " }, //11
0838:                        { "", "" }, //12
0839:                        { "http://user:password@sun.com/index.html",
0840:                                "http://user:password@sun.com/index.html" }, //13
0841:                        { "../../img/background.jpg",
0842:                                "http://rajanagendra.sun.com/img/background.jpg" }, //14
0843:                        { "http://www.sun.com/abc.html",
0844:                                "http://www.sun.com/abc.html" }, //15
0845:                        { "https://www.sun.com/sh.html",
0846:                                "https://www.sun.com/sh.html" }, //16
0847:                        { "https://www.sun.com:78/sh.html",
0848:                                "https://www.sun.com:78/sh.html" }, //17
0849:                        { "htTp://www.sun.com:400/sh.html",
0850:                                "htTp://www.sun.com:400/sh.html" }, //18
0851:                        { "./abc.html", "http://rajanagendra.sun.com/abc.html" }, //19
0852:                        { "/abc.html", "http://rajanagendra.sun.com/abc.html" }, //20
0853:                        { "../../abc.html",
0854:                                "http://rajanagendra.sun.com/abc.html" }, //21
0855:                        { "../abc.html", "http://rajanagendra.sun.com/abc.html" }, //22
0856:                        { "../abc.html?turn=true",
0857:                                "http://rajanagendra.sun.com/abc.html?turn=true" }, //23
0858:                        { "./abc.html?turn=true",
0859:                                "http://rajanagendra.sun.com/abc.html?turn=true" }, //24
0860:                        { "htTp://www.sun.com:400/sh.html?roja=ramani",
0861:                                "htTp://www.sun.com:400/sh.html?roja=ramani" }, //25
0862:                        { "./././././abc.html",
0863:                                "http://rajanagendra.sun.com/abc.html" }, //26
0864:                        { "null", "http://rajanagendra.sun.com/null" }, //37 - Bug4627258
0865:                        { "../../../../functions/javascript.js",
0866:                                "http://rajanagendra.sun.com/functions/javascript.js" }, //28
0867:                        { "./raja/mahesh/.././abc.html",
0868:                                "http://rajanagendra.sun.com/raja/abc.html" }, //29
0869:                        { "\"/index.html\"",
0870:                                "\"http://rajanagendra.sun.com/index.html\"" }, //30
0871:                        { "'/index.html'",
0872:                                "'http://rajanagendra.sun.com/index.html'" }, //30
0873:                        { "\"\"\"/index.html\"\"\"",
0874:                                "\"\"\"http://rajanagendra.sun.com/index.html\"\"\"" }, //30
0875:                        { "'''/index.html'''",
0876:                                "'''http://rajanagendra.sun.com/index.html'''" }, //30
0877:                        { "user:password@./index.html",
0878:                                "user:password@./index.html" }, //31
0879:                        { "user:password@http://sun.com/index.html",
0880:                                "user:password@http://sun.com/index.html" }, //32
0881:                //{"&#47;file.shtml?view=new_cal&#38;id=lakjsdfla&#38;date=99", "http:&#47;&#47;rajanagendra.sun.com&#47;file.shtml?view=new_cal&#38;id=lakjsdfla&#38;date=99"}, //18
0882:                //{"http:&#47;&#47;host.com&#47;file.shtml?view=new_cal&#38;id=lakjsdfla&#38;date=99", "http:&#47;&#47;host.com&#47;file.shtml?view=new_cal&#38;id=lakjsdfla&#38;date=99"}, //17
0883:                };
0884:
0885:                //Bug No: 4681424
0886:                String[] baseURI = { "http://rajanagendra.sun.com/./.",
0887:                        "http://rajanagendra.sun.com",
0888:                        "http://rajanagendra.sun.com/",
0889:                        "http://rajanagendra.sun.com//",
0890:                        "http://rajanagendra.sun.com:80",
0891:                        "http://rajanagendra.sun.com:80/",
0892:                        "http://rajanagendra.sun.com:80//", };
0893:
0894:                for (int j = 0; j < baseURI.length; j++) {
0895:                    PageSpec samplePageSpec = new PageSpec(baseURI[j]); //Bug No: 4681424
0896:                    Translator translator = new AbsoluteTranslator(
0897:                            samplePageSpec);
0898:
0899:                    for (int i = 0; i < lData.length; i++) {
0900:                        String result = translator.translate(lData[i][0]);
0901:                        assertEquals("Failed at i=" + i + ":", lData[i][1],
0902:                                result);
0903:                    }//for loop
0904:                }
0905:            }//testBug4681424BaseWithNoPathInfo()
0906:
0907:            public void testBug4681424BaseWithNonDefaultPort() throws Exception {
0908:                String[][] lData = {
0909:                        { "/", "ftp://rajanagendra.sun.com:8087/" },
0910:                        { "file:///c:/ghkim/love.txt",
0911:                                "file:///c:/ghkim/love.txt" },
0912:                        { "./EP_SgPgLayView.jsp?pgid=|1E2652&titfont=white",
0913:                                "ftp://rajanagendra.sun.com:8087/EP_SgPgLayView.jsp?pgid=|1E2652&titfont=white" },
0914:
0915:                        { "#default#homepage",
0916:                                "ftp://rajanagendra.sun.com:8087/#default#homepage" },
0917:                        {
0918:                                "/first.shtml?view=new_cal&#38;id=bl02oe8w2rbhp3t6&#38;crc=2561871368&#38;date=20020925T180701&#38;newCalCalID=tuser&#38;tzid=&#38;freebusy=1&#38;tab=1&#38;prevView=monthview&#38;calid=tuser&#38;security=1",
0919:                                "ftp://rajanagendra.sun.com:8087/first.shtml?view=new_cal&#38;id=bl02oe8w2rbhp3t6&#38;crc=2561871368&#38;date=20020925T180701&#38;newCalCalID=tuser&#38;tzid=&#38;freebusy=1&#38;tab=1&#38;prevView=monthview&#38;calid=tuser&#38;security=1" },
0920:                        {
0921:                                "/amserver/login?gw=gatev.red.iplanet.com&org=red.iplanet.com",
0922:                                "ftp://rajanagendra.sun.com:8087/amserver/login?gw=gatev.red.iplanet.com&org=red.iplanet.com" },
0923:                        { "..", "ftp://rajanagendra.sun.com:8087" }, //33
0924:                        { "../..", "ftp://rajanagendra.sun.com:8087" }, //34
0925:                        { "../", "ftp://rajanagendra.sun.com:8087/" }, //6
0926:                        {
0927:                                "iPlanet%20%20Directory%20Server%20Access%20Management%20Edition_files/AMHeader",
0928:                                "ftp://rajanagendra.sun.com:8087/iPlanet%20%20Directory%20Server%20Access%20Management%20Edition_files/AMHeader" },
0929:                        {
0930:                                "iPlanet Directory Server Access Management Edition_files/AMHeader",
0931:                                "ftp://rajanagendra.sun.com:8087/iPlanet Directory Server Access Management Edition_files/AMHeader" },
0932:                        { "''\"'\"'''     \"'\"'   ",
0933:                                "''\"'\"'''     \"'\"'   " }, //1
0934:                        { "abc.html",
0935:                                "ftp://rajanagendra.sun.com:8087/abc.html" }, //2
0936:                        { "ftp://www.sun.com:80/abc.html",
0937:                                "ftp://www.sun.com:80/abc.html" }, //3
0938:                        { "index.", "ftp://rajanagendra.sun.com:8087/index." }, //4 - Bug 4658040
0939:                        { "../../index.",
0940:                                "ftp://rajanagendra.sun.com:8087/index." }, //5 - Bug 4658040
0941:                        { "./.", "ftp://rajanagendra.sun.com:8087/" }, //9
0942:                        { "../../", "ftp://rajanagendra.sun.com:8087/" }, //7
0943:                        { "././", "ftp://rajanagendra.sun.com:8087/" }, //8
0944:                        { "#raj.index",
0945:                                "ftp://rajanagendra.sun.com:8087/#raj.index" }, //10
0946:                        { " ", " " }, //11
0947:                        { "", "" }, //12
0948:                        { "ftp://user:password@sun.com/index.html",
0949:                                "ftp://user:password@sun.com/index.html" }, //13
0950:                        { "../../img/background.jpg",
0951:                                "ftp://rajanagendra.sun.com:8087/img/background.jpg" }, //14
0952:                        { "FTP://www.sun.com/abc.html",
0953:                                "FTP://www.sun.com/abc.html" }, //15
0954:                        { "ftP://www.sun.com/sh.html",
0955:                                "ftP://www.sun.com/sh.html" }, //16
0956:                        { "ftp://www.sun.com:78/sh.html",
0957:                                "ftp://www.sun.com:78/sh.html" }, //17
0958:                        { "fTp://www.sun.com:400/sh.html",
0959:                                "fTp://www.sun.com:400/sh.html" }, //18
0960:                        { "./abc.html",
0961:                                "ftp://rajanagendra.sun.com:8087/abc.html" }, //19
0962:                        { "/abc.html",
0963:                                "ftp://rajanagendra.sun.com:8087/abc.html" }, //20
0964:                        { "../../abc.html",
0965:                                "ftp://rajanagendra.sun.com:8087/abc.html" }, //21
0966:                        { "../abc.html",
0967:                                "ftp://rajanagendra.sun.com:8087/abc.html" }, //22
0968:                        { "../abc.html?turn=true",
0969:                                "ftp://rajanagendra.sun.com:8087/abc.html?turn=true" }, //23
0970:                        { "./abc.html?turn=true",
0971:                                "ftp://rajanagendra.sun.com:8087/abc.html?turn=true" }, //24
0972:                        { "fTP://www.sun.com:400/sh.html?roja=ramani",
0973:                                "fTP://www.sun.com:400/sh.html?roja=ramani" }, //25
0974:                        { "./././././abc.html",
0975:                                "ftp://rajanagendra.sun.com:8087/abc.html" }, //26
0976:                        { "null", "ftp://rajanagendra.sun.com:8087/null" }, //37 - Bug4627258
0977:                        { "../../../../functions/javascript.js",
0978:                                "ftp://rajanagendra.sun.com:8087/functions/javascript.js" }, //28
0979:                        { "./raja/mahesh/.././abc.html",
0980:                                "ftp://rajanagendra.sun.com:8087/raja/abc.html" }, //29
0981:                        { "\"/index.html\"",
0982:                                "\"ftp://rajanagendra.sun.com:8087/index.html\"" }, //30
0983:                        { "'/index.html'",
0984:                                "'ftp://rajanagendra.sun.com:8087/index.html'" }, //30
0985:                        { "\"\"\"/index.html\"\"\"",
0986:                                "\"\"\"ftp://rajanagendra.sun.com:8087/index.html\"\"\"" }, //30
0987:                        { "'''/index.html'''",
0988:                                "'''ftp://rajanagendra.sun.com:8087/index.html'''" }, //30
0989:                        { "user:password@./index.html",
0990:                                "user:password@./index.html" }, //31
0991:                        { "user:password@http://sun.com/index.html",
0992:                                "user:password@http://sun.com/index.html" }, //32
0993:                        { ".", "ftp://rajanagendra.sun.com:8087/" }, //33
0994:
0995:                //{"&#47;file.shtml?view=new_cal&#38;id=lakjsdfla&#38;date=99", "http:&#47;&#47;rajanagendra.sun.com&#47;file.shtml?view=new_cal&#38;id=lakjsdfla&#38;date=99"}, //18
0996:                //{"http:&#47;&#47;host.com&#47;file.shtml?view=new_cal&#38;id=lakjsdfla&#38;date=99", "http:&#47;&#47;host.com&#47;file.shtml?view=new_cal&#38;id=lakjsdfla&#38;date=99"}, //17
0997:                };
0998:
0999:                //Bug No: 4681424
1000:                String[] baseURI = { "ftp://rajanagendra.sun.com:8087",
1001:                        "ftp://rajanagendra.sun.com:8087/",
1002:                        "ftp://rajanagendra.sun.com:8087//",
1003:                        "ftp://rajanagendra.sun.com:8087/././.",
1004:                        "ftp://rajanagendra.sun.com:8087/./././",
1005:                        "ftp://rajanagendra.sun.com:8087/./.", };
1006:
1007:                for (int i = 0; i < baseURI.length; i++) {
1008:                    PageSpec samplePageSpec = new PageSpec(baseURI[i]); //Bug No: 4681424
1009:                    Translator lTranslator = new AbsoluteTranslator(
1010:                            samplePageSpec);
1011:
1012:                    for (int j = 0; j < lData.length; j++) {
1013:
1014:                        String result = lTranslator.translate(lData[j][0]);
1015:                        assertEquals("Failed at j=" + j + ":", lData[j][1],
1016:                                result);
1017:                    }//for loop
1018:                }
1019:
1020:            }//testBug4681424BaseWithNonDefaultPort()
1021:
1022:            public void testBug4627258PassingNull() throws Exception {
1023:                String result = getDefaultTranslator().translate(null);
1024:                assertNull(result);
1025:            }//testBug4627258PassingNull()
1026:
1027:            /*
1028:            public void atestTranslateString()
1029:            {
1030:                String[][] lData =
1031:            	    {
1032:            		{
1033:            		    "/index.html",
1034:            		    "http://rajanagendra.sun.com/index.html",
1035:            		    "\" \""
1036:            		}, //1
1037:
1038:
1039:            		{
1040:            		    "'/index.html",
1041:            		    "'http://rajanagendra.sun.com/index.html'",
1042:            		    "**'"
1043:            		}, //2
1044:
1045:            		{
1046:            		    "  '/index.html",
1047:            		    "'http://rajanagendra.sun.com/index.html'",
1048:            		    "**'"
1049:            		}, //3
1050:
1051:            		{
1052:            		    "\"/index.html\"",
1053:            		    "\"http://rajanagendra.sun.com/index.html\""
1054:            		}, //0
1055:
1056:            	    };
1057:
1058:                for ( int i = 0; i < lData.length; i++ )
1059:                {
1060:            	Pattern[] c = RegExp.createValuePatternSpec( lData[i][2],
1061:            					     Rule.PATTERN_SEPERATOR,
1062:            					     Rule.CHILD_PATTERN );
1063:            	String result = TranslatorHelper.translateSubStrings(  c,
1064:            							      lData[i][0],
1065:            							      getDefaultTranslator() );
1066:            	assertEquals( "Failed in must Translate String : i= " + i, lData[i][1], result );
1067:                }
1068:            }//testTranslateString()*/
1069:
1070:            public void testComplextQueryURI() throws Exception {
1071:                String url = "http://rajawin.india.sun.com:8080/ips/";
1072:                Translator lTranslator = new AbsoluteTranslator(new PageSpec(
1073:                        url, ""));
1074:
1075:                String[][] lData = {
1076:                        {
1077:                                "http://sun.com:80/ips/rwadmin/SelectRule?SelectRule.TiledView1[0].hrefEditRule=defaultruleset&jato.pageSession=AKztAAVzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hvbGR4cD9AAAAAAAAIdwgAAAALAAAAAnQAM2phdG8uU2VsZWN0UnVsZS5UaWxlZFZpZXcxLndlYkFjdGlvbi5tYXhEaXNwbGF5Um93c3QAAzEwMHQANWphdG8uU2VsZWN0UnVsZS5UaWxlZFZpZXcxLndlYkFjdGlvbi5jdXJyZW50Um93T2Zmc2V0dAABMHg$",
1078:                                "http://sun.com/ips/rwadmin/SelectRule?SelectRule.TiledView1[0].hrefEditRule=defaultruleset&jato.pageSession=AKztAAVzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hvbGR4cD9AAAAAAAAIdwgAAAALAAAAAnQAM2phdG8uU2VsZWN0UnVsZS5UaWxlZFZpZXcxLndlYkFjdGlvbi5tYXhEaXNwbGF5Um93c3QAAzEwMHQANWphdG8uU2VsZWN0UnVsZS5UaWxlZFZpZXcxLndlYkFjdGlvbi5jdXJyZW50Um93T2Zmc2V0dAABMHg$", },
1079:
1080:                        {
1081:                                "http://sun.com:8080/ips/rwadmin/SelectRule?SelectRule.TiledView1[0].hrefEditRule=defaultruleset&jato.pageSession=AKztAAVzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hvbGR4cD9AAAAAAAAIdwgAAAALAAAAAnQAM2phdG8uU2VsZWN0UnVsZS5UaWxlZFZpZXcxLndlYkFjdGlvbi5tYXhEaXNwbGF5Um93c3QAAzEwMHQANWphdG8uU2VsZWN0UnVsZS5UaWxlZFZpZXcxLndlYkFjdGlvbi5jdXJyZW50Um93T2Zmc2V0dAABMHg$",
1082:                                "http://sun.com:8080/ips/rwadmin/SelectRule?SelectRule.TiledView1[0].hrefEditRule=defaultruleset&jato.pageSession=AKztAAVzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hvbGR4cD9AAAAAAAAIdwgAAAALAAAAAnQAM2phdG8uU2VsZWN0UnVsZS5UaWxlZFZpZXcxLndlYkFjdGlvbi5tYXhEaXNwbGF5Um93c3QAAzEwMHQANWphdG8uU2VsZWN0UnVsZS5UaWxlZFZpZXcxLndlYkFjdGlvbi5jdXJyZW50Um93T2Zmc2V0dAABMHg$", },
1083:
1084:                        {
1085:                                "rwadmin/SelectRule?SelectRule.TiledView1[0].hrefEditRule=defaultruleset&jato.pageSession=AKztAAVzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hvbGR4cD9AAAAAAAAIdwgAAAALAAAAAnQAM2phdG8uU2VsZWN0UnVsZS5UaWxlZFZpZXcxLndlYkFjdGlvbi5tYXhEaXNwbGF5Um93c3QAAzEwMHQANWphdG8uU2VsZWN0UnVsZS5UaWxlZFZpZXcxLndlYkFjdGlvbi5jdXJyZW50Um93T2Zmc2V0dAABMHg$",
1086:                                "http://rajawin.india.sun.com:8080/ips/rwadmin/SelectRule?SelectRule.TiledView1[0].hrefEditRule=defaultruleset&jato.pageSession=AKztAAVzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hvbGR4cD9AAAAAAAAIdwgAAAALAAAAAnQAM2phdG8uU2VsZWN0UnVsZS5UaWxlZFZpZXcxLndlYkFjdGlvbi5tYXhEaXNwbGF5Um93c3QAAzEwMHQANWphdG8uU2VsZWN0UnVsZS5UaWxlZFZpZXcxLndlYkFjdGlvbi5jdXJyZW50Um93T2Zmc2V0dAABMHg$", },
1087:
1088:                        {
1089:                                "../rwadmin/SelectRule?SelectRule.TiledView1[0].hrefEditRule=defaultruleset&jato.pageSession=AKztAAVzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hvbGR4cD9AAAAAAAAIdwgAAAALAAAAAnQAM2phdG8uU2VsZWN0UnVsZS5UaWxlZFZpZXcxLndlYkFjdGlvbi5tYXhEaXNwbGF5Um93c3QAAzEwMHQANWphdG8uU2VsZWN0UnVsZS5UaWxlZFZpZXcxLndlYkFjdGlvbi5jdXJyZW50Um93T2Zmc2V0dAABMHg$",
1090:                                "http://rajawin.india.sun.com:8080/rwadmin/SelectRule?SelectRule.TiledView1[0].hrefEditRule=defaultruleset&jato.pageSession=AKztAAVzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hvbGR4cD9AAAAAAAAIdwgAAAALAAAAAnQAM2phdG8uU2VsZWN0UnVsZS5UaWxlZFZpZXcxLndlYkFjdGlvbi5tYXhEaXNwbGF5Um93c3QAAzEwMHQANWphdG8uU2VsZWN0UnVsZS5UaWxlZFZpZXcxLndlYkFjdGlvbi5jdXJyZW50Um93T2Zmc2V0dAABMHg$", },
1091:
1092:                        {
1093:                                "../../../rwadmin/SelectRule?SelectRule.TiledView1[0].hrefEditRule=defaultruleset&jato.pageSession=AKztAAVzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hvbGR4cD9AAAAAAAAIdwgAAAALAAAAAnQAM2phdG8uU2VsZWN0UnVsZS5UaWxlZFZpZXcxLndlYkFjdGlvbi5tYXhEaXNwbGF5Um93c3QAAzEwMHQANWphdG8uU2VsZWN0UnVsZS5UaWxlZFZpZXcxLndlYkFjdGlvbi5jdXJyZW50Um93T2Zmc2V0dAABMHg$",
1094:                                "http://rajawin.india.sun.com:8080/rwadmin/SelectRule?SelectRule.TiledView1[0].hrefEditRule=defaultruleset&jato.pageSession=AKztAAVzcgARamF2YS51dGlsLkhhc2hNYXAFB9rBwxZg0QMAAkYACmxvYWRGYWN0b3JJAAl0aHJlc2hvbGR4cD9AAAAAAAAIdwgAAAALAAAAAnQAM2phdG8uU2VsZWN0UnVsZS5UaWxlZFZpZXcxLndlYkFjdGlvbi5tYXhEaXNwbGF5Um93c3QAAzEwMHQANWphdG8uU2VsZWN0UnVsZS5UaWxlZFZpZXcxLndlYkFjdGlvbi5jdXJyZW50Um93T2Zmc2V0dAABMHg$", }, };
1095:
1096:                for (int i = 0; i < lData.length; i++) {
1097:                    String result = lTranslator.translate(lData[i][0]);
1098:                    assertEquals("Failed at i=" + i + ":", lData[i][1], result);
1099:                }//for loop
1100:            }//testComplextQueryURI()
1101:
1102:            public void testWMLURI() throws Exception {
1103:                String lInput = "#c";
1104:                String lExpectation = "http://server/abc.jsp?a=1&b=2#c";
1105:
1106:                Translator lTranslator = new AbsoluteTranslator(new PageSpec(
1107:                        "http://server/abc.jsp?a=1&b=2"));
1108:                String result = lTranslator.translate(lInput);
1109:                assertEquals(lExpectation, result);
1110:            }//testWMLURI()
1111:
1112:            public static void main(String[] args) {
1113:                RewriterModule.initFile();
1114:                //BasicTestCase.run( TestTranslatorHelper.class );
1115:                TestSuite testSuite = new TestSuite();
1116:                testSuite.addTest(new TestTranslatorHelper(
1117:                        "testTranslateHTTPURL"));
1118:                BasicTestCase.run(testSuite);
1119:            }//main()
1120:
1121:        }//class TestTranslatorHelper
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.