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.rproxy.rewriter.engines.js.test;
0006:
0007: import com.sun.portal.rewriter.Translator;
0008: import com.sun.portal.log.common.PortalLogger;
0009: import com.sun.portal.rewriter.test.util.BasicTestCase;
0010: import com.sun.portal.rewriter.test.util.JScriptInterpreter;
0011: import com.sun.portal.rproxy.rewriter.test.util.SRAPJSWrapperHelper;
0012: import com.sun.portal.rproxy.rewriter.test.util.SRAPTestSystemFactory;
0013: import junit.framework.TestSuite;
0014:
0015: import java.net.MalformedURLException;
0016:
0017: public class TestSRAPJSConvertExpressionFunction extends BasicTestCase {
0018: private static final String[][] data = {
0019: {
0020: "https://zeus.NAWAB.inda.COM/SESSionID/https://rajanagendra.sun.com ",
0021: "https://zeus.NAWAB.inda.COM/SESSionID/https://rajanagendra.sun.com" },
0022:
0023: {
0024: "https://zeus.NAWAB.inda.COM/SESSionID/redirect/https://rajanagendra.sun.com ",
0025: "https://zeus.NAWAB.inda.COM/SESSionID/redirect/https://rajanagendra.sun.com" },
0026:
0027: {
0028: "https://zeus.NAWAB.inda.COM/redirect/https://rajanagendra.sun.com ",
0029: "https://zeus.NAWAB.inda.COM/redirect/https://rajanagendra.sun.com" },
0030:
0031: {
0032: "https://zeuS.nawab.indA.COM/https://rajanagendra.sun.com ",
0033: "https://zeuS.nawab.indA.COM/https://rajanagendra.sun.com" },
0034:
0035: {
0036: "https://zeus.nawab.inda.COM/redirect/https://rajanagendra.sun.com ",
0037: "https://zeus.nawab.inda.COM/redirect/https://rajanagendra.sun.com" },
0038:
0039: {
0040: "https://zeus.nawab.indA.com/redirect/https://rajanagendra.sun.com ",
0041: "https://zeus.nawab.indA.com/redirect/https://rajanagendra.sun.com" },
0042:
0043: {
0044: "https://zeus.nawab.inda.com/redirect/https://rajanagendra.sun.com ",
0045: "https://zeus.nawab.inda.com/redirect/https://rajanagendra.sun.com" },
0046:
0047: {
0048: "https://zeus.nawab.inda.com/redirect/https://rajanagendra.sun.com/abc/img.gIG ",
0049: "https://zeus.nawab.inda.com/redirect/https://rajanagendra.sun.com/abc/img.gIG" },
0050:
0051: {
0052: "./?Cmd=navbar",
0053: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/./?Cmd=navbar", },
0054:
0055: { "http://localhost", "http://localhost" }, //39
0056: { "https://localhost", "https://localhost" }, //40
0057: { "http://127.0.0.1", "http://127.0.0.1" }, //37
0058: { "https://127.0.0.1", "https://127.0.0.1" }, //38
0059: { "htTp://127.0.0.1", "htTp://127.0.0.1" }, //41
0060: { "hTTps://127.0.0.1", "hTTps://127.0.0.1" }, //42
0061: { "http://localHOST", "http://localHOST" }, //43
0062: { "HTTPS://LOCALHOST", "HTTPS://LOCALHOST" }, //44
0063: { "http://127.0.0.1:34", "http://127.0.0.1:34" }, //37
0064: { "HTTPS://LOCALHOST:256", "HTTPS://LOCALHOST:256" }, //44
0065: { "ftp://LOCALHOST", "ftp://LOCALHOST" }, //44
0066: { "ftp://LOCALHOST:23", "ftp://LOCALHOST:23" }, //44
0067: { "ftp://rajanagendra.india.sun.com",
0068: "ftp://rajanagendra.india.sun.com" }, //44
0069:
0070: {
0071: "/mail/mstm.nsf/iNotes/Proxy/?OpenDocument&Form=s_ReadViewEntries&PresetFields=FolderName;%28%24Inbox%29,s_UsingHttps;1&Start=1&Count=40",
0072: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/mail/mstm.nsf/iNotes/Proxy/?OpenDocument&Form=s_ReadViewEntries&PresetFields=FolderName;%28%24Inbox%29,s_UsingHttps;1&Start=1&Count=40", },
0073:
0074: {
0075: "/command.shtml?view=overview&id=bu95rq3r35uq62n2o2p&crc=/()'-/*(+/&group=Keine+Kalendergruppe&date=",
0076: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/command.shtml?view=overview&id=bu95rq3r35uq62n2o2p&crc=/()'-/*(+/&group=Keine+Kalendergruppe&date=" },
0077:
0078: {
0079: "command.shtml?view=overview&id=bu95rq3r35uq62n2o2p&crc=/()'-/*(+/&group=Keine+Kalendergruppe&date=",
0080: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/command.shtml?view=overview&id=bu95rq3r35uq62n2o2p&crc=/()'-/*(+/&group=Keine+Kalendergruppe&date=" },
0081:
0082: {
0083: "/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",
0084: "https://zeus.nawab.inda.com/redirect/http://raja.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", },
0085: {
0086: "/command.shtml?view=new_cal&id=ebm0q3u6y92m2nv9&crc=3002401687&date=20021005T013040&newCalCalID=tuser&tzid=&e_ACL=@@o^c^WDEIC^g;@@o^a^RSF^g;@^a^sf^g;@^c^^g;@^p^r^g&freebusy=1&tab=1&prevView=monthview&calid=tuser&security=1",
0087: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/command.shtml?view=new_cal&id=ebm0q3u6y92m2nv9&crc=3002401687&date=20021005T013040&newCalCalID=tuser&tzid=&e_ACL=@@o^c^WDEIC^g;@@o^a^RSF^g;@^a^sf^g;@^c^^g;@^p^r^g&freebusy=1&tab=1&prevView=monthview&calid=tuser&security=1" },
0088: {
0089: "/command.shtml?view=new_cal&id=ebm0q3u6y92m2nv9&crc=3002401687&date=20021005T013040&newCalCalID=tuser&tzid=&e_ACL=@@o^c^WDEIC^g;@@o^a^RSF^g;@^a^sf^g;@^c^^g;@^p^r^g&freebusy=1&tab=1&prevView=monthview&calid=tuser&security=1",
0090: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/command.shtml?view=new_cal&id=ebm0q3u6y92m2nv9&crc=3002401687&date=20021005T013040&newCalCalID=tuser&tzid=&e_ACL=@@o^c^WDEIC^g;@@o^a^RSF^g;@^a^sf^g;@^c^^g;@^p^r^g&freebusy=1&tab=1&prevView=monthview&calid=tuser&security=1", },
0091: { "/",
0092: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/" },
0093: { "file:///c:/ghkim/love.txt", "file:///c:/ghkim/love.txt" },
0094: {
0095: "./EP_SgPgLayView.jsp?pgid=|1E2652&titfont=white",
0096: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/./EP_SgPgLayView.jsp?pgid=|1E2652&titfont=white" },
0097: { "#default#homepage", "#default#homepage" },
0098: {
0099: "/first.shtml?view=new_cal&id=bl02oe8w2rbhp3t6&crc=2561871368&date=20020925T180701&newCalCalID=tuser&tzid=&freebusy=1&tab=1&prevView=monthview&calid=tuser&security=1",
0100: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/first.shtml?view=new_cal&id=bl02oe8w2rbhp3t6&crc=2561871368&date=20020925T180701&newCalCalID=tuser&tzid=&freebusy=1&tab=1&prevView=monthview&calid=tuser&security=1" },
0101: {
0102: "http://serverm.stonerunner.red.iplanet.com:80/amserver/login?gw=gatev.red.iplanet.com&org=red.iplanet.com",
0103: "https://zeus.nawab.inda.com/redirect/http://serverm.stonerunner.red.iplanet.com/amserver/login?gw=gatev.red.iplanet.com&org=red.iplanet.com" },
0104: {
0105: "serverm.stonerunner.red.iplanet.com:80/amserver/login?gw=gatev.red.iplanet.com&org=red.iplanet.com",
0106: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/serverm.stonerunner.red.iplanet.com:80/amserver/login?gw=gatev.red.iplanet.com&org=red.iplanet.com" },
0107:
0108: { "https://rajanagendra.sun.com:443 ",
0109: "https://zeus.nawab.inda.com/redirect/https://rajanagendra.sun.com " },
0110: { " https://rajanagendra.sun.com:443",
0111: " https://zeus.nawab.inda.com/redirect/https://rajanagendra.sun.com" },
0112: { " https://rajanagendra.sun.com:443 ",
0113: " https://zeus.nawab.inda.com/redirect/https://rajanagendra.sun.com " },
0114:
0115: { "", "" }, //135
0116: { "''", "''" }, //135
0117: { "\"\"", "\"\"" }, //135
0118:
0119: { "/abc.com",
0120: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/abc.com" },
0121: { " /abc.com ",
0122: " https://zeus.nawab.inda.com/redirect/http://raja.sun.com/abc.com " },
0123: { " \t\t /abc.com ",
0124: " \t\t https://zeus.nawab.inda.com/redirect/http://raja.sun.com/abc.com " },
0125: { " \r/abc.com ",
0126: " \rhttps://zeus.nawab.inda.com/redirect/http://raja.sun.com/abc.com " },
0127: { " \n/abc.com ",
0128: " \nhttps://zeus.nawab.inda.com/redirect/http://raja.sun.com/abc.com " },
0129:
0130: {
0131: "/abc.com?url=http://pserv6.sun.com/exchange/index.html",
0132: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/abc.com?url=http://pserv6.sun.com/exchange/index.html" },
0133: {
0134: "abc.com?url=http://pserv6.sun.com/exchange/index.html",
0135: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/abc.com?url=http://pserv6.sun.com/exchange/index.html" },
0136: {
0137: "abc.comurl=http://pserv6.sun.com/exchange/index.html",
0138: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/abc.comurl=http://pserv6.sun.com/exchange/index.html" },
0139:
0140: {
0141: "/http://pserv6.sun.com/exchange/index.html",
0142: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/http://pserv6.sun.com/exchange/index.html" },
0143: {
0144: " /abc.com?url=http://pserv6.sun.com/exchange/index.html",
0145: " https://zeus.nawab.inda.com/redirect/http://raja.sun.com/abc.com?url=http://pserv6.sun.com/exchange/index.html" },
0146: {
0147: "\t\t/abc.com?url=http://pserv6.sun.com/exchange/index.html",
0148: "\t\thttps://zeus.nawab.inda.com/redirect/http://raja.sun.com/abc.com?url=http://pserv6.sun.com/exchange/index.html" },
0149:
0150: { "/abc.com",
0151: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/abc.com" },
0152: { " /abc.com ",
0153: " https://zeus.nawab.inda.com/redirect/http://raja.sun.com/abc.com " },
0154: {
0155: "\t\t/abc.com?url=http://pserv6.sun.com/exchange/index.html",
0156: "\t\thttps://zeus.nawab.inda.com/redirect/http://raja.sun.com/abc.com?url=http://pserv6.sun.com/exchange/index.html" },
0157: {
0158: " /abc.com?url=http://pserv6.sun.com/exchange/index.html",
0159: " https://zeus.nawab.inda.com/redirect/http://raja.sun.com/abc.com?url=http://pserv6.sun.com/exchange/index.html" },
0160:
0161: //Start of Negative TestCases
0162: {
0163: "\tfile:/tmp/x.html",
0164: "\thttps://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/file:/tmp/x.html" },
0165: {
0166: "\nfile:/tmp/x.html",
0167: "\nhttps://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/file:/tmp/x.html" },
0168: {
0169: "fiLe:/tmp/x.html",
0170: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/fiLe:/tmp/x.html" },
0171: {
0172: "file:/tmp/x.html",
0173: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/file:/tmp/x.html" },
0174: //End of Negative TestCases
0175:
0176: {
0177: "\\\"\\14c.html\\\"",
0178: "\\\"\\https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/14c.html\\\"" }, //0
0179: {
0180: "\\\"\\raj\\k\\14c.html\\\"",
0181: "\\\"\\https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/raj\\k\\14c.html\\\"" }, //0
0182: {
0183: "\\\"raj\\k/14c.html\\\"",
0184: "\\\"https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/raj\\k/14c.html\\\"" }, //0
0185:
0186: { "\\\"/14c.html\\\"",
0187: "\\\"https://zeus.nawab.inda.com/redirect/http://raja.sun.com/14c.html\\\"" }, //0
0188: { "\\\'/14c.html\\\'",
0189: "\\\'https://zeus.nawab.inda.com/redirect/http://raja.sun.com/14c.html\\\'" }, //1
0190: {
0191: "\\'./14c.html\\'",
0192: "\\'https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/./14c.html\\'" }, //2
0193: {
0194: "\"\\\'./14c.html\\'",
0195: "\"\\\'https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/./14c.html\\'" }, //3
0196: { "\"/14c.html\"",
0197: "\"https://zeus.nawab.inda.com/redirect/http://raja.sun.com/14c.html\"" }, //4
0198: {
0199: "'../14c.html'",
0200: "'https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/../14c.html'" }, //5
0201: { "'\"/14c.html\"'",
0202: "'\"https://zeus.nawab.inda.com/redirect/http://raja.sun.com/14c.html\"'" }, //6
0203: { "'\\\"/14c.html\\\"'",
0204: "'\\\"https://zeus.nawab.inda.com/redirect/http://raja.sun.com/14c.html\\\"'" }, //7
0205:
0206: { "/14c.html\\\"",
0207: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/14c.html\\\"" }, //0
0208: { "/14c.html\\\'",
0209: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/14c.html\\\'" }, //1
0210: {
0211: "./14c.html\\'",
0212: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/./14c.html\\'" }, //2
0213: {
0214: "./14c.html\\'",
0215: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/./14c.html\\'" }, //3
0216: { "/14c.html\"",
0217: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/14c.html\"" }, //4
0218: {
0219: "../14c.html'",
0220: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/../14c.html'" }, //5
0221: { "/14c.html\"'",
0222: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/14c.html\"'" }, //6
0223: { "/14c.html\\\"'",
0224: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/14c.html\\\"'" }, //7
0225:
0226: { "\\\"/14c.html",
0227: "\\\"https://zeus.nawab.inda.com/redirect/http://raja.sun.com/14c.html" }, //0
0228: { "\\\'/14c.html",
0229: "\\\'https://zeus.nawab.inda.com/redirect/http://raja.sun.com/14c.html" }, //1
0230: {
0231: "\\'./14c.html",
0232: "\\'https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/./14c.html" }, //2
0233: {
0234: "\"\\\'./14c.html",
0235: "\"\\\'https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/./14c.html" }, //3
0236: { "\"/14c.html",
0237: "\"https://zeus.nawab.inda.com/redirect/http://raja.sun.com/14c.html" }, //4
0238: {
0239: "'../14c.html",
0240: "'https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/../14c.html" }, //24
0241: { "'\"/14c.html",
0242: "'\"https://zeus.nawab.inda.com/redirect/http://raja.sun.com/14c.html" }, //6
0243: { "'\\\"/14c.html",
0244: "'\\\"https://zeus.nawab.inda.com/redirect/http://raja.sun.com/14c.html" }, //7
0245:
0246: { "ftp://ABC.COM", "ftp://ABC.COM" }, //44
0247: { " FILE://ABC.COM ", " FILE://ABC.COM " }, //44
0248: { " FTP://ABC.COM", " FTP://ABC.COM" }, //44
0249: { " ftP://ABC.COM", " ftP://ABC.COM" }, //44
0250: { " FilE://ABC.COM", " FilE://ABC.COM" }, //44
0251: { "telnet://ABC.COM ", "telnet://ABC.COM " }, //44
0252: { "teLNET://ABC.COM/INDEX.HTML ",
0253: "teLNET://ABC.COM/INDEX.HTML " }, //44
0254:
0255: { "ftp://LOCALHOST", "ftp://LOCALHOST" }, //44
0256: { "FILE://LOCALHOST", "FILE://LOCALHOST" }, //44
0257: { "FTP://LOCALHOST", "FTP://LOCALHOST" }, //44
0258: { "ftP://LOCALHOST", "ftP://LOCALHOST" }, //44
0259: { "FilE://LOCALHOST", "FilE://LOCALHOST" }, //44
0260: { "telnet://LOCALHOST", "telnet://LOCALHOST" }, //44
0261: { "teLNET://LOCALHOST", "teLNET://LOCALHOST" }, //44
0262:
0263: { "'''\t\t/index.html'''",
0264: "'''\t\thttps://zeus.nawab.inda.com/redirect/http://raja.sun.com/index.html'''" }, //30
0265: {
0266: "'\t\t'\t'/index.html'''",
0267: "'\t\t'\t'https://zeus.nawab.inda.com/redirect/http://raja.sun.com/index.html'''" }, //30
0268: {
0269: "'\t'\t'\t/index.html'''",
0270: "'\t'\t'\thttps://zeus.nawab.inda.com/redirect/http://raja.sun.com/index.html'''" }, //30
0271: {
0272: "\t\"\t\"\t\"\t/index1.html\"\"\"",
0273: "\t\"\t\"\t\"\thttps://zeus.nawab.inda.com/redirect/http://raja.sun.com/index1.html\"\"\"" }, //30
0274: {
0275: "\" \" \" \t /index.html\"\"\"",
0276: "\" \" \" \t https://zeus.nawab.inda.com/redirect/http://raja.sun.com/index.html\"\"\"" }, //30
0277: {
0278: "\"\t\t\"\t\t\t\"\t\t\t\t/index.html\"\"\"",
0279: "\"\t\t\"\t\t\t\"\t\t\t\thttps://zeus.nawab.inda.com/redirect/http://raja.sun.com/index.html\"\"\"" }, //30
0280: {
0281: "'''\t\t/index.html\t'\t'\t'",
0282: "'''\t\thttps://zeus.nawab.inda.com/redirect/http://raja.sun.com/index.html\t'\t'\t'" }, //30
0283: {
0284: "'\t\t'\t'/index.html\t'\t\t''\t\t",
0285: "'\t\t'\t'https://zeus.nawab.inda.com/redirect/http://raja.sun.com/index.html\t'\t\t''\t\t" }, //30
0286: {
0287: "'\t'\t'\t/index.html\t'\t'\t'\t",
0288: "'\t'\t'\thttps://zeus.nawab.inda.com/redirect/http://raja.sun.com/index.html\t'\t'\t'\t" }, //30
0289: {
0290: "\t\"\t\"\t\"\t/index.html\t \" \t \"\t \"",
0291: "\t\"\t\"\t\"\thttps://zeus.nawab.inda.com/redirect/http://raja.sun.com/index.html\t \" \t \"\t \"" }, //30
0292: {
0293: "\" \" \" \t /index.html \t \" \" \" ",
0294: "\" \" \" \t https://zeus.nawab.inda.com/redirect/http://raja.sun.com/index.html \t \" \" \" " }, //30
0295: {
0296: "\"\t\t\"\t\t\"\t\t\t\t/index.html \" \" \" ",
0297: "\"\t\t\"\t\t\"\t\t\t\thttps://zeus.nawab.inda.com/redirect/http://raja.sun.com/index.html \" \" \" " }, //30
0298: {
0299: "\"\t\t\"\t\t\"\t\t\t\thttp://rajanagendra.sun.com/index.html \" \" \"",
0300: "\"\t\t\"\t\t\"\t\t\t\thttps://zeus.nawab.inda.com/redirect/http://rajanagendra.sun.com/index.html \" \" \"" }, //30
0301: {
0302: "\"\t\t\"\t\t\"\t\t\t\thttp://rajanagendra.sun.com:80/index.html \" \" \"",
0303: "\"\t\t\"\t\t\"\t\t\t\thttps://zeus.nawab.inda.com/redirect/http://rajanagendra.sun.com/index.html \" \" \"" }, //30
0304: {
0305: "\"\t\t\"\t\t\"\t\t\t\thttps://rajanagendra.sun.com:80/index.html \" \" \"",
0306: "\"\t\t\"\t\t\"\t\t\t\thttps://zeus.nawab.inda.com/redirect/https://rajanagendra.sun.com:80/index.html \" \" \"" }, //30
0307: { "'/index.html'",
0308: "'https://zeus.nawab.inda.com/redirect/http://raja.sun.com/index.html'" }, //30
0309: {
0310: "\"\"\"/index.html\"\"\"",
0311: "\"\"\"https://zeus.nawab.inda.com/redirect/http://raja.sun.com/index.html\"\"\"" }, //30
0312: { "'''/index.html'''",
0313: "'''https://zeus.nawab.inda.com/redirect/http://raja.sun.com/index.html'''" }, //30
0314:
0315: {
0316: "https://www.sun.com:443#https://www.sun.com:443/sh.html",
0317: "https://zeus.nawab.inda.com/redirect/https://www.sun.com#https://www.sun.com:443/sh.html" }, //16
0318: {
0319: "https://www.sun.com:443?https://www.sun.com:443/sh.html",
0320: "https://zeus.nawab.inda.com/redirect/https://www.sun.com?https://www.sun.com:443/sh.html" }, //16
0321: {
0322: "https://www.sun.com/https://www.sun.com:443/sh.html",
0323: "https://zeus.nawab.inda.com/redirect/https://www.sun.com/https://www.sun.com:443/sh.html" }, //16
0324: {
0325: "https://www.sun.com:443/https://www.sun.com:443/sh.html",
0326: "https://zeus.nawab.inda.com/redirect/https://www.sun.com/https://www.sun.com:443/sh.html" }, //16
0327: {
0328: "http://www.sun.com:8680/sh.html?http://www.sun.com:443/sh.html",
0329: "https://zeus.nawab.inda.com/redirect/http://www.sun.com:8680/sh.html?http://www.sun.com:443/sh.html" }, //16
0330: {
0331: "http://www.sun.com:8086/sh.html?http://www.sun.com:443/sh.html",
0332: "https://zeus.nawab.inda.com/redirect/http://www.sun.com:8086/sh.html?http://www.sun.com:443/sh.html" }, //16
0333: {
0334: "http://www.sun.com:8080/sh.html?http://www.sun.com:443/sh.html",
0335: "https://zeus.nawab.inda.com/redirect/http://www.sun.com:8080/sh.html?http://www.sun.com:443/sh.html" }, //16
0336: {
0337: "https://www.sun.com:4431/sh.html?http://www.sun.com:443/sh.html",
0338: "https://zeus.nawab.inda.com/redirect/https://www.sun.com:4431/sh.html?http://www.sun.com:443/sh.html" }, //16
0339: {
0340: "https://www.sun.com:443/sh.html?http://www.sun.com:443/sh.html",
0341: "https://zeus.nawab.inda.com/redirect/https://www.sun.com/sh.html?http://www.sun.com:443/sh.html" }, //16
0342: {
0343: "https://www.sun.com/sh.html?http://www.sun.com:443/sh.html",
0344: "https://zeus.nawab.inda.com/redirect/https://www.sun.com/sh.html?http://www.sun.com:443/sh.html" }, //16
0345:
0346: { "ftp://rajanagendra.sun.com:21",
0347: "ftp://rajanagendra.sun.com:21" },
0348: { "file://rajanagendra.sun.com:0",
0349: "file://rajanagendra.sun.com:0" },
0350: { "https://rajanagendra.sun.com:443",
0351: "https://zeus.nawab.inda.com/redirect/https://rajanagendra.sun.com" },
0352: { "http://rajanagendra.sun.com:80",
0353: "https://zeus.nawab.inda.com/redirect/http://rajanagendra.sun.com" },
0354:
0355: { "ftp://rajanagendra.sun.com:21 ",
0356: "ftp://rajanagendra.sun.com:21 " },
0357: { "file://rajanagendra.sun.com:0 ",
0358: "file://rajanagendra.sun.com:0 " },
0359: { "https://rajanagendra.sun.com:443 ",
0360: "https://zeus.nawab.inda.com/redirect/https://rajanagendra.sun.com " },
0361: { "http://rajanagendra.sun.com:80 ",
0362: "https://zeus.nawab.inda.com/redirect/http://rajanagendra.sun.com " },
0363:
0364: { "file://rajanagendra.sun.com:0/",
0365: "file://rajanagendra.sun.com:0/" },
0366: { "ftp://rajanagendra.sun.com:21/",
0367: "ftp://rajanagendra.sun.com:21/" },
0368: { "https://rajanagendra.sun.com:443/",
0369: "https://zeus.nawab.inda.com/redirect/https://rajanagendra.sun.com/" },
0370: { "http://rajanagendra.sun.com:80/",
0371: "https://zeus.nawab.inda.com/redirect/http://rajanagendra.sun.com/" },
0372:
0373: { "ftp://rajanagendra.sun.com:21/test.html",
0374: "ftp://rajanagendra.sun.com:21/test.html" },
0375: { "file://rajanagendra.sun.com:0/test.html",
0376: "file://rajanagendra.sun.com:0/test.html" },
0377: { "https://rajanagendra.sun.com:443/test.html",
0378: "https://zeus.nawab.inda.com/redirect/https://rajanagendra.sun.com/test.html" },
0379: { "http://rajanagendra.sun.com:80/test.html",
0380: "https://zeus.nawab.inda.com/redirect/http://rajanagendra.sun.com/test.html" },
0381:
0382: { "file://rajanagendra.sun.com:0/test.html?index=21#ref",
0383: "file://rajanagendra.sun.com:0/test.html?index=21#ref" },
0384: { "ftp://rajanagendra.sun.com:21/test.html?index=21#ref",
0385: "ftp://rajanagendra.sun.com:21/test.html?index=21#ref" },
0386: {
0387: "https://rajanagendra.sun.com:443/test.html?index=21#ref",
0388: "https://zeus.nawab.inda.com/redirect/https://rajanagendra.sun.com/test.html?index=21#ref" },
0389: {
0390: "http://rajanagendra.sun.com:80/test.html?index=21#ref",
0391: "https://zeus.nawab.inda.com/redirect/http://rajanagendra.sun.com/test.html?index=21#ref" },
0392:
0393: {
0394: "file://rajanagendra.sun.com:21/test.html?http://raja.com:0/",
0395: "file://rajanagendra.sun.com:21/test.html?http://raja.com:0/" },
0396: {
0397: "ftp://rajanagendra.sun.com:31/test.html?http://raja.com:21/",
0398: "ftp://rajanagendra.sun.com:31/test.html?http://raja.com:21/" },
0399: {
0400: "https://rajanagendra.sun.com:44/test.html?http://raja.com:443/",
0401: "https://zeus.nawab.inda.com/redirect/https://rajanagendra.sun.com:44/test.html?http://raja.com:443/" },
0402: {
0403: "http://rajanagendra.sun.com:98/test.html?http://raja.com:80/",
0404: "https://zeus.nawab.inda.com/redirect/http://rajanagendra.sun.com:98/test.html?http://raja.com:80/" },
0405:
0406: { "file://rajanagendra.sun.com:21/test.html?index=21#ref",
0407: "file://rajanagendra.sun.com:21/test.html?index=21#ref" },
0408: { "ftp://rajanagendra.sun.com:31/test.html?index=21#ref",
0409: "ftp://rajanagendra.sun.com:31/test.html?index=21#ref" },
0410: {
0411: "https://rajanagendra.sun.com:44/test.html?index=21#ref",
0412: "https://zeus.nawab.inda.com/redirect/https://rajanagendra.sun.com:44/test.html?index=21#ref" },
0413: {
0414: "http://rajanagendra.sun.com:98/test.html?index=21#ref",
0415: "https://zeus.nawab.inda.com/redirect/http://rajanagendra.sun.com:98/test.html?index=21#ref" },
0416:
0417: {
0418: " file://rajanagendra.sun.com:0/test.html?index=21#ref",
0419: " file://rajanagendra.sun.com:0/test.html?index=21#ref" },
0420: {
0421: " ftp://rajanagendra.sun.com:21/test.html?index=21#ref",
0422: " ftp://rajanagendra.sun.com:21/test.html?index=21#ref" },
0423: {
0424: " https://rajanagendra.sun.com:443/test.html?index=21#ref",
0425: " https://zeus.nawab.inda.com/redirect/https://rajanagendra.sun.com/test.html?index=21#ref" },
0426: {
0427: " http://rajanagendra.sun.com:80/test.html?index=21#ref",
0428: " https://zeus.nawab.inda.com/redirect/http://rajanagendra.sun.com/test.html?index=21#ref" },
0429: { "/test.html",
0430: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/test.html" }, //BugNo:4693657
0431: { "file://C:/temp/x.html", "file://C:/temp/x.html" },
0432: { "FILE://C:/temp/x.html", "FILE://C:/temp/x.html" },
0433: { " file://C:/temp/x.html", " file://C:/temp/x.html" },
0434: { "fiLE://C:/temp/x.html", "fiLE://C:/temp/x.html" },
0435: { "index.",
0436: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/index." }, //0
0437: {
0438: "../../index.",
0439: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/../../index." }, //1
0440: { "../",
0441: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/../" }, //2
0442: { "../../",
0443: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/../../" }, //3
0444: { "././",
0445: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/././" }, //4
0446: { "..",
0447: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/.." }, //5
0448: { "../..",
0449: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/../.." }, //6
0450: { "./.",
0451: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/./." }, //7
0452: { "/",
0453: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/" }, //8
0454: { "#raj.index", "#raj.index" }, //9
0455: {
0456: "../../../../functions/javascript.js",
0457: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/../../../../functions/javascript.js" }, //13
0458: {
0459: "../../img/background.jpg",
0460: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/../../img/background.jpg" }, //14
0461: { "http://www.sun.com/abc.html",
0462: "https://zeus.nawab.inda.com/redirect/http://www.sun.com/abc.html" }, //15
0463: { "https://www.sun.com/sh.html",
0464: "https://zeus.nawab.inda.com/redirect/https://www.sun.com/sh.html" }, //16
0465: { "https://www.sun.com:78/sh.html",
0466: "https://zeus.nawab.inda.com/redirect/https://www.sun.com:78/sh.html" }, //17
0467: { "htTp://www.sun.com:400/sh.html",
0468: "https://zeus.nawab.inda.com/redirect/htTp://www.sun.com:400/sh.html" }, //18
0469: { "./abc.html",
0470: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/./abc.html" }, //20
0471: { "/abc.html",
0472: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/abc.html" }, //21
0473: {
0474: "../../abc.html",
0475: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/../../abc.html" }, //22
0476: {
0477: "../abc.html",
0478: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/../abc.html" }, //23
0479: {
0480: "../abc.html?turn=true",
0481: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/../abc.html?turn=true" }, //24
0482: {
0483: "./abc.html?turn=true",
0484: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/./abc.html?turn=true" }, //25
0485: {
0486: "htTp://www.sun.com:400/sh.html?roja=ramani",
0487: "https://zeus.nawab.inda.com/redirect/htTp://www.sun.com:400/sh.html?roja=ramani" }, //26
0488: {
0489: "./././././abc.html",
0490: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/./././././abc.html" }, //27
0491: {
0492: "./raja/mahesh/.././abc.html",
0493: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/./raja/mahesh/.././abc.html" }, //28
0494: {
0495: "https://zeus.nawab.inda.com/http://www.sun.com/abc.html",
0496: "https://zeus.nawab.inda.com/http://www.sun.com/abc.html" }, //35
0497:
0498: { "https://zeus.nawab.inda.com/index.html",
0499: "https://zeus.nawab.inda.com/index.html" },
0500: { "https://zeus.nawab.inda.com:443/index.html",
0501: "https://zeus.nawab.inda.com/index.html" },
0502: {
0503: "https://zeus.nawab.inda.com:445/index.html",
0504: "https://zeus.nawab.inda.com/redirect/https://zeus.nawab.inda.com:445/index.html" },
0505: {
0506: "hTTps://zeus.nawab.inda.com:445/index.html",
0507: "https://zeus.nawab.inda.com/redirect/hTTps://zeus.nawab.inda.com:445/index.html" },
0508: {
0509: "hTTps://zeus.nawab.inda.com:445/INDEX.html",
0510: "https://zeus.nawab.inda.com/redirect/hTTps://zeus.nawab.inda.com:445/INDEX.html" },
0511: {
0512: " ../../../../functions/javascript.js",
0513: " https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/../../../../functions/javascript.js" }, //13
0514: { " http://www.sun.com/abc.html ",
0515: " https://zeus.nawab.inda.com/redirect/http://www.sun.com/abc.html " }, //36
0516: { "abc.html",
0517: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/abc.html" }, //19
0518: { "null",
0519: "https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/null" }, //30 - Bug4627258
0520: { "'null'",
0521: "'https://zeus.nawab.inda.com/redirect/http://raja.sun.com/Base/Raja/null'" }, //31 - Bug4627258
0522: { "\"/index.html\"",
0523: "\"https://zeus.nawab.inda.com/redirect/http://raja.sun.com/index.html\"" },
0524: { " ", " " }, //10
0525: { "", "" }, //11
0526: { " ", " " }, //12
0527: { "\"\"", "\"\"" }, //29
0528: { "\" \t \t \"", "\" \t \t \"" }, //29
0529: { " #raj.index ", " #raj.index " }, //7
0530: { " \"\'#raj.index\'\" ", " \"\'#raj.index\'\" " }, //7
0531:
0532: /*{"user:password@./index.html", "user:password@./index.html"}, //33
0533: {"user:password@http://sun.com/index.html", "user:password@http://sun.com/index.html"}, //34
0534: */
0535: };
0536:
0537: private static Translator srapTranslator;
0538:
0539: static {
0540: try {
0541: srapTranslator = SRAPTestSystemFactory
0542: .createSRAPTranslator();
0543: } catch (MalformedURLException e) {
0544: e.printStackTrace(); //To change body of catch statement use Options | File Templates.
0545: }
0546: }
0547:
0548: public TestSRAPJSConvertExpressionFunction(String aName) {
0549: super (aName);
0550: }//constuctor
0551:
0552: public void testSRAPExperession() throws Exception {
0553: String[] gatewayURI = { "https://zeus.nawab.inda.com:443/",
0554: "https://zeus.nawab.inda.com:443",
0555: "https://zeus.nawab.inda.com/",
0556: "https://zeus.nawab.inda.com", };
0557: String intranetURI = "http://raja.sun.com/Base/Raja/index.html?abc=10&ee=90#raju";
0558:
0559: for (int j = 0; j < gatewayURI.length; j++) {
0560: Translator lSRAPTranslator = SRAPTestSystemFactory
0561: .createSRAPTranslator(gatewayURI[j], intranetURI);
0562: String functionDef = lSRAPTranslator.getJSFunctionSpec()
0563: .getExpressionFunctionDefination(
0564: lSRAPTranslator.getPageSpec());
0565:
0566: for (int i = 0; i < data.length; i++) {
0567: String result = JScriptInterpreter.exec(functionDef,
0568: lSRAPTranslator.getJSFunctionSpec()
0569: .getExpressionFunctionName(),
0570: new String[] { data[i][0] });
0571: assertEquals("Failed at i=" + i + ":", data[i][1],
0572: result);
0573: }
0574: }//for j loop
0575: }//testSRAPExperession()
0576:
0577: public void testInScriptBug4627258() throws Exception {
0578: String functionDef = srapTranslator.getJSFunctionSpec()
0579: .getExpressionFunctionDefination(
0580: srapTranslator.getPageSpec());
0581:
0582: String result = JScriptInterpreter.exec(functionDef,
0583: srapTranslator.getJSFunctionSpec()
0584: .getExpressionFunctionName(),
0585: new String[] { null });
0586: assertEquals(null, result);
0587: }//testInScriptBug4627258()
0588:
0589: public static void testWithPortInGatewayURI() throws Exception {
0590: String[][] lData = {
0591: { "ftp://ABC.COM", "ftp://ABC.COM" }, //44
0592: { " FILE://ABC.COM ", " FILE://ABC.COM " }, //44
0593: { " FTP://ABC.COM", " FTP://ABC.COM" }, //44
0594: { " ftP://ABC.COM", " ftP://ABC.COM" }, //44
0595: { " FilE://ABC.COM", " FilE://ABC.COM" }, //44
0596: { "telnet://ABC.COM ", "telnet://ABC.COM " }, //44
0597: { "teLNET://ABC.COM/INDEX.HTML ",
0598: "teLNET://ABC.COM/INDEX.HTML " }, //44
0599:
0600: { "ftp://LOCALHOST", "ftp://LOCALHOST" }, //44
0601: { "FILE://LOCALHOST", "FILE://LOCALHOST" }, //44
0602: { "FTP://LOCALHOST", "FTP://LOCALHOST" }, //44
0603: { "ftP://LOCALHOST", "ftP://LOCALHOST" }, //44
0604: { "FilE://LOCALHOST", "FilE://LOCALHOST" }, //44
0605: { "telnet://LOCALHOST", "telnet://LOCALHOST" }, //44
0606: { "teLNET://LOCALHOST", "teLNET://LOCALHOST" }, //44
0607:
0608: { "index.",
0609: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/index." }, //0
0610: {
0611: "../../index.",
0612: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/../../index." }, //1
0613: { "../",
0614: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/../" }, //2
0615: { "../../",
0616: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/../../" }, //3
0617: { "././",
0618: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/././" }, //4
0619: { "..",
0620: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/.." }, //5
0621: { "../..",
0622: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/../.." }, //6
0623: { "./.",
0624: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/./." }, //7
0625: { "/",
0626: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/" }, //8
0627: { "#raj.index", "#raj.index" }, //9
0628: {
0629: "../../../../functions/javascript.js",
0630: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/../../../../functions/javascript.js" }, //13
0631: {
0632: "../../img/background.jpg",
0633: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/../../img/background.jpg" }, //14
0634: { "http://www.sun.com/abc.html",
0635: "https://zeus.nawab.inda.com:445/redirect/http://www.sun.com/abc.html" }, //15
0636: { "https://www.sun.com/sh.html",
0637: "https://zeus.nawab.inda.com:445/redirect/https://www.sun.com/sh.html" }, //16
0638: { "https://www.sun.com:78/sh.html",
0639: "https://zeus.nawab.inda.com:445/redirect/https://www.sun.com:78/sh.html" }, //17
0640: { "htTp://www.sun.com:400/sh.html",
0641: "https://zeus.nawab.inda.com:445/redirect/htTp://www.sun.com:400/sh.html" }, //18
0642: {
0643: "./abc.html",
0644: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/./abc.html" }, //20
0645: { "/abc.html",
0646: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/abc.html" }, //21
0647: {
0648: "../../abc.html",
0649: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/../../abc.html" }, //22
0650: {
0651: "../abc.html",
0652: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/../abc.html" }, //23
0653: {
0654: "../abc.html?turn=true",
0655: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/../abc.html?turn=true" }, //24
0656: {
0657: "./abc.html?turn=true",
0658: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/./abc.html?turn=true" }, //25
0659: {
0660: "htTp://www.sun.com:400/sh.html?roja=ramani",
0661: "https://zeus.nawab.inda.com:445/redirect/htTp://www.sun.com:400/sh.html?roja=ramani" }, //26
0662: {
0663: "./././././abc.html",
0664: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/./././././abc.html" }, //27
0665: {
0666: "./raja/mahesh/.././abc.html",
0667: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/./raja/mahesh/.././abc.html" }, //28
0668: {
0669: "https://zeus.nawab.inda.com:445/http://www.sun.com/abc.html",
0670: "https://zeus.nawab.inda.com:445/http://www.sun.com/abc.html" }, //35
0671: { "http://127.0.0.1", "http://127.0.0.1" }, //37
0672: { "https://127.0.0.1", "https://127.0.0.1" }, //38
0673: { "http://localhost", "http://localhost" }, //39
0674: { "https://localhost", "https://localhost" }, //40
0675: { "htTp://127.0.0.1", "htTp://127.0.0.1" }, //41
0676: { "hTTps://127.0.0.1", "hTTps://127.0.0.1" }, //42
0677: { "http://localHOST", "http://localHOST" }, //43
0678: { "HTTPS://LOCALHOST", "HTTPS://LOCALHOST" }, //44
0679:
0680: {
0681: " ../../../../functions/javascript.js",
0682: " https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/../../../../functions/javascript.js" }, //13
0683: { " http://www.sun.com/abc.html ",
0684: " https://zeus.nawab.inda.com:445/redirect/http://www.sun.com/abc.html " }, //36
0685: {
0686: "abc.html",
0687: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/abc.html" }, //19
0688: { "null",
0689: "https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/null" }, //30 - Bug4627258
0690: { "'null'",
0691: "'https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/Base/Raja/null'" }, //31 - Bug4627258
0692: { "\"/index.html\"",
0693: "\"https://zeus.nawab.inda.com:445/redirect/http://raja.sun.com/index.html\"" }, //29
0694: { " ", " " }, //10
0695: { "", "" }, //11
0696: { " ", " " }, //12
0697: { "\"\"", "\"\"" }, //29
0698: { "\" \t \t \"", "\" \t \t \"" }, //29
0699: { " #raj.index ", " #raj.index " }, //7
0700: { " \"\'#raj.index\'\" ", " \"\'#raj.index\'\" " }, //7
0701: /*{"user:password@./index.html", "user:password@./index.html"}, //33
0702: {"user:password@http://sun.com/index.html", "user:password@http://sun.com/index.html"}, //34*/
0703: };
0704:
0705: String[] gatewayURI = { "https://zeus.nawab.inda.com:445/",
0706: "https://zeus.nawab.inda.com:445", };
0707: String intranetURI = "http://raja.sun.com/Base/Raja/index.html?abc=10&ee=90#raju";
0708:
0709: for (int j = 0; j < gatewayURI.length; j++) {
0710: Translator lSRAPTranslator = SRAPTestSystemFactory
0711: .createSRAPTranslator(gatewayURI[j], intranetURI);
0712: String functionDef = lSRAPTranslator.getJSFunctionSpec()
0713: .getExpressionFunctionDefination(
0714: lSRAPTranslator.getPageSpec());
0715:
0716: for (int i = 0; i < lData.length; i++) {
0717: String result = JScriptInterpreter.exec(functionDef,
0718: lSRAPTranslator.getJSFunctionSpec()
0719: .getExpressionFunctionName(),
0720: new String[] { lData[i][0] });
0721: assertEquals("Failed at i=" + i + result, lData[i][1],
0722: result);
0723: }
0724: }//for j loop
0725: }//testWithPortInGatewayURI()
0726:
0727: public void testFTPBase() throws Exception {
0728: String[][] lData = {
0729: { "index.",
0730: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/index." }, //0
0731: {
0732: "../../index.",
0733: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/../../index." }, //1
0734: { "../",
0735: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/../" }, //2
0736: { "../../",
0737: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/../../" }, //3
0738: { "././",
0739: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/././" }, //4
0740: { "..",
0741: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/.." }, //5
0742: { "../..",
0743: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/../.." }, //6
0744: { "./.",
0745: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/./." }, //7
0746: { "/",
0747: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/" }, //8
0748: { "#raj.index", "#raj.index" }, //9
0749: { " ", " " }, //10
0750: { "", "" }, //11
0751: { " ", " " }, //12
0752: {
0753: " ../../../../functions/javascript.js",
0754: " https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/../../../../functions/javascript.js" }, //13
0755: {
0756: "../../../../functions/javascript.js",
0757: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/../../../../functions/javascript.js" }, //13
0758: {
0759: "../../img/background.jpg",
0760: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/../../img/background.jpg" }, //14
0761: { "./abc.html",
0762: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/./abc.html" }, //20
0763: { "/abc.html",
0764: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/abc.html" }, //21
0765: {
0766: "../../abc.html",
0767: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/../../abc.html" }, //22
0768: { "../abc.html",
0769: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/../abc.html" }, //23
0770: {
0771: "../abc.html?turn=true",
0772: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/../abc.html?turn=true" }, //24
0773: {
0774: "./abc.html?turn=true",
0775: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/./abc.html?turn=true" }, //25
0776: {
0777: "./././././abc.html",
0778: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/./././././abc.html" }, //27
0779: {
0780: "./raja/mahesh/.././abc.html",
0781: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/./raja/mahesh/.././abc.html" }, //28
0782: { "abc.html",
0783: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/abc.html" }, //19
0784: { "null",
0785: "https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/null" }, //30 - Bug4627258
0786: { "\"/index.html\"",
0787: "\"https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/index.html\"" }, //29
0788: { "'null'",
0789: "'https://zeus.nawab.inda.com/redirect/ftp://raja.sun.com/Base/Raja/null'" }, //31 - Bug4627258
0790:
0791: { "ftp://www.sun.com/abc.html",
0792: "ftp://www.sun.com/abc.html" }, //15
0793: { "ftp://www.sun.com/sh.html",
0794: "ftp://www.sun.com/sh.html" }, //16
0795: { "ftp://www.sun.com:78/sh.html",
0796: "ftp://www.sun.com:78/sh.html" }, //17
0797: { "ftp://www.sun.com:400/sh.html",
0798: "ftp://www.sun.com:400/sh.html" }, //18
0799: {
0800: "ftp://zeus.nawab.inda.com/ftp://www.sun.com/abc.html",
0801: "ftp://zeus.nawab.inda.com/ftp://www.sun.com/abc.html" }, //35
0802: { "ftp://www.sun.com:400/sh.html?roja=ramani",
0803: "ftp://www.sun.com:400/sh.html?roja=ramani" }, //26
0804: { "ftp://127.0.0.1", "ftp://127.0.0.1" }, //37
0805: { "ftp://127.0.0.1", "ftp://127.0.0.1" }, //38
0806: { "ftp://localhost", "ftp://localhost" }, //39
0807: { "ftp://localhost", "ftp://localhost" }, //40
0808: { "ftp://127.0.0.1", "ftp://127.0.0.1" }, //41
0809: { "ftp://127.0.0.1", "ftp://127.0.0.1" }, //42
0810: { "ftp://localHOST", "ftp://localHOST" }, //43
0811: { "ftp://LOCALHOST", "ftp://LOCALHOST" }, //44
0812: { "ftp://zeus.nawab.inda.com/index.html",
0813: "ftp://zeus.nawab.inda.com/index.html" },
0814: { "ftp://zeus.nawab.inda.com:443/index.html",
0815: "ftp://zeus.nawab.inda.com:443/index.html" },
0816: { "ftp://zeus.nawab.inda.com:445/index.html",
0817: "ftp://zeus.nawab.inda.com:445/index.html" },
0818: { "ftp://zeus.nawab.inda.com:445/index.html",
0819: "ftp://zeus.nawab.inda.com:445/index.html" },
0820: { "ftp://zeus.nawab.inda.com:445/INDEX.html",
0821: "ftp://zeus.nawab.inda.com:445/INDEX.html" },
0822: { " ftp://www.sun.com/abc.html ",
0823: " ftp://www.sun.com/abc.html " }, //36
0824:
0825: //{"user:password@./index.html", "user:password@./index.html"}, //33
0826: //{"user:password@ftp://sun.com/index.html", "user:password@ftp://sun.com/index.html"}, //34
0827: };
0828:
0829: Translator lSRAPTranslator = SRAPTestSystemFactory
0830: .createSRAPTranslator("https://zeus.nawab.inda.com",
0831: "ftp://raja.sun.com/Base/Raja/index.html?abc=10&ee=90#raju");
0832: String functionDef = lSRAPTranslator.getJSFunctionSpec()
0833: .getExpressionFunctionDefination(
0834: lSRAPTranslator.getPageSpec());
0835:
0836: for (int i = 0; i < lData.length; i++) {
0837: String result = JScriptInterpreter.exec(functionDef,
0838: lSRAPTranslator.getJSFunctionSpec()
0839: .getExpressionFunctionName(),
0840: new String[] { lData[i][0] });
0841: assertEquals("Failed at i=" + i + ":", lData[i][1], result);
0842: }
0843: }//testFTPBase()
0844:
0845: public void testBug4616452() throws Exception {
0846: String[][] fData = {
0847: {
0848: "http://zeus.nawab.inda.com:80",
0849: "http://zeus.nawab.inda.com:443",
0850: "http://zeus.nawab.inda.com/redirect/http://zeus.nawab.inda.com:443", },
0851:
0852: {
0853: "https://zeus.nawab.inda.com:880",
0854: "https://zeus.nawab.inda.com",
0855: "https://zeus.nawab.inda.com:880/redirect/https://zeus.nawab.inda.com", },
0856:
0857: { "https://zeus.nawab.inda.com:880",
0858: "https://zeus.nawab.inda.com:880",
0859: "https://zeus.nawab.inda.com:880", },
0860:
0861: { "https://zeus.nawab.inda.com:443",
0862: "https://zeus.nawab.inda.com:443",
0863: "https://zeus.nawab.inda.com", },
0864:
0865: {
0866: "https://zeus.nawab.inda.com:8080",
0867: "https://zeus.nawab.inda.com:443",
0868: "https://zeus.nawab.inda.com:8080/redirect/https://zeus.nawab.inda.com", },
0869:
0870: {
0871: "http://raja.sun.com:8080",
0872: "/ab.html",
0873: "http://raja.sun.com:8080/redirect/http://raja.sun.com/ab.html", }, };
0874:
0875: for (int i = 0; i < fData.length; i++) {
0876: Translator lSRAPTranslator = SRAPTestSystemFactory
0877: .createSRAPTranslator(fData[i][0],
0878: "http://raja.sun.com/Base/Raja/index.html?abc=10&ee=90#raju");
0879: String functionDef = lSRAPTranslator.getJSFunctionSpec()
0880: .getExpressionFunctionDefination(
0881: lSRAPTranslator.getPageSpec());
0882: String result = JScriptInterpreter.exec(functionDef,
0883: lSRAPTranslator.getJSFunctionSpec()
0884: .getExpressionFunctionName(),
0885: new String[] { fData[i][1] });
0886: assertEquals("Failed at i=" + i + ":", fData[i][2], result);
0887: }
0888: }//testBug4616452()
0889:
0890: public void testBug4627258PassingFuncPointer() throws Exception {
0891: Translator srapTranslator = SRAPTestSystemFactory
0892: .createSRAPTranslator();
0893: String functionDef = srapTranslator.getJSFunctionSpec()
0894: .getExpressionFunctionDefination(
0895: srapTranslator.getPageSpec());
0896:
0897: String testFunctionPointer = "function testFunctionPointer()\n"
0898: + "{\n"
0899: + " return "
0900: + SRAPJSWrapperHelper.CONVERT_EXPRESSION_FUNCTION_WRAP_START
0901: + " psSplit );\n" + "}\n";
0902:
0903: try {
0904: String result = JScriptInterpreter.execObject(
0905: testFunctionPointer + functionDef,
0906: "testFunctionPointer", new String[0], Object.class)
0907: .toString();
0908: assertEquals("org.mozilla.javascript.gen.", result
0909: .substring(0, "org.mozilla.javascript.gen."
0910: .length()));
0911: } catch (Exception e) {
0912: fail("convertFunction Should rewrite only Strings and Not function pointers etc..");
0913: }
0914: }//testBug4627258PassingFuncPointer()
0915:
0916: public void testReverseProxyWithSessionIDForMapJS()
0917: throws Exception {
0918: //2nd param is not used as all ftp are not rewriten..
0919: String[][] lData = {
0920: {
0921: "https://zeuS.nawab.inda.COM/ABCDE/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://abc.com/index.html",
0922: "https://zeuS.nawab.inda.COM/ABCDE/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://abc.com/index.html" },
0923: {
0924: "https://zeuS.nawab.inda.COM/ABCDE/LDXIEWOUUOIWUOIREWSEssionID/",
0925: "https://zeuS.nawab.inda.COM/ABCDE/LDXIEWOUUOIWUOIREWSEssionID/" },
0926: {
0927: "https://zeus.nawab.INda.com/LDXIEWOUUOIWUOIREWSEssionID/",
0928: "https://zeus.nawab.INda.com/LDXIEWOUUOIWUOIREWSEssionID/" },
0929: {
0930: "https://zeuS.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID",
0931: "https://zeuS.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID" },
0932: {
0933: "https://zeus.nawab.inda.com:443/LDXIEWOUUOIWUOIREWSEssionID/",
0934: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/" },
0935: {
0936: "https://zeus.NAWAB.inda.com/ABCDE/LDXIEWOUUOIWUOIREWSEssionID/",
0937: "https://zeus.NAWAB.inda.com/ABCDE/LDXIEWOUUOIWUOIREWSEssionID/" },
0938: {
0939: "htTPs://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/",
0940: "htTPs://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/" },
0941: {
0942: "httpS://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID",
0943: "httpS://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID" },
0944: {
0945: "HTTPS://zeus.naWAB.inda.com:443/LDXIEWOUUOIWUOIREWSEssionID/",
0946: "HTTPS://zeus.naWAB.inda.com/LDXIEWOUUOIWUOIREWSEssionID/" },
0947: {
0948: "index.",
0949: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/index." }, //0
0950: {
0951: "../../index.",
0952: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/../../index." }, //1
0953: {
0954: "../",
0955: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/../" }, //2
0956: {
0957: "../../",
0958: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/../../" }, //3
0959: {
0960: "././",
0961: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/././" }, //4
0962: {
0963: "..",
0964: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/.." }, //5
0965: {
0966: "../..",
0967: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/../.." }, //6
0968: {
0969: "./.",
0970: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/./." }, //7
0971: {
0972: "/",
0973: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/" }, //8
0974: { "#raj.index", "#raj.index" }, //9
0975: {
0976: "../../../../functions/javascript.js",
0977: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/../../../../functions/javascript.js" }, //13
0978: {
0979: "../../img/background.jpg",
0980: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/../../img/background.jpg" }, //14
0981: {
0982: "http://www.sun.com/abc.html",
0983: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://www.sun.com/abc.html" }, //15
0984: {
0985: "http://www.sun.com/sh.html",
0986: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://www.sun.com/sh.html" }, //16
0987: {
0988: "http://www.sun.com:78/sh.html",
0989: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://www.sun.com:78/sh.html" }, //17
0990: {
0991: "http://www.sun.com:400/sh.html",
0992: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://www.sun.com:400/sh.html" }, //18
0993: {
0994: "abc.html",
0995: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/abc.html" }, //19
0996: {
0997: "./abc.html",
0998: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/./abc.html" }, //20
0999: {
1000: "/abc.html",
1001: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/abc.html" }, //21
1002: {
1003: "../../abc.html",
1004: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/../../abc.html" }, //22
1005: {
1006: "../abc.html",
1007: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/../abc.html" }, //23
1008: {
1009: "../abc.html?turn=true",
1010: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/../abc.html?turn=true" }, //24
1011: {
1012: "./abc.html?turn=true",
1013: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/./abc.html?turn=true" }, //25
1014: {
1015: "http://www.sun.com:400/sh.html?roja=ramani",
1016: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://www.sun.com:400/sh.html?roja=ramani" }, //26
1017: {
1018: "./././././abc.html",
1019: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/./././././abc.html" }, //27
1020: {
1021: "./raja/mahesh/.././abc.html",
1022: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/./raja/mahesh/.././abc.html" }, //28
1023: {
1024: "null",
1025: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/null" }, //30 - Bug4627258
1026: {
1027: "http://zeus.nawab.inda.com/http://www.sun.com/abc.html",
1028: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://zeus.nawab.inda.com/http://www.sun.com/abc.html" }, //35
1029: { "http://127.0.0.1", "http://127.0.0.1" }, //37
1030: { "https://127.0.0.1/", "https://127.0.0.1/" }, //38
1031: { "http://localhost", "http://localhost" }, //39
1032: { "hTTPs://localhost", "hTTPs://localhost" }, //40
1033: { "http://127.0.0.1", "http://127.0.0.1" }, //41
1034: { "hTTp://127.0.0.1", "hTTp://127.0.0.1" }, //42
1035: { "http://localHOST/", "http://localHOST/" }, //43
1036: { "http://LOCALHOST", "http://LOCALHOST" }, //44
1037: {
1038: "http://zeus.nawab.inda.com/index.html",
1039: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://zeus.nawab.inda.com/index.html" },
1040: {
1041: "http://zeus.nawab.inda.com:443/index.html",
1042: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://zeus.nawab.inda.com:443/index.html" },
1043: {
1044: "http://zeus.nawab.inda.com:445/index.html",
1045: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://zeus.nawab.inda.com:445/index.html" },
1046: {
1047: "http://zeus.nawab.inda.com:445/index.html",
1048: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://zeus.nawab.inda.com:445/index.html" },
1049: {
1050: "http://zeus.nawab.inda.com:445/INDEX.html",
1051: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://zeus.nawab.inda.com:445/INDEX.html" },
1052: { " ", " " }, //10
1053: { "", "" }, //11
1054: { " ", " " }, //12
1055: //{"user:password@./index.html", "user:password@./index.html"}, //33
1056: //{"user:password@http://sun.com/index.html", "user:password@http://sun.com/index.html"}, //34
1057: };
1058:
1059: String[] bGatewayURI = {
1060: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/",
1061: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID",
1062: "https://zeus.nawab.inda.com:443/LDXIEWOUUOIWUOIREWSEssionID/" };
1063:
1064: for (int j = 0; j < bGatewayURI.length; j++) {
1065: Translator lSRAPTranslator = SRAPTestSystemFactory
1066: .createSRAPTranslator(bGatewayURI[j],
1067: "http://raja.sun.com/Base/Raja/raja.html?name=raja");
1068: String functionDef = lSRAPTranslator.getJSFunctionSpec()
1069: .getExpressionFunctionDefination(
1070: lSRAPTranslator.getPageSpec());
1071:
1072: for (int i = 0; i < lData.length; i++) {
1073: String result = JScriptInterpreter.exec(functionDef,
1074: lSRAPTranslator.getJSFunctionSpec()
1075: .getExpressionFunctionName(),
1076: new String[] { lData[i][0] });
1077: assertEquals("Failed at i=" + i + ":", lData[i][1],
1078: result);
1079:
1080: //send it second time and see if the value remains the same
1081: result = JScriptInterpreter.exec(functionDef,
1082: lSRAPTranslator.getJSFunctionSpec()
1083: .getExpressionFunctionName(),
1084: new String[] { result });
1085: assertEquals("Failed at i=" + i + ":", lData[i][1],
1086: result);
1087: }
1088: }
1089:
1090: {
1091: String[][] lSpecial = {
1092: {
1093: "'null'",
1094: "'https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/null'", //31 - Bug4627258
1095: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/null" }, //31 - Bug4627258
1096:
1097: {
1098: " http://www.sun.com/abc.html ",
1099: " https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://www.sun.com/abc.html ", //36
1100: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://www.sun.com/abc.html" }, //36
1101:
1102: {
1103: " ../../../../functions/javascript.js",
1104: " https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/../../../../functions/javascript.js", //13
1105: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/Base/Raja/../../../../functions/javascript.js" }, //13
1106: {
1107: "\"/index.html\"",
1108: "\"https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/index.html\"", //29
1109: "https://zeus.nawab.inda.com/LDXIEWOUUOIWUOIREWSEssionID/redirect/http://raja.sun.com/index.html" }, //29
1110: };
1111:
1112: for (int j = 0; j < bGatewayURI.length; j++) {
1113: Translator lSRAPTranslator = SRAPTestSystemFactory
1114: .createSRAPTranslator(bGatewayURI[j],
1115: "http://raja.sun.com/Base/Raja/raja.html?name=raja");
1116: String functionDef = lSRAPTranslator
1117: .getJSFunctionSpec()
1118: .getExpressionFunctionDefination(
1119: lSRAPTranslator.getPageSpec());
1120:
1121: for (int i = 0; i < lSpecial.length; i++) {
1122: String result = JScriptInterpreter.exec(
1123: functionDef, lSRAPTranslator
1124: .getJSFunctionSpec()
1125: .getExpressionFunctionName(),
1126: new String[] { lSpecial[i][0] });
1127: assertEquals("Failed at i=" + i + ":",
1128: lSpecial[i][1], result);
1129:
1130: //send it second time and see if the value remains the same
1131: result = JScriptInterpreter.exec(functionDef,
1132: lSRAPTranslator.getJSFunctionSpec()
1133: .getExpressionFunctionName(),
1134: new String[] { result });
1135: assertEquals("Special Failed at i=" + i + ":",
1136: lSpecial[i][2], result);
1137: }
1138: }
1139: }
1140: }//testReverseProxyWithSessionIDForMapJS()
1141:
1142: public void testSRAPGlobolVarEscNo10311588() throws Exception {
1143: Translator srapTranslator = SRAPTestSystemFactory
1144: .createSRAPTranslator();
1145:
1146: String functionDef = "var i=20000;"
1147: + "var j=40000;"
1148: + srapTranslator.getJSFunctionSpec()
1149: .getExpressionFunctionDefination(
1150: srapTranslator.getPageSpec())
1151: + "\nfunction readVar(aURI)"
1152: + "\n{\n"
1153: + SRAPJSWrapperHelper.CONVERT_EXPRESSION_FUNCTION_WRAP_START
1154: + "aURI);\n" + "return i+j;\n" + "}\n";
1155:
1156: Integer result = (Integer) JScriptInterpreter.execObject(
1157: functionDef, "readVar", new String[] { "raja.html" },
1158: Integer.class);
1159: assertEquals(
1160: "If a Gobal Variable i or j is declared, then converfunction is chageing this gobol var",
1161: 60000, result.intValue());
1162: }//testSRAPGlobolVarEscNo10311588()
1163:
1164: public static void main(String[] args) {
1165: //BasicTestCase.run( new TestSuite( TestSRAPJSConvertExpressionFunction.class ) );
1166: TestSuite testSuite = new TestSuite();
1167: testSuite.addTest(new TestSRAPJSConvertExpressionFunction(
1168: "testReverseProxyWithSessionIDForMapJS"));
1169: BasicTestCase.run(testSuite);
1170: }//main()
1171: }//class TestSRAPJSConvertExpressionFunction
|