You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bval.apache.org by si...@apache.org on 2010/03/28 14:28:32 UTC
svn commit: r928387 [13/15] - in /incubator/bval/trunk: ./ agimatec-jsr303/
agimatec-validation/ bval-core/ bval-core/.externalToolBuilders/
bval-core/.settings/ bval-core/src/ bval-core/src/main/
bval-core/src/main/java/ bval-core/src/main/java/org/ b...
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Customer.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Customer.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Customer.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Customer.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,86 @@
+/*
+ * 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.bval.jsr303.example;
+
+
+import javax.validation.constraints.NotNull;
+
+import org.apache.bval.constraints.Email;
+import org.apache.bval.constraints.Password;
+
+public class Customer implements Person {
+ private String firstName;
+ private String middleName;
+ private String lastName;
+ @NotNull
+ private String customerId;
+ @Password(robustness = 5)
+ private String password;
+
+ @Email
+ private String emailAddress;
+
+ public String getEmailAddress() {
+ return emailAddress;
+ }
+
+ public void setEmailAddress(String emailAddress) {
+ this.emailAddress = emailAddress;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getMiddleName() {
+ return middleName;
+ }
+
+ public void setMiddleName(String middleName) {
+ this.middleName = middleName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getCustomerId() {
+ return customerId;
+ }
+
+ public void setCustomerId(String customerId) {
+ this.customerId = customerId;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+}
\ No newline at end of file
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Customer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Customer.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Customer.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Employee.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Employee.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Employee.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Employee.java Sun Mar 28 12:28:25 2010
@@ -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.bval.jsr303.example;
+
+/**
+ * Description: <br/>
+ * User: roman <br/>
+ * Date: 06.10.2009 <br/>
+ * Time: 13:41:43 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public class Employee implements Person {
+ private String firstName, lastName;
+
+ public Employee(String firstN, String lastN) {
+ this.firstName = firstN;
+ this.lastName = lastN;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public String getMiddleName() {
+ return null; // not supported
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Employee.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Employee.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Employee.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Engine.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Engine.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Engine.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Engine.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,32 @@
+/*
+ * 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.bval.jsr303.example;
+
+import javax.validation.constraints.Pattern;
+
+public class Engine {
+ @Pattern.List({
+ @Pattern(regexp = "^[A-Z0-9-]+$", flags = Pattern.Flag.CASE_INSENSITIVE,
+ message = "must contain alphabetical characters only"),
+ @Pattern(
+ regexp = "^....-....-....$", message = "must match ....-....-....")})
+ public String serialNumber;
+
+
+}
\ No newline at end of file
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Engine.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Engine.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Engine.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/First.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/First.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/First.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/First.java Sun Mar 28 12:28:25 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.
+ */
+package org.apache.bval.jsr303.example;
+
+/**
+ * Description: <br/>
+ * User: roman.stumm <br/>
+ * Date: 08.12.2008 <br/>
+ * Time: 10:24:50 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public interface First {
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/First.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/First.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/First.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/FrenchAddress.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/FrenchAddress.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/FrenchAddress.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/FrenchAddress.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,49 @@
+/*
+ * 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.bval.jsr303.example;
+
+import org.apache.bval.constraints.FrenchZipCode;
+
+/**
+ * Description: <br/>
+ * User: roman.stumm <br/>
+ * Date: 31.10.2008 <br/>
+ * Time: 16:47:35 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public class FrenchAddress {
+ @FrenchZipCode(size = 7)
+ String zipCode;
+
+ public FrenchAddress() {
+ }
+
+ public FrenchAddress(String zipCode) {
+ this.zipCode = zipCode;
+ }
+
+ public String getZipCode() {
+ return zipCode;
+ }
+
+ public void setZipCode(String zipCode) {
+ this.zipCode = zipCode;
+ }
+
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/FrenchAddress.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/FrenchAddress.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/FrenchAddress.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Last.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Last.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Last.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Last.java Sun Mar 28 12:28:25 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.
+ */
+package org.apache.bval.jsr303.example;
+
+/**
+ * Description: <br/>
+ * User: roman.stumm <br/>
+ * Date: 08.12.2008 <br/>
+ * Time: 10:24:56 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public interface Last {
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Last.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Last.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Last.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Library.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Library.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Library.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Library.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,70 @@
+/*
+ * 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.bval.jsr303.example;
+
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
+import java.util.*;
+
+/**
+ * Description: <br/>
+ * User: roman <br/>
+ * Date: 06.10.2009 <br/>
+ * Time: 12:35:42 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public class Library {
+ @NotNull
+ private String libraryName;
+ @Valid
+ private final Map<String,Book> taggedBooks = new HashMap();
+
+ private Person[] persons;
+
+ public String getLibraryName() {
+ return libraryName;
+ }
+
+ public void setLibraryName(String libraryName) {
+ this.libraryName = libraryName;
+ }
+
+ public Map<String, Book> getTaggedBooks() {
+ return taggedBooks;
+ }
+
+ public Person[] getPersons() {
+ return persons;
+ }
+
+ public void setPersons(Person[] persons) {
+ this.persons = persons;
+ }
+
+ @Valid
+ public List<Employee> getEmployees() {
+ if(persons == null) return Collections.emptyList();
+
+ ArrayList<Employee> emps = new ArrayList(persons.length);
+ for(Person each : persons) {
+ if(each instanceof Employee) emps.add((Employee) each);
+ }
+ return emps;
+ }
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Library.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Library.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Library.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/MaxTestEntity.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/MaxTestEntity.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/MaxTestEntity.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/MaxTestEntity.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,74 @@
+/*
+ * 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.bval.jsr303.example;
+
+import javax.validation.constraints.Max;
+import java.math.BigDecimal;
+
+/**
+ * Description: <br/>
+ * User: roman <br/>
+ * Date: 17.11.2009 <br/>
+ * Time: 15:21:45 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public class MaxTestEntity {
+ @Max(100)
+ private String text;
+ private String property;
+
+ @Max(300)
+ private long longValue;
+
+ private BigDecimal decimalValue;
+
+ public String getText() {
+ return text;
+ }
+
+ @Max(200)
+ public String getProperty() {
+ return property;
+ }
+
+ public long getLongValue() {
+ return longValue;
+ }
+
+ @Max(400)
+ public BigDecimal getDecimalValue() {
+ return decimalValue;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public void setProperty(String property) {
+ this.property = property;
+ }
+
+ public void setLongValue(long longValue) {
+ this.longValue = longValue;
+ }
+
+ public void setDecimalValue(BigDecimal decimalValue) {
+ this.decimalValue = decimalValue;
+ }
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/MaxTestEntity.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/MaxTestEntity.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/MaxTestEntity.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/NoValidatorTestEntity.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/NoValidatorTestEntity.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/NoValidatorTestEntity.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/NoValidatorTestEntity.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,34 @@
+/*
+ * 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.bval.jsr303.example;
+
+import javax.validation.constraints.Max;
+
+/**
+ * Description: <br/>
+ * User: roman <br/>
+ * Date: 18.11.2009 <br/>
+ * Time: 10:00:15 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public class NoValidatorTestEntity {
+ @Max(20)
+ private Object anything;
+
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/NoValidatorTestEntity.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/NoValidatorTestEntity.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/NoValidatorTestEntity.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Person.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Person.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Person.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Person.java Sun Mar 28 12:28:25 2010
@@ -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.bval.jsr303.example;
+
+import org.apache.bval.constraints.NotEmpty;
+
+public interface Person {
+ @NotEmpty
+ String getFirstName();
+
+ String getMiddleName();
+
+ @NotEmpty
+ String getLastName();
+}
\ No newline at end of file
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Person.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Person.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Person.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/PreferredGuest.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/PreferredGuest.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/PreferredGuest.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/PreferredGuest.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,34 @@
+/*
+ * 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.bval.jsr303.example;
+
+import javax.validation.constraints.Digits;
+
+public class PreferredGuest extends Customer {
+ @Digits(integer = 10, fraction = 0)
+ private String guestCreditCardNumber;
+
+ public String getGuestCreditCardNumber() {
+ return guestCreditCardNumber;
+ }
+
+ public void setGuestCreditCardNumber(String guestCreditCardNumber) {
+ this.guestCreditCardNumber = guestCreditCardNumber;
+ }
+}
\ No newline at end of file
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/PreferredGuest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/PreferredGuest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/PreferredGuest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/RecursiveFoo.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/RecursiveFoo.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/RecursiveFoo.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/RecursiveFoo.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,48 @@
+/*
+ * 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.bval.jsr303.example;
+
+
+import javax.validation.Valid;
+
+import org.apache.bval.constraints.NotEmpty;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * Description: <br/>
+ * User: roman.stumm <br/>
+ * Date: 05.09.2008 <br/>
+ * Time: 11:02:24 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public class RecursiveFoo {
+ @NotEmpty
+ @Valid
+ Collection<RecursiveFoo> foos = new ArrayList();
+
+ public Collection<RecursiveFoo> getFoos() {
+ return foos;
+ }
+
+ public void setFoos(Collection<RecursiveFoo> foos) {
+ this.foos = foos;
+ }
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/RecursiveFoo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/RecursiveFoo.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/RecursiveFoo.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Second.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Second.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Second.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Second.java Sun Mar 28 12:28:25 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.
+ */
+package org.apache.bval.jsr303.example;
+
+/**
+ * Description: <br/>
+ * User: roman.stumm <br/>
+ * Date: 08.12.2008 <br/>
+ * Time: 10:25:24 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public interface Second {
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Second.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Second.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/Second.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/SizeTestEntity.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/SizeTestEntity.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/SizeTestEntity.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/SizeTestEntity.java Sun Mar 28 12:28:25 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.bval.jsr303.example;
+
+import javax.validation.constraints.Size;
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * Description: <br/>
+ * User: roman <br/>
+ * Date: 18.11.2009 <br/>
+ * Time: 11:58:46 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public class SizeTestEntity {
+ @Size(max=2)
+ public Map<String,String> map;
+ @Size(max=2)
+ public Collection<String> coll;
+ @Size(max=2)
+ public String text;
+
+ @Size(max=2)
+ public Object[] oa;
+ @Size(max=2)
+ public byte[] ba;
+ @Size(max=2)
+ public int[] it;
+ @Size(max=2)
+ public Integer[] oa2;
+ @Size(max=2)
+ public boolean[] boa;
+ @Size(max=2)
+ public char[] ca;
+ @Size(max=2)
+ public double[] da;
+ @Size(max=2)
+ public float[] fa;
+ @Size(max=2)
+ public long[] la;
+ @Size(max=2)
+ public short[] sa;
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/SizeTestEntity.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/SizeTestEntity.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/SizeTestEntity.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/XmlEntitySampleBean.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/XmlEntitySampleBean.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/XmlEntitySampleBean.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/XmlEntitySampleBean.java Sun Mar 28 12:28:25 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.bval.jsr303.example;
+
+/**
+ * Description: bean used to test constraints described in XML<br/>
+ * User: roman <br/>
+ * Date: 25.11.2009 <br/>
+ * Time: 09:00:45 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public class XmlEntitySampleBean {
+ private String zipCode;
+ private String valueCode;
+
+ private String firstName;
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getZipCode() {
+ return zipCode;
+ }
+
+ public void setZipCode(String zipCode) {
+ this.zipCode = zipCode;
+ }
+
+ public String getValueCode() {
+ return valueCode;
+ }
+
+ public void setValueCode(String valueCode) {
+ this.valueCode = valueCode;
+ }
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/XmlEntitySampleBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/XmlEntitySampleBean.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/XmlEntitySampleBean.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/ZipCodeCityCarrier.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/ZipCodeCityCarrier.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/ZipCodeCityCarrier.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/ZipCodeCityCarrier.java Sun Mar 28 12:28:25 2010
@@ -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.bval.jsr303.example;
+
+/**
+ * Description: <br/>
+ * User: roman <br/>
+ * Date: 05.10.2009 <br/>
+ * Time: 12:40:35 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public interface ZipCodeCityCarrier {
+ String getZipCode();
+ String getCity();
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/ZipCodeCityCarrier.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/ZipCodeCityCarrier.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/example/ZipCodeCityCarrier.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/extensions/ExampleMethodService.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/extensions/ExampleMethodService.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/extensions/ExampleMethodService.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/extensions/ExampleMethodService.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,46 @@
+/*
+ * 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.bval.jsr303.extensions;
+
+
+import javax.validation.constraints.NotNull;
+
+import org.apache.bval.constraints.NotEmpty;
+
+/**
+ * Description: class with annotated methods to demonstrate
+ * method-level-validation<br/>
+ * User: roman <br/>
+ * Date: 01.02.2010 <br/>
+ * Time: 10:05:12 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public class ExampleMethodService {
+ public ExampleMethodService() {
+ }
+
+ public ExampleMethodService(@NotNull @NotEmpty String s1, @NotNull String s2) {
+ }
+
+ @NotNull
+ @NotEmpty
+ public String concat(@NotNull @NotEmpty String s1, @NotNull String s2) {
+ return s1 + s2;
+ }
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/extensions/ExampleMethodService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/extensions/ExampleMethodService.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/extensions/ExampleMethodService.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/extensions/MethodValidatorImplTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/extensions/MethodValidatorImplTest.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/extensions/MethodValidatorImplTest.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/extensions/MethodValidatorImplTest.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,131 @@
+/**
+ * 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.bval.jsr303.extensions;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import javax.validation.Validator;
+
+import org.apache.bval.jsr303.AgimatecValidatorFactory;
+import org.apache.bval.jsr303.ClassValidator;
+import org.apache.bval.jsr303.extensions.MethodValidator;
+import org.apache.bval.jsr303.extensions.MethodValidatorImpl;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.Set;
+
+/**
+ * MethodValidatorImpl Tester.
+ *
+ * @author <Authors name>
+ * @version 1.0
+ * @since <pre>11/11/2009</pre>
+ */
+public class MethodValidatorImplTest extends TestCase {
+ public MethodValidatorImplTest(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ return new TestSuite(MethodValidatorImplTest.class);
+ }
+
+ public void testUnwrap() {
+ Validator v = getValidator();
+ ClassValidator cv = v.unwrap(ClassValidator.class);
+ assertTrue(v == cv);
+ assertTrue(v == v.unwrap(Validator.class));
+ MethodValidatorImpl mvi = v.unwrap(MethodValidatorImpl.class);
+ assertNotNull(mvi);
+ MethodValidator mv = v.unwrap(MethodValidator.class);
+ assertNotNull(mv);
+ assertTrue(mv == mv.unwrap(MethodValidatorImpl.class));
+ assertTrue(mv == mv.unwrap(ClassValidator.class));
+ }
+
+ public void testValidateMethodParameters() throws NoSuchMethodException {
+ ExampleMethodService service = new ExampleMethodService();
+ MethodValidator mv = getValidator().unwrap(MethodValidator.class);
+ Method method =
+ service.getClass().getMethod("concat", new Class[]{String.class, String.class});
+ String[] params = new String[2];
+ params[0] = "Hello ";
+ params[1] = "world";
+ Set results = mv.validateParameters(service.getClass(), method, params);
+ assertEquals(true, results.isEmpty());
+
+ params[0] = "";
+ results = mv.validateParameters(service.getClass(), method, params);
+ assertEquals(1, results.size());
+
+ params[1] = null;
+ results = mv.validateParameters(service.getClass(), method, params);
+ assertEquals(2, results.size());
+
+ results = mv.validateParameter(service.getClass(), method, params[0], 0);
+ assertEquals(1, results.size());
+
+ results = mv.validateParameter(service.getClass(), method, "ok", 0);
+ assertEquals(0, results.size());
+ }
+
+ public void testValidateConstructorParameters() throws NoSuchMethodException {
+ ExampleMethodService service = new ExampleMethodService();
+ MethodValidator mv = getValidator().unwrap(MethodValidator.class);
+ Constructor constructor =
+ service.getClass().getConstructor(String.class, String.class);
+ String[] params = new String[2];
+ params[0] = "Hello ";
+ params[1] = "world";
+ Set results = mv.validateParameters(service.getClass(), constructor, params);
+ assertEquals(true, results.isEmpty());
+
+ params[0] = "";
+ results = mv.validateParameters(service.getClass(), constructor, params);
+ assertEquals(1, results.size());
+
+ params[1] = null;
+ results = mv.validateParameters(service.getClass(), constructor, params);
+ assertEquals(2, results.size());
+
+ results = mv.validateParameter(service.getClass(), constructor, params[0], 0);
+ assertEquals(1, results.size());
+
+ results = mv.validateParameter(service.getClass(), constructor, "ok", 0);
+ assertEquals(0, results.size());
+ }
+
+ public void testValidateReturnValue() throws NoSuchMethodException {
+ ExampleMethodService service = new ExampleMethodService();
+ MethodValidator mv = getValidator().unwrap(MethodValidator.class);
+ Method method =
+ service.getClass().getMethod("concat", new Class[]{String.class, String.class});
+ Set results;
+ results = mv.validateReturnedValue(service.getClass(), method, "test");
+ assertEquals(true, results.isEmpty());
+
+ results = mv.validateReturnedValue(service.getClass(), method, "");
+ assertEquals(1, results.size());
+ }
+
+ private Validator getValidator() {
+ return AgimatecValidatorFactory.getDefault().getValidator();
+ }
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/extensions/MethodValidatorImplTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/extensions/MethodValidatorImplTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/extensions/MethodValidatorImplTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/Billable.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/Billable.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/Billable.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/Billable.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,26 @@
+/*
+ * 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.bval.jsr303.groups;
+
+/**
+ * Validation group checking a user is billable.
+ * Example 3.1. Definition of groups
+ */
+public interface Billable {
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/Billable.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/Billable.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/Billable.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BillableCreditCard.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BillableCreditCard.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BillableCreditCard.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BillableCreditCard.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,25 @@
+/*
+ * 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.bval.jsr303.groups;
+
+/**
+ * Example 3.2. Assign groups to constraints.
+ */
+public class BillableCreditCard {
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BillableCreditCard.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BillableCreditCard.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BillableCreditCard.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BillableUser.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BillableUser.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BillableUser.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BillableUser.java Sun Mar 28 12:28:25 2010
@@ -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.bval.jsr303.groups;
+
+import javax.validation.constraints.NotNull;
+import javax.validation.groups.Default;
+
+/**
+ * User representation
+ * Example 3.2. Assign groups to constraints.
+ */
+public class BillableUser {
+ @NotNull
+ private String firstname;
+
+ @NotNull(groups = Default.class)
+ private String lastname;
+
+ @NotNull(groups = {Billable.class, BuyInOneClick.class})
+ private BillableCreditCard defaultCreditCard;
+
+ public String getFirstname() {
+ return firstname;
+ }
+
+ public void setFirstname(String firstname) {
+ this.firstname = firstname;
+ }
+
+ public String getLastname() {
+ return lastname;
+ }
+
+ public void setLastname(String lastname) {
+ this.lastname = lastname;
+ }
+
+ public BillableCreditCard getDefaultCreditCard() {
+ return defaultCreditCard;
+ }
+
+ public void setDefaultCreditCard(BillableCreditCard defaultCreditCard) {
+ this.defaultCreditCard = defaultCreditCard;
+ }
+}
\ No newline at end of file
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BillableUser.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BillableUser.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BillableUser.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BuyInOneClick.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BuyInOneClick.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BuyInOneClick.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BuyInOneClick.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,26 @@
+/*
+ * 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.bval.jsr303.groups;
+
+/**
+ * customer can buy without any harrassing checking process.
+ * Example 3.1. Definition of groups
+ */
+public interface BuyInOneClick {
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BuyInOneClick.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BuyInOneClick.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/BuyInOneClick.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CollectionValidationTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CollectionValidationTest.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CollectionValidationTest.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CollectionValidationTest.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,179 @@
+/*
+ * 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.bval.jsr303.groups;
+
+import org.apache.bval.jsr303.example.*;
+import junit.framework.TestCase;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.Validator;
+
+import org.apache.bval.jsr303.AgimatecValidatorFactory;
+import org.apache.bval.jsr303.example.Address;
+import org.apache.bval.jsr303.example.Author;
+import org.apache.bval.jsr303.example.Book;
+import org.apache.bval.jsr303.example.Country;
+import org.apache.bval.jsr303.example.Customer;
+import org.apache.bval.jsr303.example.Employee;
+import org.apache.bval.jsr303.example.Library;
+import org.apache.bval.jsr303.example.Person;
+import org.apache.bval.jsr303.util.TestUtils;
+
+import java.util.ArrayList;
+import java.util.Set;
+
+/**
+ * Description: <br/>
+ * User: roman <br/>
+ * Date: 06.10.2009 <br/>
+ * Time: 12:47:30 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public class CollectionValidationTest extends TestCase {
+ private Validator validator;
+
+ protected void setUp() {
+ validator = AgimatecValidatorFactory.getDefault().getValidator();
+ }
+
+ public void testValidateList() {
+ Author author = new Author();
+ author.setFirstName("Peter");
+ author.setLastName("Ford");
+ author.setCompany("IBM");
+ author.setAddresses(new ArrayList());
+
+ Address adr1, adr2, adr3;
+ adr1 = new Address();
+ adr1.setCountry(new Country());
+ adr1.getCountry().setName("Germany");
+ adr1.setCity("Bonn");
+ adr1.setAddressline1("Strasse 1");
+
+ adr2 = new Address();
+ adr2.setCountry(new Country());
+ adr2.getCountry().setName("Cuba");
+ adr2.setCity("Habana");
+ adr2.setAddressline1("Calle 2");
+
+ adr3 = new Address();
+ adr3.setCountry(new Country());
+ adr3.getCountry().setName("USA");
+ adr3.setCity("San Francisco");
+ adr3.setAddressline1("Street 3");
+
+ author.getAddresses().add(adr1);
+ author.getAddresses().add(adr2);
+ author.getAddresses().add(adr3);
+
+ Set<ConstraintViolation<Author>> violations;
+
+ violations = validator.validate(author);
+ assertEquals(0, violations.size());
+
+ adr2.setCity(null); // violate not null
+ adr3.setAddressline1(null); // violate not null
+
+ violations = validator.validate(author);
+ assertEquals(2, violations.size());
+ assertNotNull(TestUtils.getViolation(violations, "addresses[1].city"));
+ assertNotNull(TestUtils.getViolation(violations, "addresses[2].addressline1"));
+ }
+
+ public void testValidateMapAndRedefinedDefaultGroupOnNonRootBean() {
+ Library lib = new Library();
+ lib.setLibraryName("Leibnitz Bibliothek");
+
+ Book book1, book2, book3;
+
+ book1 = new Book();
+ book1.setTitle("History of time");
+ book1.setSubtitle("How it really works");
+ Author hawking = new Author();
+ hawking.setFirstName("Stephen");
+ hawking.setFirstName("Hawking");
+ hawking.setAddresses(new ArrayList<Address>(1));
+ Address adr = new Address();
+ adr.setAddressline1("Street 1");
+ adr.setCity("London");
+ adr.setCountry(new Country());
+ adr.getCountry().setName("England");
+ hawking.getAddresses().add(adr);
+ book1.setAuthor(hawking);
+
+ book2 = new Book();
+ Author castro = new Author();
+ castro.setFirstName("Fidel");
+ castro.setLastName("Castro Ruz");
+ book2.setAuthor(castro);
+ book2.setTitle("My life");
+
+ book3 = new Book();
+ book3.setTitle("World best jokes");
+ Author someone = new Author();
+ someone.setFirstName("John");
+ someone.setLastName("Do");
+ book3.setAuthor(someone);
+
+ lib.getTaggedBooks().put("science", book1);
+ lib.getTaggedBooks().put("politics", book2);
+ lib.getTaggedBooks().put("humor", book3);
+
+ Set<ConstraintViolation<Library>> violations;
+
+ violations = validator.validate(lib);
+ assertTrue(violations.isEmpty());
+
+ book2.setTitle(null);
+ book3.getAuthor().setFirstName(""); // violate NotEmpty validation
+ book1.getAuthor().getAddresses().get(0).setCity(null);
+ /*
+ This, by the way, tests redefined default group sequence behavior
+ on non-root-beans (Library.Book)!!
+ */
+ violations = validator.validate(lib);
+ assertEquals(
+ "redefined default group of Book not correctly validated from Library", 3,
+ violations.size());
+ assertNotNull(TestUtils.getViolation(violations, "taggedBooks[politics].title"));
+ assertNotNull(
+ TestUtils.getViolation(violations, "taggedBooks[humor].author.firstName"));
+ assertNotNull(TestUtils.getViolation(violations,
+ "taggedBooks[science].author.addresses[0].city"));
+ }
+
+ public void testValidateArray() {
+ Library lib = new Library();
+ lib.setLibraryName("Unibibliothek");
+ lib.setPersons(new Person[3]);
+ lib.getPersons()[0] = new Employee("Marcel", "Reich-Ranicki");
+ lib.getPersons()[1] = new Employee("Elke", "Heidenreich");
+ lib.getPersons()[2] =
+ new Customer(); // not validated, because only getEmployees() is @Valid
+
+ Set<ConstraintViolation<Library>> violations;
+ violations = validator.validate(lib);
+ assertTrue(violations.isEmpty());
+
+ ((Employee) lib.getPersons()[1]).setFirstName(""); // violate NotEmpty constraint
+ violations = validator.validate(lib);
+ assertEquals(1, violations.size());
+ assertNotNull(TestUtils.getViolation(violations, "employees[1].firstName"));
+ }
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CollectionValidationTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CollectionValidationTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CollectionValidationTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,32 @@
+/*
+ * 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.bval.jsr303.groups;
+
+import javax.validation.GroupSequence;
+
+/**
+ * Description: <br/>
+ * User: roman <br/>
+ * Date: 09.04.2009 <br/>
+ * Time: 09:33:10 <br/>
+ * Copyright: Agimatec GmbH
+ */
+@GroupSequence(value = CyclicGroupSequence.class)
+public interface CyclicGroupSequence {
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence1.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence1.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence1.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence1.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,32 @@
+/*
+ * 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.bval.jsr303.groups;
+
+import javax.validation.GroupSequence;
+
+/**
+ * Description: <br/>
+ * User: roman <br/>
+ * Date: 09.04.2009 <br/>
+ * Time: 09:33:46 <br/>
+ * Copyright: Agimatec GmbH
+ */
+@GroupSequence(value = CyclicGroupSequence2.class)
+public interface CyclicGroupSequence1 {
+}
\ No newline at end of file
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence1.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence1.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence1.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence2.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence2.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence2.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence2.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,33 @@
+/*
+ * 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.bval.jsr303.groups;
+
+import javax.validation.GroupSequence;
+
+/**
+ * Description: <br/>
+ * User: roman <br/>
+ * Date: 09.04.2009 <br/>
+ * Time: 09:33:52 <br/>
+ * Copyright: Agimatec GmbH
+ */
+@GroupSequence( value = CyclicGroupSequence1.class)
+public interface CyclicGroupSequence2 {
+
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence2.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence2.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/CyclicGroupSequence2.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/DefaultGroupSequenceTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/DefaultGroupSequenceTest.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/DefaultGroupSequenceTest.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/DefaultGroupSequenceTest.java Sun Mar 28 12:28:25 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.bval.jsr303.groups;
+
+import junit.framework.TestCase;
+
+import javax.validation.GroupDefinitionException;
+import javax.validation.groups.Default;
+
+import org.apache.bval.jsr303.groups.Group;
+import org.apache.bval.jsr303.groups.Groups;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Hardy Ferentschik
+ * @author Roman Stumm
+ */
+public class DefaultGroupSequenceTest extends TestCase {
+ public void testAssertDefaultGroupSequenceIsExpandableWithDefaultAtEndOfSequence() {
+ // create a dummy sequence
+ Group a = new Group(GroupA.class);
+ Group b = new Group(GroupB.class);
+ Group c = new Group(GroupC.class);
+ Group defaultGroup = new Group(Default.class);
+ List<Group> sequence = new ArrayList<Group>();
+ sequence.add(a);
+ sequence.add(b);
+ sequence.add(c);
+ sequence.add(defaultGroup);
+
+ Groups chain = new Groups();
+ chain.insertSequence(sequence);
+
+ // create test default sequence
+ List<Group> defaultSequence = new ArrayList<Group>();
+ defaultSequence.add(Group.DEFAULT);
+ defaultSequence.add(new Group(GroupA.class));
+ try {
+ chain.assertDefaultGroupSequenceIsExpandable(defaultSequence);
+ fail();
+ } catch (GroupDefinitionException e) {
+ // success
+ }
+
+ defaultSequence.clear();
+ defaultSequence.add(new Group(GroupA.class));
+ defaultSequence.add(new Group(Default.class));
+ try {
+ chain.assertDefaultGroupSequenceIsExpandable(defaultSequence);
+ fail();
+ } catch (GroupDefinitionException e) {
+ // success
+ }
+
+ defaultSequence.clear();
+ defaultSequence.add(Group.DEFAULT);
+ defaultSequence.add(new Group(GroupC.class));
+ try {
+ chain.assertDefaultGroupSequenceIsExpandable(defaultSequence);
+ fail();
+ } catch (GroupDefinitionException e) {
+ // success
+ }
+
+ defaultSequence.clear();
+ defaultSequence.add(new Group(GroupC.class));
+ defaultSequence.add(Group.DEFAULT);
+ chain.assertDefaultGroupSequenceIsExpandable(defaultSequence);
+ }
+
+
+ public void testAssertDefaulGroupSequenceIsExpandableWithDefaultAtBeginningOfSequence() {
+ // create a dummy sequence
+ Group a = new Group(GroupA.class);
+ Group b = new Group(GroupB.class);
+ Group c = new Group(GroupC.class);
+ Group defaultGroup = new Group(Default.class);
+ List<Group> sequence = new ArrayList<Group>();
+ sequence.add(defaultGroup);
+ sequence.add(a);
+ sequence.add(b);
+ sequence.add(c);
+
+ Groups chain = new Groups();
+ chain.insertSequence(sequence);
+
+ // create test default sequence
+ List<Group> defaultSequence = new ArrayList<Group>();
+ defaultSequence.add(Group.DEFAULT);
+ defaultSequence.add(new Group(GroupA.class));
+ chain.assertDefaultGroupSequenceIsExpandable(defaultSequence);
+
+
+ defaultSequence.clear();
+ defaultSequence.add(new Group(GroupA.class));
+ defaultSequence.add(Group.DEFAULT);
+ try {
+ chain.assertDefaultGroupSequenceIsExpandable(defaultSequence);
+ fail();
+ } catch (GroupDefinitionException e) {
+ // success
+ }
+
+ defaultSequence.clear();
+ defaultSequence.add(Group.DEFAULT);
+ defaultSequence.add(new Group(GroupC.class));
+ try {
+ chain.assertDefaultGroupSequenceIsExpandable(defaultSequence);
+ fail();
+ } catch (GroupDefinitionException e) {
+ // success
+ }
+
+ defaultSequence.clear();
+ defaultSequence.add(new Group(GroupC.class));
+ defaultSequence.add(Group.DEFAULT);
+ try {
+ chain.assertDefaultGroupSequenceIsExpandable(defaultSequence);
+ fail();
+ } catch (GroupDefinitionException e) {
+ // success
+ }
+ }
+}
+
+interface TestSequence {
+}
+
+interface GroupA {
+}
+
+interface GroupB {
+}
+
+interface GroupC {
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/DefaultGroupSequenceTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/DefaultGroupSequenceTest.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/DefaultGroupSequenceTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/GClass1.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/GClass1.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/GClass1.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/GClass1.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,30 @@
+/*
+ * 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.bval.jsr303.groups;
+
+/**
+ * Description: <br/>
+ * User: roman <br/>
+ * Date: 25.02.2009 <br/>
+ * Time: 16:44:41 <br/>
+ * Copyright: Agimatec GmbH
+ */
+public class GClass1 implements GInterface1 {
+
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/GClass1.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/GClass1.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/GClass1.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/GClass2.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/GClass2.java?rev=928387&view=auto
==============================================================================
--- incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/GClass2.java (added)
+++ incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/GClass2.java Sun Mar 28 12:28:25 2010
@@ -0,0 +1,32 @@
+/*
+ * 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.bval.jsr303.groups;
+
+import javax.validation.GroupSequence;
+
+/**
+ * Description: <br/>
+ * User: roman <br/>
+ * Date: 25.02.2009 <br/>
+ * Time: 16:44:48 <br/>
+ * Copyright: Agimatec GmbH
+ */
+@GroupSequence({GClass1.class, GClass2.class})
+public class GClass2 extends GClass1 {
+}
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/GClass2.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/GClass2.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/bval/trunk/bval-jsr303/src/test/java/org/apache/bval/jsr303/groups/GClass2.java
------------------------------------------------------------------------------
svn:mime-type = text/plain