libhibernate-validator-java-4.0.2.GA/ 0000755 0001750 0001750 00000000000 11402110405 017257 5 ustar twerner twerner libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/ 0000755 0001750 0001750 00000000000 11402110404 024444 5 ustar twerner twerner libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/license.txt 0000644 0001750 0001750 00000026136 11144263744 026662 0 ustar twerner twerner
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.
libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/readme.txt 0000644 0001750 0001750 00000002310 11070443223 026447 0 ustar twerner twerner Hibernate Validator
==================================================
Version: 3.1.0.GA, 10.09.2008
Description
-----------
Hibernate Validator aims at defining and checking a domain model level constraints.
It supports custom constraints definitions as well as full internationalization.
Annotations are used to define constraints on object level.
The validation mechanism can be executed in different layers in your application
without having to duplicate any of these rules (presentation layer,
data access layer, Database schema).
Hibernate Requires Hibernate Core 3.2 and above.
This version runs well with Hibernate Annotations 3.3.x and Hibernate EntityManager 3.3.x
Instructions
------------
Unzip to installation directory, read doc/reference
Contact
------------
Latest Documentation:
http://www.hibernate.org
Bug Reports:
Hibernate JIRA (preferred)
hibernate-devel@lists.sourceforge.net
Free Technical Support:
http://forum.hibernate.org (http://forum.hibernate.org/viewforum.php?f=9)
Notes
-----------
If you want to contribute, go to http://www.hibernate.org/
This software and its documentation are distributed under the terms of the
FSF Lesser Gnu Public License (see lgpl.txt). libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/ 0000755 0001750 0001750 00000000000 11402110375 025242 5 ustar twerner twerner libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/ 0000755 0001750 0001750 00000000000 11402110374 026220 5 ustar twerner twerner libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/resources/ 0000755 0001750 0001750 00000000000 11402110375 030233 5 ustar twerner twerner ././@LongLink 0000000 0000000 0000000 00000000163 00000000000 011565 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/resources/ValidatorMessages_da.properties libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/resources/ValidatorMessages0000644 0001750 0001750 00000000311 11173623006 033573 0 ustar twerner twerner #overriding of default keys
#specific to my project
long=is too damn long
floor.name=Floor
out.of.range=lower that {min} and greater than {max}
floor.out.of.range={floor.name} cannot be {out.of.range} ././@LongLink 0000000 0000000 0000000 00000000150 00000000000 011561 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/resources/hibernate.properties libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/resources/hibernate.propert0000644 0001750 0001750 00000030770 11173623006 033625 0 ustar twerner twerner ######################
### Query Language ###
######################
## define query language constants / function names
hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'
## select the classic query parser
#hibernate.query.factory_class org.hibernate.hql.classic.ClassicQueryTranslatorFactory
hibernate.format_sql true
#################
### Platforms ###
#################
## JNDI Datasource
#hibernate.connection.datasource jdbc/test
#hibernate.connection.username db2
#hibernate.connection.password db2
## HypersonicSQL
hibernate.dialect org.hibernate.dialect.HSQLDialect
hibernate.connection.driver_class org.hsqldb.jdbcDriver
hibernate.connection.username sa
hibernate.connection.password
hibernate.connection.url jdbc:hsqldb:hsql://localhost
hibernate.connection.url jdbc:hsqldb:test
hibernate.connection.url jdbc:hsqldb:.
## MySQL
#hibernate.dialect org.hibernate.dialect.MySQLDialect
#hibernate.dialect org.hibernate.dialect.MySQLInnoDBDialect
#hibernate.dialect org.hibernate.dialect.MySQLMyISAMDialect
#hibernate.connection.driver_class com.mysql.jdbc.Driver
#hibernate.connection.url jdbc:mysql:///test
#hibernate.connection.username emmanuel
#hibernate.connection.password
## Oracle
#hibernate.dialect org.hibernate.dialect.OracleDialect
#hibernate.dialect org.hibernate.dialect.Oracle9Dialect
#hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
#hibernate.connection.username ora
#hibernate.connection.password ora
#hibernate.connection.url jdbc:oracle:thin:@localhost:1521:test
## PostgreSQL
#hibernate.dialect org.hibernate.dialect.PostgreSQLDialect
#hibernate.connection.driver_class org.postgresql.Driver
#hibernate.connection.url jdbc:postgresql:annotations
#hibernate.connection.username postgres
#hibernate.connection.password hibernate
#hibernate.query.substitutions yes 'Y', no 'N'
## DB2
#hibernate.dialect org.hibernate.dialect.DB2Dialect
#hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
#hibernate.connection.url jdbc:db2:test
#hibernate.connection.username db2
#hibernate.connection.password db2
## TimesTen (not supported yet)
#hibernate.dialect org.hibernate.dialect.TimesTenDialect
#hibernate.connection.driver_class com.timesten.jdbc.TimesTenDriver
#hibernate.connection.url jdbc:timesten:direct:test
#hibernate.connection.username
#hibernate.connection.password
## DB2/400
#hibernate.dialect org.hibernate.dialect.DB2400Dialect
#hibernate.connection.username user
#hibernate.connection.password password
## Native driver
#hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
#hibernate.connection.url jdbc:db2://systemname
## Toolbox driver
#hibernate.connection.driver_class com.ibm.as400.access.AS400JDBCDriver
#hibernate.connection.url jdbc:as400://systemname
## Derby (Not supported!)
#hibernate.dialect org.hibernate.dialect.DerbyDialect
#hibernate.connection.driver_class org.apache.derby.jdbc.EmbeddedDriver
#hibernate.connection.username
#hibernate.connection.password
#hibernate.connection.url jdbc:derby:/test;create=true
## Sybase
#hibernate.dialect org.hibernate.dialect.SybaseDialect
#hibernate.connection.driver_class com.sybase.jdbc2.jdbc.SybDriver
#hibernate.connection.username sa
#hibernate.connection.password sasasa
#hibernate.connection.url jdbc:sybase:Tds:co3061835-a:5000/tempdb
## Mckoi SQL
#hibernate.dialect org.hibernate.dialect.MckoiDialect
#hibernate.connection.driver_class com.mckoi.JDBCDriver
#hibernate.connection.url jdbc:mckoi:///
#hibernate.connection.url jdbc:mckoi:local://C:/mckoi1.00/db.conf
#hibernate.connection.username admin
#hibernate.connection.password nimda
## SAP DB
#hibernate.dialect org.hibernate.dialect.SAPDBDialect
#hibernate.connection.driver_class com.sap.dbtech.jdbc.DriverSapDB
#hibernate.connection.url jdbc:sapdb://localhost/TST
#hibernate.connection.username TEST
#hibernate.connection.password TEST
#hibernate.query.substitutions yes 'Y', no 'N'
## MS SQL Server
#hibernate.dialect org.hibernate.dialect.SQLServerDialect
#hibernate.connection.username sa
#hibernate.connection.password sa
## JSQL Driver
#hibernate.connection.driver_class com.jnetdirect.jsql.JSQLDriver
#hibernate.connection.url jdbc:JSQLConnect://1E1/test
## JTURBO Driver
#hibernate.connection.driver_class com.newatlanta.jturbo.driver.Driver
#hibernate.connection.url jdbc:JTurbo://1E1:1433/test
## WebLogic Driver
#hibernate.connection.driver_class weblogic.jdbc.mssqlserver4.Driver
#hibernate.connection.url jdbc:weblogic:mssqlserver4:1E1:1433
## Microsoft Driver (not recommended!)
#hibernate.connection.driver_class com.microsoft.jdbc.sqlserver.SQLServerDriver
#hibernate.connection.url jdbc:microsoft:sqlserver://1E1;DatabaseName=test;SelectMethod=cursor
## jTDS (since version 0.9)
#hibernate.connection.driver_class net.sourceforge.jtds.jdbc.Driver
#hibernate.connection.url jdbc:jtds:sqlserver://1E1/test
## Interbase
#hibernate.dialect org.hibernate.dialect.InterbaseDialect
#hibernate.connection.username sysdba
#hibernate.connection.password masterkey
## DO NOT specify hibernate.connection.sqlDialect
## InterClient
#hibernate.connection.driver_class interbase.interclient.Driver
#hibernate.connection.url jdbc:interbase://localhost:3060/C:/firebird/test.gdb
## Pure Java
#hibernate.connection.driver_class org.firebirdsql.jdbc.FBDriver
#hibernate.connection.url jdbc:firebirdsql:localhost/3050:/firebird/test.gdb
## Pointbase
#hibernate.dialect org.hibernate.dialect.PointbaseDialect
#hibernate.connection.driver_class com.pointbase.jdbc.jdbcUniversalDriver
#hibernate.connection.url jdbc:pointbase:embedded:sample
#hibernate.connection.username PBPUBLIC
#hibernate.connection.password PBPUBLIC
#################################
### Hibernate Connection Pool ###
#################################
hibernate.connection.pool_size 1
###########################
### C3P0 Connection Pool###
###########################
#hibernate.c3p0.max_size 2
#hibernate.c3p0.min_size 2
#hibernate.c3p0.timeout 5000
#hibernate.c3p0.max_statements 100
#hibernate.c3p0.idle_test_period 3000
#hibernate.c3p0.acquire_increment 2
#hibernate.c3p0.validate false
##############################
### Proxool Connection Pool###
##############################
## Properties for external configuration of Proxool
hibernate.proxool.pool_alias pool1
## Only need one of the following
#hibernate.proxool.existing_pool true
#hibernate.proxool.xml proxool.xml
#hibernate.proxool.properties proxool.properties
#################################
### Plugin ConnectionProvider ###
#################################
## use a custom ConnectionProvider (if not set, Hibernate will choose a built-in ConnectionProvider using hueristics)
#hibernate.connection.provider_class org.hibernate.connection.DriverManagerConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.DatasourceConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.C3P0ConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.DBCPConnectionProvider
#hibernate.connection.provider_class org.hibernate.connection.ProxoolConnectionProvider
#######################
### Transaction API ###
#######################
## Enable automatic flush during the JTA beforeCompletion() callback
## (This setting is relevant with or without the Transaction API)
#hibernate.transaction.flush_before_completion
## Enable automatic session close at the end of transaction
## (This setting is relevant with or without the Transaction API)
#hibernate.transaction.auto_close_session
## the Transaction API abstracts application code from the underlying JTA or JDBC transactions
#hibernate.transaction.factory_class org.hibernate.transaction.JTATransactionFactory
#hibernate.transaction.factory_class org.hibernate.transaction.JDBCTransactionFactory
## to use JTATransactionFactory, Hibernate must be able to locate the UserTransaction in JNDI
## default is java:comp/UserTransaction
## you do NOT need this setting if you specify hibernate.transaction.manager_lookup_class
#jta.UserTransaction jta/usertransaction
#jta.UserTransaction javax.transaction.UserTransaction
#jta.UserTransaction UserTransaction
## to use the second-level cache with JTA, Hibernate must be able to obtain the JTA TransactionManager
#hibernate.transaction.manager_lookup_class org.hibernate.transaction.JBossTransactionManagerLookup
#hibernate.transaction.manager_lookup_class org.hibernate.transaction.WeblogicTransactionManagerLookup
#hibernate.transaction.manager_lookup_class org.hibernate.transaction.WebSphereTransactionManagerLookup
#hibernate.transaction.manager_lookup_class org.hibernate.transaction.OrionTransactionManagerLookup
#hibernate.transaction.manager_lookup_class org.hibernate.transaction.ResinTransactionManagerLookup
##############################
### Miscellaneous Settings ###
##############################
## print all generated SQL to the console
#hibernate.show_sql true
## add comments to the generated SQL
#hibernate.use_sql_comments true
## generate statistics
#hibernate.generate_statistics true
## auto schema export
#hibernate.hbm2ddl.auto create-drop
#hibernate.hbm2ddl.auto create
#hibernate.hbm2ddl.auto update
## specify a default schema and catalog for unqualified tablenames
#hibernate.default_schema test
#hibernate.default_catalog test
## enable ordering of SQL UPDATEs by primary key
hibernate.order_updates true
## set the maximum depth of the outer join fetch tree
hibernate.max_fetch_depth 1
## set the default batch size for batch fetching
hibernate.default_batch_fetch_size 100
## rollback generated identifier values of deleted entities to default values
#hibernate.use_identifer_rollback true
## enable CGLIB reflection optimizer (enabled by default)
#hibernate.cglib.use_reflection_optimizer false
#####################
### JDBC Settings ###
#####################
## specify a JDBC isolation level
#hibernate.connection.isolation 4
## enable JDBC autocommit (not recommended!)
#hibernate.connection.autocommit true
## set the JDBC fetch size
#hibernate.jdbc.fetch_size 25
## set the maximum JDBC 2 batch size (a nonzero value enables batching)
#hibernate.jdbc.batch_size 0
## enable batch updates even for versioned data
hibernate.jdbc.batch_versioned_data true
## enable use of JDBC 2 scrollable ResultSets (specifying a Dialect will cause Hibernate to use a sensible default)
#hibernate.jdbc.use_scrollable_resultset true
## use streams when writing binary types to / from JDBC
hibernate.jdbc.use_streams_for_binary true
## use JDBC 3 PreparedStatement.getGeneratedKeys() to get the identifier of an inserted row
#hibernate.jdbc.use_get_generated_keys false
## choose a custom JDBC batcher
# hibernate.jdbc.factory_class
## enable JDBC result set column alias caching
## (minor performance enhancement for broken JDBC drivers)
# hibernate.jdbc.wrap_result_sets
## choose a custom SQL exception converter
#hibernate.jdbc.sql_exception_converter
##########################
### Second-level Cache ###
##########################
## optimize chache for minimal "puts" instead of minimal "gets" (good for clustered cache)
#hibernate.cache.use_minimal_puts true
## set a prefix for cache region names
hibernate.cache.region_prefix hibernate.test
## disable the second-level cache
#hibernate.cache.use_second_level_cache false
## enable the query cache
hibernate.cache.use_query_cache true
## store the second-level cache entries in a more human-friendly format
#hibernate.cache.use_structured_entries true
## choose a cache implementation
#hibernate.cache.provider_class org.hibernate.cache.EhCacheProvider
#hibernate.cache.provider_class org.hibernate.cache.EmptyCacheProvider
hibernate.cache.provider_class org.hibernate.cache.HashtableCacheProvider
#hibernate.cache.provider_class org.hibernate.cache.TreeCacheProvider
#hibernate.cache.provider_class org.hibernate.cache.OSCacheProvider
#hibernate.cache.provider_class org.hibernate.cache.SwarmCacheProvider
## choose a custom query cache implementation
#hibernate.cache.query_cache_factory
############
### JNDI ###
############
## specify a JNDI name for the SessionFactory
#hibernate.session_factory_name hibernate/session_factory
## Hibernate uses JNDI to bind a name to a SessionFactory and to look up the JTA UserTransaction;
## if hibernate.jndi.* are not specified, Hibernate will use the default InitialContext() which
## is the best approach in an application server
#file system
#hibernate.jndi.class com.sun.jndi.fscontext.RefFSContextFactory
#hibernate.jndi.url file:/
#WebSphere
#hibernate.jndi.class com.ibm.websphere.naming.WsnInitialContextFactory
#hibernate.jndi.url iiop://localhost:900/
././@LongLink 0000000 0000000 0000000 00000000163 00000000000 011565 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/resources/ValidatorMessages_fr.properties libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/resources/ValidatorMessages0000644 0001750 0001750 00000000330 11173623006 033574 0 ustar twerner twerner #overriding of default keys
#specific to my project
long=est grave trop long
floor.name=Etage
out.of.range=plus petit que {min} ou plus grand que {max}
floor.out.of.range={floor.name} ne peut pas être {out.of.range} ././@LongLink 0000000 0000000 0000000 00000000160 00000000000 011562 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/resources/ValidatorMessages.properties libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/resources/ValidatorMessages0000644 0001750 0001750 00000000311 11173623006 033573 0 ustar twerner twerner #overriding of default keys
#specific to my project
long=is too damn long
floor.name=Floor
out.of.range=lower that {min} and greater than {max}
floor.out.of.range={floor.name} cannot be {out.of.range} libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/resources/log4j.properties 0000644 0001750 0001750 00000003020 11173623006 033370 0 ustar twerner twerner ### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### direct messages to file hibernate.log ###
#log4j.appender.file=org.apache.log4j.FileAppender
#log4j.appender.file.File=hibernate.log
#log4j.appender.file.layout=org.apache.log4j.PatternLayout
#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
### set log levels - for more verbose logging change 'info' to 'debug' ###
log4j.rootLogger=warn, stdout
log4j.logger.org.hibernate=warn
### log just the SQL
log4j.logger.org.hibernate.SQL=warn
#log4j.logger.org.hibernate.engine.CascadingAction=debug
### log JDBC bind parameters ###
#log4j.logger.org.hibernate.type=debug
### log schema export/update ###
log4j.logger.org.hibernate.tool.hbm2ddl=warn
### log cache activity ###
#log4j.logger.org.hibernate.cache=debug
### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
#log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace
### annotation logs
#log4j.logger.org.hibernate.annotation=info
#log4j.logger.org.hibernate.cfg=info
#log4j.logger.org.hibernate.cfg.SettingsFactory=info
#log4j.logger.org.hibernate.cfg.AnnotationBinder=info
#log4j.logger.org.hibernate.cfg.AnnotationConfiguration=info
#log4j.logger.org.hibernate.cfg.Ejb3Column=info ././@LongLink 0000000 0000000 0000000 00000000152 00000000000 011563 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/resources/messages_en.properties libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/resources/messages_en.prope0000644 0001750 0001750 00000001140 11173623006 033574 0 ustar twerner twerner long=is too damn long
floor.name=Floor
out.of.range=lower that {min} and greater than {max}
floor.out.of.range={floor.name} cannot (escaping #{el}) be {out.of.range}
validator.assertFalse=assertion failed
validator.assertTrue=assertion failed
validator.length=length must be between {min} and {max}
validator.max=must less than or equal to {value}
validator.min=must greater than or equal to {value}
validator.notNull=may not be null
validator.past=must be a past date
validator.pattern=must match "{regex}"
validator.range=must be between {min} and {max}
validator.size=size must be between {min} and {max} libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/ 0000755 0001750 0001750 00000000000 11402110370 027135 5 ustar twerner twerner libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/ 0000755 0001750 0001750 00000000000 11402110370 027724 5 ustar twerner twerner libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/ 0000755 0001750 0001750 00000000000 11402110370 031665 5 ustar twerner twerner ././@LongLink 0000000 0000000 0000000 00000000147 00000000000 011567 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/ libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000755 0001750 0001750 00000000000 11402110370 033411 5 ustar twerner twerner ././@LongLink 0000000 0000000 0000000 00000000154 00000000000 011565 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/ libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000755 0001750 0001750 00000000000 11402110374 033415 5 ustar twerner twerner ././@LongLink 0000000 0000000 0000000 00000000176 00000000000 011571 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/ValidatorTest.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000024175 11131662636 033444 0 ustar twerner twerner //$Id: ValidatorTest.java 15765 2009-01-09 14:56:30Z hardy.ferentschik $
package org.hibernate.validator.test;
import java.io.Serializable;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ObjectInputStream;
import java.math.BigInteger;
import java.util.Date;
import java.util.Locale;
import java.util.ResourceBundle;
import junit.framework.TestCase;
import org.hibernate.validator.ClassValidator;
import org.hibernate.validator.InvalidValue;
import org.hibernate.validator.MessageInterpolator;
import org.hibernate.validator.Validator;
/**
* @author Gavin King
*/
public class ValidatorTest extends TestCase {
public static final String ESCAPING_EL = "(escaping #{el})";
public void testValidator() {
Address a = new Address();
Address.blacklistedZipCode = null;
a.setCountry( "Australia" );
a.setZip( "1221341234123" );
a.setState( "Vic" );
a.setLine1( "Karbarook Ave" );
a.setId( 3 );
ClassValidator
classValidator = new ClassValidator(
Address.class, ResourceBundle.getBundle( "messages", Locale.ENGLISH )
);
InvalidValue[] validationMessages = classValidator.getInvalidValues( a );
assertEquals( 2, validationMessages.length ); //static field is tested also
Address.blacklistedZipCode = "323232";
a.setZip( null );
a.setState( "Victoria" );
validationMessages = classValidator.getInvalidValues( a );
assertEquals( 2, validationMessages.length );
validationMessages = classValidator.getInvalidValues( a, "zip" );
assertEquals( 1, validationMessages.length );
a.setZip( "3181" );
a.setState( "NSW" );
validationMessages = classValidator.getInvalidValues( a );
assertEquals( 0, validationMessages.length );
a.setCountry( null );
validationMessages = classValidator.getInvalidValues( a );
assertEquals( 1, validationMessages.length );
a.setInternalValid( false );
validationMessages = classValidator.getInvalidValues( a );
assertEquals( 2, validationMessages.length );
a.setInternalValid( true );
a.setCountry( "France" );
a.floor = 4000;
validationMessages = classValidator.getInvalidValues( a );
assertEquals( 2, validationMessages.length );
assertEquals(
"Floor cannot " + ESCAPING_EL
+ " be lower that -2 and greater than 50 " + ESCAPING_EL,
validationMessages[0].getMessage()
);
}
public void testCircularity() throws Exception {
Brother emmanuel = new Brother();
emmanuel.setName( "Emmanuel" );
Address.blacklistedZipCode = "666";
Address address = new Address();
address.setInternalValid( true );
address.setCountry( "France" );
address.setId( 3 );
address.setLine1( "Rue des rosiers" );
address.setState( "NYC" );
address.setZip( "33333" );
address.floor = 4;
emmanuel.setAddress( address );
Brother christophe = new Brother();
christophe.setName( "Christophe" );
christophe.setAddress( address );
emmanuel.setYoungerBrother( christophe );
christophe.setElder( emmanuel );
ClassValidator classValidator = new ClassValidator( Brother.class );
InvalidValue[] invalidValues = classValidator.getInvalidValues( emmanuel );
assertEquals( 0, invalidValues.length );
christophe.setName( null );
invalidValues = classValidator.getInvalidValues( emmanuel );
assertEquals( 1, invalidValues.length );
assertEquals( emmanuel, invalidValues[0].getRootBean() );
assertEquals( "youngerBrother.name", invalidValues[0].getPropertyPath() );
christophe.setName( "Christophe" );
address = new Address();
address.setInternalValid( true );
address.setCountry( "France" );
address.setId( 4 );
address.setLine1( "Rue des plantes" );
address.setState( "NYC" );
address.setZip( "33333" );
address.floor = -100;
christophe.setAddress( address );
invalidValues = classValidator.getInvalidValues( emmanuel );
assertEquals( 1, invalidValues.length );
}
public void testAggregationAnnotations() throws Exception {
Engine eng = new Engine();
eng.setHorsePower( 23 );
eng.setSerialNumber( "23-43###4" );
ClassValidator classValidator = new ClassValidator( Engine.class );
InvalidValue[] invalidValues = classValidator.getInvalidValues( eng );
assertEquals( 2, invalidValues.length );
eng.setSerialNumber( "1234-5678-9012");
invalidValues = classValidator.getInvalidValues( eng );
assertEquals( 0, invalidValues.length );
}
public void testDefaultResourceBundle() throws Exception {
Tv tv = new Tv();
tv.serial = "FS";
tv.name = "TooLong";
tv.expDate = new Date( new Date().getTime() + 1000 * 60 * 60 * 24 * 10 );
ClassValidator classValidator = new ClassValidator( Tv.class );
InvalidValue[] invalidValues = classValidator.getInvalidValues( tv );
assertEquals( 1, invalidValues.length );
Locale loc = Locale.getDefault();
if ( loc.toString().startsWith( "en" ) ) {
assertEquals( "length must be between 0 and 2", invalidValues[0].getMessage() );
}
else if ( loc.toString().startsWith( "fr" ) ) {
String message = invalidValues[0].getMessage();
String message2 ="la longueur doit être entre 0 et 2";
assertEquals( message2, message );
}
else if ( loc.toString().startsWith( "da" ) ) {
assertEquals( "længden skal være mellem 0 og 2", invalidValues[0].getMessage() );
}
else {
// if default not found then it must be english
assertEquals( "length must be between 0 and 2", invalidValues[0].getMessage() );
}
}
public void testSerialization() throws Exception {
Tv tv = new Tv();
tv.serial = "FS";
tv.name = "TooLong";
tv.expDate = new Date( new Date().getTime() + 1000 * 60 * 60 * 24 * 10 );
ClassValidator classValidator = new ClassValidator( Tv.class );
ByteArrayOutputStream stream = new ByteArrayOutputStream();
ObjectOutput out = new ObjectOutputStream( stream );
out.writeObject( classValidator );
out.close();
byte[] serialized = stream.toByteArray();
stream.close();
ByteArrayInputStream byteIn = new ByteArrayInputStream( serialized );
ObjectInputStream in = new ObjectInputStream( byteIn );
classValidator = (ClassValidator) in.readObject();
in.close();
byteIn.close();
InvalidValue[] invalidValues = classValidator.getInvalidValues( tv );
assertEquals( 1, invalidValues.length );
Locale loc = Locale.getDefault();
if ( loc.toString().startsWith( "en" ) ) {
assertEquals( "length must be between 0 and 2", invalidValues[0].getMessage() );
}
else if ( loc.toString().startsWith( "fr" ) ) {
String message = invalidValues[0].getMessage();
String message2 ="la longueur doit être entre 0 et 2";
assertEquals( message2, message );
}
else if ( loc.toString().startsWith( "da" ) ) {
assertEquals( "længden skal være mellem 0 og 2", invalidValues[0].getMessage() );
}
else {
// if default not found then it must be english
assertEquals( "length must be between 0 and 2", invalidValues[0].getMessage() );
}
}
public class PrefixMessageInterpolator implements MessageInterpolator, Serializable {
private String prefix;
public PrefixMessageInterpolator(String prefix) {
this.prefix = prefix;
}
public String interpolate(String message, Validator validator, MessageInterpolator defaultInterpolator) {
return prefix + defaultInterpolator.interpolate( message, validator, defaultInterpolator );
}
}
public void testMessageInterpolator() throws Exception {
Tv tv = new Tv();
tv.serial = "FS";
tv.name = "TooLong";
tv.expDate = new Date( new Date().getTime() + 1000 * 60 * 60 * 24 * 10 );
String prefix = "Prefix";
ClassValidator classValidator = new ClassValidator( Tv.class, new PrefixMessageInterpolator( prefix ) );
InvalidValue[] invalidValues = classValidator.getInvalidValues( tv );
assertEquals( 1, invalidValues.length );
Locale loc = Locale.getDefault();
if ( loc.toString().startsWith( "en" ) ) {
assertEquals( prefix + "length must be between 0 and 2", invalidValues[0].getMessage() );
}
else if ( loc.toString().startsWith( "fr" ) ) {
assertEquals( prefix + "la longueur doit être entre 0 et 2", invalidValues[0].getMessage() );
}
else if ( loc.toString().startsWith( "da" ) ) {
assertEquals( prefix + "længden skal være mellem 0 og 2", invalidValues[0].getMessage() );
}
else {
// if default not found then it must be english
assertEquals( prefix + "length must be between 0 and 2", invalidValues[0].getMessage() );
}
}
public void testBigInteger() throws Exception {
Tv tv = new Tv();
tv.lifetime = new BigInteger("9223372036854775808");
ClassValidator classValidator = new ClassValidator( Tv.class );
InvalidValue[] invalidValues = classValidator.getInvalidValues( tv );
assertEquals( 0, invalidValues.length );
}
public void testBeanValidator() throws Exception {
Vase v = new Vase();
ClassValidator classValidator = new ClassValidator( Vase.class );
InvalidValue[] invalidValues = classValidator.getInvalidValues( v );
assertEquals( 1, invalidValues.length );
assertNull( invalidValues[0].getPropertyName() );
}
public void testPotentialInvalidValues() throws Exception {
Address a = new Address();
Address.blacklistedZipCode = null;
a.setCountry( "Australia" );
a.setZip( "1221341234123" );
a.setState( "Vic" );
a.setLine1( "Karbarook Ave" );
a.setId( 3 );
ClassValidator classValidator = new ClassValidator( Address.class );
InvalidValue[] validationMessages = classValidator.getPotentialInvalidValues(
"blacklistedZipCode", Address.blacklistedZipCode
);
assertEquals( 1, validationMessages.length );
}
public void testRecursivity() throws Exception {
Site site = new Site();
site.setSiteName( "Rocky mountains" );
Contact contact = new Contact();
contact.setName( null ); //1 error
contact.setPhone( "01234455" );
site.setContact( contact );
Address a = new Address();
Address.blacklistedZipCode = "222";
a.setCountry( "Australia" );
a.setZip( "123" );
a.setState( "Vic" );
a.setLine1( null ); // 1 more error
a.setId( 3 );
site.setAddress( a );
ClassValidator classValidator = new ClassValidator( Site.class );
InvalidValue[] validationMessages = classValidator.getInvalidValues( site );
assertEquals( 2, validationMessages.length );
}
}
././@LongLink 0000000 0000000 0000000 00000000172 00000000000 011565 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/haintegration/ libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000755 0001750 0001750 00000000000 11402110372 033413 5 ustar twerner twerner ././@LongLink 0000000 0000000 0000000 00000000210 00000000000 011556 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/haintegration/MartianPk.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000002041 11052766205 033427 0 ustar twerner twerner //$Id: MartianPk.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.haintegration;
import java.io.Serializable;
import javax.persistence.Embeddable;
import org.hibernate.validator.Length;
/**
* @author Emmanuel Bernard
*/
@Embeddable
public class MartianPk implements Serializable {
private String name;
private String colony;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Length(max = 4)
public String getColony() {
return colony;
}
public void setColony(String colony) {
this.colony = colony;
}
public boolean equals(Object o) {
if ( this == o ) return true;
if ( o == null || getClass() != o.getClass() ) return false;
final MartianPk martianPk = (MartianPk) o;
if ( !colony.equals( martianPk.colony ) ) return false;
if ( !name.equals( martianPk.name ) ) return false;
return true;
}
public int hashCode() {
int result;
result = name.hashCode();
result = 29 * result + colony.hashCode();
return result;
}
}
././@LongLink 0000000 0000000 0000000 00000000207 00000000000 011564 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/haintegration/Venusian.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000001302 11052766205 033426 0 ustar twerner twerner //$Id: Venusian.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.haintegration;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import org.hibernate.validator.Length;
/**
* @author Emmanuel Bernard
*/
@Entity
@IdClass(VenusianPk.class)
public class Venusian implements Serializable {
private String region;
private String name;
@Id
@Length(min = 3)
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
@Id
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
././@LongLink 0000000 0000000 0000000 00000000230 00000000000 011560 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/haintegration/PrefixMessageInterpolator.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000001064 11052766205 033433 0 ustar twerner twerner //$Id: PrefixMessageInterpolator.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.haintegration;
import org.hibernate.validator.MessageInterpolator;
import org.hibernate.validator.Validator;
/**
* @author Emmanuel Bernard
*/
public class PrefixMessageInterpolator implements MessageInterpolator {
public String interpolate(String message, Validator validator, MessageInterpolator defaultInterpolator) {
return "prefix_" + defaultInterpolator.interpolate( message, validator, defaultInterpolator );
}
}
././@LongLink 0000000 0000000 0000000 00000000206 00000000000 011563 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/haintegration/Address.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000003611 11052766205 033433 0 ustar twerner twerner //$Id: Address.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.haintegration;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Transient;
import org.hibernate.validator.AssertTrue;
import org.hibernate.validator.Length;
import org.hibernate.validator.Min;
import org.hibernate.validator.NotNull;
import org.hibernate.validator.Pattern;
import org.hibernate.validator.Range;
/**
* @author Gavin King
*/
@Entity
public class Address {
@NotNull
public static String blacklistedZipCode;
private String line1;
private String line2;
private String zip;
private String state;
@Length(max = 20)
@NotNull
private String country;
private long id;
private boolean internalValid = true;
@Range(min = -2, max = 50, message = "{floor.out.of.range} (escaping #{el})")
public int floor;
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
@NotNull
public String getLine1() {
return line1;
}
public void setLine1(String line1) {
this.line1 = line1;
}
public String getLine2() {
return line2;
}
public void setLine2(String line2) {
this.line2 = line2;
}
@Length(max = 3)
@NotNull
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
@Length(max = 5, message = "{long}")
@Pattern(regex = "[0-9]+")
@NotNull
public String getZip() {
return zip;
}
public void setZip(String zip) {
this.zip = zip;
}
@AssertTrue
@Transient
public boolean isValid() {
return true;
}
@AssertTrue
@Transient
private boolean isInternalValid() {
return internalValid;
}
public void setInternalValid(boolean internalValid) {
this.internalValid = internalValid;
}
@Id
@Min(1)
@Range(max = 2000)
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
}
././@LongLink 0000000 0000000 0000000 00000000203 00000000000 011560 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/haintegration/Rock.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000457 11052766205 033440 0 ustar twerner twerner //$Id: Rock.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.haintegration;
import javax.persistence.Entity;
import org.hibernate.validator.NotNull;
/**
* @author Emmanuel Bernard
*/
@Entity
public class Rock extends Music {
@NotNull
public Integer bit;
}
././@LongLink 0000000 0000000 0000000 00000000206 00000000000 011563 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/haintegration/TvOwner.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000701 11052766205 033430 0 ustar twerner twerner //$Id: TvOwner.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.haintegration;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import org.hibernate.validator.NotNull;
/**
* @author Emmanuel Bernard
*/
@Entity
public class TvOwner {
@Id
@GeneratedValue
public Integer id;
@ManyToOne
@NotNull
public Tv tv;
}
././@LongLink 0000000 0000000 0000000 00000000201 00000000000 011556 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/haintegration/Tv.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000001166 11052766205 033436 0 ustar twerner twerner //$Id: Tv.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.haintegration;
import java.util.Date;
import java.math.BigInteger;
import javax.persistence.Entity;
import javax.persistence.Id;
import org.hibernate.validator.Future;
import org.hibernate.validator.Length;
import org.hibernate.validator.Min;
/**
* @author Emmanuel Bernard
*/
@Entity
public class Tv {
@Id
@Length(max = 2)
public String serial;
public int size;
@Length(max = 2)
public String name;
@Future
public Date expDate;
@Length(min = 0)
public String description;
@Min(1000)
public BigInteger lifetime;
}
././@LongLink 0000000 0000000 0000000 00000000206 00000000000 011563 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/haintegration/Martian.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000001041 11052766205 033426 0 ustar twerner twerner //$Id: Martian.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.haintegration;
import javax.persistence.Entity;
import javax.persistence.Id;
/**
* @author Emmanuel Bernard
*/
@Entity
public class Martian {
private MartianPk id;
private MarsAddress address;
@Id
public MartianPk getId() {
return id;
}
public void setId(MartianPk id) {
this.id = id;
}
public MarsAddress getAddress() {
return address;
}
public void setAddress(MarsAddress address) {
this.address = address;
}
}
././@LongLink 0000000 0000000 0000000 00000000221 00000000000 011560 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/haintegration/EmbeddedObjectTest.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000003353 11227341572 033436 0 ustar twerner twerner //$Id: EmbeddedObjectTest.java 17095 2009-07-15 11:54:34Z hardy.ferentschik $
package org.hibernate.validator.test.haintegration;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.event.PreInsertEventListener;
import org.hibernate.event.PreUpdateEventListener;
import org.hibernate.validator.ClassValidator;
import org.hibernate.validator.event.ValidatePreInsertEventListener;
import org.hibernate.validator.event.ValidatePreUpdateEventListener;
import org.hibernate.validator.test.HANTestCase;
/**
* @author Emmanuel Bernard
*/
@SuppressWarnings({ "deprecation" })
public class EmbeddedObjectTest extends HANTestCase {
public void testNotNullEmbeddedObject() throws Exception {
CreditCard cc = new CreditCard();
User username = new User();
username.setFirstname( "Emmanuel" );
username.setMiddlename( "P" );
username.setLastname( "Bernard" );
cc.setUsername( username );
ClassValidator ccValid = new ClassValidator( CreditCard.class );
assertEquals( 0, ccValid.getInvalidValues( cc ).length );
username.setMiddlename( null );
assertEquals( 0, ccValid.getInvalidValues( cc ).length );
Session s = openSession();
Transaction tx = s.beginTransaction();
s.persist( cc );
s.flush();
tx.rollback();
s.close();
}
protected Class[] getMappings() {
return new Class[]{
CreditCard.class
};
}
protected void configure(Configuration cfg) {
cfg.getEventListeners()
.setPreInsertEventListeners( new PreInsertEventListener[]{new ValidatePreInsertEventListener()} );
cfg.getEventListeners()
.setPreUpdateEventListeners( new PreUpdateEventListener[]{new ValidatePreUpdateEventListener()} );
}
}
././@LongLink 0000000 0000000 0000000 00000000211 00000000000 011557 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/haintegration/CreditCard.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000001405 11052766205 033432 0 ustar twerner twerner //$Id: CreditCard.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.haintegration;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import org.hibernate.validator.NotNull;
import org.hibernate.validator.Valid;
/**
* @author Emmanuel Bernard
*/
@Entity
public class CreditCard {
@Id
@GeneratedValue
private Integer id;
@Embedded
@Valid
@NotNull
private User username;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public User getUsername() {
return username;
}
public void setUsername(User username) {
this.username = username;
}
}
././@LongLink 0000000 0000000 0000000 00000000241 00000000000 011562 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/haintegration/HibernateAnnotationIntegrationTest.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000013324 11222147453 033432 0 ustar twerner twerner //$Id: HibernateAnnotationIntegrationTest.java 16963 2009-06-29 14:26:51Z hardy.ferentschik $
package org.hibernate.validator.test.haintegration;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.validator.Environment;
import org.hibernate.validator.InvalidStateException;
import org.hibernate.validator.test.HANTestCase;
/**
* Test the validate framework integration with the Hibernate
* metadata binding
*
* @author Emmanuel Bernard
*/
public class HibernateAnnotationIntegrationTest extends HANTestCase {
public void testApply() throws Exception {
PersistentClass classMapping = getCfg().getClassMapping( Address.class.getName() );
//new ClassValidator( Address.class, ResourceBundle.getBundle("messages", Locale.ENGLISH) ).apply( classMapping );
Column stateColumn = (Column) classMapping.getProperty( "state" ).getColumnIterator().next();
assertEquals( stateColumn.getLength(), 3 );
Column zipColumn = (Column) classMapping.getProperty( "zip" ).getColumnIterator().next();
assertEquals( zipColumn.getLength(), 5 );
assertFalse( zipColumn.isNullable() );
}
public void testApplyOnIdColumn() throws Exception {
PersistentClass classMapping = getCfg().getClassMapping( Tv.class.getName() );
Column serialColumn = (Column) classMapping.getIdentifierProperty().getColumnIterator().next();
assertEquals( "Vaidator annotation not applied on ids", 2, serialColumn.getLength() );
}
public void testApplyOnManyToOne() throws Exception {
PersistentClass classMapping = getCfg().getClassMapping( TvOwner.class.getName() );
Column serialColumn = (Column) classMapping.getProperty( "tv" ).getColumnIterator().next();
assertEquals( "Validator annotations not applied on associations", false, serialColumn.isNullable() );
}
public void testSingleTableAvoidNotNull() throws Exception {
PersistentClass classMapping = getCfg().getClassMapping( Rock.class.getName() );
Column serialColumn = (Column) classMapping.getProperty( "bit" ).getColumnIterator().next();
assertTrue( "Notnull should not be applised on single tables", serialColumn.isNullable() );
}
public void testEvents() throws Exception {
Session s;
Transaction tx;
Address a = new Address();
Address.blacklistedZipCode = "3232";
a.setId( 12 );
a.setCountry( "Country" );
a.setLine1( "Line 1" );
a.setZip( "nonnumeric" );
a.setState( "NY" );
s = openSession();
tx = s.beginTransaction();
try {
s.persist( a );
tx.commit();
fail( "bean should have been validated" );
}
catch (InvalidStateException e) {
//success
assertEquals( 2, e.getInvalidValues().length );
assertTrue( "Environment.MESSAGE_INTERPOLATOR_CLASS does not work",
e.getInvalidValues()[0].getMessage().startsWith( "prefix_")
);
}
finally {
if ( tx != null ) tx.rollback();
s.close();
}
a = new Address();
Address.blacklistedZipCode = "3232";
a.setId( 12 );
a.setCountry( "Country" );
a.setLine1( "Line 1" );
a.setZip( "12345" );
a.setState( "NY" );
s = openSession();
tx = s.beginTransaction();
s.persist( a );
tx.commit();
a.setState( "WAYTOOLONG" );
s = openSession();
tx = s.beginTransaction();
try {
s.merge( a );
tx.commit();
fail( "bean should have been validated" );
}
catch (InvalidStateException e) {
//success
assertEquals( 1, e.getInvalidValues().length );
assertTrue( "Environment.MESSAGE_INTERPOLATOR_CLASS does not work",
e.getInvalidValues()[0].getMessage().startsWith( "prefix_")
);
}
finally {
if ( tx != null ) tx.rollback();
s.close();
}
s = openSession();
tx = s.beginTransaction();
a.setId( 13 );
a.setCountry( "Country" );
a.setLine1( "Line 1" );
a.setZip( "4343" );
a.setState( "NY" );
s.persist( a );
s.flush();
a.setState( "TOOLONG" );
try {
s.flush();
fail( "update should have been checked" );
}
catch (InvalidStateException e) {
assertEquals( 1, e.getInvalidValues().length );
}
finally {
s.clear();
for (Object o : s.createCriteria( Address.class ).list() ) {
s.delete( o );
}
tx.commit();
s.close();
}
}
public void testComponents() throws Exception {
Session s;
Transaction tx;
s = openSession();
tx = s.beginTransaction();
Martian martian = new Martian();
MartianPk pk = new MartianPk();
pk.setColony( "Liberal" ); //one failure
pk.setName( "Biboudie" );
MarsAddress address = new MarsAddress();
address.setContinent( "cont" ); //one failure
address.setCanal( "Plus" ); //one failure
martian.setId( pk );
martian.setAddress( address );
s.persist( martian );
try {
s.flush();
fail( "Components are not validated" );
}
catch (InvalidStateException e) {
assertEquals( 2, e.getInvalidValues().length );
}
finally {
tx.rollback();
s.close();
}
}
public void testIdClass() throws Exception {
Session s;
Transaction tx;
s = openSession();
tx = s.beginTransaction();
Venusian venus = new Venusian();
venus.setName( "bibi" );
venus.setRegion( "ts" );
s.persist( venus );
try {
s.flush();
fail( "test on embedded properties should have been done" );
}
catch (InvalidStateException e) {
assertEquals( 1, e.getInvalidValues().length );
}
finally {
tx.rollback();
s.close();
}
}
protected void configure(Configuration cfg) {
cfg.setProperty( Environment.MESSAGE_INTERPOLATOR_CLASS, PrefixMessageInterpolator.class.getName() );
}
protected Class[] getMappings() {
return new Class[]{
Address.class,
Martian.class,
Venusian.class,
Tv.class,
TvOwner.class,
Music.class,
Rock.class
};
}
public HibernateAnnotationIntegrationTest(String x) {
super( x );
}
}
././@LongLink 0000000 0000000 0000000 00000000203 00000000000 011560 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/haintegration/User.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000001461 11052766205 033434 0 ustar twerner twerner //$Id: User.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.haintegration;
import javax.persistence.Embeddable;
import org.hibernate.validator.NotNull;
/**
* @author Emmanuel Bernard
*/
@Embeddable
public class User {
@NotNull
private String firstname;
private String middlename;
@NotNull
private String lastname;
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 String getMiddlename() {
return middlename;
}
public void setMiddlename(String middlename) {
this.middlename = middlename;
}
}
././@LongLink 0000000 0000000 0000000 00000000211 00000000000 011557 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/haintegration/VenusianPk.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000001653 11052766205 033437 0 ustar twerner twerner //$Id: VenusianPk.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.haintegration;
import java.io.Serializable;
/**
* @author Emmanuel Bernard
*/
public class VenusianPk implements Serializable {
private String region;
private String name;
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean equals(Object o) {
if ( this == o ) return true;
if ( o == null || getClass() != o.getClass() ) return false;
final VenusianPk that = (VenusianPk) o;
if ( !name.equals( that.name ) ) return false;
if ( !region.equals( that.region ) ) return false;
return true;
}
public int hashCode() {
int result;
result = region.hashCode();
result = 29 * result + name.hashCode();
return result;
}
}
././@LongLink 0000000 0000000 0000000 00000000204 00000000000 011561 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/haintegration/Music.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000422 11052766205 033430 0 ustar twerner twerner //$Id: Music.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.haintegration;
import javax.persistence.Entity;
import javax.persistence.Id;
/**
* @author Emmanuel Bernard
*/
@Entity
public class Music {
@Id
public String name;
}
././@LongLink 0000000 0000000 0000000 00000000245 00000000000 011566 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/haintegration/NonHibernateAnnotationsIntegrationTest.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000003467 11052766205 033444 0 ustar twerner twerner //$Id: NonHibernateAnnotationsIntegrationTest.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.haintegration;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Column;
import org.hibernate.event.PreInsertEventListener;
import org.hibernate.event.PreUpdateEventListener;
import org.hibernate.cfg.Configuration;
import org.hibernate.validator.Environment;
import org.hibernate.validator.test.HANTestCase;
import org.hibernate.validator.event.ValidateEventListener;
import org.hibernate.Session;
/**
* Test the ability to disable DDL update
*
* @author Emmanuel Bernard
*/
public class NonHibernateAnnotationsIntegrationTest extends HANTestCase {
public void testNotApplyDll() throws Exception {
PersistentClass classMapping = getCfg().getClassMapping( Address.class.getName() );
Column stateColumn = (Column) classMapping.getProperty( "state" ).getColumnIterator().next();
assertFalse( stateColumn.getLength() == 3 );
Column zipColumn = (Column) classMapping.getProperty( "zip" ).getColumnIterator().next();
assertFalse( zipColumn.getLength() == 5 );
assertTrue( zipColumn.isNullable() );
}
public void testNotApplyListener() throws Exception {
Session s = openSession( );
Address a = new Address();
s.persist( a ); //shouldn't fail
s.flush();
s.close();
}
protected void configure(Configuration cfg) {
cfg.setProperty( Environment.MESSAGE_INTERPOLATOR_CLASS, PrefixMessageInterpolator.class.getName() );
cfg.setProperty( Environment.APPLY_TO_DDL, "false" );
cfg.setProperty( Environment.AUTOREGISTER_LISTENERS, "false" );
}
protected Class[] getMappings() {
return new Class[]{
Address.class,
};
}
public NonHibernateAnnotationsIntegrationTest(String x) {
super( x );
}
}
././@LongLink 0000000 0000000 0000000 00000000212 00000000000 011560 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/haintegration/MarsAddress.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000001205 11052766205 033430 0 ustar twerner twerner //$Id: MarsAddress.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.haintegration;
import javax.persistence.Embeddable;
import org.hibernate.validator.Length;
import org.hibernate.validator.NotNull;
/**
* @author Emmanuel Bernard
*/
@Embeddable
public class MarsAddress {
private String continent;
private String canal;
@NotNull
public String getContinent() {
return continent;
}
public void setContinent(String continent) {
this.continent = continent;
}
@Length(min = 5)
public String getCanal() {
return canal;
}
public void setCanal(String canal) {
this.canal = canal;
}
}
././@LongLink 0000000 0000000 0000000 00000000170 00000000000 011563 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/Brother.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000002025 11131662636 033432 0 ustar twerner twerner //$Id: Brother.java 15765 2009-01-09 14:56:30Z hardy.ferentschik $
package org.hibernate.validator.test;
import org.hibernate.validator.NotNull;
import org.hibernate.validator.Valid;
/**
* @author Emmanuel Bernard
*/
public class Brother {
private String name;
private Brother elder;
private Brother youngerBrother;
@NotNull
@Valid
private Address address;
@NotNull
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Valid
public Brother getElder() {
return elder;
}
public void setElder(Brother elder) {
this.elder = elder;
}
@Valid
public Brother getYoungerBrother() {
return youngerBrother;
}
public void setYoungerBrother(Brother youngerBrother) {
this.youngerBrother = youngerBrother;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public boolean equals(Object o) {
return true; //workaround dummy equals and hashcode?
}
public int hashCode() {
return 5;
}
}
././@LongLink 0000000 0000000 0000000 00000000170 00000000000 011563 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/Contact.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000752 11131662636 033437 0 ustar twerner twerner //$Id: Contact.java 15765 2009-01-09 14:56:30Z hardy.ferentschik $
package org.hibernate.validator.test;
import org.hibernate.validator.NotNull;
/**
* @author Emmanuel Bernard
*/
public class Contact {
@NotNull
private String name;
@NotNull
private String phone;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
} ././@LongLink 0000000 0000000 0000000 00000000167 00000000000 011571 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/validators/ libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000755 0001750 0001750 00000000000 11402110373 033414 5 ustar twerner twerner ././@LongLink 0000000 0000000 0000000 00000000177 00000000000 011572 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/validators/Car.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000001362 11052766205 033434 0 ustar twerner twerner //$Id: Car.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.validators;
import java.math.BigDecimal;
import javax.persistence.Id;
import javax.persistence.GeneratedValue;
import javax.persistence.Entity;
import org.hibernate.validator.NotEmpty;
import org.hibernate.validator.Digits;
/**
* @author Emmanuel Bernard
*/
@Entity
public class Car {
@Id @GeneratedValue
public Long id;
@NotEmpty
public String name;
@NotEmpty
public String[] insurances;
@Digits(integerDigits = 1, fractionalDigits = 2)
public BigDecimal length;
@Digits(integerDigits = 2, fractionalDigits = 1)
public Double gallons;
@Digits(integerDigits = 2, fractionalDigits = 1)
public String mpg;
}
././@LongLink 0000000 0000000 0000000 00000000206 00000000000 011563 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/validators/CreditCard.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000507 11052766205 033434 0 ustar twerner twerner //$Id: CreditCard.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.validators;
import org.hibernate.validator.EAN;
/**
* @author Emmanuel Bernard
*/
public class CreditCard {
@org.hibernate.validator.CreditCardNumber
public String number;
@EAN
public String ean;
}
././@LongLink 0000000 0000000 0000000 00000000206 00000000000 011563 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/validators/DigitsTest.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000003757 11052766205 033446 0 ustar twerner twerner //$Id: DigitsTest.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.validators;
import java.math.BigDecimal;
import org.hibernate.cfg.Configuration;
import org.hibernate.event.PreInsertEventListener;
import org.hibernate.event.PreUpdateEventListener;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.validator.ClassValidator;
import org.hibernate.validator.InvalidValue;
import org.hibernate.validator.test.HANTestCase;
import org.hibernate.validator.event.ValidateEventListener;
/**
* @author Emmanuel Bernard
*/
public class DigitsTest extends HANTestCase {
public void testDigits() throws Exception {
Car car = new Car();
car.name = "350Z";
car.insurances = new String[] { "random" };
car.length = new BigDecimal(10.2);
car.gallons = 100.3;
car.mpg = "EFG";
ClassValidator classValidator = new ClassValidator( Car.class );
InvalidValue[] invalidValues = classValidator.getInvalidValues( car );
assertEquals( 3, invalidValues.length );
car.length = new BigDecimal(1.223); //more than 2
car.gallons = 10.300; //1 digit really so not invalid
invalidValues = classValidator.getInvalidValues( car );
assertEquals( 2, invalidValues.length );
}
public void testApply() throws Exception {
PersistentClass classMapping = getCfg().getClassMapping( Car.class.getName() );
Column stateColumn = (Column) classMapping.getProperty( "gallons" ).getColumnIterator().next();
assertEquals( stateColumn.getPrecision(), 3 );
assertEquals( stateColumn.getScale(), 1 );
}
protected void configure(Configuration cfg) {
cfg.getEventListeners()
.setPreInsertEventListeners( new PreInsertEventListener[]{new ValidateEventListener()} );
cfg.getEventListeners()
.setPreUpdateEventListeners( new PreUpdateEventListener[]{new ValidateEventListener()} );
}
protected Class[] getMappings() {
return new Class[] {
Car.class
};
}
}
././@LongLink 0000000 0000000 0000000 00000000204 00000000000 011561 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/validators/LuhnTest.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000002150 11052766205 033430 0 ustar twerner twerner //$Id: LuhnTest.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.validators;
import junit.framework.TestCase;
import org.hibernate.validator.ClassValidator;
import org.hibernate.validator.InvalidValue;
/**
* @author Emmanuel Bernard
*/
public class LuhnTest extends TestCase {
public void testCreditCard() {
CreditCard card = new CreditCard();
card.number = "1234567890123456";
ClassValidator classValidator = new ClassValidator( CreditCard.class );
InvalidValue[] invalidValues = classValidator.getInvalidValues( card );
assertEquals( 1, invalidValues.length );
card.number = "541234567890125"; //right CC (luhn compliant)
invalidValues = classValidator.getInvalidValues( card );
assertEquals( 0, invalidValues.length );
card.ean = "9782266156066"; //right EAN
invalidValues = classValidator.getInvalidValues( card );
assertEquals( 0, invalidValues.length );
card.ean = "9782266156067"; //wrong EAN
invalidValues = classValidator.getInvalidValues( card );
assertEquals( 1, invalidValues.length );
}
}
././@LongLink 0000000 0000000 0000000 00000000210 00000000000 011556 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/validators/NotEmptyTest.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000002157 11052766205 033437 0 ustar twerner twerner //$Id: NotEmptyTest.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.validators;
import junit.framework.TestCase;
import org.hibernate.validator.ClassValidator;
import org.hibernate.validator.InvalidValue;
/**
* @author Gavin King
*/
public class NotEmptyTest extends TestCase {
public void testBigInteger() throws Exception {
Car car = new Car();
ClassValidator classValidator = new ClassValidator( Car.class );
InvalidValue[] invalidValues = classValidator.getInvalidValues( car );
assertEquals( 2, invalidValues.length );
car.name = "";
invalidValues = classValidator.getInvalidValues( car );
assertEquals( 2, invalidValues.length );
car.name = "350Z";
invalidValues = classValidator.getInvalidValues( car );
assertEquals( 1, invalidValues.length );
car.insurances = new String[0];
invalidValues = classValidator.getInvalidValues( car );
assertEquals( 1, invalidValues.length );
car.insurances = new String[1];
invalidValues = classValidator.getInvalidValues( car );
assertEquals( 0, invalidValues.length );
}
}
././@LongLink 0000000 0000000 0000000 00000000176 00000000000 011571 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/BooleanHolder.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000001305 11052766205 033431 0 ustar twerner twerner //$Id: BooleanHolder.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test;
import org.hibernate.validator.AssertFalse;
import org.hibernate.validator.AssertTrue;
/**
* @author Hardy Ferentschik
*/
public class BooleanHolder {
@AssertTrue
private Boolean mustBeTrue;
@AssertFalse
private Boolean mustBeFalse;
public Boolean getMustBeTrue() {
return mustBeTrue;
}
public void setMustBeTrue(Boolean mustBeTrue) {
this.mustBeTrue = mustBeTrue;
}
public Boolean getMustBeFalse() {
return mustBeFalse;
}
public void setMustBeFalse(Boolean mustBeFalse) {
this.mustBeFalse = mustBeFalse;
}
}
././@LongLink 0000000 0000000 0000000 00000000172 00000000000 011565 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/EmailTest.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000002332 11131662636 033433 0 ustar twerner twerner //$Id: EmailTest.java 15765 2009-01-09 14:56:30Z hardy.ferentschik $
package org.hibernate.validator.test;
import junit.framework.TestCase;
import org.hibernate.validator.ClassValidator;
/**
* @author Emmanuel Bernard
*/
public class EmailTest extends TestCase {
private ClassValidator userValidator;
public void testEmail() throws Exception {
userValidator = new ClassValidator(User.class);
isRightEmail("emmanuel@hibernate.org");
isRightEmail("");
isRightEmail(null);
isRightEmail("emmanuel@hibernate");
isRightEmail("emma-n_uel@hibernate");
isRightEmail("emma+nuel@hibernate.org");
isRightEmail("emma=nuel@hibernate.org");
isRightEmail("emmanuel@[123.12.2.11]");
isWrongEmail("emmanuel.hibernate.org");
isWrongEmail("emma nuel@hibernate.org");
isWrongEmail("emma(nuel@hibernate.org");
isWrongEmail("emmanuel@");
isWrongEmail("emma\nnuel@hibernate.org");
isWrongEmail("emma@nuel@hibernate.org");
}
private void isRightEmail(String email) {
assertEquals("Wrong email", 0, userValidator.getPotentialInvalidValues("email", email).length);
}
private void isWrongEmail(String email) {
assertEquals("Right email", 1, userValidator.getPotentialInvalidValues("email", email).length);
}
}
././@LongLink 0000000 0000000 0000000 00000000167 00000000000 011571 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/Engine.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000001422 11052766205 033431 0 ustar twerner twerner //$Id: Engine.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test;
import org.hibernate.validator.Patterns;
import org.hibernate.validator.Pattern;
/**
* @author Emmanuel Bernard
*/
public class Engine {
@Patterns( {
@Pattern(regex = "^[A-Z0-9-]+$", message = "must contain alphabetical characters only"),
@Pattern(regex = "^....-....-....$", message="must match ....-....-....")
} )
private String serialNumber;
private long horsePower;
public String getSerialNumber() {
return serialNumber;
}
public void setSerialNumber(String serialNumber) {
this.serialNumber = serialNumber;
}
public long getHorsePower() {
return horsePower;
}
public void setHorsePower(long horsePower) {
this.horsePower = horsePower;
}
}
././@LongLink 0000000 0000000 0000000 00000000170 00000000000 011563 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/Address.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000003445 11131662636 033441 0 ustar twerner twerner //$Id: Address.java 15765 2009-01-09 14:56:30Z hardy.ferentschik $
package org.hibernate.validator.test;
import org.hibernate.validator.AssertTrue;
import org.hibernate.validator.Length;
import org.hibernate.validator.Min;
import org.hibernate.validator.NotNull;
import org.hibernate.validator.Pattern;
import org.hibernate.validator.Range;
import org.hibernate.validator.Max;
/**
* @author Gavin King
*/
public class Address {
@NotNull
public static String blacklistedZipCode;
private String line1;
private String line2;
private String zip;
private String state;
@Length(max = 20)
@NotNull
private String country;
private long id;
private boolean internalValid = true;
@Range(min = -2, max = 50, message = "{floor.out.of.range} (escaping #{el})")
@Max(70)
public int floor;
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
@NotNull
public String getLine1() {
return line1;
}
public void setLine1(String line1) {
this.line1 = line1;
}
public String getLine2() {
return line2;
}
public void setLine2(String line2) {
this.line2 = line2;
}
@Length(max = 3)
@NotNull
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
@Length(max = 5, message = "{long}")
@Pattern(regex = "[0-9]+")
@NotNull
public String getZip() {
return zip;
}
public void setZip(String zip) {
this.zip = zip;
}
@AssertTrue
public boolean isValid() {
return true;
}
@AssertTrue
private boolean isInternalValid() {
return internalValid;
}
public void setInternalValid(boolean internalValid) {
this.internalValid = internalValid;
}
@Min(1)
@Range(max = 2000)
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
}
././@LongLink 0000000 0000000 0000000 00000000160 00000000000 011562 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/jpa/ libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000755 0001750 0001750 00000000000 11402110374 033415 5 ustar twerner twerner ././@LongLink 0000000 0000000 0000000 00000000200 00000000000 011555 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/jpa/JPATestCase.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000005034 11227341572 033434 0 ustar twerner twerner //$Id: JPATestCase.java 17095 2009-07-15 11:54:34Z hardy.ferentschik $
package org.hibernate.validator.test.jpa;
import java.util.Map;
import java.util.HashMap;
import java.util.Properties;
import java.util.ArrayList;
import java.io.InputStream;
import java.io.IOException;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.hibernate.cfg.Environment;
import org.hibernate.ejb.HibernatePersistence;
/**
* @author Emmanuel Bernard
*/
@SuppressWarnings({ "deprecation" })
public abstract class JPATestCase extends junit.framework.TestCase {
protected EntityManagerFactory factory;
public JPATestCase() {
super();
}
public JPATestCase(String name) {
super( name );
}
public void setUp() {
factory = new HibernatePersistence().createEntityManagerFactory( getConfig() );
}
public void tearDown() {
factory.close();
}
public abstract Class[] getAnnotatedClasses();
public String[] getEjb3DD() {
return new String[]{};
}
public Map getCachedClasses() {
return new HashMap();
}
public Map getCachedCollections() {
return new HashMap();
}
public static Properties loadProperties() {
Properties props = new Properties();
InputStream stream = Persistence.class.getResourceAsStream( "/hibernate.properties" );
if ( stream != null ) {
try {
props.load( stream );
}
catch (Exception e) {
throw new RuntimeException( "could not load hibernate.properties" );
}
finally {
try {
stream.close();
}
catch (IOException ioe) {
}
}
}
props.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
return props;
}
public Map getConfig() {
Map config = loadProperties();
ArrayList classes = new ArrayList();
for ( Class clazz : getAnnotatedClasses() ) {
classes.add( clazz );
}
config.put( HibernatePersistence.LOADED_CLASSES, classes );
for ( Map.Entry entry : getCachedClasses().entrySet() ) {
config.put(
HibernatePersistence.CLASS_CACHE_PREFIX + "." + entry.getKey().getName(),
entry.getValue()
);
}
for ( Map.Entry entry : getCachedCollections().entrySet() ) {
config.put(
HibernatePersistence.COLLECTION_CACHE_PREFIX + "." + entry.getKey(),
entry.getValue()
);
}
if ( getEjb3DD().length > 0 ) {
ArrayList dds = new ArrayList();
for ( String dd : getEjb3DD() ) {
dds.add( dd );
}
config.put( HibernatePersistence.XML_FILE_NAMES, dds );
}
return config;
}
}
././@LongLink 0000000 0000000 0000000 00000000176 00000000000 011571 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/jpa/Commander.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000727 11052766205 033440 0 ustar twerner twerner //$Id: Commander.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.jpa;
import javax.persistence.Embeddable;
import javax.persistence.Column;
import org.hibernate.validator.NotEmpty;
/**
* @author Emmanuel Bernard
*/
@Embeddable
public class Commander {
@NotEmpty
@Column(name="commander_name")
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
././@LongLink 0000000 0000000 0000000 00000000170 00000000000 011563 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/jpa/Cat.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000001501 11052766205 033427 0 ustar twerner twerner //$Id: Cat.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.jpa;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import org.hibernate.validator.Length;
import org.hibernate.validator.Min;
/**
* @author Emmanuel Bernard
*/
@Entity
public class Cat implements Serializable {
private Integer id;
private String name;
private long length;
@Id
@GeneratedValue
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
@Length(min = 4)
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Min(0)
public long getLength() {
return length;
}
public void setLength(long length) {
this.length = length;
}
} ././@LongLink 0000000 0000000 0000000 00000000210 00000000000 011556 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/jpa/HEMAutoWireringTest.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000002603 11052766205 033433 0 ustar twerner twerner //$Id: HEMAutoWireringTest.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.jpa;
import java.util.Date;
import java.util.Map;
import javax.persistence.EntityManager;
import org.hibernate.ejb.HibernatePersistence;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.validator.InvalidStateException;
/**
* @author Emmanuel Bernard
*/
public class HEMAutoWireringTest extends JPATestCase {
public void testPropertyValidation() throws Exception {
EntityManager em = factory.createEntityManager();
Cat cat = new Cat();
cat.setName( "iti" );
em.getTransaction().begin();
try {
em.persist( cat );
em.flush();
fail( "No validation" );
}
catch (InvalidStateException e) {
//success
}
finally {
em.getTransaction().rollback();
em.close();
}
}
public void testEventPerProperties() throws Exception {
EntityManager em = factory.createEntityManager();
assertEquals( "Only validator and explicit NoOp should be present", 2,
( (SessionImplementor) em.getDelegate() ).getListeners().getPreInsertEventListeners().length );
em.close();
}
public Class[] getAnnotatedClasses() {
return new Class[] {
Cat.class
};
}
public Map getConfig() {
Map config = super.getConfig();
config.put( HibernatePersistence.EVENT_LISTENER_PREFIX + ".pre-insert", NoOpListener.class.getName() );
return config;
}
}
././@LongLink 0000000 0000000 0000000 00000000214 00000000000 011562 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/jpa/JPAValidateListenerTest.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000004056 11052766205 033437 0 ustar twerner twerner //$Id: JPAValidateListenerTest.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.jpa;
import java.util.Map;
import javax.persistence.EntityManager;
import org.hibernate.ejb.HibernatePersistence;
import org.hibernate.validator.Environment;
import org.hibernate.validator.InvalidStateException;
/**
* @author Emmanuel Bernard
*/
public class JPAValidateListenerTest extends JPATestCase {
public void testEventTrigger() {
EntityManager em = factory.createEntityManager();
em.getTransaction().begin();
Commander beetles = new Commander();
beetles.setName( "" );
Submarine yellowSubmarine = new Submarine();
yellowSubmarine.setCommander( beetles );
yellowSubmarine.setName( "" );
yellowSubmarine.setSize( 3 );
try {
em.persist( yellowSubmarine );
em.flush();
fail("Event not wired");
}
catch(InvalidStateException e) {
assertEquals( 3, e.getInvalidValues().length );
}
finally {
em.getTransaction().rollback();
em.close();
}
//update trigger
em = factory.createEntityManager();
em.getTransaction().begin();
beetles = new Commander();
beetles.setName( "Beetles" );
yellowSubmarine = new Submarine();
yellowSubmarine.setCommander( beetles );
yellowSubmarine.setName( "Yellow" );
yellowSubmarine.setSize( 13 );
em.persist( yellowSubmarine );
em.flush();
em.clear();
yellowSubmarine = em.find( Submarine.class, yellowSubmarine.getId() );
yellowSubmarine.setSize( 3 );
try {
em.flush();
fail("Event not wired");
}
catch(InvalidStateException e) {
assertEquals( 1, e.getInvalidValues().length );
}
finally {
em.getTransaction().rollback();
em.close();
}
}
public Class[] getAnnotatedClasses() {
return new Class[]{
Commander.class,
Submarine.class
};
}
public Map getConfig() {
Map map = super.getConfig();
//Remove regular Validator wiring
map.put( HibernatePersistence.EVENT_LISTENER_PREFIX + "." + "pre-insert",
"" );
map.put( HibernatePersistence.EVENT_LISTENER_PREFIX + "." + "pre-update",
"" );
return map;
}
}
././@LongLink 0000000 0000000 0000000 00000000201 00000000000 011556 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/jpa/NoOpListener.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000575 11052766205 033441 0 ustar twerner twerner //$Id: NoOpListener.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.jpa;
import org.hibernate.event.PreInsertEventListener;
import org.hibernate.event.PreInsertEvent;
/**
* @author Emmanuel Bernard
*/
public class NoOpListener implements PreInsertEventListener {
public boolean onPreInsert(PreInsertEvent event) {
return false;
}
}
././@LongLink 0000000 0000000 0000000 00000000176 00000000000 011571 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/jpa/Submarine.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000002160 11052766205 033431 0 ustar twerner twerner //$Id: Submarine.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.jpa;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import org.hibernate.validator.Min;
import org.hibernate.validator.NotEmpty;
import org.hibernate.validator.Valid;
import org.hibernate.validator.event.JPAValidateListener;
/**
* @author Emmanuel Bernard
*/
@Entity
@EntityListeners( JPAValidateListener.class )
public class Submarine {
@Id
@GeneratedValue
private Long id;
@NotEmpty
private String name;
@Valid
private Commander commander;
@Min( 10 )
private long size;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public long getSize() {
return size;
}
public void setSize(long size) {
this.size = size;
}
public Commander getCommander() {
return commander;
}
public void setCommander(Commander commander) {
this.commander = commander;
}
}
././@LongLink 0000000 0000000 0000000 00000000173 00000000000 011566 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/AssertTest.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000004275 11052516561 033440 0 ustar twerner twerner // $Id: AssertTest.java 15111 2008-08-19 10:16:17Z hardy.ferentschik $
package org.hibernate.validator.test;
import junit.framework.TestCase;
import org.hibernate.validator.ClassValidator;
import org.hibernate.validator.InvalidValue;
import org.hibernate.validator.AssertTrueValidator;
import org.hibernate.validator.AssertFalseValidator;
import java.util.Locale;
import java.util.ResourceBundle;
/**
* Test cases for AssertFalse
and AssertTrue
.
*
* @author Hardy Ferentschik
* @see HV-53
*/
public class AssertTest extends TestCase {
ClassValidator classValidator;
public void setUp() throws Exception {
classValidator = new ClassValidator(
BooleanHolder.class, ResourceBundle.getBundle("messages", Locale.ENGLISH)
);
}
public void testSuccessfulValidation() throws Exception {
BooleanHolder bholder = new BooleanHolder();
bholder.setMustBeTrue(true);
bholder.setMustBeFalse(false);
InvalidValue[] invalidValues = classValidator.getInvalidValues(bholder);
assertTrue("should be empty", invalidValues.length == 0);
}
public void testUnSuccessfulValidation() throws Exception {
BooleanHolder bholder = new BooleanHolder();
bholder.setMustBeTrue(false);
bholder.setMustBeFalse(true);
InvalidValue[] invalidValues = classValidator.getInvalidValues(bholder);
assertTrue("should be empty", invalidValues.length == 2);
}
public void testNullValidation() throws Exception {
BooleanHolder bholder = new BooleanHolder();
bholder.setMustBeTrue(null);
bholder.setMustBeFalse(null);
InvalidValue[] invalidValues = classValidator.getInvalidValues(bholder);
assertTrue("should be empty", invalidValues.length == 0);
}
public void testNonBooleanValidation() throws Exception {
AssertTrueValidator trueValidator = new AssertTrueValidator();
assertFalse(trueValidator.isValid("foo"));
AssertFalseValidator falseValidator = new AssertFalseValidator();
assertFalse(falseValidator.isValid("foo"));
}
} ././@LongLink 0000000 0000000 0000000 00000000200 00000000000 011555 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/Serializability.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000001120 11131662636 033425 0 ustar twerner twerner package org.hibernate.validator.test;
import java.lang.annotation.Documented;
import static java.lang.annotation.ElementType.TYPE;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;
import org.hibernate.validator.ValidatorClass;
/**
* Dummy sample of a bean-level validation annotation
*
* @author Emmanuel Bernard
*/
@ValidatorClass(SerializabilityValidator.class)
@Target(TYPE)
@Retention(RUNTIME)
@Documented
public @interface Serializability {
String message() default "Bean not Serializable";
}
././@LongLink 0000000 0000000 0000000 00000000174 00000000000 011567 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/HANTestCase.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000007615 11227341464 033443 0 ustar twerner twerner //$Id: HANTestCase.java 17094 2009-07-15 11:53:24Z hardy.ferentschik $
package org.hibernate.validator.test;
import java.io.InputStream;
import org.hibernate.SessionFactory;
import org.hibernate.Session;
import org.hibernate.HibernateException;
import org.hibernate.Interceptor;
import org.hibernate.dialect.Dialect;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.cfg.Environment;
import org.hibernate.cfg.Configuration;
/**
* Copy from HAN
*
* @author Emmanuel Bernard
*/
public abstract class HANTestCase extends junit.framework.TestCase {
private static SessionFactory sessions;
private static AnnotationConfiguration cfg;
private static Dialect dialect;
private static Class lastTestClass;
private Session session;
public HANTestCase() {
super();
}
public HANTestCase(String x) {
super( x );
}
protected void buildSessionFactory(Class[] classes, String[] packages, String[] xmlFiles) throws Exception {
if ( getSessions() != null ) getSessions().close();
try {
setCfg( new AnnotationConfiguration() );
configure( cfg );
if ( recreateSchema() ) {
cfg.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
}
for ( int i = 0; i < packages.length; i++ ) {
getCfg().addPackage( packages[i] );
}
for ( int i = 0; i < classes.length; i++ ) {
getCfg().addAnnotatedClass( classes[i] );
}
for ( int i = 0; i < xmlFiles.length; i++ ) {
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream( xmlFiles[i] );
getCfg().addInputStream( is );
}
setDialect( Dialect.getDialect() );
setSessions( getCfg().buildSessionFactory( /*new TestInterceptor()*/ ) );
}
catch (Exception e) {
e.printStackTrace();
throw e;
}
}
protected void setUp() throws Exception {
if ( getSessions() == null || lastTestClass != getClass() ) {
buildSessionFactory( getMappings(), getAnnotatedPackages(), getXmlFiles() );
lastTestClass = getClass();
}
}
@SuppressWarnings({ "deprecation" })
protected void runTest() throws Throwable {
try {
super.runTest();
if ( session != null && session.isOpen() ) {
if ( session.isConnected() ) session.connection().rollback();
session.close();
session = null;
fail( "unclosed session" );
}
else {
session = null;
}
}
catch (Throwable e) {
try {
if ( session != null && session.isOpen() ) {
if ( session.isConnected() ) session.connection().rollback();
session.close();
}
}
catch (Exception ignore) {
}
try {
if ( sessions != null ) {
sessions.close();
sessions = null;
}
}
catch (Exception ignore) {
}
throw e;
}
}
public Session openSession() throws HibernateException {
session = getSessions().openSession();
return session;
}
public Session openSession(Interceptor interceptor) throws HibernateException {
session = getSessions().openSession( interceptor );
return session;
}
protected abstract Class[] getMappings();
protected String[] getAnnotatedPackages() {
return new String[]{};
}
protected String[] getXmlFiles() {
return new String[]{};
}
private void setSessions(SessionFactory sessions) {
HANTestCase.sessions = sessions;
}
protected SessionFactory getSessions() {
return sessions;
}
private void setDialect(Dialect dialect) {
HANTestCase.dialect = dialect;
}
protected Dialect getDialect() {
return dialect;
}
protected static void setCfg(AnnotationConfiguration cfg) {
HANTestCase.cfg = cfg;
}
protected static AnnotationConfiguration getCfg() {
return cfg;
}
protected void configure(Configuration cfg) {
//cfg.setNamingStrategy( AlternativeNamingStrategy.INSTANCE );
//cfg.getSessionEventListenerConfig().setFlushEventListener( new EJB3FlushEventListener() );
//cfg.getSessionEventListenerConfig().setAutoFlushEventListener( new EJB3AutoFlushEventListener() );
}
protected boolean recreateSchema() {
return true;
}
}
././@LongLink 0000000 0000000 0000000 00000000170 00000000000 011563 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/TvOwner.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000454 11131662636 033436 0 ustar twerner twerner //$Id: TvOwner.java 15765 2009-01-09 14:56:30Z hardy.ferentschik $
package org.hibernate.validator.test;
import org.hibernate.validator.NotNull;
import org.hibernate.validator.Valid;
/**
* @author Emmanuel Bernard
*/
public class TvOwner {
public Integer id;
@NotNull
@Valid
public Tv tv;
}
././@LongLink 0000000 0000000 0000000 00000000170 00000000000 011563 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/collections/ libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000755 0001750 0001750 00000000000 11402110374 033415 5 ustar twerner twerner ././@LongLink 0000000 0000000 0000000 00000000201 00000000000 011556 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/collections/Show.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000401 11052766205 033425 0 ustar twerner twerner //$Id: Show.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.collections;
import org.hibernate.validator.NotNull;
/**
* @author Emmanuel Bernard
*/
public class Show {
@NotNull
public String name;
}
././@LongLink 0000000 0000000 0000000 00000000206 00000000000 011563 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/collections/Presenter.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000413 11052766205 033430 0 ustar twerner twerner //$Id: Presenter.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.collections;
import org.hibernate.validator.NotNull;
/**
* @author Emmanuel Bernard
*/
public class Presenter {
@NotNull
public String name;
}
././@LongLink 0000000 0000000 0000000 00000000177 00000000000 011572 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/collections/Tv.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000001113 11052766205 033426 0 ustar twerner twerner //$Id: Tv.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.collections;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.hibernate.validator.NotNull;
import org.hibernate.validator.Valid;
/**
* @author Emmanuel Bernard
*/
public class Tv {
@NotNull
public String name;
@Valid
public List presenters = new ArrayList();
@Valid
public Map shows = new HashMap();
public
@Valid
Movie[] movies;
}
././@LongLink 0000000 0000000 0000000 00000000225 00000000000 011564 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/collections/ValidationCollectionTest.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000003644 11052766205 033441 0 ustar twerner twerner //$Id: ValidationCollectionTest.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.collections;
import junit.framework.TestCase;
import org.hibernate.validator.ClassValidator;
import org.hibernate.validator.InvalidValue;
/**
* @author Emmanuel Bernard
*/
public class ValidationCollectionTest extends TestCase {
public void testCollection() throws Exception {
Tv tv = new Tv();
tv.name = "France 2";
Presenter presNok = new Presenter();
presNok.name = null;
Presenter presOk = new Presenter();
presOk.name = "Thierry Ardisson";
tv.presenters.add( presOk );
tv.presenters.add( presNok );
ClassValidator validator = new ClassValidator( Tv.class );
InvalidValue[] values = validator.getInvalidValues( tv );
assertEquals( 1, values.length );
assertEquals( "presenters[1].name", values[0].getPropertyPath() );
}
public void testMap() throws Exception {
Tv tv = new Tv();
tv.name = "France 2";
Show showOk = new Show();
showOk.name = "Tout le monde en parle";
Show showNok = new Show();
showNok.name = null;
tv.shows.put( "Midnight", showOk );
tv.shows.put( "Primetime", showNok );
ClassValidator validator = new ClassValidator( Tv.class );
InvalidValue[] values = validator.getInvalidValues( tv );
assertEquals( 1, values.length );
assertEquals( "shows['Primetime'].name", values[0].getPropertyPath() );
}
public void testArray() throws Exception {
Tv tv = new Tv();
tv.name = "France 2";
Movie movieOk = new Movie();
movieOk.name = "Kill Bill";
Movie movieNok = new Movie();
movieNok.name = null;
tv.movies = new Movie[]{
movieOk,
null,
movieNok
};
ClassValidator validator = new ClassValidator( Tv.class );
InvalidValue[] values = validator.getInvalidValues( tv );
assertEquals( 1, values.length );
assertEquals( "movies[2].name", values[0].getPropertyPath() );
}
}
././@LongLink 0000000 0000000 0000000 00000000202 00000000000 011557 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/collections/Movie.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000403 11052766205 033427 0 ustar twerner twerner //$Id: Movie.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.collections;
import org.hibernate.validator.NotNull;
/**
* @author Emmanuel Bernard
*/
public class Movie {
@NotNull
public String name;
}
././@LongLink 0000000 0000000 0000000 00000000163 00000000000 011565 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/Tv.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000001035 11131662636 033432 0 ustar twerner twerner //$Id: Tv.java 15765 2009-01-09 14:56:30Z hardy.ferentschik $
package org.hibernate.validator.test;
import java.math.BigInteger;
import java.util.Date;
import org.hibernate.validator.Future;
import org.hibernate.validator.Length;
import org.hibernate.validator.Min;
/**
* @author Emmanuel Bernard
*/
public class Tv {
@Length(max = 2)
public String serial;
public int size;
@Length(max = 2)
public String name;
@Future
public Date expDate;
@Length(min = 0)
public String description;
@Min(1000)
public BigInteger lifetime;
}
././@LongLink 0000000 0000000 0000000 00000000165 00000000000 011567 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/Vase.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000351 11131662636 033432 0 ustar twerner twerner //$Id: Vase.java 15765 2009-01-09 14:56:30Z hardy.ferentschik $
package org.hibernate.validator.test;
/**
* A vase has to be Serializable to fit in luggages
*
* @author Emmanuel Bernard
*/
@Serializability
public class Vase {
}
././@LongLink 0000000 0000000 0000000 00000000202 00000000000 011557 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/InterpolationTest.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000002264 11052766205 033436 0 ustar twerner twerner //$Id: InterpolationTest.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test;
import java.util.MissingResourceException;
import junit.framework.TestCase;
import org.hibernate.validator.ClassValidator;
import org.hibernate.validator.InvalidValue;
/**
* @author Emmanuel Bernard
*/
public class InterpolationTest extends TestCase {
public void testMissingKey() {
Building b = new Building();
b.setAddress( "2323 Younge St");
ClassValidator validator = new ClassValidator(Building.class);
try {
validator.getInvalidValues( b );
}
catch (MissingResourceException e) {
fail("message should be interpolated lazily in DefaultMessageInterpolator");
}
b = new Building();
b.setAddress("");
boolean failure = false;
InvalidValue[] invalidValues = validator.getInvalidValues( b );
assertNotSame( "Should have a failure here", 0, invalidValues.length );
assertEquals( "Missing key should be left unchanged",
"{notpresent.Key} and #{key.notPresent} and {key.notPresent2} 1",
invalidValues[0].getMessage() );
}
}
././@LongLink 0000000 0000000 0000000 00000000211 00000000000 011557 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/SerializabilityValidator.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000773 11131662636 033442 0 ustar twerner twerner //$Id: SerializabilityValidator.java 15765 2009-01-09 14:56:30Z hardy.ferentschik $
package org.hibernate.validator.test;
import java.io.Serializable;
import org.hibernate.validator.Validator;
/**
* Sample of a bean-level validator
*
* @author Emmanuel Bernard
*/
public class SerializabilityValidator implements Validator, Serializable {
public boolean isValid(Object value) {
return value instanceof Serializable;
}
public void initialize(Serializability parameters) {
}
}
././@LongLink 0000000 0000000 0000000 00000000171 00000000000 011564 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/Building.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000001071 11052766205 033431 0 ustar twerner twerner //$Id: Building.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test;
import org.hibernate.validator.Length;
/**
* @author Emmanuel Bernard
*/
public class Building {
private Long id;
@Length( min = 1, message = "{notpresent.Key} and #{key.notPresent} and {key.notPresent2} {min}" )
private String address;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}
././@LongLink 0000000 0000000 0000000 00000000165 00000000000 011567 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/Site.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000001327 11131662636 033436 0 ustar twerner twerner //$Id: Site.java 15765 2009-01-09 14:56:30Z hardy.ferentschik $
package org.hibernate.validator.test;
import org.hibernate.validator.NotNull;
import org.hibernate.validator.Valid;
/**
* @author Emmanuel Bernard
*/
public class Site {
@NotNull
private String siteName;
@Valid
private Address address;
@Valid
private Contact contact;
public String getSiteName() {
return siteName;
}
public void setSiteName(String siteName) {
this.siteName = siteName;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public Contact getContact() {
return contact;
}
public void setContact(Contact contact) {
this.contact = contact;
}
} ././@LongLink 0000000 0000000 0000000 00000000165 00000000000 011567 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/User.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000455 11131662636 033437 0 ustar twerner twerner //$Id: User.java 15765 2009-01-09 14:56:30Z hardy.ferentschik $
package org.hibernate.validator.test;
import org.hibernate.validator.Email;
import org.hibernate.validator.NotNull;
/**
* @author Emmanuel Bernard
*/
public class User {
@NotNull
public String name;
@Email
public String email;
}
././@LongLink 0000000 0000000 0000000 00000000170 00000000000 011563 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/inheritance/ libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000755 0001750 0001750 00000000000 11402110371 033412 5 ustar twerner twerner ././@LongLink 0000000 0000000 0000000 00000000206 00000000000 011563 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/inheritance/BoneEater.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000504 11131662636 033432 0 ustar twerner twerner //$Id: BoneEater.java 15765 2009-01-09 14:56:30Z hardy.ferentschik $
package org.hibernate.validator.test.inheritance;
import org.hibernate.validator.NotNull;
/**
* @author Emmanuel Bernard
*/
public interface BoneEater extends Eater {
@NotNull
String getFavoriteBone();
void setFavoriteBone(String favoriteBone);
}
././@LongLink 0000000 0000000 0000000 00000000214 00000000000 011562 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/inheritance/InheritanceTest.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000001355 11131662636 033437 0 ustar twerner twerner //$Id: InheritanceTest.java 15765 2009-01-09 14:56:30Z hardy.ferentschik $
package org.hibernate.validator.test.inheritance;
import junit.framework.TestCase;
import org.hibernate.validator.ClassValidator;
import org.hibernate.validator.InvalidValue;
/**
* @author Emmanuel Bernard
*/
public class InheritanceTest extends TestCase {
public void testInheritance() throws Exception {
ClassValidator classValidator = new ClassValidator( Dog.class );
Dog dog = new Dog();
InvalidValue[] invalidValues = classValidator.getInvalidValues( dog );
assertEquals( 3, invalidValues.length );
dog.setFavoriteBone( "DE" ); //failure
invalidValues = classValidator.getInvalidValues( dog );
assertEquals( 3, invalidValues.length );
}
}
././@LongLink 0000000 0000000 0000000 00000000202 00000000000 011557 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/inheritance/Eater.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000432 11131662636 033432 0 ustar twerner twerner //$Id: Eater.java 15765 2009-01-09 14:56:30Z hardy.ferentschik $
package org.hibernate.validator.test.inheritance;
import org.hibernate.validator.Min;
/**
* @author Emmanuel Bernard
*/
public interface Eater {
@Min(2)
int getFrequency();
void setFrequency(int frequency);
}
././@LongLink 0000000 0000000 0000000 00000000203 00000000000 011560 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/inheritance/Animal.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000555 11131662636 033440 0 ustar twerner twerner //$Id: Animal.java 15765 2009-01-09 14:56:30Z hardy.ferentschik $
package org.hibernate.validator.test.inheritance;
import java.io.Serializable;
/**
* @author Emmanuel Bernard
*/
public class Animal implements Serializable, Name {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
././@LongLink 0000000 0000000 0000000 00000000200 00000000000 011555 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/inheritance/Dog.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000001207 11131662636 033433 0 ustar twerner twerner //$Id: Dog.java 15765 2009-01-09 14:56:30Z hardy.ferentschik $
package org.hibernate.validator.test.inheritance;
import java.io.Serializable;
import org.hibernate.validator.Length;
/**
* @author Emmanuel Bernard
*/
public class Dog extends Animal implements Serializable, BoneEater {
private String favoriteBone;
private int frequency;
@Length(min = 3)
public String getFavoriteBone() {
return favoriteBone;
}
public void setFavoriteBone(String favoriteBone) {
this.favoriteBone = favoriteBone;
}
public int getFrequency() {
return frequency;
}
public void setFrequency(int frequency) {
this.frequency = frequency;
}
}
././@LongLink 0000000 0000000 0000000 00000000201 00000000000 011556 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/inheritance/Name.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000424 11131662636 033433 0 ustar twerner twerner //$Id: Name.java 15765 2009-01-09 14:56:30Z hardy.ferentschik $
package org.hibernate.validator.test.inheritance;
import org.hibernate.validator.NotNull;
/**
* @author Emmanuel Bernard
*/
public interface Name {
@NotNull
String getName();
void setName(String name);
}
././@LongLink 0000000 0000000 0000000 00000000162 00000000000 011564 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/valid/ libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000755 0001750 0001750 00000000000 11402110373 033414 5 ustar twerner twerner ././@LongLink 0000000 0000000 0000000 00000000173 00000000000 011566 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/valid/Form.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000560 11052766205 033433 0 ustar twerner twerner //$Id: Form.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.valid;
import org.hibernate.validator.Valid;
/**
* @author Emmanuel Bernard
*/
public class Form {
private Member member;
@Valid
public Member getMember() {
return member;
}
public void setMember(Member m) {
this.member = m;
}
}
././@LongLink 0000000 0000000 0000000 00000000175 00000000000 011570 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/valid/Member.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000612 11052766205 033431 0 ustar twerner twerner //$Id: Member.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.valid;
import org.hibernate.validator.Valid;
/**
* @author Emmanuel Bernard
*/
public class Member {
private Address address;
@Valid
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
}
././@LongLink 0000000 0000000 0000000 00000000176 00000000000 011571 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/valid/Address.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000000467 11052766205 033441 0 ustar twerner twerner //$Id: Address.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.valid;
import org.hibernate.validator.NotNull;
/**
* @author Emmanuel Bernard
*/
public class Address {
private String city;
@NotNull
public String getCity() {
return city;
}
}
././@LongLink 0000000 0000000 0000000 00000000200 00000000000 011555 L ustar root root libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validator/test/valid/ValidTest.java libhibernate-validator-java-4.0.2.GA/hibernate-validator-legacy/src/test/java/org/hibernate/validato0000644 0001750 0001750 00000001257 11052766205 033437 0 ustar twerner twerner //$Id: ValidTest.java 15133 2008-08-20 10:05:57Z hardy.ferentschik $
package org.hibernate.validator.test.valid;
import junit.framework.TestCase;
import org.hibernate.validator.ClassValidator;
import org.hibernate.validator.InvalidValue;
/**
* @author Emmanuel Bernard
*/
public class ValidTest extends TestCase {
public void testDeepValid() throws Exception {
ClassValidator