You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shale.apache.org by cr...@apache.org on 2007/01/07 01:46:10 UTC
svn commit: r493624 - in /shale/framework/trunk/shale-test/src:
main/java/org/apache/shale/test/config/
test/java/org/apache/shale/test/config/ test/resources/ test/resources/org/
test/resources/org/apache/ test/resources/org/apache/shale/ test/resourc...
Author: craigmcc
Date: Sat Jan 6 16:46:08 2007
New Revision: 493624
URL: http://svn.apache.org/viewvc?view=rev&rev=493624
Log:
SHALE-262 Beginnings of a test case for parsing faces configuration resources.
Added:
shale/framework/trunk/shale-test/src/test/resources/
shale/framework/trunk/shale-test/src/test/resources/org/
shale/framework/trunk/shale-test/src/test/resources/org/apache/
shale/framework/trunk/shale-test/src/test/resources/org/apache/shale/
shale/framework/trunk/shale-test/src/test/resources/org/apache/shale/test/
shale/framework/trunk/shale-test/src/test/resources/org/apache/shale/test/config/
shale/framework/trunk/shale-test/src/test/resources/org/apache/shale/test/config/faces-config-1.xml (with props)
Modified:
shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/config/ConfigParser.java
shale/framework/trunk/shale-test/src/test/java/org/apache/shale/test/config/ConfigParserTestCase.java
Modified: shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/config/ConfigParser.java
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/config/ConfigParser.java?view=diff&rev=493624&r1=493623&r2=493624
==============================================================================
--- shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/config/ConfigParser.java (original)
+++ shale/framework/trunk/shale-test/src/main/java/org/apache/shale/test/config/ConfigParser.java Sat Jan 6 16:46:08 2007
@@ -52,6 +52,8 @@
* <code>AbstractJmockJsfTestCase</code>, be sure you have completed the
* <code>setUp()</code> processing in this base class before calling one
* of the <code>parse()</code> methods.</p>
+ *
+ * @since 1.1
*/
public final class ConfigParser {
@@ -143,7 +145,7 @@
("faces-config/component/component-type", "setComponentType", 0);
digester.addCallMethod
("faces-config/component/component-class", "setComponentClass", 0);
- digester.addRule("faces-config/converter", new ValidatorRule());
+ digester.addRule("faces-config/converter", new ConverterRule());
digester.addCallMethod
("faces-config/converter/converter-id", "setConverterId", 0);
digester.addCallMethod
@@ -152,6 +154,13 @@
("faces-config/converter/converter-for-class", "setConverterForClass", 0);
digester.addRule("faces-config/render-kit", new RenderKitRule());
digester.addRule("faces-config/render-kit/render-kit-id", new RenderKitIdRule());
+ digester.addRule("faces-config/render-kit/renderer", new RendererRule());
+ digester.addCallMethod
+ ("faces-config/render-kit/renderer/component-family", "setComponentFamily", 0);
+ digester.addCallMethod
+ ("faces-config/render-kit/renderer/renderer-class", "setRendererClass", 0);
+ digester.addCallMethod
+ ("faces-config/render-kit/renderer/renderer-type", "setRendererType", 0);
digester.addRule("faces-config/validator", new ValidatorRule());
digester.addCallMethod
("faces-config/validator/validator-id", "setValidatorId", 0);
Modified: shale/framework/trunk/shale-test/src/test/java/org/apache/shale/test/config/ConfigParserTestCase.java
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-test/src/test/java/org/apache/shale/test/config/ConfigParserTestCase.java?view=diff&rev=493624&r1=493623&r2=493624
==============================================================================
--- shale/framework/trunk/shale-test/src/test/java/org/apache/shale/test/config/ConfigParserTestCase.java (original)
+++ shale/framework/trunk/shale-test/src/test/java/org/apache/shale/test/config/ConfigParserTestCase.java Sat Jan 6 16:46:08 2007
@@ -17,6 +17,10 @@
package org.apache.shale.test.config;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.shale.test.base.AbstractJsfTestCase;
@@ -79,6 +83,42 @@
public void testPristine() {
assertNotNull(parser);
+
+ }
+
+
+ // Test loading a simple configuration resource
+ public void testSimple() throws Exception {
+
+ URL url = this.getClass().getResource("/org/apache/shale/test/config/faces-config-1.xml");
+ assertNotNull(url);
+ parser.parse(url);
+ Iterator items = null;
+ List list = new ArrayList();
+
+ items = application.getComponentTypes();
+ list.clear();
+ while (items.hasNext()) {
+ list.add(items.next());
+ }
+ assertTrue(list.contains("component-type-1"));
+ assertTrue(list.contains("component-type-2"));
+
+ items = application.getConverterIds();
+ list.clear();
+ while (items.hasNext()) {
+ list.add(items.next());
+ }
+ assertTrue(list.contains("converter-id-1"));
+ assertTrue(list.contains("converter-id-2"));
+
+ items = application.getValidatorIds();
+ list.clear();
+ while (items.hasNext()) {
+ list.add(items.next());
+ }
+ assertTrue(list.contains("validator-id-1"));
+ assertTrue(list.contains("validator-id-2"));
}
Added: shale/framework/trunk/shale-test/src/test/resources/org/apache/shale/test/config/faces-config-1.xml
URL: http://svn.apache.org/viewvc/shale/framework/trunk/shale-test/src/test/resources/org/apache/shale/test/config/faces-config-1.xml?view=auto&rev=493624
==============================================================================
--- shale/framework/trunk/shale-test/src/test/resources/org/apache/shale/test/config/faces-config-1.xml (added)
+++ shale/framework/trunk/shale-test/src/test/resources/org/apache/shale/test/config/faces-config-1.xml Sat Jan 6 16:46:08 2007
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to you under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<faces-config>
+
+ <component>
+ <component-type>component-type-1</component-type>
+ <component-class>com.mycompany.MyComponent1</component-class>
+ </component>
+
+ <component>
+ <component-type>component-type-2</component-type>
+ <component-class>com.mycompany.MyComponent2</component-class>
+ </component>
+
+ <converter>
+ <converter-id>converter-id-1</converter-id>
+ <converter-class>com.mycompany.MyConverter1</converter-class>
+ </converter>
+
+ <converter>
+ <converter-id>converter-id-2</converter-id>
+ <converter-class>com.mycompany.MyConverter2</converter-class>
+ </converter>
+
+ <!-- FIXME - need a real converter for by-class registration -->
+
+ <validator>
+ <validator-id>validator-id-1</validator-id>
+ <validator-class>com.mycompany.MyValidator1</validator-class>
+ </validator>
+
+ <validator>
+ <validator-id>validator-id-2</validator-id>
+ <validator-class>com.mycompany.MyValidator2</validator-class>
+ </validator>
+
+<!-- FIXME - need some real Renderer classes
+ <render-kit>
+
+ <renderer>
+ <component-family>component-family-1</component-family>
+ <renderer-type>renderer-type-1</renderer-type>
+ <renderer-class>com.mycompany.MyRenderer1</renderer-class>
+ </renderer>
+
+ <renderer>
+ <component-family>component-family-2</component-family>
+ <renderer-type>renderer-type-2</renderer-type>
+ <renderer-class>com.mycompany.MyRenderer2</renderer-class>
+ </renderer>
+
+ </render-kit>
+-->
+
+</faces-config>
Propchange: shale/framework/trunk/shale-test/src/test/resources/org/apache/shale/test/config/faces-config-1.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: shale/framework/trunk/shale-test/src/test/resources/org/apache/shale/test/config/faces-config-1.xml
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL