Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HV-836 Adding a dedicated XML configured cascaded validation test
- Loading branch information
1 parent
a3084fe
commit f29d8e7
Showing
4 changed files
with
126 additions
and
2 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
engine/src/test/java/org/hibernate/validator/test/internal/xml/Part.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* Licensed 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.hibernate.validator.test.internal.xml; | ||
|
||
import javax.validation.constraints.NotNull; | ||
|
||
/** | ||
* @author Hardy Ferentschik | ||
*/ | ||
public class Part { | ||
@NotNull | ||
String partId; | ||
|
||
public String getPartId() { | ||
return partId; | ||
} | ||
|
||
public void setPartId(String partId) { | ||
this.partId = partId; | ||
} | ||
} | ||
|
||
|
53 changes: 53 additions & 0 deletions
53
engine/src/test/java/org/hibernate/validator/test/internal/xml/System.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2009, Red Hat, Inc. and/or its affiliates, and individual contributors | ||
* by the @authors tag. See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* Licensed 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.hibernate.validator.test.internal.xml; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import javax.validation.Valid; | ||
|
||
/** | ||
* @author Hardy Ferentschik | ||
*/ | ||
public class System { | ||
private String name; | ||
|
||
private List<Part> parts; | ||
|
||
public System() { | ||
parts = new ArrayList<Part>(); | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
@Valid | ||
public List<Part> getParts() { | ||
return parts; | ||
} | ||
|
||
public void addPart(Part part) { | ||
parts.add( part ); | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
.../test/resources/org/hibernate/validator/test/internal/xml/cascaded-validation-mapping.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<constraint-mappings | ||
xmlns="http://jboss.org/xml/ns/javax/validation/mapping" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation= | ||
"http://jboss.org/xml/ns/javax/validation/mapping validation-mapping-1.0.xsd"> | ||
|
||
<default-package>org.hibernate.validator.internal.xml</default-package> | ||
|
||
<bean class="org.hibernate.validator.test.internal.xml.System" ignore-annotations="true"> | ||
<getter name="parts"> | ||
<valid/> | ||
</getter> | ||
</bean> | ||
|
||
<bean class="org.hibernate.validator.test.internal.xml.Part" ignore-annotations="false"/> | ||
</constraint-mappings> |