You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2010/07/26 19:04:10 UTC

svn commit: r979363 - in /geronimo/server/trunk/testsuite/javaee6-testsuite: ./ beanvalidation-test/ beanvalidation-test/src/ beanvalidation-test/src/main/ beanvalidation-test/src/main/java/ beanvalidation-test/src/main/java/org/ beanvalidation-test/sr...

Author: gawor
Date: Mon Jul 26 17:04:09 2010
New Revision: 979363

URL: http://svn.apache.org/viewvc?rev=979363&view=rev
Log:
GERONIMO-5470: Testsuite for Bean Validation features. Patch from Lu Jiang

Added:
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/pom.xml   (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Action/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Action/submitInfo.java   (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Constraints/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Constraints/ValidDay.java   (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Constraints/ValidDayValidator.java   (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/Address.java   (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/Information.java   (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/OrdinaryPeople.java   (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/VIP.java   (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/WEB-INF/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/WEB-INF/geronimo-web.xml   (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/WEB-INF/web.xml   (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/header.html   (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/index.html   (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/register.jsp   (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/successful.jsp   (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/java/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/java/org/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/java/org/apache/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/java/org/apache/geronimo/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/java/org/apache/geronimo/sample/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/java/org/apache/geronimo/sample/RegisterValidation/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/java/org/apache/geronimo/sample/RegisterValidation/test/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/java/org/apache/geronimo/sample/RegisterValidation/test/BeanValidationTest.java   (with props)
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/resources/
    geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/resources/testng.xml   (with props)
Modified:
    geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/pom.xml?rev=979363&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/pom.xml (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/pom.xml Mon Jul 26 17:04:09 2010
@@ -0,0 +1,112 @@
+<?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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<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>
+
+    <parent>
+        <groupId>org.apache.geronimo.testsuite</groupId>
+        <artifactId>javaee6-testsuite</artifactId>
+        <version>3.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>beanvalidation-test</artifactId>
+    <name>Geronimo TestSuite :: Javaee6 Testsuite :: beanvalidation-test</name>
+    <packaging>war</packaging>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-servlet_3.0_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-validation_1.0_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>
+			
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-jsp_2.2_spec</artifactId>
+            <scope>provided</scope>
+        </dependency>       
+
+    </dependencies>
+     
+    <profiles>
+        <profile>
+            <id>it</id>
+            <activation>
+                <property>
+                    <name>it</name>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>selenium-maven-plugin</artifactId>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.geronimo.buildsupport</groupId>
+                        <artifactId>geronimo-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>deploy-wars</id>
+                                <phase>pre-integration-test</phase>
+                                <goals>
+                                    <goal>deploy-module</goal>
+                                </goals>
+                                <configuration>
+                                    <moduleArchive>${project.build.directory}/${project.artifactId}-${project.version}.war</moduleArchive>
+                                </configuration>
+                            </execution>
+                            <execution>
+                                <id>undeploy-war-as-moduleId</id>
+                                <phase>post-integration-test</phase>
+                                <goals>
+                                    <goal>undeploy-module</goal>
+                                </goals>
+                                <configuration>
+                                    <moduleId>${project.groupId}/${project.artifactId}/${project.version}/war</moduleId>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-failsafe-plugin</artifactId>
+                        <configuration>                                
+                            <suiteXmlFiles>
+                                <suiteXmlFile>${project.build.testOutputDirectory}/testng.xml</suiteXmlFile>
+                            </suiteXmlFiles>
+                        </configuration>                            
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Action/submitInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Action/submitInfo.java?rev=979363&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Action/submitInfo.java (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Action/submitInfo.java Mon Jul 26 17:04:09 2010
@@ -0,0 +1,154 @@
+/**
+ * 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.geronimo.sample.RegisterValidation.Action;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Set;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.ConstraintViolation;
+import javax.validation.Validation;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+import org.apache.geronimo.sample.RegisterValidation.Model.Address;
+import org.apache.geronimo.sample.RegisterValidation.Model.Information;
+import org.apache.geronimo.sample.RegisterValidation.Model.OrdinaryPeople;
+import org.apache.geronimo.sample.RegisterValidation.Model.VIP;
+
+@WebServlet(name = "submitInfo", urlPatterns = {"/submitInfo"})
+public class submitInfo extends HttpServlet {
+
+    /** 
+     * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
+     * @param request servlet request
+     * @param response servlet response
+     * @throws ServletException if a servlet-specific error occurs
+     * @throws IOException if an I/O error occurs
+     */
+    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        response.setContentType("text/html;charset=UTF-8");
+        Information infor = new Information();
+        String message = "";
+        String name = request.getParameter("name");
+        if(""==name)name=null; 
+        String age = request.getParameter("age");
+        if(""==age)age=null;
+        String mail = request.getParameter("mail");
+        if(""==mail)mail=null;
+        String country = request.getParameter("country");
+        if(""==country)country=null;
+        String state = request.getParameter("state");
+        if(""==state)state=null;
+        String city = request.getParameter("city");
+        if(""==city)city=null;
+        String salary = request.getParameter("salary");
+        if(""==salary)salary=null;
+        String birthday=request.getParameter("birthday");
+        if(""==birthday)birthday=null;
+        infor.setName(name);  
+        if(null!=age)
+        infor.setAge(Integer.parseInt(age));
+        infor.setMail(mail);       
+        infor.setAddress(new Address(country, state, city));
+        if(null!=salary)
+        infor.setSalary(Integer.parseInt(salary));
+        infor.setBirthday(birthday);
+        ValidatorFactory vf = Validation.buildDefaultValidatorFactory();
+        Validator validator = (Validator) vf.getValidator();
+        Set<ConstraintViolation<Information>> generalSet = validator.validate(infor);
+        int generalSize = generalSet.size();
+        int violationSize = generalSize;
+        if (generalSize > 0) {
+            for (ConstraintViolation<Information> constraintViolation : generalSet) {
+                message += "<b>Invalid value:</b><font color=red>" + constraintViolation.getInvalidValue() + "</font>," + constraintViolation.getMessage() + "<br>";
+            }
+        }
+
+        if (null != request.getParameter("submit")) {
+            Set<ConstraintViolation<Information>> salarySet = validator.validate(infor, OrdinaryPeople.class);
+            int salarySize = salarySet.size();
+            violationSize += salarySize;
+            if (salarySize > 0) {
+                for (ConstraintViolation<Information> constraintViolation : salarySet) {
+                    message += "<b>Invalid value:</b><font color=red>" + constraintViolation.getInvalidValue() + "</font>," + constraintViolation.getMessage() + "<br>";
+                }
+            }
+        }
+        if (null != request.getParameter("submitAsVIP")) {
+            Set<ConstraintViolation<Information>> VIPSalarySet = validator.validate(infor, VIP.class);
+            int VIPSalarySize = VIPSalarySet.size();
+            violationSize += VIPSalarySize;
+            if (VIPSalarySize > 0) {
+                for (ConstraintViolation<Information> constraintViolation : VIPSalarySet) {
+                    message += "<b>Invalid value:</b><font color=red>" + constraintViolation.getInvalidValue() + "</font>," + constraintViolation.getMessage() + "<br>";
+                }
+            }
+        }
+        if (violationSize <= 0) {
+            message += "Congratulations,all your information passed validation!";
+            request.setAttribute("message", message);
+            RequestDispatcher dispatcher = request.getRequestDispatcher("successful.jsp");
+            dispatcher.forward(request, response);
+        } else {
+            request.getSession().setAttribute("message", message);
+            RequestDispatcher dispatcher = request.getRequestDispatcher("register.jsp");
+            dispatcher.forward(request, response);
+        }
+    }
+
+    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
+    /** 
+     * Handles the HTTP <code>GET</code> method.
+     * @param request servlet request
+     * @param response servlet response
+     * @throws ServletException if a servlet-specific error occurs
+     * @throws IOException if an I/O error occurs
+     */
+    @Override
+    protected void doGet(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        processRequest(request, response);
+    }
+
+    /** 
+     * Handles the HTTP <code>POST</code> method.
+     * @param request servlet request
+     * @param response servlet response
+     * @throws ServletException if a servlet-specific error occurs
+     * @throws IOException if an I/O error occurs
+     */
+    @Override
+    protected void doPost(HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        processRequest(request, response);
+    }
+
+    /** 
+     * Returns a short description of the servlet.
+     * @return a String containing servlet description
+     */
+    @Override
+    public String getServletInfo() {
+        return "Short description";
+    }// </editor-fold>
+}

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Action/submitInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Action/submitInfo.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Action/submitInfo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Constraints/ValidDay.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Constraints/ValidDay.java?rev=979363&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Constraints/ValidDay.java (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Constraints/ValidDay.java Mon Jul 26 17:04:09 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.geronimo.sample.RegisterValidation.Constraints;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import javax.validation.Constraint;
+import javax.validation.Payload;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.*;
+//apply level of the constraint
+@Target( { METHOD, FIELD, ANNOTATION_TYPE })
+// runtime
+@Retention(RUNTIME)
+// validator
+@Constraint(validatedBy = ValidDayValidator.class)
+public @interface ValidDay {
+// validate message
+String message() default "Not a valid date.";
+// the group validator belongs to
+Class<?>[] groups() default {};
+// valid payload
+Class<? extends Payload>[] payload() default {};
+String key() default "ValidDay";
+String value() default "YYYY-MM-DD";
+}

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Constraints/ValidDay.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Constraints/ValidDay.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Constraints/ValidDay.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Constraints/ValidDayValidator.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Constraints/ValidDayValidator.java?rev=979363&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Constraints/ValidDayValidator.java (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Constraints/ValidDayValidator.java Mon Jul 26 17:04:09 2010
@@ -0,0 +1,68 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.sample.RegisterValidation.Constraints;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import javax.validation.ConstraintValidator;
+import javax.validation.ConstraintValidatorContext;
+
+public class ValidDayValidator implements ConstraintValidator<ValidDay, String> {
+
+    @Override
+    public void initialize(ValidDay validDay) {
+// validDay is the constrait annotation
+    }
+
+    @Override
+    public boolean isValid(String date, ConstraintValidatorContext context) {
+//date is the value to be validated
+//arg1 is the validator context,can be used to modify message.
+        if(date==null)
+            return true;
+        Pattern p = Pattern.compile("\\d{4}+[-]\\d{1,2}+[-]\\d{1,2}+");
+        Matcher m = p.matcher(date);
+        if (!m.matches()) {
+            context.buildConstraintViolationWithTemplate("Bad date format,should be like 2012-12-30");
+            return false;
+        }
+
+        String[] array = date.split("-");
+        int year = Integer.valueOf(array[0]);
+        int month = Integer.valueOf(array[1]);
+        int day = Integer.valueOf(array[2]);
+
+        if (month < 1 || month > 12) {
+            context.buildConstraintViolationWithTemplate("The month should between January to December");
+            return false;
+        }
+        int[] monthLengths = new int[]{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+        if (isLeapYear(year)) {
+            monthLengths[1] = 29;
+        } 
+        int monthLength = monthLengths[month - 1];
+        if (day < 1 || day > monthLength) {
+            context.buildConstraintViolationWithTemplate("The day of the month should between 1 and "+monthLength);
+            return false;
+        }
+        return true;
+    }
+
+    private boolean isLeapYear(int year) {
+        return ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
+    }
+}

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Constraints/ValidDayValidator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Constraints/ValidDayValidator.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Constraints/ValidDayValidator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/Address.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/Address.java?rev=979363&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/Address.java (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/Address.java Mon Jul 26 17:04:09 2010
@@ -0,0 +1,60 @@
+/**
+ * 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.geronimo.sample.RegisterValidation.Model;
+
+import javax.validation.constraints.NotNull;
+
+
+public class Address {
+    @NotNull(message="Country can not be null.")
+    String country;
+    @NotNull(message="City can not be null")
+    String city;
+    @NotNull(message="State can not be null")
+    String State;
+
+    public Address(String country, String city, String State) {
+        this.country = country;
+        this.city = city;
+        this.State = State;
+    }
+
+    public String getCity() {
+        return city;
+    }
+
+    public void setCity(String city) {
+        this.city = city;
+    }
+
+    public String getCountry() {
+        return country;
+    }
+
+    public void setCountry(String country) {
+        this.country = country;
+    }
+
+    public String getState() {
+        return State;
+    }
+
+    public void setState(String State) {
+        this.State = State;
+    }
+
+}

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/Address.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/Address.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/Address.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/Information.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/Information.java?rev=979363&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/Information.java (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/Information.java Mon Jul 26 17:04:09 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.geronimo.sample.RegisterValidation.Model;
+
+
+import javax.validation.Valid;
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
+import org.apache.geronimo.sample.RegisterValidation.Constraints.ValidDay;
+
+
+public class Information {
+    @NotNull(message="Name can not be null!")
+    @Size(min=1,max=5,message="The length of name should between {min} and {max}")
+    String name;
+
+    @Min(value=1,message="Age should be larger than {value}")
+    @Max(value=100,message="Age should be less than {value}")
+    int age;
+
+    //@Pattern(regexp="^[\\w.-]+@([0-9a-zA-Z\\w-]+\\.)+[0-9a-zA-Z]{2,8}$")
+    @Pattern(regexp="^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$" )
+    String mail;
+
+
+    @ValidDay
+    String birthday;
+
+
+    @NotNull
+    @Valid
+    Address address;
+    
+    @Min.List({@Min(value=1000,groups=OrdinaryPeople.class,message="Your salary should not be less than {value}"),
+               @Min(value=10000,groups=VIP.class,message="As a VIP,your salary should not be less than {value}")})
+    int salary;
+
+    public int getAge() {
+        return age;
+    }
+
+    public void setAge(int age) {
+        this.age = age;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getMail() {
+        return mail;
+    }
+
+    public void setMail(String mail) {
+        this.mail = mail;
+    }
+
+    public Address getAddress() {
+        return address;
+    }
+
+    public void setAddress(Address address) {
+        this.address = address;
+    }
+
+    public int getSalary() {
+        return salary;
+    }
+
+    public void setSalary(int salary) {
+        this.salary = salary;
+    }
+
+    public String getBirthday() {
+        return birthday;
+    }
+
+    public void setBirthday(String birthday) {
+        this.birthday = birthday;
+    }
+
+    
+
+}

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/Information.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/Information.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/Information.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/OrdinaryPeople.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/OrdinaryPeople.java?rev=979363&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/OrdinaryPeople.java (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/OrdinaryPeople.java Mon Jul 26 17:04:09 2010
@@ -0,0 +1,21 @@
+/**
+ * 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.geronimo.sample.RegisterValidation.Model;
+
+public interface OrdinaryPeople {
+
+}

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/OrdinaryPeople.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/OrdinaryPeople.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/OrdinaryPeople.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/VIP.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/VIP.java?rev=979363&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/VIP.java (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/VIP.java Mon Jul 26 17:04:09 2010
@@ -0,0 +1,22 @@
+/**
+ * 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.geronimo.sample.RegisterValidation.Model;
+
+public interface VIP {
+
+}

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/VIP.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/VIP.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/java/org/apache/geronimo/sample/RegisterValidation/Model/VIP.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/WEB-INF/geronimo-web.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/WEB-INF/geronimo-web.xml?rev=979363&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/WEB-INF/geronimo-web.xml (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/WEB-INF/geronimo-web.xml Mon Jul 26 17:04:09 2010
@@ -0,0 +1,39 @@
+<?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.
+-->
+<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1"
+         xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.2"
+         xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0"
+         xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">
+
+  <sys:environment>
+    <sys:moduleId>
+      <sys:groupId>${pom.groupId}</sys:groupId>
+      <sys:artifactId>${pom.artifactId}</sys:artifactId>
+      <sys:version>${version}</sys:version>
+      <sys:type>war</sys:type>
+    </sys:moduleId>
+    <sys:dependencies/>
+    <sys:hidden-classes/>
+    <sys:non-overridable-classes/>
+  </sys:environment>
+
+  <context-root>/${pom.artifactId}</context-root>
+
+</web-app>

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/WEB-INF/web.xml?rev=979363&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/WEB-INF/web.xml (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/WEB-INF/web.xml Mon Jul 26 17:04:09 2010
@@ -0,0 +1,31 @@
+<?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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="el2.2-javaee6">
+
+    <description>beanvalidation-javaee6  Sample</description>
+
+    <welcome-file-list>
+        <welcome-file>index.html</welcome-file>
+    </welcome-file-list>
+
+</web-app>

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/header.html
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/header.html?rev=979363&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/header.html (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/header.html Mon Jul 26 17:04:09 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.
+-->
+
+<html>
+<head>
+    <link type="text/css" rel="stylesheet" href="http://geronimo.apache.org/style/default.css">
+    <link rel="SHORTCUT ICON" href="http://geronimo.apache.org/images/favicon.ico">
+    <script src="http://geronimo.apache.org/functions.js" type="text/javascript"></script>
+    <title>Apache Geronimo Sample Applications</title>
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+</head>
+
+<body onload="init()">
+
+<table valign="top" background="http://geronimo.apache.org/images/header_bg_1x86.gif" border="0" cellpadding="0" cellspacing="0" width="100%">
+    <tbody>
+        <tr>
+            <td valing="top" align="left">
+                <a href="http://geronimo.apache.org/"><img src="http://geronimo.apache.org/images/topleft_logo_437x64.gif" border="0"></a>
+            </td>
+            <td width="100%">
+                &nbsp;
+            </td>
+        </tr>
+    </tbody>
+</table>
+
+<table border="0" cellpadding="2" cellspacing="0" width="100%">
+    <tbody>
+        <tr class="topBar">
+            <td class="topBarDiv" align="left" nowrap="true" valign="middle" width="100%">
+                &nbsp;<a href="http://geronimo.apache.org/" title="Apache Geronimo Home" target="_blank">Apache Geronimo Home</a> | <a href="http://cwiki.apache.org/geronimo/" title="Geronimo Documentation" target="_blank">Documentation</a>
+                | <a href="http://cwiki.apache.org/GMOxSAMPLES/" title="Sample Applications" target="_blank">Sample Applications</a>
+            </td>
+            <td class="topBarDiv" align="left" nowrap="true" valign="middle">
+                <!--<a href="xref/index.html" target="source_window">Source Code</a> | <a href="apidocs/index.html" target="source_window">Java Docs</a>&nbsp;&nbsp;-->
+            </td>
+        </tr>
+    </tbody>
+</table>
+
+</body>
+</html>
\ No newline at end of file

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/header.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/header.html
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/header.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/index.html?rev=979363&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/index.html (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/index.html Mon Jul 26 17:04:09 2010
@@ -0,0 +1,29 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd class="cell"">
+<html>
+<head>
+    <title>Apache Geronimo Sample Application</title>
+    <meta content="text/html; CHARSET=iso-8859-1" http-equiv="Content-Type"/>
+</head>
+
+<FRAMESET rows="86px,*" frameborder="0">
+    <FRAME src="header.html" name="headerFrame" title="Header" frameborder="0" marginheight="0" marginwidth="0" noresize scrolling="no">
+    <FRAME src="register.jsp" name="registerFrame" title="JAX-WS sample" frameborder="0" marginheight="0" marginwidth="0" noresize scrolling="no">
+</FRAMESET>
+
+</html>

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/index.html
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/index.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/register.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/register.jsp?rev=979363&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/register.jsp (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/register.jsp Mon Jul 26 17:04:09 2010
@@ -0,0 +1,83 @@
+<!--
+   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.
+-->
+
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+   "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+        <title>JSP Page</title>
+    </head>
+    <body>
+        <h1>Basic Information</h1>
+        <div  style="float: left; margin-right: 40px">
+        <form action="submitInfo">
+            <table border="1">
+                <tr>
+                    <td align="right">Name:</td>
+                    <td><input name="name" type="text" value="<%String name=request.getParameter("name");if(name!=null){%><%=name%><%}%>"/></td>
+                    
+                </tr>
+                <tr>
+                    <td align="right">Age:</td>
+                    <td><input name="age" type="text"  value="<%String age=request.getParameter("age");if(age!=null){%><%=age%><%}%>"/></td>
+                </tr>
+                <tr>
+                    <td align="right">Mail:</td>
+                    <td><input name="mail" type="text" value="<%String mail=request.getParameter("mail");if(mail!=null){%><%=mail%><%}%>"/></td>
+                </tr>
+                <tr>
+                    <td align="right">Birthday:</td>
+                    <td><input name="birthday" type="text" value="<%String birthday=request.getParameter("birthday");if(birthday!=null){%><%=birthday%><%}%>"/></td>
+                </tr>
+                <tr>
+                    <td align="right">Address:</td>
+                    <td>Country:<input name="country" type="text" value="<%String country=request.getParameter("country");if(country!=null){%><%=country%><%}%>"/>
+                    <br>State:&nbsp;&nbsp;&nbsp;&nbsp;<input name="state" type="text" value="<%String state=request.getParameter("state");if(state!=null){%><%=state%><%}%>"/>
+                    <br>City:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name="city" type="text" value="<%String city=request.getParameter("city");if(city!=null){%><%=city%><%}%>"/></td>
+                </tr>
+                <tr>
+                    <td align="right">Salary:</td>
+                    <td><input name="salary" type="text" value="<%String salary=request.getParameter("salary");if(salary!=null){%><%=salary%><%}%>"/></td>
+                </tr>
+                <tr>
+                    <td><input name="submit" type="submit" value="Register"/></td>
+                    <td><input name="submitAsVIP" type="submit" value="Register as VIP"/></td>
+                </tr>
+            </table>
+        </form>
+                </div>
+                <div  id="hints" style="padding: 5px;margin: 5px;border: 2px">
+                    <h2> Registration Notice!</h2><br>
+                    <ol>
+                        <li><b>Name</b> Attribute can not be null.and the length of it should between<b> 1</b> and <b>5</b>.</li>
+                        <li>Your <b>age</b> should between <b>1</b> and <b>100</b>.</li>
+                        <li>Valid <b>mail</b> format is like <b>somebody@whatever.com</b>.</li>
+                        <li>Your <b>birthday</b> format is like <b>2012-12-30</b>.</li>
+                        <li><b>Address</b> should not be null.</li>
+                        <li>To <b>registe</b>r as a member,your salary should be less than <b>1000</b>.<br>To register as a <b>VIP</b>,your salary should be less than<b> 10000</b>.</li>
+                    </ol>
+                </div>
+        <hr>
+        <div id="errormessages" style="padding: 5px;margin-top: 5px">
+        <%Object message=request.getSession().getAttribute("message");
+        if(null!=message){%><%=message.toString()%><%}%>
+        </div>
+    </body>
+</html>

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/register.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/register.jsp
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/register.jsp
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/successful.jsp
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/successful.jsp?rev=979363&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/successful.jsp (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/successful.jsp Mon Jul 26 17:04:09 2010
@@ -0,0 +1,29 @@
+<!--
+   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.
+-->
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+   "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+    <head>
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+        <title>JSP Page</title>
+    </head>
+    <body>
+        <h1>Congratulations,All your information passed validation!Register Successfully!</h1>
+    </body>
+</html>

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/successful.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/successful.jsp
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/main/webapp/successful.jsp
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/java/org/apache/geronimo/sample/RegisterValidation/test/BeanValidationTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/java/org/apache/geronimo/sample/RegisterValidation/test/BeanValidationTest.java?rev=979363&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/java/org/apache/geronimo/sample/RegisterValidation/test/BeanValidationTest.java (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/java/org/apache/geronimo/sample/RegisterValidation/test/BeanValidationTest.java Mon Jul 26 17:04:09 2010
@@ -0,0 +1,187 @@
+/**
+ *  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.geronimo.sample.RegisterValidation.test;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.apache.geronimo.testsupport.SeleniumTestSupport;
+
+public class BeanValidationTest extends SeleniumTestSupport {
+
+
+	@Test
+	public void rightInput() {
+		selenium.open("/beanvalidation-test/");
+		selenium.selectFrame("registerFrame");
+		selenium.type("name", "gero");
+		selenium.type("age", "23");
+		selenium.type("mail", "geronimo@apache.com");
+		selenium.type("birthday", "2012-12-30");
+		selenium.type("country", "Earth");
+		selenium.type("state", "Califorlia");
+		selenium.type("city", "sh");
+		selenium.type("salary", "1002");
+		selenium.click("submit");
+		selenium.waitForPageToLoad("30000");
+		Assert.assertEquals(selenium.getBodyText(),"Congratulations,All your information passed validation!Register Successfully!");
+	}
+    //test of @NotNull
+	@Test
+	public void testNullName() {
+		selenium.open("/beanvalidation-test/");
+		selenium.selectFrame("registerFrame");
+		selenium.type("name", "");
+		selenium.type("age", "23");
+		selenium.type("mail", "geronimo@apache.com");
+		selenium.type("birthday", "2012-12-30");
+		selenium.type("country", "Earth");
+		selenium.type("state", "Califorlia");
+		selenium.type("city", "sh");
+		selenium.type("salary", "1200");
+		selenium.click("submit");
+		selenium.waitForPageToLoad("30000");
+		Assert.assertEquals(selenium.getText("xpath=//*[@id=\"errormessages\"]"),"Invalid value:null,Name can not be null!");						
+		
+								
+	}
+	// test of @Size
+	@Test
+	public void testNameLength(){
+		selenium.open("/beanvalidation-test/");
+		selenium.selectFrame("registerFrame");
+		selenium.type("name", "geronimo");
+		selenium.type("age", "23");
+		selenium.type("mail", "geronimo@apache.com");
+		selenium.type("birthday", "2012-12-30");
+		selenium.type("country", "Earth");
+		selenium.type("state", "Califorlia");
+		selenium.type("city", "sh");
+		selenium.type("salary", "1002");
+		selenium.click("submit");
+		selenium.waitForPageToLoad("30000");
+		Assert.assertEquals(selenium.getText("xpath=//*[@id=\"errormessages\"]"),"Invalid value:geronimo,The length of name should between 1 and 5");
+		
+	}
+	//test of @Min and @Max
+	@Test
+	public void testAge(){
+		selenium.open("/beanvalidation-test/");
+		selenium.selectFrame("registerFrame");
+		selenium.type("name", "gero");
+		selenium.type("age", "122");
+		selenium.type("mail", "geronimo@apache.com");
+		selenium.type("birthday", "2012-12-30");
+		selenium.type("country", "Earth");
+		selenium.type("state", "Califorlia");
+		selenium.type("city", "sh");
+		selenium.type("salary", "1002");
+		selenium.click("submit");
+		selenium.waitForPageToLoad("30000");
+		Assert.assertEquals(selenium.getText("xpath=//*[@id=\"errormessages\"]"),"Invalid value:122,Age should be less than 100");			
+	}
+	//test of @Pattern
+	@Test
+	public void testMail(){
+		selenium.open("/beanvalidation-test/");
+		selenium.selectFrame("registerFrame");
+		selenium.type("name", "gero");
+		selenium.type("age", "23");
+		selenium.type("mail", "ttt!gmail.com");
+		selenium.type("birthday", "2012-12-30");
+		selenium.type("country", "Earth");
+		selenium.type("state", "Califorlia");
+		selenium.type("city", "sh");
+		selenium.type("salary", "1002");
+		selenium.click("submit");
+		selenium.waitForPageToLoad("30000");
+		Assert.assertEquals(selenium.getText("xpath=//*[@id=\"errormessages\"]"),"Invalid value:ttt!gmail.com,must match the following regular expression: ^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$");				
+	}
+	//test of the constraints defined by yourself
+	@Test
+	public void testBirthday(){
+		selenium.open("/beanvalidation-test/");
+		selenium.selectFrame("registerFrame");
+		selenium.type("name", "gero");
+		selenium.type("age", "23");
+		selenium.type("mail", "geronimo@apache.com");
+		selenium.type("birthday", "2012-2-31");
+		selenium.type("country", "Earth");
+		selenium.type("state", "Califorlia");
+		selenium.type("city", "sh");
+		selenium.type("salary", "1002");
+		selenium.click("submit");
+		selenium.waitForPageToLoad("30000");
+		Assert.assertEquals(selenium.getText("xpath=//*[@id=\"errormessages\"]"),"Invalid value:2012-2-31,Not a valid date.");		
+		
+	}
+	//test of @Valid
+	@Test
+	public void testAddress(){
+		selenium.open("/beanvalidation-test/");
+		selenium.selectFrame("registerFrame");
+		selenium.type("name", "gero");
+		selenium.type("age", "23");
+		selenium.type("mail", "geronimo@apache.com");
+		selenium.type("birthday", "2012-12-30");
+		selenium.type("country", "");
+		selenium.type("state", "Califorlia");
+		selenium.type("city", "sh");
+		selenium.type("salary", "1002");
+		selenium.click("submit");
+		selenium.waitForPageToLoad("30000");
+		Assert.assertEquals(selenium.getText("xpath=//*[@id=\"errormessages\"]"),"Invalid value:null,Country can not be null.");	
+		
+	}
+	//test of @Min.List and groups
+	@Test
+	public void testSalary(){
+		selenium.open("/beanvalidation-test/");
+		selenium.selectFrame("registerFrame");
+		selenium.type("name", "gero");
+		selenium.type("age", "23");
+		selenium.type("mail", "geronimo@apache.com");
+		selenium.type("birthday", "2012-12-30");
+		selenium.type("country", "Earth");
+		selenium.type("state", "Califorlia");
+		selenium.type("city", "sh");
+		selenium.type("salary", "100");
+		selenium.click("submit");
+		selenium.waitForPageToLoad("30000");
+		Assert.assertEquals(selenium.getText("xpath=//*[@id=\"errormessages\"]"),"Invalid value:100,Your salary should not be less than 1000");									
+	}
+	//test of @Min.List and groups
+	@Test
+	public void testGroup(){
+		selenium.open("/beanvalidation-test/");
+		selenium.selectFrame("registerFrame");
+		selenium.type("name", "gero");
+		selenium.type("age", "23");
+		selenium.type("mail", "geronimo@apache.com");
+		selenium.type("birthday", "2012-12-30");
+		selenium.type("country", "Earth");
+		selenium.type("state", "Califorlia");
+		selenium.type("city", "sh");
+		selenium.type("salary", "1002");
+		selenium.click("submitAsVIP");
+		selenium.waitForPageToLoad("30000");
+		Assert.assertEquals(selenium.getText("xpath=//*[@id=\"errormessages\"]"),"Invalid value:1002,As a VIP,your salary should not be less than 10000");	
+		
+	}
+}

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/java/org/apache/geronimo/sample/RegisterValidation/test/BeanValidationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/java/org/apache/geronimo/sample/RegisterValidation/test/BeanValidationTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/java/org/apache/geronimo/sample/RegisterValidation/test/BeanValidationTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/resources/testng.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/resources/testng.xml?rev=979363&view=auto
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/resources/testng.xml (added)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/resources/testng.xml Mon Jul 26 17:04:09 2010
@@ -0,0 +1,32 @@
+<?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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+
+<suite name="Suite1" verbose="1">
+    <test name="sample-testsuite-beanValidation">
+        <packages>
+            <package name="org.apache.geronimo.sample.RegisterValidation.test"/>
+        </packages>
+    </test>
+</suite>
+

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/resources/testng.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/resources/testng.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/testsuite/javaee6-testsuite/beanvalidation-test/src/test/resources/testng.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml?rev=979363&r1=979362&r2=979363&view=diff
==============================================================================
--- geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml (original)
+++ geronimo/server/trunk/testsuite/javaee6-testsuite/pom.xml Mon Jul 26 17:04:09 2010
@@ -52,7 +52,7 @@
     </description>
 
     <modules>
-        <!--<module></module>-->
+        <module>beanvalidation-test</module>
     </modules>
 
 </project>