You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2008/08/09 22:42:52 UTC

svn commit: r684340 - in /myfaces/commons/branches/jsf_11: ./ myfaces-commons-converters/src/main/conf/ myfaces-commons-converters/src/test/java/org/ myfaces-commons-converters/src/test/java/org/apache/ myfaces-commons-converters/src/test/java/org/apac...

Author: lu4242
Date: Sat Aug  9 13:42:51 2008
New Revision: 684340

URL: http://svn.apache.org/viewvc?rev=684340&view=rev
Log:
backport added tests

Added:
    myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/main/conf/
    myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/main/conf/facelets-taglib-base.xml   (with props)
    myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/
    myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/
    myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/
    myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/
    myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/
    myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/BooleanConverterTest.java   (with props)
    myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/EnumConverterTest.java   (with props)
    myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/TypedNumberConverterTest.java   (with props)
    myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/test/
    myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/test/CommonsConverterClassElementTestCase.java   (with props)
    myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/test/CommonsConverterTagLibTestCase.java   (with props)
    myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/
    myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/
    myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/
    myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/
    myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/
    myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/AbstractClassElementTestCase.java   (with props)
    myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/AbstractTagLibTestCase.java   (with props)
    myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/ClassElementHandler.java   (with props)
    myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/conf/
    myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/conf/facelets-taglib-base.xml   (with props)
    myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/
    myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/
    myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/
    myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/
    myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/test/
    myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/test/CommonsValidatorClassElementTestCase.java   (with props)
    myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/test/CommonsValidatorTagLibTestCase.java   (with props)
    myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/
    myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/AbstractValidatorTestCase.java   (with props)
    myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/EmailValidatorTestCase.java   (with props)
    myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/ISBNValidatorTestCase.java   (with props)
    myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/RegExprValidatorTestCase.java   (with props)
    myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/UrlValidatorTestCase.java   (with props)
Modified:
    myfaces/commons/branches/jsf_11/   (props changed)

Propchange: myfaces/commons/branches/jsf_11/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Aug  9 13:42:51 2008
@@ -0,0 +1,10 @@
+target
+.classpath
+.project
+.wtpmodules
+*.ipr
+*.iml
+*.iws
+.settings
+maven-eclipse.xml
+.externalToolBuilders

Added: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/main/conf/facelets-taglib-base.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/main/conf/facelets-taglib-base.xml?rev=684340&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/main/conf/facelets-taglib-base.xml (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/main/conf/facelets-taglib-base.xml Sat Aug  9 13:42:51 2008
@@ -0,0 +1,24 @@
+<?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.
+-->
+<!DOCTYPE facelet-taglib
+  PUBLIC "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN" "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
+<facelet-taglib xmlns="http://java.sun.com/JSF/Facelet">
+
+</facelet-taglib>
\ No newline at end of file

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/main/conf/facelets-taglib-base.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/main/conf/facelets-taglib-base.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/BooleanConverterTest.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/BooleanConverterTest.java?rev=684340&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/BooleanConverterTest.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/BooleanConverterTest.java Sat Aug  9 13:42:51 2008
@@ -0,0 +1,99 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.commons.converter;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIInput;
+import javax.faces.convert.ConverterException;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.shale.test.base.AbstractJsfTestCase;
+
+/**
+ * @author lu4242 (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class BooleanConverterTest extends AbstractJsfTestCase
+{
+
+    private BooleanConverter converter;
+
+    public BooleanConverterTest(String testName)
+    {
+        super(testName);
+    }
+
+    public void setUp() throws Exception
+    {
+        super.setUp();
+        converter = new BooleanConverter();
+    }
+
+    public void tearDown() throws Exception
+    {
+        super.tearDown();
+        converter = null;
+    }
+
+    public static Test suite()
+    {
+        return new TestSuite(BooleanConverterTest.class);
+    }
+
+    public void testConverterFalse()
+    {
+        UIInput input = new UIInput();
+        input.setId("txt_test");
+
+        converter.setTrueValue("verdadero");
+        converter.setFalseValue("falso");
+
+        try
+        {
+            //Any different to true is false.
+            Object value = converter.getAsObject(facesContext, input, "test_invalid_input");
+            assertEquals("falso", converter.getAsString(facesContext, input, value));
+        }
+        catch (ConverterException exception)
+        {
+            fail();
+        }
+    }
+    
+    public void testConverterTrueValue()
+    {
+        UIInput input = new UIInput();
+        input.setId("txt_test");
+
+        converter.setTrueValue("verdadero");
+        converter.setFalseValue("falso");
+
+        try
+        {
+            Object value = converter.getAsObject(facesContext, input, "verdadero");
+            assertEquals("verdadero", converter.getAsString(facesContext, input, value));
+        }
+        catch (ConverterException exception)
+        {
+            fail();            
+        }        
+    }
+}

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/BooleanConverterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/BooleanConverterTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/EnumConverterTest.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/EnumConverterTest.java?rev=684340&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/EnumConverterTest.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/EnumConverterTest.java Sat Aug  9 13:42:51 2008
@@ -0,0 +1,104 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.commons.converter;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIInput;
+import javax.faces.convert.ConverterException;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.shale.test.base.AbstractJsfTestCase;
+
+/**
+ * @author lu4242 (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class EnumConverterTest extends AbstractJsfTestCase
+{
+
+    private EnumConverter converter;
+
+    public EnumConverterTest(String testName)
+    {
+        super(testName);
+    }
+
+    public void setUp() throws Exception
+    {
+        super.setUp();
+        converter = new EnumConverter(EnumTest.class);
+    }
+    
+    public enum EnumTest
+    {
+        OPTION1,
+        OPTION2,
+        OPTION3
+    }
+
+    public void tearDown() throws Exception
+    {
+        super.tearDown();
+        converter = null;
+    }
+
+    public static Test suite()
+    {
+        return new TestSuite(EnumConverterTest.class);
+    }
+
+    public void testEnumItemFound()
+    {
+        UIInput input = new UIInput();
+        input.setId("txt_test");
+
+        try
+        {
+            //Any different to true is false.
+            Object value = converter.getAsObject(facesContext, input, "OPTION2");
+            assertEquals(EnumTest.OPTION2, value);
+            assertEquals("OPTION2", converter.getAsString(facesContext, input, value));
+        }
+        catch (ConverterException exception)
+        {
+            fail();
+        }
+    }
+    
+    public void testEnumItemNotFound()
+    {
+        UIInput input = new UIInput();
+        input.setId("txt_test");
+
+        try
+        {
+            //Any different to true is false.
+            Object value = converter.getAsObject(facesContext, input, "OPTION100");
+            fail();
+        }
+        catch (ConverterException exception)
+        {
+            FacesMessage facesMessage = exception.getFacesMessage();
+            assertEquals(FacesMessage.SEVERITY_ERROR, facesMessage.getSeverity());
+        }
+    }    
+    
+}

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/EnumConverterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/EnumConverterTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/TypedNumberConverterTest.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/TypedNumberConverterTest.java?rev=684340&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/TypedNumberConverterTest.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/TypedNumberConverterTest.java Sat Aug  9 13:42:51 2008
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.commons.converter;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIInput;
+import javax.faces.convert.ConverterException;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.shale.test.base.AbstractJsfTestCase;
+
+/**
+ * @author cagatay (latest modification by $Author$)
+ * @version $Revision$ $Date$
+ */
+public class TypedNumberConverterTest extends AbstractJsfTestCase{
+    
+    private TypedNumberConverter converter;
+    
+    public TypedNumberConverterTest(String testName) {
+        super(testName);
+    }
+    
+    public void setUp() throws Exception{
+        super.setUp();
+        converter = new TypedNumberConverter();
+    }
+    
+    public void tearDown() throws Exception{
+        super.tearDown();
+        converter = null; 
+    }
+    
+    public static Test suite() {
+        return new TestSuite(TypedNumberConverterTest.class);
+    }
+    
+    public void testSeverityLevelOfMessageShouldBeErrorInCaseConversionFails() {
+        UIInput input = new UIInput();
+        input.setId("txt_test");
+        
+        converter.setIntegerOnly(true);
+        
+        try {
+            converter.getAsObject(facesContext, input, "test_invalid_input");
+            
+            fail();
+        }catch (ConverterException exception) {
+            FacesMessage facesMessage = exception.getFacesMessage();
+            assertEquals(FacesMessage.SEVERITY_ERROR, facesMessage.getSeverity());
+        }
+        
+    }
+    
+    public void testIntegerOnly()
+    {
+        UIInput input = new UIInput();
+        input.setId("txt_test");
+        
+        converter.setIntegerOnly(true);
+        
+        try {
+            String inValue = "29991"; 
+            Object value = converter.getAsObject(facesContext, input, inValue);
+            assertEquals((Long) value, Long.valueOf(29991));
+        }catch (ConverterException exception) {
+            fail();
+        }        
+    }
+}

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/TypedNumberConverterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/converter/TypedNumberConverterTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/test/CommonsConverterClassElementTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/test/CommonsConverterClassElementTestCase.java?rev=684340&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/test/CommonsConverterClassElementTestCase.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/test/CommonsConverterClassElementTestCase.java Sat Aug  9 13:42:51 2008
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+package org.apache.myfaces.commons.test;
+
+/**
+ * @author Leonardo Uribe
+ */
+
+public class CommonsConverterClassElementTestCase extends
+        AbstractClassElementTestCase
+{
+
+    public CommonsConverterClassElementTestCase()
+    {
+        resource.add("META-INF/mcc.tld");
+        resource.add("META-INF/faces-config.xml");
+    }
+}

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/test/CommonsConverterClassElementTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/test/CommonsConverterClassElementTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/test/CommonsConverterTagLibTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/test/CommonsConverterTagLibTestCase.java?rev=684340&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/test/CommonsConverterTagLibTestCase.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/test/CommonsConverterTagLibTestCase.java Sat Aug  9 13:42:51 2008
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+package org.apache.myfaces.commons.test;
+
+/**
+ * @author Leonardo Uribe
+ */
+
+public class CommonsConverterTagLibTestCase extends AbstractTagLibTestCase
+{
+
+    protected static final String META_INF = "META-INF/";
+
+    public CommonsConverterTagLibTestCase()
+    {
+        tldPaths = new String[1];
+        tldPaths[0] = META_INF + "mcc.tld";
+    }
+
+}

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/test/CommonsConverterTagLibTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-converters/src/test/java/org/apache/myfaces/commons/test/CommonsConverterTagLibTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/AbstractClassElementTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/AbstractClassElementTestCase.java?rev=684340&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/AbstractClassElementTestCase.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/AbstractClassElementTestCase.java Sat Aug  9 13:42:51 2008
@@ -0,0 +1,112 @@
+/*
+ * 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.
+ */
+
+package org.apache.myfaces.commons.test;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import junit.framework.TestCase;
+
+/**
+ * This test makes sure all of our components, tags, renderers, 
+ * validators, converters, action listeners, phase listeners and
+ * core implementation classes are in the build.
+ * 
+ * This class has been copy and pasted into both tomahawk and core 
+ * in order to avoid a compile scoped dependency on junit in shared.
+ * 
+ * @see ClassElementHandler
+ * @author Dennis Byrne
+ */
+
+public abstract class AbstractClassElementTestCase extends TestCase
+{
+
+    private Log log = LogFactory.getLog(AbstractClassElementTestCase.class);
+
+    protected List resource = new ArrayList();
+    private List className = new ArrayList();
+
+    protected void setUp() throws Exception
+    {
+        SAXParserFactory factory = SAXParserFactory.newInstance();
+        factory.setValidating(false);
+        factory.setNamespaceAware(false);
+
+        SAXParser parser = factory.newSAXParser();
+        ClassElementHandler handler = new ClassElementHandler();
+
+        Iterator iterator = resource.iterator();
+
+        while (iterator.hasNext())
+        {
+            String resourceName = (String) iterator.next();
+
+            InputStream is = getClass().getClassLoader().getResourceAsStream(
+                    resourceName);
+
+            if (is == null)
+                is = Thread.currentThread().getContextClassLoader()
+                        .getResourceAsStream(resourceName);
+
+            if (is == null)
+                throw new Exception("Could not locate resource :"
+                        + resourceName);
+
+            parser.parse(is, handler);
+        }
+
+        className.addAll(handler.getClassName());
+    }
+
+    public void testClassPath()
+    {
+        int i = 0;
+        for (; i < className.size(); i++)
+        {
+            String clazz = (String) className.get(i);
+
+            try
+            {
+                getClass().getClassLoader().loadClass(clazz);
+            }
+            catch (ClassNotFoundException e)
+            {
+                try
+                {
+                    Thread.currentThread().getContextClassLoader().loadClass(
+                            clazz);
+                }
+                catch (ClassNotFoundException e2)
+                {
+                    assertFalse("Could not load " + clazz, true);
+                }
+            }
+        }
+        log.debug((i + 1) + " class found ");
+    }
+}

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/AbstractClassElementTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/AbstractClassElementTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/AbstractTagLibTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/AbstractTagLibTestCase.java?rev=684340&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/AbstractTagLibTestCase.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/AbstractTagLibTestCase.java Sat Aug  9 13:42:51 2008
@@ -0,0 +1,263 @@
+/*
+ * 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.
+ */
+
+package org.apache.myfaces.commons.test;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import junit.framework.TestCase;
+import net.sf.maventaglib.checker.Tag;
+import net.sf.maventaglib.checker.TagAttribute;
+import net.sf.maventaglib.checker.Tld;
+import net.sf.maventaglib.checker.TldParser;
+
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.w3c.dom.Document;
+
+/**
+ * Insures the following ...
+ * <ul>
+ * <li> Tag handlers have setters for all tag attributes</li>
+ * <li> All tag handlers are in the classpath</li>
+ * <li> Tag handlers do not appear in the TLD more than once</li>
+ * <li> Tag handler attributes do not occur mare than once</li>
+ * </ul>
+ * 
+ * @author Dennis Byrne
+ * @see http://maven-taglib.sourceforge.net/ for dependency download
+ */
+
+public abstract class AbstractTagLibTestCase extends TestCase
+{
+    private static Log log = LogFactory.getLog(AbstractTagLibTestCase.class);
+
+    protected Tld[] tlds;
+
+    protected String[] tldPaths;
+
+    private ClassLoader classLoader = getClass().getClassLoader();
+
+    /**
+     * Unmarshall TLDs to an object model. TLDs are supplied by a subclass.
+     */
+
+    protected void setUp() throws Exception
+    {
+
+        if (tldPaths == null)
+            throw new NullPointerException(
+                    "tldPaths cannot point to null before setUp() is called");
+
+        int length = tldPaths.length;
+
+        if (length == 0)
+            throw new IllegalStateException(
+                    "tldPaths should have at least one resource path");
+
+        tlds = new Tld[length];
+
+        for (int t = 0; t < length; t++)
+        {
+            String name = tldPaths[t];
+
+            InputStream stream = classLoader.getResourceAsStream(name);
+
+            if (stream == null)
+                throw new NullPointerException(
+                        "couldn't get an input stream for " + name);
+
+            tlds[t] = TldTestUtils.getTld(name, stream);
+            stream.close();
+        }
+    }
+
+    public void testUniqueTagTestCase() throws Exception
+    {
+
+        for (int lib = 0; lib < tlds.length; lib++)
+        {
+            Tld tld = tlds[lib];
+            List tagNames = new ArrayList();
+            Tag[] tags = tld.getTags();
+
+            for (int t = 0; t < tags.length; t++)
+            {
+                Tag tag = tags[t];
+
+                if (tag == null)
+                    throw new NullPointerException("tag");
+
+                String name = tag.getName();
+                String msg = name + " found more than once in " + tldPaths[lib];
+                assertFalse(msg, tagNames.contains(name));
+                tagNames.add(name);
+            } // end t
+        } // end lib
+    }
+
+    public void testUniqueTagAttributes() throws Exception
+    {
+
+        for (int lib = 0; lib < tlds.length; lib++)
+        {
+            Tld tld = tlds[lib];
+            Tag[] tags = tld.getTags();
+
+            for (int t = 0; t < tags.length; t++)
+            {
+
+                Tag tag = tags[t];
+                assertUniqueTagAttributes(tag, tldPaths[lib]);
+
+            } // end t
+        } // end lib
+    }
+
+    private void assertUniqueTagAttributes(final Tag tag, final String path)
+    {
+
+        List attributeNames = new ArrayList();
+        TagAttribute[] atts = tag.getAttributes();
+        String tagName = tag.getName();
+
+        for (int a = 0; a < atts.length;)
+        {
+
+            TagAttribute att = atts[a++];
+            String name = att.getAttributeName();
+            String msg = " @" + name + " of " + path + ":" + tagName
+                    + " is duplicated.";
+            assertFalse(msg, attributeNames.contains(name));
+            attributeNames.add(name);
+
+        } // end a
+
+    }
+
+    /**
+     * Make sure the class exists. Make sure there is a setter for each
+     * attribute.
+     */
+
+    public void testSetters() throws Exception
+    {
+
+        for (int t = 0; t < tlds.length; t++)
+        {
+            Tld tld = tlds[t];
+            Tag[] tags = tld.getTags();
+
+            for (int s = 0; s < tags.length; s++)
+            {
+                Tag tag = tags[s];
+                String filename = tld.getFilename();
+
+                Object object = TldTestUtils.makeTagClassInstance(tag,
+                        filename, classLoader);
+                log.debug("filename = " + filename + " ; tag = "
+                        + tag.getName());
+                assertSetters(tag, filename, object);
+
+            } // end for tag
+        } // end for lib
+
+    }
+
+    private void assertSetters(final Tag tag, final String path,
+            final Object object)
+    {
+
+        TagAttribute[] attributes = tag.getAttributes();
+        String tagName = tag.getName();
+
+        for (int a = 0; a < attributes.length; a++)
+        {
+            TagAttribute attribute = attributes[a];
+            String name = attribute.getAttributeName();
+
+            if (name == null || "".equals(name.trim()))
+                throw new IllegalStateException(path + ":" + tagName
+                        + " has a nameless attribute ");
+
+            String msg = path + ":" + tagName + "@" + name + " exists, but "
+                    + object.getClass().getName() + " has no setter.";
+
+            assertTrue(msg, PropertyUtils.isWriteable(object, name));
+        } // end for attributes
+
+    }
+
+    private static class TldTestUtils
+    {
+        private static Log log = LogFactory.getLog(TldTestUtils.class);
+
+        private static DocumentBuilderFactory dbf = DocumentBuilderFactory
+                .newInstance();
+
+        public static Tld getTld(String name, InputStream stream)
+                throws Exception
+        {
+            if (stream == null)
+                log.error(" input stream is null ");
+
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document doc = db.parse(stream);
+
+            return TldParser.parse(doc, name);
+        }
+
+        public static Object makeTagClassInstance(Tag tag, String filename,
+                ClassLoader classLoader) throws Exception
+        {
+
+            String clazzName = tag.getTagClass();
+
+            if (clazzName == null || "".equals(clazzName.trim()))
+                throw new NullPointerException(tag.getName()
+                        + " is missing a tag class.");
+
+            try
+            {
+
+                Class clazz = classLoader.loadClass(clazzName);
+                return clazz.newInstance();
+
+            }
+            catch (ClassNotFoundException e)
+            {
+                throw new ClassNotFoundException(clazzName);
+            }
+            catch (IllegalAccessException ie)
+            {
+                throw new IllegalAccessException(clazzName);
+            }
+            catch (InstantiationException iste)
+            {
+                throw new InstantiationException(clazzName);
+            }
+        }
+    }
+}
\ No newline at end of file

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/AbstractTagLibTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/AbstractTagLibTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/ClassElementHandler.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/ClassElementHandler.java?rev=684340&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/ClassElementHandler.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/ClassElementHandler.java Sat Aug  9 13:42:51 2008
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ */
+
+package org.apache.myfaces.commons.test;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * @see AbstractClassElementTestCase
+ * @author Dennis Byrne
+ */
+
+public class ClassElementHandler extends DefaultHandler
+{
+    
+    private boolean clazz ;
+    private List elementName = new ArrayList();
+    private List className = new ArrayList();
+    private StringBuffer buffer ;
+    
+    public ClassElementHandler(){
+        
+        elementName.add("component-class");
+        elementName.add("tag-class");
+        elementName.add("renderer-class");
+        elementName.add("validator-class");
+        elementName.add("converter-class");
+        elementName.add("action-listener");
+        elementName.add("navigation-handler");
+        elementName.add("variable-resolver");
+        elementName.add("property-resolver");
+        elementName.add("phase-listener");
+        
+    }
+
+    public void characters(char[] ch, int start, int length)
+    throws SAXException
+    {
+        if (clazz)
+        {
+            String string = new String(ch, start, length);
+            if(string != null)
+            {
+                buffer.append(string.trim());
+            }
+        }
+    }
+    
+    public void startElement(
+            String ns, String local, String qName, Attributes atts) 
+            throws SAXException
+    {
+       
+         clazz = elementName.contains(qName);
+         
+         if(clazz)
+             buffer = new StringBuffer();
+        
+    }
+
+    public void endElement(String ns, String local, String qName) 
+        throws SAXException
+    {
+        
+        if(clazz){
+            className.add(buffer.toString());
+            clazz = false;
+        }
+        
+    }
+
+    public List getClassName()
+    {
+        return className;
+    }
+    
+}

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/ClassElementHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-utils/src/test/java/org/apache/myfaces/commons/test/ClassElementHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/conf/facelets-taglib-base.xml
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/conf/facelets-taglib-base.xml?rev=684340&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/conf/facelets-taglib-base.xml (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/conf/facelets-taglib-base.xml Sat Aug  9 13:42:51 2008
@@ -0,0 +1,24 @@
+<?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.
+-->
+<!DOCTYPE facelet-taglib
+  PUBLIC "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN" "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
+<facelet-taglib xmlns="http://java.sun.com/JSF/Facelet">
+
+</facelet-taglib>
\ No newline at end of file

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/conf/facelets-taglib-base.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/main/conf/facelets-taglib-base.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/test/CommonsValidatorClassElementTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/test/CommonsValidatorClassElementTestCase.java?rev=684340&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/test/CommonsValidatorClassElementTestCase.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/test/CommonsValidatorClassElementTestCase.java Sat Aug  9 13:42:51 2008
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+package org.apache.myfaces.commons.test;
+
+/**
+ * @author Leonardo Uribe
+ */
+
+public class CommonsValidatorClassElementTestCase extends
+        AbstractClassElementTestCase
+{
+
+    public CommonsValidatorClassElementTestCase()
+    {
+        resource.add("META-INF/mcv.tld");
+        resource.add("META-INF/faces-config.xml");
+    }
+}

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/test/CommonsValidatorClassElementTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/test/CommonsValidatorClassElementTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/test/CommonsValidatorTagLibTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/test/CommonsValidatorTagLibTestCase.java?rev=684340&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/test/CommonsValidatorTagLibTestCase.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/test/CommonsValidatorTagLibTestCase.java Sat Aug  9 13:42:51 2008
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+package org.apache.myfaces.commons.test;
+
+/**
+ * @author Leonardo Uribe
+ */
+
+public class CommonsValidatorTagLibTestCase extends AbstractTagLibTestCase
+{
+
+    protected static final String META_INF = "META-INF/";
+
+    public CommonsValidatorTagLibTestCase()
+    {
+        tldPaths = new String[1];
+        tldPaths[0] = META_INF + "mcv.tld";
+    }
+
+}

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/test/CommonsValidatorTagLibTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/test/CommonsValidatorTagLibTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/AbstractValidatorTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/AbstractValidatorTestCase.java?rev=684340&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/AbstractValidatorTestCase.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/AbstractValidatorTestCase.java Sat Aug  9 13:42:51 2008
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.commons.validator;
+
+import javax.faces.component.UIComponent;
+import javax.faces.validator.Validator;
+
+import org.apache.shale.test.jmock.AbstractJmockJsfTestCase;
+import org.jmock.Mock;
+
+public abstract class AbstractValidatorTestCase extends AbstractJmockJsfTestCase
+{
+
+  public AbstractValidatorTestCase(String arg0) {
+    super(arg0);
+  }
+  
+  Mock mockComponent;
+  UIComponent component;
+  
+  protected void setUp() throws Exception
+  {
+    super.setUp();
+    mockComponent = mock(UIComponent.class);
+    component = (UIComponent) mockComponent.proxy();
+    
+  }
+
+  protected void tearDown() throws Exception
+  {
+    super.tearDown();
+  }
+
+
+  /**
+   * if contex or component = null then should throw NullPointerException
+   */
+  protected void doTestNullContext(
+    UIComponent component,
+    Validator validator) throws NullPointerException
+  {
+    try
+    {
+      validator.validate(null, component, "dummy");
+      fail("Expected NullpointerException - if context or component is null");
+    }
+    catch (NullPointerException npe)
+    {
+      // this is expected
+    }
+  }
+}
\ No newline at end of file

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/AbstractValidatorTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/AbstractValidatorTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/EmailValidatorTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/EmailValidatorTestCase.java?rev=684340&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/EmailValidatorTestCase.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/EmailValidatorTestCase.java Sat Aug  9 13:42:51 2008
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.commons.validator;
+
+import javax.faces.validator.ValidatorException;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class EmailValidatorTestCase extends AbstractValidatorTestCase
+{
+
+  public EmailValidatorTestCase(String arg0) {
+    super(arg0);
+  }
+  
+  EmailValidator emailValidator;
+  
+  protected void setUp() throws Exception
+  {
+    super.setUp();
+    emailValidator = new EmailValidator();    
+  }
+
+  protected void tearDown() throws Exception
+  {
+    super.tearDown();
+  }
+
+  public static Test suite()
+  {
+    return new TestSuite(EmailValidatorTestCase.class);
+  }
+
+  /**
+   * Test when context is set to null
+   */
+  public void testNullContext()
+  {
+
+    doTestNullContext(component, emailValidator);
+  }
+  
+  public void testWrongEmailAddress()
+  {
+    try
+    {
+      emailValidator.validate(facesContext, component, "matzew@apache");
+      fail("Expected ValidatorException");
+    }
+    catch (ValidatorException ve)
+    {
+      // if exception then fine.
+    }
+
+  }
+
+  public void testGoodEmailAddress()
+  {
+      emailValidator.validate(facesContext, component, "foo@apache.org");
+  }
+  
+}
\ No newline at end of file

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/EmailValidatorTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/EmailValidatorTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/ISBNValidatorTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/ISBNValidatorTestCase.java?rev=684340&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/ISBNValidatorTestCase.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/ISBNValidatorTestCase.java Sat Aug  9 13:42:51 2008
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.commons.validator;
+
+import javax.faces.validator.ValidatorException;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class ISBNValidatorTestCase extends AbstractValidatorTestCase
+{
+
+  public ISBNValidatorTestCase(String arg0) {
+    super(arg0);
+  }
+  
+  ISBNValidator isbnValidator;
+  
+  protected void setUp() throws Exception
+  {
+    super.setUp();
+    isbnValidator = new ISBNValidator();    
+  }
+
+  protected void tearDown() throws Exception
+  {
+    super.tearDown();
+  }
+
+  public static Test suite()
+  {
+    return new TestSuite(ISBNValidatorTestCase.class);
+  }
+
+  /**
+   * Test when context is set to null
+   */
+  public void testNullContext()
+  {
+
+    doTestNullContext(component, isbnValidator);
+  }
+  
+  public void testWrongISBN()
+  {
+    try
+    {
+      isbnValidator.validate(facesContext, component, "8sd481-0277-0");
+      fail("Expected ValidatorException");
+    }
+    catch (ValidatorException ve)
+    {
+      // if exception then fine.
+    }
+
+  }
+
+  public void testGoodISBN()
+  {
+      isbnValidator.validate(facesContext, component, "84-481-0277-0");
+  }
+  
+}
\ No newline at end of file

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/ISBNValidatorTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/ISBNValidatorTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/RegExprValidatorTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/RegExprValidatorTestCase.java?rev=684340&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/RegExprValidatorTestCase.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/RegExprValidatorTestCase.java Sat Aug  9 13:42:51 2008
@@ -0,0 +1,99 @@
+/*
+ * 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.
+ */
+
+package org.apache.myfaces.commons.validator;
+
+import javax.faces.component.UIInput;
+import javax.faces.validator.ValidatorException;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class RegExprValidatorTestCase extends AbstractValidatorTestCase
+{
+
+  public RegExprValidatorTestCase(String arg0) {
+    super(arg0);
+  }
+  
+  RegExprValidator validator;
+  
+  protected void setUp() throws Exception
+  {
+    super.setUp();
+    validator = new RegExprValidator();
+    
+  }
+
+  protected void tearDown() throws Exception
+  {
+    super.tearDown();
+  }
+
+  public static Test suite()
+  {
+    return new TestSuite(RegExprValidatorTestCase.class);
+  }
+  
+  /**
+   * Test when context is set to null
+   */
+  public void testNullContext()
+  {
+
+    doTestNullContext(component, validator);
+  }
+  
+  public void testRightValue()
+  {
+    validator.setPattern("\\d{5}");
+    
+    UIInput comp1 = new UIInput();
+    comp1.setValue("12345");
+    comp1.setId("comp1");
+    facesContext.getViewRoot().getChildren().add(comp1);
+    
+    validator.validate(facesContext, comp1, comp1.getValue());
+
+  }
+
+  public void testWrongValue()
+  {
+    try
+    {
+      validator.setPattern("\\d{12}");
+      
+      UIInput comp1 = new UIInput();
+      comp1.setValue("12345");
+      comp1.setId("comp1");
+      facesContext.getViewRoot().getChildren().add(comp1);
+      
+      validator.validate(facesContext, comp1, comp1.getValue());
+      
+      fail("Expected ValidatorException");
+    }
+    catch (ValidatorException ve)
+    {
+      // if exception then fine.
+    }
+
+  }
+
+  
+}

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/RegExprValidatorTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/RegExprValidatorTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/UrlValidatorTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/UrlValidatorTestCase.java?rev=684340&view=auto
==============================================================================
--- myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/UrlValidatorTestCase.java (added)
+++ myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/UrlValidatorTestCase.java Sat Aug  9 13:42:51 2008
@@ -0,0 +1,79 @@
+/*
+ * 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.
+ */
+package org.apache.myfaces.commons.validator;
+
+import javax.faces.validator.ValidatorException;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class UrlValidatorTestCase extends AbstractValidatorTestCase
+{
+
+  public UrlValidatorTestCase(String arg0) {
+    super(arg0);
+  }
+  
+  UrlValidator urlValidator;
+  
+  protected void setUp() throws Exception
+  {
+    super.setUp();
+    urlValidator = new UrlValidator();    
+  }
+
+  protected void tearDown() throws Exception
+  {
+    super.tearDown();
+  }
+
+  public static Test suite()
+  {
+    return new TestSuite(UrlValidatorTestCase.class);
+  }
+
+  /**
+   * Test when context is set to null
+   */
+  public void testNullContext()
+  {
+
+    doTestNullContext(component, urlValidator);
+  }
+  
+  public void testWrongUrl()
+  {
+    try
+    {
+      urlValidator.validate(facesContext, component, "http://fsdfsdfds");
+      fail("Expected ValidatorException");
+    }
+    catch (ValidatorException ve)
+    {
+      // if exception then fine.
+    }
+
+  }
+
+  public void testGoodUrl()
+  {
+      urlValidator.validate(facesContext, component, "http://myfaces.apache.org");
+  }
+  
+}
\ No newline at end of file

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/UrlValidatorTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/commons/branches/jsf_11/myfaces-commons-validators/src/test/java/org/apache/myfaces/commons/validator/UrlValidatorTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL