0001: /*
0002: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
0003: * Distributed under the terms of either:
0004: * - the common development and distribution license (CDDL), v1.0; or
0005: * - the GNU Lesser General Public License, v2.1 or later
0006: * $Id: TestParser.java 3782 2007-06-11 11:01:53Z gbevin $
0007: */
0008: package com.uwyn.rife.template;
0009:
0010: import com.uwyn.rife.template.exceptions.*;
0011:
0012: import com.uwyn.rife.tools.ExceptionUtils;
0013: import java.io.File;
0014: import java.util.regex.Pattern;
0015:
0016: public class TestParser extends TemplateTestCase {
0017: private Parser mParser = null;
0018:
0019: public TestParser(String name) {
0020: super (name);
0021: }
0022:
0023: public void setUp() {
0024: mParser = TemplateFactory.HTML.getParser();
0025: }
0026:
0027: public void testClone() {
0028: Parser parser_clone = mParser.clone();
0029: assertNotNull(parser_clone);
0030: assertTrue(mParser != parser_clone);
0031: assertTrue(mParser.equals(parser_clone));
0032: }
0033:
0034: public void testEquals() {
0035: Parser parser1 = new Parser(
0036: TemplateFactory.HTML,
0037: "html",
0038: new Parser.Config[] { new Parser.Config("<!--", "-->",
0039: "<!--/", "/-->", new Parser.OptionalConfigPart(
0040: Parser.PartType.STRING_DELIMITER_BEGIN,
0041: "'"), new Parser.OptionalConfigPart(
0042: Parser.PartType.STRING_DELIMITER_END,
0043: "'"), "V", "B", "BV", "BA", "I", "C") },
0044: ".html", (Pattern[]) null, (Pattern[]) null);
0045: Parser parser2 = new Parser(
0046: TemplateFactory.HTML,
0047: "html",
0048: new Parser.Config[] { new Parser.Config("<!--", "-->",
0049: "<!--/", "/-->", new Parser.OptionalConfigPart(
0050: Parser.PartType.STRING_DELIMITER_BEGIN,
0051: "'"), new Parser.OptionalConfigPart(
0052: Parser.PartType.STRING_DELIMITER_END,
0053: "'"), "V", "B", "BV", "BA", "I", "C") },
0054: ".html", new Pattern[] { Pattern.compile("pattern1"),
0055: Pattern.compile("pattern2"),
0056: Pattern.compile("pattern3") }, null);
0057: Parser parser3 = new Parser(
0058: TemplateFactory.HTML,
0059: "html",
0060: new Parser.Config[] { new Parser.Config("<!--", "-->",
0061: "<!--/", "/-->", new Parser.OptionalConfigPart(
0062: Parser.PartType.STRING_DELIMITER_BEGIN,
0063: "'"), new Parser.OptionalConfigPart(
0064: Parser.PartType.STRING_DELIMITER_END,
0065: "'"), "V", "B", "BV", "BA", "I", "C") },
0066: ".html", new Pattern[] { Pattern.compile("pattern2"),
0067: Pattern.compile("pattern3"),
0068: Pattern.compile("pattern1") }, null);
0069: Parser parser4 = new Parser(
0070: TemplateFactory.HTML,
0071: "html",
0072: new Parser.Config[] { new Parser.Config("<!--", "-->",
0073: "<!--/", "/-->", new Parser.OptionalConfigPart(
0074: Parser.PartType.STRING_DELIMITER_BEGIN,
0075: "'"), new Parser.OptionalConfigPart(
0076: Parser.PartType.STRING_DELIMITER_END,
0077: "'"), "V", "B", "BV", "BA", "I", "C") },
0078: ".html", null, new Pattern[] {
0079: Pattern.compile("pattern1"),
0080: Pattern.compile("pattern2"),
0081: Pattern.compile("pattern3") });
0082: Parser parser5 = new Parser(
0083: TemplateFactory.HTML,
0084: "html",
0085: new Parser.Config[] { new Parser.Config("<!--", "-->",
0086: "<!--/", "/-->", new Parser.OptionalConfigPart(
0087: Parser.PartType.STRING_DELIMITER_BEGIN,
0088: "'"), new Parser.OptionalConfigPart(
0089: Parser.PartType.STRING_DELIMITER_END,
0090: "'"), "V", "B", "BV", "BA", "I", "C") },
0091: ".html", null, new Pattern[] {
0092: Pattern.compile("pattern2"),
0093: Pattern.compile("pattern3"),
0094: Pattern.compile("pattern1") });
0095: Parser parser6 = new Parser(
0096: TemplateFactory.HTML,
0097: "htm",
0098: new Parser.Config[] { new Parser.Config("<!--", "-->",
0099: "<!--/", "/-->", new Parser.OptionalConfigPart(
0100: Parser.PartType.STRING_DELIMITER_BEGIN,
0101: "'"), new Parser.OptionalConfigPart(
0102: Parser.PartType.STRING_DELIMITER_END,
0103: "'"), "V", "B", "BV", "BA", "I", "C") },
0104: ".html", (Pattern[]) null, (Pattern[]) null);
0105: Parser parser7 = new Parser(
0106: TemplateFactory.HTML,
0107: "htm",
0108: new Parser.Config[] { new Parser.Config("<!", "-->",
0109: "<!/", "/-->", new Parser.OptionalConfigPart(
0110: Parser.PartType.STRING_DELIMITER_BEGIN,
0111: "'"), new Parser.OptionalConfigPart(
0112: Parser.PartType.STRING_DELIMITER_END,
0113: "'"), "V", "B", "BV", "BA", "I", "C") },
0114: ".html", (Pattern[]) null, (Pattern[]) null);
0115: Parser parser8 = new Parser(
0116: TemplateFactory.HTML,
0117: "htm",
0118: new Parser.Config[] { new Parser.Config("<!", ">",
0119: "<!/", "/>", new Parser.OptionalConfigPart(
0120: Parser.PartType.STRING_DELIMITER_BEGIN,
0121: "'"), new Parser.OptionalConfigPart(
0122: Parser.PartType.STRING_DELIMITER_END,
0123: "'"), "V", "B", "BV", "BA", "I", "C") },
0124: ".html", (Pattern[]) null, (Pattern[]) null);
0125: Parser parser9 = new Parser(
0126: TemplateFactory.HTML,
0127: "htm",
0128: new Parser.Config[] { new Parser.Config("<!", ">",
0129: "<!-", "->", new Parser.OptionalConfigPart(
0130: Parser.PartType.STRING_DELIMITER_BEGIN,
0131: "'"), new Parser.OptionalConfigPart(
0132: Parser.PartType.STRING_DELIMITER_END,
0133: "'"), "V", "B", "BV", "BA", "I", "C") },
0134: ".html", (Pattern[]) null, (Pattern[]) null);
0135: Parser parser10 = new Parser(
0136: TemplateFactory.HTML,
0137: "htm",
0138: new Parser.Config[] { new Parser.Config("<!", ">",
0139: "<!-", "->", new Parser.OptionalConfigPart(
0140: Parser.PartType.STRING_DELIMITER_BEGIN,
0141: "'"), new Parser.OptionalConfigPart(
0142: Parser.PartType.STRING_DELIMITER_END,
0143: "'"), "V", "B", "BV", "BA", "I", "C") },
0144: ".htm", (Pattern[]) null, (Pattern[]) null);
0145: Parser parser11 = new Parser(
0146: TemplateFactory.HTML,
0147: "htm",
0148: new Parser.Config[] { new Parser.Config("<!", ">",
0149: "<!-", "->", new Parser.OptionalConfigPart(
0150: Parser.PartType.STRING_DELIMITER_BEGIN,
0151: "\""), new Parser.OptionalConfigPart(
0152: Parser.PartType.STRING_DELIMITER_END,
0153: "\""), "V", "B", "BV", "BA", "I", "C") },
0154: ".htm", (Pattern[]) null, (Pattern[]) null);
0155:
0156: assertNotNull(parser1);
0157: assertNotNull(parser2);
0158: assertNotNull(parser3);
0159: assertNotNull(parser4);
0160: assertNotNull(parser5);
0161: assertNotNull(parser6);
0162: assertNotNull(parser7);
0163: assertNotNull(parser8);
0164: assertNotNull(parser9);
0165: assertNotNull(parser10);
0166: assertNotNull(parser11);
0167:
0168: assertTrue(!mParser.equals(parser1));
0169: assertTrue(!mParser.equals(parser2));
0170: assertTrue(!mParser.equals(parser3));
0171: assertTrue(!mParser.equals(parser4));
0172: assertTrue(!mParser.equals(parser5));
0173: assertTrue(!mParser.equals(parser6));
0174: assertTrue(!mParser.equals(parser7));
0175: assertTrue(!mParser.equals(parser8));
0176: assertTrue(!mParser.equals(parser9));
0177: assertTrue(!mParser.equals(parser10));
0178: assertTrue(!mParser.equals(parser11));
0179:
0180: assertTrue(parser1.equals(parser1));
0181: assertTrue(!parser1.equals(parser2));
0182: assertTrue(!parser1.equals(parser3));
0183: assertTrue(!parser1.equals(parser4));
0184: assertTrue(!parser1.equals(parser5));
0185: assertTrue(!parser1.equals(parser6));
0186: assertTrue(!parser1.equals(parser7));
0187: assertTrue(!parser1.equals(parser8));
0188: assertTrue(!parser1.equals(parser9));
0189: assertTrue(!parser1.equals(parser10));
0190: assertTrue(!parser1.equals(parser11));
0191:
0192: assertTrue(parser2.equals(parser2));
0193: assertTrue(!parser2.equals(parser3));
0194: assertTrue(!parser2.equals(parser4));
0195: assertTrue(!parser2.equals(parser5));
0196: assertTrue(!parser2.equals(parser6));
0197: assertTrue(!parser2.equals(parser7));
0198: assertTrue(!parser2.equals(parser8));
0199: assertTrue(!parser2.equals(parser9));
0200: assertTrue(!parser2.equals(parser10));
0201: assertTrue(!parser2.equals(parser11));
0202:
0203: assertTrue(parser3.equals(parser3));
0204: assertTrue(!parser3.equals(parser4));
0205: assertTrue(!parser3.equals(parser5));
0206: assertTrue(!parser3.equals(parser6));
0207: assertTrue(!parser3.equals(parser7));
0208: assertTrue(!parser3.equals(parser8));
0209: assertTrue(!parser3.equals(parser9));
0210: assertTrue(!parser3.equals(parser10));
0211: assertTrue(!parser3.equals(parser11));
0212:
0213: assertTrue(parser4.equals(parser4));
0214: assertTrue(!parser4.equals(parser5));
0215: assertTrue(!parser4.equals(parser6));
0216: assertTrue(!parser4.equals(parser7));
0217: assertTrue(!parser4.equals(parser8));
0218: assertTrue(!parser4.equals(parser9));
0219: assertTrue(!parser4.equals(parser10));
0220: assertTrue(!parser4.equals(parser11));
0221:
0222: assertTrue(parser5.equals(parser5));
0223: assertTrue(!parser5.equals(parser6));
0224: assertTrue(!parser5.equals(parser7));
0225: assertTrue(!parser5.equals(parser8));
0226: assertTrue(!parser5.equals(parser9));
0227: assertTrue(!parser5.equals(parser10));
0228: assertTrue(!parser5.equals(parser11));
0229:
0230: assertTrue(parser6.equals(parser6));
0231: assertTrue(!parser6.equals(parser7));
0232: assertTrue(!parser6.equals(parser8));
0233: assertTrue(!parser6.equals(parser9));
0234: assertTrue(!parser6.equals(parser10));
0235: assertTrue(!parser6.equals(parser11));
0236:
0237: assertTrue(parser7.equals(parser7));
0238: assertTrue(!parser7.equals(parser8));
0239: assertTrue(!parser7.equals(parser9));
0240: assertTrue(!parser7.equals(parser10));
0241: assertTrue(!parser7.equals(parser11));
0242:
0243: assertTrue(parser8.equals(parser8));
0244: assertTrue(!parser8.equals(parser9));
0245: assertTrue(!parser8.equals(parser10));
0246: assertTrue(!parser8.equals(parser11));
0247:
0248: assertTrue(parser9.equals(parser9));
0249: assertTrue(!parser9.equals(parser10));
0250: assertTrue(!parser9.equals(parser11));
0251:
0252: assertTrue(parser10.equals(parser10));
0253: assertTrue(!parser10.equals(parser11));
0254:
0255: assertTrue(parser11.equals(parser11));
0256: }
0257:
0258: public void testTemplatePackage() {
0259: try {
0260: Parsed template_parsed = mParser.parse(
0261: "test_package.noblocks_in", null, null);
0262: assertEquals(template_parsed.getBlocks().size(), 1);
0263: assertNotNull(template_parsed.getContent());
0264: assertEquals(template_parsed.getContent().countParts(), 1);
0265: assertEquals(template_parsed.getContent().getPart(0)
0266: .getData(), getTemplateContent("test_package"
0267: + File.separator + "noblocks_out_content", mParser));
0268: } catch (TemplateException e) {
0269: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0270: }
0271: }
0272:
0273: public void testParseDefaultValues() {
0274: try {
0275: Parsed template_parsed = mParser.parse("defaultvalues_in",
0276: null, null);
0277: assertEquals(template_parsed.getBlocks().size(), 2);
0278: assertNotNull(template_parsed.getContent());
0279: assertNotNull(template_parsed.getBlock("BLOCK1"));
0280: assertEquals(template_parsed.getContent().countParts(), 6);
0281: assertEquals(template_parsed.getBlock("BLOCK1")
0282: .countParts(), 1);
0283: assertEquals(template_parsed.getDefaultValue("VALUE1"),
0284: getTemplateContent("defaultvalues_out_default1",
0285: mParser));
0286: assertEquals(template_parsed.getDefaultValue("VALUE2"),
0287: getTemplateContent("defaultvalues_out_default2",
0288: mParser));
0289: assertEquals(template_parsed.getDefaultValue("VALUE3"),
0290: getTemplateContent("defaultvalues_out_default3",
0291: mParser));
0292: assertEquals(template_parsed.getContent().getPart(0)
0293: .getData(), getTemplateContent(
0294: "defaultvalues_out_content_0", mParser));
0295: assertEquals(template_parsed.getContent().getPart(1)
0296: .getData(), getTemplateContent(
0297: "defaultvalues_out_content_1", mParser));
0298: assertEquals(template_parsed.getContent().getPart(2)
0299: .getData(), getTemplateContent(
0300: "defaultvalues_out_content_2", mParser));
0301: assertEquals(template_parsed.getContent().getPart(3)
0302: .getData(), getTemplateContent(
0303: "defaultvalues_out_content_3", mParser));
0304: assertEquals(template_parsed.getContent().getPart(4)
0305: .getData(), getTemplateContent(
0306: "defaultvalues_out_content_4", mParser));
0307: assertEquals(template_parsed.getContent().getPart(5)
0308: .getData(), getTemplateContent(
0309: "defaultvalues_out_content_5", mParser));
0310: assertEquals(template_parsed.getBlock("BLOCK1").getPart(0)
0311: .getData(), getTemplateContent(
0312: "defaultvalues_out_block1", mParser));
0313: } catch (TemplateException e) {
0314: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0315: }
0316: }
0317:
0318: public void testParseComments() {
0319: try {
0320: Parsed template_parsed = mParser.parse("comments_in", null,
0321: null);
0322: assertEquals(template_parsed.getBlocks().size(), 2);
0323: assertNotNull(template_parsed.getContent());
0324: assertNotNull(template_parsed.getBlock("BLOCK1"));
0325: assertEquals(template_parsed.getContent().countParts(), 3);
0326: assertEquals(template_parsed.getBlock("BLOCK1")
0327: .countParts(), 1);
0328: assertEquals(
0329: template_parsed.getDefaultValue("VALUE1"),
0330: getTemplateContent("comments_out_default1", mParser));
0331: assertNull(template_parsed.getDefaultValue("VALUE2"));
0332: assertEquals(template_parsed.getContent().getPart(0)
0333: .getData(), getTemplateContent(
0334: "comments_out_content_0", mParser));
0335: assertEquals(template_parsed.getContent().getPart(1)
0336: .getData(), getTemplateContent(
0337: "comments_out_content_1", mParser));
0338: assertEquals(template_parsed.getContent().getPart(2)
0339: .getData(), getTemplateContent(
0340: "comments_out_content_2", mParser));
0341: assertEquals(template_parsed.getBlock("BLOCK1").getPart(0)
0342: .getData(), getTemplateContent(
0343: "comments_out_block1", mParser));
0344: } catch (TemplateException e) {
0345: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0346: }
0347: }
0348:
0349: public void testParseCommentsSuccessiveEscaped() {
0350: try {
0351: Parsed template_parsed = mParser.parse(
0352: "comments_successive_escaped_in", null, null);
0353: assertEquals(template_parsed.getBlocks().size(), 1);
0354: assertNotNull(template_parsed.getContent());
0355: assertEquals(template_parsed.getContent().countParts(), 1);
0356: assertEquals(template_parsed.getContent().getPart(0)
0357: .getData(), getTemplateContent(
0358: "comments_successive_escaped_out", mParser));
0359: } catch (TemplateException e) {
0360: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0361: }
0362: }
0363:
0364: public void testParseNoBlocks() {
0365: try {
0366: Parsed template_parsed = mParser.parse("noblocks_in", null,
0367: null);
0368: assertEquals(template_parsed.getBlocks().size(), 1);
0369: assertNotNull(template_parsed.getContent());
0370: assertEquals(template_parsed.getContent().countParts(), 1);
0371: assertEquals(template_parsed.getContent().getPart(0)
0372: .getData(), getTemplateContent(
0373: "noblocks_out_content", mParser));
0374: } catch (TemplateException e) {
0375: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0376: }
0377: }
0378:
0379: public void testParseBlocksSuccessive() {
0380: try {
0381: Parsed template_parsed = mParser.parse(
0382: "blocks_successive_in", null, null);
0383: assertEquals(template_parsed.getBlocks().size(), 4);
0384: assertNotNull(template_parsed.getContent());
0385: assertNotNull(template_parsed.getBlock("BLOCK1"));
0386: assertNotNull(template_parsed.getBlock("BLOCK2"));
0387: assertNotNull(template_parsed.getBlock("BLOCK3"));
0388: assertEquals(template_parsed.getContent().countParts(), 1);
0389: assertEquals(template_parsed.getBlock("BLOCK1")
0390: .countParts(), 1);
0391: assertEquals(template_parsed.getBlock("BLOCK2")
0392: .countParts(), 1);
0393: assertEquals(template_parsed.getBlock("BLOCK3")
0394: .countParts(), 1);
0395: assertEquals(template_parsed.getContent().getPart(0)
0396: .getData(), getTemplateContent(
0397: "blocks_successive_out_content", mParser));
0398: assertEquals(template_parsed.getBlock("BLOCK1").getPart(0)
0399: .getData(), getTemplateContent(
0400: "blocks_successive_out_block1", mParser));
0401: assertEquals(template_parsed.getBlock("BLOCK2").getPart(0)
0402: .getData(), getTemplateContent(
0403: "blocks_successive_out_block2", mParser));
0404: assertEquals(template_parsed.getBlock("BLOCK3").getPart(0)
0405: .getData(), getTemplateContent(
0406: "blocks_successive_out_block3", mParser));
0407: } catch (TemplateException e) {
0408: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0409: }
0410: }
0411:
0412: public void testParseBlocksSuccessiveEscaped() {
0413: try {
0414: Parsed template_parsed = mParser.parse(
0415: "blocks_successive_escaped_in", null, null);
0416: assertEquals(template_parsed.getBlocks().size(), 2);
0417: assertNotNull(template_parsed.getContent());
0418: assertNotNull(template_parsed.getBlock("BLOCK2"));
0419: assertEquals(template_parsed.getContent().countParts(), 1);
0420: assertEquals(template_parsed.getBlock("BLOCK2")
0421: .countParts(), 1);
0422: assertEquals(template_parsed.getContent().getPart(0)
0423: .getData(), getTemplateContent(
0424: "blocks_successive_escaped_out_content", mParser));
0425: assertEquals(template_parsed.getBlock("BLOCK2").getPart(0)
0426: .getData(), getTemplateContent(
0427: "blocks_successive_escaped_out_block2", mParser));
0428: } catch (TemplateException e) {
0429: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0430: }
0431: }
0432:
0433: public void testParseBlocksSpaced() {
0434: try {
0435: Parsed template_parsed = mParser.parse("blocks_spaced_in",
0436: null, null);
0437: assertEquals(template_parsed.getBlocks().size(), 4);
0438: assertNotNull(template_parsed.getContent());
0439: assertNotNull(template_parsed.getBlock("BLOCK1"));
0440: assertNotNull(template_parsed.getBlock("BLOCK2"));
0441: assertNotNull(template_parsed.getBlock("BLOCK3"));
0442: assertEquals(template_parsed.getContent().countParts(), 1);
0443: assertEquals(template_parsed.getBlock("BLOCK1")
0444: .countParts(), 1);
0445: assertEquals(template_parsed.getBlock("BLOCK2")
0446: .countParts(), 1);
0447: assertEquals(template_parsed.getBlock("BLOCK3")
0448: .countParts(), 1);
0449: assertEquals(template_parsed.getContent().getPart(0)
0450: .getData(), getTemplateContent(
0451: "blocks_spaced_out_content", mParser));
0452: assertEquals(template_parsed.getBlock("BLOCK1").getPart(0)
0453: .getData(), getTemplateContent(
0454: "blocks_spaced_out_block1", mParser));
0455: assertEquals(template_parsed.getBlock("BLOCK2").getPart(0)
0456: .getData(), getTemplateContent(
0457: "blocks_spaced_out_block2", mParser));
0458: assertEquals(template_parsed.getBlock("BLOCK3").getPart(0)
0459: .getData(), getTemplateContent(
0460: "blocks_spaced_out_block3", mParser));
0461: } catch (TemplateException e) {
0462: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0463: }
0464: }
0465:
0466: public void testParseBlocksSpacedEscaped() {
0467: try {
0468: Parsed template_parsed = mParser.parse(
0469: "blocks_spaced_escaped_in", null, null);
0470: assertEquals(template_parsed.getBlocks().size(), 2);
0471: assertNotNull(template_parsed.getContent());
0472: assertNotNull(template_parsed.getBlock("BLOCK1"));
0473: assertEquals(template_parsed.getContent().countParts(), 1);
0474: assertEquals(template_parsed.getBlock("BLOCK1")
0475: .countParts(), 1);
0476: assertEquals(template_parsed.getContent().getPart(0)
0477: .getData(), getTemplateContent(
0478: "blocks_spaced_escaped_out_content", mParser));
0479: assertEquals(template_parsed.getBlock("BLOCK1").getPart(0)
0480: .getData(), getTemplateContent(
0481: "blocks_spaced_escaped_out_block1", mParser));
0482: } catch (TemplateException e) {
0483: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0484: }
0485: }
0486:
0487: public void testParseBlocksExtremities() {
0488: try {
0489: Parsed template_parsed = mParser.parse(
0490: "blocks_extremities_in", null, null);
0491: assertEquals(template_parsed.getBlocks().size(), 4);
0492: assertNotNull(template_parsed.getContent());
0493: assertNotNull(template_parsed.getBlock("BLOCK1"));
0494: assertNotNull(template_parsed.getBlock("BLOCK2"));
0495: assertNotNull(template_parsed.getBlock("BLOCK3"));
0496: assertEquals(template_parsed.getContent().countParts(), 1);
0497: assertEquals(template_parsed.getBlock("BLOCK1")
0498: .countParts(), 1);
0499: assertEquals(template_parsed.getBlock("BLOCK2")
0500: .countParts(), 1);
0501: assertEquals(template_parsed.getBlock("BLOCK3")
0502: .countParts(), 1);
0503: assertEquals(template_parsed.getContent().getPart(0)
0504: .getData(), getTemplateContent(
0505: "blocks_extremities_out_content", mParser));
0506: assertEquals(template_parsed.getBlock("BLOCK1").getPart(0)
0507: .getData(), getTemplateContent(
0508: "blocks_extremities_out_block1", mParser));
0509: assertEquals(template_parsed.getBlock("BLOCK2").getPart(0)
0510: .getData(), getTemplateContent(
0511: "blocks_extremities_out_block2", mParser));
0512: assertEquals(template_parsed.getBlock("BLOCK3").getPart(0)
0513: .getData(), getTemplateContent(
0514: "blocks_extremities_out_block3", mParser));
0515: } catch (TemplateException e) {
0516: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0517: }
0518: }
0519:
0520: public void testParseBlocksExtremitiesEscaped() {
0521: try {
0522: Parsed template_parsed = mParser.parse(
0523: "blocks_extremities_escaped_in", null, null);
0524: assertEquals(template_parsed.getBlocks().size(), 2);
0525: assertNotNull(template_parsed.getContent());
0526: assertNotNull(template_parsed.getBlock("BLOCK2"));
0527: assertEquals(template_parsed.getContent().countParts(), 1);
0528: assertEquals(template_parsed.getBlock("BLOCK2")
0529: .countParts(), 1);
0530: assertEquals(template_parsed.getContent().getPart(0)
0531: .getData(), getTemplateContent(
0532: "blocks_extremities_escaped_out_content", mParser));
0533: assertEquals(template_parsed.getBlock("BLOCK2").getPart(0)
0534: .getData(), getTemplateContent(
0535: "blocks_extremities_escaped_out_block2", mParser));
0536: } catch (TemplateException e) {
0537: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0538: }
0539: }
0540:
0541: public void testParseBlockvalues() {
0542: try {
0543: Parsed template_parsed = mParser.parse("blockvalues_in",
0544: null, null);
0545: assertEquals(template_parsed.getBlocks().size(), 4);
0546: assertNotNull(template_parsed.getContent());
0547: assertNotNull(template_parsed.getBlock("BLOCK1"));
0548: assertNotNull(template_parsed.getBlock("BLOCK2"));
0549: assertNotNull(template_parsed.getBlock("BLOCK3"));
0550: assertEquals(template_parsed.getContent().countParts(), 1);
0551: assertEquals(template_parsed.getBlock("BLOCK1")
0552: .countParts(), 1);
0553: assertEquals(template_parsed.getBlock("BLOCK2")
0554: .countParts(), 1);
0555: assertEquals(template_parsed.getBlock("BLOCK3")
0556: .countParts(), 1);
0557: assertTrue(template_parsed.hasBlockvalue("BLOCK1"));
0558: assertTrue(template_parsed.hasBlockvalue("BLOCK2"));
0559: assertTrue(template_parsed.hasBlockvalue("BLOCK3"));
0560: assertEquals(template_parsed.getContent().getPart(0)
0561: .getData(), getTemplateContent(
0562: "blockvalues_out_content", mParser));
0563: assertEquals(template_parsed.getBlock("BLOCK1").getPart(0)
0564: .getData(), getTemplateContent(
0565: "blockvalues_out_block1", mParser));
0566: assertEquals(template_parsed.getBlock("BLOCK2").getPart(0)
0567: .getData(), getTemplateContent(
0568: "blockvalues_out_block2", mParser));
0569: assertEquals(template_parsed.getBlock("BLOCK3").getPart(0)
0570: .getData(), getTemplateContent(
0571: "blockvalues_out_block3", mParser));
0572: } catch (TemplateException e) {
0573: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0574: }
0575: }
0576:
0577: public void testParseBlockvaluesEscaped() {
0578: try {
0579: Parsed template_parsed = mParser.parse(
0580: "blockvalues_escaped_in", null, null);
0581: assertEquals(template_parsed.getBlocks().size(), 3);
0582: assertNotNull(template_parsed.getContent());
0583: assertNotNull(template_parsed.getBlock("BLOCK1"));
0584: assertNotNull(template_parsed.getBlock("BLOCK3"));
0585: assertEquals(template_parsed.getContent().countParts(), 1);
0586: assertEquals(template_parsed.getBlock("BLOCK1")
0587: .countParts(), 1);
0588: assertEquals(template_parsed.getBlock("BLOCK3")
0589: .countParts(), 1);
0590: assertTrue(template_parsed.hasBlockvalue("BLOCK1"));
0591: assertTrue(template_parsed.hasBlockvalue("BLOCK3"));
0592: assertEquals(template_parsed.getContent().getPart(0)
0593: .getData(), getTemplateContent(
0594: "blockvalues_escaped_out_content", mParser));
0595: assertEquals(template_parsed.getBlock("BLOCK1").getPart(0)
0596: .getData(), getTemplateContent(
0597: "blockvalues_escaped_out_block1", mParser));
0598: assertEquals(template_parsed.getBlock("BLOCK3").getPart(0)
0599: .getData(), getTemplateContent(
0600: "blockvalues_escaped_out_block3", mParser));
0601: } catch (TemplateException e) {
0602: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0603: }
0604: }
0605:
0606: public void testParseBlockappends() {
0607: try {
0608: Parsed template_parsed = mParser.parse("blockappends_in",
0609: null, null);
0610: assertEquals(template_parsed.getBlocks().size(), 2);
0611: assertNotNull(template_parsed.getContent());
0612: assertNotNull(template_parsed.getBlock("BLOCK"));
0613: assertEquals(template_parsed.getContent().countParts(), 3);
0614: assertEquals(
0615: template_parsed.getBlock("BLOCK").countParts(), 5);
0616: assertTrue(template_parsed.hasBlockvalue("BLOCK"));
0617: assertEquals(template_parsed.getContent().getPart(0)
0618: .getData(), getTemplateContent(
0619: "blockappends_out_content_0", mParser));
0620: assertEquals(template_parsed.getContent().getPart(1)
0621: .getType(), ParsedBlockPart.VALUE);
0622: assertEquals(template_parsed.getContent().getPart(1)
0623: .getData(), "BLOCK");
0624: assertEquals(template_parsed.getContent().getPart(2)
0625: .getData(), getTemplateContent(
0626: "blockappends_out_content_2", mParser));
0627: assertEquals(template_parsed.getBlock("BLOCK").getPart(0)
0628: .getData(), getTemplateContent(
0629: "blockappends_out_block_0", mParser));
0630: assertEquals(template_parsed.getBlock("BLOCK").getPart(1)
0631: .getType(), ParsedBlockPart.VALUE);
0632: assertEquals(template_parsed.getBlock("BLOCK").getPart(1)
0633: .getData(), "value2");
0634: assertEquals(template_parsed.getBlock("BLOCK").getPart(2)
0635: .getData(), getTemplateContent(
0636: "blockappends_out_block_2", mParser));
0637: assertEquals(template_parsed.getBlock("BLOCK").getPart(3)
0638: .getType(), ParsedBlockPart.VALUE);
0639: assertEquals(template_parsed.getBlock("BLOCK").getPart(3)
0640: .getData(), "value3");
0641: assertEquals(template_parsed.getDefaultValue("value3"),
0642: getTemplateContent(
0643: "blockappends_out_block_3-defaultvalue",
0644: mParser));
0645: assertEquals(template_parsed.getBlock("BLOCK").getPart(4)
0646: .getData(), getTemplateContent(
0647: "blockappends_out_block_4", mParser));
0648: } catch (TemplateException e) {
0649: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0650: }
0651: }
0652:
0653: public void testParseBlockappendsEscaped() {
0654: try {
0655: Parsed template_parsed = mParser.parse(
0656: "blockappends_escaped_in", null, null);
0657: assertEquals(template_parsed.getBlocks().size(), 3);
0658: assertNotNull(template_parsed.getContent());
0659: assertNotNull(template_parsed.getBlock("BLOCK1"));
0660: assertNotNull(template_parsed.getBlock("BLOCK2"));
0661: assertEquals(template_parsed.getContent().countParts(), 1);
0662: assertEquals(template_parsed.getBlock("BLOCK1")
0663: .countParts(), 1);
0664: assertEquals(template_parsed.getBlock("BLOCK2")
0665: .countParts(), 1);
0666: assertTrue(template_parsed.hasBlockvalue("BLOCK1"));
0667: assertTrue(template_parsed.hasBlockvalue("BLOCK2"));
0668: assertEquals(template_parsed.getContent().getPart(0)
0669: .getData(), getTemplateContent(
0670: "blockappends_escaped_out_content", mParser));
0671: assertEquals(template_parsed.getBlock("BLOCK1").getPart(0)
0672: .getData(), getTemplateContent(
0673: "blockappends_escaped_out_block1", mParser));
0674: assertEquals(template_parsed.getBlock("BLOCK2").getPart(0)
0675: .getData(), getTemplateContent(
0676: "blockappends_escaped_out_block2", mParser));
0677: } catch (TemplateException e) {
0678: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0679: }
0680: }
0681:
0682: public void testParseBlocksNested() {
0683: try {
0684: Parsed template_parsed = mParser.parse("blocks_nested_in",
0685: null, null);
0686: assertEquals(template_parsed.getBlocks().size(), 4);
0687: assertNotNull(template_parsed.getContent());
0688: assertNotNull(template_parsed.getBlock("BLOCK1"));
0689: assertNotNull(template_parsed.getBlock("BLOCK2"));
0690: assertNotNull(template_parsed.getBlock("BLOCK3"));
0691: assertEquals(template_parsed.getContent().countParts(), 1);
0692: assertEquals(template_parsed.getBlock("BLOCK1")
0693: .countParts(), 1);
0694: assertEquals(template_parsed.getBlock("BLOCK2")
0695: .countParts(), 1);
0696: assertEquals(template_parsed.getBlock("BLOCK3")
0697: .countParts(), 1);
0698: assertEquals(template_parsed.getContent().getPart(0)
0699: .getData(), getTemplateContent(
0700: "blocks_nested_out_content", mParser));
0701: assertEquals(template_parsed.getBlock("BLOCK1").getPart(0)
0702: .getData(), getTemplateContent(
0703: "blocks_nested_out_block1", mParser));
0704: assertEquals(template_parsed.getBlock("BLOCK2").getPart(0)
0705: .getData(), getTemplateContent(
0706: "blocks_nested_out_block2", mParser));
0707: assertEquals(template_parsed.getBlock("BLOCK3").getPart(0)
0708: .getData(), getTemplateContent(
0709: "blocks_nested_out_block3", mParser));
0710: } catch (TemplateException e) {
0711: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0712: }
0713: }
0714:
0715: public void testParseBlocksNestedEscaped() {
0716: try {
0717: Parsed template_parsed = mParser.parse(
0718: "blocks_nested_escaped_in", null, null);
0719: assertEquals(template_parsed.getBlocks().size(), 3);
0720: assertNotNull(template_parsed.getContent());
0721: assertNotNull(template_parsed.getBlock("BLOCK1"));
0722: assertNotNull(template_parsed.getBlock("BLOCK3"));
0723: assertEquals(template_parsed.getContent().countParts(), 1);
0724: assertEquals(template_parsed.getBlock("BLOCK1")
0725: .countParts(), 1);
0726: assertEquals(template_parsed.getBlock("BLOCK3")
0727: .countParts(), 1);
0728: assertEquals(template_parsed.getContent().getPart(0)
0729: .getData(), getTemplateContent(
0730: "blocks_nested_escaped_out_content", mParser));
0731: assertEquals(template_parsed.getBlock("BLOCK1").getPart(0)
0732: .getData(), getTemplateContent(
0733: "blocks_nested_escaped_out_block1", mParser));
0734: assertEquals(template_parsed.getBlock("BLOCK3").getPart(0)
0735: .getData(), getTemplateContent(
0736: "blocks_nested_escaped_out_block3", mParser));
0737: } catch (TemplateException e) {
0738: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0739: }
0740: }
0741:
0742: public void testParseBlocksNameHashcodeConflicts() {
0743: try {
0744: assertTrue("DMn0".hashCode() == "Cln0".hashCode());
0745: assertTrue("DMn0".hashCode() == "DNNO".hashCode());
0746: assertTrue("FMmO".hashCode() == "EmMn".hashCode());
0747: assertTrue("DMn0".hashCode() != "FMmO".hashCode());
0748: assertTrue("DMn0".hashCode() != "HNMn".hashCode());
0749: assertTrue("FMmO".hashCode() != "HNMn".hashCode());
0750: Parsed template_parsed = mParser.parse(
0751: "blocks_stringconflicts_in", null, null);
0752: assertEquals(template_parsed.getBlocks().size(), 7);
0753: assertNotNull(template_parsed.getContent());
0754: assertNotNull(template_parsed.getBlock("DMn0"));
0755: assertNotNull(template_parsed.getBlock("Cln0"));
0756: assertNotNull(template_parsed.getBlock("DNNO"));
0757: assertNotNull(template_parsed.getBlock("FMmO"));
0758: assertNotNull(template_parsed.getBlock("EmMn"));
0759: assertNotNull(template_parsed.getBlock("HNMn"));
0760: assertEquals(template_parsed.getContent().countParts(), 3);
0761: assertEquals(template_parsed.getBlock("DMn0").countParts(),
0762: 1);
0763: assertEquals(template_parsed.getBlock("Cln0").countParts(),
0764: 1);
0765: assertEquals(template_parsed.getBlock("DNNO").countParts(),
0766: 1);
0767: assertEquals(template_parsed.getBlock("FMmO").countParts(),
0768: 1);
0769: assertEquals(template_parsed.getBlock("EmMn").countParts(),
0770: 1);
0771: assertEquals(template_parsed.getBlock("HNMn").countParts(),
0772: 1);
0773: assertEquals(template_parsed.getContent().getPart(0)
0774: .getData(), getTemplateContent(
0775: "blocks_stringconflicts_out_content", mParser));
0776: assertEquals(template_parsed.getBlock("DMn0").getPart(0)
0777: .getData(), getTemplateContent(
0778: "blocks_stringconflicts_out_block1", mParser));
0779: assertEquals(template_parsed.getBlock("Cln0").getPart(0)
0780: .getData(), getTemplateContent(
0781: "blocks_stringconflicts_out_block2", mParser));
0782: assertEquals(template_parsed.getBlock("DNNO").getPart(0)
0783: .getData(), getTemplateContent(
0784: "blocks_stringconflicts_out_block3", mParser));
0785: assertEquals(template_parsed.getBlock("FMmO").getPart(0)
0786: .getData(), getTemplateContent(
0787: "blocks_stringconflicts_out_block4", mParser));
0788: assertEquals(template_parsed.getBlock("EmMn").getPart(0)
0789: .getData(), getTemplateContent(
0790: "blocks_stringconflicts_out_block5", mParser));
0791: assertEquals(template_parsed.getBlock("HNMn").getPart(0)
0792: .getData(), getTemplateContent(
0793: "blocks_stringconflicts_out_block6", mParser));
0794: } catch (TemplateException e) {
0795: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0796: }
0797: }
0798:
0799: public void testParseValuesLong() {
0800: try {
0801: Parsed template_parsed = mParser.parse("values_long_in",
0802: null, null);
0803: assertEquals(template_parsed.getBlocks().size(), 4);
0804: assertNotNull(template_parsed.getContent());
0805: assertNotNull(template_parsed.getBlock("BLOCK1"));
0806: assertNotNull(template_parsed.getBlock("BLOCK2"));
0807: assertNotNull(template_parsed.getBlock("BLOCK3"));
0808: assertEquals(template_parsed.getContent().countParts(), 5);
0809: assertEquals(template_parsed.getBlock("BLOCK1")
0810: .countParts(), 5);
0811: assertEquals(template_parsed.getBlock("BLOCK2")
0812: .countParts(), 3);
0813: assertEquals(template_parsed.getBlock("BLOCK3")
0814: .countParts(), 1);
0815: assertEquals(template_parsed.getContent().getPart(0)
0816: .getData(), getTemplateContent(
0817: "values_long_out_content_0", mParser));
0818: assertEquals(template_parsed.getContent().getPart(1)
0819: .getData(), getTemplateContent(
0820: "values_long_out_content_1", mParser));
0821: assertEquals(template_parsed.getContent().getPart(2)
0822: .getData(), getTemplateContent(
0823: "values_long_out_content_2", mParser));
0824: assertEquals(template_parsed.getContent().getPart(3)
0825: .getData(), getTemplateContent(
0826: "values_long_out_content_3", mParser));
0827: assertEquals(template_parsed.getContent().getPart(4)
0828: .getData(), getTemplateContent(
0829: "values_long_out_content_4", mParser));
0830: assertEquals(template_parsed.getBlock("BLOCK1").getPart(0)
0831: .getData(), getTemplateContent(
0832: "values_long_out_block1_0", mParser));
0833: assertEquals(template_parsed.getBlock("BLOCK1").getPart(1)
0834: .getData(), getTemplateContent(
0835: "values_long_out_block1_1", mParser));
0836: assertEquals(template_parsed
0837: .getDefaultValue(template_parsed.getBlock("BLOCK1")
0838: .getPart(1).getData()), getTemplateContent(
0839: "values_long_out_block1_1-defaultvalue", mParser));
0840: assertEquals(template_parsed.getBlock("BLOCK1").getPart(2)
0841: .getData(), getTemplateContent(
0842: "values_long_out_block1_2", mParser));
0843: assertEquals(template_parsed.getBlock("BLOCK1").getPart(3)
0844: .getData(), getTemplateContent(
0845: "values_long_out_block1_3", mParser));
0846: assertEquals(template_parsed
0847: .getDefaultValue(template_parsed.getBlock("BLOCK1")
0848: .getPart(3).getData()), getTemplateContent(
0849: "values_long_out_block1_3-defaultvalue", mParser));
0850: assertEquals(template_parsed.getBlock("BLOCK1").getPart(4)
0851: .getData(), getTemplateContent(
0852: "values_long_out_block1_4", mParser));
0853: assertEquals(template_parsed.getBlock("BLOCK2").getPart(0)
0854: .getData(), getTemplateContent(
0855: "values_long_out_block2_0", mParser));
0856: assertEquals(template_parsed.getBlock("BLOCK2").getPart(1)
0857: .getData(), getTemplateContent(
0858: "values_long_out_block2_1", mParser));
0859: assertEquals(template_parsed
0860: .getDefaultValue(template_parsed.getBlock("BLOCK2")
0861: .getPart(1).getData()), getTemplateContent(
0862: "values_long_out_block2_1-defaultvalue", mParser));
0863: assertEquals(template_parsed.getBlock("BLOCK2").getPart(2)
0864: .getData(), getTemplateContent(
0865: "values_long_out_block2_2", mParser));
0866: assertEquals(template_parsed
0867: .getDefaultValue(template_parsed.getBlock("BLOCK2")
0868: .getPart(2).getData()), getTemplateContent(
0869: "values_long_out_block2_2-defaultvalue", mParser));
0870: assertEquals(template_parsed.getBlock("BLOCK3").getPart(0)
0871: .getData(), getTemplateContent(
0872: "values_long_out_block3_0", mParser));
0873: assertEquals(template_parsed
0874: .getDefaultValue(template_parsed.getBlock("BLOCK3")
0875: .getPart(0).getData()), getTemplateContent(
0876: "values_long_out_block3_0-defaultvalue", mParser));
0877: } catch (TemplateException e) {
0878: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0879: }
0880: }
0881:
0882: public void testParseValuesLongEscaped() {
0883: try {
0884: Parsed template_parsed = mParser.parse(
0885: "values_long_escaped_in", null, null);
0886: assertEquals(template_parsed.getBlocks().size(), 2);
0887: assertNotNull(template_parsed.getContent());
0888: assertNotNull(template_parsed.getBlock("BLOCK1"));
0889: assertEquals(template_parsed.getContent().countParts(), 3);
0890: assertEquals(template_parsed.getBlock("BLOCK1")
0891: .countParts(), 6);
0892: assertEquals(template_parsed.getContent().getPart(0)
0893: .getData(), getTemplateContent(
0894: "values_long_escaped_out_content_0", mParser));
0895: assertEquals(template_parsed.getContent().getPart(1)
0896: .getData(), getTemplateContent(
0897: "values_long_escaped_out_content_1", mParser));
0898: assertEquals(template_parsed.getContent().getPart(2)
0899: .getData(), getTemplateContent(
0900: "values_long_escaped_out_content_2", mParser));
0901: assertEquals(template_parsed.getBlock("BLOCK1").getPart(0)
0902: .getData(), getTemplateContent(
0903: "values_long_escaped_out_block1_0", mParser));
0904: assertEquals(template_parsed.getBlock("BLOCK1").getPart(1)
0905: .getData(), getTemplateContent(
0906: "values_long_escaped_out_block1_1", mParser));
0907: assertEquals(template_parsed
0908: .getDefaultValue(template_parsed.getBlock("BLOCK1")
0909: .getPart(1).getData()), getTemplateContent(
0910: "values_long_escaped_out_block1_1-defaultvalue",
0911: mParser));
0912: assertEquals(template_parsed.getBlock("BLOCK1").getPart(2)
0913: .getData(), getTemplateContent(
0914: "values_long_escaped_out_block1_2", mParser));
0915: assertEquals(template_parsed.getBlock("BLOCK1").getPart(3)
0916: .getData(), getTemplateContent(
0917: "values_long_escaped_out_block1_3", mParser));
0918: assertEquals(template_parsed
0919: .getDefaultValue(template_parsed.getBlock("BLOCK1")
0920: .getPart(3).getData()), getTemplateContent(
0921: "values_long_escaped_out_block1_3-defaultvalue",
0922: mParser));
0923: assertEquals(template_parsed.getBlock("BLOCK1").getPart(4)
0924: .getData(), getTemplateContent(
0925: "values_long_escaped_out_block1_4", mParser));
0926: assertEquals(template_parsed.getBlock("BLOCK1").getPart(5)
0927: .getData(), getTemplateContent(
0928: "values_long_escaped_out_block1_5", mParser));
0929: assertEquals(template_parsed
0930: .getDefaultValue(template_parsed.getBlock("BLOCK1")
0931: .getPart(5).getData()), getTemplateContent(
0932: "values_long_escaped_out_block1_5-defaultvalue",
0933: mParser));
0934: } catch (TemplateException e) {
0935: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0936: }
0937: }
0938:
0939: public void testParseValuesShort() {
0940: try {
0941: Parsed template_parsed = mParser.parse("values_short_in",
0942: null, null);
0943: assertEquals(template_parsed.getBlocks().size(), 4);
0944: assertNotNull(template_parsed.getContent());
0945: assertNotNull(template_parsed.getBlock("BLOCK1"));
0946: assertNotNull(template_parsed.getBlock("BLOCK2"));
0947: assertNotNull(template_parsed.getBlock("BLOCK3"));
0948: assertEquals(template_parsed.getContent().countParts(), 5);
0949: assertEquals(template_parsed.getBlock("BLOCK1")
0950: .countParts(), 5);
0951: assertEquals(template_parsed.getBlock("BLOCK2")
0952: .countParts(), 3);
0953: assertEquals(template_parsed.getBlock("BLOCK3")
0954: .countParts(), 1);
0955: assertEquals(template_parsed.getContent().getPart(0)
0956: .getData(), getTemplateContent(
0957: "values_short_out_content_0", mParser));
0958: assertEquals(template_parsed.getContent().getPart(1)
0959: .getData(), getTemplateContent(
0960: "values_short_out_content_1", mParser));
0961: assertEquals(template_parsed.getContent().getPart(2)
0962: .getData(), getTemplateContent(
0963: "values_short_out_content_2", mParser));
0964: assertEquals(template_parsed.getContent().getPart(3)
0965: .getData(), getTemplateContent(
0966: "values_short_out_content_3", mParser));
0967: assertEquals(template_parsed.getContent().getPart(4)
0968: .getData(), getTemplateContent(
0969: "values_short_out_content_4", mParser));
0970: assertEquals(template_parsed.getBlock("BLOCK1").getPart(0)
0971: .getData(), getTemplateContent(
0972: "values_short_out_block1_0", mParser));
0973: assertEquals(template_parsed.getBlock("BLOCK1").getPart(1)
0974: .getData(), getTemplateContent(
0975: "values_short_out_block1_1", mParser));
0976: assertEquals(template_parsed.getBlock("BLOCK1").getPart(2)
0977: .getData(), getTemplateContent(
0978: "values_short_out_block1_2", mParser));
0979: assertEquals(template_parsed.getBlock("BLOCK1").getPart(3)
0980: .getData(), getTemplateContent(
0981: "values_short_out_block1_3", mParser));
0982: assertEquals(template_parsed.getBlock("BLOCK1").getPart(4)
0983: .getData(), getTemplateContent(
0984: "values_short_out_block1_4", mParser));
0985: assertEquals(template_parsed.getBlock("BLOCK2").getPart(0)
0986: .getData(), getTemplateContent(
0987: "values_short_out_block2_0", mParser));
0988: assertEquals(template_parsed.getBlock("BLOCK2").getPart(1)
0989: .getData(), getTemplateContent(
0990: "values_short_out_block2_1", mParser));
0991: assertEquals(template_parsed.getBlock("BLOCK2").getPart(2)
0992: .getData(), getTemplateContent(
0993: "values_short_out_block2_2", mParser));
0994: assertEquals(template_parsed.getBlock("BLOCK3").getPart(0)
0995: .getData(), getTemplateContent(
0996: "values_short_out_block3_0", mParser));
0997: } catch (TemplateException e) {
0998: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
0999: }
1000: }
1001:
1002: public void testParseValuesShortEscaped() {
1003: try {
1004: Parsed template_parsed = mParser.parse(
1005: "values_short_escaped_in", null, null);
1006: assertEquals(template_parsed.getBlocks().size(), 2);
1007: assertNotNull(template_parsed.getContent());
1008: assertNotNull(template_parsed.getBlock("BLOCK1"));
1009: assertEquals(template_parsed.getContent().countParts(), 5);
1010: assertEquals(template_parsed.getBlock("BLOCK1")
1011: .countParts(), 3);
1012: assertEquals(template_parsed.getContent().getPart(0)
1013: .getData(), getTemplateContent(
1014: "values_short_escaped_out_content_0", mParser));
1015: assertEquals(template_parsed.getContent().getPart(1)
1016: .getData(), getTemplateContent(
1017: "values_short_escaped_out_content_1", mParser));
1018: assertEquals(template_parsed.getContent().getPart(2)
1019: .getData(), getTemplateContent(
1020: "values_short_escaped_out_content_2", mParser));
1021: assertEquals(template_parsed.getContent().getPart(3)
1022: .getData(), getTemplateContent(
1023: "values_short_escaped_out_content_3", mParser));
1024: assertEquals(template_parsed.getContent().getPart(4)
1025: .getData(), getTemplateContent(
1026: "values_short_escaped_out_content_4", mParser));
1027: assertEquals(template_parsed.getBlock("BLOCK1").getPart(0)
1028: .getData(), getTemplateContent(
1029: "values_short_escaped_out_block1_0", mParser));
1030: assertEquals(template_parsed.getBlock("BLOCK1").getPart(1)
1031: .getData(), getTemplateContent(
1032: "values_short_escaped_out_block1_1", mParser));
1033: assertEquals(template_parsed.getBlock("BLOCK1").getPart(2)
1034: .getData(), getTemplateContent(
1035: "values_short_escaped_out_block1_2", mParser));
1036: } catch (TemplateException e) {
1037: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1038: }
1039: }
1040:
1041: public void testParseIncludes() {
1042: try {
1043: Parsed template_parsed = mParser.parse(
1044: "includes_master_in", null, null);
1045: assertEquals(template_parsed.getBlocks().size(), 1);
1046: assertNotNull(template_parsed.getContent());
1047: assertEquals(template_parsed.getContent().countParts(), 1);
1048: assertEquals(template_parsed.getContent().getPart(0)
1049: .getData(), getTemplateContent(
1050: "includes_out_content", mParser));
1051: } catch (TemplateException e) {
1052: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1053: }
1054: }
1055:
1056: public void testParseIncludesUnquoted() {
1057: try {
1058: Parsed template_parsed = mParser.parse(
1059: "includes_unquoted_in", null, null);
1060: assertEquals(template_parsed.getBlocks().size(), 1);
1061: assertNotNull(template_parsed.getContent());
1062: assertEquals(template_parsed.getContent().countParts(), 1);
1063: assertEquals(template_parsed.getContent().getPart(0)
1064: .getData(), getTemplateContent(
1065: "includes_unquoted_out_content", mParser));
1066: } catch (TemplateException e) {
1067: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1068: }
1069: }
1070:
1071: public void testParseIncludesOtherType() {
1072: try {
1073: Parsed template_parsed = mParser.parse(
1074: "includes_othertype_in", null, null);
1075: assertEquals(template_parsed.getBlocks().size(), 2);
1076: assertNotNull(template_parsed.getContent());
1077: assertEquals(template_parsed.getContent().countParts(), 5);
1078: assertEquals(template_parsed.getContent().getPart(0)
1079: .getData(), getTemplateContent(
1080: "includes_othertype_out_content_0", mParser));
1081: assertEquals(template_parsed.getContent().getPart(1)
1082: .getData(), getTemplateContent(
1083: "includes_othertype_out_content_1", mParser));
1084: assertEquals(template_parsed.getContent().getPart(2)
1085: .getData(), getTemplateContent(
1086: "includes_othertype_out_content_2", mParser));
1087: assertEquals(template_parsed.getContent().getPart(3)
1088: .getData(), getTemplateContent(
1089: "includes_othertype_out_content_3", mParser));
1090: assertEquals(template_parsed.getContent().getPart(4)
1091: .getData(), getTemplateContent(
1092: "includes_othertype_out_content_4", mParser));
1093: } catch (TemplateException e) {
1094: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1095: }
1096: }
1097:
1098: public void testParseIncludesEscaped() {
1099: try {
1100: Parsed template_parsed = mParser.parse(
1101: "includes_escaped_master_in", null, null);
1102: assertEquals(template_parsed.getBlocks().size(), 1);
1103: assertNotNull(template_parsed.getContent());
1104: assertEquals(template_parsed.getContent().countParts(), 1);
1105: assertEquals(template_parsed.getContent().getPart(0)
1106: .getData(), getTemplateContent(
1107: "includes_escaped_out_content", mParser));
1108: } catch (TemplateException e) {
1109: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1110: }
1111: }
1112:
1113: public void testEncodingLatin() {
1114: try {
1115: Parsed template_ascii = TemplateFactory.TXT.getParser()
1116: .parse("encoding_latin_ascii", "US-ASCII", null);
1117: Parsed template_utf_16le = TemplateFactory.TXT.getParser()
1118: .parse("encoding_latin_utf16le", "UTF-16LE", null);
1119: Parsed template_ascii_wrong = TemplateFactory.TXT
1120: .getParser().parse("encoding_latin_ascii",
1121: "UTF-16LE", null);
1122: Parsed template_utf_16le_wrong = TemplateFactory.TXT
1123: .getParser().parse("encoding_latin_utf16le",
1124: "US-ASCII", null);
1125:
1126: assertTrue(template_ascii.getContent().getPart(0).getData()
1127: .equals(
1128: template_utf_16le.getContent().getPart(0)
1129: .getData()));
1130: assertTrue(!template_utf_16le.getContent().getPart(0)
1131: .getData().equals(
1132: template_utf_16le_wrong.getContent()
1133: .getPart(0).getData()));
1134: assertTrue(!template_ascii.getContent().getPart(0)
1135: .getData().equals(
1136: template_ascii_wrong.getContent()
1137: .getPart(0).getData()));
1138: } catch (TemplateException e) {
1139: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1140: }
1141: }
1142:
1143: public void testEncodingLatin1() {
1144: try {
1145: Parsed template_iso8859_1 = TemplateFactory.TXT.getParser()
1146: .parse("encoding_latin1_iso88591", "ISO8859-1",
1147: null);
1148: Parsed template_utf_8 = TemplateFactory.TXT.getParser()
1149: .parse("encoding_latin1_utf8", "UTF-8", null);
1150: Parsed template_iso8859_1_wrong = TemplateFactory.TXT
1151: .getParser().parse("encoding_latin1_iso88591",
1152: "UTF-8", null);
1153: Parsed template_utf_8_wrong = TemplateFactory.TXT
1154: .getParser().parse("encoding_latin1_utf8",
1155: "ISO8859-1", null);
1156:
1157: assertTrue(template_iso8859_1.getContent().getPart(0)
1158: .getData().equals(
1159: template_utf_8.getContent().getPart(0)
1160: .getData()));
1161: assertTrue(!template_iso8859_1.getContent().getPart(0)
1162: .getData().equals(
1163: template_iso8859_1_wrong.getContent()
1164: .getPart(0).getData()));
1165: assertTrue(!template_utf_8.getContent().getPart(0)
1166: .getData().equals(
1167: template_utf_8_wrong.getContent()
1168: .getPart(0).getData()));
1169: } catch (TemplateException e) {
1170: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1171: }
1172: }
1173:
1174: public void testEncodingNonLatin() {
1175: try {
1176: Parsed template_utf_8 = TemplateFactory.TXT.getParser()
1177: .parse("encoding_nonlatin_utf8", "UTF-8", null);
1178: Parsed template_utf_8_wrong = TemplateFactory.TXT
1179: .getParser().parse("encoding_nonlatin_utf8",
1180: "ISO8859-1", null);
1181: Parsed template_utf_16be = TemplateFactory.TXT.getParser()
1182: .parse("encoding_nonlatin_utf16be", "UTF-16BE",
1183: null);
1184: Parsed template_utf_16be_wrong = TemplateFactory.TXT
1185: .getParser().parse("encoding_nonlatin_utf16be",
1186: "UTF-16LE", null);
1187:
1188: assertTrue(template_utf_8.getContent().getPart(0).getData()
1189: .equals(
1190: template_utf_16be.getContent().getPart(0)
1191: .getData()));
1192: assertTrue(!template_utf_8.getContent().getPart(0)
1193: .getData().equals(
1194: template_utf_8_wrong.getContent()
1195: .getPart(0).getData()));
1196: assertTrue(!template_utf_16be.getContent().getPart(0)
1197: .getData().equals(
1198: template_utf_16be_wrong.getContent()
1199: .getPart(0).getData()));
1200: } catch (TemplateException e) {
1201: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1202: }
1203: }
1204:
1205: public void testParseFilteredBlocks() {
1206: try {
1207: Parser parser = null;
1208: Parsed template_parsed = null;
1209: FilteredTagsMap filtered_blocks_map = null;
1210:
1211: String filter1 = "^FILTER1:(\\w+):CONST:(\\w+)$";
1212: String filter2 = "^FILTER2:(\\w+)$";
1213: String filter3 = "^CONST-FILTER3:(\\w+)$";
1214: String filter4 = "(\\w+)";
1215: FilteredTags filtered_blocks = null;
1216:
1217: parser = new Parser(
1218: TemplateFactory.HTML,
1219: "html",
1220: new Parser.Config[] { TemplateFactory.CONFIG_INVISIBLE_XML },
1221: ".html", (Pattern[]) null, (Pattern[]) null);
1222: template_parsed = parser.parse("blocks_filtered_in", null,
1223: null);
1224: filtered_blocks_map = template_parsed
1225: .getFilteredBlocksMap();
1226: assertNull(filtered_blocks_map);
1227:
1228: parser = new Parser(
1229: TemplateFactory.HTML,
1230: "html",
1231: new Parser.Config[] { TemplateFactory.CONFIG_INVISIBLE_XML },
1232: ".html", new Pattern[] { Pattern.compile(filter1),
1233: Pattern.compile(filter2),
1234: Pattern.compile(filter3),
1235: Pattern.compile(filter4) }, null);
1236: template_parsed = parser.parse("blocks_filtered_in", null,
1237: null);
1238: filtered_blocks_map = template_parsed
1239: .getFilteredBlocksMap();
1240: assertNotNull(filtered_blocks_map);
1241:
1242: assertTrue(filtered_blocks_map.containsFilter(filter1));
1243: assertTrue(filtered_blocks_map.containsFilter(filter2));
1244: assertTrue(filtered_blocks_map.containsFilter(filter3));
1245: assertFalse(filtered_blocks_map.containsFilter(filter4));
1246:
1247: filtered_blocks = filtered_blocks_map
1248: .getFilteredTag(filter1);
1249: assertEquals(3, filtered_blocks.size());
1250:
1251: boolean filter1_got_block1 = false;
1252: boolean filter1_got_block2 = false;
1253: boolean filter1_got_block3 = false;
1254: for (String[] block_groups : filtered_blocks) {
1255: assertEquals(3, block_groups.length);
1256: if (block_groups[0]
1257: .equals("FILTER1:BLOCK1a:CONST:BLOCK1b")
1258: && block_groups[1].equals("BLOCK1a")
1259: && block_groups[2].equals("BLOCK1b")) {
1260: filter1_got_block1 = true;
1261: } else if (block_groups[0]
1262: .equals("FILTER1:BLOCK2a:CONST:BLOCK2b")
1263: && block_groups[1].equals("BLOCK2a")
1264: && block_groups[2].equals("BLOCK2b")) {
1265: filter1_got_block2 = true;
1266: } else if (block_groups[0]
1267: .equals("FILTER1:BLOCK3a:CONST:BLOCK3b")
1268: && block_groups[1].equals("BLOCK3a")
1269: && block_groups[2].equals("BLOCK3b")) {
1270: filter1_got_block3 = true;
1271: }
1272: }
1273: assertTrue(filter1_got_block1 && filter1_got_block2
1274: && filter1_got_block3);
1275:
1276: filtered_blocks = filtered_blocks_map
1277: .getFilteredTag(filter2);
1278: assertEquals(2, filtered_blocks.size());
1279:
1280: boolean filter2_got_block1 = false;
1281: boolean filter2_got_block2 = false;
1282: for (String[] block_groups : filtered_blocks) {
1283: assertEquals(2, block_groups.length);
1284: if (block_groups[0].equals("FILTER2:BLOCK1")
1285: && block_groups[1].equals("BLOCK1")) {
1286: filter2_got_block1 = true;
1287: } else if (block_groups[0].equals("FILTER2:BLOCK2")
1288: && block_groups[1].equals("BLOCK2")) {
1289: filter2_got_block2 = true;
1290: }
1291: }
1292: assertTrue(filter2_got_block1 && filter2_got_block2);
1293:
1294: filtered_blocks = filtered_blocks_map
1295: .getFilteredTag(filter3);
1296: assertEquals(2, filtered_blocks.size());
1297:
1298: boolean filter3_got_block1 = false;
1299: boolean filter3_got_block2 = false;
1300: for (String[] block_groups : filtered_blocks) {
1301: assertEquals(2, block_groups.length);
1302: if (block_groups[0].equals("CONST-FILTER3:BLOCK1")
1303: && block_groups[1].equals("BLOCK1")) {
1304: filter3_got_block1 = true;
1305: } else if (block_groups[0]
1306: .equals("CONST-FILTER3:BLOCK2")
1307: && block_groups[1].equals("BLOCK2")) {
1308: filter3_got_block2 = true;
1309: }
1310: }
1311: assertTrue(filter3_got_block1 && filter3_got_block2);
1312:
1313: parser = new Parser(
1314: TemplateFactory.HTML,
1315: "html",
1316: new Parser.Config[] { TemplateFactory.CONFIG_INVISIBLE_XML },
1317: ".html", new Pattern[] { Pattern.compile(filter4),
1318: Pattern.compile(filter1),
1319: Pattern.compile(filter2),
1320: Pattern.compile(filter3) }, null);
1321: template_parsed = parser.parse("blocks_filtered_in", null,
1322: null);
1323: filtered_blocks_map = template_parsed
1324: .getFilteredBlocksMap();
1325: assertNotNull(filtered_blocks_map);
1326:
1327: assertFalse(filtered_blocks_map.containsFilter(filter1));
1328: assertFalse(filtered_blocks_map.containsFilter(filter2));
1329: assertFalse(filtered_blocks_map.containsFilter(filter3));
1330: assertTrue(filtered_blocks_map.containsFilter(filter4));
1331:
1332: filtered_blocks = filtered_blocks_map
1333: .getFilteredTag(filter4);
1334: assertEquals(7, filtered_blocks.size());
1335:
1336: boolean filter4_got_block1 = false;
1337: boolean filter4_got_block2 = false;
1338: boolean filter4_got_block3 = false;
1339: boolean filter4_got_block4 = false;
1340: boolean filter4_got_block5 = false;
1341: boolean filter4_got_block6 = false;
1342: boolean filter4_got_block7 = false;
1343: for (String[] block_groups : filtered_blocks) {
1344: if (block_groups[0]
1345: .equals("FILTER1:BLOCK1a:CONST:BLOCK1b")
1346: && block_groups[1].equals("FILTER1")
1347: && block_groups[2].equals("BLOCK1a")
1348: && block_groups[3].equals("CONST")
1349: && block_groups[4].equals("BLOCK1b")) {
1350: assertEquals(5, block_groups.length);
1351: filter4_got_block1 = true;
1352: continue;
1353: }
1354: if (block_groups[0]
1355: .equals("FILTER1:BLOCK2a:CONST:BLOCK2b")
1356: && block_groups[1].equals("FILTER1")
1357: && block_groups[2].equals("BLOCK2a")
1358: && block_groups[3].equals("CONST")
1359: && block_groups[4].equals("BLOCK2b")) {
1360: assertEquals(5, block_groups.length);
1361: filter4_got_block2 = true;
1362: continue;
1363: }
1364: if (block_groups[0]
1365: .equals("FILTER1:BLOCK3a:CONST:BLOCK3b")
1366: && block_groups[1].equals("FILTER1")
1367: && block_groups[2].equals("BLOCK3a")
1368: && block_groups[3].equals("CONST")
1369: && block_groups[4].equals("BLOCK3b")) {
1370: assertEquals(5, block_groups.length);
1371: filter4_got_block3 = true;
1372: continue;
1373: }
1374: if (block_groups[0].equals("FILTER2:BLOCK1")
1375: && block_groups[1].equals("FILTER2")
1376: && block_groups[2].equals("BLOCK1")) {
1377: assertEquals(3, block_groups.length);
1378: filter4_got_block4 = true;
1379: continue;
1380: }
1381: if (block_groups[0].equals("FILTER2:BLOCK2")
1382: && block_groups[1].equals("FILTER2")
1383: && block_groups[2].equals("BLOCK2")) {
1384: assertEquals(3, block_groups.length);
1385: filter4_got_block5 = true;
1386: continue;
1387: }
1388: if (block_groups[0].equals("CONST-FILTER3:BLOCK1")
1389: && block_groups[1].equals("CONST")
1390: && block_groups[2].equals("FILTER3")
1391: && block_groups[3].equals("BLOCK1")) {
1392: assertEquals(4, block_groups.length);
1393: filter4_got_block6 = true;
1394: continue;
1395: }
1396: if (block_groups[0].equals("CONST-FILTER3:BLOCK2")
1397: && block_groups[1].equals("CONST")
1398: && block_groups[2].equals("FILTER3")
1399: && block_groups[3].equals("BLOCK2")) {
1400: assertEquals(4, block_groups.length);
1401: filter4_got_block7 = true;
1402: continue;
1403: }
1404: }
1405: assertTrue(filter4_got_block1 && filter4_got_block2
1406: && filter4_got_block3 && filter4_got_block4
1407: && filter4_got_block5 && filter4_got_block6
1408: && filter4_got_block7);
1409: } catch (TemplateException e) {
1410: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1411: }
1412: }
1413:
1414: public void testParseFilteredValues() {
1415: try {
1416: Parser parser = null;
1417: Parsed template_parsed = null;
1418: FilteredTagsMap filtered_values_map = null;
1419:
1420: String filter1 = "^FILTER1:(\\w+):CONST:(\\w+)$";
1421: String filter2 = "^FILTER2:(\\w+)$";
1422: String filter3 = "^CONST-FILTER3:(\\w+)$";
1423: String filter4 = "(\\w+)";
1424: FilteredTags filtered_values = null;
1425:
1426: parser = new Parser(
1427: TemplateFactory.HTML,
1428: "html",
1429: new Parser.Config[] { TemplateFactory.CONFIG_INVISIBLE_XML },
1430: ".html", (Pattern[]) null, (Pattern[]) null);
1431: template_parsed = parser.parse("values_filtered_in", null,
1432: null);
1433: filtered_values_map = template_parsed
1434: .getFilteredValuesMap();
1435: assertNull(filtered_values_map);
1436:
1437: parser = new Parser(
1438: TemplateFactory.HTML,
1439: "html",
1440: new Parser.Config[] { TemplateFactory.CONFIG_INVISIBLE_XML },
1441: ".html", null, new Pattern[] {
1442: Pattern.compile(filter1),
1443: Pattern.compile(filter2),
1444: Pattern.compile(filter3),
1445: Pattern.compile(filter4) });
1446: template_parsed = parser.parse("values_filtered_in", null,
1447: null);
1448: filtered_values_map = template_parsed
1449: .getFilteredValuesMap();
1450: assertNotNull(filtered_values_map);
1451:
1452: assertTrue(filtered_values_map.containsFilter(filter1));
1453: assertTrue(filtered_values_map.containsFilter(filter2));
1454: assertTrue(filtered_values_map.containsFilter(filter3));
1455: assertFalse(filtered_values_map.containsFilter(filter4));
1456:
1457: filtered_values = filtered_values_map
1458: .getFilteredTag(filter1);
1459: assertEquals(3, filtered_values.size());
1460:
1461: boolean filter1_got_value1 = false;
1462: boolean filter1_got_value2 = false;
1463: boolean filter1_got_value3 = false;
1464: for (String[] value_groups : filtered_values) {
1465: assertEquals(3, value_groups.length);
1466: if (value_groups[0]
1467: .equals("FILTER1:VALUE1a:CONST:VALUE1b")
1468: && value_groups[1].equals("VALUE1a")
1469: && value_groups[2].equals("VALUE1b")) {
1470: filter1_got_value1 = true;
1471: } else if (value_groups[0]
1472: .equals("FILTER1:VALUE2a:CONST:VALUE2b")
1473: && value_groups[1].equals("VALUE2a")
1474: && value_groups[2].equals("VALUE2b")) {
1475: filter1_got_value2 = true;
1476: } else if (value_groups[0]
1477: .equals("FILTER1:VALUE3a:CONST:VALUE3b")
1478: && value_groups[1].equals("VALUE3a")
1479: && value_groups[2].equals("VALUE3b")) {
1480: filter1_got_value3 = true;
1481: }
1482: }
1483: assertTrue(filter1_got_value1 && filter1_got_value2
1484: && filter1_got_value3);
1485:
1486: filtered_values = filtered_values_map
1487: .getFilteredTag(filter2);
1488: assertEquals(2, filtered_values.size());
1489:
1490: boolean filter2_got_value1 = false;
1491: boolean filter2_got_value2 = false;
1492: for (String[] value_groups : filtered_values) {
1493: assertEquals(2, value_groups.length);
1494: if (value_groups[0].equals("FILTER2:VALUE1")
1495: && value_groups[1].equals("VALUE1")) {
1496: filter2_got_value1 = true;
1497: } else if (value_groups[0].equals("FILTER2:VALUE2")
1498: && value_groups[1].equals("VALUE2")) {
1499: filter2_got_value2 = true;
1500: }
1501: }
1502: assertTrue(filter2_got_value1 && filter2_got_value2);
1503:
1504: filtered_values = filtered_values_map
1505: .getFilteredTag(filter3);
1506: assertEquals(2, filtered_values.size());
1507:
1508: boolean filter3_got_value1 = false;
1509: boolean filter3_got_value2 = false;
1510: for (String[] value_groups : filtered_values) {
1511: assertEquals(2, value_groups.length);
1512: if (value_groups[0].equals("CONST-FILTER3:VALUE1")
1513: && value_groups[1].equals("VALUE1")) {
1514: filter3_got_value1 = true;
1515: } else if (value_groups[0]
1516: .equals("CONST-FILTER3:VALUE2")
1517: && value_groups[1].equals("VALUE2")) {
1518: filter3_got_value2 = true;
1519: }
1520: }
1521: assertTrue(filter3_got_value1 && filter3_got_value2);
1522:
1523: parser = new Parser(
1524: TemplateFactory.HTML,
1525: "html",
1526: new Parser.Config[] { TemplateFactory.CONFIG_INVISIBLE_XML },
1527: ".html", null, new Pattern[] {
1528: Pattern.compile(filter4),
1529: Pattern.compile(filter1),
1530: Pattern.compile(filter2),
1531: Pattern.compile(filter3) });
1532: template_parsed = parser.parse("values_filtered_in", null,
1533: null);
1534: filtered_values_map = template_parsed
1535: .getFilteredValuesMap();
1536: assertNotNull(filtered_values_map);
1537:
1538: assertFalse(filtered_values_map.containsFilter(filter1));
1539: assertFalse(filtered_values_map.containsFilter(filter2));
1540: assertFalse(filtered_values_map.containsFilter(filter3));
1541: assertTrue(filtered_values_map.containsFilter(filter4));
1542:
1543: filtered_values = filtered_values_map
1544: .getFilteredTag(filter4);
1545: assertEquals(7, filtered_values.size());
1546:
1547: boolean filter4_got_value1 = false;
1548: boolean filter4_got_value2 = false;
1549: boolean filter4_got_value3 = false;
1550: boolean filter4_got_value4 = false;
1551: boolean filter4_got_value5 = false;
1552: boolean filter4_got_value6 = false;
1553: boolean filter4_got_value7 = false;
1554: for (String[] value_groups : filtered_values) {
1555: if (value_groups[0]
1556: .equals("FILTER1:VALUE1a:CONST:VALUE1b")
1557: && value_groups[1].equals("FILTER1")
1558: && value_groups[2].equals("VALUE1a")
1559: && value_groups[3].equals("CONST")
1560: && value_groups[4].equals("VALUE1b")) {
1561: assertEquals(5, value_groups.length);
1562: filter4_got_value1 = true;
1563: continue;
1564: }
1565: if (value_groups[0]
1566: .equals("FILTER1:VALUE2a:CONST:VALUE2b")
1567: && value_groups[1].equals("FILTER1")
1568: && value_groups[2].equals("VALUE2a")
1569: && value_groups[3].equals("CONST")
1570: && value_groups[4].equals("VALUE2b")) {
1571: assertEquals(5, value_groups.length);
1572: filter4_got_value2 = true;
1573: continue;
1574: }
1575: if (value_groups[0]
1576: .equals("FILTER1:VALUE3a:CONST:VALUE3b")
1577: && value_groups[1].equals("FILTER1")
1578: && value_groups[2].equals("VALUE3a")
1579: && value_groups[3].equals("CONST")
1580: && value_groups[4].equals("VALUE3b")) {
1581: assertEquals(5, value_groups.length);
1582: filter4_got_value3 = true;
1583: continue;
1584: }
1585: if (value_groups[0].equals("FILTER2:VALUE1")
1586: && value_groups[1].equals("FILTER2")
1587: && value_groups[2].equals("VALUE1")) {
1588: assertEquals(3, value_groups.length);
1589: filter4_got_value4 = true;
1590: continue;
1591: }
1592: if (value_groups[0].equals("FILTER2:VALUE2")
1593: && value_groups[1].equals("FILTER2")
1594: && value_groups[2].equals("VALUE2")) {
1595: assertEquals(3, value_groups.length);
1596: filter4_got_value5 = true;
1597: continue;
1598: }
1599: if (value_groups[0].equals("CONST-FILTER3:VALUE1")
1600: && value_groups[1].equals("CONST")
1601: && value_groups[2].equals("FILTER3")
1602: && value_groups[3].equals("VALUE1")) {
1603: assertEquals(4, value_groups.length);
1604: filter4_got_value6 = true;
1605: continue;
1606: }
1607: if (value_groups[0].equals("CONST-FILTER3:VALUE2")
1608: && value_groups[1].equals("CONST")
1609: && value_groups[2].equals("FILTER3")
1610: && value_groups[3].equals("VALUE2")) {
1611: assertEquals(4, value_groups.length);
1612: filter4_got_value7 = true;
1613: continue;
1614: }
1615: }
1616: assertTrue(filter4_got_value1 && filter4_got_value2
1617: && filter4_got_value3 && filter4_got_value4
1618: && filter4_got_value5 && filter4_got_value6
1619: && filter4_got_value7);
1620: } catch (TemplateException e) {
1621: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1622: }
1623: }
1624:
1625: public void testErrorTerminatingUnopenedValue() {
1626: try {
1627: mParser.parse("error_terminating_unopened_value", null,
1628: null);
1629: fail();
1630: } catch (TerminatingUnopenedTagException e) {
1631: assertEquals("<!--V 'avalue'/--><!--/V-->", e
1632: .getErrorLocation().getLineContent());
1633: assertEquals(1, e.getErrorLocation().getLine());
1634: assertEquals(19, e.getErrorLocation().getColumn());
1635: assertEquals(e.getTemplateName(),
1636: "error_terminating_unopened_value");
1637: assertEquals(e.getTagType(), "V");
1638: } catch (TemplateException e) {
1639: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1640: }
1641: }
1642:
1643: public void testErrorTerminatingUnopenedBlock() {
1644: try {
1645: mParser.parse("error_terminating_unopened_block", null,
1646: null);
1647: fail();
1648: } catch (TerminatingUnopenedTagException e) {
1649: assertEquals("<!--/B-->", e.getErrorLocation()
1650: .getLineContent());
1651: assertEquals(1, e.getErrorLocation().getLine());
1652: assertEquals(1, e.getErrorLocation().getColumn());
1653: assertEquals(e.getTemplateName(),
1654: "error_terminating_unopened_block");
1655: assertEquals(e.getTagType(), "B");
1656: } catch (TemplateException e) {
1657: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1658: }
1659: }
1660:
1661: public void testErrorTerminatingUnopenedBlockvalue() {
1662: try {
1663: mParser.parse("error_terminating_unopened_blockvalue",
1664: null, null);
1665: fail();
1666: } catch (TerminatingUnopenedTagException e) {
1667: assertEquals("<!--/BV-->", e.getErrorLocation()
1668: .getLineContent());
1669: assertEquals(1, e.getErrorLocation().getLine());
1670: assertEquals(1, e.getErrorLocation().getColumn());
1671: assertEquals(e.getTemplateName(),
1672: "error_terminating_unopened_blockvalue");
1673: assertEquals(e.getTagType(), "BV");
1674: } catch (TemplateException e) {
1675: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1676: }
1677: }
1678:
1679: public void testErrorTerminatingUnopenedComment() {
1680: try {
1681: mParser.parse("error_terminating_unopened_comment", null,
1682: null);
1683: fail();
1684: } catch (TerminatingUnopenedTagException e) {
1685: assertEquals("<!--/C-->", e.getErrorLocation()
1686: .getLineContent());
1687: assertEquals(1, e.getErrorLocation().getLine());
1688: assertEquals(1, e.getErrorLocation().getColumn());
1689: assertEquals(e.getTemplateName(),
1690: "error_terminating_unopened_comment");
1691: assertEquals(e.getTagType(), "C");
1692: } catch (TemplateException e) {
1693: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1694: }
1695: }
1696:
1697: public void testErrorIncludeNotFound() {
1698: try {
1699: mParser.parse("error_include_not_found", null, null);
1700: fail();
1701: } catch (IncludeNotFoundException e) {
1702: assertEquals(" <!--I 'error_missing_include'/-->", e
1703: .getErrorLocation().getLineContent());
1704: assertEquals(8, e.getErrorLocation().getLine());
1705: assertEquals(3, e.getErrorLocation().getColumn());
1706: assertEquals(e.getTemplateName(), "error_include_not_found");
1707: assertEquals(e.getIncluded(), "error_missing_include");
1708: } catch (TemplateException e) {
1709: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1710: }
1711: }
1712:
1713: public void testErrorCircularIncludes() {
1714: try {
1715: mParser.parse("error_circular_includes_master", null, null);
1716: fail();
1717: } catch (CircularIncludesException e) {
1718: assertEquals("<!--I 'error_circular_includes_master'/-->",
1719: e.getErrorLocation().getLineContent());
1720: assertEquals(1, e.getErrorLocation().getLine());
1721: assertEquals(1, e.getErrorLocation().getColumn());
1722: assertTrue(e.getPreviousIncludes().contains(
1723: mParser.getPackage()
1724: + "error_circular_includes_master"));
1725: assertTrue(e.getPreviousIncludes().contains(
1726: mParser.getPackage()
1727: + "error_circular_includes_included"));
1728: assertEquals(e.getIncluded(),
1729: "error_circular_includes_master");
1730: } catch (TemplateException e) {
1731: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1732: }
1733: }
1734:
1735: public void testErrorIncludeBadlyTerminated() {
1736: try {
1737: mParser.parse("error_include_badly_terminated", null, null);
1738: fail();
1739: } catch (TagBadlyTerminatedException e) {
1740: assertEquals(
1741: " <!--I 'error_badly_terminated_include' erzer /-->",
1742: e.getErrorLocation().getLineContent());
1743: assertEquals(8, e.getErrorLocation().getLine());
1744: assertEquals(48, e.getErrorLocation().getColumn());
1745: assertEquals(e.getTemplateName(),
1746: "error_include_badly_terminated");
1747: assertEquals(e.getTagType(), "I");
1748: assertEquals(e.getTagId(), "error_badly_terminated_include");
1749: } catch (TemplateException e) {
1750: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1751: }
1752: }
1753:
1754: public void testErrorValueNameAttributeNotEnded() {
1755: try {
1756: mParser.parse("error_value_name_attribute_not_ended", null,
1757: null);
1758: fail();
1759: } catch (AttributeNotEndedException e) {
1760: assertEquals(" <!--V 'VALUE1/-->", e.getErrorLocation()
1761: .getLineContent());
1762: assertEquals(8, e.getErrorLocation().getLine());
1763: assertEquals(10, e.getErrorLocation().getColumn());
1764: assertEquals(e.getTemplateName(),
1765: "error_value_name_attribute_not_ended");
1766: assertEquals(e.getTagType(), "V");
1767: assertEquals(e.getAttributeName(), "name");
1768: } catch (TemplateException e) {
1769: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1770: }
1771: }
1772:
1773: public void testErrorValueNameAttributeNotDelimitedInBegin() {
1774: try {
1775: mParser
1776: .parse(
1777: "error_value_name_attribute_not_delimited_in_begin",
1778: null, null);
1779: fail();
1780: } catch (AttributeWronglyEndedException e) {
1781: assertEquals(" <!--V VALUE1'/-->", e.getErrorLocation()
1782: .getLineContent());
1783: assertEquals(8, e.getErrorLocation().getLine());
1784: assertEquals(15, e.getErrorLocation().getColumn());
1785: assertEquals(e.getTemplateName(),
1786: "error_value_name_attribute_not_delimited_in_begin");
1787: assertEquals(e.getTagType(), "V");
1788: assertEquals(e.getAttributeName(), "name");
1789: } catch (TemplateException e) {
1790: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1791: }
1792: }
1793:
1794: public void testErrorValueTagNotTerminated() {
1795: try {
1796: mParser.parse("error_value_tag_not_terminated", null, null);
1797: fail();
1798: } catch (TagNotTerminatedException e) {
1799: assertEquals(" <!--V 'VALUE1'-->", e.getErrorLocation()
1800: .getLineContent());
1801: assertEquals(8, e.getErrorLocation().getLine());
1802: assertEquals(3, e.getErrorLocation().getColumn());
1803: assertEquals(e.getTemplateName(),
1804: "error_value_tag_not_terminated");
1805: assertEquals(e.getTagType(), "V");
1806: assertEquals(e.getTagId(), "VALUE1");
1807: } catch (TemplateException e) {
1808: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1809: }
1810: }
1811:
1812: public void testErrorValueShortBeginTagBadlyTerminated() {
1813: try {
1814: mParser.parse("error_valueshort_begin_badly_terminated",
1815: null, null);
1816: fail();
1817: } catch (BeginTagBadlyTerminatedException e) {
1818: assertEquals(" <!--V 'VALUE1' eff /-->", e
1819: .getErrorLocation().getLineContent());
1820: assertEquals(8, e.getErrorLocation().getLine());
1821: assertEquals(17, e.getErrorLocation().getColumn());
1822: assertEquals(e.getTemplateName(),
1823: "error_valueshort_begin_badly_terminated");
1824: assertEquals(e.getTagType(), "V");
1825: assertEquals(e.getTagId(), "VALUE1");
1826: } catch (TemplateException e) {
1827: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1828: }
1829: }
1830:
1831: public void testErrorValueLongBeginTagBadlyTerminated() {
1832: try {
1833: mParser.parse("error_valuelong_begin_badly_terminated",
1834: null, null);
1835: fail();
1836: } catch (BeginTagBadlyTerminatedException e) {
1837: assertEquals(" <!--V 'VALUE1' eff --><!--/V-->", e
1838: .getErrorLocation().getLineContent());
1839: assertEquals(8, e.getErrorLocation().getLine());
1840: assertEquals(17, e.getErrorLocation().getColumn());
1841: assertEquals(e.getTemplateName(),
1842: "error_valuelong_begin_badly_terminated");
1843: assertEquals(e.getTagType(), "V");
1844: assertEquals(e.getTagId(), "VALUE1");
1845: } catch (TemplateException e) {
1846: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1847: }
1848: }
1849:
1850: public void testErrorUnsupportedNestedValueTag() {
1851: try {
1852: mParser.parse("error_unsupported_nested_value_tag", null,
1853: null);
1854: fail();
1855: } catch (UnsupportedNestedTagException e) {
1856: assertEquals(" <!--V 'VALUE2'/-->", e.getErrorLocation()
1857: .getLineContent());
1858: assertEquals(9, e.getErrorLocation().getLine());
1859: assertEquals(3, e.getErrorLocation().getColumn());
1860: assertEquals(e.getTemplateName(),
1861: "error_unsupported_nested_value_tag");
1862: assertEquals(e.getTagType(), "V");
1863: assertEquals(e.getTagId(), "VALUE1");
1864: } catch (TemplateException e) {
1865: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1866: }
1867: }
1868:
1869: public void testErrorValueBeginTagNotEnded() {
1870: try {
1871: mParser
1872: .parse("error_value_begin_tag_not_ended", null,
1873: null);
1874: fail();
1875: } catch (BeginTagNotEndedException e) {
1876: assertEquals(" <!--V 'VALUE1'", e.getErrorLocation()
1877: .getLineContent());
1878: assertEquals(8, e.getErrorLocation().getLine());
1879: assertEquals(17, e.getErrorLocation().getColumn());
1880: assertEquals(e.getTemplateName(),
1881: "error_value_begin_tag_not_ended");
1882: assertEquals(e.getTagType(), "V");
1883: assertEquals(e.getTagId(), "VALUE1");
1884: } catch (TemplateException e) {
1885: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1886: }
1887: }
1888:
1889: public void testErrorCommentMissingTerminationTag() {
1890: try {
1891: mParser.parse("error_comment_missing_termination_tag",
1892: null, null);
1893: fail();
1894: } catch (MissingTerminationTagsException e) {
1895: assertEquals("</html>", e.getErrorLocation()
1896: .getLineContent());
1897: assertEquals(10, e.getErrorLocation().getLine());
1898: assertEquals(8, e.getErrorLocation().getColumn());
1899: assertEquals(e.getTemplateName(),
1900: "error_comment_missing_termination_tag");
1901: assertEquals(e.getTagType(), "C");
1902: } catch (TemplateException e) {
1903: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1904: }
1905: }
1906:
1907: public void testErrorBlockNameAttributeNotEnded() {
1908: try {
1909: mParser.parse("error_block_name_attribute_not_ended", null,
1910: null);
1911: fail();
1912: } catch (AttributeNotEndedException e) {
1913: assertEquals(" <!--B 'BLOCK1--><!--/B-->", e
1914: .getErrorLocation().getLineContent());
1915: assertEquals(8, e.getErrorLocation().getLine());
1916: assertEquals(10, e.getErrorLocation().getColumn());
1917: assertEquals(e.getTemplateName(),
1918: "error_block_name_attribute_not_ended");
1919: assertEquals(e.getTagType(), "B");
1920: assertEquals(e.getAttributeName(), "name");
1921: } catch (TemplateException e) {
1922: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1923: }
1924: }
1925:
1926: public void testErrorBlockNameAttributeNotDelimitedInBegin() {
1927: try {
1928: mParser
1929: .parse(
1930: "error_block_name_attribute_not_delimited_in_begin",
1931: null, null);
1932: fail();
1933: } catch (AttributeWronglyEndedException e) {
1934: assertEquals(" <!--B BLOCK1'--><!--/B-->", e
1935: .getErrorLocation().getLineContent());
1936: assertEquals(8, e.getErrorLocation().getLine());
1937: assertEquals(15, e.getErrorLocation().getColumn());
1938: assertEquals(e.getTemplateName(),
1939: "error_block_name_attribute_not_delimited_in_begin");
1940: assertEquals(e.getTagType(), "B");
1941: assertEquals(e.getAttributeName(), "name");
1942: } catch (TemplateException e) {
1943: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1944: }
1945: }
1946:
1947: public void testErrorBlockBeginTagNotEnded() {
1948: try {
1949: mParser
1950: .parse("error_block_begin_tag_not_ended", null,
1951: null);
1952: fail();
1953: } catch (BeginTagNotEndedException e) {
1954: assertEquals(" <!--B 'BLOCK1'", e.getErrorLocation()
1955: .getLineContent());
1956: assertEquals(8, e.getErrorLocation().getLine());
1957: assertEquals(16, e.getErrorLocation().getColumn());
1958: assertEquals(e.getTemplateName(),
1959: "error_block_begin_tag_not_ended");
1960: assertEquals(e.getTagType(), "B");
1961: assertEquals(e.getTagId(), "BLOCK1");
1962: } catch (TemplateException e) {
1963: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1964: }
1965: }
1966:
1967: public void testErrorBlockMissingTerminationTag() {
1968: try {
1969: mParser.parse("error_block_missing_termination_tag", null,
1970: null);
1971: fail();
1972: } catch (MissingTerminationTagsException e) {
1973: assertEquals("</html>", e.getErrorLocation()
1974: .getLineContent());
1975: assertEquals(10, e.getErrorLocation().getLine());
1976: assertEquals(8, e.getErrorLocation().getColumn());
1977: assertEquals(e.getTemplateName(),
1978: "error_block_missing_termination_tag");
1979: assertEquals(e.getTagType(), "B");
1980: } catch (TemplateException e) {
1981: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
1982: }
1983: }
1984:
1985: public void testErrorBlockMismatchedTerminationTag1() {
1986: try {
1987: mParser.parse("error_block_mismatched_termination_tag1",
1988: null, null);
1989: fail();
1990: } catch (MismatchedTerminationTagException e) {
1991: assertEquals(" <!--B 'BLOCK1'--><!--/BV-->", e
1992: .getErrorLocation().getLineContent());
1993: assertEquals(8, e.getErrorLocation().getLine());
1994: assertEquals(20, e.getErrorLocation().getColumn());
1995: assertEquals(e.getTemplateName(),
1996: "error_block_mismatched_termination_tag1");
1997: assertEquals(e.getTagId(), "BLOCK1");
1998: assertEquals(e.getExpected(), "B");
1999: assertEquals(e.getActual(), "BV");
2000: } catch (TemplateException e) {
2001: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2002: }
2003: }
2004:
2005: public void testErrorBlockMismatchedTerminationTag2() {
2006: try {
2007: mParser.parse("error_block_mismatched_termination_tag2",
2008: null, null);
2009: fail();
2010: } catch (MismatchedTerminationTagException e) {
2011: assertEquals(" <!--BV 'BLOCK2'--><!--/B-->", e
2012: .getErrorLocation().getLineContent());
2013: assertEquals(8, e.getErrorLocation().getLine());
2014: assertEquals(21, e.getErrorLocation().getColumn());
2015: assertEquals(e.getTemplateName(),
2016: "error_block_mismatched_termination_tag2");
2017: assertEquals(e.getTagId(), "BLOCK2");
2018: assertEquals(e.getExpected(), "BV");
2019: assertEquals(e.getActual(), "B");
2020: } catch (TemplateException e) {
2021: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2022: }
2023: }
2024:
2025: public void testErrorBlockMismatchedTerminationTag3() {
2026: try {
2027: mParser.parse("error_block_mismatched_termination_tag3",
2028: null, null);
2029: fail();
2030: } catch (MismatchedTerminationTagException e) {
2031: assertEquals(" <!--BV 'BLOCK2'--><!--/C-->", e
2032: .getErrorLocation().getLineContent());
2033: assertEquals(8, e.getErrorLocation().getLine());
2034: assertEquals(21, e.getErrorLocation().getColumn());
2035: assertEquals(e.getTemplateName(),
2036: "error_block_mismatched_termination_tag3");
2037: assertEquals(e.getTagId(), "BLOCK2");
2038: assertEquals(e.getExpected(), "BV");
2039: assertEquals(e.getActual(), "C");
2040: } catch (TemplateException e) {
2041: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2042: }
2043: }
2044:
2045: public void testErrorBlockBeginTagBadlyTerminated() {
2046: try {
2047: mParser.parse("error_block_begin_tag_badly_terminated",
2048: null, null);
2049: fail();
2050: } catch (BeginTagBadlyTerminatedException e) {
2051: assertEquals(" <!--B 'BLOCK1' dfsdf --> <!--/B-->", e
2052: .getErrorLocation().getLineContent());
2053: assertEquals(8, e.getErrorLocation().getLine());
2054: assertEquals(17, e.getErrorLocation().getColumn());
2055: assertEquals(e.getTemplateName(),
2056: "error_block_begin_tag_badly_terminated");
2057: assertEquals(e.getTagId(), "BLOCK1");
2058: assertEquals(e.getTagType(), "B");
2059: } catch (TemplateException e) {
2060: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2061: }
2062: }
2063:
2064: public void testErrorBlockValueBeginTagBadlyTerminated() {
2065: try {
2066: mParser.parse(
2067: "error_blockvalue_begin_tag_badly_terminated",
2068: null, null);
2069: fail();
2070: } catch (BeginTagBadlyTerminatedException e) {
2071: assertEquals(" <!--BV 'BLOCK1' dfsdf --> <!--/B-->", e
2072: .getErrorLocation().getLineContent());
2073: assertEquals(8, e.getErrorLocation().getLine());
2074: assertEquals(18, e.getErrorLocation().getColumn());
2075: assertEquals(e.getTemplateName(),
2076: "error_blockvalue_begin_tag_badly_terminated");
2077: assertEquals(e.getTagId(), "BLOCK1");
2078: assertEquals(e.getTagType(), "BV");
2079: } catch (TemplateException e) {
2080: assertTrue(ExceptionUtils.getExceptionStackTrace(e), false);
2081: }
2082: }
2083:
2084: public void testErrorUnsupportedEncoding() {
2085: try {
2086: TemplateFactory.TXT.getParser().parse(
2087: "encoding_nonlatin_utf8",
2088: "THIS_ENCODING_DOESNT_EXIST", null);
2089: fail();
2090: } catch (GetContentErrorException e) {
2091: assertTrue(e.getCause() instanceof com.uwyn.rife.resources.exceptions.ResourceFinderErrorException);
2092: assertTrue(e.getCause().getCause() instanceof com.uwyn.rife.tools.exceptions.FileUtilsErrorException);
2093: assertTrue(e.getCause().getCause().getCause() instanceof java.io.UnsupportedEncodingException);
2094: }
2095: }
2096: }
|