bval-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r992489 [2/2] - in /incubator/bval/sandbox/lang3-work: ./ bval-core/ bval-core/src/main/java/org/apache/bval/ bval-core/src/main/java/org/apache/bval/model/ bval-jsr303/src/main/java/ bval-jsr303/src/main/java/org/apache/bval/jsr303/ bval-j...
Date Fri, 03 Sep 2010 21:48:15 GMT
Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/MethodValidatorMetaBeanFactory.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/MethodValidatorMetaBeanFactory.java?rev=992489&r1=992488&r2=992489&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/MethodValidatorMetaBeanFactory.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/MethodValidatorMetaBeanFactory.java Fri Sep  3 21:48:14 2010
@@ -23,7 +23,7 @@ import org.apache.bval.jsr303.Jsr303Meta
 import org.apache.bval.jsr303.util.SecureActions;
 import org.apache.bval.model.Validation;
 import org.apache.bval.util.AccessStrategy;
-import org.apache.commons.lang.ClassUtils;
+import org.apache.commons.lang3.ClassUtils;
 
 import javax.validation.Constraint;
 import javax.validation.ConstraintValidator;
@@ -37,7 +37,7 @@ import java.util.HashMap;
 /**
  * Description: extension to validate parameters/return values of methods/constructors.<br/>
  */
-//TODO RSt - move. this is an optional module: move the whole package. core code has no dependencies on it 
+//TODO RSt - move. this is an optional module: move the whole package. core code has no dependencies on it
 public class MethodValidatorMetaBeanFactory extends Jsr303MetaBeanFactory {
   /**
    * Create a new MethodValidatorMetaBeanFactory instance.

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/ParameterAccess.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/ParameterAccess.java?rev=992489&r1=992488&r2=992489&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/ParameterAccess.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/ParameterAccess.java Fri Sep  3 21:48:14 2010
@@ -20,7 +20,6 @@
 package org.apache.bval.jsr303.extensions;
 
 import org.apache.bval.util.AccessStrategy;
-import org.apache.commons.lang.NotImplementedException;
 
 import java.lang.annotation.ElementType;
 import java.lang.reflect.Type;
@@ -51,7 +50,7 @@ public class ParameterAccess extends Acc
      */
     @Override
     public Object get(Object instance) {
-        throw new NotImplementedException("Obtaining a parameter value not yet implemented");
+        throw new UnsupportedOperationException("Obtaining a parameter value not yet implemented");
     }
 
     /**

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/ReturnAccess.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/ReturnAccess.java?rev=992489&r1=992488&r2=992489&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/ReturnAccess.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/extensions/ReturnAccess.java Fri Sep  3 21:48:14 2010
@@ -20,7 +20,6 @@
 package org.apache.bval.jsr303.extensions;
 
 import org.apache.bval.util.AccessStrategy;
-import org.apache.commons.lang.NotImplementedException;
 
 import java.lang.annotation.ElementType;
 import java.lang.reflect.Type;
@@ -47,7 +46,7 @@ public class ReturnAccess extends Access
      */
     @Override
     public Object get(Object instance) {
-        throw new NotImplementedException("Obtaining a method return value not yet implemented");
+        throw new UnsupportedOperationException("Obtaining a method return value not yet implemented");
     }
 
     /**

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/resolver/DefaultTraversableResolver.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/resolver/DefaultTraversableResolver.java?rev=992489&r1=992488&r2=992489&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/resolver/DefaultTraversableResolver.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/resolver/DefaultTraversableResolver.java Fri Sep  3 21:48:14 2010
@@ -17,7 +17,7 @@
 package org.apache.bval.jsr303.resolver;
 
 import org.apache.bval.jsr303.util.SecureActions;
-import org.apache.commons.lang.ClassUtils;
+import org.apache.commons.lang3.ClassUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ClassHelper.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ClassHelper.java?rev=992489&r1=992488&r2=992489&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ClassHelper.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/ClassHelper.java Fri Sep  3 21:48:14 2010
@@ -33,7 +33,7 @@ public class ClassHelper {
     private ClassHelper() {
         // No instances please
     }
-    
+
     /**
      * Fill the list with the full class/interface hierarchy of the given class.
      * List is ordered from the most to less specific.
@@ -44,18 +44,18 @@ public class ClassHelper {
      *            The current class, root of the hierarchy to traverse.
      */
     static public void fillFullClassHierarchyAsList(List<Class<?>> allClasses, Class<?> clazz) {
-        if ( clazz == null || clazz == Object.class ) {
+        if (clazz == null || clazz == Object.class) {
             return;
         }
-        if ( allClasses.contains(clazz) ) {
+        if (allClasses.contains(clazz)) {
             return;
         }
         allClasses.add(clazz);
-        List<Class<?>> subClasses = new ArrayList(Arrays.asList(clazz.getInterfaces()));
+        List<Class<?>> subClasses = new ArrayList<Class<?>>(Arrays.asList(clazz.getInterfaces()));
         subClasses.add(0, clazz.getSuperclass());
-        for ( Class<?> subClass : subClasses ) {
+        for (Class<?> subClass : subClasses) {
             fillFullClassHierarchyAsList(allClasses, subClass);
-        }        
+        }
     }
-    
+
 }

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/SecureActions.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/SecureActions.java?rev=992489&r1=992488&r2=992489&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/SecureActions.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/main/java/org/apache/bval/jsr303/util/SecureActions.java Fri Sep  3 21:48:14 2010
@@ -19,7 +19,7 @@
 package org.apache.bval.jsr303.util;
 
 import org.apache.bval.util.PrivilegedActions;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
 
 import javax.validation.ValidationException;
 import java.lang.reflect.Constructor;

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/constraints/DecimalMinMaxValidatorsTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/constraints/DecimalMinMaxValidatorsTest.java?rev=992489&r1=992488&r2=992489&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/constraints/DecimalMinMaxValidatorsTest.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/constraints/DecimalMinMaxValidatorsTest.java Fri Sep  3 21:48:14 2010
@@ -35,31 +35,29 @@ import java.util.Set;
  */
 public class DecimalMinMaxValidatorsTest extends TestCase {
 
-  @DecimalMin("922392239223.06")
-  public double dmin;
-  @DecimalMax("922392239223.09")
-  public double dmax;
-
-
-  public void testDecimalMinValue() {
-    Validator v = Validation.buildDefaultValidatorFactory().getValidator();
-
-    this.dmin = 922392239223.05;
-    this.dmax = 922392239223.08;
-
-    Set<ConstraintViolation<DecimalMinMaxValidatorsTest>> res = v.validate(this);
-    assertFalse("Min validation failed", res.isEmpty());
-  }
-
-  public void testDecimalMaxValue() {
-    Validator v = Validation.buildDefaultValidatorFactory().getValidator();
-
-    this.dmin = Double.MAX_VALUE;
-    this.dmax = 922392239223.1;
-
-    Set<ConstraintViolation<DecimalMinMaxValidatorsTest>> res = v.validate(this);
-    assertFalse("Max validation failed", res.isEmpty());
-  }
-
+    @DecimalMin("922392239223.06")
+    public double dmin;
+    @DecimalMax("922392239223.09")
+    public double dmax;
+
+    public void testDecimalMinValue() {
+        Validator v = Validation.buildDefaultValidatorFactory().getValidator();
+
+        this.dmin = 922392239223.05;
+        this.dmax = 922392239223.08;
+
+        Set<ConstraintViolation<DecimalMinMaxValidatorsTest>> res = v.validate(this);
+        assertFalse("Min validation failed", res.isEmpty());
+    }
+
+    public void testDecimalMaxValue() {
+        Validator v = Validation.buildDefaultValidatorFactory().getValidator();
+
+        this.dmin = Double.MAX_VALUE;
+        this.dmax = 922392239223.1;
+
+        Set<ConstraintViolation<DecimalMinMaxValidatorsTest>> res = v.validate(this);
+        assertFalse("Max validation failed", res.isEmpty());
+    }
 
 }

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/constraints/HasStringValidator.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/constraints/HasStringValidator.java?rev=992489&r1=992488&r2=992489&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/constraints/HasStringValidator.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/constraints/HasStringValidator.java Fri Sep  3 21:48:14 2010
@@ -18,7 +18,7 @@
  */
 package org.apache.bval.constraints;
 
-import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang3.ArrayUtils;
 
 import javax.validation.ConstraintValidator;
 import javax.validation.ConstraintValidatorContext;

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/constraints/MinMaxValidatorsForNumberTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/constraints/MinMaxValidatorsForNumberTest.java?rev=992489&r1=992488&r2=992489&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/constraints/MinMaxValidatorsForNumberTest.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/constraints/MinMaxValidatorsForNumberTest.java Fri Sep  3 21:48:14 2010
@@ -27,46 +27,43 @@ import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;
 import java.util.Set;
 
-
 /**
  * Check correct behaviour of {@link MinValidatorForNumber} and
  * {@link MaxValidatorForNumber} on boundary values.
  * <p/>
- * The chosen numbers: 9223372036854775806l and 9223372036854775807l cast to
- * the same double value.
- *
+ * The chosen numbers: 9223372036854775806l and 9223372036854775807l cast to the
+ * same double value.
+ * 
  * @author Carlos Vara
  */
 public class MinMaxValidatorsForNumberTest extends TestCase {
 
-  @Min(value = 9223372036854775807l)
-  public long min;
-
-  @Max(value = 9223372036854775806l)
-  public long max;
-
+    @Min(value = 9223372036854775807l)
+    public long min;
 
-  public void testMinBoundaryValue() {
-    Validator v = Validation.buildDefaultValidatorFactory().getValidator();
+    @Max(value = 9223372036854775806l)
+    public long max;
 
-    this.min = 9223372036854775806l;
-    this.max = 0l;
+    public void testMinBoundaryValue() {
+        Validator v = Validation.buildDefaultValidatorFactory().getValidator();
 
-    // Current min value is smaller, should fail, but it doesn't
-    Set<ConstraintViolation<MinMaxValidatorsForNumberTest>> res = v.validate(this);
-    assertFalse("Min validation failed", res.isEmpty());
-  }
+        this.min = 9223372036854775806l;
+        this.max = 0l;
 
-  public void testMaxBoundaryValue() {
-    Validator v = Validation.buildDefaultValidatorFactory().getValidator();
+        // Current min value is smaller, should fail, but it doesn't
+        Set<ConstraintViolation<MinMaxValidatorsForNumberTest>> res = v.validate(this);
+        assertFalse("Min validation failed", res.isEmpty());
+    }
 
-    this.min = Long.MAX_VALUE;
-    this.max = 9223372036854775807l;
+    public void testMaxBoundaryValue() {
+        Validator v = Validation.buildDefaultValidatorFactory().getValidator();
 
-    // Current max value is bigger, should fail, but it doesn't
-    Set<ConstraintViolation<MinMaxValidatorsForNumberTest>> res = v.validate(this);
-    assertFalse("Max validation failed", res.isEmpty());
-  }
+        this.min = Long.MAX_VALUE;
+        this.max = 9223372036854775807l;
 
+        // Current max value is bigger, should fail, but it doesn't
+        Set<ConstraintViolation<MinMaxValidatorsForNumberTest>> res = v.validate(this);
+        assertFalse("Max validation failed", res.isEmpty());
+    }
 
 }

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/DefaultMessageInterpolatorTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/DefaultMessageInterpolatorTest.java?rev=992489&r1=992488&r2=992489&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/DefaultMessageInterpolatorTest.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/DefaultMessageInterpolatorTest.java Fri Sep  3 21:48:14 2010
@@ -34,71 +34,65 @@ import java.util.Locale;
  */
 public class DefaultMessageInterpolatorTest extends TestCase {
 
-  private DefaultMessageInterpolator interpolator;
+    private DefaultMessageInterpolator interpolator;
 
-  public DefaultMessageInterpolatorTest(String name) {
-    super(name);
-  }
-
-  public static Test suite() {
-    return new TestSuite(DefaultMessageInterpolatorTest.class);
-  }
-
-  @Override
-  protected void setUp() throws Exception {
-    super.setUp();    // call super!
-    interpolator = new DefaultMessageInterpolator();
-    interpolator.setLocale(Locale.ENGLISH);
-  }
-
-  public void testCreateResolver() {
-
-    final Validator gvalidator = getValidator();
-
-    assertTrue(!gvalidator.getConstraintsForClass(PreferredGuest.class)
-        .getConstraintsForProperty("guestCreditCardNumber")
-        .getConstraintDescriptors().isEmpty());
-
-    MessageInterpolator.Context ctx = new MessageInterpolator.Context() {
-
-      public ConstraintDescriptor<?> getConstraintDescriptor() {
-        return (ConstraintDescriptor<?>) gvalidator
-            .getConstraintsForClass(PreferredGuest.class).
-                getConstraintsForProperty("guestCreditCardNumber")
-            .getConstraintDescriptors().toArray()[0];
-      }
-
-      public Object getValidatedValue() {
-        return "12345678";
-      }
-    };
-    String msg = interpolator.interpolate("{validator.creditcard}", ctx);
-    Assert.assertEquals("credit card is not valid", msg);
-
-    ctx = new MessageInterpolator.Context() {
-      public ConstraintDescriptor<?> getConstraintDescriptor() {
-        return (ConstraintDescriptor) gvalidator
-            .getConstraintsForClass(Author.class).
-                getConstraintsForProperty("lastName")
-            .getConstraintDescriptors().toArray()[0];
-      }
-
-      public Object getValidatedValue() {
-        return "";
-      }
-    };
-
-
-    msg = interpolator.interpolate("{org.apache.bval.constraints.NotEmpty.message}", ctx);
-    Assert.assertEquals("may not be empty", msg);
-  }
+    public DefaultMessageInterpolatorTest(String name) {
+        super(name);
+    }
+
+    public static Test suite() {
+        return new TestSuite(DefaultMessageInterpolatorTest.class);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp(); // call super!
+        interpolator = new DefaultMessageInterpolator();
+        interpolator.setLocale(Locale.ENGLISH);
+    }
+
+    public void testCreateResolver() {
+
+        final Validator gvalidator = getValidator();
+
+        assertTrue(!gvalidator.getConstraintsForClass(PreferredGuest.class).getConstraintsForProperty(
+            "guestCreditCardNumber").getConstraintDescriptors().isEmpty());
+
+        MessageInterpolator.Context ctx = new MessageInterpolator.Context() {
+
+            public ConstraintDescriptor<?> getConstraintDescriptor() {
+                return (ConstraintDescriptor<?>) gvalidator.getConstraintsForClass(PreferredGuest.class)
+                    .getConstraintsForProperty("guestCreditCardNumber").getConstraintDescriptors().toArray()[0];
+            }
+
+            public Object getValidatedValue() {
+                return "12345678";
+            }
+        };
+        String msg = interpolator.interpolate("{validator.creditcard}", ctx);
+        Assert.assertEquals("credit card is not valid", msg);
+
+        ctx = new MessageInterpolator.Context() {
+            public ConstraintDescriptor<?> getConstraintDescriptor() {
+                return (ConstraintDescriptor) gvalidator.getConstraintsForClass(Author.class)
+                    .getConstraintsForProperty("lastName").getConstraintDescriptors().toArray()[0];
+            }
+
+            public Object getValidatedValue() {
+                return "";
+            }
+        };
+
+        msg = interpolator.interpolate("{org.apache.bval.constraints.NotEmpty.message}", ctx);
+        Assert.assertEquals("may not be empty", msg);
+    }
 
     /**
      * Checks that strings containing special characters are correctly
      * substituted when interpolating.
      */
     public void testReplacementWithSpecialChars() {
-        
+
         final Validator validator = getValidator();
         MessageInterpolator.Context ctx;
 
@@ -106,10 +100,8 @@ public class DefaultMessageInterpolatorT
         ctx = new MessageInterpolator.Context() {
 
             public ConstraintDescriptor<?> getConstraintDescriptor() {
-                return (ConstraintDescriptor<?>) validator
-                        .getConstraintsForClass(Person.class)
-                        .getConstraintsForProperty("idNumber")
-                        .getConstraintDescriptors().toArray()[0];
+                return (ConstraintDescriptor<?>) validator.getConstraintsForClass(Person.class)
+                    .getConstraintsForProperty("idNumber").getConstraintDescriptors().toArray()[0];
             }
 
             public Object getValidatedValue() {
@@ -118,28 +110,28 @@ public class DefaultMessageInterpolatorT
         };
 
         String result = this.interpolator.interpolate("Id number should match {regexp}", ctx);
-        Assert.assertEquals("Incorrect message interpolation when $ is in an attribute", "Id number should match ....$", result);
-        
+        Assert.assertEquals("Incorrect message interpolation when $ is in an attribute",
+            "Id number should match ....$", result);
+
         // Try to interpolate an annotation attribute containing \
         ctx = new MessageInterpolator.Context() {
 
             public ConstraintDescriptor<?> getConstraintDescriptor() {
-                return (ConstraintDescriptor<?>) validator
-                        .getConstraintsForClass(Person.class)
-                        .getConstraintsForProperty("otherId")
-                        .getConstraintDescriptors().toArray()[0];
+                return (ConstraintDescriptor<?>) validator.getConstraintsForClass(Person.class)
+                    .getConstraintsForProperty("otherId").getConstraintDescriptors().toArray()[0];
             }
 
             public Object getValidatedValue() {
                 return "12345678";
             }
         };
-        
+
         result = this.interpolator.interpolate("Other id should match {regexp}", ctx);
-        Assert.assertEquals("Incorrect message interpolation when \\ is in an attribute value", "Other id should match .\\n", result);
-        
+        Assert.assertEquals("Incorrect message interpolation when \\ is in an attribute value",
+            "Other id should match .\\n", result);
+
     }
-    
+
     public static class Person {
 
         @Pattern(message = "Id number should match {regexp}", regexp = "....$")
@@ -150,8 +142,7 @@ public class DefaultMessageInterpolatorT
 
     }
 
-
-  private Validator getValidator() {
-    return ApacheValidatorFactory.getDefault().getValidator();
-  }
+    private Validator getValidator() {
+        return ApacheValidatorFactory.getDefault().getValidator();
+    }
 }

Modified: incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/TckReproducerTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/TckReproducerTest.java?rev=992489&r1=992488&r2=992489&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/TckReproducerTest.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-jsr303/src/test/java/org/apache/bval/jsr303/TckReproducerTest.java Fri Sep  3 21:48:14 2010
@@ -35,55 +35,53 @@ import java.util.Set;
  */
 public class TckReproducerTest extends TestCase {
 
-  public static <T> void assertCorrectNumberOfViolations(Set<ConstraintViolation<T>> violations,
-                                                         int expectedViolations) {
-    assertEquals(
-        "Wrong number of constraint violations. Expected: " + expectedViolations + " Actual: " + violations.size(),
-        expectedViolations, violations.size());
-  }
-
-  private Validator getValidator() {
-    return ApacheValidatorFactory.getDefault().getValidator();
-  }
-
-  public void testPropertyAccessOnNonPublicClass()
-      throws Exception {
-    Validator validator = getValidator();
-    Car car = new Car("USd-298");
-    assertEquals(car.getLicensePlateNumber(), PropertyAccess.getProperty(car, "licensePlateNumber"));
-
-    Set<ConstraintViolation<Car>> violations = validator.validateProperty(
-        car, "licensePlateNumber", First.class, org.apache.bval.jsr303.example.Second.class
-    );
-    assertCorrectNumberOfViolations(violations, 1);
-
-    car.setLicensePlateNumber("USD-298");
-    violations = validator.validateProperty(
-        car, "licensePlateNumber", First.class, org.apache.bval.jsr303.example.Second.class
-    );
-    assertCorrectNumberOfViolations(violations, 0);
-  }
-
-  class Car {
-    @Pattern(regexp = "[A-Z][A-Z][A-Z]-[0-9][0-9][0-9]", groups = {First.class, Second.class})
-    private String licensePlateNumber;
+    public static <T> void assertCorrectNumberOfViolations(Set<ConstraintViolation<T>> violations,
+        int expectedViolations) {
+        assertEquals("Wrong number of constraint violations. Expected: " + expectedViolations + " Actual: "
+            + violations.size(), expectedViolations, violations.size());
+    }
 
-    Car(String licensePlateNumber) {
-      this.licensePlateNumber = licensePlateNumber;
+    private Validator getValidator() {
+        return ApacheValidatorFactory.getDefault().getValidator();
     }
 
-    public String getLicensePlateNumber() {
-      return licensePlateNumber;
+    public void testPropertyAccessOnNonPublicClass() throws Exception {
+        Validator validator = getValidator();
+        Car car = new Car("USd-298");
+        assertEquals(car.getLicensePlateNumber(), PropertyAccess.getProperty(car, "licensePlateNumber"));
+
+        Set<ConstraintViolation<Car>> violations =
+            validator.validateProperty(car, "licensePlateNumber", First.class,
+                org.apache.bval.jsr303.example.Second.class);
+        assertCorrectNumberOfViolations(violations, 1);
+
+        car.setLicensePlateNumber("USD-298");
+        violations =
+            validator.validateProperty(car, "licensePlateNumber", First.class,
+                org.apache.bval.jsr303.example.Second.class);
+        assertCorrectNumberOfViolations(violations, 0);
     }
 
-    public void setLicensePlateNumber(String licensePlateNumber) {
-      this.licensePlateNumber = licensePlateNumber;
+    class Car {
+        @Pattern(regexp = "[A-Z][A-Z][A-Z]-[0-9][0-9][0-9]", groups = { First.class, Second.class })
+        private String licensePlateNumber;
+
+        Car(String licensePlateNumber) {
+            this.licensePlateNumber = licensePlateNumber;
+        }
+
+        public String getLicensePlateNumber() {
+            return licensePlateNumber;
+        }
+
+        public void setLicensePlateNumber(String licensePlateNumber) {
+            this.licensePlateNumber = licensePlateNumber;
+        }
     }
-  }
 
-  interface First {
-  }
+    interface First {
+    }
 
-  interface Second {
-  }
+    interface Second {
+    }
 }

Modified: incubator/bval/sandbox/lang3-work/bval-tck/pom.xml
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-tck/pom.xml?rev=992489&r1=992488&r2=992489&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-tck/pom.xml (original)
+++ incubator/bval/sandbox/lang3-work/bval-tck/pom.xml Fri Sep  3 21:48:14 2010
@@ -162,8 +162,8 @@
                                             <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
                                         </artifactItem>
                                         <artifactItem>
-                                            <groupId>commons-lang</groupId>
-                                            <artifactId>commons-lang</artifactId>
+                                            <groupId>org.apache.commons</groupId>
+                                            <artifactId>commons-lang3</artifactId>
                                             <overWrite>true</overWrite>
                                             <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
                                         </artifactItem>

Modified: incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanBuilder.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanBuilder.java?rev=992489&r1=992488&r2=992489&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanBuilder.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanBuilder.java Fri Sep  3 21:48:14 2010
@@ -32,153 +32,147 @@ import java.util.Map;
  * Time: 10:10:46<br>
  */
 public class XMLMetaBeanBuilder extends MetaBeanBuilder {
-  private XMLMetaBeanFactory xmlFactory;
+    private XMLMetaBeanFactory xmlFactory;
 
+    public XMLMetaBeanBuilder(MetaBeanFactory[] factories) {
+        setFactories(factories);
+    }
+
+    public XMLMetaBeanBuilder() {
+        setFactories(new MetaBeanFactory[] { new IntrospectorMetaBeanFactory(), new XMLMetaBeanFactory() });
+    }
+
+    public void setFactories(MetaBeanFactory[] factories) {
+        super.setFactories(factories);
+        updateXmlFactory();
+    }
+
+    public void addLoader(XMLMetaBeanLoader loader) {
+        assertXmlFactory();
+        xmlFactory.addLoader(loader);
+    }
+
+    public MetaBean buildForId(String beanInfoId) throws Exception {
+        final XMLMetaBeanFactory.Visitor v;
+        assertXmlFactory();
+        xmlFactory.visitXMLBeanMeta(beanInfoId, v = new XMLMetaBeanFactory.Visitor() {
+            private MetaBean meta;
 
-  public XMLMetaBeanBuilder(MetaBeanFactory[] factories) {
-    setFactories(factories);
-  }
-
-  public XMLMetaBeanBuilder() {
-    setFactories(new MetaBeanFactory[]{new IntrospectorMetaBeanFactory(),
-        new XMLMetaBeanFactory()});
-  }
-
-  public void setFactories(MetaBeanFactory[] factories) {
-    super.setFactories(factories);
-    updateXmlFactory();
-  }
-
-  public void addLoader(XMLMetaBeanLoader loader) {
-    assertXmlFactory();
-    xmlFactory.addLoader(loader);
-  }
-
-  public MetaBean buildForId(String beanInfoId) throws Exception {
-    final XMLMetaBeanFactory.Visitor v;
-    assertXmlFactory();
-    xmlFactory.visitXMLBeanMeta(beanInfoId, v = new XMLMetaBeanFactory.Visitor() {
-      private MetaBean meta;
-
-      public MetaBean getMetaBean() {
-        return meta;
-      }
-
-      public void visit(XMLMetaBean xmlMeta, XMLMetaBeanInfos xmlInfos)
-          throws Exception {
-        if (meta == null) {
-          meta = createMetaBean(xmlMeta);
-        }
-        xmlFactory.enrichMetaBean(meta,
-            new XMLMetaBeanFactory.XMLResult(xmlMeta, xmlInfos));
-      }
-
-
-    });
-    if (v.getMetaBean() == null) {
-      throw new IllegalArgumentException("MetaBean " + beanInfoId + " not found");
-    }
-    return v.getMetaBean();
-  }
-
-  public Map<String, MetaBean> buildAll() throws Exception {
-    final Map<String, MetaBean> all = super.buildAll();
-    if (xmlFactory != null) {
-      xmlFactory.visitXMLBeanMeta(null, new XMLMetaBeanFactory.Visitor() {
-        public void visit(XMLMetaBean empty, XMLMetaBeanInfos xmlInfos)
-            throws Exception {
-          if (xmlInfos.getBeans() == null) return; // empty file, ignore
-          XMLMetaBeanFactory.XMLResult carrier =
-              new XMLMetaBeanFactory.XMLResult(null, xmlInfos);
-
-          for (XMLMetaBean xmlMeta : xmlInfos.getBeans()) {
-            MetaBean meta = all.get(xmlMeta.getId());
-            if (meta == null) {
-              meta = createMetaBean(xmlMeta);
-              all.put(xmlMeta.getId(), meta);
+            public MetaBean getMetaBean() {
+                return meta;
             }
-            carrier.xmlMeta = xmlMeta;
-            xmlFactory.enrichMetaBean(meta, carrier);
-          }
-        }
-
-        public MetaBean getMetaBean() {
-          return null;  // do nothing
-        }
-      });
-    }
-    return all;
-  }
-
-  public Map<String, MetaBean> enrichCopies(Map<String, MetaBean> all,
-                                            XMLMetaBeanInfos... infosArray)
-      throws Exception {
-    assertXmlFactory();
-    final Map<String, MetaBean> copies = new HashMap<String, MetaBean>(all.size());
-    boolean nothing = true;
-    XMLMetaBeanFactory.XMLResult carrier = new XMLMetaBeanFactory.XMLResult();
-    for (XMLMetaBeanInfos xmlMetaBeanInfos : infosArray) {
-      carrier.xmlInfos = xmlMetaBeanInfos;
-      if (xmlMetaBeanInfos == null) continue;
-      try {
-        for (XMLMetaBean xmlMeta : xmlMetaBeanInfos.getBeans()) {
-          nothing = false;
-          MetaBean copy = copies.get(xmlMeta.getId());
-          if (copy == null) { // ist noch nicht kopiert
-            MetaBean meta = all.get(xmlMeta.getId());
-            if (meta == null) { // gibt es nicht
-              copy = createMetaBean(xmlMeta);
-            } else { // gibt es, jetzt kopieren
-              copy = meta.copy();
+
+            public void visit(XMLMetaBean xmlMeta, XMLMetaBeanInfos xmlInfos) throws Exception {
+                if (meta == null) {
+                    meta = createMetaBean(xmlMeta);
+                }
+                xmlFactory.enrichMetaBean(meta, new XMLMetaBeanFactory.XMLResult(xmlMeta, xmlInfos));
             }
-            copies.put(xmlMeta.getId(), copy);
-          }
-          carrier.xmlMeta = xmlMeta;
-          xmlFactory.enrichMetaBean(copy, carrier);
-        }
-      } catch (IOException e) {
-        xmlFactory.handleLoadException(xmlMetaBeanInfos, e);
-      }
-    }
-    if (nothing) return all;
-    for (Map.Entry<String, MetaBean> entry : all.entrySet()) {
-      /*
-      * alle unveraenderten werden AUCH KOPIERT (nur zwar nur, wegen
-      * potentieller CrossReferenzen durch Relationships)
-      */
-      if (!copies.containsKey(entry.getKey())) {
-        if (entry.getValue().hasRelationships()) {
-          copies.put(entry.getKey(), (MetaBean) entry.getValue().copy());
-        } else { // no relationship: do not clone()
-          copies.put(entry.getKey(), entry.getValue());
-        }
-      }
-    }
-    return copies;
-  }
-
-  private MetaBean createMetaBean(XMLMetaBean xmlMeta) throws Exception {
-    return buildForClass(findLocalClass(xmlMeta.getImpl()));
-  }
-
-  private void updateXmlFactory() {
-    for (MetaBeanFactory each : getFactories()) {
-      if (each instanceof XMLMetaBeanFactory) { // use the first one!
-        xmlFactory = (XMLMetaBeanFactory) each;
-        return;
-      }
-    }
-    xmlFactory = null; // none
-  }
-
-  public XMLMetaBeanFactory getXmlFactory() {
-    return xmlFactory;
-  }
-
-  private void assertXmlFactory() {
-    if (xmlFactory == null) {
-      throw new IllegalStateException("no xmlFactory available");
+
+        });
+        if (v.getMetaBean() == null) {
+            throw new IllegalArgumentException("MetaBean " + beanInfoId + " not found");
+        }
+        return v.getMetaBean();
+    }
+
+    public Map<String, MetaBean> buildAll() throws Exception {
+        final Map<String, MetaBean> all = super.buildAll();
+        if (xmlFactory != null) {
+            xmlFactory.visitXMLBeanMeta(null, new XMLMetaBeanFactory.Visitor() {
+                public void visit(XMLMetaBean empty, XMLMetaBeanInfos xmlInfos) throws Exception {
+                    if (xmlInfos.getBeans() == null)
+                        return; // empty file, ignore
+                    XMLMetaBeanFactory.XMLResult carrier = new XMLMetaBeanFactory.XMLResult(null, xmlInfos);
+
+                    for (XMLMetaBean xmlMeta : xmlInfos.getBeans()) {
+                        MetaBean meta = all.get(xmlMeta.getId());
+                        if (meta == null) {
+                            meta = createMetaBean(xmlMeta);
+                            all.put(xmlMeta.getId(), meta);
+                        }
+                        carrier.xmlMeta = xmlMeta;
+                        xmlFactory.enrichMetaBean(meta, carrier);
+                    }
+                }
+
+                public MetaBean getMetaBean() {
+                    return null; // do nothing
+                }
+            });
+        }
+        return all;
+    }
+
+    public Map<String, MetaBean> enrichCopies(Map<String, MetaBean> all, XMLMetaBeanInfos... infosArray)
+        throws Exception {
+        assertXmlFactory();
+        final Map<String, MetaBean> copies = new HashMap<String, MetaBean>(all.size());
+        boolean nothing = true;
+        XMLMetaBeanFactory.XMLResult carrier = new XMLMetaBeanFactory.XMLResult();
+        for (XMLMetaBeanInfos xmlMetaBeanInfos : infosArray) {
+            carrier.xmlInfos = xmlMetaBeanInfos;
+            if (xmlMetaBeanInfos == null)
+                continue;
+            try {
+                for (XMLMetaBean xmlMeta : xmlMetaBeanInfos.getBeans()) {
+                    nothing = false;
+                    MetaBean copy = copies.get(xmlMeta.getId());
+                    if (copy == null) { // ist noch nicht kopiert
+                        MetaBean meta = all.get(xmlMeta.getId());
+                        if (meta == null) { // gibt es nicht
+                            copy = createMetaBean(xmlMeta);
+                        } else { // gibt es, jetzt kopieren
+                            copy = meta.copy();
+                        }
+                        copies.put(xmlMeta.getId(), copy);
+                    }
+                    carrier.xmlMeta = xmlMeta;
+                    xmlFactory.enrichMetaBean(copy, carrier);
+                }
+            } catch (IOException e) {
+                xmlFactory.handleLoadException(xmlMetaBeanInfos, e);
+            }
+        }
+        if (nothing)
+            return all;
+        for (Map.Entry<String, MetaBean> entry : all.entrySet()) {
+            /*
+             * alle unveraenderten werden AUCH KOPIERT (nur zwar nur, wegen
+             * potentieller CrossReferenzen durch Relationships)
+             */
+            if (!copies.containsKey(entry.getKey())) {
+                if (entry.getValue().hasRelationships()) {
+                    copies.put(entry.getKey(), (MetaBean) entry.getValue().copy());
+                } else { // no relationship: do not clone()
+                    copies.put(entry.getKey(), entry.getValue());
+                }
+            }
+        }
+        return copies;
+    }
+
+    private MetaBean createMetaBean(XMLMetaBean xmlMeta) throws Exception {
+        return buildForClass(findLocalClass(xmlMeta.getImpl()));
+    }
+
+    private void updateXmlFactory() {
+        for (MetaBeanFactory each : getFactories()) {
+            if (each instanceof XMLMetaBeanFactory) { // use the first one!
+                xmlFactory = (XMLMetaBeanFactory) each;
+                return;
+            }
+        }
+        xmlFactory = null; // none
+    }
+
+    public XMLMetaBeanFactory getXmlFactory() {
+        return xmlFactory;
     }
-  }
-}
 
+    private void assertXmlFactory() {
+        if (xmlFactory == null) {
+            throw new IllegalStateException("no xmlFactory available");
+        }
+    }
+}

Modified: incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanInfos.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanInfos.java?rev=992489&r1=992488&r2=992489&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanInfos.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanInfos.java Fri Sep  3 21:48:14 2010
@@ -22,7 +22,7 @@ import com.thoughtworks.xstream.annotati
 import com.thoughtworks.xstream.annotations.XStreamOmitField;
 import org.apache.bval.model.Validation;
 import org.apache.commons.collections.FastHashMap;
-import org.apache.commons.lang.ClassUtils;
+import org.apache.commons.lang3.ClassUtils;
 
 import java.util.ArrayList;
 import java.util.List;

Modified: incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanManager.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanManager.java?rev=992489&r1=992488&r2=992489&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanManager.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaBeanManager.java Fri Sep  3 21:48:14 2010
@@ -27,107 +27,107 @@ import java.util.Map;
 import static org.apache.bval.model.Features.Property.REF_BEAN_ID;
 
 /**
- * Description: internal implementation class to construct
- * metabeans with factories and from xstream xml files.
- * You can register different XMLMetaBeanLoaders (see addLoader()) to register xstream-xml-files that
- * contain meta-data.
- * You can merge + unify meta data with method enrichCopies().
- * <br/>
+ * Description: internal implementation class to construct metabeans with
+ * factories and from xstream xml files. You can register different
+ * XMLMetaBeanLoaders (see addLoader()) to register xstream-xml-files that
+ * contain meta-data. You can merge + unify meta data with method
+ * enrichCopies(). <br/>
  * User: roman.stumm<br>
  * Date: 17.06.2010<br>
  * Time: 09:47:14<br>
  */
-public class XMLMetaBeanManager extends MetaBeanManager
-    implements MetaBeanFinder, XMLMetaBeanRegistry, MetaBeanEnricher {
-  public XMLMetaBeanManager() {
-    this(new XMLMetaBeanBuilder());
-  }
-
-  public XMLMetaBeanManager(XMLMetaBeanBuilder builder) {
-    super(builder);
-  }
-
-  public void addResourceLoader(String resource) {
-    addLoader(new XMLMetaBeanURLLoader(
-        PrivilegedActions.getClassLoader(getClass()).getResource(resource)));
-  }
-
-  public synchronized void addLoader(XMLMetaBeanLoader loader) {
-    ((XMLMetaBeanBuilder) builder).addLoader(loader);
-    cache.clear(); // clear because new loaders can affect ALL MetaBeans already created!
-    complete = false;
-  }
-
-  /**
-   * @param infos - the patches to apply
-   * @return all MetaBeans for classes that have a xml descriptor and
-   *         additional the MetaBeans loaded by the given loaders.
-   *         The given loaders may also return patches for MetaBeans that have
-   *         also been returned by other loaders. The beans with patches for
-   *         references to patched beans will be copied.
-   */
-  public Map<String, MetaBean> enrichCopies(XMLMetaBeanInfos... infos) {
-    Map<String, MetaBean> cached = findAll();
-    try {
-      Map<String, MetaBean> patched = ((XMLMetaBeanBuilder) builder).enrichCopies(cached, infos);
-      for (Object entry : patched.values()) {
-        MetaBean meta = (MetaBean) entry;
-        computeRelationships(meta, patched);
-      }
-      return patched;
-    } catch (RuntimeException e) {
-      throw e; // do not wrap runtime exceptions
-    } catch (Exception e) {
-      throw new IllegalArgumentException("error enriching beanInfos", e);
-    }
-  }
-
-  /**
-   * 
-   * @return all MetaBeans for classes that have a xml descriptor:
-   *         key = bean.id, value = MetaBean
-   */
-  public Map<String, MetaBean> findAll() {
-    if (!complete) {
-      try {
-        Map<String, MetaBean> allBuilt = builder.buildAll();
-        for (MetaBean meta : allBuilt.values()) {
-          MetaBean cached = cache.findForId(meta.getId());
-          if (cached == null) {
-            cache.cache(meta);
-          }
+public class XMLMetaBeanManager extends MetaBeanManager implements MetaBeanFinder, XMLMetaBeanRegistry,
+    MetaBeanEnricher {
+    public XMLMetaBeanManager() {
+        this(new XMLMetaBeanBuilder());
+    }
+
+    public XMLMetaBeanManager(XMLMetaBeanBuilder builder) {
+        super(builder);
+    }
+
+    public void addResourceLoader(String resource) {
+        addLoader(new XMLMetaBeanURLLoader(PrivilegedActions.getClassLoader(getClass()).getResource(resource)));
+    }
+
+    public synchronized void addLoader(XMLMetaBeanLoader loader) {
+        ((XMLMetaBeanBuilder) builder).addLoader(loader);
+        cache.clear(); // clear because new loaders can affect ALL MetaBeans
+                       // already created!
+        complete = false;
+    }
+
+    /**
+     * @param infos
+     *            - the patches to apply
+     * @return all MetaBeans for classes that have a xml descriptor and
+     *         additional the MetaBeans loaded by the given loaders. The given
+     *         loaders may also return patches for MetaBeans that have also been
+     *         returned by other loaders. The beans with patches for references
+     *         to patched beans will be copied.
+     */
+    public Map<String, MetaBean> enrichCopies(XMLMetaBeanInfos... infos) {
+        Map<String, MetaBean> cached = findAll();
+        try {
+            Map<String, MetaBean> patched = ((XMLMetaBeanBuilder) builder).enrichCopies(cached, infos);
+            for (Object entry : patched.values()) {
+                MetaBean meta = (MetaBean) entry;
+                computeRelationships(meta, patched);
+            }
+            return patched;
+        } catch (RuntimeException e) {
+            throw e; // do not wrap runtime exceptions
+        } catch (Exception e) {
+            throw new IllegalArgumentException("error enriching beanInfos", e);
         }
-        Map<String, MetaBean> map = cache.findAll();
-        for (Object oentry : map.values()) {
-          MetaBean meta = (MetaBean) oentry;
-          computeRelationships(meta, map);
+    }
+
+    /**
+     * 
+     * @return all MetaBeans for classes that have a xml descriptor: key =
+     *         bean.id, value = MetaBean
+     */
+    public Map<String, MetaBean> findAll() {
+        if (!complete) {
+            try {
+                Map<String, MetaBean> allBuilt = builder.buildAll();
+                for (MetaBean meta : allBuilt.values()) {
+                    MetaBean cached = cache.findForId(meta.getId());
+                    if (cached == null) {
+                        cache.cache(meta);
+                    }
+                }
+                Map<String, MetaBean> map = cache.findAll();
+                for (Object oentry : map.values()) {
+                    MetaBean meta = (MetaBean) oentry;
+                    computeRelationships(meta, map);
+                }
+                complete = true;
+                return map;
+            } catch (RuntimeException e) {
+                throw e; // do not wrap runtime exceptions
+            } catch (Exception e) {
+                throw new IllegalArgumentException("error creating beanInfos", e);
+            }
+        } else {
+            return cache.findAll();
+        }
+    }
+
+    protected void computeRelationships(MetaBean beanInfo, Map<String, MetaBean> cached) {
+        for (MetaProperty prop : beanInfo.getProperties()) {
+            String beanRef = (String) prop.getFeature(REF_BEAN_ID);
+            if (beanRef != null) {
+                prop.setMetaBean(cached.get(beanRef));
+            }
+        }
+    }
+
+    protected void computeRelatedMetaBean(MetaProperty prop, String beanRef) {
+        if (beanRef != null) {
+            prop.setMetaBean(findForId(beanRef));
+        } else {
+            super.computeRelatedMetaBean(prop, beanRef);
         }
-        complete = true;
-        return map;
-      } catch (RuntimeException e) {
-        throw e; // do not wrap runtime exceptions
-      } catch (Exception e) {
-        throw new IllegalArgumentException("error creating beanInfos", e);
-      }
-    } else {
-      return cache.findAll();
-    }
-  }
-
-  protected void computeRelationships(MetaBean beanInfo, Map<String, MetaBean> cached) {
-    for (MetaProperty prop : beanInfo.getProperties()) {
-      String beanRef = (String) prop.getFeature(REF_BEAN_ID);
-      if (beanRef != null) {
-        prop.setMetaBean(cached.get(beanRef));
-      }
-    }
-  }
-
-  protected void computeRelatedMetaBean(MetaProperty prop, String beanRef) {
-    if (beanRef != null) {
-        prop.setMetaBean(findForId(beanRef));
-    } else {
-      super.computeRelatedMetaBean(prop, beanRef);
     }
-  }
 }

Modified: incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaElement.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaElement.java?rev=992489&r1=992488&r2=992489&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaElement.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaElement.java Fri Sep  3 21:48:14 2010
@@ -18,7 +18,7 @@ package org.apache.bval.xml;
 
 import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
 import org.apache.bval.model.MetaProperty;
-import org.apache.commons.lang.ClassUtils;
+import org.apache.commons.lang3.ClassUtils;
 
 import static org.apache.bval.model.Features.Property.*;
 

Modified: incubator/bval/sandbox/lang3-work/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java?rev=992489&r1=992488&r2=992489&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java (original)
+++ incubator/bval/sandbox/lang3-work/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java Fri Sep  3 21:48:14 2010
@@ -32,68 +32,61 @@ import java.util.Map;
  * Time: 10:28:48<br>
  */
 public class XMLMetaBeanManagerTest extends TestCase {
-  XMLMetaBeanManager mbm = new XMLMetaBeanManager();
+    XMLMetaBeanManager mbm = new XMLMetaBeanManager();
 
-  public XMLMetaBeanManagerTest(String name) {
-    super(name);
-  }
-
-  public void setUp() throws Exception {
-    super.setUp();
-    mbm.addLoader(new XMLMetaBeanURLLoader(
-        BusinessObject.class.getResource("test-beanInfos.xml")));
-  }
-
-  public void tearDown() throws Exception {
-    super.tearDown();
-  }
-
-  public void testEnrichCopies() throws Exception {
-    Map<String, MetaBean> copies = mbm.enrichCopies(new XMLMetaBeanURLLoader(
-        BusinessObject.class.getResource("test-beanInfos-custom.xml")).load());
-    assertNotNull(copies);
-    MetaBean mb = copies.get(BusinessObject.class.getName());
-    assertFalse(mb.getProperty("lastName").isMandatory());
-    MetaBean mb2 = mbm.findForClass(BusinessObject.class);
-    assertTrue(mb2.getProperty("lastName").isMandatory());
-  }
-
-  public void testCopy() {
-    MetaBean mb = mbm.findForClass(BusinessObject.class);
-    MetaBean mb2 = mb.copy();
-    assertTrue(mb2 != mb);
-    assertTrue(mb2.getProperty("dateBirth") != mb.getProperty("dateBirth"));
-  }
-
-  public void testFindForClass() throws Exception {
-    MetaBeanFinder finder = mbm;
-    MetaBean info = finder.findForClass(BusinessObject.class);
-    assertNotNull(info);
-    assertTrue(info == info.getProperty("address").getMetaBean().getProperty("owner")
-        .getMetaBean());
-    assertTrue(info == info.getProperty("addresses").getMetaBean()
-        .getProperty("owner").getMetaBean());
-    assertTrue(info.getProperty("email").getJavaScriptValidations().length > 0);
-  }
-
-
-  public void testFindAll() {
-    Map<String, MetaBean> all = mbm.findAll();
-    assertNotNull(all);
-    Map<String, MetaBean> all2 = mbm.findAll();
-    assertEquals(all.size(), all2.size());
-    assertTrue(all.get(BusinessObject.class.getName()) ==
-        all2.get(BusinessObject.class.getName()));
-    assertTrue(all.get(BusinessObject.class.getName()) != null);
-    MetaBean bean = all.get(BusinessObject.class.getName());
-    assertTrue(bean == bean.getProperty("address").getMetaBean().getProperty("owner")
-        .getMetaBean());
-    assertTrue(bean == bean.getProperty("addresses").getMetaBean()
-        .getProperty("owner").getMetaBean());
-  }
-
-
-  public static Test suite() {
-    return new TestSuite(XMLMetaBeanManagerTest.class);
-  }
+    public XMLMetaBeanManagerTest(String name) {
+        super(name);
+    }
+
+    public void setUp() throws Exception {
+        super.setUp();
+        mbm.addLoader(new XMLMetaBeanURLLoader(BusinessObject.class.getResource("test-beanInfos.xml")));
+    }
+
+    public void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public void testEnrichCopies() throws Exception {
+        Map<String, MetaBean> copies =
+            mbm.enrichCopies(new XMLMetaBeanURLLoader(BusinessObject.class.getResource("test-beanInfos-custom.xml"))
+                .load());
+        assertNotNull(copies);
+        MetaBean mb = copies.get(BusinessObject.class.getName());
+        assertFalse(mb.getProperty("lastName").isMandatory());
+        MetaBean mb2 = mbm.findForClass(BusinessObject.class);
+        assertTrue(mb2.getProperty("lastName").isMandatory());
+    }
+
+    public void testCopy() {
+        MetaBean mb = mbm.findForClass(BusinessObject.class);
+        MetaBean mb2 = mb.copy();
+        assertTrue(mb2 != mb);
+        assertTrue(mb2.getProperty("dateBirth") != mb.getProperty("dateBirth"));
+    }
+
+    public void testFindForClass() throws Exception {
+        MetaBeanFinder finder = mbm;
+        MetaBean info = finder.findForClass(BusinessObject.class);
+        assertNotNull(info);
+        assertTrue(info == info.getProperty("address").getMetaBean().getProperty("owner").getMetaBean());
+        assertTrue(info == info.getProperty("addresses").getMetaBean().getProperty("owner").getMetaBean());
+        assertTrue(info.getProperty("email").getJavaScriptValidations().length > 0);
+    }
+
+    public void testFindAll() {
+        Map<String, MetaBean> all = mbm.findAll();
+        assertNotNull(all);
+        Map<String, MetaBean> all2 = mbm.findAll();
+        assertEquals(all.size(), all2.size());
+        assertTrue(all.get(BusinessObject.class.getName()) == all2.get(BusinessObject.class.getName()));
+        assertTrue(all.get(BusinessObject.class.getName()) != null);
+        MetaBean bean = all.get(BusinessObject.class.getName());
+        assertTrue(bean == bean.getProperty("address").getMetaBean().getProperty("owner").getMetaBean());
+        assertTrue(bean == bean.getProperty("addresses").getMetaBean().getProperty("owner").getMetaBean());
+    }
+
+    public static Test suite() {
+        return new TestSuite(XMLMetaBeanManagerTest.class);
+    }
 }

Modified: incubator/bval/sandbox/lang3-work/pom.xml
URL: http://svn.apache.org/viewvc/incubator/bval/sandbox/lang3-work/pom.xml?rev=992489&r1=992488&r2=992489&view=diff
==============================================================================
--- incubator/bval/sandbox/lang3-work/pom.xml (original)
+++ incubator/bval/sandbox/lang3-work/pom.xml Fri Sep  3 21:48:14 2010
@@ -16,11 +16,9 @@
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
--->
-<!--
+--><!--
     Maven release plugin requires the project tag to be on a single line.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
     <modelVersion>4.0.0</modelVersion>
 
@@ -28,7 +26,7 @@
         <groupId>org.apache</groupId>
         <artifactId>apache</artifactId>
         <version>7</version>
-        <relativePath />
+        <relativePath/>
     </parent>
 
     <groupId>org.apache.bval</groupId>
@@ -303,11 +301,6 @@
                 <version>1.8.5</version>
             </dependency>
             <dependency>
-                <groupId>commons-lang</groupId>
-                <artifactId>commons-lang</artifactId>
-                <version>2.4</version>
-            </dependency>
-            <dependency>
                 <groupId>org.apache.commons</groupId>
                 <artifactId>commons-lang3</artifactId>
                 <version>3.0-SNAPSHOT</version>
@@ -633,7 +626,7 @@
         <module>bval-json</module>
         <module>bval-guice</module>
         <module>bval-tck</module>
-    </modules>
-
-</project>
+    <module>bval-jsr303d</module>
+  </modules>
 
+</project>
\ No newline at end of file



Mime
View raw message