You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gp...@apache.org on 2009/11/11 03:15:53 UTC
svn commit: r834742 - in
/myfaces/extensions/validator/trunk/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval:
./ model/ view/
Author: gpetracek
Date: Wed Nov 11 02:15:52 2009
New Revision: 834742
URL: http://svn.apache.org/viewvc?rev=834742&view=rev
Log:
EXTVAL-30 bv group validation test cases
Added:
myfaces/extensions/validator/trunk/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/UseGroupValidation2TestCase.java
myfaces/extensions/validator/trunk/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/GroupValidationTestCase2Bean.java
myfaces/extensions/validator/trunk/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/view/UseGroupValidationTestCase2PageBean.java
Added: myfaces/extensions/validator/trunk/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/UseGroupValidation2TestCase.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/UseGroupValidation2TestCase.java?rev=834742&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/UseGroupValidation2TestCase.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/UseGroupValidation2TestCase.java Wed Nov 11 02:15:52 2009
@@ -0,0 +1,61 @@
+/*
+ * 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.beanval;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.myfaces.extensions.validator.test.beanval.view.UseGroupValidationTestCase2PageBean;
+
+import javax.faces.application.FacesMessage;
+
+public class UseGroupValidation2TestCase extends BaseBeanValPropertyValidationTestCase<UseGroupValidationTestCase2PageBean>
+{
+ public UseGroupValidation2TestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite()
+ {
+ return new TestSuite(UseGroupValidation2TestCase.class);
+ }
+
+ protected UseGroupValidationTestCase2PageBean getBeanToTest()
+ {
+ return new UseGroupValidationTestCase2PageBean();
+ }
+
+ public void testGroup1AwareValidation()
+ {
+ createValueBindingForComponent(this.inputComponent1, "#{testBean.model.property1}");
+ createValueBindingForComponent(this.inputComponent2, "#{testBean.model.property2}");
+ setValueToValidate(this.inputComponent1, "");
+ setValueToValidate(this.inputComponent2, "");
+
+ validateComponents();
+
+ assertComponentInvalid(this.inputComponent1);
+ assertComponentValid(this.inputComponent2);
+
+ assertNavigationBlocked(true);
+
+ checkMessageCount(1);
+ checkMessageSeverities(FacesMessage.SEVERITY_ERROR);
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/trunk/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/GroupValidationTestCase2Bean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/GroupValidationTestCase2Bean.java?rev=834742&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/GroupValidationTestCase2Bean.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/model/GroupValidationTestCase2Bean.java Wed Nov 11 02:15:52 2009
@@ -0,0 +1,55 @@
+/*
+ * 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.beanval.model;
+
+import org.apache.myfaces.extensions.validator.test.beanval.validation.Group1;
+import org.apache.myfaces.extensions.validator.test.beanval.validation.Group2;
+import org.apache.myfaces.extensions.validator.beanval.annotation.BeanValidation;
+
+import javax.validation.constraints.NotNull;
+
+public class GroupValidationTestCase2Bean
+{
+ @BeanValidation(useGroups = Group1.class)
+ @NotNull(groups = Group1.class)
+ private String property1;
+
+ @NotNull(groups = Group2.class)
+ private String property2;
+
+ public String getProperty1()
+ {
+ return property1;
+ }
+
+ public void setProperty1(String property1)
+ {
+ this.property1 = property1;
+ }
+
+ public String getProperty2()
+ {
+ return property2;
+ }
+
+ public void setProperty2(String property2)
+ {
+ this.property2 = property2;
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/validator/trunk/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/view/UseGroupValidationTestCase2PageBean.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/validator/trunk/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/view/UseGroupValidationTestCase2PageBean.java?rev=834742&view=auto
==============================================================================
--- myfaces/extensions/validator/trunk/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/view/UseGroupValidationTestCase2PageBean.java (added)
+++ myfaces/extensions/validator/trunk/test-modules/bean-validation-tests/src/test/java/org/apache/myfaces/extensions/validator/test/beanval/view/UseGroupValidationTestCase2PageBean.java Wed Nov 11 02:15:52 2009
@@ -0,0 +1,31 @@
+/*
+ * 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.beanval.view;
+
+import org.apache.myfaces.extensions.validator.test.beanval.model.GroupValidationTestCase2Bean;
+
+public class UseGroupValidationTestCase2PageBean
+{
+ private GroupValidationTestCase2Bean model = new GroupValidationTestCase2Bean();
+
+ public GroupValidationTestCase2Bean getModel()
+ {
+ return model;
+ }
+}
\ No newline at end of file