01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.rewriter.test;
06:
07: import com.sun.portal.rewriter.RewriterModule;
08: import com.sun.portal.rewriter.rom.RuleSetManager;
09: import com.sun.portal.rewriter.test.util.BasicTestCase;
10: import com.sun.portal.rewriter.util.Resource;
11: import com.sun.portal.rewriter.util.xml.Document;
12:
13: public class TestResourcesExistance extends BasicTestCase {
14: public TestResourcesExistance(String aName) {
15: super (aName);
16: }//constuctor
17:
18: public void testJSResourcesExistance() {
19: String resource = Resource
20: .read(RewriterModule.RESOURCE_URI_UTILS_LOCATION);
21: validate(resource, RewriterModule.RESOURCE_URI_UTILS_LOCATION);
22:
23: resource = Resource
24: .read(RewriterModule.RESOURCE_CONVERT_EXPRESSTION_FUNCTION_LOCATION);
25: validate(
26: resource,
27: RewriterModule.RESOURCE_CONVERT_EXPRESSTION_FUNCTION_LOCATION);
28:
29: resource = Resource
30: .read(RewriterModule.RESOURCE_CONVERT_SYSTEM_FUNCTION_LOCATION);
31: validate(
32: resource,
33: RewriterModule.RESOURCE_CONVERT_SYSTEM_FUNCTION_LOCATION);
34:
35: resource = Resource
36: .read(RewriterModule.RESOURCE_REWRITER_MODULE_PROPERTIES_LOCATION);
37: validate(
38: resource,
39: RewriterModule.RESOURCE_REWRITER_MODULE_PROPERTIES_LOCATION);
40: }//testJSResourcesExistance()
41:
42: public void testRuleSetResourcesExistance() throws Exception {
43: String resource = Resource
44: .read(RewriterModule.RESOURCE_RULESET_DTD_LOCATION);
45: validate(resource, RewriterModule.RESOURCE_RULESET_DTD_LOCATION);
46:
47: resource = Resource
48: .read(RewriterModule.RESOURCE_RULESET_V62_DTD_LOCATION);
49: validate(resource,
50: RewriterModule.RESOURCE_RULESET_V62_DTD_LOCATION);
51:
52: for (int i = 0; i < RewriterModule.PORTAL_RULESET_SPEC.length; i++) {
53: resource = Resource
54: .read(RewriterModule.PORTAL_RULESET_SPEC[i][0]);
55: validate(resource, RewriterModule.PORTAL_RULESET_SPEC[i][0]);
56: assertEquals(RuleSetManager.create(resource).getID(),
57: RewriterModule.PORTAL_RULESET_SPEC[i][1]);
58: }
59: }//testRuleSetResources()
60:
61: public void testI18NResourcesExistance() throws Exception {
62: String resource = Resource
63: .read(RewriterModule.RESOURCE_EXT_2_MIME_MAPPING_LOCATION);
64: validate(resource,
65: RewriterModule.RESOURCE_EXT_2_MIME_MAPPING_LOCATION);
66:
67: resource = Resource
68: .read(RewriterModule.RESOURCE_JAVA_2_IANA_ENCODING_MAPPING_LOCATION);
69: validate(
70: resource,
71: RewriterModule.RESOURCE_JAVA_2_IANA_ENCODING_MAPPING_LOCATION);
72: }//testI18NResourcesExistance()
73:
74: public void testCLIResourcesExistance() throws Exception {
75: String resource = Resource
76: .readXML(RewriterModule.RESOURCE_RWCLISPEC_DTD_LOCATION);
77: validate(resource,
78: RewriterModule.RESOURCE_RWCLISPEC_DTD_LOCATION);
79:
80: resource = Resource
81: .readXML(RewriterModule.RESOURCE_RWCLISPEC_LOCATION);
82: validate(resource, RewriterModule.RESOURCE_RWCLISPEC_LOCATION);
83: Document.create(resource);
84:
85: resource = Resource
86: .read(RewriterModule.RESOURCE_RWCLIPROPS_LOCATION);
87: validate(resource, RewriterModule.RESOURCE_RWCLIPROPS_LOCATION);
88: }//testCLIResourcesExistance()
89:
90: private void validate(String aResource, String aPath) {
91: assertTrue("Failed to locate the Resource: " + aPath,
92: (aResource.length() > 10));
93: }//validate()
94:
95: public static void main(String[] args) {
96: BasicTestCase.run(TestResourcesExistance.class);
97: }//main()
98: }//TestSRAPRewriterResourcesExistance
|