You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by rd...@apache.org on 2010/07/22 15:39:33 UTC

svn commit: r966651 [3/5] - in /myfaces/extensions/validator/branches/branch_for_jsf_1_1: core/src/main/java/org/apache/myfaces/extensions/validator/core/ core/src/main/java/org/apache/myfaces/extensions/validator/core/startup/ core/src/main/java/org/a...

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationCustomValidationStrategyFactoryClassNameTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationCustomValidationStrategyFactoryClassNameTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationCustomValidationStrategyFactoryClassNameTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationCustomValidationStrategyFactoryClassNameTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,123 @@
+/*
+ * 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.extensions.validator.test.core.config;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.ExtValInformation;
+import org.apache.myfaces.extensions.validator.core.DefaultExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.factory.DefaultFactoryFinder;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryFinder;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.DefaultValidationStrategyFactory;
+import org.apache.myfaces.extensions.validator.test.base.mock.MockValidationStrategyFactory;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+
+/**
+ * 
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValCoreConfigurationCustomValidationStrategyFactoryClassNameTestCase extends
+        ExtValCoreConfigurationTestCase
+{
+    public ExtValCoreConfigurationCustomValidationStrategyFactoryClassNameTestCase(String name)
+    {
+        super(name);
+    }
+
+    public static class CustomValidationStrategyFactory extends DefaultValidationStrategyFactory
+    {
+
+    }
+
+    public static class Custom2ValidationStrategyFactory extends DefaultValidationStrategyFactory
+    {
+
+    }
+
+    protected void addInitializationParameters()
+    {
+        super.addInitializationParameters();
+        if (needXmlParameters())
+        {
+            addInitParameter(ExtValInformation.WEBXML_PARAM_PREFIX + ".CUSTOM_VALIDATION_STRATEGY_FACTORY",
+                    CustomValidationStrategyFactory.class.getName());
+
+        }
+    }
+
+    @Override
+    protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
+    {
+        if (needCustomConfig())
+        {
+
+            return new DefaultExtValCoreConfiguration()
+            {
+                @Override
+                public String customValidationStrategyFactoryClassName()
+                {
+                    return Custom2ValidationStrategyFactory.class.getName();
+                }
+
+            };
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public void testCustomValidationStrategyFactoryClassNameDefault()
+    {
+        FactoryFinder factoryFinder = DefaultFactoryFinder.getInstance();
+        Object factory = factoryFinder.getFactory(FactoryNames.VALIDATION_STRATEGY_FACTORY, Object.class);
+        // The testcase install a MockFactory for it that exposes some protected
+        // information
+        // assertEquals(DefaultValidationStrategyFactory.class.getName(),
+        // factory
+        // .getClass().getName());
+        assertEquals(MockValidationStrategyFactory.class.getName(), factory.getClass().getName());
+
+    }
+
+    public void testCustomValidationStrategyFactoryClassNameWebXml()
+    {
+        FactoryFinder factoryFinder = DefaultFactoryFinder.getInstance();
+        Object factory = factoryFinder.getFactory(FactoryNames.VALIDATION_STRATEGY_FACTORY, Object.class);
+        assertEquals(CustomValidationStrategyFactory.class.getName(), factory.getClass().getName());
+    }
+
+    public void testCustomValidationStrategyFactoryClassNameCustomConfig()
+    {
+        FactoryFinder factoryFinder = DefaultFactoryFinder.getInstance();
+        Object factory = factoryFinder.getFactory(FactoryNames.VALIDATION_STRATEGY_FACTORY, Object.class);
+        assertEquals(Custom2ValidationStrategyFactory.class.getName(), factory.getClass().getName());
+    }
+
+    public static Test suite()
+    {
+
+        return new ClassLoaderTestSuite(ExtValCoreConfigurationCustomValidationStrategyFactoryClassNameTestCase.class);
+    }
+
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationCustomValidationStrategyToMessageResolverNameMapperClassNameTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationCustomValidationStrategyToMessageResolverNameMapperClassNameTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationCustomValidationStrategyToMessageResolverNameMapperClassNameTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationCustomValidationStrategyToMessageResolverNameMapperClassNameTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,159 @@
+/*
+ * 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.extensions.validator.test.core.config;
+
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.ExtValInformation;
+import org.apache.myfaces.extensions.validator.core.DefaultExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
+import org.apache.myfaces.extensions.validator.core.factory.NameMapperAwareFactory;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.test.base.mock.MockMessageResolverFactory;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+
+/**
+ * 
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValCoreConfigurationCustomValidationStrategyToMessageResolverNameMapperClassNameTestCase extends
+        ExtValCoreConfigurationTestCase
+{
+
+    private static final String WEB_XML = "Web.xml";
+    private static final String CUSTOM_CONFIG = "Custom Config";
+
+    public ExtValCoreConfigurationCustomValidationStrategyToMessageResolverNameMapperClassNameTestCase(String name)
+    {
+        super(name);
+    }
+
+    public static class CustomNameMapper implements NameMapper<ValidationStrategy>
+    {
+
+        public String createName(ValidationStrategy source)
+        {
+            return WEB_XML;
+        }
+
+    }
+
+    public static class Custom2NameMapper implements NameMapper<ValidationStrategy>
+    {
+
+        public String createName(ValidationStrategy source)
+        {
+            return CUSTOM_CONFIG;
+        }
+
+    }
+
+    @Override
+    protected void addInitializationParameters()
+    {
+        super.addInitializationParameters();
+        if (needXmlParameters())
+        {
+            addInitParameter(ExtValInformation.WEBXML_PARAM_PREFIX
+                    + ".CUSTOM_VALIDATION_STRATEGY_TO_MESSAGE_RESOLVER_NAME_MAPPER", CustomNameMapper.class.getName());
+        }
+    }
+
+    @Override
+    protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
+    {
+        if (needCustomConfig())
+        {
+
+            return new DefaultExtValCoreConfiguration()
+            {
+                @Override
+                public String customValidationStrategyToMessageResolverNameMapperClassName()
+                {
+                    return Custom2NameMapper.class.getName();
+                }
+            };
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public void testCustomValidationStrategyToMessageResolverNameMapperClassNameDefault()
+    {
+        List<NameMapper<ValidationStrategy>> nameMappers = getNameMappers();
+        assertEquals(5, nameMappers.size());
+        // The first one (due to @InvocationOrder) is the
+        // CustomConfiguredValidationStrategyToMsgResolverNameMapper which we
+        // can
+        // customize and testing here.
+        NameMapper<ValidationStrategy> mapper = nameMappers.get(0);
+        // By default nothing is configures so should return null.
+        assertNull(mapper.createName(null));
+
+    }
+
+    public void testCustomValidationStrategyToMessageResolverNameMapperClassNameWebXml()
+    {
+        List<NameMapper<ValidationStrategy>> nameMappers = getNameMappers();
+        assertEquals(5, nameMappers.size());
+        // No mapper additional, but the first mapper contain now our custom
+        // configured mapper.
+
+        NameMapper<ValidationStrategy> mapper = nameMappers.get(0);
+        // So now it should return some value
+        assertEquals(WEB_XML, mapper.createName(null));
+    }
+
+    public void testCustomValidationStrategyToMessageResolverNameMapperClassNameCustomConfig()
+    {
+        List<NameMapper<ValidationStrategy>> nameMappers = getNameMappers();
+        assertEquals(5, nameMappers.size());
+        // No mapper additional, but the first mapper contain now our custom
+        // configured mapper.
+
+        NameMapper<ValidationStrategy> mapper = nameMappers.get(0);
+        // So now it should return some value
+        assertEquals(CUSTOM_CONFIG, mapper.createName(null));
+    }
+
+    private List<NameMapper<ValidationStrategy>> getNameMappers()
+    {
+        NameMapperAwareFactory result = ExtValContext.getContext().getFactoryFinder().getFactory(
+                FactoryNames.MESSAGE_RESOLVER_FACTORY, NameMapperAwareFactory.class);
+
+        return ((MockMessageResolverFactory) result).getRegisteredNameMapperList();
+    }
+
+    public static Test suite()
+    {
+
+        return new ClassLoaderTestSuite(
+                ExtValCoreConfigurationCustomValidationStrategyToMessageResolverNameMapperClassNameTestCase.class);
+    }
+
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationCustomValidationStrategyToMetaDataTransformerNameMapperClassNameTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationCustomValidationStrategyToMetaDataTransformerNameMapperClassNameTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationCustomValidationStrategyToMetaDataTransformerNameMapperClassNameTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationCustomValidationStrategyToMetaDataTransformerNameMapperClassNameTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,155 @@
+/*
+ * 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.extensions.validator.test.core.config;
+
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.ExtValInformation;
+import org.apache.myfaces.extensions.validator.core.DefaultExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
+import org.apache.myfaces.extensions.validator.core.factory.NameMapperAwareFactory;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.test.base.mock.MockMetaDataTransformerFactory;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+
+/**
+ * 
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValCoreConfigurationCustomValidationStrategyToMetaDataTransformerNameMapperClassNameTestCase extends
+        ExtValCoreConfigurationTestCase
+{
+    private static final String WEB_XML = "Web.xml";
+    private static final String CUSTOM_CONFIG = "Custom Config";
+
+    public ExtValCoreConfigurationCustomValidationStrategyToMetaDataTransformerNameMapperClassNameTestCase(String name)
+    {
+        super(name);
+    }
+
+    public static class CustomNameMapper implements NameMapper<ValidationStrategy>
+    {
+
+        public String createName(ValidationStrategy source)
+        {
+            return WEB_XML;
+        }
+
+    }
+
+    public static class Custom2NameMapper implements NameMapper<ValidationStrategy>
+    {
+
+        public String createName(ValidationStrategy source)
+        {
+            return CUSTOM_CONFIG;
+        }
+
+    }
+
+    @Override
+    protected void addInitializationParameters()
+    {
+        super.addInitializationParameters();
+        if (needXmlParameters())
+        {
+            addInitParameter(ExtValInformation.WEBXML_PARAM_PREFIX
+                    + ".CUSTOM_VALIDATION_STRATEGY_TO_META_DATA_TRANSFORMER_NAME_MAPPER", CustomNameMapper.class
+                    .getName());
+        }
+    }
+
+    @Override
+    protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
+    {
+        if (needCustomConfig())
+        {
+
+            return new DefaultExtValCoreConfiguration()
+            {
+                @Override
+                public String customValidationStrategyToMetaDataTransformerNameMapperClassName()
+                {
+                    return Custom2NameMapper.class.getName();
+                }
+            };
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public void testCustomValidationStrategyToMetaDataTransformerNameMapperClassNameDefault()
+    {
+        List<NameMapper<ValidationStrategy>> nameMappers = getNameMappers();
+        assertEquals(6, nameMappers.size());
+        // The first one (due to @InvocationOrder) is the
+        // CustomConfiguredValidationStrategyToMetaDataTransformerNameMapper
+        // which we can customize and testing here.
+        NameMapper<ValidationStrategy> mapper = nameMappers.get(0);
+        // By default nothing is configures so should return null.
+        assertNull(mapper.createName(null));
+    }
+
+    public void testCustomValidationStrategyToMetaDataTransformerNameMapperClassNameWebXml()
+    {
+        List<NameMapper<ValidationStrategy>> nameMappers = getNameMappers();
+        assertEquals(6, nameMappers.size());
+        // No mapper additional, but the first mapper contain now our custom
+        // configured mapper.
+        NameMapper<ValidationStrategy> mapper = nameMappers.get(0);
+        // So now it should return some value
+        assertEquals(WEB_XML, mapper.createName(null));
+    }
+
+    public void testCustomValidationStrategyToMetaDataTransformerNameMapperClassNameCustomConfig()
+    {
+        List<NameMapper<ValidationStrategy>> nameMappers = getNameMappers();
+        assertEquals(6, nameMappers.size());
+        // No mapper additional, but the first mapper contain now our custom
+        // configured mapper.
+        NameMapper<ValidationStrategy> mapper = nameMappers.get(0);
+        // So now it should return some value
+        assertEquals(CUSTOM_CONFIG, mapper.createName(null));
+    }
+
+    private List<NameMapper<ValidationStrategy>> getNameMappers()
+    {
+        NameMapperAwareFactory result = ExtValContext.getContext().getFactoryFinder().getFactory(
+                FactoryNames.META_DATA_TRANSFORMER_FACTORY, NameMapperAwareFactory.class);
+
+        return ((MockMetaDataTransformerFactory) result).getRegisteredNameMapperList();
+    }
+
+    public static Test suite()
+    {
+
+        return new ClassLoaderTestSuite(
+                ExtValCoreConfigurationCustomValidationStrategyToMetaDataTransformerNameMapperClassNameTestCase.class);
+    }
+
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateComponentInitializationTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateComponentInitializationTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateComponentInitializationTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateComponentInitializationTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,123 @@
+/*
+ * 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.extensions.validator.test.core.config;
+
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.ExtValInformation;
+import org.apache.myfaces.extensions.validator.core.DefaultExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.initializer.component.ComponentInitializer;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+
+/**
+ * 
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValCoreConfigurationDeactivateComponentInitializationTestCase extends ExtValCoreConfigurationTestCase
+{
+    public ExtValCoreConfigurationDeactivateComponentInitializationTestCase(String name)
+    {
+        super(name);
+    }
+
+    public static class CustomComponentInitializer implements ComponentInitializer
+    {
+
+        public void configureComponent(FacesContext facesContext, UIComponent uiComponent, Map<String, Object> metaData)
+        {
+
+        }
+
+    }
+
+    @Override
+    protected void setUp() throws Exception
+    {
+
+        super.setUp();
+        // Make sure we have one ComponentInitializer. When deactivated the
+        // getComponentInitializers returns an empty list whatever registered.
+        ExtValContext.getContext().addComponentInitializer(new CustomComponentInitializer());
+
+    }
+
+    @Override
+    protected void addInitializationParameters()
+    {
+        super.addInitializationParameters();
+        if (needXmlParameters())
+        {
+            addInitParameter(ExtValInformation.WEBXML_PARAM_PREFIX + ".DEACTIVATE_COMPONENT_INITIALIZATION", "true");
+
+        }
+    }
+
+    @Override
+    protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
+    {
+        if (needCustomConfig())
+        {
+
+            return new DefaultExtValCoreConfiguration()
+            {
+                @Override
+                public boolean deactivateComponentInitialization()
+                {
+                    return true;
+                }
+            };
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public void testDeactivateComponentInitializationDefault()
+    {
+
+        assertFalse(ExtValContext.getContext().getComponentInitializers().isEmpty());
+    }
+
+    public void testDeactivateComponentInitializationWebXml()
+    {
+        assertTrue(ExtValContext.getContext().getComponentInitializers().isEmpty());
+    }
+
+    public void testDeactivateComponentInitializationCustomConfig()
+    {
+        assertTrue(ExtValContext.getContext().getComponentInitializers().isEmpty());
+    }
+
+    public static Test suite()
+    {
+
+        return new ClassLoaderTestSuite(ExtValCoreConfigurationDeactivateComponentInitializationTestCase.class);
+    }
+
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateDefaultConventionTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateDefaultConventionTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateDefaultConventionTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateDefaultConventionTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,102 @@
+/*
+ * 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.extensions.validator.test.core.config;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.ExtValInformation;
+import org.apache.myfaces.extensions.validator.core.DefaultExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.internal.Priority;
+import org.apache.myfaces.extensions.validator.internal.ToDo;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+
+/**
+ * 
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValCoreConfigurationDeactivateDefaultConventionTestCase extends ExtValCoreConfigurationTestCase
+{
+    public ExtValCoreConfigurationDeactivateDefaultConventionTestCase(String name)
+    {
+        super(name);
+    }
+
+    @Override
+    protected void addInitializationParameters()
+    {
+        super.addInitializationParameters();
+        if (needXmlParameters())
+        {
+            addInitParameter(ExtValInformation.WEBXML_PARAM_PREFIX + ".DEACTIVATE_DEFAULT_CONVENTION", "true");
+        }
+    }
+
+    @Override
+    protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
+    {
+        if (needCustomConfig())
+        {
+
+            return new DefaultExtValCoreConfiguration()
+            {
+                @Override
+                public boolean deactivateDefaultConvention()
+                {
+                    return true;
+                }
+
+            };
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    @ToDo(value = Priority.MEDIUM, description = "some better logic to see if it is really well integrated")
+    public void testDeactivateDefConventionDefault() throws Exception
+    {
+        // Not a very clever testcase but code in
+        // AbstractValidationErrorMessageResolver is too complex to have a quick
+        // simple test of the parameter
+        assertFalse(ExtValCoreConfiguration.get().deactivateDefaultConvention());
+    }
+
+    // Name of method should contain default
+    public void testDeactivateDefConventionWebXml()
+    {
+        assertTrue(ExtValCoreConfiguration.get().deactivateDefaultConvention());
+    }
+
+    // Name of method should contain default
+    public void testDeactivateDefConventionCustomConfig()
+    {
+        assertTrue(ExtValCoreConfiguration.get().deactivateDefaultConvention());
+    }
+
+    public static Test suite()
+    {
+
+        return new ClassLoaderTestSuite(ExtValCoreConfigurationDeactivateDefaultConventionTestCase.class);
+    }
+
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateDefaultNameMappersTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateDefaultNameMappersTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateDefaultNameMappersTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateDefaultNameMappersTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,114 @@
+/*
+ * 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.extensions.validator.test.core.config;
+
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.ExtValInformation;
+import org.apache.myfaces.extensions.validator.core.DefaultExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.factory.FactoryNames;
+import org.apache.myfaces.extensions.validator.core.factory.NameMapperAwareFactory;
+import org.apache.myfaces.extensions.validator.core.mapper.NameMapper;
+import org.apache.myfaces.extensions.validator.core.validation.strategy.ValidationStrategy;
+import org.apache.myfaces.extensions.validator.test.base.mock.MockMessageResolverFactory;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+
+/**
+ * 
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValCoreConfigurationDeactivateDefaultNameMappersTestCase extends ExtValCoreConfigurationTestCase
+{
+    public ExtValCoreConfigurationDeactivateDefaultNameMappersTestCase(String name)
+    {
+        super(name);
+    }
+
+    @Override
+    protected void addInitializationParameters()
+    {
+        super.addInitializationParameters();
+        if (needXmlParameters())
+        {
+            addInitParameter(ExtValInformation.WEBXML_PARAM_PREFIX + ".DEACTIVATE_DEFAULT_NAME_MAPPERS", "true");
+        }
+    }
+
+    @Override
+    protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
+    {
+        if (needCustomConfig())
+        {
+
+            return new DefaultExtValCoreConfiguration()
+            {
+                @Override
+                public boolean deactivateDefaultNameMappers()
+                {
+                    return true;
+                }
+
+            };
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public void testDeactivateDefaultNameMappersDefault()
+    {
+        List<NameMapper<ValidationStrategy>> nameMappers = getNameMappers();
+        assertFalse(nameMappers.isEmpty());
+    }
+
+    public void testDeactivateDefaultNameMappersWebXml()
+    {
+        List<NameMapper<ValidationStrategy>> nameMappers = getNameMappers();
+        assertTrue(nameMappers.isEmpty());
+    }
+
+    // Name shouldn't contain default
+    public void testDeactivateDefNameMappersCustomConfig()
+    {
+        List<NameMapper<ValidationStrategy>> nameMappers = getNameMappers();
+        assertTrue(nameMappers.isEmpty());
+    }
+
+    private List<NameMapper<ValidationStrategy>> getNameMappers()
+    {
+        NameMapperAwareFactory result = ExtValContext.getContext().getFactoryFinder().getFactory(
+                FactoryNames.MESSAGE_RESOLVER_FACTORY, NameMapperAwareFactory.class);
+
+        return ((MockMessageResolverFactory) result).getRegisteredNameMapperList();
+    }
+
+    public static Test suite()
+    {
+
+        return new ClassLoaderTestSuite(ExtValCoreConfigurationDeactivateDefaultNameMappersTestCase.class);
+    }
+
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateRenderKitFactoryTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateRenderKitFactoryTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateRenderKitFactoryTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateRenderKitFactoryTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,106 @@
+/*
+ * 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.extensions.validator.test.core.config;
+
+import javax.faces.render.RenderKit;
+import javax.faces.render.RenderKitFactory;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.ExtValInformation;
+import org.apache.myfaces.extensions.validator.core.DefaultExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.renderkit.ExtValRenderKit;
+import org.apache.myfaces.extensions.validator.core.renderkit.ExtValRenderKitFactory;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+import org.apache.shale.test.mock.MockRenderKit;
+import org.apache.shale.test.mock.MockRenderKitFactory;
+
+/**
+ * 
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValCoreConfigurationDeactivateRenderKitFactoryTestCase extends ExtValCoreConfigurationTestCase
+{
+    public ExtValCoreConfigurationDeactivateRenderKitFactoryTestCase(String name)
+    {
+        super(name);
+    }
+
+    protected void addInitializationParameters()
+    {
+        super.addInitializationParameters();
+        if (needXmlParameters())
+        {
+            addInitParameter(ExtValInformation.WEBXML_PARAM_PREFIX + ".DEACTIVATE_RENDER_KIT_FACTORY", "true");
+        }
+    }
+
+    @Override
+    protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
+    {
+        if (needCustomConfig())
+        {
+
+            return new DefaultExtValCoreConfiguration()
+            {
+                @Override
+                public boolean deactivateRenderKitFactory()
+                {
+                    return true;
+                }
+            };
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public void testDeactivateRenderKitFactoryDefault()
+    {
+        RenderKitFactory factory = new ExtValRenderKitFactory(new MockRenderKitFactory());
+        RenderKit renderKit = factory.getRenderKit(facesContext, RenderKitFactory.HTML_BASIC_RENDER_KIT);
+        assertEquals(ExtValRenderKit.class.getName(), renderKit.getClass().getName());
+
+    }
+
+    public void testDeactivateRenderKitFactoryWebXml()
+    {
+        RenderKitFactory factory = new ExtValRenderKitFactory(new MockRenderKitFactory());
+        RenderKit renderKit = factory.getRenderKit(facesContext, RenderKitFactory.HTML_BASIC_RENDER_KIT);
+        assertEquals(MockRenderKit.class.getName(), renderKit.getClass().getName());
+    }
+
+    public void testDeactivateRenderKitFactoryCustomConfig()
+    {
+        RenderKitFactory factory = new ExtValRenderKitFactory(new MockRenderKitFactory());
+        RenderKit renderKit = factory.getRenderKit(facesContext, RenderKitFactory.HTML_BASIC_RENDER_KIT);
+        assertEquals(MockRenderKit.class.getName(), renderKit.getClass().getName());
+    }
+
+    public static Test suite()
+    {
+
+        return new ClassLoaderTestSuite(ExtValCoreConfigurationDeactivateRenderKitFactoryTestCase.class);
+    }
+
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateRequiredAttributeSupportTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateRequiredAttributeSupportTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateRequiredAttributeSupportTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateRequiredAttributeSupportTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,93 @@
+/*
+ * 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.extensions.validator.test.core.config;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.ExtValInformation;
+import org.apache.myfaces.extensions.validator.core.DefaultExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+
+/**
+ * 
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValCoreConfigurationDeactivateRequiredAttributeSupportTestCase extends ExtValCoreConfigurationTestCase
+{
+    public ExtValCoreConfigurationDeactivateRequiredAttributeSupportTestCase(String name)
+    {
+        super(name);
+    }
+
+    protected void addInitializationParameters()
+    {
+        super.addInitializationParameters();
+        if (needXmlParameters())
+        {
+            addInitParameter(ExtValInformation.WEBXML_PARAM_PREFIX + ".DEACTIVATE_REQUIRED_ATTRIBUTE_SUPPORT", "true");
+        }
+    }
+
+    @Override
+    protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
+    {
+        if (needCustomConfig())
+        {
+
+            return new DefaultExtValCoreConfiguration()
+            {
+                @Override
+                public boolean deactivateRequiredAttributeSupport()
+                {
+                    return true;
+                }
+            };
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public void testDeactivateRequiredAttributeSupportDefault()
+    {
+        assertFalse(ExtValUtils.isRequiredResetActivated());
+    }
+
+    public void testDeactivateRequiredAttributeSupportWebXml()
+    {
+        assertTrue(ExtValUtils.isRequiredResetActivated());
+    }
+
+    public void testDeactivateRequiredAttributeSupportCustomConfig()
+    {
+        assertTrue(ExtValUtils.isRequiredResetActivated());
+    }
+
+    public static Test suite()
+    {
+
+        return new ClassLoaderTestSuite(ExtValCoreConfigurationDeactivateRequiredAttributeSupportTestCase.class);
+    }
+
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateValidationParametersTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateValidationParametersTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateValidationParametersTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDeactivateValidationParametersTestCase.java Thu Jul 22 13:39:30 2010
@@ -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.extensions.validator.test.core.config;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.ExtValInformation;
+import org.apache.myfaces.extensions.validator.core.DefaultExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.DefaultValidationParameterExtractor;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+import org.apache.myfaces.extensions.validator.util.ExtValUtils;
+
+/**
+ * 
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValCoreConfigurationDeactivateValidationParametersTestCase extends ExtValCoreConfigurationTestCase
+{
+    public ExtValCoreConfigurationDeactivateValidationParametersTestCase(String name)
+    {
+        super(name);
+    }
+
+    protected void addInitializationParameters()
+    {
+        super.addInitializationParameters();
+        if (needXmlParameters())
+        {
+            addInitParameter(ExtValInformation.WEBXML_PARAM_PREFIX + ".DEACTIVATE_VALIDATION_PARAMETERS", "true");
+        }
+    }
+
+    @Override
+    protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
+    {
+        if (needCustomConfig())
+        {
+
+            return new DefaultExtValCoreConfiguration()
+            {
+                @Override
+                public boolean deactivateValidationParameters()
+                {
+                    return true;
+                }
+            };
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public void testDeactivateValidationParametersDefault()
+    {
+        assertEquals(DefaultValidationParameterExtractor.class.getName(), ExtValUtils.getValidationParameterExtractor()
+                .getClass().getName());
+
+    }
+
+    public void testDeactivateValidationParametersWebXml()
+    {
+        assertTrue(ExtValUtils.getValidationParameterExtractor().getClass().getName().startsWith(
+                ExtValUtils.class.getName()));
+    }
+
+    public void testDeactivateValidationParametersCustomConfig()
+    {
+        assertTrue(ExtValUtils.getValidationParameterExtractor().getClass().getName().startsWith(
+                ExtValUtils.class.getName()));
+    }
+
+    public static Test suite()
+    {
+
+        return new ClassLoaderTestSuite(ExtValCoreConfigurationDeactivateValidationParametersTestCase.class);
+    }
+
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDisableClientSideValidationValidationParameterTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDisableClientSideValidationValidationParameterTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDisableClientSideValidationValidationParameterTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationDisableClientSideValidationValidationParameterTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,93 @@
+/*
+ * 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.extensions.validator.test.core.config;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.core.DefaultExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.DisableClientSideValidation;
+import org.apache.myfaces.extensions.validator.core.validation.parameter.ValidationParameter;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+
+/**
+ * 
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValCoreConfigurationDisableClientSideValidationValidationParameterTestCase extends
+        ExtValCoreConfigurationTestCase
+{
+    public ExtValCoreConfigurationDisableClientSideValidationValidationParameterTestCase(String name)
+    {
+        super(name);
+    }
+
+    public static interface CustomDisableClientSideValidation extends DisableClientSideValidation
+    {
+
+    }
+
+    @Override
+    protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
+    {
+        if (needCustomConfig())
+        {
+
+            return new DefaultExtValCoreConfiguration()
+            {
+
+                @Override
+                public Class<? extends ValidationParameter> disableClientSideValidationValidationParameter()
+                {
+                    return CustomDisableClientSideValidation.class;
+                }
+
+            };
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public void testDisableClientSideValidationValidationParameterDefault()
+    {
+
+        assertEquals(DisableClientSideValidation.class.getName(), ((Class) ExtValContext.getContext()
+                .getGlobalProperty(DisableClientSideValidation.class.getName())).getName());
+    }
+
+    public void testDisableClientSideValidationValidationParameterCustomConfig()
+    {
+
+        assertEquals(CustomDisableClientSideValidation.class.getName(), ((Class) ExtValContext.getContext()
+                .getGlobalProperty(DisableClientSideValidation.class.getName())).getName());
+    }
+
+    public static Test suite()
+    {
+
+        return new ClassLoaderTestSuite(
+                ExtValCoreConfigurationDisableClientSideValidationValidationParameterTestCase.class);
+    }
+
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationIgnoreConstraintSourceAnnotationTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationIgnoreConstraintSourceAnnotationTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationIgnoreConstraintSourceAnnotationTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationIgnoreConstraintSourceAnnotationTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,96 @@
+/*
+ * 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.extensions.validator.test.core.config;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.core.DefaultExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+import org.apache.myfaces.extensions.validator.test.core.config.support.ConstraintSourceAwareBean;
+import org.apache.myfaces.extensions.validator.test.core.config.support.CustomIgnoreConstraintSource;
+import org.apache.myfaces.extensions.validator.util.ConstraintSourceUtils;
+import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
+
+/**
+ * 
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValCoreConfigurationIgnoreConstraintSourceAnnotationTestCase extends ExtValCoreConfigurationTestCase
+{
+    public ExtValCoreConfigurationIgnoreConstraintSourceAnnotationTestCase(String name)
+    {
+        super(name);
+    }
+
+    @Override
+    protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
+    {
+        if (needCustomConfig())
+        {
+
+            return new DefaultExtValCoreConfiguration()
+            {
+                @Override
+                public Class<? extends Annotation> ignoreConstraintSourceAnnotation()
+                {
+                    return CustomIgnoreConstraintSource.class;
+                }
+            };
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public void testIgnoreConstraintSourceAnnotationDefault() throws Exception
+    {
+        Method method = ReflectionUtils.getMethod(ConstraintSourceUtils.class, "isMappedConstraintSourceIgnored",
+                Class.class, String.class);
+        assertNotNull(method);
+        assertTrue((Boolean) ReflectionUtils.invokeMethodOfClass(ConstraintSourceUtils.class, method,
+                ConstraintSourceAwareBean.class, "property1"));
+        assertFalse((Boolean) ReflectionUtils.invokeMethodOfClass(ConstraintSourceUtils.class, method,
+                ConstraintSourceAwareBean.class, "property2"));
+    }
+
+    public void testIgnoreConstraintSourceAnnotationCustomConfig() throws Exception
+    {
+        Method method = ReflectionUtils.getMethod(ConstraintSourceUtils.class, "isMappedConstraintSourceIgnored",
+                Class.class, String.class);
+        assertNotNull(method);
+        assertFalse((Boolean) ReflectionUtils.invokeMethodOfClass(ConstraintSourceUtils.class, method,
+                ConstraintSourceAwareBean.class, "property1"));
+        assertTrue((Boolean) ReflectionUtils.invokeMethodOfClass(ConstraintSourceUtils.class, method,
+                ConstraintSourceAwareBean.class, "property2"));
+    }
+
+    public static Test suite()
+    {
+
+        return new ClassLoaderTestSuite(ExtValCoreConfigurationIgnoreConstraintSourceAnnotationTestCase.class);
+    }
+
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationInterpretEmptyStringSubmittedValuesAsNullTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationInterpretEmptyStringSubmittedValuesAsNullTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationInterpretEmptyStringSubmittedValuesAsNullTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationInterpretEmptyStringSubmittedValuesAsNullTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,132 @@
+/*
+ * 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.extensions.validator.test.core.config;
+
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.core.DefaultExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.interceptor.AbstractValidationInterceptor;
+import org.apache.myfaces.extensions.validator.core.metadata.extractor.MetaDataExtractor;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+
+/**
+ * 
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValCoreConfigurationInterpretEmptyStringSubmittedValuesAsNullTestCase extends
+        ExtValCoreConfigurationTestCase
+{
+    public ExtValCoreConfigurationInterpretEmptyStringSubmittedValuesAsNullTestCase(String name)
+    {
+        super(name);
+    }
+
+    public static class TestValidationInterceptor extends AbstractValidationInterceptor
+    {
+
+        @Override
+        protected MetaDataExtractor getComponentMetaDataExtractor(Map<String, Object> properties)
+        {
+            return null;
+        }
+
+        @Override
+        protected void initComponent(FacesContext facesContext, UIComponent uiComponent)
+        {
+
+        }
+
+        @Override
+        protected void processValidation(FacesContext facesContext, UIComponent uiComponent, Object convertedObject)
+        {
+
+        }
+
+        @Override
+        public boolean interpretEmptyStringValuesAsNull()
+        {
+            return super.interpretEmptyStringValuesAsNull();
+        }
+
+    }
+
+    @Override
+    protected void addInitializationParameters()
+    {
+        super.addInitializationParameters();
+        if (needXmlParameters())
+        {
+            addInitParameter("javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL", "false");
+        }
+    }
+
+    @Override
+    protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
+    {
+        if (needCustomConfig())
+        {
+
+            return new DefaultExtValCoreConfiguration()
+            {
+                @Override
+                public boolean interpretEmptyStringSubmittedValuesAsNull()
+                {
+                    return false;
+                }
+            };
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public void testInterpretEmptyStringSubmittedValuesAsNullDefault()
+    {
+        TestValidationInterceptor interceptor = new TestValidationInterceptor();
+        assertTrue(interceptor.interpretEmptyStringValuesAsNull());
+    }
+
+    public void testInterpretEmptyStringSubmittedValuesAsNullWebXml()
+    {
+        TestValidationInterceptor interceptor = new TestValidationInterceptor();
+        assertFalse(interceptor.interpretEmptyStringValuesAsNull());
+    }
+
+    public void testInterpretEmptyStringSubmittedValuesAsNullCustomConfig()
+    {
+        TestValidationInterceptor interceptor = new TestValidationInterceptor();
+        assertFalse(interceptor.interpretEmptyStringValuesAsNull());
+    }
+
+    public static Test suite()
+    {
+
+        return new ClassLoaderTestSuite(ExtValCoreConfigurationInterpretEmptyStringSubmittedValuesAsNullTestCase.class);
+    }
+
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationProjectStageResolverTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationProjectStageResolverTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationProjectStageResolverTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationProjectStageResolverTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,107 @@
+/*
+ * 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.extensions.validator.test.core.config;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.core.DefaultExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.JsfProjectStage;
+import org.apache.myfaces.extensions.validator.core.ProjectStage;
+import org.apache.myfaces.extensions.validator.core.ProjectStageResolver;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+
+/**
+ * 
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValCoreConfigurationProjectStageResolverTestCase extends ExtValCoreConfigurationTestCase
+{
+    public ExtValCoreConfigurationProjectStageResolverTestCase(String name)
+    {
+        super(name);
+    }
+
+    public static class CustomProjectStageResolver implements ProjectStageResolver
+    {
+
+        public ProjectStage getCurrentProjectStage()
+        {
+
+            return ProjectStage.createStage(JsfProjectStage.UnitTest.getValue());
+        }
+
+    }
+
+    protected void addInitializationParameters()
+    {
+        super.addInitializationParameters();
+        if (needXmlParameters())
+        {
+            addInitParameter("javax.faces.PROJECT_STAGE", "SystemTest");
+        }
+    }
+
+    @Override
+    protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
+    {
+        if (needCustomConfig())
+        {
+
+            return new DefaultExtValCoreConfiguration()
+            {
+
+                @Override
+                public ProjectStageResolver projectStageResolver()
+                {
+                    return new CustomProjectStageResolver();
+                }
+
+            };
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public void testProjectStageResolverDefault()
+    {
+        assertTrue(JsfProjectStage.is(JsfProjectStage.Production));
+    }
+
+    public void testProjectStageResolverWebXml()
+    {
+        assertTrue(JsfProjectStage.is(JsfProjectStage.SystemTest));
+    }
+
+    public void testProjectStageResolverCustomConfig()
+    {
+        assertTrue(JsfProjectStage.is(JsfProjectStage.UnitTest));
+    }
+
+    public static Test suite()
+    {
+
+        return new ClassLoaderTestSuite(ExtValCoreConfigurationProjectStageResolverTestCase.class);
+    }
+
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationProxyHelperTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationProxyHelperTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationProxyHelperTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationProxyHelperTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,145 @@
+/*
+ * 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.extensions.validator.test.core.config;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.ExtValInformation;
+import org.apache.myfaces.extensions.validator.core.DefaultExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.proxy.ProxyHelper;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+import org.apache.myfaces.extensions.validator.util.ProxyUtils;
+
+/**
+ * 
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValCoreConfigurationProxyHelperTestCase extends ExtValCoreConfigurationTestCase
+{
+    public ExtValCoreConfigurationProxyHelperTestCase(String name)
+    {
+        super(name);
+    }
+
+    public static class CustomProxyHelper implements ProxyHelper
+    {
+
+        public String getClassNameOfObject(Object proxiedObject)
+        {
+            return null;
+        }
+
+        public String getNameOfClass(Class proxiedClass)
+        {
+            return null;
+        }
+
+        public Class getUnproxiedClass(Class currentClass)
+        {
+            return null;
+        }
+
+        public <T> Class<T> getUnproxiedClass(Class currentClass, Class<T> targetType)
+        {
+            return null;
+        }
+
+        public boolean isProxiedClass(Class currentClass)
+        {
+            if (currentClass.equals(Object.class))
+            {
+                return true;
+            }
+            return false;
+        }
+
+        public boolean isProxiedObject(Object proxiedObject)
+        {
+            return false;
+        }
+
+    }
+
+    @Override
+    protected void setUp() throws Exception
+    {
+
+        super.setUp();
+        // Trick the method jsfUtils#isApplicationInitialized to believe the
+        // application is initialized
+        facesContext.getExternalContext().getRequestMap().put("Key", "Value");
+    }
+
+    @Override
+    protected void addInitializationParameters()
+    {
+        super.addInitializationParameters();
+        if (needXmlParameters())
+        {
+            addInitParameter(ExtValInformation.WEBXML_PARAM_PREFIX + ".CUSTOM_PROXY_HELPER", CustomProxyHelper.class
+                    .getName());
+        }
+    }
+
+    @Override
+    protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
+    {
+        if (needCustomConfig())
+        {
+
+            return new DefaultExtValCoreConfiguration()
+            {
+                @Override
+                public ProxyHelper proxyHelper()
+                {
+                    return new CustomProxyHelper();
+                }
+            };
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public void testProxyHelperDefault()
+    {
+        assertFalse(ProxyUtils.isProxiedClass(Object.class));
+    }
+
+    public void testProxyHelperWebXml()
+    {
+        assertTrue(ProxyUtils.isProxiedClass(Object.class));
+    }
+
+    public void testProxyHelperCustomConfig()
+    {
+        assertTrue(ProxyUtils.isProxiedClass(Object.class));
+    }
+
+    public static Test suite()
+    {
+
+        return new ClassLoaderTestSuite(ExtValCoreConfigurationProxyHelperTestCase.class);
+    }
+
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationRendererProxyTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationRendererProxyTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationRendererProxyTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationRendererProxyTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,151 @@
+/*
+ * 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.extensions.validator.test.core.config;
+
+import javax.faces.context.FacesContext;
+import javax.faces.render.RenderKit;
+import javax.faces.render.Renderer;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.core.DefaultExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.renderkit.ExtValRendererProxy;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+
+/**
+ * 
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValCoreConfigurationRendererProxyTestCase extends ExtValCoreConfigurationTestCase
+{
+
+    private static final String WEB_XML = "Web.xml";
+    private static final String CUSTOM_CONFIG = "Custom Config";
+
+    public ExtValCoreConfigurationRendererProxyTestCase(String name)
+    {
+        super(name);
+    }
+
+    public static class CustomExtValRendererProxy extends ExtValRendererProxy
+    {
+
+        public CustomExtValRendererProxy(Renderer renderer)
+        {
+            super(renderer);
+        }
+
+        @Override
+        public String convertClientId(FacesContext facesContext, String s)
+        {
+            return WEB_XML;
+        }
+
+    }
+
+    public static class Custom2ExtValRendererProxy extends ExtValRendererProxy
+    {
+
+        public Custom2ExtValRendererProxy(Renderer renderer)
+        {
+            super(renderer);
+        }
+
+        @Override
+        public String convertClientId(FacesContext facesContext, String s)
+        {
+            return CUSTOM_CONFIG;
+        }
+
+    }
+
+    public static class CustomExtValCoreConfiguration extends DefaultExtValCoreConfiguration
+    {
+
+        public CustomExtValCoreConfiguration()
+        {
+            ExtValContext.getContext().addGlobalProperty(ExtValRendererProxy.KEY,
+                    CustomExtValRendererProxy.class.getName(), true);
+        }
+
+    }
+
+    protected void addInitializationParameters()
+    {
+        super.addInitializationParameters();
+        if (needXmlParameters())
+        {
+            addInitParameter(ExtValCoreConfiguration.class.getName(), CustomExtValCoreConfiguration.class.getName());
+        }
+    }
+
+    @Override
+    protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
+    {
+        if (needCustomConfig())
+        {
+
+            return new DefaultExtValCoreConfiguration()
+            {
+                @Override
+                public Class<? extends ExtValRendererProxy> rendererProxy()
+                {
+                    return Custom2ExtValRendererProxy.class;
+                }
+            };
+        }
+        else
+        {
+            return null;
+        }
+
+    }
+
+    public void testRendererProxyDefault()
+    {
+        RenderKit kit = facesContext.getRenderKit();
+        Renderer renderer = kit.getRenderer("javax.faces.Input", "javax.faces.Text");
+        assertEquals("test", renderer.convertClientId(facesContext, "test"));
+    }
+
+    public void testRendererProxyWebXml()
+    {
+        RenderKit kit = facesContext.getRenderKit();
+        Renderer renderer = kit.getRenderer("javax.faces.Input", "javax.faces.Text");
+        assertEquals(WEB_XML, renderer.convertClientId(facesContext, "test"));
+    }
+
+    public void testRendererProxyCustomConfig()
+    {
+        RenderKit kit = facesContext.getRenderKit();
+        Renderer renderer = kit.getRenderer("javax.faces.Input", "javax.faces.Text");
+        assertEquals(CUSTOM_CONFIG, renderer.convertClientId(facesContext, "test"));
+    }
+
+    public static Test suite()
+    {
+
+        return new ClassLoaderTestSuite(ExtValCoreConfigurationRendererProxyTestCase.class);
+    }
+
+}

Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationTargetPropertyAnnotationTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationTargetPropertyAnnotationTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationTargetPropertyAnnotationTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/config/ExtValCoreConfigurationTargetPropertyAnnotationTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,106 @@
+/*
+ * 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.extensions.validator.test.core.config;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.core.DefaultExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValCoreConfiguration;
+import org.apache.myfaces.extensions.validator.core.storage.PropertyStorage;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+import org.apache.myfaces.extensions.validator.test.core.config.support.ConstraintSourceAwareBean;
+import org.apache.myfaces.extensions.validator.test.core.config.support.CustomTargetProperty;
+import org.apache.myfaces.extensions.validator.util.ConstraintSourceUtils;
+import org.apache.myfaces.extensions.validator.util.ExtValAnnotationUtils;
+import org.apache.myfaces.extensions.validator.util.ReflectionUtils;
+
+/**
+ * 
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValCoreConfigurationTargetPropertyAnnotationTestCase extends ExtValCoreConfigurationTestCase
+{
+    public ExtValCoreConfigurationTargetPropertyAnnotationTestCase(String name)
+    {
+        super(name);
+    }
+
+    @Override
+    protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
+    {
+        if (needCustomConfig())
+        {
+
+            return new DefaultExtValCoreConfiguration()
+            {
+                @Override
+                public Class<? extends Annotation> targetPropertyAnnotation()
+                {
+                    return CustomTargetProperty.class;
+                }
+            };
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public void testTargetPropertyAnnotationDefault() throws Exception
+    {
+        Method method = ReflectionUtils.getMethod(ConstraintSourceUtils.class, "getTargetPropertyMetaData",
+                PropertyStorage.class, Class.class, String.class);
+        assertNotNull(method);
+        PropertyStorage storage = ReflectionUtils.getPropertyStorage();
+        Annotation target = (Annotation) ReflectionUtils.invokeMethodOfClass(ConstraintSourceUtils.class, method,
+                storage, ConstraintSourceAwareBean.class, "property3");
+
+        assertEquals("test1", ExtValAnnotationUtils.extractValueOf(target, Object.class));
+
+        assertNull(ReflectionUtils.invokeMethodOfClass(ConstraintSourceUtils.class, method, storage,
+                ConstraintSourceAwareBean.class, "property4"));
+    }
+
+    public void testTargetPropertyAnnotationCustomConfig() throws Exception
+    {
+        Method method = ReflectionUtils.getMethod(ConstraintSourceUtils.class, "getTargetPropertyMetaData",
+                PropertyStorage.class, Class.class, String.class);
+        assertNotNull(method);
+        PropertyStorage storage = ReflectionUtils.getPropertyStorage();
+        Annotation target = (Annotation) ReflectionUtils.invokeMethodOfClass(ConstraintSourceUtils.class, method,
+                storage, ConstraintSourceAwareBean.class, "property4");
+
+        assertEquals("test2", ExtValAnnotationUtils.extractValueOf(target, Object.class));
+
+        assertNull(ReflectionUtils.invokeMethodOfClass(ConstraintSourceUtils.class, method, storage,
+                ConstraintSourceAwareBean.class, "property3"));
+    }
+
+    public static Test suite()
+    {
+
+        return new ClassLoaderTestSuite(ExtValCoreConfigurationTargetPropertyAnnotationTestCase.class);
+    }
+
+}