Hibernate SVN: r17592 - validator/trunk/hibernate-validator-tck-runner.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-09-30 14:17:06 -0400 (Wed, 30 Sep 2009)
New Revision: 17592
Modified:
validator/trunk/hibernate-validator-tck-runner/pom.xml
Log:
Updated to the latest jboss-test-harness version.
Also cahnged to running the test harness against jboss 5.1 for in-container mode.
Got rid of the obsolete setupJBoss profile
Modified: validator/trunk/hibernate-validator-tck-runner/pom.xml
===================================================================
--- validator/trunk/hibernate-validator-tck-runner/pom.xml 2009-09-30 18:15:12 UTC (rev 17591)
+++ validator/trunk/hibernate-validator-tck-runner/pom.xml 2009-09-30 18:17:06 UTC (rev 17592)
@@ -36,13 +36,13 @@
</dependency>
<dependency>
<groupId>org.jboss.test-harness</groupId>
- <artifactId>jboss-test-harness-jboss-as-50</artifactId>
- <version>1.0.0.BETA3</version>
+ <artifactId>jboss-test-harness-jboss-as-51</artifactId>
+ <version>1.0.0</version>
</dependency>
</dependencies>
<properties>
- <jboss.home>/opt/java/jboss-5</jboss.home>
+ <jboss.home>/opt/java/jboss-5.1.0.GA</jboss.home>
<validation.provider>org.hibernate.validator.HibernateValidator</validation.provider>
<remote.debug />
</properties>
@@ -242,45 +242,5 @@
</plugins>
</build>
</profile>
- <profile>
- <id>setup-jboss-as</id>
- <activation>
- <property>
- <name>setupJBoss</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <phase>initialize</phase>
- <configuration>
- <tasks>
- <property name="deploy.dir" value="${jboss.home}/server/default/deployers/tck-303.deployer" />
- <property name="remote.repo" value="http://repository.jboss.com/maven2" />
- <property name="artifact.version" value="5.2.0.Beta2" />
- <property name="artifact.name" value="webbeans-jboss-int-deployer-${artifact.version}" />
- <delete dir="${deploy.dir}" failonerror="false" />
- <mkdir dir="${basedir}/target/download" />
- <get src="${remote.repo}/org/jboss/webbeans/integration/webbeans-jboss-int-deployer/${artifact.version}/${artifact.name}.zip" dest="${basedir}/target/download/${artifact.name}.zip" verbose="true" usetimestamp="true" />
- <unzip dest="target" src="${basedir}/target/download/${artifact.name}.zip" />
- <copy todir="${deploy.dir}">
- <fileset dir="target/webbeans.deployer">
- <include name="**/*" />
- </fileset>
- </copy>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
</profiles>
</project>
15 years, 4 months
Hibernate SVN: r17591 - in beanvalidation/tck/trunk: src/main/java/org/hibernate/jsr303/tck/util and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-09-30 14:15:12 -0400 (Wed, 30 Sep 2009)
New Revision: 17591
Modified:
beanvalidation/tck/trunk/pom.xml
beanvalidation/tck/trunk/src/main/java/org/hibernate/jsr303/tck/util/StandaloneContainersImpl.java
Log:
Updated to the latest jboss-test-harness version
Modified: beanvalidation/tck/trunk/pom.xml
===================================================================
--- beanvalidation/tck/trunk/pom.xml 2009-09-30 18:11:35 UTC (rev 17590)
+++ beanvalidation/tck/trunk/pom.xml 2009-09-30 18:15:12 UTC (rev 17591)
@@ -49,17 +49,17 @@
<dependency>
<groupId>org.jboss.test-audit</groupId>
<artifactId>jboss-test-audit-api</artifactId>
- <version>1.0.0.BETA1</version>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.jboss.test-harness</groupId>
<artifactId>jboss-test-harness-api</artifactId>
- <version>1.0.0.BETA3</version>
+ <version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.jboss.test-harness</groupId>
<artifactId>jboss-test-harness</artifactId>
- <version>1.0.0.BETA3</version>
+ <version>1.0.0</version>
</dependency>
</dependencies>
Modified: beanvalidation/tck/trunk/src/main/java/org/hibernate/jsr303/tck/util/StandaloneContainersImpl.java
===================================================================
--- beanvalidation/tck/trunk/src/main/java/org/hibernate/jsr303/tck/util/StandaloneContainersImpl.java 2009-09-30 18:11:35 UTC (rev 17590)
+++ beanvalidation/tck/trunk/src/main/java/org/hibernate/jsr303/tck/util/StandaloneContainersImpl.java 2009-09-30 18:15:12 UTC (rev 17591)
@@ -22,6 +22,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
+import java.util.Collection;
import org.jboss.testharness.api.DeploymentException;
import org.jboss.testharness.spi.StandaloneContainers;
@@ -41,7 +42,10 @@
public void cleanup() {
}
- public boolean deploy(Iterable<Class<?>> classes, Iterable<URL> validationXmls) {
+ public void deploy(Collection<Class<?>> classes) throws DeploymentException {
+ }
+
+ public boolean deploy(Collection<Class<?>> classes, Collection<URL> validationXmls) {
if ( validationXmls == null || !validationXmls.iterator().hasNext() ) {
Thread.currentThread()
.setContextClassLoader( new IgnoringValidationXmlClassLoader() );
15 years, 4 months
Hibernate SVN: r17590 - in beanvalidation/api/trunk/src/main/java/javax/validation: constraints and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2009-09-30 14:11:35 -0400 (Wed, 30 Sep 2009)
New Revision: 17590
Modified:
beanvalidation/api/trunk/src/main/java/javax/validation/ConstraintViolationException.java
beanvalidation/api/trunk/src/main/java/javax/validation/constraints/AssertFalse.java
beanvalidation/api/trunk/src/main/java/javax/validation/constraints/AssertTrue.java
beanvalidation/api/trunk/src/main/java/javax/validation/constraints/DecimalMax.java
beanvalidation/api/trunk/src/main/java/javax/validation/constraints/DecimalMin.java
beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Digits.java
beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Future.java
beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Max.java
beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Min.java
beanvalidation/api/trunk/src/main/java/javax/validation/constraints/NotNull.java
beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Null.java
beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Past.java
beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Pattern.java
beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Size.java
beanvalidation/api/trunk/src/main/java/javax/validation/metadata/BeanDescriptor.java
beanvalidation/api/trunk/src/main/java/javax/validation/metadata/ConstraintDescriptor.java
beanvalidation/api/trunk/src/main/java/javax/validation/metadata/ElementDescriptor.java
beanvalidation/api/trunk/src/main/java/javax/validation/metadata/PropertyDescriptor.java
Log:
Enhance JavaDoc
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/ConstraintViolationException.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/ConstraintViolationException.java 2009-09-30 17:36:15 UTC (rev 17589)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/ConstraintViolationException.java 2009-09-30 18:11:35 UTC (rev 17590)
@@ -20,7 +20,7 @@
import java.util.Set;
/**
- * Report the result of constraint violations
+ * Reports the result of constraint violations
* `
* @author Emmanuel Bernard
*/
@@ -31,7 +31,7 @@
* Creates a constraint violation report
*
* @param message error message
- * @param constraintViolations Set of ConstraintViolation
+ * @param constraintViolations <code>Set</code> of <code>ConstraintViolation</code>
*/
public ConstraintViolationException(String message,
Set<ConstraintViolation<?>> constraintViolations) {
@@ -42,7 +42,7 @@
/**
* Creates a constraint violation report
*
- * @param constraintViolations Set of ConstraintViolation
+ * @param constraintViolations <code>Set</code> of <code>ConstraintViolation</code>
*/
public ConstraintViolationException(Set<ConstraintViolation<?>> constraintViolations) {
super();
@@ -52,7 +52,7 @@
/**
* Set of constraint violations reported during a validation
*
- * @return Set of CosntraintViolation
+ * @return <code>Set</code> of <code>ConstraintViolation</code>
*/
public Set<ConstraintViolation<?>> getConstraintViolations() {
return constraintViolations;
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/constraints/AssertFalse.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/constraints/AssertFalse.java 2009-09-30 17:36:15 UTC (rev 17589)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/constraints/AssertFalse.java 2009-09-30 18:11:35 UTC (rev 17590)
@@ -49,7 +49,7 @@
Class<? extends Payload>[] payload() default {};
/**
- * Defines several @AssertFalse annotations on the same element
+ * Defines several <code>@AssertFalse</code> annotations on the same element
* @see javax.validation.constraints.AssertFalse
*
* @author Emmanuel Bernard
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/constraints/AssertTrue.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/constraints/AssertTrue.java 2009-09-30 17:36:15 UTC (rev 17589)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/constraints/AssertTrue.java 2009-09-30 18:11:35 UTC (rev 17590)
@@ -46,7 +46,7 @@
Class<? extends Payload>[] payload() default {};
/**
- * Defines several @AssertTrue annotations on the same element
+ * Defines several <code>@AssertTrue</code> annotations on the same element
* @see AssertTrue
*
* @author Emmanuel Bernard
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/constraints/DecimalMax.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/constraints/DecimalMax.java 2009-09-30 17:36:15 UTC (rev 17589)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/constraints/DecimalMax.java 2009-09-30 18:11:35 UTC (rev 17590)
@@ -57,15 +57,15 @@
Class<? extends Payload>[] payload() default {};
/**
- * The String representation of the max value according to the
- * BigDecimal string representation
+ * The <code>String</code> representation of the max value according to the
+ * <code>BigDecimal</code> string representation
*
* @return value the element must be lower or equal to
*/
String value();
/**
- * Defines several @DecimalMax annotations on the same element
+ * Defines several <code>@DecimalMax</code> annotations on the same element
*
* @author Emmanuel Bernard
* @see DecimalMax
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/constraints/DecimalMin.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/constraints/DecimalMin.java 2009-09-30 17:36:15 UTC (rev 17589)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/constraints/DecimalMin.java 2009-09-30 18:11:35 UTC (rev 17590)
@@ -57,14 +57,14 @@
Class<? extends Payload>[] payload() default {};
/**
- * The String representation of the min value according to the
- * BigDecimal string representation
+ * The <code>String</code> representation of the min value according to the
+ * <code>BigDecimal</code> string representation
* @return value the element must be higher or equal to
*/
String value();
/**
- * Defines several @DecimalMin annotations on the same element
+ * Defines several <code>@DecimalMin</code> annotations on the same element
* @see DecimalMin
*
* @author Emmanuel Bernard
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Digits.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Digits.java 2009-09-30 17:36:15 UTC (rev 17589)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Digits.java 2009-09-30 18:11:35 UTC (rev 17590)
@@ -63,7 +63,7 @@
int fraction();
/**
- * Defines several @Digits annotations on the same element
+ * Defines several <code>@Digits</code> annotations on the same element
* @see Digits
*
* @author Emmanuel Bernard
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Future.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Future.java 2009-09-30 17:36:15 UTC (rev 17589)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Future.java 2009-09-30 18:11:35 UTC (rev 17590)
@@ -54,7 +54,7 @@
Class<? extends Payload>[] payload() default {};
/**
- * Defines several @Future annotations on the same element
+ * Defines several <code>@Future</code> annotations on the same element
* @see Future
*
* @author Emmanuel Bernard
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Max.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Max.java 2009-09-30 17:36:15 UTC (rev 17589)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Max.java 2009-09-30 18:11:35 UTC (rev 17590)
@@ -61,7 +61,7 @@
long value();
/**
- * Defines several @Max annotations on the same element
+ * Defines several <code>@Max</code> annotations on the same element
* @see Max
*
* @author Emmanuel Bernard
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Min.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Min.java 2009-09-30 17:36:15 UTC (rev 17589)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Min.java 2009-09-30 18:11:35 UTC (rev 17590)
@@ -61,7 +61,7 @@
long value();
/**
- * Defines several @Min annotations on the same element
+ * Defines several <code>@Min</code> annotations on the same element
* @see Min
*
* @author Emmanuel Bernard
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/constraints/NotNull.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/constraints/NotNull.java 2009-09-30 17:36:15 UTC (rev 17589)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/constraints/NotNull.java 2009-09-30 18:11:35 UTC (rev 17590)
@@ -44,7 +44,7 @@
Class<? extends Payload>[] payload() default {};
/**
- * Defines several @NotNull annotations on the same element
+ * Defines several <code>@NotNull</code> annotations on the same element
* @see javax.validation.constraints.NotNull
*
* @author Emmanuel Bernard
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Null.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Null.java 2009-09-30 17:36:15 UTC (rev 17589)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Null.java 2009-09-30 18:11:35 UTC (rev 17590)
@@ -27,7 +27,7 @@
import javax.validation.Payload;
/**
- * The annotated element must be null.
+ * The annotated element must be <code>null</code>.
* Accepts any type.
*
* @author Emmanuel Bernard
@@ -44,7 +44,7 @@
Class<? extends Payload>[] payload() default {};
/**
- * Defines several @Null annotations on the same element
+ * Defines several <code>@Null</code> annotations on the same element
* @see javax.validation.constraints.Null
*
* @author Emmanuel Bernard
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Past.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Past.java 2009-09-30 17:36:15 UTC (rev 17589)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Past.java 2009-09-30 18:11:35 UTC (rev 17590)
@@ -54,7 +54,7 @@
Class<? extends Payload>[] payload() default {};
/**
- * Defines several @Past annotations on the same element
+ * Defines several <code>@Past</code> annotations on the same element
* @see Past
*
* @author Emmanuel Bernard
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Pattern.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Pattern.java 2009-09-30 17:36:15 UTC (rev 17589)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Pattern.java 2009-09-30 18:11:35 UTC (rev 17590)
@@ -46,7 +46,7 @@
String regexp();
/**
- * @return Array of <code>Flag</code> enumeration instances considered when resolving the regular expression.
+ * @return Array of <code>Flag</code>s considered when resolving the regular expression.
*/
Flag[] flags() default {};
@@ -128,7 +128,7 @@
}
/**
- * Defines several @Pattern annotations on the same element
+ * Defines several <code>@Pattern</code> annotations on the same element
* @see Pattern
*
* @author Emmanuel Bernard
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Size.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Size.java 2009-09-30 17:36:15 UTC (rev 17589)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/constraints/Size.java 2009-09-30 18:11:35 UTC (rev 17590)
@@ -62,7 +62,7 @@
int max() default Integer.MAX_VALUE;
/**
- * Defines several @Size annotations on the same element
+ * Defines several <code>@Size</code> annotations on the same element
* @see Size
*
* @author Emmanuel Bernard
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/metadata/BeanDescriptor.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/metadata/BeanDescriptor.java 2009-09-30 17:36:15 UTC (rev 17589)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/metadata/BeanDescriptor.java 2009-09-30 18:11:35 UTC (rev 17590)
@@ -20,17 +20,17 @@
import java.util.Set;
/**
- * Describe a constrained Java Bean and the constraints associated to it.
+ * Describes a constrained Java Bean and the constraints associated to it.
*
* @author Emmanuel Bernard
*/
public interface BeanDescriptor extends ElementDescriptor {
/**
- * Returns true if the bean involves validation:
+ * Returns <code>true</code> if the bean involves validation:
* <ul>
* <li> a constraint is hosted on the bean itself </li>
- * <li> a constraint is hosted on one of the bean properties </li>
- * <li> or a bean property is marked for cascade (@Valid) </li>
+ * <li> a constraint is hosted on one of the bean properties</li>
+ * <li> or a bean property is marked for cascade (<code>@Valid</code>)</li>
* </ul>
*
* @return <code>true</code> if the bean involves validation, <code>false</code> otherwise.
@@ -42,7 +42,7 @@
* Return <code>null</code> if the property does not exist or has no
* constraint nor is marked as cascaded (see {@link #getConstrainedProperties()} )
* <p/>
- * The returned object (and associated objects including ConstraintDescriptors)
+ * The returned object (and associated objects including <code>ConstraintDescriptor</code>s)
* are immutable.
*
* @param propertyName property evaluated
@@ -54,8 +54,9 @@
PropertyDescriptor getConstraintsForProperty(String propertyName);
/**
- * @return the property descriptors having at least one constraint defined or which are marked
- * as cascaded (@Valid) or an empty set.
+ * Returns a set of property descriptors having at least one constraint defined
+ * or marked as cascaded (<code>@Valid<c/ode>). If not property matches,
+ * an empty set is returned.
*/
Set<PropertyDescriptor> getConstrainedProperties();
}
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/metadata/ConstraintDescriptor.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/metadata/ConstraintDescriptor.java 2009-09-30 17:36:15 UTC (rev 17589)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/metadata/ConstraintDescriptor.java 2009-09-30 18:11:35 UTC (rev 17590)
@@ -26,7 +26,7 @@
/**
* Describes a single constraint and its composing constraints.
- * T is the constraint's annotation type.
+ * <code>T</code> is the constraint's annotation type.
*
* @author Emmanuel Bernard
* @author Hardy Ferentschik
@@ -42,7 +42,7 @@
T getAnnotation();
/**
- * The Set of groups the constraint is applied on.
+ * The set of groups the constraint is applied on.
* If the constraint declares no group, a set with only the <code>Default</code>
* group is returned.
*
@@ -51,14 +51,14 @@
Set<Class<?>> getGroups();
/**
- * The Set of payload the constraint hosts.
+ * The set of payload the constraint hosts.
*
* @return payload classes hosted on the constraint or an empty set if none.
*/
Set<Class<? extends Payload>> getPayload();
/**
- * Immutable list of the constraint validation implementation classes.
+ * List of the constraint validation implementation classes.
*
* @return list of the constraint validation implementation classes.
*/
@@ -88,7 +88,7 @@
Set<ConstraintDescriptor<?>> getComposingConstraints();
/**
- * @return true if the constraint is annotated with @ReportAsSingleViolation
+ * @return true if the constraint is annotated with <code>@ReportAsSingleViolation</code>
*/
boolean isReportAsSingleViolation();
}
\ No newline at end of file
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/metadata/ElementDescriptor.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/metadata/ElementDescriptor.java 2009-09-30 17:36:15 UTC (rev 17589)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/metadata/ElementDescriptor.java 2009-09-30 18:11:35 UTC (rev 17590)
@@ -40,9 +40,9 @@
/**
* Return all constraint descriptors for this element or an
- * empty Set if none are present.
+ * empty <code>Set</code> if none are present.
*
- * @return Set of constraint descriptors for this element
+ * @return <code>Set</code> of constraint descriptors for this element
*/
Set<ConstraintDescriptor<?>> getConstraintDescriptors();
@@ -50,9 +50,9 @@
* Return the list of matching constraints for a given set of groups for this element.
*
* This method respects group sequences and group inheritance (including
- * class-level Default group overriding) but does not return ConstraintDescriptors
- * in any particular order. Specifically, ordering of the group sequence is not
- * respected.
+ * class-level <code>Default</code> group overriding) but does not return
+ * <code>ConstraintDescriptor</code>s in any particular order.
+ * Specifically, ordering of the group sequence is not respected.
*
* @param groups groups targeted
* @return list of matching ConstraintDescriptors
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/metadata/PropertyDescriptor.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/metadata/PropertyDescriptor.java 2009-09-30 17:36:15 UTC (rev 17589)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/metadata/PropertyDescriptor.java 2009-09-30 18:11:35 UTC (rev 17590)
@@ -21,7 +21,7 @@
* Describes a Java Bean property hosting validation constraints.
*
* Constraints placed on the attribute and the getter of a given property
- * are all referenced by this object.
+ * are all referenced.
*
* @author Emmanuel Bernard
*/
15 years, 4 months
Hibernate SVN: r17589 - in beanvalidation/api/trunk/src/main/java/javax/validation: bootstrap and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2009-09-30 13:36:15 -0400 (Wed, 30 Sep 2009)
New Revision: 17589
Modified:
beanvalidation/api/trunk/src/main/java/javax/validation/Configuration.java
beanvalidation/api/trunk/src/main/java/javax/validation/Validation.java
beanvalidation/api/trunk/src/main/java/javax/validation/ValidationProviderResolver.java
beanvalidation/api/trunk/src/main/java/javax/validation/bootstrap/GenericBootstrap.java
beanvalidation/api/trunk/src/main/java/javax/validation/bootstrap/ProviderSpecificBootstrap.java
beanvalidation/api/trunk/src/main/java/javax/validation/spi/BootstrapState.java
beanvalidation/api/trunk/src/main/java/javax/validation/spi/ConfigurationState.java
beanvalidation/api/trunk/src/main/java/javax/validation/spi/ValidationProvider.java
Log:
Enhance JavaDoc
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/Configuration.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/Configuration.java 2009-09-30 17:20:44 UTC (rev 17588)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/Configuration.java 2009-09-30 17:36:15 UTC (rev 17589)
@@ -152,8 +152,9 @@
T addProperty(String name, String value);
/**
- * Return an implementation of the MessageInterpolator interface following the
- * default MessageInterpolator defined in the specification:
+ * Return an implementation of the <code>MessageInterpolator</code> interface
+ * following the default <code>MessageInterpolator</code> defined in the
+ * specification:
* <ul>
* <li>use the ValidationMessages resource bundle to load keys</li>
* <li>use Locale.getDefault()</li>
@@ -164,8 +165,9 @@
MessageInterpolator getDefaultMessageInterpolator();
/**
- * Return an implementation of the TraversableResolver interface following the
- * default TraversableResolver defined in the specification:
+ * Return an implementation of the <code>TraversableResolver</code> interface
+ * following the default <code>TraversableResolver</code> defined in the
+ * specification:
* <ul>
* <li>if Java Persistence is available in the runtime environment,
* a property is considered reachable if Java Persistence considers
@@ -180,8 +182,9 @@
TraversableResolver getDefaultTraversableResolver();
/**
- * Return an implementation of the ConstraintValidatorFactory interface following the
- * default ConstraintValidatorFactory defined in the specification:
+ * Return an implementation of the <code>ConstraintValidatorFactory</code> interface
+ * following the default <code>ConstraintValidatorFactory</code> defined in the
+ * specification:
* <ul>
* <li>uses the public no-arg constructor of the <code>ConstraintValidator</code></li>
* </ul>
@@ -191,7 +194,7 @@
ConstraintValidatorFactory getDefaultConstraintValidatorFactory();
/**
- * Build a ValidatorFactory implementation.
+ * Build a <code>ValidatorFactory</code> implementation.
*
* @return ValidatorFactory
* @throws ValidationException if the ValidatorFactory cannot be built
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/Validation.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/Validation.java 2009-09-30 17:20:44 UTC (rev 17588)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/Validation.java 2009-09-30 17:36:15 UTC (rev 17589)
@@ -35,11 +35,11 @@
import javax.validation.spi.ValidationProvider;
/**
- * This class is the entry point for the Bean Validation framework. There are three ways
- * to bootstrap the framework:
+ * This class is the entry point for Bean Validation. There are three ways
+ * to bootstrap it:
* <ul>
* <li>
- * The easiest approach is to build the default ValidatorFactory.
+ * The easiest approach is to build the default <code>ValidatorFactory</code>.
* <pre>{@code ValidatorFactory factory = Validation.buildDefaultValidatorFactory();}</pre>
* In this case, the default validation provider resolver
* will be used to locate available providers.
@@ -47,8 +47,8 @@
* <ul>
* <li>if the XML configuration defines a provider, this provider is used</li>
* <li>if the XML configuration does not define a provider or if no XML configuration
- * is present the first provider returned by the ValidationProviderResolver
- * isntance is used.</li>
+ * is present the first provider returned by the
+ * <code>ValidationProviderResolver</code> instance is used.</li>
* </ul>
* </li>
* <li>
@@ -81,8 +81,8 @@
* Note:<br/>
* <ul>
* <li>
- * The ValidatorFactory object built by the bootstrap process should be cached
- * and shared amongst Validator consumers.
+ * The <code>ValidatorFactory</code> object built by the bootstrap process should be cached
+ * and shared amongst <code>Validator</code> consumers.
* </li>
* <li>
* This class is thread-safe.
@@ -95,9 +95,8 @@
public class Validation {
/**
- * Build and return a ValidatorFactory instance based on the
- * default Bean Validation provider and following the
- * XML configuration.
+ * Build and return a <code>ValidatorFactory</code> instance based on the
+ * default Bean Validation provider and following the XML configuration.
* <p/>
* The provider list is resolved using the default validation provider resolver
* logic.
@@ -147,8 +146,8 @@
* </pre>,
* where <code>ACMEConfiguration</code> is the
* <code>Configuration</code> sub interface uniquely identifying the
- * ACME Bean Validation provider. and ACMEProvider is the ValidationProvider
- * implementation of the ACME provider.
+ * ACME Bean Validation provider. and <code>ACMEProvider</code> is the
+ * <code>ValidationProvider</code> implementation of the ACME provider.
*
* @param providerType the <code>ValidationProvider</code> implementation type
*
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/ValidationProviderResolver.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/ValidationProviderResolver.java 2009-09-30 17:20:44 UTC (rev 17588)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/ValidationProviderResolver.java 2009-09-30 17:36:15 UTC (rev 17589)
@@ -29,7 +29,7 @@
* <a href="http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider">here</a>
* <p/>
* Each META-INF/services/javax.validation.spi.ValidationProvider file contains the list of
- * ValidationProvider implementations each of them representing a provider.
+ * <code>ValidationProvider</code> implementations each of them representing a provider.
* <p/>
* Implementations must be thread-safe.
*
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/bootstrap/GenericBootstrap.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/bootstrap/GenericBootstrap.java 2009-09-30 17:20:44 UTC (rev 17588)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/bootstrap/GenericBootstrap.java 2009-09-30 17:36:15 UTC (rev 17589)
@@ -22,7 +22,7 @@
/**
* Defines the state used to bootstrap Bean Validation and
- * creates a provider agnostic Configuration.
+ * creates a provider agnostic <code>Configuration</code>.
*
* @author Emmanuel Bernard
*/
@@ -30,9 +30,9 @@
/**
* Defines the provider resolution strategy.
* This resolver returns the list of providers evaluated
- * to build the Configuration
+ * to build the <code>Configuration</code>
* <p/>
- * If no resolver is defined, the default ValidationProviderResolver
+ * If no resolver is defined, the default <code>ValidationProviderResolver</code>
* implementation is used.
*
* @return <code>this</code> following the chaining method pattern
@@ -40,11 +40,12 @@
GenericBootstrap providerResolver(ValidationProviderResolver resolver);
/**
- * Returns a generic Configuration implementation.
- * At this stage the provider used to build the ValidatorFactory is not defined.
+ * Returns a generic <code>Configuration</code> implementation.
+ * At this stage the provider used to build the <code>ValidatorFactory</code>
+ * is not defined.
* <p/>
- * The Configuration implementation is provided by the first provider returned
- * by the ValidationProviderResolver strategy.
+ * The <code>Configuration</code> implementation is provided by the first provider
+ * returned by the <code>ValidationProviderResolver</code> strategy.
*
* @return a Configuration implementation compliant with the bootstrap state
* @throws javax.validation.ValidationException if the Configuration object cannot be built
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/bootstrap/ProviderSpecificBootstrap.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/bootstrap/ProviderSpecificBootstrap.java 2009-09-30 17:20:44 UTC (rev 17588)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/bootstrap/ProviderSpecificBootstrap.java 2009-09-30 17:36:15 UTC (rev 17589)
@@ -23,36 +23,37 @@
/**
* Defines the state used to bootstrap Bean Validation and
- * creates a provider specific Configuration <code>T</code>.
+ * creates a provider specific <code>Configuration</code>
+ * of type<code>T</code>.
* <p/>
- * The specific Configuration is linked to the provider via the generic
- * parameter of the ValidationProvider implementation.
+ * The specific <code>Configuration</code> is linked to the provider via the generic
+ * parameter of the <code>ValidationProvider</code> implementation.
* <p/>
* The requested provider is the first provider instance assignable to
- * the requested provider type (known when ProviderSpecificBootstrap is built).
+ * the requested provider type (known when <code>ProviderSpecificBootstrap</code> is built).
* The list of providers evaluated is returned by {@link ValidationProviderResolver}.
- * If no ValidationProviderResolver is defined, the
- * default ValidationProviderResolver strategy is used.
+ * If no <code>ValidationProviderResolver</code> is defined, the
+ * default <code>ValidationProviderResolver</code> strategy is used.
*
* @author Emmanuel Bernard
*/
public interface ProviderSpecificBootstrap<T extends Configuration<T>> {
/**
- * Optionally define the provider resolver implementation used.
- * If not defined, use the default ValidationProviderResolver
+ * Optionally defines the provider resolver implementation used.
+ * If not defined, use the default <code>ValidationProviderResolver</code>
*
- * @param resolver ValidationProviderResolver implementation used
+ * @param resolver <code>ValidationProviderResolver</code> implementation used
*
* @return <code>this</code> following the chaining method pattern
*/
public ProviderSpecificBootstrap<T> providerResolver(ValidationProviderResolver resolver);
/**
- * Determine the provider implementation suitable for T and delegate
- * the creation of this specific Configuration subclass to the provider.
+ * Determines the provider implementation suitable for <code>T</code> and delegates
+ * the creation of this specific <code>Configuration</code> subclass to the provider.
*
- * @return a Configuration sub interface implementation
+ * @return <code>Configuration</code> sub interface implementation
* @throws javax.validation.ValidationException if the Configuration object cannot be built
* this is generally due to an issue with the ValidationProviderResolver
*/
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/spi/BootstrapState.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/spi/BootstrapState.java 2009-09-30 17:20:44 UTC (rev 17588)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/spi/BootstrapState.java 2009-09-30 17:36:15 UTC (rev 17589)
@@ -20,22 +20,23 @@
import javax.validation.ValidationProviderResolver;
/**
- * Defines the state used to bootstrap the Configuration
+ * Defines the state used to bootstrap the <code>Configuration</code>
*
* @author Emmanuel Bernard
* @author Sebastian Thomschke
*/
public interface BootstrapState {
/**
- * User defined ValidationProviderResolver strategy instance or <code>null</code>
- * if undefined.
+ * User defined <code>ValidationProviderResolver</code> strategy
+ * instance or <code>null</code> if undefined.
*
* @return ValidationProviderResolver instance or null
*/
ValidationProviderResolver getValidationProviderResolver();
/**
- * Specification default ValidationProviderResolver strategy instance
+ * Specification default <code>ValidationProviderResolver</code>
+ * strategy instance.
*
* @return default implementation of ValidationProviderResolver
*/
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/spi/ConfigurationState.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/spi/ConfigurationState.java 2009-09-30 17:20:44 UTC (rev 17588)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/spi/ConfigurationState.java 2009-09-30 17:36:15 UTC (rev 17589)
@@ -28,7 +28,8 @@
* Contract between a <code>Configuration</code> and a
* </code>ValidatorProvider</code> to create a <code>ValidatorFactory</code>.
* The configuration artifacts defined in the XML configuration and provided to the
- * <code>Configuration</code> are merged and passed along via ConfigurationState.
+ * <code>Configuration</code> are merged and passed along via
+ * <code>ConfigurationState</code>.
*
* @author Emmanuel Bernard
* @author Hardy Ferentschik
@@ -44,10 +45,10 @@
boolean isIgnoreXmlConfiguration();
/**
- * Returns the message interpolator of this configuration..
+ * Returns the message interpolator of this configuration.
* Message interpolator is defined in the following decreasing priority:
* <ul>
- * <li>set via the Configuration programmatic API</li>
+ * <li>set via the <code>Configuration</code> programmatic API</li>
* <li>defined in META-INF/validation.xml provided that ignoreXmlConfiguration
* is false. In this case the instance is created via its no-arg constructor.</li>
* <li>{@code null} if undefined.</li>
@@ -61,14 +62,14 @@
* Returns a set of configuration streams.
* The streams are defined by:
* <ul>
- * <li>mapping XML streams passed programmatically in Configuration</li>
+ * <li>mapping XML streams passed programmatically in <code>Configuration</code></li>
* <li>mapping XML stream located in the resources defined in</li>
* META-INF/validation.xml (constraint-mapping element)
* </ul>
* Streams represented in the XML configuration and opened by the
- * configuration implementation must be closed by the configuration
- * implementation after the ValidatorFactory creation (or if an exception
- * occurs).
+ * <code>Configuration</code> implementation must be closed by the
+ * <code>Configuration</code> implementation after the <code>ValidatorFactory</code>
+ * creation (or if an exception occurs).
*
* @return set of input stream
*/
@@ -79,7 +80,7 @@
* The {@code ConstraintValidatorFactory} implementation is defined in the following
* decreasing priority:
* <ul>
- * <li>set via the Configuration programmatic API</li>
+ * <li>set via the <code>Configuration</code> programmatic API</li>
* <li>defined in META-INF/validation.xml provided that ignoredXmlConfiguration
* is false. In this case the instance is created via its no-arg constructor.</li>
* <li>{@code null} if undefined.</li>
@@ -91,9 +92,9 @@
/**
* Returns the traversable resolver for this configuration.
- * TraversableResolver is defined in the following decreasing priority:
+ * <code>TraversableResolver</code> is defined in the following decreasing priority:
* <ul>
- * <li>set via the Configuration programmatic API</li>
+ * <li>set via the <code>Configuration</code> programmatic API</li>
* <li>defined in META-INF/validation.xml provided that ignoredXmlConfiguration
* is false. In this case the instance is created via its no-arg constructor.</li>
* <li>{@code null} if undefined.</li>
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/spi/ValidationProvider.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/spi/ValidationProvider.java 2009-09-30 17:20:44 UTC (rev 17588)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/spi/ValidationProvider.java 2009-09-30 17:36:15 UTC (rev 17589)
@@ -35,10 +35,10 @@
public interface ValidationProvider<T extends Configuration<T>> {
/**
- * Returns a Configuration instance implementing <code>T</code>,
+ * Returns a <code>Configuration</code> instance implementing <code>T</code>,
* the <code>Configuration</code> subinterface.
- * The returned Configuration instance must use the current provider (<code>this</code>)
- * to build the ValidatorFactory instance.
+ * The returned <code>Configuration</code> instance must use the current provider
+ * (<code>this</code>) to build the <code>ValidatorFactory</code> instance.
* <p/>
*
* @param state bootstrap state
@@ -48,13 +48,13 @@
T createSpecializedConfiguration(BootstrapState state);
/**
- * Returns a Configuration instance. This instance is not bound to
+ * Returns a <code>Configuration</code> instance. This instance is not bound to
* use the current provider. The choice of provider follows the algorithm described
* in {@link javax.validation.Configuration}
* <p/>
- * The ValidationProviderResolver used by <code>Configuration</code>
+ * The <code>ValidationProviderResolver</code> used by <code>Configuration</code>
* is provided by <code>state</code>.
- * If null, the default ValidationProviderResolver is used.
+ * If null, the default <code>ValidationProviderResolver</code> is used.
*
* @param state bootstrap state
*
@@ -63,11 +63,11 @@
Configuration<?> createGenericConfiguration(BootstrapState state);
/**
- * Build a ValidatorFactory using the current provider implementation. The
- * ValidatorFactory is assembled and follows the configuration passed
- * via ConfigurationState.
+ * Build a <code>ValidatorFactory</code> using the current provider implementation.
+ * The <code>ValidatorFactory</code> is assembled and follows the configuration passed
+ * via <code>ConfigurationState</code>.
* <p>
- * The returned ValidatorFactory is properly initialized and ready for use.
+ * The returned <code>ValidatorFactory</code> is properly initialized and ready for use.
* </p>
*
* @param configurationState the configuration descriptor
15 years, 4 months
Hibernate SVN: r17588 - in core/branches/envers-hibernate-3.3/src: main/java/org/hibernate/envers/entities/mapper/relation/lazy and 8 other directories.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2009-09-30 13:20:44 -0400 (Wed, 30 Sep 2009)
New Revision: 17588
Added:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/proxy/
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/proxy/ProxyIdentifier.java
Removed:
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/proxy/ProxyIdentifier.java
Modified:
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/entities/mapper/relation/ToOneIdMapper.java
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/AbstractDelegateSessionImplementor.java
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/ToOneDelegateSessionImplementor.java
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/event/AuditEventListener.java
core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/tools/Tools.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/UnversionedStrTestEntity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytoone/unidirectional/TargetNotAuditedEntity.java
core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytoone/unidirectional/RelationNotAuditedTarget.java
core/branches/envers-hibernate-3.3/src/test/resources/testng.xml
Log:
svn merge -r 17583:17587 https://svn.jboss.org/repos/hibernate/core/trunk/envers .
Modified: core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/entities/mapper/relation/ToOneIdMapper.java
===================================================================
--- core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/entities/mapper/relation/ToOneIdMapper.java 2009-09-30 17:16:01 UTC (rev 17587)
+++ core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/entities/mapper/relation/ToOneIdMapper.java 2009-09-30 17:20:44 UTC (rev 17588)
@@ -82,7 +82,7 @@
Class<?> entityClass = ReflectionTools.loadClass(referencedEntityName);
value = versionsReader.getSessionImplementor().getFactory().getEntityPersister(referencedEntityName).
- createProxy(null, new ToOneDelegateSessionImplementor(versionsReader, entityClass, entityId, revision, verCfg));
+ createProxy((Serializable)entityId, new ToOneDelegateSessionImplementor(versionsReader, entityClass, entityId, revision, verCfg));
}
}
Modified: core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/AbstractDelegateSessionImplementor.java
===================================================================
--- core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/AbstractDelegateSessionImplementor.java 2009-09-30 17:16:01 UTC (rev 17587)
+++ core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/AbstractDelegateSessionImplementor.java 2009-09-30 17:20:44 UTC (rev 17588)
@@ -57,7 +57,7 @@
* @author Adam Warski (adam at warski dot org)
*/
public abstract class AbstractDelegateSessionImplementor implements SessionImplementor {
- private SessionImplementor delegate;
+ protected SessionImplementor delegate;
public AbstractDelegateSessionImplementor(SessionImplementor delegate) {
this.delegate = delegate;
Modified: core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/ToOneDelegateSessionImplementor.java
===================================================================
--- core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/ToOneDelegateSessionImplementor.java 2009-09-30 17:16:01 UTC (rev 17587)
+++ core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/ToOneDelegateSessionImplementor.java 2009-09-30 17:20:44 UTC (rev 17588)
@@ -31,7 +31,6 @@
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.HibernateException;
-import org.hibernate.Session;
/**
* @author Adam Warski (adam at warski dot org)
@@ -62,8 +61,7 @@
if (notVersionedEntityConfiguration == null) {
return versionsReader.find(entityClass, entityId, revision);
} else {
- Session session = versionsReader.getSession();
- return session.get(entityClass, (Serializable) entityId);
+ return delegate.immediateLoad(entityName, (Serializable) entityId);
}
}
}
Modified: core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/event/AuditEventListener.java
===================================================================
--- core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/event/AuditEventListener.java 2009-09-30 17:16:01 UTC (rev 17587)
+++ core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/event/AuditEventListener.java 2009-09-30 17:20:44 UTC (rev 17588)
@@ -105,7 +105,7 @@
toEntityName = session.bestGuessEntityName(newValue);
id = hibernateProxy.getHibernateLazyInitializer().getIdentifier();
// We've got to initialize the object from the proxy to later read its state.
- newValue = Tools.getTargetFromProxy(hibernateProxy);
+ newValue = Tools.getTargetFromProxy(session.getFactory(), hibernateProxy);
} else {
toEntityName = session.guessEntityName(newValue);
@@ -125,7 +125,7 @@
toEntityName = session.bestGuessEntityName(oldValue);
id = hibernateProxy.getHibernateLazyInitializer().getIdentifier();
// We've got to initialize the object as we'll read it's state anyway.
- oldValue = Tools.getTargetFromProxy(hibernateProxy);
+ oldValue = Tools.getTargetFromProxy(session.getFactory(), hibernateProxy);
} else {
toEntityName = session.guessEntityName(oldValue);
Modified: core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/tools/Tools.java
===================================================================
--- core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/tools/Tools.java 2009-09-30 17:16:01 UTC (rev 17587)
+++ core/branches/envers-hibernate-3.3/src/main/java/org/hibernate/envers/tools/Tools.java 2009-09-30 17:20:44 UTC (rev 17588)
@@ -25,6 +25,7 @@
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.engine.SessionImplementor;
+import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.Session;
import java.util.*;
@@ -66,20 +67,21 @@
return session.getEntityPersister(null, obj).getIdentifier(obj, session.getEntityMode());
}
- public static Object getTargetFromProxy(HibernateProxy proxy) {
- if (!proxy.getHibernateLazyInitializer().isUninitialized()) {
- return proxy.getHibernateLazyInitializer().getImplementation();
- }
+ public static Object getTargetFromProxy(SessionFactoryImplementor sessionFactoryImplementor, HibernateProxy proxy) {
+ if (!proxy.getHibernateLazyInitializer().isUninitialized()) {
+ return proxy.getHibernateLazyInitializer().getImplementation();
+ }
- Session tempSession = proxy.getHibernateLazyInitializer().getSession().getFactory().openTemporarySession();
- try {
- proxy.getHibernateLazyInitializer().setSession((SessionImplementor) tempSession);
- proxy.getHibernateLazyInitializer().initialize();
- return proxy.getHibernateLazyInitializer().getImplementation();
- } finally {
- tempSession.close();
- }
- }
+ SessionImplementor sessionImplementor = proxy.getHibernateLazyInitializer().getSession();
+ Session tempSession = sessionImplementor==null ? sessionFactoryImplementor.openTemporarySession() : sessionImplementor.getFactory().openTemporarySession();
+ try {
+ proxy.getHibernateLazyInitializer().setSession((SessionImplementor) tempSession);
+ proxy.getHibernateLazyInitializer().initialize();
+ return proxy.getHibernateLazyInitializer().getImplementation();
+ } finally {
+ tempSession.close();
+ }
+ }
public static boolean objectsEqual(Object obj1, Object obj2) {
if (obj1 == null) {
@@ -113,7 +115,7 @@
}
/**
- * Transforms a list of arbitrary elements to a list of index-element pairs.
+ * Transforms a list of arbitrary elements to a list of index-element pairs.
* @param list List to transform.
* @return A list of pairs: ((0, element_at_index_0), (1, element_at_index_1), ...)
*/
Modified: core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/UnversionedStrTestEntity.java
===================================================================
--- core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/UnversionedStrTestEntity.java 2009-09-30 17:16:01 UTC (rev 17587)
+++ core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/UnversionedStrTestEntity.java 2009-09-30 17:20:44 UTC (rev 17588)
@@ -72,8 +72,8 @@
UnversionedStrTestEntity that = (UnversionedStrTestEntity) o;
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
- if (str != null ? !str.equals(that.str) : that.str != null) return false;
+ if (id != null ? !id.equals(that.getId()) : that.getId() != null) return false;
+ if (str != null ? !str.equals(that.getStr()) : that.getStr() != null) return false;
return true;
}
@@ -88,4 +88,4 @@
public String toString() {
return "USTE(id = " + id + ", str = " + str + ")";
}
-}
\ No newline at end of file
+}
Modified: core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytoone/unidirectional/TargetNotAuditedEntity.java
===================================================================
--- core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytoone/unidirectional/TargetNotAuditedEntity.java 2009-09-30 17:16:01 UTC (rev 17587)
+++ core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/entities/manytoone/unidirectional/TargetNotAuditedEntity.java 2009-09-30 17:20:44 UTC (rev 17588)
@@ -45,7 +45,7 @@
private String data;
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
- @ManyToOne(fetch = FetchType.EAGER)
+ @ManyToOne(fetch = FetchType.LAZY)
private UnversionedStrTestEntity reference;
public TargetNotAuditedEntity() { }
@@ -96,8 +96,8 @@
TargetNotAuditedEntity that = (TargetNotAuditedEntity) o;
- if (data != null ? !data.equals(that.data) : that.data != null) return false;
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
+ if (data != null ? !data.equals(that.getData()) : that.getData() != null) return false;
+ if (id != null ? !id.equals(that.getId()) : that.getId() != null) return false;
return true;
}
Modified: core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytoone/unidirectional/RelationNotAuditedTarget.java
===================================================================
--- core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytoone/unidirectional/RelationNotAuditedTarget.java 2009-09-30 17:16:01 UTC (rev 17587)
+++ core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/manytoone/unidirectional/RelationNotAuditedTarget.java 2009-09-30 17:20:44 UTC (rev 17588)
@@ -32,6 +32,11 @@
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.entities.UnversionedStrTestEntity;
import org.hibernate.envers.test.entities.manytoone.unidirectional.TargetNotAuditedEntity;
+
+import org.hibernate.Hibernate;
+import org.hibernate.proxy.HibernateProxy;
+import org.hibernate.proxy.HibernateProxyHelper;
+
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -129,6 +134,9 @@
@Test
public void testHistoryOfTnae1_id() {
+ // load original "tnae1" TargetNotAuditedEntity to force load "str1" UnversionedStrTestEntity as Proxy
+ TargetNotAuditedEntity original = getEntityManager().find(TargetNotAuditedEntity.class, tnae1_id);
+
UnversionedStrTestEntity uste1 = getEntityManager().find(UnversionedStrTestEntity.class, uste1_id);
UnversionedStrTestEntity uste2 = getEntityManager().find(UnversionedStrTestEntity.class, uste2_id);
@@ -141,6 +149,11 @@
assert rev2.getReference().equals(uste2);
assert rev3.getReference().equals(uste2);
assert rev4.getReference().equals(uste1);
+
+ assert original.getReference() instanceof HibernateProxy;
+ assert UnversionedStrTestEntity.class.equals(Hibernate.getClass(original.getReference()));
+ assert UnversionedStrTestEntity.class.equals(HibernateProxyHelper.getClassWithoutInitializingProxy(rev1.getReference()));
+ assert UnversionedStrTestEntity.class.equals(Hibernate.getClass(rev1.getReference()));
}
@Test
Copied: core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/proxy (from rev 17587, core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/proxy)
Deleted: core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/proxy/ProxyIdentifier.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/proxy/ProxyIdentifier.java 2009-09-30 17:16:01 UTC (rev 17587)
+++ core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/proxy/ProxyIdentifier.java 2009-09-30 17:20:44 UTC (rev 17588)
@@ -1,90 +0,0 @@
-/*
- * Hibernate, Relational Persistence for Idiomatic Java
- *
- * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
- * indicated by the @author tags or express copyright attribution
- * statements applied by the authors. All third-party contributions are
- * distributed under license by Red Hat Middleware LLC.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
- * for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this distribution; if not, write to:
- * Free Software Foundation, Inc.
- * 51 Franklin Street, Fifth Floor
- * Boston, MA 02110-1301 USA
- */
-package org.hibernate.envers.test.integration.proxy;
-
-import org.hibernate.ejb.Ejb3Configuration;
-
-import org.hibernate.envers.test.AbstractEntityTest;
-import org.hibernate.envers.test.entities.UnversionedStrTestEntity;
-import org.hibernate.envers.test.entities.manytoone.unidirectional.TargetNotAuditedEntity;
-
-import org.hibernate.proxy.HibernateProxy;
-import org.hibernate.proxy.LazyInitializer;
-
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import javax.persistence.EntityManager;
-
-
-/**
- * @author Eugene Goroschenya
- */
-public class ProxyIdentifier extends AbstractEntityTest {
- private TargetNotAuditedEntity tnae1;
- private UnversionedStrTestEntity uste1;
-
- public void configure(Ejb3Configuration cfg) {
- cfg.addAnnotatedClass(TargetNotAuditedEntity.class);
- cfg.addAnnotatedClass(UnversionedStrTestEntity.class);
- }
-
- @BeforeClass(dependsOnMethods = "init")
- public void initData() {
- EntityManager em = getEntityManager();
-
- uste1 = new UnversionedStrTestEntity("str1");
-
- // No revision
- em.getTransaction().begin();
- em.persist(uste1);
- em.getTransaction().commit();
-
- // Revision 1
- em.getTransaction().begin();
- uste1 = em.find(UnversionedStrTestEntity.class, uste1.getId());
- tnae1 = new TargetNotAuditedEntity(1, "tnae1", uste1);
- em.persist(tnae1);
- em.getTransaction().commit();
- }
-
- @Test
- public void testProxyIdentifier() {
- TargetNotAuditedEntity rev1 = getAuditReader().find(TargetNotAuditedEntity.class, tnae1.getId(), 1);
-
- assert rev1.getReference() instanceof HibernateProxy;
-
- HibernateProxy proxyCreateByEnvers = (HibernateProxy) rev1.getReference();
- LazyInitializer lazyInitializer = proxyCreateByEnvers.getHibernateLazyInitializer();
-
- assert lazyInitializer.isUninitialized();
- assert lazyInitializer.getIdentifier() != null;
- assert lazyInitializer.getIdentifier().equals(tnae1.getId());
- assert lazyInitializer.isUninitialized();
-
- assert rev1.getReference().getId().equals(uste1.getId());
- assert rev1.getReference().getStr().equals(uste1.getStr());
- assert !lazyInitializer.isUninitialized();
- }
-}
Copied: core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/proxy/ProxyIdentifier.java (from rev 17587, core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/proxy/ProxyIdentifier.java)
===================================================================
--- core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/proxy/ProxyIdentifier.java (rev 0)
+++ core/branches/envers-hibernate-3.3/src/test/java/org/hibernate/envers/test/integration/proxy/ProxyIdentifier.java 2009-09-30 17:20:44 UTC (rev 17588)
@@ -0,0 +1,90 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.test.integration.proxy;
+
+import org.hibernate.ejb.Ejb3Configuration;
+
+import org.hibernate.envers.test.AbstractEntityTest;
+import org.hibernate.envers.test.entities.UnversionedStrTestEntity;
+import org.hibernate.envers.test.entities.manytoone.unidirectional.TargetNotAuditedEntity;
+
+import org.hibernate.proxy.HibernateProxy;
+import org.hibernate.proxy.LazyInitializer;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import javax.persistence.EntityManager;
+
+
+/**
+ * @author Eugene Goroschenya
+ */
+public class ProxyIdentifier extends AbstractEntityTest {
+ private TargetNotAuditedEntity tnae1;
+ private UnversionedStrTestEntity uste1;
+
+ public void configure(Ejb3Configuration cfg) {
+ cfg.addAnnotatedClass(TargetNotAuditedEntity.class);
+ cfg.addAnnotatedClass(UnversionedStrTestEntity.class);
+ }
+
+ @BeforeClass(dependsOnMethods = "init")
+ public void initData() {
+ EntityManager em = getEntityManager();
+
+ uste1 = new UnversionedStrTestEntity("str1");
+
+ // No revision
+ em.getTransaction().begin();
+ em.persist(uste1);
+ em.getTransaction().commit();
+
+ // Revision 1
+ em.getTransaction().begin();
+ uste1 = em.find(UnversionedStrTestEntity.class, uste1.getId());
+ tnae1 = new TargetNotAuditedEntity(1, "tnae1", uste1);
+ em.persist(tnae1);
+ em.getTransaction().commit();
+ }
+
+ @Test
+ public void testProxyIdentifier() {
+ TargetNotAuditedEntity rev1 = getAuditReader().find(TargetNotAuditedEntity.class, tnae1.getId(), 1);
+
+ assert rev1.getReference() instanceof HibernateProxy;
+
+ HibernateProxy proxyCreateByEnvers = (HibernateProxy) rev1.getReference();
+ LazyInitializer lazyInitializer = proxyCreateByEnvers.getHibernateLazyInitializer();
+
+ assert lazyInitializer.isUninitialized();
+ assert lazyInitializer.getIdentifier() != null;
+ assert lazyInitializer.getIdentifier().equals(tnae1.getId());
+ assert lazyInitializer.isUninitialized();
+
+ assert rev1.getReference().getId().equals(uste1.getId());
+ assert rev1.getReference().getStr().equals(uste1.getStr());
+ assert !lazyInitializer.isUninitialized();
+ }
+}
Modified: core/branches/envers-hibernate-3.3/src/test/resources/testng.xml
===================================================================
--- core/branches/envers-hibernate-3.3/src/test/resources/testng.xml 2009-09-30 17:16:01 UTC (rev 17587)
+++ core/branches/envers-hibernate-3.3/src/test/resources/testng.xml 2009-09-30 17:20:44 UTC (rev 17588)
@@ -33,6 +33,7 @@
<package name="org.hibernate.envers.test.integration.manytomany" />
<package name="org.hibernate.envers.test.integration.manytomany.ternary" />
<package name="org.hibernate.envers.test.integration.manytomany.unidirectional" />
+ <package name="org.hibernate.envers.test.integration.manytoone.unidirectional" />
<package name="org.hibernate.envers.test.integration.naming" />
<package name="org.hibernate.envers.test.integration.naming.ids" />
<package name="org.hibernate.envers.test.integration.notinsertable" />
@@ -44,6 +45,7 @@
<package name="org.hibernate.envers.test.integration.onetoone.unidirectional" />
<package name="org.hibernate.envers.test.integration.primitive" />
<package name="org.hibernate.envers.test.integration.properties" />
+ <package name="org.hibernate.envers.test.integration.proxy" />
<package name="org.hibernate.envers.test.integration.query" />
<package name="org.hibernate.envers.test.integration.query.ids" />
<package name="org.hibernate.envers.test.integration.reference" />
15 years, 4 months
Hibernate SVN: r17587 - in core/trunk/envers/src/main/java/org/hibernate/envers: tools and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2009-09-30 13:16:01 -0400 (Wed, 30 Sep 2009)
New Revision: 17587
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/event/AuditEventListener.java
core/trunk/envers/src/main/java/org/hibernate/envers/tools/Tools.java
Log:
HHH-4449:
- applying patch
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/event/AuditEventListener.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/event/AuditEventListener.java 2009-09-30 17:11:04 UTC (rev 17586)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/event/AuditEventListener.java 2009-09-30 17:16:01 UTC (rev 17587)
@@ -104,7 +104,7 @@
toEntityName = session.bestGuessEntityName(newValue);
id = hibernateProxy.getHibernateLazyInitializer().getIdentifier();
// We've got to initialize the object from the proxy to later read its state.
- newValue = Tools.getTargetFromProxy(hibernateProxy);
+ newValue = Tools.getTargetFromProxy(session.getFactory(), hibernateProxy);
} else {
toEntityName = session.guessEntityName(newValue);
@@ -124,7 +124,7 @@
toEntityName = session.bestGuessEntityName(oldValue);
id = hibernateProxy.getHibernateLazyInitializer().getIdentifier();
// We've got to initialize the object as we'll read it's state anyway.
- oldValue = Tools.getTargetFromProxy(hibernateProxy);
+ oldValue = Tools.getTargetFromProxy(session.getFactory(), hibernateProxy);
} else {
toEntityName = session.guessEntityName(oldValue);
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/tools/Tools.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/tools/Tools.java 2009-09-30 17:11:04 UTC (rev 17586)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/tools/Tools.java 2009-09-30 17:16:01 UTC (rev 17587)
@@ -25,6 +25,7 @@
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.engine.SessionImplementor;
+import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.Session;
import java.util.*;
@@ -66,20 +67,21 @@
return session.getEntityPersister(null, obj).getIdentifier(obj, session.getEntityMode());
}
- public static Object getTargetFromProxy(HibernateProxy proxy) {
- if (!proxy.getHibernateLazyInitializer().isUninitialized()) {
- return proxy.getHibernateLazyInitializer().getImplementation();
- }
+ public static Object getTargetFromProxy(SessionFactoryImplementor sessionFactoryImplementor, HibernateProxy proxy) {
+ if (!proxy.getHibernateLazyInitializer().isUninitialized()) {
+ return proxy.getHibernateLazyInitializer().getImplementation();
+ }
- Session tempSession = proxy.getHibernateLazyInitializer().getSession().getFactory().openTemporarySession();
- try {
- proxy.getHibernateLazyInitializer().setSession((SessionImplementor) tempSession);
- proxy.getHibernateLazyInitializer().initialize();
- return proxy.getHibernateLazyInitializer().getImplementation();
- } finally {
- tempSession.close();
- }
- }
+ SessionImplementor sessionImplementor = proxy.getHibernateLazyInitializer().getSession();
+ Session tempSession = sessionImplementor==null ? sessionFactoryImplementor.openTemporarySession() : sessionImplementor.getFactory().openTemporarySession();
+ try {
+ proxy.getHibernateLazyInitializer().setSession((SessionImplementor) tempSession);
+ proxy.getHibernateLazyInitializer().initialize();
+ return proxy.getHibernateLazyInitializer().getImplementation();
+ } finally {
+ tempSession.close();
+ }
+ }
public static boolean objectsEqual(Object obj1, Object obj2) {
if (obj1 == null) {
@@ -113,7 +115,7 @@
}
/**
- * Transforms a list of arbitrary elements to a list of index-element pairs.
+ * Transforms a list of arbitrary elements to a list of index-element pairs.
* @param list List to transform.
* @return A list of pairs: ((0, element_at_index_0), (1, element_at_index_1), ...)
*/
15 years, 4 months
Hibernate SVN: r17586 - in core/trunk/envers/src: test/java/org/hibernate/envers/test/integration and 2 other directories.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2009-09-30 13:11:04 -0400 (Wed, 30 Sep 2009)
New Revision: 17586
Added:
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/proxy/
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/proxy/ProxyIdentifier.java
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/ToOneIdMapper.java
core/trunk/envers/src/test/resources/testng.xml
Log:
HHH-4447:
- applying patches
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/ToOneIdMapper.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/ToOneIdMapper.java 2009-09-30 16:55:34 UTC (rev 17585)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/ToOneIdMapper.java 2009-09-30 17:11:04 UTC (rev 17586)
@@ -82,7 +82,7 @@
Class<?> entityClass = ReflectionTools.loadClass(referencedEntityName);
value = versionsReader.getSessionImplementor().getFactory().getEntityPersister(referencedEntityName).
- createProxy(null, new ToOneDelegateSessionImplementor(versionsReader, entityClass, entityId, revision, verCfg));
+ createProxy((Serializable)entityId, new ToOneDelegateSessionImplementor(versionsReader, entityClass, entityId, revision, verCfg));
}
}
Added: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/proxy/ProxyIdentifier.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/proxy/ProxyIdentifier.java (rev 0)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/proxy/ProxyIdentifier.java 2009-09-30 17:11:04 UTC (rev 17586)
@@ -0,0 +1,90 @@
+/*
+ * Hibernate, Relational Persistence for Idiomatic Java
+ *
+ * Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
+ * indicated by the @author tags or express copyright attribution
+ * statements applied by the authors. All third-party contributions are
+ * distributed under license by Red Hat Middleware LLC.
+ *
+ * This copyrighted material is made available to anyone wishing to use, modify,
+ * copy, or redistribute it subject to the terms and conditions of the GNU
+ * Lesser General Public License, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this distribution; if not, write to:
+ * Free Software Foundation, Inc.
+ * 51 Franklin Street, Fifth Floor
+ * Boston, MA 02110-1301 USA
+ */
+package org.hibernate.envers.test.integration.proxy;
+
+import org.hibernate.ejb.Ejb3Configuration;
+
+import org.hibernate.envers.test.AbstractEntityTest;
+import org.hibernate.envers.test.entities.UnversionedStrTestEntity;
+import org.hibernate.envers.test.entities.manytoone.unidirectional.TargetNotAuditedEntity;
+
+import org.hibernate.proxy.HibernateProxy;
+import org.hibernate.proxy.LazyInitializer;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import javax.persistence.EntityManager;
+
+
+/**
+ * @author Eugene Goroschenya
+ */
+public class ProxyIdentifier extends AbstractEntityTest {
+ private TargetNotAuditedEntity tnae1;
+ private UnversionedStrTestEntity uste1;
+
+ public void configure(Ejb3Configuration cfg) {
+ cfg.addAnnotatedClass(TargetNotAuditedEntity.class);
+ cfg.addAnnotatedClass(UnversionedStrTestEntity.class);
+ }
+
+ @BeforeClass(dependsOnMethods = "init")
+ public void initData() {
+ EntityManager em = getEntityManager();
+
+ uste1 = new UnversionedStrTestEntity("str1");
+
+ // No revision
+ em.getTransaction().begin();
+ em.persist(uste1);
+ em.getTransaction().commit();
+
+ // Revision 1
+ em.getTransaction().begin();
+ uste1 = em.find(UnversionedStrTestEntity.class, uste1.getId());
+ tnae1 = new TargetNotAuditedEntity(1, "tnae1", uste1);
+ em.persist(tnae1);
+ em.getTransaction().commit();
+ }
+
+ @Test
+ public void testProxyIdentifier() {
+ TargetNotAuditedEntity rev1 = getAuditReader().find(TargetNotAuditedEntity.class, tnae1.getId(), 1);
+
+ assert rev1.getReference() instanceof HibernateProxy;
+
+ HibernateProxy proxyCreateByEnvers = (HibernateProxy) rev1.getReference();
+ LazyInitializer lazyInitializer = proxyCreateByEnvers.getHibernateLazyInitializer();
+
+ assert lazyInitializer.isUninitialized();
+ assert lazyInitializer.getIdentifier() != null;
+ assert lazyInitializer.getIdentifier().equals(tnae1.getId());
+ assert lazyInitializer.isUninitialized();
+
+ assert rev1.getReference().getId().equals(uste1.getId());
+ assert rev1.getReference().getStr().equals(uste1.getStr());
+ assert !lazyInitializer.isUninitialized();
+ }
+}
Modified: core/trunk/envers/src/test/resources/testng.xml
===================================================================
--- core/trunk/envers/src/test/resources/testng.xml 2009-09-30 16:55:34 UTC (rev 17585)
+++ core/trunk/envers/src/test/resources/testng.xml 2009-09-30 17:11:04 UTC (rev 17586)
@@ -45,6 +45,7 @@
<package name="org.hibernate.envers.test.integration.onetoone.unidirectional" />
<package name="org.hibernate.envers.test.integration.primitive" />
<package name="org.hibernate.envers.test.integration.properties" />
+ <package name="org.hibernate.envers.test.integration.proxy" />
<package name="org.hibernate.envers.test.integration.query" />
<package name="org.hibernate.envers.test.integration.query.ids" />
<package name="org.hibernate.envers.test.integration.reference" />
15 years, 4 months
Hibernate SVN: r17585 - validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2009-09-30 12:55:34 -0400 (Wed, 30 Sep 2009)
New Revision: 17585
Modified:
beanvalidation/api/trunk/src/main/java/javax/validation/ValidatorContext.java
beanvalidation/api/trunk/src/main/java/javax/validation/ValidatorFactory.java
validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValidatorContextImpl.java
Log:
BVAL-185 Allow overriding of ConstraintValidatorFactory when creating a Validator
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/ValidatorContext.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/ValidatorContext.java 2009-09-30 16:28:00 UTC (rev 17584)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/ValidatorContext.java 2009-09-30 16:55:34 UTC (rev 17585)
@@ -21,33 +21,47 @@
* Represents the context that is used to create <code>Validator</code>
* instances.
*
- * A client may use methods of the ValidatorContext returned through
- * <code>usingContext</code> of <code>ValidatorFactory</code> to customize
- * the context (for instance establish different message interpolators or
- * traversable resolvers) used to create <code>Validator</code> instances.
+ * A client may use methods of the <code>ValidatorContext</code> returned by
+ * <code>ValidatorFactory#usingContext</code> to customize
+ * the context used to create <code>Validator</code> instances
+ * (for instance establish different message interpolators or
+ * traversable resolvers).
*
* @author Emmanuel Bernard
*/
public interface ValidatorContext {
/**
- * Defines the message interpolator implementation used by the Validator.
+ * Defines the message interpolator implementation used by the
+ * <code>Validator</code>.
* If not set or if null is passed as a parameter,
- * the message interpolator of the ValidatorFactory is used.
+ * the message interpolator of the <code>ValidatorFactory</code>
+ * is used.
*
* @return self following the chaining method pattern
*/
ValidatorContext messageInterpolator(MessageInterpolator messageInterpolator);
/**
- * Defines the traversable resolver implementation used by the Validator.
+ * Defines the traversable resolver implementation used by the
+ * <code>Validator</code>.
* If not set or if null is passed as a parameter,
- * the traversable resolver of the ValidatorFactory is used.
+ * the traversable resolver of the <code>ValidatorFactory</code> is used.
*
* @return self following the chaining method pattern
*/
ValidatorContext traversableResolver(TraversableResolver traversableResolver);
/**
+ * Defines the constraint validator factory implementation used by the
+ * <code>Validator</code>.
+ * If not set or if null is passed as a parameter,
+ * the constraint validator factory of the <code>ValidatorFactory</code> is used.
+ *
+ * @return self following the chaining method pattern
+ */
+ ValidatorContext constraintValidatorFactory(ConstraintValidatorFactory factory);
+
+ /**
* @return an initialized <code>Validator</code> instance respecting the defined state.
* Validator instances can be pooled and shared by the implementation.
*/
Modified: beanvalidation/api/trunk/src/main/java/javax/validation/ValidatorFactory.java
===================================================================
--- beanvalidation/api/trunk/src/main/java/javax/validation/ValidatorFactory.java 2009-09-30 16:28:00 UTC (rev 17584)
+++ beanvalidation/api/trunk/src/main/java/javax/validation/ValidatorFactory.java 2009-09-30 16:55:34 UTC (rev 17585)
@@ -26,17 +26,19 @@
*/
public interface ValidatorFactory {
/**
- * @return Returns an initialized <code>Validator</code> instance using the default
- * factory instances for message interpolator and traversable resolver.
+ * Returns an initialized <code>Validator</code> instance using the
+ * factory defaults for message interpolator, traversable resolver
+ * and constraint validator factory.
* <p>
* Validator instances can be pooled and shared by the implementation.
* </p>
+ * @return an initialized <code>Validator</code> instance
*/
Validator getValidator();
/**
- * Define the validator context and return a <code>Validator</code> compliant
- * with this state.
+ * Defines a new validator context and return a <code>Validator</code>
+ * compliant this new context.
*
* @return a <code>ValidatorContext</code>.
*/
@@ -71,12 +73,15 @@
ConstraintValidatorFactory getConstraintValidatorFactory();
/**
- * Return an object of the specified type to allow access to the
- * provider-specific API. If the Bean Validation provider
- * implementation does not support the specified class, the
- * ValidationException is thrown.
+ * Return an instance of the specified type allowing access to
+ * provider-specific APIs. If the Bean Validation provider
+ * implementation does not support the specified class,
+ * <code>ValidationException,</code> is thrown.
+ *
* @param type the class of the object to be returned.
- * @return an instance of the specified class
+ *
+ * @return an instance of the specified class.
+ *
* @throws ValidationException if the provider does not
* support the call.
*/
Modified: validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValidatorContextImpl.java
===================================================================
--- validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValidatorContextImpl.java 2009-09-30 16:28:00 UTC (rev 17584)
+++ validator/trunk/hibernate-validator/src/main/java/org/hibernate/validator/engine/ValidatorContextImpl.java 2009-09-30 16:55:34 UTC (rev 17585)
@@ -33,9 +33,10 @@
public class ValidatorContextImpl implements ValidatorContext {
private MessageInterpolator messageInterpolator;
private TraversableResolver traversableResolver;
+ private ConstraintValidatorFactory constraintValidatorFactory;
private final MessageInterpolator factoryMessageInterpolator;
private final TraversableResolver factoryTraversableResolver;
- private final ConstraintValidatorFactory constraintValidatorFactory;
+ private final ConstraintValidatorFactory factoryConstraintValidatorFactory;
private final ConstraintHelper constraintHelper;
private final BeanMetaDataCache beanMetaDataCache;
@@ -44,13 +45,14 @@
TraversableResolver factoryTraversableResolver,
ConstraintHelper constraintHelper,
BeanMetaDataCache beanMetaDataCache) {
- this.constraintValidatorFactory = constraintValidatorFactory;
+ this.factoryConstraintValidatorFactory = constraintValidatorFactory;
this.factoryMessageInterpolator = factoryMessageInterpolator;
this.factoryTraversableResolver = factoryTraversableResolver;
this.constraintHelper = constraintHelper;
this.beanMetaDataCache = beanMetaDataCache;
messageInterpolator( factoryMessageInterpolator );
traversableResolver( factoryTraversableResolver );
+ constraintValidatorFactory( factoryConstraintValidatorFactory );
}
public ValidatorContext messageInterpolator(MessageInterpolator messageInterpolator) {
@@ -73,6 +75,16 @@
return this;
}
+ public ValidatorContext constraintValidatorFactory(ConstraintValidatorFactory factory) {
+ if ( constraintValidatorFactory == null ) {
+ this.constraintValidatorFactory = factoryConstraintValidatorFactory;
+ }
+ else {
+ this.constraintValidatorFactory = factory;
+ }
+ return this;
+ }
+
public Validator getValidator() {
return new ValidatorImpl(
constraintValidatorFactory,
15 years, 4 months
Hibernate SVN: r17584 - in core/trunk/envers/src: test/java/org/hibernate/envers/test/entities and 3 other directories.
by hibernate-commits@lists.jboss.org
Author: adamw
Date: 2009-09-30 12:28:00 -0400 (Wed, 30 Sep 2009)
New Revision: 17584
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/AbstractDelegateSessionImplementor.java
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/ToOneDelegateSessionImplementor.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/UnversionedStrTestEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytoone/unidirectional/TargetNotAuditedEntity.java
core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/manytoone/unidirectional/RelationNotAuditedTarget.java
core/trunk/envers/src/test/resources/testng.xml
Log:
HHH-4437:
- applying patches
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/AbstractDelegateSessionImplementor.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/AbstractDelegateSessionImplementor.java 2009-09-30 15:18:46 UTC (rev 17583)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/AbstractDelegateSessionImplementor.java 2009-09-30 16:28:00 UTC (rev 17584)
@@ -58,7 +58,7 @@
* @author Adam Warski (adam at warski dot org)
*/
public abstract class AbstractDelegateSessionImplementor implements SessionImplementor {
- private SessionImplementor delegate;
+ protected SessionImplementor delegate;
public AbstractDelegateSessionImplementor(SessionImplementor delegate) {
this.delegate = delegate;
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/ToOneDelegateSessionImplementor.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/ToOneDelegateSessionImplementor.java 2009-09-30 15:18:46 UTC (rev 17583)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/ToOneDelegateSessionImplementor.java 2009-09-30 16:28:00 UTC (rev 17584)
@@ -31,7 +31,6 @@
import org.hibernate.envers.reader.AuditReaderImplementor;
import org.hibernate.HibernateException;
-import org.hibernate.Session;
/**
* @author Adam Warski (adam at warski dot org)
@@ -62,8 +61,7 @@
if (notVersionedEntityConfiguration == null) {
return versionsReader.find(entityClass, entityId, revision);
} else {
- Session session = versionsReader.getSession();
- return session.get(entityClass, (Serializable) entityId);
+ return delegate.immediateLoad(entityName, (Serializable) entityId);
}
}
}
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/UnversionedStrTestEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/UnversionedStrTestEntity.java 2009-09-30 15:18:46 UTC (rev 17583)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/UnversionedStrTestEntity.java 2009-09-30 16:28:00 UTC (rev 17584)
@@ -72,8 +72,8 @@
UnversionedStrTestEntity that = (UnversionedStrTestEntity) o;
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
- if (str != null ? !str.equals(that.str) : that.str != null) return false;
+ if (id != null ? !id.equals(that.getId()) : that.getId() != null) return false;
+ if (str != null ? !str.equals(that.getStr()) : that.getStr() != null) return false;
return true;
}
@@ -88,4 +88,4 @@
public String toString() {
return "USTE(id = " + id + ", str = " + str + ")";
}
-}
\ No newline at end of file
+}
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytoone/unidirectional/TargetNotAuditedEntity.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytoone/unidirectional/TargetNotAuditedEntity.java 2009-09-30 15:18:46 UTC (rev 17583)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/entities/manytoone/unidirectional/TargetNotAuditedEntity.java 2009-09-30 16:28:00 UTC (rev 17584)
@@ -45,7 +45,7 @@
private String data;
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
- @ManyToOne(fetch = FetchType.EAGER)
+ @ManyToOne(fetch = FetchType.LAZY)
private UnversionedStrTestEntity reference;
public TargetNotAuditedEntity() { }
@@ -96,8 +96,8 @@
TargetNotAuditedEntity that = (TargetNotAuditedEntity) o;
- if (data != null ? !data.equals(that.data) : that.data != null) return false;
- if (id != null ? !id.equals(that.id) : that.id != null) return false;
+ if (data != null ? !data.equals(that.getData()) : that.getData() != null) return false;
+ if (id != null ? !id.equals(that.getId()) : that.getId() != null) return false;
return true;
}
Modified: core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/manytoone/unidirectional/RelationNotAuditedTarget.java
===================================================================
--- core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/manytoone/unidirectional/RelationNotAuditedTarget.java 2009-09-30 15:18:46 UTC (rev 17583)
+++ core/trunk/envers/src/test/java/org/hibernate/envers/test/integration/manytoone/unidirectional/RelationNotAuditedTarget.java 2009-09-30 16:28:00 UTC (rev 17584)
@@ -32,6 +32,11 @@
import org.hibernate.envers.test.AbstractEntityTest;
import org.hibernate.envers.test.entities.UnversionedStrTestEntity;
import org.hibernate.envers.test.entities.manytoone.unidirectional.TargetNotAuditedEntity;
+
+import org.hibernate.Hibernate;
+import org.hibernate.proxy.HibernateProxy;
+import org.hibernate.proxy.HibernateProxyHelper;
+
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -129,6 +134,9 @@
@Test
public void testHistoryOfTnae1_id() {
+ // load original "tnae1" TargetNotAuditedEntity to force load "str1" UnversionedStrTestEntity as Proxy
+ TargetNotAuditedEntity original = getEntityManager().find(TargetNotAuditedEntity.class, tnae1_id);
+
UnversionedStrTestEntity uste1 = getEntityManager().find(UnversionedStrTestEntity.class, uste1_id);
UnversionedStrTestEntity uste2 = getEntityManager().find(UnversionedStrTestEntity.class, uste2_id);
@@ -141,6 +149,11 @@
assert rev2.getReference().equals(uste2);
assert rev3.getReference().equals(uste2);
assert rev4.getReference().equals(uste1);
+
+ assert original.getReference() instanceof HibernateProxy;
+ assert UnversionedStrTestEntity.class.equals(Hibernate.getClass(original.getReference()));
+ assert UnversionedStrTestEntity.class.equals(HibernateProxyHelper.getClassWithoutInitializingProxy(rev1.getReference()));
+ assert UnversionedStrTestEntity.class.equals(Hibernate.getClass(rev1.getReference()));
}
@Test
Modified: core/trunk/envers/src/test/resources/testng.xml
===================================================================
--- core/trunk/envers/src/test/resources/testng.xml 2009-09-30 15:18:46 UTC (rev 17583)
+++ core/trunk/envers/src/test/resources/testng.xml 2009-09-30 16:28:00 UTC (rev 17584)
@@ -33,6 +33,7 @@
<package name="org.hibernate.envers.test.integration.manytomany" />
<package name="org.hibernate.envers.test.integration.manytomany.ternary" />
<package name="org.hibernate.envers.test.integration.manytomany.unidirectional" />
+ <package name="org.hibernate.envers.test.integration.manytoone.unidirectional" />
<package name="org.hibernate.envers.test.integration.naming" />
<package name="org.hibernate.envers.test.integration.naming.ids" />
<package name="org.hibernate.envers.test.integration.notinsertable" />
15 years, 4 months