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 [4/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/ExtValCoreConfigurationTargetPropertyIdAnnotationTestCase.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/ExtValCoreConfigurationTargetPropertyIdAnnotationTestCase.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/ExtValCoreConfigurationTargetPropertyIdAnnotationTestCase.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/ExtValCoreConfigurationTargetPropertyIdAnnotationTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,110 @@
+/*
+ * 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.core.validation.ConstraintSource;
+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.CustomConstraintSource;
+import org.apache.myfaces.extensions.validator.test.core.config.support.CustomTargetPropertyId;
+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 ExtValCoreConfigurationTargetPropertyIdAnnotationTestCase extends ExtValCoreConfigurationTestCase
+{
+ public ExtValCoreConfigurationTargetPropertyIdAnnotationTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
+ {
+ if (needCustomConfig())
+ {
+
+ return new DefaultExtValCoreConfiguration()
+ {
+ @Override
+ public Class<? extends Annotation> targetPropertyIdAnnotation()
+ {
+ return CustomTargetPropertyId.class;
+ }
+ };
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public void testTargetPropertyIdAnnotationDefault() throws Exception
+ {
+ Method method = ReflectionUtils.getMethod(ConstraintSourceUtils.class, "getTargetPropertyMetaData",
+ PropertyStorage.class, Class.class, String.class);
+ assertNotNull(method);
+ PropertyStorage propertyStorage = ReflectionUtils.getPropertyStorage();
+ Annotation target = (Annotation) ReflectionUtils.invokeMethodOfClass(ConstraintSourceUtils.class, method,
+ propertyStorage, ConstraintSourceAwareBean.class, "property5");
+
+ assertEquals(ConstraintSource.class.getName(), ((Class) ExtValAnnotationUtils.extractValueOf(target,
+ Object.class)).getName());
+
+ assertNull(ReflectionUtils.invokeMethodOfClass(ConstraintSourceUtils.class, method,
+ propertyStorage, ConstraintSourceAwareBean.class, "property6"));
+ }
+
+ public void testTargetPropertyIdAnnotationCustomConfig() throws Exception
+ {
+ Method method = ReflectionUtils.getMethod(ConstraintSourceUtils.class, "getTargetPropertyMetaData",
+ PropertyStorage.class, Class.class, String.class);
+ assertNotNull(method);
+ PropertyStorage propertyStorage = ReflectionUtils.getPropertyStorage();
+ Annotation target = (Annotation) ReflectionUtils.invokeMethodOfClass(ConstraintSourceUtils.class, method,
+ propertyStorage, ConstraintSourceAwareBean.class, "property6");
+
+ assertEquals(CustomConstraintSource.class.getName(), ((Class) ExtValAnnotationUtils.extractValueOf(target,
+ Object.class)).getName());
+
+ assertNull(ReflectionUtils.invokeMethodOfClass(ConstraintSourceUtils.class, method,
+ propertyStorage, ConstraintSourceAwareBean.class, "property5"));
+ }
+
+ public static Test suite()
+ {
+
+ return new ClassLoaderTestSuite(ExtValCoreConfigurationTargetPropertyIdAnnotationTestCase.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/ExtValCoreConfigurationTestCase.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/ExtValCoreConfigurationTestCase.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/ExtValCoreConfigurationTestCase.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/ExtValCoreConfigurationTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,57 @@
+/*
+ * 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 org.apache.myfaces.extensions.validator.test.core.AbstractExValCoreTestCase;
+
+/**
+ *
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public abstract class ExtValCoreConfigurationTestCase extends
+ AbstractExValCoreTestCase
+{
+
+ public ExtValCoreConfigurationTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected boolean needXmlParameters()
+ {
+ return getName().contains("Xml");
+ }
+
+ protected boolean needCustomConfig()
+ {
+ return !getName().contains("Xml") && !getName().contains("Default");
+ }
+
+ @Override
+ /*
+ * Made the method final because we do
+ */
+ protected final void invokeStartupListeners()
+ {
+ super.invokeStartupListeners();
+ }
+
+}
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/ExtValCoreConfigurationValidateEmptyFieldsTestCase.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/ExtValCoreConfigurationValidateEmptyFieldsTestCase.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/ExtValCoreConfigurationValidateEmptyFieldsTestCase.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/ExtValCoreConfigurationValidateEmptyFieldsTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,118 @@
+/*
+ * 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.initializer.component.AbstractHtmlCoreComponentsComponentInitializer;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+
+/**
+ *
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValCoreConfigurationValidateEmptyFieldsTestCase extends ExtValCoreConfigurationTestCase
+{
+ public ExtValCoreConfigurationValidateEmptyFieldsTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static class CustomComponentInitializer extends AbstractHtmlCoreComponentsComponentInitializer
+ {
+
+ @Override
+ protected void configureRequiredAttribute(FacesContext facesContext, UIComponent uiComponent,
+ Map<String, Object> metaData)
+ {
+
+ }
+
+ @Override
+ public boolean validateEmptyFields()
+ {
+ return super.validateEmptyFields();
+ }
+
+ }
+
+ protected void addInitializationParameters()
+ {
+ super.addInitializationParameters();
+ if (needXmlParameters())
+ {
+ addInitParameter("javax.faces.VALIDATE_EMPTY_FIELDS", "false");
+ }
+ }
+
+ @Override
+ protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
+ {
+ if (needCustomConfig())
+ {
+
+ return new DefaultExtValCoreConfiguration()
+ {
+ @Override
+ public boolean validateEmptyFields()
+ {
+ return false;
+ }
+ };
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public void testValidateEmptyFieldsDefault()
+ {
+ CustomComponentInitializer initializer = new CustomComponentInitializer();
+ assertTrue(initializer.validateEmptyFields());
+ }
+
+ public void testValidateEmptyFieldsWebXml()
+ {
+ CustomComponentInitializer initializer = new CustomComponentInitializer();
+ assertFalse(initializer.validateEmptyFields());
+ }
+
+ public void testValidateEmptyFieldsCustomConfig()
+ {
+ CustomComponentInitializer initializer = new CustomComponentInitializer();
+ assertFalse(initializer.validateEmptyFields());
+ }
+
+ public static Test suite()
+ {
+
+ return new ClassLoaderTestSuite(ExtValCoreConfigurationValidateEmptyFieldsTestCase.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/ExtValCoreConfigurationViolationSeverityTestCase.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/ExtValCoreConfigurationViolationSeverityTestCase.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/ExtValCoreConfigurationViolationSeverityTestCase.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/ExtValCoreConfigurationViolationSeverityTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,89 @@
+/*
+ * 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.ViolationSeverity;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+
+/**
+ *
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValCoreConfigurationViolationSeverityTestCase extends ExtValCoreConfigurationTestCase
+{
+ public ExtValCoreConfigurationViolationSeverityTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
+ {
+ if (needCustomConfig())
+ {
+
+ return new DefaultExtValCoreConfiguration()
+ {
+
+ @Override
+ public Class violationSeverity()
+ {
+ return CustomViolationSeverity.class;
+ }
+
+ };
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static interface CustomViolationSeverity
+ {
+
+ }
+
+ public void testViolationSeverityDefault()
+ {
+ assertEquals(ViolationSeverity.class.getName(), ((Class) ExtValContext.getContext().getGlobalProperty(
+ ViolationSeverity.class.getName())).getName());
+ }
+
+ public void testViolationSeverityCustomConfig()
+ {
+ assertEquals(CustomViolationSeverity.class.getName(), ((Class) ExtValContext.getContext().getGlobalProperty(
+ ViolationSeverity.class.getName())).getName());
+ }
+
+ public static Test suite()
+ {
+
+ return new ClassLoaderTestSuite(ExtValCoreConfigurationViolationSeverityTestCase.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/support/ConstraintSourceAware2MetaDataBean.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/support/ConstraintSourceAware2MetaDataBean.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/support/ConstraintSourceAware2MetaDataBean.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/support/ConstraintSourceAware2MetaDataBean.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,24 @@
+/*
+ * 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.support;
+
+public class ConstraintSourceAware2MetaDataBean
+{
+
+}
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/support/ConstraintSourceAwareBean.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/support/ConstraintSourceAwareBean.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/support/ConstraintSourceAwareBean.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/support/ConstraintSourceAwareBean.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,69 @@
+/*
+ * 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.support;
+
+import org.apache.myfaces.extensions.validator.core.validation.ConstraintSource;
+import org.apache.myfaces.extensions.validator.core.validation.IgnoreConstraintSource;
+import org.apache.myfaces.extensions.validator.core.validation.TargetProperty;
+import org.apache.myfaces.extensions.validator.core.validation.TargetPropertyId;
+
+@ConstraintSource(ConstraintSourceAwareMetaDataBean.class)
+public class ConstraintSourceAwareBean
+{
+ @IgnoreConstraintSource
+ private String property1;
+
+ @CustomIgnoreConstraintSource
+ private String property2;
+
+ @TargetProperty(value="test1")
+ private String property3;
+
+ @CustomTargetProperty(value="test2")
+ private String property4;
+
+ @TargetPropertyId(value=ConstraintSource.class)
+ private String property5;
+
+ @CustomTargetPropertyId(value=CustomConstraintSource.class)
+ private String property6;
+
+ public String getProperty1()
+ {
+ return property1;
+ }
+
+ public void setProperty1(String property1)
+ {
+ this.property1 = property1;
+ }
+
+ @CustomConstraintSource(ConstraintSourceAware2MetaDataBean.class)
+ public String getProperty2()
+ {
+ return property2;
+ }
+
+ public void setProperty2(String property2)
+ {
+ this.property2 = property2;
+ }
+}
+
+
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/support/ConstraintSourceAwareMetaDataBean.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/support/ConstraintSourceAwareMetaDataBean.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/support/ConstraintSourceAwareMetaDataBean.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/support/ConstraintSourceAwareMetaDataBean.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,24 @@
+/*
+ * 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.support;
+
+public class ConstraintSourceAwareMetaDataBean
+{
+
+}
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/support/CustomConstraintSource.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/support/CustomConstraintSource.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/support/CustomConstraintSource.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/support/CustomConstraintSource.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,40 @@
+/*
+ * 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.support;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+@Target({TYPE, FIELD, METHOD})
+@Retention(RUNTIME)
+@Documented
+@UsageInformation(UsageCategory.API)
+public @interface CustomConstraintSource
+{
+ Class value();
+}
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/support/CustomIgnoreConstraintSource.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/support/CustomIgnoreConstraintSource.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/support/CustomIgnoreConstraintSource.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/support/CustomIgnoreConstraintSource.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,38 @@
+/*
+ * 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.support;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.apache.myfaces.extensions.validator.internal.UsageCategory;
+import org.apache.myfaces.extensions.validator.internal.UsageInformation;
+
+@Target({FIELD, METHOD})
+@Retention(RUNTIME)
+@Documented
+@UsageInformation(UsageCategory.API)
+public @interface CustomIgnoreConstraintSource
+{
+}
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/support/CustomTargetProperty.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/support/CustomTargetProperty.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/support/CustomTargetProperty.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/support/CustomTargetProperty.java Thu Jul 22 13:39:30 2010
@@ -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.extensions.validator.test.core.config.support;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Target({FIELD, METHOD})
+@Retention(RUNTIME)
+@Documented
+public @interface CustomTargetProperty
+{
+ String value();
+}
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/support/CustomTargetPropertyId.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/support/CustomTargetPropertyId.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/support/CustomTargetPropertyId.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/support/CustomTargetPropertyId.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,36 @@
+/*
+ * 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.support;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+@Target({FIELD, METHOD})
+@Retention(RUNTIME)
+@Documented
+public @interface CustomTargetPropertyId
+{
+ Class<? extends Annotation> value();
+}
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/stage/IndependentProjectStageTestCase.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/stage/IndependentProjectStageTestCase.java?rev=966651&r1=966650&r2=966651&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/stage/IndependentProjectStageTestCase.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/java/org/apache/myfaces/extensions/validator/test/core/stage/IndependentProjectStageTestCase.java Thu Jul 22 13:39:30 2010
@@ -44,12 +44,11 @@ public class IndependentProjectStageTest
return new TestSuite(IndependentProjectStageTestCase.class);
}
+
@Override
- protected void setUp() throws Exception
+ protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
{
- super.setUp();
-
- ExtValCoreConfiguration.use(new DefaultExtValCoreConfiguration()
+ return new DefaultExtValCoreConfiguration()
{
@Override
public ProjectStageResolver projectStageResolver()
@@ -76,7 +75,8 @@ public class IndependentProjectStageTest
if (!(independentProjectStageName == null || "".equals(independentProjectStageName)))
{
- ProjectStageName independentResult = ProjectStage.createStageName(independentProjectStageName.trim());
+ ProjectStageName independentResult = ProjectStage
+ .createStageName(independentProjectStageName.trim());
//check jsf stage values first
ProjectStageName result = ProjectStage.createStageName(independentProjectStageName.trim());
@@ -89,8 +89,8 @@ public class IndependentProjectStageTest
}
//check custom stage values
- if (ProjectStage.createStageName(CUSTOM_DEV).equals(independentResult) ||
- ProjectStage.createStageName(CUSTOM_TEST).equals(independentResult))
+ if (ProjectStage.createStageName(CUSTOM_DEV).equals(independentResult)
+ || ProjectStage.createStageName(CUSTOM_TEST).equals(independentResult))
{
return ProjectStage.createStage(independentResult);
}
@@ -100,7 +100,7 @@ public class IndependentProjectStageTest
}
};
}
- }, true);
+ };
}
private String resolveProjectStageName(String parameterName)
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/resources/org/apache/myfaces/extensions/validator/core/config/ExtValCoreConfigurationCustomStaticValidationStrategyMappingSourceTestCaseCustomConfig.properties
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/resources/org/apache/myfaces/extensions/validator/core/config/ExtValCoreConfigurationCustomStaticValidationStrategyMappingSourceTestCaseCustomConfig.properties?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/resources/org/apache/myfaces/extensions/validator/core/config/ExtValCoreConfigurationCustomStaticValidationStrategyMappingSourceTestCaseCustomConfig.properties (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/resources/org/apache/myfaces/extensions/validator/core/config/ExtValCoreConfigurationCustomStaticValidationStrategyMappingSourceTestCaseCustomConfig.properties Thu Jul 22 13:39:30 2010
@@ -0,0 +1 @@
+UnitTest=org.apache.myfaces.extensions.validator.test.core.config.ExtValCoreConfigurationCustomStaticValidationStrategyMappingSourceTestCase$Custom2ValidationStrategy
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/resources/org/apache/myfaces/extensions/validator/core/config/ExtValCoreConfigurationCustomStaticValidationStrategyMappingSourceTestCaseWebXml.properties
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/resources/org/apache/myfaces/extensions/validator/core/config/ExtValCoreConfigurationCustomStaticValidationStrategyMappingSourceTestCaseWebXml.properties?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/resources/org/apache/myfaces/extensions/validator/core/config/ExtValCoreConfigurationCustomStaticValidationStrategyMappingSourceTestCaseWebXml.properties (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/core-tests/src/test/resources/org/apache/myfaces/extensions/validator/core/config/ExtValCoreConfigurationCustomStaticValidationStrategyMappingSourceTestCaseWebXml.properties Thu Jul 22 13:39:30 2010
@@ -0,0 +1 @@
+UnitTest=org.apache.myfaces.extensions.validator.test.core.config.ExtValCoreConfigurationCustomStaticValidationStrategyMappingSourceTestCase$CustomValidationStrategy
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/pom.xml?rev=966651&r1=966650&r2=966651&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/pom.xml (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/pom.xml Thu Jul 22 13:39:30 2010
@@ -51,6 +51,7 @@
<module>core-tests</module>
<module>property-validation-tests</module>
<module>bean-validation-tests</module>
+ <module>trinidad-component-support-tests</module>
</modules>
<dependencies>
@@ -173,6 +174,7 @@
<exclude>**/TestUtils.java</exclude>
<exclude>**/*Bean.java</exclude>
</excludes>
+ <useSystemClassLoader>true</useSystemClassLoader>
</configuration>
</plugin>
</plugins>
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValBaseValidationConfigurationCustomTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValBaseValidationConfigurationCustomTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValBaseValidationConfigurationCustomTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValBaseValidationConfigurationCustomTestCase.java Thu Jul 22 13:39:30 2010
@@ -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.extensions.validator.test.propval.config;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.baseval.DefaultExtValBaseValidationModuleConfiguration;
+import org.apache.myfaces.extensions.validator.baseval.ExtValBaseValidationModuleConfiguration;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+
+/**
+ *
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValBaseValidationConfigurationCustomTestCase extends ExtValBaseValidationConfigurationTestCase
+{
+
+ public ExtValBaseValidationConfigurationCustomTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static class CustomExtValBaseValidationModuleConfiguration extends
+ DefaultExtValBaseValidationModuleConfiguration
+ {
+
+ @Override
+ public boolean deactivateJpaBasedValidation()
+ {
+
+ return true;
+ }
+
+ }
+
+ protected void addInitializationParameters()
+ {
+ super.addInitializationParameters();
+ if (needCustomConfig())
+ {
+ addInitParameter(ExtValBaseValidationModuleConfiguration.class.getName(),
+ CustomExtValBaseValidationModuleConfiguration.class.getName());
+
+ }
+ }
+
+ @Override
+ protected ExtValBaseValidationModuleConfiguration getCustomBaseValidationModuleConfiguration()
+ {
+ // Don't specify the custom config here. We explicitly want to test the
+ // web.xml parameter.
+ return null;
+ }
+
+ public void testExtValBaseValidationModuleConfigurationCustomDefault()
+ {
+ assertFalse(ExtValBaseValidationModuleConfiguration.get().deactivateJpaBasedValidation());
+ }
+
+ public void testExtValBaseValidationModuleConfigurationCustomCustomConfig()
+ {
+ assertTrue(ExtValBaseValidationModuleConfiguration.get().deactivateJpaBasedValidation());
+ }
+
+ public static Test suite()
+ {
+
+ return new ClassLoaderTestSuite(ExtValBaseValidationConfigurationCustomTestCase.class);
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValBaseValidationConfigurationDeactivateJpaBasedValidationTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValBaseValidationConfigurationDeactivateJpaBasedValidationTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValBaseValidationConfigurationDeactivateJpaBasedValidationTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValBaseValidationConfigurationDeactivateJpaBasedValidationTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,101 @@
+/*
+ * 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.propval.config;
+
+import java.util.List;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.ExtValInformation;
+import org.apache.myfaces.extensions.validator.baseval.DefaultExtValBaseValidationModuleConfiguration;
+import org.apache.myfaces.extensions.validator.baseval.ExtValBaseValidationModuleConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValContext;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfiguration;
+import org.apache.myfaces.extensions.validator.core.initializer.configuration.StaticConfigurationNames;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+
+/**
+ *
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValBaseValidationConfigurationDeactivateJpaBasedValidationTestCase extends
+ ExtValBaseValidationConfigurationTestCase
+{
+
+ public ExtValBaseValidationConfigurationDeactivateJpaBasedValidationTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected void addInitializationParameters()
+ {
+ super.addInitializationParameters();
+ if (needXmlParameters())
+ {
+ addInitParameter(ExtValInformation.WEBXML_PARAM_PREFIX + ".DEACTIVATE_JPA_BASED_VALIDATION", "true");
+
+ }
+ }
+
+ @Override
+ protected ExtValBaseValidationModuleConfiguration getCustomBaseValidationModuleConfiguration()
+ {
+ return new DefaultExtValBaseValidationModuleConfiguration()
+ {
+
+ @Override
+ public boolean deactivateJpaBasedValidation()
+ {
+ return true;
+ }
+
+ };
+ }
+
+ public void testExtValBaseValidationConfigurationDeactivateJpaBasedValidationDefault()
+ {
+ List<StaticConfiguration<String, String>> configs = ExtValContext.getContext().getStaticConfiguration(
+ StaticConfigurationNames.META_DATA_TO_VALIDATION_STRATEGY_CONFIG);
+ assertEquals(1, configs.size());
+ }
+
+ public void testExtValBaseValidationConfigurationDeactivateJpaBasedValidationWebXml()
+ {
+ List<StaticConfiguration<String, String>> configs = ExtValContext.getContext().getStaticConfiguration(
+ StaticConfigurationNames.META_DATA_TO_VALIDATION_STRATEGY_CONFIG);
+ assertEquals(0, configs.size());
+ }
+
+ public void testExtValBaseValidationConfigurationDeactivateJpaBasedValidationCustomConfig()
+ {
+ List<StaticConfiguration<String, String>> configs = ExtValContext.getContext().getStaticConfiguration(
+ StaticConfigurationNames.META_DATA_TO_VALIDATION_STRATEGY_CONFIG);
+ assertEquals(0, configs.size());
+ }
+
+ public static Test suite()
+ {
+
+ return new ClassLoaderTestSuite(ExtValBaseValidationConfigurationDeactivateJpaBasedValidationTestCase.class);
+ }
+
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValBaseValidationConfigurationJpaValidationErrorMessagesTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValBaseValidationConfigurationJpaValidationErrorMessagesTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValBaseValidationConfigurationJpaValidationErrorMessagesTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValBaseValidationConfigurationJpaValidationErrorMessagesTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,108 @@
+/*
+ * 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.propval.config;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.ExtValInformation;
+import org.apache.myfaces.extensions.validator.baseval.DefaultExtValBaseValidationModuleConfiguration;
+import org.apache.myfaces.extensions.validator.baseval.ExtValBaseValidationModuleConfiguration;
+import org.apache.myfaces.extensions.validator.baseval.message.resolver.JpaValidationErrorMessageResolver;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+
+/**
+ *
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValBaseValidationConfigurationJpaValidationErrorMessagesTestCase extends
+ ExtValBaseValidationConfigurationTestCase
+{
+
+ private static final String WEB_XML = "Web.XML";
+ private static final String CUSTOM_CONFIG = "Custom config";
+
+ public ExtValBaseValidationConfigurationJpaValidationErrorMessagesTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static class VisibleJpaValidationErrorMessageResolver extends JpaValidationErrorMessageResolver
+ {
+
+ @Override
+ public String getCustomBaseName()
+ {
+ return super.getCustomBaseName();
+ }
+
+ }
+
+ @Override
+ protected void addInitializationParameters()
+ {
+ super.addInitializationParameters();
+ if (needXmlParameters())
+ {
+ addInitParameter(ExtValInformation.WEBXML_PARAM_PREFIX + ".JPA_VALIDATION_ERROR_MESSAGES", WEB_XML);
+
+ }
+ }
+
+ @Override
+ protected ExtValBaseValidationModuleConfiguration getCustomBaseValidationModuleConfiguration()
+ {
+ return new DefaultExtValBaseValidationModuleConfiguration()
+ {
+
+ @Override
+ public String jpaValidationErrorMessages()
+ {
+ return CUSTOM_CONFIG;
+ }
+
+ };
+ }
+
+ public void testExtValBaseValidationConfigurationJpaValidationErrorMessagesDefault()
+ {
+ VisibleJpaValidationErrorMessageResolver messageResolver = new VisibleJpaValidationErrorMessageResolver();
+ assertNull(messageResolver.getCustomBaseName());
+ }
+
+ public void testExtValBaseValidationConfigurationJpaValidationErrorMessagesWebXml()
+ {
+ VisibleJpaValidationErrorMessageResolver messageResolver = new VisibleJpaValidationErrorMessageResolver();
+ assertEquals(WEB_XML, messageResolver.getCustomBaseName());
+ }
+
+ public void testExtValBaseValidationConfigurationJpaValidationErrorMessagesCustomConfig()
+ {
+ VisibleJpaValidationErrorMessageResolver messageResolver = new VisibleJpaValidationErrorMessageResolver();
+ assertEquals(CUSTOM_CONFIG, messageResolver.getCustomBaseName());
+ }
+
+ public static Test suite()
+ {
+
+ return new ClassLoaderTestSuite(ExtValBaseValidationConfigurationJpaValidationErrorMessagesTestCase.class);
+ }
+
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValBaseValidationConfigurationTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValBaseValidationConfigurationTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValBaseValidationConfigurationTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValBaseValidationConfigurationTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,105 @@
+/*
+ * 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.propval.config;
+
+import org.apache.myfaces.extensions.validator.PropertyValidationModuleStartupListener;
+import org.apache.myfaces.extensions.validator.baseval.DefaultExtValBaseValidationModuleConfiguration;
+import org.apache.myfaces.extensions.validator.baseval.ExtValBaseValidationModuleConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValModuleConfiguration;
+import org.apache.myfaces.extensions.validator.crossval.DefaultExtValCrossValidationModuleConfiguration;
+import org.apache.myfaces.extensions.validator.crossval.ExtValCrossValidationModuleConfiguration;
+import org.apache.myfaces.extensions.validator.test.core.AbstractExValCoreTestCase;
+
+/**
+ *
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public abstract class ExtValBaseValidationConfigurationTestCase extends AbstractExValCoreTestCase
+{
+
+ public ExtValBaseValidationConfigurationTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected boolean needXmlParameters()
+ {
+ return getName().contains("Xml");
+ }
+
+ protected boolean needCustomConfig()
+ {
+ return !getName().contains("Xml") && !getName().contains("Default");
+ }
+
+ @Override
+ /*
+ * Made the method final because we do
+ */
+ protected final void invokeStartupListeners()
+ {
+ super.invokeStartupListeners();
+ new PropertyValidationModuleStartupListener()
+ {
+ private static final long serialVersionUID = -3861810605160281884L;
+
+ @Override
+ protected void initModuleConfig()
+ {
+ ExtValBaseValidationModuleConfiguration
+ .use(new DefaultExtValBaseValidationModuleConfiguration(), false);
+ ExtValCrossValidationModuleConfiguration.use(new DefaultExtValCrossValidationModuleConfiguration(),
+ false);
+ }
+
+ @Override
+ protected void init()
+ {
+ initModuleConfig();
+ super.init();
+ }
+ }.init();
+ }
+
+ @Override
+ protected final ExtValModuleConfiguration[] getCustomConfigObjects()
+ {
+ if (needCustomConfig())
+ {
+ ExtValModuleConfiguration[] result = new ExtValModuleConfiguration[]
+ { getCustomBaseValidationModuleConfiguration() };
+ if (result.length == 1 && result[0] == null)
+ {
+ // test don't want to specify a custom configuration.
+ return null;
+ } else
+ {
+ return result;
+ }
+ } else
+ {
+ return null;
+ }
+ }
+
+ abstract protected ExtValBaseValidationModuleConfiguration getCustomBaseValidationModuleConfiguration();
+
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValCrossValidationConfigurationCustomTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValCrossValidationConfigurationCustomTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValCrossValidationConfigurationCustomTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValCrossValidationConfigurationCustomTestCase.java Thu Jul 22 13:39:30 2010
@@ -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.extensions.validator.test.propval.config;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.crossval.DefaultExtValCrossValidationModuleConfiguration;
+import org.apache.myfaces.extensions.validator.crossval.ExtValCrossValidationModuleConfiguration;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+
+/**
+ *
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValCrossValidationConfigurationCustomTestCase extends ExtValCrossValidationConfigurationTestCase
+{
+
+ public ExtValCrossValidationConfigurationCustomTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static class CustomExtValCrossValidationModuleConfiguration extends
+ DefaultExtValCrossValidationModuleConfiguration
+ {
+
+ @Override
+ public boolean deactivateCrossvalidation()
+ {
+ return true;
+ }
+
+
+ }
+
+ protected void addInitializationParameters()
+ {
+ super.addInitializationParameters();
+ if (needCustomConfig())
+ {
+ addInitParameter(ExtValCrossValidationModuleConfiguration.class.getName(),
+ CustomExtValCrossValidationModuleConfiguration.class.getName());
+
+ }
+ }
+
+ @Override
+ protected ExtValCrossValidationModuleConfiguration getCustomCrossValidationModuleConfiguration()
+ {
+ // Don't specify the custom config here. We explicitly want to test the
+ // web.xml parameter.
+ return null;
+ }
+
+ public void testExtValCrossValidationModuleConfigurationCustomDefault()
+ {
+ assertFalse(ExtValCrossValidationModuleConfiguration.get().deactivateCrossvalidation());
+ }
+
+ public void testExtValCrossValidationModuleConfigurationCustomCustomConfig()
+ {
+ assertTrue(ExtValCrossValidationModuleConfiguration.get().deactivateCrossvalidation());
+ }
+
+ public static Test suite()
+ {
+
+ return new ClassLoaderTestSuite(ExtValCrossValidationConfigurationCustomTestCase.class);
+ }
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValCrossValidationConfigurationDeactivateCrossvalidationTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValCrossValidationConfigurationDeactivateCrossvalidationTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValCrossValidationConfigurationDeactivateCrossvalidationTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValCrossValidationConfigurationDeactivateCrossvalidationTestCase.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.propval.config;
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.faces.FactoryFinder;
+import javax.faces.event.PhaseEvent;
+import javax.faces.event.PhaseId;
+import javax.faces.event.PhaseListener;
+import javax.faces.lifecycle.Lifecycle;
+import javax.faces.lifecycle.LifecycleFactory;
+import javax.faces.webapp.FacesServlet;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.ExtValInformation;
+import org.apache.myfaces.extensions.validator.crossval.DefaultExtValCrossValidationModuleConfiguration;
+import org.apache.myfaces.extensions.validator.crossval.ExtValCrossValidationModuleConfiguration;
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+
+/**
+ *
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValCrossValidationConfigurationDeactivateCrossvalidationTestCase extends
+ ExtValCrossValidationConfigurationTestCase
+{
+
+ public ExtValCrossValidationConfigurationDeactivateCrossvalidationTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected void addInitializationParameters()
+ {
+ super.addInitializationParameters();
+ if (needXmlParameters())
+ {
+ addInitParameter(ExtValInformation.WEBXML_PARAM_PREFIX + ".DEACTIVATE_CROSSVALIDATION", "true");
+
+ }
+ }
+
+ @Override
+ protected ExtValCrossValidationModuleConfiguration getCustomCrossValidationModuleConfiguration()
+ {
+ return new DefaultExtValCrossValidationModuleConfiguration()
+ {
+
+ @Override
+ public boolean deactivateCrossvalidation()
+ {
+ return true;
+ }
+
+ };
+ }
+
+ public void testExtValBaseValidationConfigurationDeactivateCrossvalidationDefault()
+ {
+ executeBeforePhaseOfCrossValidationPhaseListener();
+ // PhaseIdPhaseListener from core and CrossValidationPhaseListener
+ assertEquals(2, getPhaseListeners().size());
+ }
+
+ public void testExtValBaseValidationConfigurationDeactivateCrossvalidationWebXml()
+ {
+ executeBeforePhaseOfCrossValidationPhaseListener();
+
+ // PhaseIdPhaseListener from core
+ assertEquals(1, getPhaseListeners().size());
+ }
+
+ public void testExtValBaseValidationConfigurationDeactivateCrossvalidationCustomConfig()
+ {
+ executeBeforePhaseOfCrossValidationPhaseListener();
+
+ // PhaseIdPhaseListener from core
+ assertEquals(1, getPhaseListeners().size());
+
+ }
+
+ private void executeBeforePhaseOfCrossValidationPhaseListener()
+ {
+ for (PhaseListener listener : getPhaseListeners())
+ {
+ listener.beforePhase(new PhaseEvent(facesContext, PhaseId.RESTORE_VIEW, getLifeCycle()));
+ }
+ }
+
+ private Lifecycle getLifeCycle()
+ {
+ LifecycleFactory factory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
+ String id = facesContext.getExternalContext().getInitParameter(FacesServlet.LIFECYCLE_ID_ATTR);
+ if (id == null)
+ {
+ id = LifecycleFactory.DEFAULT_LIFECYCLE;
+ }
+ return factory.getLifecycle(id);
+ }
+
+ private List<PhaseListener> getPhaseListeners()
+ {
+ LifecycleFactory lifecycleFactory = (LifecycleFactory) FactoryFinder
+ .getFactory(FactoryFinder.LIFECYCLE_FACTORY);
+
+ String currentId;
+ Lifecycle currentLifecycle;
+ Iterator lifecycleIds = lifecycleFactory.getLifecycleIds();
+ assert lifecycleIds.hasNext();
+ currentId = (String) lifecycleIds.next();
+ currentLifecycle = lifecycleFactory.getLifecycle(currentId);
+ return Arrays.asList(currentLifecycle.getPhaseListeners());
+
+ }
+
+ public static Test suite()
+ {
+
+ return new ClassLoaderTestSuite(ExtValCrossValidationConfigurationDeactivateCrossvalidationTestCase.class);
+ }
+
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValCrossValidationConfigurationTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValCrossValidationConfigurationTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValCrossValidationConfigurationTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/config/ExtValCrossValidationConfigurationTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,105 @@
+/*
+ * 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.propval.config;
+
+import org.apache.myfaces.extensions.validator.PropertyValidationModuleStartupListener;
+import org.apache.myfaces.extensions.validator.baseval.DefaultExtValBaseValidationModuleConfiguration;
+import org.apache.myfaces.extensions.validator.baseval.ExtValBaseValidationModuleConfiguration;
+import org.apache.myfaces.extensions.validator.core.ExtValModuleConfiguration;
+import org.apache.myfaces.extensions.validator.crossval.DefaultExtValCrossValidationModuleConfiguration;
+import org.apache.myfaces.extensions.validator.crossval.ExtValCrossValidationModuleConfiguration;
+import org.apache.myfaces.extensions.validator.test.core.AbstractExValCoreTestCase;
+
+/**
+ *
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public abstract class ExtValCrossValidationConfigurationTestCase extends AbstractExValCoreTestCase
+{
+
+ public ExtValCrossValidationConfigurationTestCase(String name)
+ {
+ super(name);
+ }
+
+ protected boolean needXmlParameters()
+ {
+ return getName().contains("Xml");
+ }
+
+ protected boolean needCustomConfig()
+ {
+ return !getName().contains("Xml") && !getName().contains("Default");
+ }
+
+ @Override
+ /*
+ * Made the method final because we do
+ */
+ protected final void invokeStartupListeners()
+ {
+ super.invokeStartupListeners();
+ new PropertyValidationModuleStartupListener()
+ {
+ private static final long serialVersionUID = -3861810605160281884L;
+
+ @Override
+ protected void initModuleConfig()
+ {
+ ExtValBaseValidationModuleConfiguration
+ .use(new DefaultExtValBaseValidationModuleConfiguration(), false);
+ ExtValCrossValidationModuleConfiguration.use(new DefaultExtValCrossValidationModuleConfiguration(),
+ false);
+ }
+
+ @Override
+ protected void init()
+ {
+ initModuleConfig();
+ super.init();
+ }
+ }.init();
+ }
+
+ @Override
+ protected final ExtValModuleConfiguration[] getCustomConfigObjects()
+ {
+ if (needCustomConfig())
+ {
+ ExtValModuleConfiguration[] result = new ExtValModuleConfiguration[]
+ { getCustomCrossValidationModuleConfiguration() };
+ if (result.length == 1 && result[0] == null)
+ {
+ // test don't want to specify a custom configuration.
+ return null;
+ } else
+ {
+ return result;
+ }
+ } else
+ {
+ return null;
+ }
+ }
+
+ abstract protected ExtValCrossValidationModuleConfiguration getCustomCrossValidationModuleConfiguration();
+
+}
Modified: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/ConstraintSourceAwareValidation6TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/ConstraintSourceAwareValidation6TestCase.java?rev=966651&r1=966650&r2=966651&view=diff
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/ConstraintSourceAwareValidation6TestCase.java (original)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/property-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/propval/constraintsource/ConstraintSourceAwareValidation6TestCase.java Thu Jul 22 13:39:30 2010
@@ -31,11 +31,11 @@ public class ConstraintSourceAwareValida
return new ConstraintSourceAware6Bean();
}
+
@Override
- protected void setUp() throws Exception
+ protected ExtValCoreConfiguration getCustomExtValCoreConfiguration()
{
- super.setUp();
- ExtValCoreConfiguration.use(new DefaultExtValCoreConfiguration() {
+ return new DefaultExtValCoreConfiguration() {
@Override
public Class<? extends Annotation> constraintSourceAnnotation()
{
@@ -59,7 +59,7 @@ public class ConstraintSourceAwareValida
{
return CustomTargetPropertyId.class;
}
- }, true);
+ };
}
public void testCustomAnnotations1()
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/trinidad-component-support-tests/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/trinidad-component-support-tests/pom.xml?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/trinidad-component-support-tests/pom.xml (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/trinidad-component-support-tests/pom.xml Thu Jul 22 13:39:30 2010
@@ -0,0 +1,82 @@
+<?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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>jar</packaging>
+
+ <groupId>org.apache.myfaces.extensions.validator.test-modules</groupId>
+ <artifactId>myfaces-extval-trinidad-support-tests</artifactId>
+
+ <name>MyFaces Extensions-Validator Trinidad Component-Support-Tests</name>
+ <version>1.1.4-SNAPSHOT</version>
+
+ <parent>
+ <groupId>org.apache.myfaces.extensions.validator.test-modules</groupId>
+ <artifactId>test-modules-project</artifactId>
+ <version>1.1.4-SNAPSHOT</version>
+ </parent>
+
+ <!-- Is there a way to synchronize this value with the component support module POM -->
+ <properties>
+ <trinidad.version>1.0.9</trinidad.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator.test-modules</groupId>
+ <artifactId>myfaces-extval-base-test-infrastructure</artifactId>
+ <version>1.1.4-SNAPSHOT</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator.test-modules</groupId>
+ <artifactId>myfaces-extval-core-tests</artifactId>
+ <version>1.1.4-SNAPSHOT</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.extensions.validator.component-support-modules</groupId>
+ <artifactId>myfaces-extval-trinidad-support</artifactId>
+ <version>1.1.4-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.trinidad</groupId>
+ <artifactId>trinidad-api</artifactId>
+ <version>${trinidad.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.myfaces.trinidad</groupId>
+ <artifactId>trinidad-impl</artifactId>
+ <version>${trinidad.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+</project>
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/trinidad-component-support-tests/src/test/java/org/apache/myfaces/extensions/validator/test/trinidad/AbstractTrinidadSupportTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/trinidad-component-support-tests/src/test/java/org/apache/myfaces/extensions/validator/test/trinidad/AbstractTrinidadSupportTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/trinidad-component-support-tests/src/test/java/org/apache/myfaces/extensions/validator/test/trinidad/AbstractTrinidadSupportTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/trinidad-component-support-tests/src/test/java/org/apache/myfaces/extensions/validator/test/trinidad/AbstractTrinidadSupportTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,53 @@
+/*
+ * 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.trinidad;
+
+import org.apache.myfaces.extensions.validator.test.base.AbstractExValTestCase;
+import org.apache.myfaces.extensions.validator.trinidad.startup.TrinidadModuleStartupListener;
+
+/**
+ *
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public abstract class AbstractTrinidadSupportTestCase extends AbstractExValTestCase
+{
+
+ public AbstractTrinidadSupportTestCase(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ protected void invokeStartupListeners()
+ {
+ new TrinidadModuleStartupListener(){
+ private static final long serialVersionUID = 423076920926752646L;
+
+ @Override
+ protected void init()
+ {
+ super.init();
+ }
+ }.init();
+
+ }
+
+}
Added: myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/trinidad-component-support-tests/src/test/java/org/apache/myfaces/extensions/validator/test/trinidad/config/ExtValTrinidadSupportModuleConfigurationCustomTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/trinidad-component-support-tests/src/test/java/org/apache/myfaces/extensions/validator/test/trinidad/config/ExtValTrinidadSupportModuleConfigurationCustomTestCase.java?rev=966651&view=auto
==============================================================================
--- myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/trinidad-component-support-tests/src/test/java/org/apache/myfaces/extensions/validator/test/trinidad/config/ExtValTrinidadSupportModuleConfigurationCustomTestCase.java (added)
+++ myfaces/extensions/validator/branches/branch_for_jsf_1_1/test-modules/trinidad-component-support-tests/src/test/java/org/apache/myfaces/extensions/validator/test/trinidad/config/ExtValTrinidadSupportModuleConfigurationCustomTestCase.java Thu Jul 22 13:39:30 2010
@@ -0,0 +1,89 @@
+/*
+ * 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.trinidad.config;
+
+import junit.framework.Test;
+
+import org.apache.myfaces.extensions.validator.test.base.util.ClassLoaderTestSuite;
+import org.apache.myfaces.extensions.validator.trinidad.DefaultExtValTrinidadSupportModuleConfiguration;
+import org.apache.myfaces.extensions.validator.trinidad.ExtValTrinidadSupportModuleConfiguration;
+
+/**
+ *
+ * @author Rudy De Busscher
+ * since v4
+ *
+ */
+public class ExtValTrinidadSupportModuleConfigurationCustomTestCase extends
+ ExtValTrinidadSupportModuleConfigurationTestCase
+{
+
+ public ExtValTrinidadSupportModuleConfigurationCustomTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static class CustomExtValTrinidadSupportModuleConfiguration extends
+ DefaultExtValTrinidadSupportModuleConfiguration
+ {
+
+ @Override
+ public boolean deactivateClientSideValidation()
+ {
+ return true;
+ }
+
+ }
+
+ protected void addInitializationParameters()
+ {
+ super.addInitializationParameters();
+ if (needCustomConfig())
+ {
+ addInitParameter(ExtValTrinidadSupportModuleConfiguration.class.getName(),
+ CustomExtValTrinidadSupportModuleConfiguration.class.getName());
+
+ }
+ }
+
+ @Override
+ protected ExtValTrinidadSupportModuleConfiguration getCustomTrinidadSupportModuleConfiguration()
+ {
+ // Don't specify the custom config here. We explicitly want to test the
+ // web.xml parameter.
+ return null;
+ }
+
+ public void testExtValTrinidadSupportModuleConfigurationCustomDefault()
+ {
+ assertFalse(ExtValTrinidadSupportModuleConfiguration.get().deactivateClientSideValidation());
+ }
+
+ public void testExtValTrinidadSupportModuleConfigurationCustomCustomConfig()
+ {
+ assertTrue(ExtValTrinidadSupportModuleConfiguration.get().deactivateClientSideValidation());
+
+ }
+
+ public static Test suite()
+ {
+ return new ClassLoaderTestSuite(ExtValTrinidadSupportModuleConfigurationCustomTestCase.class);
+ }
+
+}