0001: package com.sun.portal.rewriter.engines.xml.test;
0002:
0003: import com.sun.portal.rewriter.Rewriter;
0004: import com.sun.portal.rewriter.RewriterModule;
0005: import com.sun.portal.rewriter.RewriterPool;
0006: import com.sun.portal.rewriter.engines.LanguageConstants;
0007: import com.sun.portal.rewriter.rom.RuleSet;
0008: import com.sun.portal.rewriter.test.util.BasicTestCase;
0009: import com.sun.portal.rewriter.test.util.BasicXMLTestCase;
0010: import com.sun.portal.rewriter.test.util.CreateRuleSet;
0011: import junit.framework.TestSuite;
0012:
0013: public class TestXMLTagTexts extends BasicXMLTestCase {
0014: public TestXMLTagTexts(String aName) {
0015: super (aName);
0016: }//constuctor
0017:
0018: public void testNameSpaceTagText() throws Exception {
0019: //Input,Expectation, Rule
0020: final String[][] lData = {
0021: {
0022: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
0023: + "<x xmlns:xsl='http://ecommerce.org/schema'>"
0024: + "<xsl:attribute name=\"src\">raja.html</xsl:attribute>\n"
0025: + "</x>\n",
0026: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
0027: + "<x xmlns:xsl=\"http://ecommerce.org/schema\">"
0028: + "<xsl:attribute name=\"src\">http://rajanagendra.sun.com/Base/Raja/raja.html</xsl:attribute>\n"
0029: + "</x>",
0030: "<TagText tag=\"xsl:attribute\" attributePatterns=\"name=src\" /> \n" }, //0
0031:
0032: {
0033: "<x xmlns:xsl=\"http://ecommerce.org/schema\">"
0034: + "<xsl:attribute name=\"src\">raja.html</xsl:attribute>\n"
0035: + "</x>\n",
0036: "<x xmlns:xsl=\"http://ecommerce.org/schema\">"
0037: + "<xsl:attribute name=\"src\">http://rajanagendra.sun.com/Base/Raja/raja.html</xsl:attribute>\n"
0038: + "</x>",
0039: "<TagText tag=\"xsl:attribute\" attributePatterns=\"name=src\" /> \n" }, //1
0040:
0041: {
0042: "<x xmlns:xsl=\"http://ecommerce.org/schema\">"
0043: + "<xsl:attribute>raja.html</xsl:attribute>\n"
0044: + "</x>\n",
0045: "<x xmlns:xsl=\"http://ecommerce.org/schema\">"
0046: + "<xsl:attribute>http://rajanagendra.sun.com/Base/Raja/raja.html</xsl:attribute>\n"
0047: + "</x>",
0048: "<TagText tag=\"xsl:attribute\"/> \n" }, //2
0049: };
0050: for (int i = 0; i < lData.length; i++) {
0051: RuleSet lRuleSet = CreateRuleSet
0052: .withXMLTagTextRules(lData[i][2]);
0053: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0054: LanguageConstants.XML_MIME);
0055: String lResult = lRewriter.rewrite(lData[i][0],
0056: getDefaultTranslator());
0057: assertXMLEqual("For i=" + i, lData[i][1], lResult);
0058: }//for loop
0059: }//testNameSpaceTagText()
0060:
0061: public void testTagTexts() throws Exception {
0062: //Input,Expectation, Rule
0063: final String[][] lData = {
0064: {
0065: "<attribute name=\"src\">raja.html</attribute>",
0066: "<attribute name=\"src\">http://rajanagendra.sun.com/Base/Raja/raja.html</attribute>",
0067: "<TagText tag=\"attribute\" attributePatterns=\"name=src\" /> \n" }, //set - 0
0068:
0069: {
0070: "<attribute>raja.html</attribute>",
0071: "<attribute>http://rajanagendra.sun.com/Base/Raja/raja.html</attribute>",
0072: "<TagText tag=\"attribute\"/> \n" }, //set - 1
0073: };
0074:
0075: for (int i = 0; i < lData.length; i++) {
0076: RuleSet lRuleSet = CreateRuleSet
0077: .withXMLTagTextRules(lData[i][2]);
0078: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0079: LanguageConstants.XML_MIME);
0080: String lResult = lRewriter.rewrite(lData[i][0],
0081: getDefaultTranslator());
0082: assertXMLEqual("i=" + i, lData[i][1], lResult);
0083: }//for loop
0084: }//testTagTexts()
0085:
0086: public void testTagTexts2AttributesFail() throws Exception {
0087: //Input,Expectation, Rule
0088: final String[][] lData = {
0089: {
0090: "<attribute name=\"sr1c\" href=\"raja\">raja.html</attribute>",
0091: "<attribute name=\"sr1c\" href=\"raja\">raja.html</attribute>",
0092: "<TagText tag=\"attribute\" attributePatterns=\"name=src;href=raja\" /> \n" }, //set - 0
0093:
0094: {
0095: "<attribute name=\"src\" href=\"raja\">raja.html</attribute>",
0096: "<attribute name=\"src\" href=\"raja\">raja.html</attribute>",
0097: "<TagText tag=\"attribute\" attributePatterns=\"href=raja\" /> \n" }, //set - 1
0098: };
0099:
0100: for (int i = 0; i < lData.length; i++) {
0101: RuleSet lRuleSet = CreateRuleSet
0102: .withXMLTagTextRules(lData[i][2]);
0103: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0104: LanguageConstants.XML_MIME);
0105: String lResult = lRewriter.rewrite(lData[i][0],
0106: getDefaultTranslator());
0107: assertXMLEqual(lData[i][1], lResult);
0108: }//for loop
0109: }//testTagTexts2AttributesFail()
0110:
0111: public void testTagTexts2AttributesPass() throws Exception {
0112: //Input,Expectation, Rule
0113: final String[][] lData = { {
0114: "<attribute name=\"src\" href=\"raja\">raja.html</attribute>",
0115: "<attribute name=\"src\" href=\"raja\">http://rajanagendra.sun.com/Base/Raja/raja.html</attribute>",
0116: "<TagText tag=\"attribute\" attributePatterns=\"name=src;href=raja\" /> \n" }, //set - 0
0117: };
0118: for (int i = 0; i < lData.length; i++) {
0119: RuleSet lRuleSet = CreateRuleSet
0120: .withXMLTagTextRules(lData[i][2]);
0121: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0122: LanguageConstants.XML_MIME);
0123: String lResult = lRewriter.rewrite(lData[i][0],
0124: getDefaultTranslator());
0125: assertXMLEqual(lData[i][1], lResult);
0126: }//for loop
0127: }//testTagTexts2AttributesPass()
0128:
0129: public void testSimpleTagTexts() throws Exception {
0130: //Input,Expectation, Rule
0131: final String[][] lData = {
0132: {
0133: "<xml><attribute name=\"src\">raja.html</attribute><attribute>/raja.html</attribute></xml>",
0134: "<xml><attribute name=\"src\">raja.html</attribute><attribute>http://rajanagendra.sun.com/raja.html</attribute></xml>",
0135: "<TagText tag=\"attribute\" />\n" }, //set - 0
0136:
0137: {
0138: "<XML><prop ab=\"i5\">/mapi/proptag/x0e080003</prop></XML>",
0139: "<XML><prop ab=\"i5\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop></XML>",
0140: "<TagText tag=\"prop\" attributePatterns=\"ab=i5\"/>", }, //2
0141:
0142: {
0143: "<XML><prop ab=\"i5\">/mapi/proptag/x0e080003</prop></XML>",
0144: "<XML><prop ab=\"i5\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop></XML>",
0145: "<TagText tag=\"prop\" attributePatterns=\"ab=i*\"/>", }, //3
0146:
0147: {
0148: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
0149: + "<XML><prop ab=\"i5\">/mapi/proptag/x0e080003</prop></XML>",
0150: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
0151: + "<XML><prop ab=\"i5\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop></XML>",
0152: "<TagText tag=\"prop\" attributePatterns=\"*b=i*\"/>", }, //4
0153:
0154: {
0155: "<xml><attribute name=\"src\">raja.html</attribute><attribute>raja.html</attribute></xml>",
0156: "<xml><attribute name=\"src\">http://rajanagendra.sun.com/Base/Raja/raja.html</attribute><attribute>raja.html</attribute></xml>",
0157: "<TagText tag=\"attribute\" attributePatterns=\"name=src\" />\n" }, //5
0158:
0159: {
0160: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
0161: + "<xml><attribute name=\"src\">raja.html</attribute><attribute>raja.html</attribute></xml>",
0162: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
0163: + "<xml><attribute name=\"src\">http://rajanagendra.sun.com/Base/Raja/raja.html</attribute><attribute>raja.html</attribute></xml>",
0164: "<TagText tag=\"attribute\" attributePatterns=\"name = src\" />\n" //observe the space between name and src
0165: }, //6
0166: };
0167:
0168: for (int i = 0; i < lData.length; i++) {
0169: RuleSet lRuleSet = CreateRuleSet
0170: .withXMLTagTextRules(lData[i][2]);
0171: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0172: LanguageConstants.XML_MIME);
0173: String lResult = lRewriter.rewrite(lData[i][0],
0174: getDefaultTranslator());
0175: assertXMLEqual("Failed: i= " + i, lData[i][1], lResult);
0176: }//for loop
0177: }//testSimpleTagTexts()
0178:
0179: public void testSimpleTagTextsInvalidXML() throws Exception {
0180: //Input,Expectation, Rule
0181: final String[][] lData = { {
0182: "<XML><prop d:dt=\"i5\">/mapi/proptag/x0e080003</prop></XML>",
0183: "<XML><prop d:dt=\"i5\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop></XML>",
0184: "<TagText tag=\"prop\" attributePatterns=\"d:dt=i5\"/>", }, //1 this does not translate as xmlns is missing some thing to do with d:dt attribib
0185: };
0186:
0187: for (int i = 0; i < lData.length; i++) {
0188: RuleSet lRuleSet = CreateRuleSet
0189: .withXMLTagTextRules(lData[i][2]);
0190: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0191: LanguageConstants.XML_MIME);
0192: String lResult = lRewriter.rewrite(lData[i][0],
0193: getDefaultTranslator());
0194: assertEquals("Failed: i= " + i, lData[i][1], lResult);
0195: }//for loop
0196: }//testSimpleTagTextsInvalidXML()
0197:
0198: public void testOWARegExp() throws Exception {
0199: String lInput = "<XML>"
0200: + "<prop ab=\"i5\">/mapi/proptag/x0e080003</prop>\n"
0201: + "</XML>";
0202:
0203: String lExpectation = "<XML>"
0204: + "<prop ab=\"i5\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>"
0205: + "</XML>";
0206:
0207: String[] lXMLTagTextRules = {
0208: "<TagText tag=\"prop\" attributePatterns=\"a*=*\"/>",
0209: "<TagText tag=\"*;\" attributePatterns=\"a*=*\"/>",
0210: "<TagText tag=\";*;\" attributePatterns=\"a*=*\"/>",
0211: "<TagText tag=\";*\" attributePatterns=\"a*=*\"/>",
0212: //"<TagText tag=\"\" attributePatterns=\"a*=*\"/>",
0213: //"<TagText tag=\"*\" attributePatterns=\"a*=*\"/>",
0214: };
0215:
0216: for (int i = 0; i < lXMLTagTextRules.length; i++) {
0217: RuleSet lRuleSet = CreateRuleSet
0218: .withXMLTagTextRules(lXMLTagTextRules[i]);
0219: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0220: LanguageConstants.MARKUP_MIME);
0221: String lResult = lRewriter.rewrite(lInput,
0222: getDefaultTranslator());
0223: assertXMLEqual(lExpectation, lResult);
0224: }
0225: }//testOWARegExp()
0226:
0227: public void testOWARegExp1() throws Exception {
0228: String lInput = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
0229: + "<XML>"
0230: + "<ab>"
0231: + "<prop ab=\"i5\">/mapi/proptag/x0e080003</prop>\n"
0232: + "<prop ab=\"stRINg\">/mapi/proptag/x0e080003</prop>\n"
0233: + "</ab>" + "</XML>";
0234:
0235: String lExpectation = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
0236: + "<XML>"
0237: + "<ab>"
0238: + "<prop ab=\"i5\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>\n"
0239: + "<prop ab=\"stRINg\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>\n"
0240: + "</ab>" + "</XML>";
0241:
0242: String lXMLTagTextRules = "<TagText tag=\"prop\" attributePatterns=\"a*=*\"/>";
0243:
0244: RuleSet lRuleSet = CreateRuleSet
0245: .withXMLTagTextRules(lXMLTagTextRules);
0246: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0247: LanguageConstants.MARKUP_MIME);
0248: String lResult = lRewriter.rewrite(lInput,
0249: getDefaultTranslator());
0250: assertXMLEqual(lExpectation, lResult);
0251: }//testOWARegExp1()
0252:
0253: public void testOWARegExp2() throws Exception {
0254: String lInput = "<XML>"
0255: + "<prop ab=\"i5\">/mapi/proptag/x0e080003</prop>\n"
0256: + "</XML>";
0257:
0258: String lExpectation = "<XML>"
0259: + "<prop ab=\"i5\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>"
0260: + "</XML>";
0261:
0262: String lXMLTagTextRules = "<TagText tag=\"prop\" attributePatterns=\"*=*\"/>";
0263:
0264: RuleSet lRuleSet = CreateRuleSet
0265: .withXMLTagTextRules(lXMLTagTextRules);
0266: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0267: LanguageConstants.MARKUP_MIME);
0268: String lResult = lRewriter.rewrite(lInput,
0269: getDefaultTranslator());
0270: assertXMLEqual(lExpectation, lResult);
0271: }//testOWARegExp2()
0272:
0273: public void testOWARegExp3() throws Exception {
0274: String lInput = "<XML>"
0275: + "<prop ab=\"i5\">/mapi/proptag/x0e080003</prop>\n"
0276: + "<prop ab=\"stRINg\">/mapi/proptag/x0e080003</prop>\n"
0277: + "</XML>";
0278:
0279: String lExpectation = "<XML>"
0280: + "<prop ab=\"i5\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>\n"
0281: + "<prop ab=\"stRINg\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>\n"
0282: + "</XML>";
0283:
0284: String lXMLTagTextRules = "<TagText tag=\"prop\" attributePatterns=\"*b=*\"/>";
0285:
0286: RuleSet lRuleSet = CreateRuleSet
0287: .withXMLTagTextRules(lXMLTagTextRules);
0288: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0289: LanguageConstants.XML_MIME);
0290: String lResult = lRewriter.rewrite(lInput,
0291: getDefaultTranslator());
0292: assertXMLEqual(lExpectation, lResult);
0293: }//testOWARegExp3()
0294:
0295: public void testOWARegExp3NegativeSourceRule() throws Exception {
0296: String lInput = "<XML>"
0297: + "<prop ab=\"i5\">/mapi/proptag/x0e080003</prop>\n"
0298: + "<prop ab=\"stRINg\">/mapi/proptag/x0e080003</prop>\n"
0299: + "</XML>";
0300:
0301: String lExpectation = "<XML>"
0302: + "<prop ab=\"i5\">/mapi/proptag/x0e080003</prop>\n"
0303: + "<prop ab=\"stRINg\">/mapi/proptag/x0e080003</prop>\n"
0304: + "</XML>";
0305:
0306: String lXMLTagTextRules = "<TagText tag=\"prop\" attributePatterns=\"*b=*\" source=\"abc\"/>";
0307:
0308: RuleSet lRuleSet = CreateRuleSet
0309: .withXMLTagTextRules(lXMLTagTextRules);
0310: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0311: LanguageConstants.XML_MIME);
0312: String lResult = lRewriter.rewrite(lInput,
0313: getDefaultTranslator());
0314: assertXMLEqual(lExpectation, lResult);
0315: }//testOWARegExp3NegativeSourceRule()
0316:
0317: public void testOWARegExp3PositiveSourceRule() throws Exception {
0318: String lInput = "<XML>"
0319: + "<prop ab=\"i5\">/mapi/proptag/x0e080003</prop>\n"
0320: + "<prop ab=\"stRINg\">/mapi/proptag/x0e080003</prop>\n"
0321: + "</XML>";
0322:
0323: String lExpectation = "<XML>"
0324: + "<prop ab=\"i5\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>\n"
0325: + "<prop ab=\"stRINg\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>\n"
0326: + "</XML>";
0327:
0328: String lXMLTagTextRules = "<TagText tag=\"prop\" attributePatterns=\"*b=*\" source=\"*raja*\"/>";
0329:
0330: RuleSet lRuleSet = CreateRuleSet
0331: .withXMLTagTextRules(lXMLTagTextRules);
0332: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0333: LanguageConstants.XML_MIME);
0334: String lResult = lRewriter.rewrite(lInput,
0335: getDefaultTranslator());
0336: assertXMLEqual(lExpectation, lResult);
0337: }//testOWARegExp3PositiveSourceRule()
0338:
0339: public void testOWARegExp4() throws Exception {
0340: String lInput = "<XML>"
0341: + "<prop ab=\"i5\">/mapi/proptag/x0e080003</prop>\n"
0342: + "<prop axyz=\"stRINg\">/mapi/proptag/x0e080003</prop>\n"
0343: + "</XML>";
0344:
0345: String lExpectation = "<XML>"
0346: + "<prop ab=\"i5\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>\n"
0347: + "<prop axyz=\"stRINg\">/mapi/proptag/x0e080003</prop>\n"
0348: + "</XML>";
0349:
0350: String lXMLTagTextRules = "<TagText tag=\"prop\" attributePatterns=\"a*=i*\"/>";
0351:
0352: RuleSet lRuleSet = CreateRuleSet
0353: .withXMLTagTextRules(lXMLTagTextRules);
0354: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0355: LanguageConstants.XML_MIME);
0356: String lResult = lRewriter.rewrite(lInput,
0357: getDefaultTranslator());
0358: assertXMLEqual(lExpectation, lResult);
0359: }//testOWARegExp4()
0360:
0361: public void testOWARegExp5() throws Exception {
0362: String lInput = "<XML>"
0363: + "<prop ab=\"i5\">/mapi/proptag/x0e080003</prop>\n"
0364: + "<prop axyz=\"stRINg\">/mapi/proptag/x0e080003</prop>\n"
0365: + "</XML>";
0366:
0367: String lExpectation = "<XML>"
0368: + "<prop ab=\"i5\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>\n"
0369: + "<prop axyz=\"stRINg\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>\n"
0370: + "</XML>";
0371:
0372: String lXMLTagTextRules = "<TagText tag=\"prop\" attributePatterns=\"a*=i*\"/> <TagText tag=\"prop\" attributePatterns=\"a*=s*\"/>";
0373:
0374: RuleSet lRuleSet = CreateRuleSet
0375: .withXMLTagTextRules(lXMLTagTextRules);
0376: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0377: LanguageConstants.XML_MIME);
0378: String lResult = lRewriter.rewrite(lInput,
0379: getDefaultTranslator());
0380: assertXMLEqual(lExpectation, lResult);
0381: }//testOWARegExp5()
0382:
0383: public void testOWARegExp6() throws Exception {
0384: String lInput = "<XML>"
0385: + "<prop ab=\"i5\" axyz=\"stRINg\">/mapi/proptag/x0e080003</prop>\n"
0386: + "<prop axyz=\"stRINg\">/mapi/proptag/x0e080003</prop>\n"
0387: + "</XML>";
0388:
0389: String lExpectation = "<XML>"
0390: + "<prop ab=\"i5\" axyz=\"stRINg\">/mapi/proptag/x0e080003</prop>\n"
0391: + "<prop axyz=\"stRINg\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>\n"
0392: + "</XML>";
0393:
0394: String lXMLTagTextRules = "<TagText tag=\"prop\" attributePatterns=\"a*=i*\"/> <TagText tag=\"prop\" attributePatterns=\"a*=s*\"/>";
0395:
0396: RuleSet lRuleSet = CreateRuleSet
0397: .withXMLTagTextRules(lXMLTagTextRules);
0398: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0399: LanguageConstants.XML_MIME);
0400: String lResult = lRewriter.rewrite(lInput,
0401: getDefaultTranslator());
0402: assertXMLEqual(lExpectation, lResult);
0403: }//testOWARegExp6()
0404:
0405: public void testOWARegExp7() throws Exception {
0406: String lInput = "<XML>"
0407: + "<prop ab=\"i5\" xyz=\"stRINg\">/mapi/proptag/x0e080003</prop>\n"
0408: + "<prop axyz=\"stRINg\">/mapi/proptag/x0e080003</prop>\n"
0409: + "</XML>";
0410:
0411: String lExpectation = "<XML>"
0412: + "<prop ab=\"i5\" xyz=\"stRINg\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>\n"
0413: + "<prop axyz=\"stRINg\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>\n"
0414: + "</XML>";
0415:
0416: String lXMLTagTextRules = "<TagText tag=\"prop\" attributePatterns=\"a*=i*;x*=s*\"/> <TagText tag=\"prop\" attributePatterns=\"a*=s*\"/>";
0417:
0418: RuleSet lRuleSet = CreateRuleSet
0419: .withXMLTagTextRules(lXMLTagTextRules);
0420: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0421: LanguageConstants.XML_MIME);
0422: String lResult = lRewriter.rewrite(lInput,
0423: getDefaultTranslator());
0424: assertXMLEqual(lExpectation, lResult);
0425: }//testOWARegExp7()
0426:
0427: public void testOWARegExp8() throws Exception {
0428: String lInput = "<XML>"
0429: + "<prop ab=\"i5\" axyz=\"stRINg\">/mapi/proptag/x0e080003</prop>\n"
0430: + "<prop axyz=\"stRINg\">/mapi/proptag/x0e080003</prop>\n"
0431: + "</XML>";
0432:
0433: String lExpectation = "<XML>"
0434: + "<prop ab=\"i5\" axyz=\"stRINg\">/mapi/proptag/x0e080003</prop>\n"
0435: + "<prop axyz=\"stRINg\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>\n"
0436: + "</XML>";
0437: //Observe the Atrribute pattern rule order and also attr key patterns.. they overlap
0438: String lXMLTagTextRules = "<TagText tag=\"prop\" attributePatterns=\"a*=i*;axyz=s*\"/> <TagText tag=\"prop\" attributePatterns=\"a*=s*\"/>";
0439: RuleSet lRuleSet = CreateRuleSet
0440: .withXMLTagTextRules(lXMLTagTextRules);
0441: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0442: LanguageConstants.XML_MIME);
0443: String lResult = lRewriter.rewrite(lInput,
0444: getDefaultTranslator());
0445: assertXMLEqual(lExpectation, lResult);
0446: }//testOWARegExp8()
0447:
0448: public void testOWARegExp9() throws Exception {
0449: String lInput = "<XML>"
0450: + "<prop ab=\"i5\" axyz=\"stRINg\">/mapi/proptag/x0e080003</prop>\n"
0451: + "<prop axyz=\"stRINg\">/mapi/proptag/x0e080003</prop>\n"
0452: + "</XML>";
0453:
0454: String lExpectation = "<XML>"
0455: + "<prop ab=\"i5\" axyz=\"stRINg\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>\n"
0456: + "<prop axyz=\"stRINg\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>\n"
0457: + "</XML>";
0458:
0459: String lXMLTagTextRules = "<TagText tag=\"prop\" attributePatterns=\"axyz=s*;a*=i*\"/> <TagText tag=\"prop\" attributePatterns=\"a*=s*\"/>";
0460: //Observe Attribute RuleOrder
0461: RuleSet lRuleSet = CreateRuleSet
0462: .withXMLTagTextRules(lXMLTagTextRules);
0463: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0464: LanguageConstants.XML_MIME);
0465: String lResult = lRewriter.rewrite(lInput,
0466: getDefaultTranslator());
0467: assertXMLEqual(lExpectation, lResult);
0468: }//testOWARegExp9()
0469:
0470: public void testOWAPage() throws Exception {
0471: String lInput = "<XML id=\"xmlDefaultView\">\n"
0472: + "<view xmlns=\"/schemas/view\" xmlns:d=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882\">\n"
0473: + "<baseroot>/exchweb/img/</baseroot>\n"
0474: + "<viewstyle>table-layout:fixed;width:100%;font-size:x-small</viewstyle>\n"
0475: + "<viewname>Messages</viewname>\n"
0476: + "<column><heading>Importance</heading>\n"
0477: + "<prop d:dt=\"i4\">/exchange/x-priority-long</prop>\n"
0478: + "<width>1%</width>\n"
0479: + "<sortable>1</sortable>\n"
0480: + "<bitmap>1</bitmap>\n"
0481: + "<multivalued>0</multivalued>\n"
0482: + "<visible>1</visible>\n"
0483: + "<style>padding-left:3px;text-align: center</style>\n"
0484: + "</column>\n"
0485: + "<column><heading>Item Type</heading>\n"
0486: + "<prop d:dt=\"string\">/exchange/outlookmessageclass</prop>\n"
0487: + "<width>3%</width>\n"
0488: + "<sortable>1</sortable>\n"
0489: + "<bitmap>1</bitmap>\n"
0490: + "<multivalued>0</multivalued>\n"
0491: + "<visible>1</visible>\n"
0492: + "<style>padding-left:3px;text-align: center</style>\n"
0493: + "</column>\n"
0494: + "<column><heading>FlagStatus</heading>\n"
0495: + "<prop d:dt=\"i4\">/mapi/proptag/x10900003</prop>\n"
0496: + "<width>3%</width>\n"
0497: + "<sortable>1</sortable>\n"
0498: + "<bitmap>1</bitmap>\n"
0499: + "<multivalued>0</multivalued>\n"
0500: + "<visible>1</visible>\n"
0501: + "<style>padding-left:3px;text-align: center</style>\n"
0502: + "</column>\n"
0503: + "<column><heading>Attachment</heading>\n"
0504: + "<prop d:dt=\"boolean\">urn:schemas:httpmail:hasattachment</prop>\n"
0505: + "<width>2%</width>\n"
0506: + "<sortable>1</sortable>\n"
0507: + "<bitmap>1</bitmap>\n"
0508: + "<multivalued>0</multivalued>\n"
0509: + "<visible>1</visible>\n"
0510: + "<style>padding-left:3px;text-align: center</style>\n"
0511: + "</column>\n"
0512: + "<column><heading>From</heading>\n"
0513: + "<prop d:dt=\"string\">/mapi/sent_representing_name</prop>\n"
0514: + "<width>21%</width>\n"
0515: + "<sortable>1</sortable>\n"
0516: + "<bitmap>0</bitmap>\n"
0517: + "<multivalued>0</multivalued>\n"
0518: + "<visible>1</visible>\n"
0519: + "<style>padding-left:3px;text-align: left</style>\n"
0520: + "</column>\n"
0521: + "<column><heading>Subject</heading>\n"
0522: + "<prop d:dt=\"string\">/mapi/subject</prop>\n"
0523: + "<width>36%</width>\n"
0524: + "<sortable>1</sortable>\n"
0525: + "<bitmap>0</bitmap>\n"
0526: + "<multivalued>0</multivalued>\n"
0527: + "<visible>1</visible>\n"
0528: + "<style>padding-left:3px;text-align: left</style>\n"
0529: + "</column>\n"
0530: + "<column><heading>Received</heading>\n"
0531: + "<prop d:dt=\"date\">urn:schemas:httpmail:datereceived</prop>\n"
0532: + "<width>24%</width>\n"
0533: + "<sortable>1</sortable>\n"
0534: + "<bitmap>0</bitmap>\n"
0535: + "<multivalued>0</multivalued>\n"
0536: + "<visible>1</visible>\n"
0537: + "<style>padding-left:3px;text-align: left</style>\n"
0538: + "<dateformat>ddd dd-MM-yyyy</dateformat>\n"
0539: + "<timeformat>HH:mm</timeformat>\n"
0540: + "</column>\n"
0541: + "<column><heading>Size</heading>\n"
0542: + "<prop d:dt=\"i4\">/mapi/proptag/x0e080003</prop>\n"
0543: + "<width>8%</width>\n"
0544: + "<sortable>1</sortable>\n"
0545: + "<bitmap>0</bitmap>\n"
0546: + "<multivalued>0</multivalued>\n"
0547: + "<visible>1</visible>\n"
0548: + "<style>padding-left:3px;text-align: right</style>\n"
0549: + "</column>\n"
0550: + "<filter>\"/mapi/proptag/0x67aa000b\" = false AND \"DAV:isfolder\" = false</filter>\n"
0551: + "<orderby><order><prop>mapi/sent_representing_name</prop>\n"
0552: + "<sort>ASC</sort>\n"
0553: + "</order>\n"
0554: + "</orderby>\n"
0555: + "<headerstyle>background-color:buttonface</headerstyle>\n"
0556: + "<rowstyle>background-color:window</rowstyle>\n"
0557: + "</view>\n" + "</XML>\n";
0558:
0559: String middle = "<view xmlns=\"http://rajanagendra.sun.com/schemas/view\" xmlns:d=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882\">\n"
0560: + "<baseroot>http://rajanagendra.sun.com/exchweb/img/</baseroot>\n"
0561: + "<viewstyle>table-layout:fixed;width:100%;font-size:x-small</viewstyle>\n"
0562: + "<viewname>Messages</viewname>\n"
0563: + "<column><heading>Importance</heading>\n"
0564: + "<prop d:dt=\"i4\">http://rajanagendra.sun.com/exchange/x-priority-long</prop>\n"
0565: + "<width>1%</width>\n"
0566: + "<sortable>1</sortable>\n"
0567: + "<bitmap>1</bitmap>\n"
0568: + "<multivalued>0</multivalued>\n"
0569: + "<visible>1</visible>\n"
0570: + "<style>padding-left:3px;text-align: center</style>\n"
0571: + "</column>\n"
0572: + "<column><heading>Item Type</heading>\n"
0573: + "<prop d:dt=\"string\">http://rajanagendra.sun.com/exchange/outlookmessageclass</prop>\n"
0574: + "<width>3%</width>\n"
0575: + "<sortable>1</sortable>\n"
0576: + "<bitmap>1</bitmap>\n"
0577: + "<multivalued>0</multivalued>\n"
0578: + "<visible>1</visible>\n"
0579: + "<style>padding-left:3px;text-align: center</style>\n"
0580: + "</column>\n"
0581: + "<column><heading>FlagStatus</heading>\n"
0582: + "<prop d:dt=\"i4\">http://rajanagendra.sun.com/mapi/proptag/x10900003</prop>\n"
0583: + "<width>3%</width>\n"
0584: + "<sortable>1</sortable>\n"
0585: + "<bitmap>1</bitmap>\n"
0586: + "<multivalued>0</multivalued>\n"
0587: + "<visible>1</visible>\n"
0588: + "<style>padding-left:3px;text-align: center</style>\n"
0589: + "</column>\n"
0590: + "<column><heading>Attachment</heading>\n"
0591: + "<prop d:dt=\"boolean\">urn:schemas:httpmail:hasattachment</prop>\n"
0592: + "<width>2%</width>\n"
0593: + "<sortable>1</sortable>\n"
0594: + "<bitmap>1</bitmap>\n"
0595: + "<multivalued>0</multivalued>\n"
0596: + "<visible>1</visible>\n"
0597: + "<style>padding-left:3px;text-align: center</style>\n"
0598: + "</column>\n"
0599: + "<column><heading>From</heading>\n"
0600: + "<prop d:dt=\"string\">http://rajanagendra.sun.com/mapi/sent_representing_name</prop>\n"
0601: + "<width>21%</width>\n"
0602: + "<sortable>1</sortable>\n"
0603: + "<bitmap>0</bitmap>\n"
0604: + "<multivalued>0</multivalued>\n"
0605: + "<visible>1</visible>\n"
0606: + "<style>padding-left:3px;text-align: left</style>\n"
0607: + "</column>\n"
0608: + "<column><heading>Subject</heading>\n"
0609: + "<prop d:dt=\"string\">http://rajanagendra.sun.com/mapi/subject</prop>\n"
0610: + "<width>36%</width>\n"
0611: + "<sortable>1</sortable>\n"
0612: + "<bitmap>0</bitmap>\n"
0613: + "<multivalued>0</multivalued>\n"
0614: + "<visible>1</visible>\n"
0615: + "<style>padding-left:3px;text-align: left</style>\n"
0616: + "</column>\n"
0617: + "<column><heading>Received</heading>\n"
0618: + "<prop d:dt=\"date\">urn:schemas:httpmail:datereceived</prop>\n"
0619: + "<width>24%</width>\n"
0620: + "<sortable>1</sortable>\n"
0621: + "<bitmap>0</bitmap>\n"
0622: + "<multivalued>0</multivalued>\n"
0623: + "<visible>1</visible>\n"
0624: + "<style>padding-left:3px;text-align: left</style>\n"
0625: + "<dateformat>ddd dd-MM-yyyy</dateformat>\n"
0626: + "<timeformat>HH:mm</timeformat>\n"
0627: + "</column>\n"
0628: + "<column><heading>Size</heading>\n"
0629: + "<prop d:dt=\"i4\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>\n"
0630: + "<width>8%</width>\n"
0631: + "<sortable>1</sortable>\n"
0632: + "<bitmap>0</bitmap>\n"
0633: + "<multivalued>0</multivalued>\n"
0634: + "<visible>1</visible>\n"
0635: + "<style>padding-left:3px;text-align: right</style>\n"
0636: + "</column>\n"
0637: + "<filter>\"/mapi/proptag/0x67aa000b\" = false AND \"DAV:isfolder\" = false</filter>\n"
0638: + "<orderby><order><prop>http://rajanagendra.sun.com/Base/Raja/mapi/sent_representing_name</prop>\n"
0639: + "<sort>ASC</sort>\n"
0640: + "</order>\n"
0641: + "</orderby>\n"
0642: + "<headerstyle>background-color:buttonface</headerstyle>\n"
0643: + "<rowstyle>background-color:window</rowstyle>\n"
0644: + "</view>";
0645:
0646: String lXMLExpectation = "<XML id=\"xmlDefaultView\">\n"
0647: + middle + "\n</XML>";
0648:
0649: String lUNIExpectation = "<XML id=\"xmlDefaultView\">\n"
0650: + middle + "</XML>\n";
0651:
0652: String lXMLAttRules = "<Attribute name=\"xm*ns\" />";
0653: String lXMLTagTextRules = "<TagText tag=\"baseroot\"/>"
0654: + "<TagText tag=\"prop\"/>"
0655: + "<TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
0656:
0657: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
0658: lXMLAttRules, lXMLTagTextRules);
0659:
0660: {
0661: //XML Parser
0662: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0663: LanguageConstants.XML_MIME);
0664: String lResult = lRewriter.rewrite(lInput,
0665: getDefaultTranslator());
0666: assertXMLEqual(lXMLExpectation, lResult);
0667: }
0668:
0669: {
0670: //Markup Parser
0671: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0672: LanguageConstants.MARKUP_MIME);
0673: String lResult = lRewriter.rewrite(lInput,
0674: getDefaultTranslator());
0675: assertXMLEqual(lUNIExpectation, lResult);
0676: }
0677: }//testOWAPage()
0678:
0679: public void testOWANameSpacePage() throws Exception {
0680: String lInput = "<?xml version = \"1.0\" ?>\n"
0681: + "<a:multistatus xmlns:d=\"urn:schemas-microsoft-com:office:office\" xmlns:c=\"xml:\" xmlns:b=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\" xmlns:a=\"DAV:\"><a:contentrange>0-16</a:contentrange>\n"
0682: + "<a:response><a:href>/exchange/magesh/Inbox/Undeliverable:%20FW:%20Delivered:%20Delivery%20Status%20Notification%20(Success).EML</a:href>\n"
0683: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0684: + "<a:prop><prop1 b:dt=\"int\">2</prop1>\n"
0685: + "<prop2>/exchweb/img/icon-report-ndr.gif</prop2>\n"
0686: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0687: + "<prop5>System Administrator</prop5>\n"
0688: + "<prop6>Undeliverable: FW: Delivered: Delivery Status Notification (Success)</prop6>\n"
0689: + "<prop7 b:dt=\"dateTime.tz\">2002-07-16T06:43:12.098Z</prop7>\n"
0690: + "<prop8 b:dt=\"int\">2806</prop8>\n"
0691: + "<read b:dt=\"boolean\">1</read>\n"
0692: + "<contentclass>REPORT.IPM.Note.NDR</contentclass>\n"
0693: + "</a:prop>\n"
0694: + "</a:propstat>\n"
0695: + "</a:response>\n"
0696: + "<a:response><a:href>/exchange/magesh/Inbox/Delivered:%20Delivery%20Status%20Notification%20(Success).EML</a:href>\n"
0697: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0698: + "<a:prop><prop1 b:dt=\"int\">2</prop1>\n"
0699: + "<prop2>/exchweb/img/icon-report-dr.gif</prop2>\n"
0700: + "<prop4 b:dt=\"boolean\">0</prop4>\n"
0701: + "<prop5>System Administrator</prop5>\n"
0702: + "<prop6>Delivered: Delivery Status Notification (Success)</prop6>\n"
0703: + "<prop7 b:dt=\"dateTime.tz\">2002-07-15T09:48:50.417Z</prop7>\n"
0704: + "<prop8 b:dt=\"int\">339</prop8>\n"
0705: + "<read b:dt=\"boolean\">1</read>\n"
0706: + "<contentclass>REPORT.IPM.Note.DR</contentclass>\n"
0707: + "</a:prop>\n"
0708: + "</a:propstat>\n"
0709: + "</a:response>\n"
0710: + "<a:response><a:href>/exchange/magesh/Inbox/Undeliverable:%20FW:%20Undeliverable:%20Delivery%20Status%20Notification%20(Failure).EML</a:href>\n"
0711: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0712: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
0713: + "<prop2>/exchweb/img/icon-report-ndr.gif</prop2>\n"
0714: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0715: + "<prop5>System Administrator</prop5>\n"
0716: + "<prop6>Undeliverable: FW: Undeliverable: Delivery Status Notification (Failure)</prop6>\n"
0717: + "<prop7 b:dt=\"dateTime.tz\">2002-07-10T09:49:35.196Z</prop7>\n"
0718: + "<prop8 b:dt=\"int\">2932</prop8>\n"
0719: + "<read b:dt=\"boolean\">1</read>\n"
0720: + "<contentclass>REPORT.IPM.Note.NDR</contentclass>\n"
0721: + "</a:prop>\n"
0722: + "</a:propstat>\n"
0723: + "</a:response>\n"
0724: + "<a:response><a:href>/exchange/magesh/Inbox/Undeliverable:%20Delivery%20Status%20Notification%20(Failure)-2.EML</a:href>\n"
0725: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0726: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
0727: + "<prop2>/exchweb/img/icon-report-ndr.gif</prop2>\n"
0728: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0729: + "<prop5>System Administrator</prop5>\n"
0730: + "<prop6>Undeliverable: Delivery Status Notification (Failure)</prop6>\n"
0731: + "<prop7 b:dt=\"dateTime.tz\">2002-07-07T10:08:43.165Z</prop7>\n"
0732: + "<prop8 b:dt=\"int\">2121</prop8>\n"
0733: + "<read b:dt=\"boolean\">1</read>\n"
0734: + "<contentclass>REPORT.IPM.Note.NDR</contentclass>\n"
0735: + "</a:prop>\n"
0736: + "</a:propstat>\n"
0737: + "</a:response>\n"
0738: + "<a:response><a:href>/exchange/magesh/Inbox/Delivery%20Status%20Notification%20(Delay)-2.EML</a:href>\n"
0739: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0740: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
0741: + "<prop2>/exchweb/img/icon-msg-unread.gif</prop2>\n"
0742: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0743: + "<prop5>Administrator</prop5>\n"
0744: + "<prop6>Delivery Status Notification (Delay)</prop6>\n"
0745: + "<prop7 b:dt=\"dateTime.tz\">2002-07-05T22:01:23.277Z</prop7>\n"
0746: + "<prop8 b:dt=\"int\">1991</prop8>\n"
0747: + "<read b:dt=\"boolean\">1</read>\n"
0748: + "<contentclass>IPM.Note</contentclass>\n"
0749: + "</a:prop>\n"
0750: + "</a:propstat>\n"
0751: + "</a:response>\n"
0752: + "<a:response><a:href>/exchange/magesh/Inbox/4%20files%20from%20win98%20folder.EML</a:href>\n"
0753: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0754: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
0755: + "<prop2>/exchweb/img/icon-msg-unread.gif</prop2>\n"
0756: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0757: + "<prop5>Magesh STM</prop5>\n"
0758: + "<prop6>4 files from win98 folder</prop6>\n"
0759: + "<prop7 b:dt=\"dateTime.tz\">2002-07-02T14:02:59.201Z</prop7>\n"
0760: + "<prop8 b:dt=\"int\">283588</prop8>\n"
0761: + "<read b:dt=\"boolean\">1</read>\n"
0762: + "<contentclass>IPM.Note</contentclass>\n"
0763: + "</a:prop>\n"
0764: + "</a:propstat>\n"
0765: + "</a:response>\n"
0766: + "<a:response><a:href>/exchange/magesh/Inbox/4%20files%20from%20win%2098.EML</a:href>\n"
0767: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0768: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
0769: + "<prop2>/exchweb/img/icon-msg-unread.gif</prop2>\n"
0770: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0771: + "<prop5>Magesh STM</prop5>\n"
0772: + "<prop6>4 files from win 98</prop6>\n"
0773: + "<prop7 b:dt=\"dateTime.tz\">2002-07-02T13:50:23.985Z</prop7>\n"
0774: + "<prop8 b:dt=\"int\">283582</prop8>\n"
0775: + "<read b:dt=\"boolean\">1</read>\n"
0776: + "<contentclass>IPM.Note</contentclass>\n"
0777: + "</a:prop>\n"
0778: + "</a:propstat>\n"
0779: + "</a:response>\n"
0780: + "<a:response><a:href>/exchange/magesh/Inbox/4%20files%20from%20wuftp%20share-2.EML</a:href>\n"
0781: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0782: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
0783: + "<prop2>/exchweb/img/icon-msg-unread.gif</prop2>\n"
0784: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0785: + "<prop5>Magesh STM</prop5>\n"
0786: + "<prop6>4 files from wuftp share</prop6>\n"
0787: + "<prop7 b:dt=\"dateTime.tz\">2002-07-02T10:42:44.826Z</prop7>\n"
0788: + "<prop8 b:dt=\"int\">283718</prop8>\n"
0789: + "<read b:dt=\"boolean\">1</read>\n"
0790: + "<contentclass>IPM.Note</contentclass>\n"
0791: + "</a:prop>\n"
0792: + "</a:propstat>\n"
0793: + "</a:response>\n"
0794: + "<a:response><a:href>/exchange/magesh/Inbox/4%20files%20from%20wuftp%20share.EML</a:href>\n"
0795: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0796: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
0797: + "<prop2>/exchweb/img/icon-msg-unread.gif</prop2>\n"
0798: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0799: + "<prop5>Magesh STM</prop5>\n"
0800: + "<prop6>4 files from wuftp share</prop6>\n"
0801: + "<prop7 b:dt=\"dateTime.tz\">2002-07-01T10:57:19.015Z</prop7>\n"
0802: + "<prop8 b:dt=\"int\">283598</prop8>\n"
0803: + "<read b:dt=\"boolean\">1</read>\n"
0804: + "<contentclass>IPM.Note</contentclass>\n"
0805: + "</a:prop>\n"
0806: + "</a:propstat>\n"
0807: + "</a:response>\n"
0808: + "<a:response><a:href>/exchange/magesh/Inbox/No%20Subject-18.EML</a:href>\n"
0809: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0810: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
0811: + "<prop2>/exchweb/img/icon-msg-unread.gif</prop2>\n"
0812: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0813: + "<prop5>Magesh STM</prop5>\n"
0814: + "<prop7 b:dt=\"dateTime.tz\">2002-07-01T10:25:44.962Z</prop7>\n"
0815: + "<prop8 b:dt=\"int\">283704</prop8>\n"
0816: + "<read b:dt=\"boolean\">1</read>\n"
0817: + "<contentclass>IPM.Note</contentclass>\n"
0818: + "</a:prop>\n"
0819: + "</a:propstat>\n"
0820: + "</a:response>\n"
0821: + "<a:response><a:href>/exchange/magesh/Inbox/No%20Subject-17.EML</a:href>\n"
0822: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0823: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
0824: + "<prop2>/exchweb/img/icon-msg-unread.gif</prop2>\n"
0825: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0826: + "<prop5>Magesh STM</prop5>\n"
0827: + "<prop7 b:dt=\"dateTime.tz\">2002-07-01T10:10:45.899Z</prop7>\n"
0828: + "<prop8 b:dt=\"int\">283694</prop8>\n"
0829: + "<read b:dt=\"boolean\">1</read>\n"
0830: + "<contentclass>IPM.Note</contentclass>\n"
0831: + "</a:prop>\n"
0832: + "</a:propstat>\n"
0833: + "</a:response>\n"
0834: + "<a:response><a:href>/exchange/magesh/Inbox/4%20files%20from%20XP%20folder-2.EML</a:href>\n"
0835: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0836: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
0837: + "<prop2>/exchweb/img/icon-msg-unread.gif</prop2>\n"
0838: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0839: + "<prop5>Magesh STM</prop5>\n"
0840: + "<prop6>4 files from XP folder</prop6>\n"
0841: + "<prop7 b:dt=\"dateTime.tz\">2002-06-30T13:13:05.002Z</prop7>\n"
0842: + "<prop8 b:dt=\"int\">283718</prop8>\n"
0843: + "<read b:dt=\"boolean\">1</read>\n"
0844: + "<contentclass>IPM.Note</contentclass>\n"
0845: + "</a:prop>\n"
0846: + "</a:propstat>\n"
0847: + "</a:response>\n"
0848: + "<a:response><a:href>/exchange/magesh/Inbox/4%20files%20from%20xp%20folder.EML</a:href>\n"
0849: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0850: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
0851: + "<prop2>/exchweb/img/icon-msg-unread.gif</prop2>\n"
0852: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0853: + "<prop5>Magesh STM</prop5>\n"
0854: + "<prop6>4 files from xp folder</prop6>\n"
0855: + "<prop7 b:dt=\"dateTime.tz\">2002-06-30T12:58:05.368Z</prop7>\n"
0856: + "<prop8 b:dt=\"int\">283718</prop8>\n"
0857: + "<read b:dt=\"boolean\">1</read>\n"
0858: + "<contentclass>IPM.Note</contentclass>\n"
0859: + "</a:prop>\n"
0860: + "</a:propstat>\n"
0861: + "</a:response>\n"
0862: + "<a:response><a:href>/exchange/magesh/Inbox/4%20files%20from%20msftp4%20folder.EML</a:href>\n"
0863: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0864: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
0865: + "<prop2>/exchweb/img/icon-msg-unread.gif</prop2>\n"
0866: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0867: + "<prop5>Magesh STM</prop5>\n"
0868: + "<prop6>4 files from msftp4 folder</prop6>\n"
0869: + "<prop7 b:dt=\"dateTime.tz\">2002-06-30T12:46:26.864Z</prop7>\n"
0870: + "<prop8 b:dt=\"int\">283722</prop8>\n"
0871: + "<read b:dt=\"boolean\">1</read>\n"
0872: + "<contentclass>IPM.Note</contentclass>\n"
0873: + "</a:prop>\n"
0874: + "</a:propstat>\n"
0875: + "</a:response>\n"
0876: + "<a:response><a:href>/exchange/magesh/Inbox/No%20Subject-16.EML</a:href>\n"
0877: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0878: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
0879: + "<prop2>/exchweb/img/icon-msg-unread.gif</prop2>\n"
0880: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0881: + "<prop5>Magesh STM</prop5>\n"
0882: + "<prop7 b:dt=\"dateTime.tz\">2002-06-30T12:34:48.550Z</prop7>\n"
0883: + "<prop8 b:dt=\"int\">283695</prop8>\n"
0884: + "<read b:dt=\"boolean\">1</read>\n"
0885: + "<contentclass>IPM.Note</contentclass>\n"
0886: + "</a:prop>\n"
0887: + "</a:propstat>\n"
0888: + "</a:response>\n"
0889: + "<a:response><a:href>/exchange/magesh/Inbox/4%20files%20from%20msftp%205%20folder.EML</a:href>\n"
0890: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0891: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
0892: + "<prop2>/exchweb/img/icon-msg-unread.gif</prop2>\n"
0893: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0894: + "<prop5>Magesh STM</prop5>\n"
0895: + "<prop6>4 files from msftp 5 folder</prop6>\n"
0896: + "<prop7 b:dt=\"dateTime.tz\">2002-06-30T11:32:09.875Z</prop7>\n"
0897: + "<prop8 b:dt=\"int\">283716</prop8>\n"
0898: + "<read b:dt=\"boolean\">1</read>\n"
0899: + "<contentclass>IPM.Note</contentclass>\n"
0900: + "</a:prop>\n"
0901: + "</a:propstat>\n"
0902: + "</a:response>\n"
0903: + "<a:response><a:href>/exchange/magesh/Inbox/4%20files%20from%20msftp%205.EML</a:href>\n"
0904: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0905: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
0906: + "<prop2>/exchweb/img/icon-msg-unread.gif</prop2>\n"
0907: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0908: + "<prop5>Magesh STM</prop5>\n"
0909: + "<prop6>4 files from msftp 5</prop6>\n"
0910: + "<prop7 b:dt=\"dateTime.tz\">2002-06-30T11:15:59.469Z</prop7>\n"
0911: + "<prop8 b:dt=\"int\">283586</prop8>\n"
0912: + "<read b:dt=\"boolean\">1</read>\n"
0913: + "<contentclass>IPM.Note</contentclass>\n"
0914: + "</a:prop>\n" + "</a:propstat>\n" + "</a:response>\n"
0915: + "</a:multistatus>\n";
0916:
0917: String lExpectation = "<?xml version = \"1.0\" ?>\n"
0918: + "<a:multistatus xmlns:d=\"urn:schemas-microsoft-com:office:office\" xmlns:c=\"xml:\" xmlns:b=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\" xmlns:a=\"DAV:\"><a:contentrange>0-16</a:contentrange>\n"
0919: + "<a:response><a:href>http://rajanagendra.sun.com/exchange/magesh/Inbox/Undeliverable:%20FW:%20Delivered:%20Delivery%20Status%20Notification%20(Success).EML</a:href>\n"
0920: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0921: + "<a:prop><prop1 b:dt=\"int\">2</prop1>\n"
0922: + "<prop2>http://rajanagendra.sun.com/exchweb/img/icon-report-ndr.gif</prop2>\n"
0923: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0924: + "<prop5>System Administrator</prop5>\n"
0925: + "<prop6>Undeliverable: FW: Delivered: Delivery Status Notification (Success)</prop6>\n"
0926: + "<prop7 b:dt=\"dateTime.tz\">2002-07-16T06:43:12.098Z</prop7>\n"
0927: + "<prop8 b:dt=\"int\">2806</prop8>\n"
0928: + "<read b:dt=\"boolean\">1</read>\n"
0929: + "<contentclass>REPORT.IPM.Note.NDR</contentclass>\n"
0930: + "</a:prop>\n"
0931: + "</a:propstat>\n"
0932: + "</a:response>\n"
0933: + "<a:response><a:href>http://rajanagendra.sun.com/exchange/magesh/Inbox/Delivered:%20Delivery%20Status%20Notification%20(Success).EML</a:href>\n"
0934: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0935: + "<a:prop><prop1 b:dt=\"int\">2</prop1>\n"
0936: + "<prop2>http://rajanagendra.sun.com/exchweb/img/icon-report-dr.gif</prop2>\n"
0937: + "<prop4 b:dt=\"boolean\">0</prop4>\n"
0938: + "<prop5>System Administrator</prop5>\n"
0939: + "<prop6>Delivered: Delivery Status Notification (Success)</prop6>\n"
0940: + "<prop7 b:dt=\"dateTime.tz\">2002-07-15T09:48:50.417Z</prop7>\n"
0941: + "<prop8 b:dt=\"int\">339</prop8>\n"
0942: + "<read b:dt=\"boolean\">1</read>\n"
0943: + "<contentclass>REPORT.IPM.Note.DR</contentclass>\n"
0944: + "</a:prop>\n"
0945: + "</a:propstat>\n"
0946: + "</a:response>\n"
0947: + "<a:response><a:href>http://rajanagendra.sun.com/exchange/magesh/Inbox/Undeliverable:%20FW:%20Undeliverable:%20Delivery%20Status%20Notification%20(Failure).EML</a:href>\n"
0948: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0949: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
0950: + "<prop2>http://rajanagendra.sun.com/exchweb/img/icon-report-ndr.gif</prop2>\n"
0951: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0952: + "<prop5>System Administrator</prop5>\n"
0953: + "<prop6>Undeliverable: FW: Undeliverable: Delivery Status Notification (Failure)</prop6>\n"
0954: + "<prop7 b:dt=\"dateTime.tz\">2002-07-10T09:49:35.196Z</prop7>\n"
0955: + "<prop8 b:dt=\"int\">2932</prop8>\n"
0956: + "<read b:dt=\"boolean\">1</read>\n"
0957: + "<contentclass>REPORT.IPM.Note.NDR</contentclass>\n"
0958: + "</a:prop>\n"
0959: + "</a:propstat>\n"
0960: + "</a:response>\n"
0961: + "<a:response><a:href>http://rajanagendra.sun.com/exchange/magesh/Inbox/Undeliverable:%20Delivery%20Status%20Notification%20(Failure)-2.EML</a:href>\n"
0962: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0963: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
0964: + "<prop2>http://rajanagendra.sun.com/exchweb/img/icon-report-ndr.gif</prop2>\n"
0965: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0966: + "<prop5>System Administrator</prop5>\n"
0967: + "<prop6>Undeliverable: Delivery Status Notification (Failure)</prop6>\n"
0968: + "<prop7 b:dt=\"dateTime.tz\">2002-07-07T10:08:43.165Z</prop7>\n"
0969: + "<prop8 b:dt=\"int\">2121</prop8>\n"
0970: + "<read b:dt=\"boolean\">1</read>\n"
0971: + "<contentclass>REPORT.IPM.Note.NDR</contentclass>\n"
0972: + "</a:prop>\n"
0973: + "</a:propstat>\n"
0974: + "</a:response>\n"
0975: + "<a:response><a:href>http://rajanagendra.sun.com/exchange/magesh/Inbox/Delivery%20Status%20Notification%20(Delay)-2.EML</a:href>\n"
0976: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0977: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
0978: + "<prop2>http://rajanagendra.sun.com/exchweb/img/icon-msg-unread.gif</prop2>\n"
0979: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0980: + "<prop5>Administrator</prop5>\n"
0981: + "<prop6>Delivery Status Notification (Delay)</prop6>\n"
0982: + "<prop7 b:dt=\"dateTime.tz\">2002-07-05T22:01:23.277Z</prop7>\n"
0983: + "<prop8 b:dt=\"int\">1991</prop8>\n"
0984: + "<read b:dt=\"boolean\">1</read>\n"
0985: + "<contentclass>IPM.Note</contentclass>\n"
0986: + "</a:prop>\n"
0987: + "</a:propstat>\n"
0988: + "</a:response>\n"
0989: + "<a:response><a:href>http://rajanagendra.sun.com/exchange/magesh/Inbox/4%20files%20from%20win98%20folder.EML</a:href>\n"
0990: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
0991: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
0992: + "<prop2>http://rajanagendra.sun.com/exchweb/img/icon-msg-unread.gif</prop2>\n"
0993: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
0994: + "<prop5>Magesh STM</prop5>\n"
0995: + "<prop6>4 files from win98 folder</prop6>\n"
0996: + "<prop7 b:dt=\"dateTime.tz\">2002-07-02T14:02:59.201Z</prop7>\n"
0997: + "<prop8 b:dt=\"int\">283588</prop8>\n"
0998: + "<read b:dt=\"boolean\">1</read>\n"
0999: + "<contentclass>IPM.Note</contentclass>\n"
1000: + "</a:prop>\n"
1001: + "</a:propstat>\n"
1002: + "</a:response>\n"
1003: + "<a:response><a:href>http://rajanagendra.sun.com/exchange/magesh/Inbox/4%20files%20from%20win%2098.EML</a:href>\n"
1004: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
1005: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
1006: + "<prop2>http://rajanagendra.sun.com/exchweb/img/icon-msg-unread.gif</prop2>\n"
1007: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
1008: + "<prop5>Magesh STM</prop5>\n"
1009: + "<prop6>4 files from win 98</prop6>\n"
1010: + "<prop7 b:dt=\"dateTime.tz\">2002-07-02T13:50:23.985Z</prop7>\n"
1011: + "<prop8 b:dt=\"int\">283582</prop8>\n"
1012: + "<read b:dt=\"boolean\">1</read>\n"
1013: + "<contentclass>IPM.Note</contentclass>\n"
1014: + "</a:prop>\n"
1015: + "</a:propstat>\n"
1016: + "</a:response>\n"
1017: + "<a:response><a:href>http://rajanagendra.sun.com/exchange/magesh/Inbox/4%20files%20from%20wuftp%20share-2.EML</a:href>\n"
1018: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
1019: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
1020: + "<prop2>http://rajanagendra.sun.com/exchweb/img/icon-msg-unread.gif</prop2>\n"
1021: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
1022: + "<prop5>Magesh STM</prop5>\n"
1023: + "<prop6>4 files from wuftp share</prop6>\n"
1024: + "<prop7 b:dt=\"dateTime.tz\">2002-07-02T10:42:44.826Z</prop7>\n"
1025: + "<prop8 b:dt=\"int\">283718</prop8>\n"
1026: + "<read b:dt=\"boolean\">1</read>\n"
1027: + "<contentclass>IPM.Note</contentclass>\n"
1028: + "</a:prop>\n"
1029: + "</a:propstat>\n"
1030: + "</a:response>\n"
1031: + "<a:response><a:href>http://rajanagendra.sun.com/exchange/magesh/Inbox/4%20files%20from%20wuftp%20share.EML</a:href>\n"
1032: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
1033: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
1034: + "<prop2>http://rajanagendra.sun.com/exchweb/img/icon-msg-unread.gif</prop2>\n"
1035: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
1036: + "<prop5>Magesh STM</prop5>\n"
1037: + "<prop6>4 files from wuftp share</prop6>\n"
1038: + "<prop7 b:dt=\"dateTime.tz\">2002-07-01T10:57:19.015Z</prop7>\n"
1039: + "<prop8 b:dt=\"int\">283598</prop8>\n"
1040: + "<read b:dt=\"boolean\">1</read>\n"
1041: + "<contentclass>IPM.Note</contentclass>\n"
1042: + "</a:prop>\n"
1043: + "</a:propstat>\n"
1044: + "</a:response>\n"
1045: + "<a:response><a:href>http://rajanagendra.sun.com/exchange/magesh/Inbox/No%20Subject-18.EML</a:href>\n"
1046: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
1047: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
1048: + "<prop2>http://rajanagendra.sun.com/exchweb/img/icon-msg-unread.gif</prop2>\n"
1049: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
1050: + "<prop5>Magesh STM</prop5>\n"
1051: + "<prop7 b:dt=\"dateTime.tz\">2002-07-01T10:25:44.962Z</prop7>\n"
1052: + "<prop8 b:dt=\"int\">283704</prop8>\n"
1053: + "<read b:dt=\"boolean\">1</read>\n"
1054: + "<contentclass>IPM.Note</contentclass>\n"
1055: + "</a:prop>\n"
1056: + "</a:propstat>\n"
1057: + "</a:response>\n"
1058: + "<a:response><a:href>http://rajanagendra.sun.com/exchange/magesh/Inbox/No%20Subject-17.EML</a:href>\n"
1059: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
1060: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
1061: + "<prop2>http://rajanagendra.sun.com/exchweb/img/icon-msg-unread.gif</prop2>\n"
1062: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
1063: + "<prop5>Magesh STM</prop5>\n"
1064: + "<prop7 b:dt=\"dateTime.tz\">2002-07-01T10:10:45.899Z</prop7>\n"
1065: + "<prop8 b:dt=\"int\">283694</prop8>\n"
1066: + "<read b:dt=\"boolean\">1</read>\n"
1067: + "<contentclass>IPM.Note</contentclass>\n"
1068: + "</a:prop>\n"
1069: + "</a:propstat>\n"
1070: + "</a:response>\n"
1071: + "<a:response><a:href>http://rajanagendra.sun.com/exchange/magesh/Inbox/4%20files%20from%20XP%20folder-2.EML</a:href>\n"
1072: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
1073: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
1074: + "<prop2>http://rajanagendra.sun.com/exchweb/img/icon-msg-unread.gif</prop2>\n"
1075: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
1076: + "<prop5>Magesh STM</prop5>\n"
1077: + "<prop6>4 files from XP folder</prop6>\n"
1078: + "<prop7 b:dt=\"dateTime.tz\">2002-06-30T13:13:05.002Z</prop7>\n"
1079: + "<prop8 b:dt=\"int\">283718</prop8>\n"
1080: + "<read b:dt=\"boolean\">1</read>\n"
1081: + "<contentclass>IPM.Note</contentclass>\n"
1082: + "</a:prop>\n"
1083: + "</a:propstat>\n"
1084: + "</a:response>\n"
1085: + "<a:response><a:href>http://rajanagendra.sun.com/exchange/magesh/Inbox/4%20files%20from%20xp%20folder.EML</a:href>\n"
1086: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
1087: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
1088: + "<prop2>http://rajanagendra.sun.com/exchweb/img/icon-msg-unread.gif</prop2>\n"
1089: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
1090: + "<prop5>Magesh STM</prop5>\n"
1091: + "<prop6>4 files from xp folder</prop6>\n"
1092: + "<prop7 b:dt=\"dateTime.tz\">2002-06-30T12:58:05.368Z</prop7>\n"
1093: + "<prop8 b:dt=\"int\">283718</prop8>\n"
1094: + "<read b:dt=\"boolean\">1</read>\n"
1095: + "<contentclass>IPM.Note</contentclass>\n"
1096: + "</a:prop>\n"
1097: + "</a:propstat>\n"
1098: + "</a:response>\n"
1099: + "<a:response><a:href>http://rajanagendra.sun.com/exchange/magesh/Inbox/4%20files%20from%20msftp4%20folder.EML</a:href>\n"
1100: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
1101: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
1102: + "<prop2>http://rajanagendra.sun.com/exchweb/img/icon-msg-unread.gif</prop2>\n"
1103: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
1104: + "<prop5>Magesh STM</prop5>\n"
1105: + "<prop6>4 files from msftp4 folder</prop6>\n"
1106: + "<prop7 b:dt=\"dateTime.tz\">2002-06-30T12:46:26.864Z</prop7>\n"
1107: + "<prop8 b:dt=\"int\">283722</prop8>\n"
1108: + "<read b:dt=\"boolean\">1</read>\n"
1109: + "<contentclass>IPM.Note</contentclass>\n"
1110: + "</a:prop>\n"
1111: + "</a:propstat>\n"
1112: + "</a:response>\n"
1113: + "<a:response><a:href>http://rajanagendra.sun.com/exchange/magesh/Inbox/No%20Subject-16.EML</a:href>\n"
1114: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
1115: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
1116: + "<prop2>http://rajanagendra.sun.com/exchweb/img/icon-msg-unread.gif</prop2>\n"
1117: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
1118: + "<prop5>Magesh STM</prop5>\n"
1119: + "<prop7 b:dt=\"dateTime.tz\">2002-06-30T12:34:48.550Z</prop7>\n"
1120: + "<prop8 b:dt=\"int\">283695</prop8>\n"
1121: + "<read b:dt=\"boolean\">1</read>\n"
1122: + "<contentclass>IPM.Note</contentclass>\n"
1123: + "</a:prop>\n"
1124: + "</a:propstat>\n"
1125: + "</a:response>\n"
1126: + "<a:response><a:href>http://rajanagendra.sun.com/exchange/magesh/Inbox/4%20files%20from%20msftp%205%20folder.EML</a:href>\n"
1127: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
1128: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
1129: + "<prop2>http://rajanagendra.sun.com/exchweb/img/icon-msg-unread.gif</prop2>\n"
1130: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
1131: + "<prop5>Magesh STM</prop5>\n"
1132: + "<prop6>4 files from msftp 5 folder</prop6>\n"
1133: + "<prop7 b:dt=\"dateTime.tz\">2002-06-30T11:32:09.875Z</prop7>\n"
1134: + "<prop8 b:dt=\"int\">283716</prop8>\n"
1135: + "<read b:dt=\"boolean\">1</read>\n"
1136: + "<contentclass>IPM.Note</contentclass>\n"
1137: + "</a:prop>\n"
1138: + "</a:propstat>\n"
1139: + "</a:response>\n"
1140: + "<a:response><a:href>http://rajanagendra.sun.com/exchange/magesh/Inbox/4%20files%20from%20msftp%205.EML</a:href>\n"
1141: + "<a:propstat><a:status>HTTP/1.1 200 OK</a:status>\n"
1142: + "<a:prop><prop1 b:dt=\"int\">1</prop1>\n"
1143: + "<prop2>http://rajanagendra.sun.com/exchweb/img/icon-msg-unread.gif</prop2>\n"
1144: + "<prop4 b:dt=\"boolean\">1</prop4>\n"
1145: + "<prop5>Magesh STM</prop5>\n"
1146: + "<prop6>4 files from msftp 5</prop6>\n"
1147: + "<prop7 b:dt=\"dateTime.tz\">2002-06-30T11:15:59.469Z</prop7>\n"
1148: + "<prop8 b:dt=\"int\">283586</prop8>\n"
1149: + "<read b:dt=\"boolean\">1</read>\n"
1150: + "<contentclass>IPM.Note</contentclass>\n"
1151: + "</a:prop>\n" + "</a:propstat>\n" + "</a:response>\n"
1152: + "</a:multistatus>";
1153:
1154: String lXMLAttRules = "<Attribute name=\"helpURL\"/>\n"
1155: + "<Attribute name=\"loginHelpURL\" />\n"
1156: + "<Attribute name=\"xmlns\"/>\n";
1157:
1158: String lXMLTagTextRules = "<TagText tag=\"a:href\"/>\n"
1159: + "<TagText tag=\"baseroot\"/>\n"
1160: + "<TagText tag=\"prop2\"/>\n"
1161: + "<TagText tag=\"xsl:attribute\" attributePatterns=\"name=src\" />\n";
1162: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
1163: lXMLAttRules, lXMLTagTextRules);
1164:
1165: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1166: LanguageConstants.XML_MIME);
1167: String lResult = lRewriter.rewrite(lInput,
1168: getDefaultTranslator());
1169: assertXMLEqual(lExpectation, lResult);
1170: }//testOWANameSpacePage()
1171:
1172: public void testSimpleNameSpaceTagText() throws Exception {
1173: String lInput = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
1174: + "<a:multistatus xmlns:b=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\" xmlns:c=\"xml:\" xmlns:d=\"urn:schemas-microsoft-com:office:office\" xmlns:a=\"DAV:\">\n"
1175: + "<a:href>/magesh/Inbox/Undeliverable:%20FW:%20Delivered:%20Delivery%20Status%20Notification%20(Success).EML</a:href>\n"
1176: + "</a:multistatus>\n";
1177:
1178: String lExpectation = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
1179: + "<a:multistatus xmlns:b=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/\" xmlns:c=\"xml:\" xmlns:d=\"urn:schemas-microsoft-com:office:office\" xmlns:a=\"DAV:\">\n"
1180: + "<a:href>http://rajanagendra.sun.com/magesh/Inbox/Undeliverable:%20FW:%20Delivered:%20Delivery%20Status%20Notification%20(Success).EML</a:href>\n"
1181: + "</a:multistatus>";
1182:
1183: String lXMLTagTextRule = "<TagText tag=\"a:href\"/>";
1184: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules("",
1185: lXMLTagTextRule);
1186:
1187: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1188: LanguageConstants.XML_MIME);
1189: String lResult = lRewriter.rewrite(lInput,
1190: getDefaultTranslator());
1191: assertXMLEqual(lExpectation, lResult);
1192: }//testSimpleNameSpaceTagText()
1193:
1194: public void testBugNo4780974TranslatingXSL() throws Exception {
1195: String lInput = "<IMG xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" id=\"folderIcon\" width=\"16\" height=\"16\" border=\"0\" style=\"cursor:hand\" >\n"
1196: + "<xsl:choose>\n"
1197: + " <xsl:when test=\"inbox\">\n"
1198: + " <xsl:attribute name=\"src\">\n"
1199: + " /exchweb/img/tree-inbox.gif\n"
1200: + " </xsl:attribute>\n"
1201: + " </xsl:when>\n"
1202: + " <xsl:when test=\"deleteditems\">\n"
1203: + " <xsl:attribute name=\"src\">\n"
1204: + " /exchweb/img/tree-deleted.gif\n"
1205: + " </xsl:attribute>\n"
1206: + " </xsl:when>\n"
1207: + " <xsl:when test=\"sentitems\">\n"
1208: + " <xsl:attribute name=\"src\">\n"
1209: + " /exchweb/img/tree-sent_itm.gif\n"
1210: + " </xsl:attribute>\n"
1211: + " </xsl:when>\n"
1212: + " <xsl:when test=\"outbox\">\n"
1213: + " <xsl:attribute name=\"src\">\n"
1214: + " /exchweb/img/tree-outbox.gif\n"
1215: + " </xsl:attribute>\n"
1216: + " </xsl:when>\n"
1217: + " <xsl:otherwise>\n"
1218: + " <xsl:attribute name=\"src\">\n"
1219: + " <xsl:value-of select=\"g:smallicon\" />\n"
1220: + " </xsl:attribute>\n"
1221: + " </xsl:otherwise>\n"
1222: + " </xsl:choose>\n" + "</IMG>\n";
1223:
1224: String lExpectation = "<IMG xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" id=\"folderIcon\" width=\"16\" height=\"16\" border=\"0\" style=\"cursor:hand\">\n"
1225: + "<xsl:choose>\n"
1226: + " <xsl:when test=\"inbox\">\n"
1227: + " <xsl:attribute name=\"src\">\n"
1228: + " http://rajanagendra.sun.com/exchweb/img/tree-inbox.gif\n"
1229: + " </xsl:attribute>\n"
1230: + " </xsl:when>\n"
1231: + " <xsl:when test=\"deleteditems\">\n"
1232: + " <xsl:attribute name=\"src\">\n"
1233: + " http://rajanagendra.sun.com/exchweb/img/tree-deleted.gif\n"
1234: + " </xsl:attribute>\n"
1235: + " </xsl:when>\n"
1236: + " <xsl:when test=\"sentitems\">\n"
1237: + " <xsl:attribute name=\"src\">\n"
1238: + " http://rajanagendra.sun.com/exchweb/img/tree-sent_itm.gif\n"
1239: + " </xsl:attribute>\n"
1240: + " </xsl:when>\n"
1241: + " <xsl:when test=\"outbox\">\n"
1242: + " <xsl:attribute name=\"src\">\n"
1243: + " http://rajanagendra.sun.com/exchweb/img/tree-outbox.gif\n"
1244: + " </xsl:attribute>\n"
1245: + " </xsl:when>\n"
1246: + " <xsl:otherwise>\n"
1247: + " <xsl:attribute name=\"src\">\n"
1248: + " <xsl:value-of select=\"g:smallicon\"/>\n"
1249: + " </xsl:attribute>\n"
1250: + " </xsl:otherwise>\n"
1251: + " </xsl:choose>\n" + "</IMG>";
1252:
1253: String[] lXMLTagTextRule = {
1254: "<TagText tag=\"xsl:attribute\" attributePatterns=\"name=src\"/>",
1255: "<TagText tag=\"xsl*attribute\" attributePatterns=\"name=src\"/>",
1256: "<TagText tag=\"xsl*\" attributePatterns=\"name=src\"/>",
1257: "<TagText tag=\"x*e\" attributePatterns=\"name=src\"/>",
1258: "<TagText tag=\"xsl:attribute\" attributePatterns=\"n*me=s*c\"/>", };
1259:
1260: for (int i = 0; i < lXMLTagTextRule.length; i++) {
1261: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules("",
1262: lXMLTagTextRule[i]);
1263:
1264: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1265: LanguageConstants.XML_MIME);
1266: String lResult = lRewriter.rewrite(lInput,
1267: getDefaultTranslator());
1268: assertXMLEqual(lExpectation, lResult);
1269: }
1270: }//testBugNo4780974TranslatingXSL()
1271:
1272: public void testCaseSensitivityInTagTextRule() throws Exception {
1273: String lInput = "<IMG xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" id=\"folderIcon\" width=\"16\" height=\"16\" border=\"0\" style=\"cursor:hand\">\n"
1274: + "<xsl:choose>abc.html</xsl:choose>\n"
1275: + "<icon>/iconDraw.gif</icon>\n"
1276: + "<attribute name=\"src\">/iconDraw.gif</attribute>\n"
1277: + "</IMG>\n";
1278:
1279: String lExpectation = "<IMG xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" id=\"folderIcon\" width=\"16\" height=\"16\" border=\"0\" style=\"cursor:hand\">\n"
1280: + "<xsl:choose>http://rajanagendra.sun.com/Base/Raja/abc.html</xsl:choose>\n"
1281: + "<icon>http://rajanagendra.sun.com/iconDraw.gif</icon>\n"
1282: + "<attribute name=\"src\">http://rajanagendra.sun.com/iconDraw.gif</attribute>\n"
1283: + "</IMG>";
1284:
1285: String[] lXMLTagTextRule = {
1286: "<TagText tag=\"xsl:choose\"/>"
1287: + "<TagText tag=\"icon\"/>"
1288: + "<TagText tag=\"attribute\" attributePatterns=\"name=src\"/>",
1289: "<TagText tag=\"*:choose\"/>"
1290: + "<TagText tag=\"icon\"/>"
1291: + "<TagText tag=\"attribute\" attributePatterns=\"name=src\"/>",
1292: "<TagText tag=\"*choose\"/>"
1293: + "<TagText tag=\"icon\"/>"
1294: + "<TagText tag=\"attribute\" attributePatterns=\"name=src\"/>",
1295: "<TagText tag=\"*choose\"/>"
1296: + "<TagText tag=\"icon\"/>"
1297: + "<TagText tag=\"attribute\" attributePatterns=\"*=*\"/>",
1298: "<TagText tag=\"*choose\"/>"
1299: + "<TagText tag=\"icon\"/>"
1300: + "<TagText tag=\"attribute\" attributePatterns=\"name=*\"/>",
1301: "<TagText tag=\"*choose\"/>"
1302: + "<TagText tag=\"icon\"/>"
1303: + "<TagText tag=\"attribute\" attributePatterns=\"*=src\"/>",
1304: "<TagText tag=\"*choose\"/>"
1305: + "<TagText tag=\"icon\"/>"
1306: + "<TagText tag=\"attribute\" attributePatterns=\"name=s*rc\"/>", };
1307:
1308: for (int i = 0; i < lXMLTagTextRule.length; i++) {
1309: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules("",
1310: lXMLTagTextRule[i]);
1311:
1312: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1313: LanguageConstants.XML_MIME);
1314: String lResult = lRewriter.rewrite(lInput,
1315: getDefaultTranslator());
1316: assertXMLEqual("i=" + i, lExpectation, lResult);
1317: }
1318: }//testCaseSensitivityInTagTextRule()
1319:
1320: public void testMultiTagsInTagTextRule() throws Exception {
1321: String lInput = "<IMG xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" id=\"folderIcon\" width=\"16\" height=\"16\" border=\"0\" style=\"cursor:hand\">\n"
1322: + "<xsl:choose>abc.html</xsl:choose>\n"
1323: + "<icon>/iconDraw.gif</icon>\n"
1324: + "<iCon>/iconDraw.gif</iCon>\n"
1325: + "<Icon>/iconDraw.gif</Icon>\n"
1326: + "<attribute name=\"src\">/iconDraw.gif</attribute>\n"
1327: + "</IMG>\n";
1328:
1329: String lExpectation = "<IMG xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" id=\"folderIcon\" width=\"16\" height=\"16\" border=\"0\" style=\"cursor:hand\">\n"
1330: + "<xsl:choose>http://rajanagendra.sun.com/Base/Raja/abc.html</xsl:choose>\n"
1331: + "<icon>http://rajanagendra.sun.com/iconDraw.gif</icon>\n"
1332: + "<iCon>http://rajanagendra.sun.com/iconDraw.gif</iCon>\n"
1333: + "<Icon>http://rajanagendra.sun.com/iconDraw.gif</Icon>\n"
1334: + "<attribute name=\"src\">http://rajanagendra.sun.com/iconDraw.gif</attribute>\n"
1335: + "</IMG>";
1336:
1337: String[] lXMLTagTextRule = {
1338: "<TagText tag=\"xsl:choose\"/>"
1339: + "<TagText tag=\"icon;Icon;iCon\"/>"
1340: + "<TagText tag=\"attribute\" attributePatterns=\"name=src\"/>",
1341:
1342: "<TagText tag=\"*:choose\"/>"
1343: + "<TagText tag=\"*on\"/>"
1344: + "<TagText tag=\"attribute\" attributePatterns=\"name=src\"/>",
1345:
1346: "<TagText tag=\"*choose\"/>"
1347: + "<TagText tag=\"i*on;Icon\"/>"
1348: + "<TagText tag=\"attribute\" attributePatterns=\"name=src\"/>",
1349:
1350: "<TagText tag=\"*choose\"/>"
1351: + "<TagText tag=\"icon;*Con;I*on\"/>"
1352: + "<TagText tag=\"attribute\" attributePatterns=\"*=*\"/>", };
1353:
1354: for (int i = 0; i < lXMLTagTextRule.length; i++) {
1355: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules("",
1356: lXMLTagTextRule[i]);
1357:
1358: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1359: LanguageConstants.XML_MIME);
1360: String lResult = lRewriter.rewrite(lInput,
1361: getDefaultTranslator());
1362: assertXMLEqual("i=" + i, lExpectation, lResult);
1363: }
1364: }//testMultiTagsInTagTextRule()
1365:
1366: public void testCaseSensitivityInTagTextRuleNegative()
1367: throws Exception {
1368: String lInput = "<IMG xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" id=\"folderIcon\" width=\"16\" height=\"16\" border=\"0\" style=\"cursor:hand\">\n"
1369: + "<xsl:Choose>abc.html</xsl:Choose>\n"
1370: + "<Icon>/iconDraw.gif</Icon>\n"
1371: + "<Attribute name=\"src\">/iconDraw.gif</Attribute>\n"
1372: + "</IMG>\n";
1373:
1374: String lExpectation = "<IMG xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" id=\"folderIcon\" width=\"16\" height=\"16\" border=\"0\" style=\"cursor:hand\">\n"
1375: + "<xsl:Choose>abc.html</xsl:Choose>\n"
1376: + "<Icon>/iconDraw.gif</Icon>\n"
1377: + "<Attribute name=\"src\">/iconDraw.gif</Attribute>\n"
1378: + "</IMG>";
1379:
1380: String[] lXMLTagTextRule = {
1381: "<TagText tag=\"xsl:choose\"/>"
1382: + "<TagText tag=\"icon\"/>"
1383: + "<TagText tag=\"attribute\" attributePatterns=\"name=src\"/>",
1384: "<TagText tag=\"*:choose\"/>"
1385: + "<TagText tag=\"icon\"/>"
1386: + "<TagText tag=\"attribute\" attributePatterns=\"name=src\"/>",
1387: "<TagText tag=\"*choose\"/>"
1388: + "<TagText tag=\"icon\"/>"
1389: + "<TagText tag=\"attribute\" attributePatterns=\"name=src\"/>",
1390: "<TagText tag=\"*choOse\"/>"
1391: + "<TagText tag=\"icon\"/>"
1392: + "<TagText tag=\"Attribute\" attributePatterns=\"name=Src\"/>",
1393: "<TagText tag=\"*CHoose\"/>"
1394: + "<TagText tag=\"icon\"/>"
1395: + "<TagText tag=\"Attribute\" attributePatterns=\"Name=src\"/>", };
1396:
1397: for (int i = 0; i < lXMLTagTextRule.length; i++) {
1398: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules("",
1399: lXMLTagTextRule[i]);
1400:
1401: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1402: LanguageConstants.XML_MIME);
1403: String lResult = lRewriter.rewrite(lInput,
1404: getDefaultTranslator());
1405: assertXMLEqual("i=" + i, lExpectation, lResult);
1406: }
1407: }//testCaseSensitivityInTagTextRule()
1408:
1409: public void testBugNo4837830DuplicateOfNo4837830() throws Exception {
1410: String lInput = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
1411: + "<text><TEST_text_message> 1</text>";
1412:
1413: String lExpectation = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
1414: + "<text><TEST_text_message> 1</text>";
1415:
1416: RuleSet lRuleSet = CreateRuleSet.emptyRuleSet();
1417: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1418: LanguageConstants.XML_MIME);
1419: String lResult = lRewriter.rewrite(lInput,
1420: getDefaultTranslator());
1421: assertXMLEqual(lExpectation, lResult);
1422: }//testBugNo4837830DuplicateOfNo4837830()
1423:
1424: public void testCDATASection() throws Exception {
1425: String lInput = "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">"
1426: + "<xsl:script><![CDATA[ //> end CDATA tag for VID colorizing\n"
1427: + "\n"
1428: + "//ADDGLOBALSHERE\n"
1429: + "//>\n"
1430: + "]]></xsl:script>" + "</xsl:stylesheet>";
1431:
1432: String lExpectation = "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">"
1433: + "<xsl:script><![CDATA[ //> end CDATA tag for VID colorizing\n"
1434: + "\n"
1435: + "//ADDGLOBALSHERE\n"
1436: + "//>\n"
1437: + "]]></xsl:script>" + "</xsl:stylesheet>";
1438:
1439: RuleSet lRuleSet = CreateRuleSet.emptyRuleSet();
1440: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1441: LanguageConstants.XML_MIME);
1442: String lResult = lRewriter.rewrite(lInput,
1443: getDefaultTranslator());
1444: assertXMLEqual(lExpectation, lResult);
1445: }//testCDATASection()
1446:
1447: public void testUrlInCDATA() throws Exception {
1448: String input = "<attribute name=\"src\"><![CDATA[raja.html]]></attribute>";
1449: String expectation = "<attribute name=\"src\"><![CDATA[http://rajanagendra.sun.com/Base/Raja/raja.html]]></attribute>";
1450:
1451: String rules = "<TagText tag=\"attribute\" attributePatterns=\"name=src\" /> ";
1452:
1453: RuleSet ruleset = CreateRuleSet.withXMLTagTextRules(rules);
1454: Rewriter rewriter = RewriterPool.create(ruleset,
1455: LanguageConstants.XML_MIME);
1456: String result = rewriter.rewrite(input, getDefaultTranslator());
1457: System.out.println("result = " + result);
1458: assertXMLEqual(expectation, result);
1459: }//testUrlInCDATA()
1460:
1461: public void testCDATASectionVarient() throws Exception {
1462: String lInput = "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">"
1463: + "<xsl:script>\n"
1464: + "\n"
1465: + "//ADDGLOBALSHERE\n"
1466: + "\n"
1467: + "<![CDATA[ //> end CDATA tag for VID colorizing\n"
1468: + "var rgDate=new Array();\n"
1469: + "//>\n"
1470: + "]]>\n"
1471: + "</xsl:script>\n" + "\n" + "</xsl:stylesheet>\n";
1472:
1473: String lExpectation = "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">"
1474: + "<xsl:script>\n"
1475: + "\n"
1476: + "//ADDGLOBALSHERE\n"
1477: + "\n"
1478: + "<![CDATA[ //> end CDATA tag for VID colorizing\n"
1479: + "var rgDate=new Array();\n"
1480: + "//>\n"
1481: + "]]>\n"
1482: + "</xsl:script>\n" + "\n" + "</xsl:stylesheet>";
1483:
1484: RuleSet lRuleSet = CreateRuleSet.emptyRuleSet();
1485: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1486: LanguageConstants.XML_MIME);
1487: String lResult = lRewriter.rewrite(lInput,
1488: getDefaultTranslator());
1489: assertXMLEqual(lExpectation, lResult);
1490: }//testCDATASectionVarient()
1491:
1492: public void testCDATASectionVarient1() throws Exception {
1493: String lInput = "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">"
1494: + "<xsl:script>\n"
1495: + "\n"
1496: + "//ADDGLOBALSHERE\n"
1497: + "\n"
1498: + "<![CDATA[ //> end CDATA tag for VID colorizing\n"
1499: + "var rgDate=new Array();\n"
1500: + "//>\n"
1501: + "]]>\n//abcdefgh"
1502: + "</xsl:script>\n"
1503: + "\n"
1504: + "</xsl:stylesheet>\n";
1505:
1506: String lExpectation = "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">"
1507: + "<xsl:script>\n"
1508: + "\n"
1509: + "//ADDGLOBALSHERE\n"
1510: + "\n"
1511: + "<![CDATA[ //> end CDATA tag for VID colorizing\n"
1512: + "var rgDate=new Array();\n"
1513: + "//>\n"
1514: + "]]>\n//abcdefgh"
1515: + "</xsl:script>\n"
1516: + "\n"
1517: + "</xsl:stylesheet>";
1518:
1519: RuleSet lRuleSet = CreateRuleSet.emptyRuleSet();
1520: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1521: LanguageConstants.XML_MIME);
1522: String lResult = lRewriter.rewrite(lInput,
1523: getDefaultTranslator());
1524: assertXMLEqual(lExpectation, lResult);
1525: }//testCDATASectionVarient1()
1526:
1527: public void testCDATASectionVarient2() throws Exception {
1528: String lInput = "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">"
1529: + "<xsl:script>\n"
1530: + "\n"
1531: + "//ADDGLOBALSHERE\n"
1532: + "\n"
1533: + "<![CDATA[ //> end CDATA tag for VID colorizing\n"
1534: + "var rgDate=new Array();\n"
1535: + "//>\n"
1536: + "]]>\n"
1537: + "</xsl:script>\n" + "\n" + "</xsl:stylesheet>\n";
1538:
1539: String lExpectation = "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">"
1540: + "<xsl:script>\n"
1541: + "\n"
1542: + "//ADDGLOBALSHERE\n"
1543: + "\n"
1544: + "<![CDATA[ //> end CDATA tag for VID colorizing\n"
1545: + "var rgDate=new Array();\n"
1546: + "//>\n"
1547: + "]]>\n"
1548: + "</xsl:script>\n" + "\n" + "</xsl:stylesheet>";
1549:
1550: RuleSet lRuleSet = CreateRuleSet.emptyRuleSet();
1551: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1552: LanguageConstants.XML_MIME);
1553: String lResult = lRewriter.rewrite(lInput,
1554: getDefaultTranslator());
1555: assertXMLEqual(lExpectation, lResult);
1556: assertXMLEqual(lInput, lExpectation);
1557: }//testCDATASectionVarient2()
1558:
1559: public void testQuetoesProblem() throws Exception {
1560: String lInput = "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" xmlns:d=\"urn:schemas:httpmail:\" xmlns:g=\"http://schemas.microsoft.com/exchange/\" xmlns:f=\"urn:schemas-microsoft-com:office:office\" xmlns:a=\"DAV:\" default-space=\"strip\">\n"
1561: + "<xsl:element name=\"xsl:eval\">formatDateTimeString(this.text, \"<xsl:value-of select='dateformat' />\", \"<xsl:value-of select='timeformat'/>\")</xsl:element>\n"
1562: + "</xsl:stylesheet>\n";
1563:
1564: String lExpectation = "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" xmlns:d=\"urn:schemas:httpmail:\" xmlns:g=\"http://schemas.microsoft.com/exchange/\" xmlns:f=\"urn:schemas-microsoft-com:office:office\" xmlns:a=\"DAV:\" default-space=\"strip\">\n"
1565: + "<xsl:element name=\"xsl:eval\">formatDateTimeString(this.text, \"<xsl:value-of select='dateformat'/>\", \"<xsl:value-of select='timeformat'/>\")</xsl:element>\n"
1566: + "</xsl:stylesheet>";
1567:
1568: RuleSet lRuleSet = CreateRuleSet.emptyRuleSet();
1569: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1570: LanguageConstants.XML_MIME);
1571: String lResult = lRewriter.rewrite(lInput,
1572: getDefaultTranslator());
1573: assertXMLEqual(lExpectation, lResult);
1574: assertXMLEqual(lInput, lExpectation);
1575: }//testQuetoesProblem()
1576:
1577: public void testIESPANAndDivProblem() throws Exception {
1578: String lInput = "<xml>" + "<abV></abV>" + "<span></span>"
1579: + "<abV></abV>" + "<span> </span>"
1580: + "<span> </span>" + "<spaN></spaN>"
1581: + "<SPAN></SPAN>" + "<SPAN> </SPAN>" + "<div></div>"
1582: + "<div> </div>" + "<xyz/>" + "<div> </div>"
1583: + "<diV></diV>" + "<DIV></DIV>" + "<DIV> </DIV>"
1584: + "<abc></abc>" + "<abc> </abc>" + "<abc> </abc>"
1585: + "<abV></abV>" + "<ABC></ABC>" + "<xyz/>"
1586: + "<ABC> </ABC>" + "</xml>";
1587:
1588: String lExpectation = "<xml>" + "<abV/>" + "<span></span>"
1589: + "<abV/>" + "<span> </span>" + "<span> </span>"
1590: + "<spaN></spaN>" + "<SPAN></SPAN>" + "<SPAN> </SPAN>"
1591: + "<div></div>" + "<div> </div>" + "<xyz/>"
1592: + "<div> </div>" + "<diV></diV>" + "<DIV></DIV>"
1593: + "<DIV> </DIV>" + "<abc/>" + "<abc> </abc>"
1594: + "<abc> </abc>" + "<abV/>" + "<ABC/>" + "<xyz/>"
1595: + "<ABC> </ABC>" + "</xml>";
1596:
1597: RuleSet lRuleSet = CreateRuleSet.emptyRuleSet();
1598: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1599: LanguageConstants.XML_MIME);
1600: String lResult = lRewriter.rewrite(lInput,
1601: getDefaultTranslator());
1602: assertXMLEqual(lExpectation, lResult);
1603: }//testIESPANAndDivProblem()
1604:
1605: public void testWRONInputContextMenu() throws Exception {
1606: String lInput = "<XML>"
1607: + "<DIV id=\\\"MENU_SPAN_ID\\\" style=\\\"PADDING-RIGHT: 5px; PADDING-LEFT: 5px; Z-INDEX: 1000000; WIDTH: 100%; COLOR: menutext; BACKGROUND-COLOR: menu\\\" noWrap><SPAN onclick='idTreeMenu.hide();MenuSelect(\\\"Refresh\\\");'><SPAN id=\\\"IMAGEITEM\\\" style=\\\"DISPLAY: none; WIDTH: 20px; CURSOR: hand; POSITION: relative; HEIGHT: 10px; BACKGROUND-COLOR: transparent\\\"></SPAN><SPAN id=\\\"idTreeMenuCAPTION0_0\\\" style=\\\"FONT-SIZE: x-small; WIDTH: 100%; CURSOR: hand; BACKGROUND-COLOR: transparent\\\">Update Folder</SPAN></SPAN></DIV>\n"
1608: + "<DIV id=\\\"MENU_SPAN_ID\\\" style=\\\"PADDING-RIGHT: 5px; PADDING-LEFT: 5px; Z-INDEX: 1000000; WIDTH: 100%; COLOR: menutext; BACKGROUND-COLOR: menu\\\" noWrap><SPAN onclick='idTreeMenu.hide();MenuSelect(\\\"Open\\\");'><SPAN id=\\\"IMAGEITEM\\\" style=\\\"DISPLAY: none; WIDTH: 20px; CURSOR: hand; POSITION: relative; HEIGHT: 10px; BACKGROUND-COLOR: transparent\\\"></SPAN><SPAN id=\\\"idTreeMenuCAPTION1_0\\\" style=\\\"FONT-SIZE: x-small; WIDTH: 100%; CURSOR: hand; BACKGROUND-COLOR: transparent\\\">Open</SPAN></SPAN></DIV>\n"
1609: + "<DIV id=\\\"MENU_SPAN_ID\\\" style=\\\"PADDING-RIGHT: 5px; PADDING-LEFT: 5px; Z-INDEX: 1000000; WIDTH: 100%; COLOR: menutext; BACKGROUND-COLOR: menu\\\" noWrap><SPAN onclick='idTreeMenu.hide();MenuSelect(\\\"OpenNewWindow\\\");'><SPAN id=\\\"IMAGEITEM\\\" style=\\\"DISPLAY: none; WIDTH: 20px; CURSOR: hand; POSITION: relative; HEIGHT: 10px; BACKGROUND-COLOR: transparent\\\"></SPAN><SPAN id=\\\"idTreeMenuCAPTION2_0\\\" style=\\\"FONT-SIZE: x-small; WIDTH: 100%; CURSOR: hand; BACKGROUND-COLOR: transparent\\\">Open in New...</SPAN></SPAN></DIV>\n"
1610: + "<HR>\n"
1611: + "\n"
1612: + "<DIV id=\\\"MENU_SPAN_ID\\\" style=\\\"PADDING-RIGHT: 5px; PADDING-LEFT: 5px; Z-INDEX: 1000000; WIDTH: 100%; COLOR: menutext; BACKGROUND-COLOR: menu\\\" noWrap><SPAN onclick='idTreeMenu.hide();MenuSelect(\\\"Move\\\");'><SPAN id=\\\"IMAGEITEM\\\" style=\\\"DISPLAY: none; WIDTH: 20px; CURSOR: hand; POSITION: relative; HEIGHT: 10px; BACKGROUND-COLOR: transparent\\\"></SPAN><SPAN id=\\\"idTreeMenuCAPTION4_0\\\" style=\\\"FONT-SIZE: x-small; WIDTH: 100%; CURSOR: hand; BACKGROUND-COLOR: transparent\\\">Move</SPAN></SPAN></DIV>\n"
1613: + "<DIV id=\\\"MENU_SPAN_ID\\\" style=\\\"PADDING-RIGHT: 5px; PADDING-LEFT: 5px; Z-INDEX: 1000000; WIDTH: 100%; COLOR: menutext; BACKGROUND-COLOR: menu\\\" noWrap><SPAN onclick='idTreeMenu.hide();MenuSelect(\\\"Copy\\\");'><SPAN id=\\\"IMAGEITEM\\\" style=\\\"DISPLAY: none; WIDTH: 20px; CURSOR: hand; POSITION: relative; HEIGHT: 10px; BACKGROUND-COLOR: transparent\\\"></SPAN><SPAN id=\\\"idTreeMenuCAPTION5_0\\\" style=\\\"FONT-SIZE: x-small; WIDTH: 100%; CURSOR: hand; BACKGROUND-COLOR: transparent\\\">Copy</SPAN></SPAN></DIV>\n"
1614: + "<HR>\n"
1615: + "\n"
1616: + "<DIV id=\\\"MENU_SPAN_ID\\\" style=\\\"PADDING-RIGHT: 5px; PADDING-LEFT: 5px; Z-INDEX: 1000000; WIDTH: 100%; COLOR: menutext; BACKGROUND-COLOR: menu\\\" noWrap><SPAN onclick='idTreeMenu.hide();MenuSelect(\\\"Delete\\\");'><SPAN id=\\\"IMAGEITEM\\\" style=\\\"DISPLAY: none; WIDTH: 20px; CURSOR: hand; POSITION: relative; HEIGHT: 10px; BACKGROUND-COLOR: transparent\\\"></SPAN><SPAN id=\\\"idTreeMenuCAPTION7_0\\\" style=\\\"FONT-SIZE: x-small; WIDTH: 100%; CURSOR: hand; BACKGROUND-COLOR: transparent\\\">Delete</SPAN></SPAN></DIV>\n"
1617: + "<DIV id=\\\"MENU_SPAN_ID\\\" style=\\\"PADDING-RIGHT: 5px; PADDING-LEFT: 5px; Z-INDEX: 1000000; WIDTH: 100%; COLOR: menutext; BACKGROUND-COLOR: menu\\\" noWrap><SPAN onclick='idTreeMenu.hide();MenuSelect(\\\"Rename\\\");'><SPAN id=\\\"IMAGEITEM\\\" style=\\\"DISPLAY: none; WIDTH: 20px; CURSOR: hand; POSITION: relative; HEIGHT: 10px; BACKGROUND-COLOR: transparent\\\"></SPAN><SPAN id=\\\"idTreeMenuCAPTION8_0\\\" style=\\\"FONT-SIZE: x-small; WIDTH: 100%; CURSOR: hand; BACKGROUND-COLOR: transparent\\\">Rename</SPAN></SPAN></DIV>\n"
1618: + "<DIV id=\\\"MENU_SPAN_ID\\\" style=\\\"PADDING-RIGHT: 5px; PADDING-LEFT: 5px; Z-INDEX: 1000000; WIDTH: 100%; COLOR: menutext; BACKGROUND-COLOR: menu\\\" noWrap><SPAN onclick='idTreeMenu.hide();MenuSelect(\\\"New Folder\\\");'><SPAN id=\\\"IMAGEITEM\\\" style=\\\"DISPLAY: none; WIDTH: 20px; CURSOR: hand; POSITION: relative; HEIGHT: 10px; BACKGROUND-COLOR: transparent\\\"></SPAN><SPAN id=\\\"idTreeMenuCAPTION9_0\\\" style=\\\"FONT-SIZE: x-small; WIDTH: 100%; CURSOR: hand; BACKGROUND-COLOR: transparent\\\">New Folder</SPAN></SPAN></DIV>\n"
1619: + "</XML>";
1620:
1621: RuleSet lRuleSet = CreateRuleSet.emptyRuleSet();
1622: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1623: LanguageConstants.XML_MIME);
1624: String lResult = lRewriter.rewrite(lInput,
1625: getDefaultTranslator());
1626: assertEquals(lInput, lResult);
1627: }//testContextMenu()
1628:
1629: public void tesXMLProvider() throws Exception {
1630: String lInput = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n"
1631: + "<sample>\n"
1632: + " thaw.singapore:28080 this is some text & "\n"
1633: + "</sample>\n";
1634:
1635: String lExpectation = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
1636: + "<sample>\n"
1637: + " thaw.singapore:28080 this is some text & "\n"
1638: + "</sample>";
1639:
1640: RuleSet lRuleSet = CreateRuleSet.emptyRuleSet();
1641: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1642: LanguageConstants.XML_MIME);
1643: String lResult = lRewriter.rewrite(lInput,
1644: getDefaultTranslator());
1645: assertXMLEqual(lExpectation, lResult);
1646: assertXMLEqual(lInput, lResult);
1647: }//tesXMLProvider()
1648:
1649: public void tesXMLProviderVarient() throws Exception {
1650: String lInput = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n"
1651: + "<sample name=\"rwe&re "lkjdsfl >j ourweoiewr <\">\n"
1652: + " thaw.singapore:28080 this is some text & "\n"
1653: + "</sample>\n";
1654:
1655: String lExpectation = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
1656: + "<sample name=\"rwe&re "lkjdsfl >j ourweoiewr <\">\n"
1657: + " thaw.singapore:28080 this is some text & "\n"
1658: + "</sample>";
1659:
1660: RuleSet lRuleSet = CreateRuleSet.emptyRuleSet();
1661: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1662: LanguageConstants.XML_MIME);
1663: String lResult = lRewriter.rewrite(lInput,
1664: getDefaultTranslator());
1665: assertEquals(lExpectation, lResult);
1666: assertXMLEqual(lInput, lResult);
1667: }//tesXMLProviderVarient()
1668:
1669: public void testPCDataNull() throws Exception {
1670: String lInput = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
1671: + " <text>\n"
1672: + " <para>this will render correctly</para>\n"
1673: + " <para>\n"
1674: + " THIS WILL NOT APPEAR\n"
1675: + " <b>bold text</b>\n"
1676: + " this will appear\n"
1677: + " </para>\n" + " </text> \n";
1678:
1679: String lExpectation = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
1680: + " <text>\n"
1681: + " <para>this will render correctly</para>\n"
1682: + " <para>\n"
1683: + " THIS WILL NOT APPEAR\n"
1684: + " <b>bold text</b>\n"
1685: + " this will appear\n"
1686: + " </para>\n" + " </text>";
1687:
1688: RuleSet lRuleSet = CreateRuleSet.emptyRuleSet();
1689: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1690: LanguageConstants.XML_MIME);
1691: String lResult = lRewriter.rewrite(lInput,
1692: getDefaultTranslator());
1693: //assertEquals( lExpectation, lResult );
1694: assertXMLEqual(lInput, lResult);
1695: }//testPCDataNull()
1696:
1697: public void testInLineDTD_ignore() throws Exception {
1698: String lInput = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
1699: + "<!DOCTYPE vCard SYSTEM \"jar://rewriter.jar/resources/RuleSet.dtd\" \n"
1700: + "[\n"
1701: + "<!ELEMENT vCard (%prop.man;, (%prop.opt; |\n"
1702: + "x-lotus-blood-type)+)>\n"
1703: + "<!ELEMENT x-lotus-blood-type (#PCDATA)>\n"
1704: + "<!ATTLIST x-lotus-blood-type value NOTATION(X-NAME) #IMPLIED>\n"
1705: + "]>\n" + "\n" + "<vCard\n" + "version=\"3.0\"\n"
1706: + "prodid=\"-//HandGen//NONSGML vGen v1.0//EN\">\n"
1707: + "<fn>Frank Dawson</fn>\n"
1708: + "<n> <family>Dawson</family>\n"
1709: + "<given>Frank</given></n>\n"
1710: + "<tel tel.type=\"WORK MSG\">+1-617-693-8728</tel>\n"
1711: + "<x-lotus-blood-type>O+</x-lotus-blood-type>\n"
1712: + "</vCard>\n";
1713:
1714: String lExpectation = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
1715: + "<!DOCTYPE vCard PUBLIC \"abc.html\"\n"
1716: + "[\n"
1717: + "<!ELEMENT vCard (%prop.man;, (%prop.opt; |\n"
1718: + "x-lotus-blood-type)+)>\n"
1719: + "<!ELEMENT x-lotus-blood-type (#PCDATA)>\n"
1720: + "<!ATTLIST x-lotus-blood-type value NOTATION(X-NAME) #IMPLIED>\n"
1721: + "]>\n"
1722: + "\n"
1723: + "<vCard\n"
1724: + "version=\"3.0\"\n"
1725: + "prodid=\"-//HandGen//NONSGML vGen v1.0//EN\">\n"
1726: + "<fn>Frank Dawson</fn>\n"
1727: + "<n> <family>Dawson</family>\n"
1728: + "<given>Frank</given></n>\n"
1729: + "<tel tel.type=\"WORK MSG\">+1-617-693-8728</tel>\n"
1730: + "<x-lotus-blood-type>O+</x-lotus-blood-type>\n"
1731: + "</vCard>";
1732:
1733: String lXMLTagTextRules = "<TagText tag=\"given\"/>";
1734: RuleSet lRuleSet = CreateRuleSet
1735: .withXMLTagTextRules(lXMLTagTextRules);
1736: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1737: LanguageConstants.XML_MIME);
1738: String lResult = lRewriter.rewrite(lInput,
1739: getDefaultTranslator());
1740: //assertEquals( lExpectation, lResult );
1741: }//testInLineDTD()
1742:
1743: public void testInLineDTDVarient_ignore() throws Exception {
1744: String lInput = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
1745: + "<!DOCTYPE vCard PUBLIC \"//IETF//DTD vCard v3.0//EN\"\n"
1746: + "[\n"
1747: + "<!ENTITY photo1 SYSTEM \"http://host.com/pub/photos/frd-photo.jpg\"\n"
1748: + "NDATA JPEG>\n"
1749: + "<!NOTATION JPEG PUBLIC \"ISO/IEC 10918:1993//NOTATION Digital\n"
1750: + "Compression and Coding of Continuous-tone Still Images (JPEG)//EN\" >\n"
1751: + "]>\n"
1752: + "\n"
1753: + "<vCard\n"
1754: + "version=\"3.0\"\n"
1755: + "prodid=\"-//HandGen//NONSGML vGen v1.0//EN\">\n"
1756: + "<fn>Frank Dawson</fn>\n"
1757: + "<n> <family>Dawson</family>\n"
1758: + "<given>Frank</given></n>\n"
1759: + "<tel tel.type=\"WORK MSG\">+1-617-693-8728</tel>\n"
1760: + "<photo img.type=\"JPEG\"><extref uri=\"photo1\" /></photo>\n"
1761: + "<email email.type=\"INTERNET\">Frank_Dawson@Lotus.com</email>\n"
1762: + "</vCard>\n";
1763:
1764: String lExpectation = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
1765: + "<!DOCTYPE vCard PUBLIC \"abc.html\"\n"
1766: + "[\n"
1767: + "<!ELEMENT vCard (%prop.man;, (%prop.opt; |\n"
1768: + "x-lotus-blood-type)+)>\n"
1769: + "<!ELEMENT x-lotus-blood-type (#PCDATA)>\n"
1770: + "<!ATTLIST x-lotus-blood-type value NOTATION(X-NAME) #IMPLIED>\n"
1771: + "]>\n"
1772: + "\n"
1773: + "<vCard\n"
1774: + "version=\"3.0\"\n"
1775: + "prodid=\"-//HandGen//NONSGML vGen v1.0//EN\">\n"
1776: + "<fn>Frank Dawson</fn>\n"
1777: + "<n> <family>Dawson</family>\n"
1778: + "<given>Frank</given></n>\n"
1779: + "<tel tel.type=\"WORK MSG\">+1-617-693-8728</tel>\n"
1780: + "<x-lotus-blood-type>O+</x-lotus-blood-type>\n"
1781: + "</vCard>";
1782:
1783: String lXMLTagTextRules = "<TagText tag=\"given\"/>";
1784: RuleSet lRuleSet = CreateRuleSet
1785: .withXMLTagTextRules(lXMLTagTextRules);
1786: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1787: LanguageConstants.XML_MIME);
1788: String lResult = lRewriter.rewrite(lInput,
1789: getDefaultTranslator());
1790: //assertEquals( lExpectation, lResult );
1791: }//testInLineDTDVarient()
1792:
1793: public void testInLineDTDVarient1_ignore() throws Exception {
1794: String lInput = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
1795: + "<!DOCTYPE X3D PUBLIC \"-//X3D//Blah Blah//EN\" \n"
1796: + " \"http://www.web3D.org/TaskGroups/x3d/translation/x3d-compromise.dtd\"\n"
1797: + " \"file://opt/hmorgan/xj3d/8-11-02/DTD/x3d-3.0.dtd\" [\n"
1798: + " <!ENTITY % Vrml97Profile \"IGNORE\">\n"
1799: + " <!ENTITY % CoreProfile \"INCLUDE\">\n"
1800: + " <!ENTITY % X3dExtensions \"IGNORE\">\n"
1801: + " <!ENTITY % GeoVrmlProfile \"IGNORE\">\n"
1802: + " ]>\n"
1803: + "<X3D>\n"
1804: + " <Scene>\n"
1805: + " <Group>\n"
1806: + " <children>\n"
1807: + " <Shape>\n"
1808: + " <IndexedLineSet coordIndex=\"0 1\">\n"
1809: + " <coord>\n"
1810: + " <Coordinate point=\"1 39.964054107666 0, 1.10000002384186 39.954761505127 0\"/>\n"
1811: + " </coord>\n" + " </IndexedLineSet>\n"
1812: + " </Shape>\n"
1813: + " </children>\n"
1814: + " </Group>\n" + " </Scene>\n"
1815: + "</X3D>\n";
1816:
1817: String lExpectation = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
1818: + "<!DOCTYPE vCard PUBLIC \"abc.html\"\n"
1819: + "[\n"
1820: + "<!ELEMENT vCard (%prop.man;, (%prop.opt; |\n"
1821: + "x-lotus-blood-type)+)>\n"
1822: + "<!ELEMENT x-lotus-blood-type (#PCDATA)>\n"
1823: + "<!ATTLIST x-lotus-blood-type value NOTATION(X-NAME) #IMPLIED>\n"
1824: + "]>\n"
1825: + "\n"
1826: + "<vCard\n"
1827: + "version=\"3.0\"\n"
1828: + "prodid=\"-//HandGen//NONSGML vGen v1.0//EN\">\n"
1829: + "<fn>Frank Dawson</fn>\n"
1830: + "<n> <family>Dawson</family>\n"
1831: + "<given>Frank</given></n>\n"
1832: + "<tel tel.type=\"WORK MSG\">+1-617-693-8728</tel>\n"
1833: + "<x-lotus-blood-type>O+</x-lotus-blood-type>\n"
1834: + "</vCard>";
1835:
1836: String lXMLTagTextRules = "<TagText tag=\"given\"/>";
1837: RuleSet lRuleSet = CreateRuleSet
1838: .withXMLTagTextRules(lXMLTagTextRules);
1839: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1840: LanguageConstants.XML_MIME);
1841: String lResult = lRewriter.rewrite(lInput,
1842: getDefaultTranslator());
1843: //assertEquals( lExpectation, lResult );
1844: }//testInLineDTDVarient1()
1845:
1846: public void testInLineDTDVarient2_ignore() throws Exception {
1847: String lInput = "<?xml version=\"1.0\"?>\n"
1848: + "<!DOCTYPE bookstore [\n"
1849: + " <!ELEMENT bookstore (name,topic+)>\n"
1850: + " <!ELEMENT topic (name,book*)>\n"
1851: + " <!ELEMENT name (#PCDATA)>\n"
1852: + " <!ELEMENT book (title,author)>\n"
1853: + " <!ELEMENT title (#CDATA)>\n"
1854: + " <!ELEMENT author (#CDATA)>\n"
1855: + " <!ELEMENT isbn (#PCDATA)>\n"
1856: + " <!ATTLIST book isbn CDATA \"0\">\n"
1857: + " ]>\n"
1858: + "<bookstore>\n"
1859: + " <name>Mike's Store</name>\n"
1860: + " <topic>\n"
1861: + " <name>XML</name>\n"
1862: + " <book isbn=\"123-456-789\">\n"
1863: + " <title>Mike's Guide To DTD's and XML Schemas</title>\n"
1864: + " <author>Mike Jervis</author>\n"
1865: + " </book>\n" + " </topic>\n" + "</bookstore>\n";
1866:
1867: String lExpectation = "<?xml version=\"1.0\"?>\n"
1868: + "<!DOCTYPE bookstore [\n"
1869: + " <!ELEMENT bookstore (name,topic+)>\n"
1870: + " <!ELEMENT topic (name,book*)>\n"
1871: + " <!ELEMENT name (#PCDATA)>\n"
1872: + " <!ELEMENT book (title,author)>\n"
1873: + " <!ELEMENT title (#CDATA)>\n"
1874: + " <!ELEMENT author (#CDATA)>\n"
1875: + " <!ELEMENT isbn (#PCDATA)>\n"
1876: + " <!ATTLIST book isbn CDATA \"0\">\n"
1877: + " ]>\n"
1878: + "<bookstore>\n"
1879: + " <name>Mike's Store</name>\n"
1880: + " <topic>\n"
1881: + " <name>XML</name>\n"
1882: + " <book isbn=\"123-456-789\">\n"
1883: + " <title>Mike's Guide To DTD's and XML Schemas<</title>\n"
1884: + " <author>Mike Jervis</author>\n"
1885: + " </book>\n" + " </topic>\n" + "</bookstore>\n";
1886:
1887: String lXMLTagTextRules = "<TagText tag=\"author\"/>";
1888: RuleSet lRuleSet = CreateRuleSet
1889: .withXMLTagTextRules(lXMLTagTextRules);
1890: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1891: LanguageConstants.XML_MIME);
1892: String lResult = lRewriter.rewrite(lInput,
1893: getDefaultTranslator());
1894: //assertEquals( lExpectation, lResult );
1895: }//testInLineDTDVarient2()
1896:
1897: public void testInLineDTDVarient3() throws Exception {
1898: String lInput = "<?xml version=\"1.0\"?>\n"
1899: + "<!DOCTYPE note [\n"
1900: + " <!ELEMENT note (to,from,heading,body)>\n"
1901: + " <!ELEMENT to (#PCDATA)>\n"
1902: + " <!ELEMENT from (#PCDATA)>\n"
1903: + " <!ELEMENT heading (#PCDATA)>\n"
1904: + " <!ELEMENT body (#PCDATA)>\n" + "]>\n"
1905: + "<note>\n" + "<to>Tove</to>\n"
1906: + "<from>Jani</from>\n"
1907: + "<heading>Reminder</heading>\n"
1908: + "<body>Don't forget me this weekend!</body>\n"
1909: + "</note> \n";
1910:
1911: String lExpectation = "<?xml version=\"1.0\"?>\n"
1912: + "<!DOCTYPE note [\n"
1913: + " <!ELEMENT note (to,from,heading,body)>\n"
1914: + " <!ELEMENT to (#PCDATA)>\n"
1915: + " <!ELEMENT from (#PCDATA)>\n"
1916: + " <!ELEMENT heading (#PCDATA)>\n"
1917: + " <!ELEMENT body (#PCDATA)>\n"
1918: + "]>\n"
1919: + "<note>\n"
1920: + "<to>Tove</to>\n"
1921: + "<from>Jani</from>\n"
1922: + "<heading>http://rajanagendra.sun.com/Base/Raja/Reminder</heading>\n"
1923: + "<body>Don't forget me this weekend!</body>\n"
1924: + "</note>";
1925:
1926: String lXMLTagTextRules = "<TagText tag=\"heading\"/>";
1927: RuleSet lRuleSet = CreateRuleSet
1928: .withXMLTagTextRules(lXMLTagTextRules);
1929: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1930: LanguageConstants.XML_MIME);
1931: String lResult = lRewriter.rewrite(lInput,
1932: getDefaultTranslator());
1933: assertXMLEqual(lExpectation, lResult);
1934: }//testInLineDTDVarient3()
1935:
1936: public void testInLineDTDVarient4() throws Exception {
1937: String lInput = "<?xml version=\"1.0\"?>\n" + "<!DOCTYPE note "
1938: + "[\n"
1939: + " <!ELEMENT note (to,from,heading,body)>\n"
1940: + " <!ELEMENT to (#PCDATA)>\n"
1941: + " <!ELEMENT from (#PCDATA)>\n"
1942: + " <!ELEMENT heading (#PCDATA)>\n"
1943: + " <!ELEMENT body (#PCDATA)>\n" + "]>\n"
1944: + "<note>\n" + "<to>Tove</to>\n"
1945: + "<from>Jani</from>\n"
1946: + "<heading>Reminder</heading>\n"
1947: + "<body>Don't forget me this weekend!</body>\n"
1948: + "</note> \n";
1949:
1950: String lExpectation = "<?xml version=\"1.0\"?>\n"
1951: + "<!DOCTYPE note "
1952: + "[\n"
1953: + " <!ELEMENT note (to,from,heading,body)>\n"
1954: + " <!ELEMENT to (#PCDATA)>\n"
1955: + " <!ELEMENT from (#PCDATA)>\n"
1956: + " <!ELEMENT heading (#PCDATA)>\n"
1957: + " <!ELEMENT body (#PCDATA)>\n"
1958: + "]>\n"
1959: + "<note>\n"
1960: + "<to>Tove</to>\n"
1961: + "<from>Jani</from>\n"
1962: + "<heading>http://rajanagendra.sun.com/Base/Raja/Reminder</heading>\n"
1963: + "<body>Don't forget me this weekend!</body>\n"
1964: + "</note>";
1965:
1966: String lXMLTagTextRules = "<TagText tag=\"heading\"/>";
1967: RuleSet lRuleSet = CreateRuleSet
1968: .withXMLTagTextRules(lXMLTagTextRules);
1969: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1970: LanguageConstants.XML_MIME);
1971: String lResult = lRewriter.rewrite(lInput,
1972: getDefaultTranslator());
1973: assertXMLEqual(lExpectation, lResult);
1974: }//testInLineDTDVarient4()
1975:
1976: public void testBug4892729() throws Exception {
1977: String lInput = "<xml>\n" + "<mytag myattr2=\"href\">\n"
1978: + " abc.html\n" + "</mytag>\n" + "</xml>\n";
1979:
1980: String lExpectation = "<xml>\n" + "<mytag myattr2=\"href\">\n"
1981: + " http://rajanagendra.sun.com/Base/Raja/abc.html\n"
1982: + "</mytag>\n" + "</xml>";
1983:
1984: String[] lXMLTagTextRules = {
1985: "<TagText tag=\"mytag\" attributePatterns=\"*=*\"/>",
1986: "<TagText tag=\"mytag\" attributePatterns=\"myattr2=*\"/>",
1987: "<TagText tag=\"mytag\" attributePatterns=\"*=href\"/>",
1988: "<TagText tag=\"mytag\" attributePatterns=\"myattr2=href\"/>",
1989: "<TagText tag=\"mytag\" attributePatterns=\"myattr2*=href*\"/>",
1990: "<TagText tag=\"mytag\" attributePatterns=\"my*attr2*=h*f*\"/>",
1991: "<TagText tag=\"mytag\" attributePatterns=\"myattr2*=href*\"/>", };
1992:
1993: for (int i = 0; i < lXMLTagTextRules.length; i++) {
1994: RuleSet lRuleSet = CreateRuleSet
1995: .withXMLTagTextRules(lXMLTagTextRules[i]);
1996: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1997: LanguageConstants.XML_MIME);
1998: String lResult = lRewriter.rewrite(lInput,
1999: getDefaultTranslator());
2000: assertXMLEqual(lExpectation, lResult);
2001: }
2002: }//testBug4892729()
2003:
2004: public void testBug4892729EmptyTag() throws Exception {
2005: String lInput = "<xml>\n" + "<mytag>\n" + " abc.html\n"
2006: + "</mytag>\n" + "</xml>\n";
2007:
2008: String lExpectation = "<xml>\n" + "<mytag>\n"
2009: + " http://rajanagendra.sun.com/Base/Raja/abc.html\n"
2010: + "</mytag>\n" + "</xml>";
2011:
2012: String[] lXMLTagTextRules = { "<TagText tag=\"mytag\"/>",
2013: "<TagText tag=\"mytag\" attributePatterns=\"\"/>",
2014: "<TagText tag=\"mytag\" attributePatterns=\"*\"/>",
2015: "<TagText tag=\"mytag\" attributePatterns=\" * \"/>", };
2016:
2017: for (int i = 0; i < lXMLTagTextRules.length; i++) {
2018: RuleSet lRuleSet = CreateRuleSet
2019: .withXMLTagTextRules(lXMLTagTextRules[i]);
2020: Rewriter lRewriter = RewriterPool.create(lRuleSet,
2021: LanguageConstants.XML_MIME);
2022: String lResult = lRewriter.rewrite(lInput,
2023: getDefaultTranslator());
2024: assertXMLEqual("For i=" + i, lExpectation, lResult);
2025: }
2026: }//testBug4892729EmptyTag()
2027:
2028: public void testBug4892729EmptyAndAttTag() throws Exception {
2029: String lInput = "<xml>\n" + "<mytag>\n" + " abc.html\n"
2030: + "</mytag>\n" + "<mytag myattr2=\"href\">\n"
2031: + " abc.html\n" + "</mytag>\n" + "</xml>\n";
2032:
2033: String lExpectation = "<xml>\n" + "<mytag>\n"
2034: + " http://rajanagendra.sun.com/Base/Raja/abc.html\n"
2035: + "</mytag>\n" + "<mytag myattr2=\"href\">\n"
2036: + " abc.html\n" + "</mytag>\n" + "</xml>";
2037:
2038: String[] lXMLTagTextRules = { "<TagText tag=\"mytag\"/>",
2039: "<TagText tag=\"mytag\" attributePatterns=\"\"/>", };
2040:
2041: for (int i = 0; i < lXMLTagTextRules.length; i++) {
2042: RuleSet lRuleSet = CreateRuleSet
2043: .withXMLTagTextRules(lXMLTagTextRules[i]);
2044: Rewriter lRewriter = RewriterPool.create(lRuleSet,
2045: LanguageConstants.XML_MIME);
2046: String lResult = lRewriter.rewrite(lInput,
2047: getDefaultTranslator());
2048: assertXMLEqual("For i=" + i, lExpectation, lResult);
2049: }
2050: }//testBug4892729EmptyAndAttTag()
2051:
2052: public void testBug4892729EmptyAndAttTagVarient() throws Exception {
2053: String lInput = "<xml>\n" + "<mytag>\n" + " abc.html\n"
2054: + "</mytag>\n" + "<mytag myattr2=\"href\">\n"
2055: + "abc.html\n" + "</mytag>\n" + "</xml>\n";
2056:
2057: String lExpectation = "<xml>\n" + "<mytag>\n"
2058: + " http://rajanagendra.sun.com/Base/Raja/abc.html\n"
2059: + "</mytag>\n" + "<mytag myattr2=\"href\">\n"
2060: + "http://rajanagendra.sun.com/Base/Raja/abc.html\n"
2061: + "</mytag>\n" + "</xml>";
2062:
2063: String[] lXMLTagTextRules = {
2064: "<TagText tag=\"mytag\"/>"
2065: + "<TagText tag=\"mytag\" attributePatterns=\";*=*\"/>",
2066:
2067: "<TagText tag=\"mytag\" attributePatterns=\"\"/>"
2068: + "<TagText tag=\"mytag\" attributePatterns=\"*=*\"/>",
2069:
2070: "<TagText tag=\"mytag\" attributePatterns=\";\"/>"
2071: + "<TagText tag=\"mytag\" attributePatterns=\"*=*\"/>",
2072: "<TagText tag=\"mytag\" attributePatterns=\"*\"/>",
2073: "<TagText tag=\"mytag\" attributePatterns=\" * \"/>", };
2074:
2075: for (int i = 0; i < lXMLTagTextRules.length; i++) {
2076: RuleSet lRuleSet = CreateRuleSet
2077: .withXMLTagTextRules(lXMLTagTextRules[i]);
2078: Rewriter lRewriter = RewriterPool.create(lRuleSet,
2079: LanguageConstants.XML_MIME);
2080: String lResult = lRewriter.rewrite(lInput,
2081: getDefaultTranslator());
2082: assertXMLEqual("For i=" + i, lExpectation, lResult);
2083: }
2084: }//testBug4892729EmptyAndAttTagVarient()
2085:
2086: public void testBug4892729EmptyAndAttTagVarientNegative()
2087: throws Exception {
2088: String lInput = "<xml>\n" + "<mytag>\n" + " abc.html\n"
2089: + "</mytag>\n" + "<mytag myattr2=\"href\">\n"
2090: + "abc.html\n" + "</mytag>\n" + "</xml>\n";
2091:
2092: String lExpectation = "<xml>\n" + "<mytag>\n" + " abc.html\n"
2093: + "</mytag>\n" + "<mytag myattr2=\"href\">\n"
2094: + "http://rajanagendra.sun.com/Base/Raja/abc.html\n"
2095: + "</mytag>\n" + "</xml>";
2096:
2097: String[] lXMLTagTextRules = {
2098: "<TagText tag=\"mytag\" attributePatterns=\";*=*\"/>",
2099: "<TagText tag=\"mytag\" attributePatterns=\"*=*\"/>", };
2100:
2101: for (int i = 0; i < lXMLTagTextRules.length; i++) {
2102: RuleSet lRuleSet = CreateRuleSet
2103: .withXMLTagTextRules(lXMLTagTextRules[i]);
2104: Rewriter lRewriter = RewriterPool.create(lRuleSet,
2105: LanguageConstants.XML_MIME);
2106: String lResult = lRewriter.rewrite(lInput,
2107: getDefaultTranslator());
2108: assertXMLEqual("For i=" + i, lExpectation, lResult);
2109: }
2110: }//testBug4892729EmptyAndAttTagVarientNegative()
2111:
2112: public void testBug4892729EmptyTagNegative() throws Exception {
2113: String lInput = "<xml>\n" + "<mytag>\n" + " abc.html\n"
2114: + "</mytag>\n" + "</xml>\n";
2115:
2116: String lExpectation = "<xml>\n" + "<mytag>\n" + " abc.html\n"
2117: + "</mytag>\n" + "</xml>";
2118:
2119: String[] lXMLTagTextRules = { "<TagText tag=\"mytag\" attributePatterns=\"*=*\"/>", };
2120:
2121: for (int i = 0; i < lXMLTagTextRules.length; i++) {
2122: RuleSet lRuleSet = CreateRuleSet
2123: .withXMLTagTextRules(lXMLTagTextRules[i]);
2124: Rewriter lRewriter = RewriterPool.create(lRuleSet,
2125: LanguageConstants.XML_MIME);
2126: String lResult = lRewriter.rewrite(lInput,
2127: getDefaultTranslator());
2128: assertXMLEqual("For i=" + i, lExpectation, lResult);
2129: }
2130: }//testBug4892729EmptyTagNegative()
2131:
2132: public void testBug4892729Varient() throws Exception {
2133: String lInput = "<xml>\n" + "<mytag myattr2=\"'href'\">\n"
2134: + " abc.html\n" + "</mytag>\n" + "</xml>\n";
2135:
2136: String lExpectation = "<xml>\n"
2137: + "<mytag myattr2=\"'href'\">\n"
2138: + " http://rajanagendra.sun.com/Base/Raja/abc.html\n"
2139: + "</mytag>\n" + "</xml>";
2140:
2141: String[] lXMLTagTextRules = { "<TagText tag=\"mytag\" attributePatterns=\"myattr2*='href'\"/>", };
2142:
2143: for (int i = 0; i < lXMLTagTextRules.length; i++) {
2144: RuleSet lRuleSet = CreateRuleSet
2145: .withXMLTagTextRules(lXMLTagTextRules[i]);
2146: Rewriter lRewriter = RewriterPool.create(lRuleSet,
2147: LanguageConstants.XML_MIME);
2148: String lResult = lRewriter.rewrite(lInput,
2149: getDefaultTranslator());
2150: assertXMLEqual(lExpectation, lResult);
2151: }
2152: }//testBug4892729Varient()
2153:
2154: public void testBug4892729Negative() throws Exception {
2155: String lInput = "<xml>\n" + "<mytag myattr2=\"href\">\n"
2156: + " abc.html\n" + "</mytag>\n" + "</xml>\n";
2157:
2158: String lExpectation = "<xml>\n" + "<mytag myattr2=\"href\">\n"
2159: + " abc.html\n" + "</mytag>\n" + "</xml>";
2160:
2161: String[] lXMLTagTextRules = {
2162: "<TagText tag=\"mytag\" attributePatterns=\"\"/>",
2163: "<TagText tag=\"mytag\"/>", };
2164:
2165: for (int i = 0; i < lXMLTagTextRules.length; i++) {
2166: RuleSet lRuleSet = CreateRuleSet
2167: .withXMLTagTextRules(lXMLTagTextRules[i]);
2168: Rewriter lRewriter = RewriterPool.create(lRuleSet,
2169: LanguageConstants.XML_MIME);
2170: String lResult = lRewriter.rewrite(lInput,
2171: getDefaultTranslator());
2172: assertXMLEqual(lExpectation, lResult);
2173: }
2174: }//testBug4892729Negative()
2175:
2176: public void testMultiPCData() throws Exception {
2177: String lInput = "<xml>\n" + "<mytag myattr2=\"href\">\n"
2178: + "<mytag/>" + " abc.html\n" + "<mytag abc=\"10\"/>"
2179: + " ../abc.html\n" + "<mytag myattr3=\"href\"/>\n"
2180: + " /abc.html\n" + "</mytag>\n" + "</xml>";
2181:
2182: String lExpectation = "<xml>\n"
2183: + "<mytag myattr2=\"href\">\n"
2184: + "<mytag/>"
2185: + " http://rajanagendra.sun.com/Base/Raja/abc.html\n"
2186: + "<mytag abc=\"10\"/>"
2187: + " http://rajanagendra.sun.com/Base/abc.html\n"
2188: + "<mytag myattr3=\"http://rajanagendra.sun.com/Base/Raja/href\"/>\n"
2189: + " http://rajanagendra.sun.com/abc.html\n"
2190: + "</mytag>\n" + "</xml>";
2191:
2192: String lXMLAttributeRule = "<Attribute name=\"myattr3\"/>";
2193: String lXMLTagTextRule = "<TagText tag=\"mytag\" attributePatterns=\"myattr2=href\"/>";
2194:
2195: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
2196: lXMLAttributeRule, lXMLTagTextRule);
2197: Rewriter lRewriter = RewriterPool.create(lRuleSet,
2198: LanguageConstants.XML_MIME);
2199: String lResult = lRewriter.rewrite(lInput,
2200: getDefaultTranslator());
2201: assertXMLEqual(lExpectation, lResult);
2202: }//testMultiPCData()
2203:
2204: public static void main(String[] args) throws Exception {
2205: RewriterModule.initFile();
2206: //BasicTestCase.run( TestXMLTagTexts.class );
2207:
2208: TestSuite testSuite = new TestSuite();
2209: testSuite.addTest(new TestXMLTagTexts("testUrlInCDATA"));
2210: BasicTestCase.run(testSuite);
2211: }//main()
2212:
2213: }//class TestXMLTagTexts
|