Source Code Cross Referenced for TestData.java in  » Internationalization-Localization » icu4j » com » ibm » icu » dev » test » stringprep » 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 » Internationalization Localization » icu4j » com.ibm.icu.dev.test.stringprep 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *******************************************************************************
003:         * Copyright (C) 2003-2006, International Business Machines Corporation and    *
004:         * others. All Rights Reserved.                                                *
005:         *******************************************************************************
006:         */
007:        package com.ibm.icu.dev.test.stringprep;
008:
009:        import com.ibm.icu.text.IDNA;
010:        import com.ibm.icu.text.StringPrepParseException;
011:
012:        /**
013:         * @author ram
014:         *
015:         * To change the template for this generated type comment go to
016:         * Window>Preferences>Java>Code Generation>Code and Comments
017:         */
018:        public class TestData {
019:            public static final char[][] unicodeIn = {
020:                    { 0x0644, 0x064A, 0x0647, 0x0645, 0x0627, 0x0628, 0x062A,
021:                            0x0643, 0x0644, 0x0645, 0x0648, 0x0634, 0x0639,
022:                            0x0631, 0x0628, 0x064A, 0x061F },
023:                    { 0x4ED6, 0x4EEC, 0x4E3A, 0x4EC0, 0x4E48, 0x4E0D, 0x8BF4,
024:                            0x4E2D, 0x6587,
025:
026:                    },
027:                    { 0x0050, 0x0072, 0x006F, 0x010D, 0x0070, 0x0072, 0x006F,
028:                            0x0073, 0x0074, 0x011B, 0x006E, 0x0065, 0x006D,
029:                            0x006C, 0x0075, 0x0076, 0x00ED, 0x010D, 0x0065,
030:                            0x0073, 0x006B, 0x0079, },
031:                    { 0x05DC, 0x05DE, 0x05D4, 0x05D4, 0x05DD, 0x05E4, 0x05E9,
032:                            0x05D5, 0x05D8, 0x05DC, 0x05D0, 0x05DE, 0x05D3,
033:                            0x05D1, 0x05E8, 0x05D9, 0x05DD, 0x05E2, 0x05D1,
034:                            0x05E8, 0x05D9, 0x05EA, },
035:                    { 0x092F, 0x0939, 0x0932, 0x094B, 0x0917, 0x0939, 0x093F,
036:                            0x0928, 0x094D, 0x0926, 0x0940, 0x0915, 0x094D,
037:                            0x092F, 0x094B, 0x0902, 0x0928, 0x0939, 0x0940,
038:                            0x0902, 0x092C, 0x094B, 0x0932, 0x0938, 0x0915,
039:                            0x0924, 0x0947, 0x0939, 0x0948, 0x0902, },
040:                    { 0x306A, 0x305C, 0x307F, 0x3093, 0x306A, 0x65E5, 0x672C,
041:                            0x8A9E, 0x3092, 0x8A71, 0x3057, 0x3066, 0x304F,
042:                            0x308C, 0x306A, 0x3044, 0x306E, 0x304B,
043:
044:                    },
045:                    /*  
046:                        {
047:                            0xC138, 0xACC4, 0xC758, 0xBAA8, 0xB4E0, 0xC0AC, 0xB78C, 0xB4E4, 0xC774,
048:                            0xD55C, 0xAD6D, 0xC5B4, 0xB97C, 0xC774, 0xD574, 0xD55C, 0xB2E4, 0xBA74,
049:                            0xC5BC, 0xB9C8, 0xB098, 0xC88B, 0xC744, 0xAE4C,
050:                        },
051:                     */
052:                    { 0x043F, 0x043E, 0x0447, 0x0435, 0x043C, 0x0443, 0x0436,
053:                            0x0435, 0x043E, 0x043D, 0x0438, 0x043D, 0x0435,
054:                            0x0433, 0x043E, 0x0432, 0x043E, 0x0440, 0x044F,
055:                            0x0442, 0x043F, 0x043E, 0x0440, 0x0443, 0x0441,
056:                            0x0441, 0x043A, 0x0438, },
057:                    { 0x0050, 0x006F, 0x0072, 0x0071, 0x0075, 0x00E9, 0x006E,
058:                            0x006F, 0x0070, 0x0075, 0x0065, 0x0064, 0x0065,
059:                            0x006E, 0x0073, 0x0069, 0x006D, 0x0070, 0x006C,
060:                            0x0065, 0x006D, 0x0065, 0x006E, 0x0074, 0x0065,
061:                            0x0068, 0x0061, 0x0062, 0x006C, 0x0061, 0x0072,
062:                            0x0065, 0x006E, 0x0045, 0x0073, 0x0070, 0x0061,
063:                            0x00F1, 0x006F, 0x006C, },
064:                    { 0x4ED6, 0x5011, 0x7232, 0x4EC0, 0x9EBD, 0x4E0D, 0x8AAA,
065:                            0x4E2D, 0x6587,
066:
067:                    },
068:                    { 0x0054, 0x1EA1, 0x0069, 0x0073, 0x0061, 0x006F, 0x0068,
069:                            0x1ECD, 0x006B, 0x0068, 0x00F4, 0x006E, 0x0067,
070:                            0x0074, 0x0068, 0x1EC3, 0x0063, 0x0068, 0x1EC9,
071:                            0x006E, 0x00F3, 0x0069, 0x0074, 0x0069, 0x1EBF,
072:                            0x006E, 0x0067, 0x0056, 0x0069, 0x1EC7, 0x0074, },
073:                    { 0x0033, 0x5E74, 0x0042, 0x7D44, 0x91D1, 0x516B, 0x5148,
074:                            0x751F, },
075:                    { 0x5B89, 0x5BA4, 0x5948, 0x7F8E, 0x6075, 0x002D, 0x0077,
076:                            0x0069, 0x0074, 0x0068, 0x002D, 0x0053, 0x0055,
077:                            0x0050, 0x0045, 0x0052, 0x002D, 0x004D, 0x004F,
078:                            0x004E, 0x004B, 0x0045, 0x0059, 0x0053, },
079:                    { 0x0048, 0x0065, 0x006C, 0x006C, 0x006F, 0x002D, 0x0041,
080:                            0x006E, 0x006F, 0x0074, 0x0068, 0x0065, 0x0072,
081:                            0x002D, 0x0057, 0x0061, 0x0079, 0x002D, 0x305D,
082:                            0x308C, 0x305E, 0x308C, 0x306E, 0x5834, 0x6240, },
083:                    { 0x3072, 0x3068, 0x3064, 0x5C4B, 0x6839, 0x306E, 0x4E0B,
084:                            0x0032, },
085:                    { 0x004D, 0x0061, 0x006A, 0x0069, 0x3067, 0x004B, 0x006F,
086:                            0x0069, 0x3059, 0x308B, 0x0035, 0x79D2, 0x524D, },
087:                    { 0x30D1, 0x30D5, 0x30A3, 0x30FC, 0x0064, 0x0065, 0x30EB,
088:                            0x30F3, 0x30D0,
089:
090:                    },
091:                    { 0x305D, 0x306E, 0x30B9, 0x30D4, 0x30FC, 0x30C9, 0x3067, },
092:                    // test non-BMP code points
093:                    { 0xD800, 0xDF00, 0xD800, 0xDF01, 0xD800, 0xDF02, 0xD800,
094:                            0xDF03, 0xD800, 0xDF05, 0xD800, 0xDF06, 0xD800,
095:                            0xDF07, 0xD800, 0xDF09, 0xD800, 0xDF0A, 0xD800,
096:                            0xDF0B,
097:
098:                    },
099:                    { 0xD800, 0xDF0D, 0xD800, 0xDF0C, 0xD800, 0xDF1E, 0xD800,
100:                            0xDF0F, 0xD800, 0xDF16, 0xD800, 0xDF15, 0xD800,
101:                            0xDF14, 0xD800, 0xDF12, 0xD800, 0xDF10, 0xD800,
102:                            0xDF20, 0xD800, 0xDF21,
103:
104:                    },
105:                    // Greek
106:                    { 0x03b5, 0x03bb, 0x03bb, 0x03b7, 0x03bd, 0x03b9, 0x03ba,
107:                            0x03ac },
108:                    // Maltese
109:                    { 0x0062, 0x006f, 0x006e, 0x0121, 0x0075, 0x0073, 0x0061,
110:                            0x0127, 0x0127, 0x0061 },
111:                    // Russian
112:                    { 0x043f, 0x043e, 0x0447, 0x0435, 0x043c, 0x0443, 0x0436,
113:                            0x0435, 0x043e, 0x043d, 0x0438, 0x043d, 0x0435,
114:                            0x0433, 0x043e, 0x0432, 0x043e, 0x0440, 0x044f,
115:                            0x0442, 0x043f, 0x043e, 0x0440, 0x0443, 0x0441,
116:                            0x0441, 0x043a, 0x0438 },
117:
118:            };
119:
120:            public static final String[] asciiIn = {
121:                    "xn--egbpdaj6bu4bxfgehfvwxn",
122:                    "xn--ihqwcrb4cv8a8dqg056pqjye",
123:                    "xn--Proprostnemluvesky-uyb24dma41a",
124:                    "xn--4dbcagdahymbxekheh6e0a7fei0b",
125:                    "xn--i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd",
126:                    "xn--n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa",
127:                    /*  "xn--989aomsvi5e83db1d2a355cv1e0vak1dwrv93d5xbh15a0dt30a5jpsd879ccm6fea98c",*/
128:                    "xn--b1abfaaepdrnnbgefbaDotcwatmq2g4l",
129:                    "xn--PorqunopuedensimplementehablarenEspaol-fmd56a",
130:                    "xn--ihqwctvzc91f659drss3x8bo0yb",
131:                    "xn--TisaohkhngthchnitingVit-kjcr8268qyxafd2f1b9g",
132:                    "xn--3B-ww4c5e180e575a65lsy2b",
133:                    "xn---with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n",
134:                    "xn--Hello-Another-Way--fc4qua05auwb3674vfr0b",
135:                    "xn--2-u9tlzr9756bt3uc0v",
136:                    "xn--MajiKoi5-783gue6qz075azm5e", "xn--de-jg4avhby1noc0d",
137:                    "xn--d9juau41awczczp", "XN--097CCDEKGHQJK",
138:                    "XN--db8CBHEJLGH4E0AL", "xn--hxargifdar", // Greek
139:                    "xn--bonusaa-5bb1da", // Maltese
140:                    "xn--b1abfaaepdrnnbgefbadotcwatmq2g4l", // Russian (Cyrillic)
141:            };
142:
143:            public static final String[] domainNames = {
144:                    "slip129-37-118-146.nc.us.ibm.net",
145:                    "saratoga.pe.utexas.edu", "dial-120-45.ots.utexas.edu",
146:                    "woo-085.dorms.waller.net", "hd30-049.hil.compuserve.com",
147:                    "pem203-31.pe.ttu.edu", "56K-227.MaxTNT3.pdq.net",
148:                    "dial-36-2.ots.utexas.edu",
149:                    "slip129-37-23-152.ga.us.ibm.net",
150:                    "ts45ip119.cadvision.com",
151:                    "sdn-ts-004txaustP05.dialsprint.net",
152:                    "bar-tnt1s66.erols.com",
153:                    "101.st-louis-15.mo.dial-access.att.net",
154:                    "h92-245.Arco.COM", "dial-13-2.ots.utexas.edu",
155:                    "net-redynet29.datamarkets.com.ar",
156:                    "ccs-shiva28.reacciun.net.ve",
157:                    "7.houston-11.tx.dial-access.att.net",
158:                    "ingw129-37-120-26.mo.us.ibm.net", "dialup6.austintx.com",
159:                    "dns2.tpao.gov.tr", "slip129-37-119-194.nc.us.ibm.net",
160:                    "cs7.dillons.co.uk.203.119.193.in-addr.arpa",
161:                    "swprd1.innovplace.saskatoon.sk.ca",
162:                    "bikini.bologna.maraut.it",
163:                    "node91.subnet159-198-79.baxter.com",
164:                    "cust19.max5.new-york.ny.ms.uu.net",
165:                    "balexander.slip.andrew.cmu.edu",
166:                    "pool029.max2.denver.co.dynip.alter.net",
167:                    "cust49.max9.new-york.ny.ms.uu.net",
168:                    "s61.abq-dialin2.hollyberry.com",
169:
170:            };
171:
172:            public static final String[] domainNames1Uni = {
173:                    "\u0917\u0928\u0947\u0936.sanjose.ibm.com",
174:                    "www.\u0121.com",
175:                    //"www.\u00E0\u00B3\u00AF.com",
176:                    "www.\u00C2\u00A4.com", "www.\u00C2\u00A3.com",
177:                    // "\\u0025", //'%' (0x0025) produces U_IDNA_STD3_ASCII_RULES_ERROR
178:                    // "\\u005C\\u005C", //'\' (0x005C) produces U_IDNA_STD3_ASCII_RULES_ERROR
179:                    //"@",
180:                    //"\\u002F",
181:                    //"www.\\u0021.com",
182:                    //"www.\\u0024.com",
183:                    //"\\u003f",
184:                    // These yeild U_IDNA_PROHIBITED_ERROR
185:                    //"\\u00CF\\u0082.com",
186:                    //"\\u00CE\\u00B2\\u00C3\\u009Fss.com",
187:                    //"\\u00E2\\u0098\\u00BA.com",
188:                    "\u00C3\u00BC.com" };
189:            public static final String[] domainNamesToASCIIOut = {
190:                    "xn--31b8a2bwd.sanjose.ibm.com", "www.xn--vea.com",
191:                    //"www.xn--3 -iia80t.com",
192:                    "www.xn--bba7j.com", "www.xn--9a9j.com",
193:                    // "\u0025",
194:                    // "\u005C\u005C",
195:                    // "@",
196:                    // "\u002F",
197:                    // "www.\u0021.com",
198:                    // "www.\u0024.com",
199:                    // "\u003f",
200:                    "xn--14-ria7423a.com"
201:
202:            };
203:
204:            public static final String[] domainNamesToUnicodeOut = {
205:                    "\u0917\u0928\u0947\u0936.sanjose.ibm.com",
206:                    "www.\u0121.com",
207:                    //"www.\u00E0\u0033\u0020\u0304.com",
208:                    "www.\u00E2\u00A4.com", "www.\u00E2\u00A3.com",
209:                    // "\u0025",
210:                    // "\u005C\u005C",
211:                    // "@",
212:                    // "\u002F",
213:                    // "www.\u0021.com",
214:                    // "www.\u0024.com",
215:                    // "\u003f",
216:                    "\u00E3\u0031\u2044\u0034.com"
217:
218:            };
219:
220:            public static class ErrorCase {
221:
222:                public char[] unicode;
223:                public String ascii;
224:                public Exception expected;
225:                public boolean useSTD3ASCIIRules;
226:                public boolean testToUnicode;
227:                public boolean testLabel;
228:
229:                ErrorCase(char[] uniIn, String asciiIn, Exception ex,
230:                        boolean std3, boolean testToUni, boolean testlabel) {
231:                    unicode = uniIn;
232:                    ascii = asciiIn;
233:                    expected = ex;
234:                    useSTD3ASCIIRules = std3;
235:                    testToUnicode = testToUni;
236:                    testLabel = testlabel;
237:
238:                }
239:            }
240:
241:            public static final ErrorCase[] errorCases = {
242:
243:                    new ErrorCase(
244:                            new char[] { 0x0077, 0x0077, 0x0077, 0x002e, /* www. */
245:                            0xC138, 0xACC4, 0xC758, 0xBAA8, 0xB4E0, 0xC0AC,
246:                                    0xB78C, 0xB4E4, 0xC774, 0x070F,/*prohibited*/
247:                                    0xD55C, 0xAD6D, 0xC5B4, 0xB97C, 0xC774,
248:                                    0xD574, 0xD55C, 0xB2E4, 0xBA74, 0x002e,
249:                                    0x0063, 0x006f, 0x006d, /* com. */
250:
251:                            },
252:                            "www.xn--8mb5595fsoa28orucya378bqre2tcwop06c5qbw82a1rffmae0361dea96b.com",
253:                            new StringPrepParseException("",
254:                                    StringPrepParseException.PROHIBITED_ERROR),
255:                            false, true, true),
256:
257:                    new ErrorCase(new char[] { 0x0077, 0x0077, 0x0077, 0x002e, /* www. */
258:                    0xC138, 0xACC4, 0xC758, 0xBAA8, 0xB4E0, 0xC0AC, 0xB78C,
259:                            0xB4E4, 0xC774, 0x0221,
260:                            0x0234/*Unassigned code points*/, 0x002e, 0x0063,
261:                            0x006f, 0x006d, /* com. */
262:
263:                    }, "www.xn--6la2bz548fj1gua391bf1gb1n59ab29a7ia.com",
264:
265:                    new StringPrepParseException("",
266:                            StringPrepParseException.UNASSIGNED_ERROR), false,
267:                            true, true),
268:                    new ErrorCase(
269:                            new char[] { 0x0077, 0x0077, 0x0077, 0x002e, /* www. */
270:                            0xC138, 0xACC4, 0xC758, 0xBAA8, 0xB4E0, 0xC0AC,
271:                                    0xB78C, 0xB4E4, 0xC774, 0x0644, 0x064A,
272:                                    0x0647,/*Arabic code points. Cannot mix RTL with LTR*/
273:                                    0xD55C, 0xAD6D, 0xC5B4, 0xB97C, 0xC774,
274:                                    0xD574, 0xD55C, 0xB2E4, 0xBA74, 0x002e,
275:                                    0x0063, 0x006f, 0x006d, /* com. */
276:
277:                            },
278:                            "www.xn--ghBGI4851OiyA33VqrD6Az86C4qF83CtRv93D5xBk15AzfG0nAgA0578DeA71C.com",
279:                            new StringPrepParseException("",
280:                                    StringPrepParseException.CHECK_BIDI_ERROR),
281:                            false, true, true),
282:                    new ErrorCase(
283:                            new char[] { 0x0077, 0x0077, 0x0077, 0x002e, /* www. */
284:                            /* labels cannot begin with an HYPHEN */
285:                            0x002D, 0xACC4, 0xC758, 0xBAA8, 0xB4E0, 0xC0AC,
286:                                    0xB78C, 0xB4E4, 0xC774, 0x002E, 0xD55C,
287:                                    0xAD6D, 0xC5B4, 0xB97C, 0xC774, 0xD574,
288:                                    0xD55C, 0xB2E4, 0xBA74, 0x002e, 0x0063,
289:                                    0x006f, 0x006d, /* com. */
290:
291:                            },
292:                            "www.xn----b95Ew8SqA315Ao5FbuMlnNmhA.com",
293:                            new StringPrepParseException(
294:                                    "",
295:                                    StringPrepParseException.STD3_ASCII_RULES_ERROR),
296:                            true, true, false),
297:                    new ErrorCase(
298:                            new char[] {
299:                            /* correct ACE-prefix followed by unicode */
300:                            0x0077, 0x0077, 0x0077, 0x002e, /* www. */
301:                            0x0078, 0x006e, 0x002d, 0x002d, /* ACE Prefix */
302:                            0x002D, 0xACC4, 0xC758, 0xBAA8, 0xB4E0, 0xC0AC,
303:                                    0xB78C, 0xB4E4, 0xC774, 0x002D, 0xD55C,
304:                                    0xAD6D, 0xC5B4, 0xB97C, 0xC774, 0xD574,
305:                                    0xD55C, 0xB2E4, 0xBA74, 0x002e, 0x0063,
306:                                    0x006f, 0x006d, /* com. */
307:
308:                            },
309:                            /* wrong ACE-prefix followed by valid ACE-encoded ASCII */
310:                            "www.XY-----b91I0V65S96C2A355Cw1E5yCeQr19CsnP1mFfmAE0361DeA96B.com",
311:                            new StringPrepParseException("",
312:                                    StringPrepParseException.ACE_PREFIX_ERROR),
313:                            false, false, false),
314:                    /* cannot verify U_IDNA_VERIFICATION_ERROR */
315:
316:                    new ErrorCase(
317:                            new char[] { 0x0077, 0x0077, 0x0077, 0x002e, /* www. */
318:                            0xC138, 0xACC4, 0xC758, 0xBAA8, 0xB4E0, 0xC0AC,
319:                                    0xB78C, 0xB4E4, 0xC774, 0xD55C, 0xAD6D,
320:                                    0xC5B4, 0xB97C, 0xC774, 0xD574, 0xD55C,
321:                                    0xB2E4, 0xBA74, 0xC5BC, 0xB9C8, 0xB098,
322:                                    0xC88B, 0xC744, 0xAE4C, 0x002e, 0x0063,
323:                                    0x006f, 0x006d, /* com. */
324:
325:                            },
326:                            "www.xn--989AoMsVi5E83Db1D2A355Cv1E0vAk1DwRv93D5xBh15A0Dt30A5JpSD879Ccm6FeA98C.com",
327:                            new StringPrepParseException(
328:                                    "",
329:                                    StringPrepParseException.LABEL_TOO_LONG_ERROR),
330:                            false, true, true),
331:                    new ErrorCase(new char[] { 0x0077, 0x0077, 0x0077, 0x002e, /* www. */
332:                    0x0030, 0x0644, 0x064A, 0x0647, 0x0031, /* Arabic code points squashed between EN codepoints */
333:                    0x002e, 0x0063, 0x006f, 0x006d, /* com. */
334:
335:                    }, "www.xn--01-tvdmo.com", new StringPrepParseException("",
336:                            StringPrepParseException.CHECK_BIDI_ERROR), false,
337:                            true, true),
338:
339:                    new ErrorCase(new char[] { 0x0077, 0x0077, 0x0077, 0x002e, // www. 
340:                            0x206C, 0x0644, 0x064A, 0x0647, 0x206D, // Arabic code points squashed between BN codepoints 
341:                            0x002e, 0x0063, 0x006f, 0x006d, // com. 
342:
343:                    }, "www.XN--ghbgi278xia.com", new StringPrepParseException(
344:                            "", StringPrepParseException.PROHIBITED_ERROR),
345:                            false, true, true),
346:                    new ErrorCase(new char[] { 0x0077, 0x0077, 0x0077, 0x002e, // www. 
347:                            0x002D, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, // HYPHEN at the start of label 
348:                            0x002e, 0x0063, 0x006f, 0x006d, // com. 
349:
350:                    }, "www.-abcde.com", new StringPrepParseException("",
351:                            StringPrepParseException.STD3_ASCII_RULES_ERROR),
352:                            true, true, false),
353:                    new ErrorCase(new char[] { 0x0077, 0x0077, 0x0077, 0x002e, // www. 
354:                            0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x002D, // HYPHEN at the end of the label
355:                            0x002e, 0x0063, 0x006f, 0x006d, // com. 
356:
357:                    }, "www.abcde-.com", new StringPrepParseException("",
358:                            StringPrepParseException.STD3_ASCII_RULES_ERROR),
359:                            true, true, false),
360:                    new ErrorCase(new char[] { 0x0077, 0x0077, 0x0077, 0x002e, // www. 
361:                            0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0040, // Containing non LDH code point
362:                            0x002e, 0x0063, 0x006f, 0x006d, // com. 
363:
364:                    }, "www.abcde@.com", new StringPrepParseException("",
365:                            StringPrepParseException.STD3_ASCII_RULES_ERROR),
366:                            true, true, false),
367:                    new ErrorCase(new char[] { 0x0077, 0x0077, 0x0077, 0x002e, // www. 
368:                            // zero length label
369:                            0x002e, 0x0063, 0x006f, 0x006d, // com. 
370:                    }, "www..com", new StringPrepParseException("",
371:                            StringPrepParseException.ZERO_LENGTH_LABEL), true,
372:                            true, false), };
373:
374:            public static final class ConformanceTestCase {
375:                String comment;
376:                String input;
377:                String output;
378:                String profile;
379:                int flags;
380:                Exception expected;
381:
382:                private static byte[] getBytes(String in) {
383:                    if (in == null) {
384:                        return null;
385:                    }
386:                    byte[] bytes = new byte[in.length()];
387:                    for (int i = 0; i < in.length(); i++) {
388:                        bytes[i] = (byte) in.charAt(i);
389:                    }
390:                    return bytes;
391:                }
392:
393:                ConformanceTestCase(String comt, String in, String out,
394:                        String prof, int flg, Exception ex) {
395:
396:                    try {
397:                        comment = comt;
398:                        byte[] bytes = getBytes(in);
399:                        input = new String(bytes, "UTF-8");
400:                        bytes = getBytes(out);
401:                        output = (bytes == null) ? null : new String(bytes,
402:                                "UTF-8");
403:                        profile = prof;
404:                        flags = flg;
405:                        expected = ex;
406:                    } catch (Exception e) {
407:                        e.printStackTrace();
408:                        throw new RuntimeException();
409:                    }
410:                }
411:            }
412:
413:            public static final ConformanceTestCase[] conformanceTestCases = {
414:
415:                    new ConformanceTestCase(
416:                            "Case folding ASCII U+0043 U+0041 U+0046 U+0045",
417:                            "\u0043\u0041\u0046\u0045",
418:                            "\u0063\u0061\u0066\u0065", "Nameprep",
419:                            IDNA.DEFAULT, null
420:
421:                    ),
422:                    new ConformanceTestCase(
423:                            "Case folding 8bit U+00DF (german sharp s)",
424:                            "\u00C3\u009F", "\u0073\u0073", "Nameprep",
425:                            IDNA.DEFAULT, null),
426:                    new ConformanceTestCase(
427:                            "Non-ASCII multibyte space character U+1680",
428:                            "\u00E1\u009A\u0080", null, "Nameprep",
429:                            IDNA.DEFAULT, new StringPrepParseException("",
430:                                    StringPrepParseException.PROHIBITED_ERROR)),
431:                    new ConformanceTestCase(
432:                            "Non-ASCII 8bit control character U+0085",
433:                            "\u00C2\u0085", null, "Nameprep", IDNA.DEFAULT,
434:                            new StringPrepParseException("",
435:                                    StringPrepParseException.PROHIBITED_ERROR)),
436:                    new ConformanceTestCase(
437:                            "Non-ASCII multibyte control character U+180E",
438:                            "\u00E1\u00A0\u008E", null, "Nameprep",
439:                            IDNA.DEFAULT, new StringPrepParseException("",
440:                                    StringPrepParseException.PROHIBITED_ERROR)),
441:                    new ConformanceTestCase(
442:                            "Non-ASCII control character U+1D175",
443:                            "\u00F0\u009D\u0085\u00B5", null, "Nameprep",
444:                            IDNA.DEFAULT, new StringPrepParseException("",
445:                                    StringPrepParseException.PROHIBITED_ERROR)),
446:                    new ConformanceTestCase(
447:                            "Plane 0 private use character U+F123",
448:                            "\u00EF\u0084\u00A3", null, "Nameprep",
449:                            IDNA.DEFAULT, new StringPrepParseException("",
450:                                    StringPrepParseException.PROHIBITED_ERROR)),
451:                    new ConformanceTestCase(
452:                            "Plane 15 private use character U+F1234",
453:                            "\u00F3\u00B1\u0088\u00B4", null, "Nameprep",
454:                            IDNA.DEFAULT, new StringPrepParseException("",
455:                                    StringPrepParseException.PROHIBITED_ERROR)),
456:                    new ConformanceTestCase(
457:                            "Plane 16 private use character U+10F234",
458:                            "\u00F4\u008F\u0088\u00B4", null, "Nameprep",
459:                            IDNA.DEFAULT, new StringPrepParseException("",
460:                                    StringPrepParseException.PROHIBITED_ERROR)),
461:                    new ConformanceTestCase("Non-character code point U+8FFFE",
462:                            "\u00F2\u008F\u00BF\u00BE", null, "Nameprep",
463:                            IDNA.DEFAULT, new StringPrepParseException("",
464:                                    StringPrepParseException.PROHIBITED_ERROR)),
465:                    new ConformanceTestCase(
466:                            "Non-character code point U+10FFFF",
467:                            "\u00F4\u008F\u00BF\u00BF", null, "Nameprep",
468:                            IDNA.DEFAULT, new StringPrepParseException("",
469:                                    StringPrepParseException.PROHIBITED_ERROR)),
470:                    /* 
471:                        {
472:                          "Surrogate code U+DF42",
473:                          "\u00ED\u00BD\u0082", null, "Nameprep", InternationalizedDomainNames.DEFAULT,
474:                          U_IDNA_PROHIBITED_ERROR
475:                        },
476:                     */
477:                    new ConformanceTestCase("Non-plain text character U+FFFD",
478:                            "\u00EF\u00BF\u00BD", null, "Nameprep",
479:                            IDNA.DEFAULT, new StringPrepParseException("",
480:                                    StringPrepParseException.PROHIBITED_ERROR)),
481:                    new ConformanceTestCase(
482:                            "Ideographic description character U+2FF5",
483:                            "\u00E2\u00BF\u00B5", null, "Nameprep",
484:                            IDNA.DEFAULT, new StringPrepParseException("",
485:                                    StringPrepParseException.PROHIBITED_ERROR)),
486:                    new ConformanceTestCase(
487:                            "Display property character U+0341",
488:                            "\u00CD\u0081", "\u00CC\u0081", "Nameprep",
489:                            IDNA.DEFAULT, null
490:
491:                    ),
492:
493:                    new ConformanceTestCase("Left-to-right mark U+200E",
494:                            "\u00E2\u0080\u008E", "\u00CC\u0081", "Nameprep",
495:                            IDNA.DEFAULT, new StringPrepParseException("",
496:                                    StringPrepParseException.PROHIBITED_ERROR)),
497:                    new ConformanceTestCase(
498:
499:                    "Deprecated U+202A", "\u00E2\u0080\u00AA", "\u00CC\u0081",
500:                            "Nameprep", IDNA.DEFAULT,
501:                            new StringPrepParseException("",
502:                                    StringPrepParseException.PROHIBITED_ERROR)),
503:                    new ConformanceTestCase(
504:                            "Language tagging character U+E0001",
505:                            "\u00F3\u00A0\u0080\u0081", "\u00CC\u0081",
506:                            "Nameprep", IDNA.DEFAULT,
507:                            new StringPrepParseException("",
508:                                    StringPrepParseException.PROHIBITED_ERROR)),
509:                    new ConformanceTestCase(
510:                            "Language tagging character U+E0042",
511:                            "\u00F3\u00A0\u0081\u0082", null, "Nameprep",
512:                            IDNA.DEFAULT, new StringPrepParseException("",
513:                                    StringPrepParseException.PROHIBITED_ERROR)),
514:                    new ConformanceTestCase(
515:                            "Bidi: RandALCat character U+05BE and LCat characters",
516:                            "\u0066\u006F\u006F\u00D6\u00BE\u0062\u0061\u0072",
517:                            null, "Nameprep", IDNA.DEFAULT,
518:                            new StringPrepParseException("",
519:                                    StringPrepParseException.CHECK_BIDI_ERROR)),
520:                    new ConformanceTestCase(
521:                            "Bidi: RandALCat character U+FD50 and LCat characters",
522:                            "\u0066\u006F\u006F\u00EF\u00B5\u0090\u0062\u0061\u0072",
523:                            null, "Nameprep", IDNA.DEFAULT,
524:                            new StringPrepParseException("",
525:                                    StringPrepParseException.CHECK_BIDI_ERROR)),
526:                    new ConformanceTestCase(
527:                            "Bidi: RandALCat character U+FB38 and LCat characters",
528:                            "\u0066\u006F\u006F\u00EF\u00B9\u00B6\u0062\u0061\u0072",
529:                            "\u0066\u006F\u006F \u00d9\u008e\u0062\u0061\u0072",
530:                            "Nameprep", IDNA.DEFAULT, null),
531:                    new ConformanceTestCase(
532:                            "Bidi: RandALCat without trailing RandALCat U+0627 U+0031",
533:                            "\u00D8\u00A7\u0031", null, "Nameprep",
534:                            IDNA.DEFAULT, new StringPrepParseException("",
535:                                    StringPrepParseException.CHECK_BIDI_ERROR)),
536:                    new ConformanceTestCase(
537:                            "Bidi: RandALCat character U+0627 U+0031 U+0628",
538:                            "\u00D8\u00A7\u0031\u00D8\u00A8",
539:                            "\u00D8\u00A7\u0031\u00D8\u00A8", "Nameprep",
540:                            IDNA.DEFAULT, null),
541:                    new ConformanceTestCase("Unassigned code point U+E0002",
542:                            "\u00F3\u00A0\u0080\u0082", null, "Nameprep",
543:                            IDNA.DEFAULT, new StringPrepParseException("",
544:                                    StringPrepParseException.UNASSIGNED_ERROR)),
545:
546:            /*  // Invalid UTF-8
547:                 {
548:                   "Larger test (shrinking)",
549:                   "X\u00C2\u00AD\u00C3\u00DF\u00C4\u00B0\u00E2\u0084\u00A1\u006a\u00cc\u008c\u00c2\u00a0\u00c2"
550:                   "\u00aa\u00ce\u00b0\u00e2\u0080\u0080", "xssi\u00cc\u0087""tel\u00c7\u00b0 a\u00ce\u00b0 ",
551:                   "Nameprep",
552:                   InternationalizedDomainNames.DEFAULT, U_ZERO_ERROR
553:                 },
554:                {
555:
556:                   "Larger test (expanding)",
557:                   "X\u00C3\u00DF\u00e3\u008c\u0096\u00C4\u00B0\u00E2\u0084\u00A1\u00E2\u0092\u009F\u00E3\u008c\u0080",
558:                   "xss\u00e3\u0082\u00ad\u00e3\u0083\u00ad\u00e3\u0083\u00a1\u00e3\u0083\u00bc\u00e3\u0083\u0088"
559:                   "\u00e3\u0083\u00ab""i\u00cc\u0087""tel\u0028""d\u0029\u00e3\u0082\u00a2\u00e3\u0083\u0091"
560:                   "\u00e3\u0083\u00bc\u00e3\u0083\u0088"
561:                   "Nameprep",
562:                   InternationalizedDomainNames.DEFAULT, U_ZERO_ERROR
563:                 },
564:             */
565:            };
566:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.