001: /*
002: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
003: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
004: */
005: package com.sun.portal.rproxy.rewriter.test;
006:
007: import com.sun.portal.rewriter.engines.js.parser.JSParser;
008: import com.sun.portal.log.common.PortalLogger;
009: import com.sun.portal.rewriter.engines.markup.MarkupRewriter;
010: import com.sun.portal.rewriter.engines.xml.XMLRewriter;
011: import com.sun.portal.rewriter.test.util.BasicTestCase;
012: import com.sun.portal.rewriter.util.ConfigManager;
013: import com.sun.portal.rewriter.util.Constants;
014: import com.sun.portal.rproxy.rewriter.SRAPRewriterModule;
015: import com.sun.portal.rproxy.rewriter.SRAPTranslatorBuilder;
016: import com.sun.portal.rproxy.rewriter.util.SRAPConfigManager;
017: import com.sun.portal.rproxy.rewriter.yahoo.YahooConfigManager;
018:
019: public class TestSRAPRewriterModule extends BasicTestCase {
020: public TestSRAPRewriterModule(String aName) {
021: super (aName);
022: }//constructor
023:
024: public void testConfigProps() {
025: String text = "SRAP Rewriter Property '";
026:
027: {
028: assertTrue("Compulsory Rewrite SRC Property Shoud be true",
029: SRAPConfigManager.isRewriteSRCValue());
030: }
031:
032: {
033: String moduleID = ConfigManager
034: .getProperty(Constants.PROPERTY_MODULE_ID);
035: assertTrue(
036: text
037: + Constants.PROPERTY_MODULE_ID
038: + "' not defined in "
039: + SRAPRewriterModule.RESOURCE_REWRITER_MODULE_PROPERTIES_LOCATION,
040: (moduleID.trim().length() >= 1));
041: }
042:
043: {
044: boolean commentBaseHREF = ConfigManager
045: .getBoolean(MarkupRewriter.PROPERTY_IS_COMMENT_BASE_HREF);
046: assertTrue(
047: text
048: + MarkupRewriter.PROPERTY_IS_COMMENT_BASE_HREF
049: + "' should be 'true' "
050: + ". Correct the property in file: "
051: + SRAPRewriterModule.RESOURCE_REWRITER_MODULE_PROPERTIES_LOCATION,
052: commentBaseHREF);
053: }
054:
055: {
056: boolean commentBodyBackground = ConfigManager
057: .getBoolean(MarkupRewriter.PROPERTY_IS_COMMENT_BODY_BACKGROUND);
058: assertFalse(
059: text
060: + MarkupRewriter.PROPERTY_IS_COMMENT_BODY_BACKGROUND
061: + " should be 'false'"
062: + ". Correct the property in file: "
063: + SRAPRewriterModule.RESOURCE_REWRITER_MODULE_PROPERTIES_LOCATION,
064: commentBodyBackground);
065: }
066:
067: {
068: boolean rewriteVarsInDHTML = ConfigManager
069: .getBoolean(JSParser.PROPERTY_IS_REWRITE_VARS_IN_DHTML);
070: assertTrue(
071: text
072: + JSParser.PROPERTY_IS_REWRITE_VARS_IN_DHTML
073: + " should be true "
074: + ". Correct the property in file: "
075: + SRAPRewriterModule.RESOURCE_REWRITER_MODULE_PROPERTIES_LOCATION,
076: rewriteVarsInDHTML);
077: }
078:
079: {
080: boolean rewriteXSL = ConfigManager
081: .getBoolean(XMLRewriter.PROPERTY_IS_REWRITE_XSL);
082: assertTrue(
083: text
084: + XMLRewriter.PROPERTY_IS_REWRITE_XSL
085: + " should be true"
086: + ". Correct the property in file: "
087: + SRAPRewriterModule.RESOURCE_REWRITER_MODULE_PROPERTIES_LOCATION,
088: rewriteXSL);
089: }
090:
091: {
092: boolean enableYahooIntegration = ConfigManager
093: .getBoolean(YahooConfigManager.PROPERTY_IS_YAHOO_INTEGRATION_ENABLED);
094: assertTrue(
095: text
096: + YahooConfigManager.PROPERTY_IS_YAHOO_INTEGRATION_ENABLED
097: + " should be true"
098: + ". Correct the property in file: "
099: + SRAPRewriterModule.RESOURCE_REWRITER_MODULE_PROPERTIES_LOCATION,
100: enableYahooIntegration);
101: }
102:
103: {
104: String customTranslatorHooks = ConfigManager
105: .getProperty(SRAPTranslatorBuilder.PROPERTY_CUSTOM_TRANSLATOR_HOOKS);
106: assertNotNull(
107: text
108: + SRAPTranslatorBuilder.PROPERTY_CUSTOM_TRANSLATOR_HOOKS
109: + " should not be null"
110: + ". Correct the property in file: "
111: + SRAPRewriterModule.RESOURCE_REWRITER_MODULE_PROPERTIES_LOCATION,
112: customTranslatorHooks);
113: }
114: }//testConfigProps()
115:
116: public static void main(String[] args) {
117: SRAPRewriterModule.initFile();
118: BasicTestCase.run(TestSRAPRewriterModule.class);
119: }//main()
120:
121: }//class TestSRAPRewriterModule
|