You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bval.apache.org by ro...@apache.org on 2010/06/18 09:08:33 UTC

svn commit: r955861 [2/2] - in /incubator/bval/trunk: ./ bval-core/ bval-core/src/main/java/org/apache/bval/ bval-core/src/main/java/org/apache/bval/routines/ bval-core/src/main/java/org/apache/bval/xml/ bval-core/src/test/java/org/apache/bval/ bval-co...

Propchange: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaElement.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaElement.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaElement.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaFeature.java (from r955856, incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/xml/XMLMetaFeature.java)
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaFeature.java?p2=incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaFeature.java&p1=incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/xml/XMLMetaFeature.java&r1=955856&r2=955861&rev=955861&view=diff
==============================================================================
    (empty)

Propchange: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaFeature.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaFeature.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaFeature.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaProperty.java (from r955856, incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/xml/XMLMetaProperty.java)
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaProperty.java?p2=incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaProperty.java&p1=incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/xml/XMLMetaProperty.java&r1=955856&r2=955861&rev=955861&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/xml/XMLMetaProperty.java (original)
+++ incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaProperty.java Fri Jun 18 07:08:31 2010
@@ -16,12 +16,11 @@
  */
 package org.apache.bval.xml;
 
-import static org.apache.bval.model.Features.Property.*;
-
-import org.apache.bval.model.MetaProperty;
-
 import com.thoughtworks.xstream.annotations.XStreamAlias;
 import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
+import org.apache.bval.model.MetaProperty;
+
+import static org.apache.bval.model.Features.Property.*;
 
 /**
  * Description: <br/>

Propchange: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaProperty.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaProperty.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaProperty.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidator.java (from r955856, incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/xml/XMLMetaValidator.java)
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidator.java?p2=incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidator.java&p1=incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/xml/XMLMetaValidator.java&r1=955856&r2=955861&rev=955861&view=diff
==============================================================================
--- incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/xml/XMLMetaValidator.java (original)
+++ incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidator.java Fri Jun 18 07:08:31 2010
@@ -19,11 +19,10 @@ package org.apache.bval.xml;
 import com.thoughtworks.xstream.annotations.XStreamAlias;
 import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
 import com.thoughtworks.xstream.annotations.XStreamOmitField;
+import org.apache.bval.model.Validation;
 
 import java.io.Serializable;
 
-import org.apache.bval.model.Validation;
-
 /**
  * Description: <br/>
  */

Propchange: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidatorReference.java (from r955856, incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/xml/XMLMetaValidatorReference.java)
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidatorReference.java?p2=incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidatorReference.java&p1=incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/xml/XMLMetaValidatorReference.java&r1=955856&r2=955861&rev=955861&view=diff
==============================================================================
    (empty)

Propchange: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidatorReference.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidatorReference.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValidatorReference.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValue.java (from r955856, incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/xml/XMLMetaValue.java)
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValue.java?p2=incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValue.java&p1=incubator/bval/trunk/bval-core/src/main/java/org/apache/bval/xml/XMLMetaValue.java&r1=955856&r2=955861&rev=955861&view=diff
==============================================================================
    (empty)

Propchange: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValue.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/bval/trunk/bval-xstream/src/main/java/org/apache/bval/xml/XMLMetaValue.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/example/BusinessEnum.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/example/BusinessEnum.java?rev=955861&view=auto
==============================================================================
--- incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/example/BusinessEnum.java (added)
+++ incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/example/BusinessEnum.java Fri Jun 18 07:08:31 2010
@@ -0,0 +1,24 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.bval.example;
+
+/**
+ * Description: <br/>
+ */
+public enum BusinessEnum {
+    VALUE1, VALUE2, VALUE3
+}

Added: incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/example/BusinessObject.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/example/BusinessObject.java?rev=955861&view=auto
==============================================================================
--- incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/example/BusinessObject.java (added)
+++ incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/example/BusinessObject.java Fri Jun 18 07:08:31 2010
@@ -0,0 +1,133 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.bval.example;
+
+import java.sql.Timestamp;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Description: <br/>
+ */
+public class BusinessObject {
+    private long userId;
+    private int numericValue;
+    private String firstName, lastName, title;
+    private Date dateBirth;
+    private Timestamp validTo;
+    private String email;
+    private BusinessEnum choice;
+    private BusinessObjectAddress address;
+    private List<BusinessObjectAddress> addresses;
+    private List properties;
+
+    public BusinessEnum getChoice() {
+        return choice;
+    }
+
+    public void setChoice(BusinessEnum choice) {
+        this.choice = choice;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public Date getDateBirth() {
+        return dateBirth;
+    }
+
+    public void setDateBirth(Date dateBirth) {
+        this.dateBirth = dateBirth;
+    }
+
+    public Timestamp getValidTo() {
+        return validTo;
+    }
+
+    public void setValidTo(Timestamp validTo) {
+        this.validTo = validTo;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public BusinessObjectAddress getAddress() {
+        return address;
+    }
+
+    public void setAddress(BusinessObjectAddress address) {
+        this.address = address;
+    }
+
+    public void setNumericValue(int newNumericValue) {
+        numericValue = newNumericValue;
+    }
+
+    public int getNumericValue() {
+        return numericValue;
+    }
+
+    public String getFirstName() {
+        return firstName;
+    }
+
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    public String getLastName() {
+        return lastName;
+    }
+
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+    public long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(long userId) {
+        this.userId = userId;
+    }
+
+    public List<BusinessObjectAddress> getAddresses() {
+        return addresses;
+    }
+
+    public void setAddresses(List<BusinessObjectAddress> addresses) {
+        this.addresses = addresses;
+    }
+
+    public List getProperties() {
+        return properties;
+    }
+
+    public void setProperties(List properties) {
+        this.properties = properties;
+    }
+}
\ No newline at end of file

Added: incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/example/BusinessObjectAddress.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/example/BusinessObjectAddress.java?rev=955861&view=auto
==============================================================================
--- incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/example/BusinessObjectAddress.java (added)
+++ incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/example/BusinessObjectAddress.java Fri Jun 18 07:08:31 2010
@@ -0,0 +1,49 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.bval.example;
+
+/**
+ * Description: <br/>
+ */
+public class BusinessObjectAddress {
+    private String city, country;
+    private BusinessObject owner;
+
+    public String getCity() {
+        return city;
+    }
+
+    public void setCity(String city) {
+        this.city = city;
+    }
+
+    public String getCountry() {
+        return country;
+    }
+
+    public void setCountry(String country) {
+        this.country = country;
+    }
+
+    public BusinessObject getOwner() {
+        return owner;
+    }
+
+    public void setOwner(BusinessObject owner) {
+        this.owner = owner;
+    }
+}

Added: incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/example/BusinessObjectBeanInfo.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/example/BusinessObjectBeanInfo.java?rev=955861&view=auto
==============================================================================
--- incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/example/BusinessObjectBeanInfo.java (added)
+++ incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/example/BusinessObjectBeanInfo.java Fri Jun 18 07:08:31 2010
@@ -0,0 +1,64 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.bval.example;
+
+import org.apache.bval.model.Features;
+
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.PropertyDescriptor;
+import java.beans.SimpleBeanInfo;
+
+/**
+ * Description: <br/>
+ */
+public class BusinessObjectBeanInfo extends SimpleBeanInfo {
+    Class targetClass = BusinessObject.class;
+
+    @Override
+    public BeanInfo[] getAdditionalBeanInfo() {
+        ExplicitBeanInfo bi = new ExplicitBeanInfo();
+        bi.setPropertyDescriptors(_getPropertyDescriptors());
+        return new BeanInfo[]{bi};
+    }
+
+    public PropertyDescriptor[] _getPropertyDescriptors() {
+        try {
+            PropertyDescriptor numericValue = new PropertyDescriptor("numericValue",
+                    targetClass, "getNumericValue", "setNumericValue");
+            numericValue.setValue(Features.Property.MAX_VALUE, new Integer(100));
+            numericValue.setValue(Features.Property.MIN_VALUE, new Integer(-100));
+            return new PropertyDescriptor[]{numericValue};
+        } catch (IntrospectionException ex) {
+            ex.printStackTrace();
+            return null;
+        }
+    }
+}
+
+class ExplicitBeanInfo extends SimpleBeanInfo {
+    private PropertyDescriptor[] propertyDescriptors;
+
+    @Override
+    public PropertyDescriptor[] getPropertyDescriptors() {
+        return propertyDescriptors;
+    }
+
+    public void setPropertyDescriptors(PropertyDescriptor[] propertyDescriptors) {
+        this.propertyDescriptors = propertyDescriptors;
+    }
+}
\ No newline at end of file

Added: incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/routines/StandardValidationTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/routines/StandardValidationTest.java?rev=955861&view=auto
==============================================================================
--- incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/routines/StandardValidationTest.java (added)
+++ incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/routines/StandardValidationTest.java Fri Jun 18 07:08:31 2010
@@ -0,0 +1,223 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.bval.routines;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.bval.BeanValidationContext;
+import org.apache.bval.model.Features;
+import org.apache.bval.model.MetaProperty;
+import org.apache.bval.model.ValidationContext;
+import org.apache.bval.model.ValidationListener;
+import org.apache.bval.xml.XMLMetaValue;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * StandardValidation Tester.
+ */
+public class StandardValidationTest extends TestCase implements ValidationListener {
+    private StandardValidation validation;
+    private BeanValidationContext<StandardValidationTest> context;
+    private List<String> reasons = new ArrayList<String>();
+    private MetaProperty metaProperty;
+    private String stringValue;
+    private Date dateValue;
+    private int intValue;
+
+    public StandardValidationTest(String name) {
+        super(name);
+    }
+
+    public void setUp() throws Exception {
+        super.setUp();
+        validation = new StandardValidation();
+        context = new BeanValidationContext<StandardValidationTest>(this);
+        metaProperty = new MetaProperty();
+        context.setBean(this, null);
+        context.setMetaProperty(metaProperty);
+    }
+
+    public void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public String getStringValue() {
+        return stringValue;
+    }
+
+    public void testValidateMandatory() {
+        metaProperty.setName("stringValue");
+
+        // test not-null value that is mandatory
+        metaProperty.setMandatory(true);
+        stringValue = "some value";
+        validation.validateMandatory(context);
+        assertTrue(reasons.isEmpty());
+
+        // test null value that is mandatory
+        context.unknownValue();
+        stringValue = null;
+        validation.validateMandatory(context);
+        assertTrue(reasons.contains(Reasons.MANDATORY));
+
+        // test null value that is NOT mandatory
+        context.unknownValue();
+        metaProperty.setMandatory(false);
+        reasons.clear();
+        validation.validateMandatory(context);
+        assertTrue(reasons.isEmpty());
+    }
+
+    public void testValidateMaxLength() {
+        metaProperty.setName("stringValue");
+        metaProperty.putFeature(Features.Property.MAX_LENGTH, 5);
+        stringValue = "1234";
+        validation.validateMaxLength(context);
+        assertTrue(reasons.isEmpty());
+        context.unknownValue();
+        stringValue = "much too long";
+        validation.validateMaxLength(context);
+        assertTrue(reasons.contains(Reasons.MAX_LENGTH));
+    }
+
+    public void testValidateMinLength() {
+        metaProperty.setName("stringValue");
+        metaProperty.putFeature(Features.Property.MIN_LENGTH, 5);
+        stringValue = "123456";
+        validation.validateMinLength(context);
+        assertTrue(reasons.isEmpty());
+        context.unknownValue();
+        stringValue = "123";
+        validation.validateMinLength(context);
+        assertTrue(reasons.contains(Reasons.MIN_LENGTH));
+    }
+
+    public void testValidateMaxValue() {
+        metaProperty.setName("stringValue");
+        metaProperty.putFeature(Features.Property.MAX_VALUE, "9999");
+        stringValue = "1111";
+        validation.validateMaxValue(context);
+        assertTrue(reasons.isEmpty());
+        context.unknownValue();
+        stringValue = "99999";
+        validation.validateMaxValue(context);
+        assertTrue(reasons.contains(Reasons.MAX_VALUE));
+    }
+
+    public void testValidateMinValue() {
+        metaProperty.setName("stringValue");
+        metaProperty.putFeature(Features.Property.MIN_VALUE, "5555");
+        stringValue = "8888";
+        validation.validateMinValue(context);
+        assertTrue(reasons.isEmpty());
+        context.unknownValue();
+        stringValue = "3333";
+        validation.validateMinValue(context);
+        assertTrue(reasons.contains(Reasons.MIN_VALUE));
+    }
+
+    public int getIntValue() {
+        return intValue;
+    }
+
+    public void testValidateMinValue_MixedNumber() {
+        metaProperty.setName("intValue");
+        metaProperty.putFeature(Features.Property.MIN_VALUE, new Long(0));
+        intValue = 5;
+        validation.validateMinValue(context);
+        assertTrue(reasons.isEmpty());
+        context.unknownValue();
+        intValue = -1;
+        validation.validateMinValue(context);
+        assertTrue(reasons.contains(Reasons.MIN_VALUE));
+    }
+
+    public void testValidateMinValue_Date_Timestamp() {
+        metaProperty.setName("dateValue");
+        Date dt = new Date();
+        metaProperty.putFeature(Features.Property.MIN_VALUE, dt);
+        dateValue = new Timestamp(dt.getTime()+1000);
+        validation.validateMinValue(context);
+        assertTrue(reasons.isEmpty());
+        context.unknownValue();
+        dateValue = new Timestamp(dt.getTime()-1000);
+        validation.validateMinValue(context);
+        assertTrue(reasons.contains(Reasons.MIN_VALUE));
+    }
+
+    public void testValidateMaxValue_AlphabeticString() {
+        metaProperty.setName("stringValue");
+        metaProperty.putFeature(Features.Property.MAX_VALUE, "BBBB");
+        stringValue = "AAAA";
+        validation.validateMaxValue(context);
+        assertTrue(reasons.isEmpty());
+        context.unknownValue();
+        stringValue = "BBBC";
+        validation.validateMaxValue(context);
+        assertTrue(reasons.contains(Reasons.MAX_VALUE));
+    }
+
+    public void testValidateRegExp() {
+        // regexp for Zip
+        String regexp = "[a-zA-Z\\- \\d]*";
+        metaProperty.setName("stringValue");
+        metaProperty.putFeature(Features.Property.REG_EXP, regexp);
+        stringValue = "53773";
+        validation.validateRegExp(context);
+        assertTrue(reasons.isEmpty());
+        context.unknownValue();
+        stringValue = "5355/7"; // invalid zip value
+        validation.validateRegExp(context);
+        assertTrue(reasons.contains(Reasons.REG_EXP));
+    }
+
+    public Date getDateValue() {
+        return dateValue;
+    }
+
+    public void testValidateTimeLag() {
+        metaProperty.setName("dateValue");
+        metaProperty.putFeature(Features.Property.TIME_LAG, XMLMetaValue.TIMELAG_Past);
+
+        dateValue = new Date(System.currentTimeMillis() - 10000);
+        validation.validateTimeLag(context);
+        assertTrue(reasons.isEmpty());
+
+        metaProperty.putFeature(Features.Property.TIME_LAG, XMLMetaValue.TIMELAG_Future);
+        validation.validateTimeLag(context);
+        assertTrue(reasons.contains(Reasons.TIME_LAG));
+
+    }
+
+    public static Test suite() {
+        return new TestSuite(StandardValidationTest.class);
+    }
+
+    public <T extends ValidationListener> void addError(String reason, ValidationContext<T> context) {
+        reasons.add(reason);
+    }
+
+    public <T extends ValidationListener> void addError(ValidationListener.Error error, ValidationContext<T> context) {
+        reasons.add(error.getReason());
+    }
+
+}

Added: incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/BeanValidatorTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/BeanValidatorTest.java?rev=955861&view=auto
==============================================================================
--- incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/BeanValidatorTest.java (added)
+++ incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/BeanValidatorTest.java Fri Jun 18 07:08:31 2010
@@ -0,0 +1,121 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.bval.xml;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.bval.BeanValidator;
+import org.apache.bval.MetaBeanFinder;
+import org.apache.bval.ValidationResults;
+import org.apache.bval.example.BusinessObject;
+import org.apache.bval.example.BusinessObjectAddress;
+import org.apache.bval.model.Features;
+import org.apache.bval.model.MetaBean;
+import org.apache.bval.routines.Reasons;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+/**
+ * BeanValidator Tester.
+ */
+public class BeanValidatorTest extends TestCase {
+    public BeanValidatorTest(String name) {
+        super(name);
+    }
+
+    public void setUp() throws Exception {
+        super.setUp();
+    }
+
+    public void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public void testValidateMapAsBean() {
+        XMLMetaBeanManagerFactory.getRegistry().addLoader(new XMLMetaBeanURLLoader(
+              BusinessObject.class.getResource("test-beanInfos.xml")));
+
+        MetaBean mb = XMLMetaBeanManagerFactory.getFinder()
+              .findForId("org.apache.bval.example.Address");
+
+        // 1. validate a bean
+        BusinessObjectAddress adr = new BusinessObjectAddress();
+        BeanValidator<ValidationResults> validator = new BeanValidator();
+        ValidationResults results = validator.validate(adr, mb);
+        assertEquals(2,
+              results.getErrorsByReason().get(Features.Property.MANDATORY).size());
+
+        // 2. validate a map with the same metabean
+        validator.setTreatMapsLikeBeans(true);
+        results = validator.validate(new HashMap(), mb);
+        assertFalse(results.isEmpty());
+        assertEquals(2,
+              results.getErrorsByReason().get(Features.Property.MANDATORY).size());
+
+        // 3. validate as empty map (jsr303 behavior)
+        validator.setTreatMapsLikeBeans(false);
+        results = validator.validate(new HashMap(), mb);
+        assertTrue(results.isEmpty());
+    }
+
+    public void testValidate() {
+        MetaBeanFinder finder = XMLMetaBeanManagerFactory.getFinder();
+        XMLMetaBeanManagerFactory.getRegistry().addLoader(new XMLMetaBeanURLLoader(
+              BusinessObject.class.getResource("test-beanInfos.xml")));
+        MetaBean info = finder.findForClass(BusinessObject.class);
+        BusinessObject object = new BusinessObject();
+        object.setAddress(new BusinessObjectAddress());
+        object.getAddress().setOwner(object);
+        BeanValidator<ValidationResults> validator = new BeanValidator();
+        ValidationResults results = validator.validate(object, info);
+        assertTrue(results.hasErrorForReason(Reasons.MANDATORY));
+        assertTrue(results.hasError(object, null));
+        assertTrue(results.hasError(object.getAddress(), null));
+
+        assertTrue(
+              validator.validateProperty(object, info.getProperty("firstName")).hasError(
+                    object, "firstName"));
+
+        object.setUserId(1L);
+        object.setFirstName("Hans");
+        object.setLastName("Tester");
+        object.setAddress(new BusinessObjectAddress());
+        object.getAddress().setOwner(object);
+        assertFalse(validator.validate(object, info).isEmpty());
+
+        object.getAddress().setCountry("0123456789012345678");
+        assertFalse(validator.validate(object, info).isEmpty());
+
+        object.getAddress().setCountry("Germany");
+        object.setAddresses(new ArrayList());
+        object.getAddresses().add(object.getAddress());
+        object.getAddresses().add(object.getAddress());
+        object.getAddresses().add(object.getAddress());
+        assertTrue(validator.validate(object, info).isEmpty());
+
+        // 4th address is too much!
+        object.getAddresses().add(object.getAddress());
+        assertFalse(
+              validator.validate(object, info).isEmpty()); // cardinality error found
+    }
+
+    public static Test suite() {
+        return new TestSuite(BeanValidatorTest.class);
+    }
+}

Added: incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanInfosTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanInfosTest.java?rev=955861&view=auto
==============================================================================
--- incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanInfosTest.java (added)
+++ incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanInfosTest.java Fri Jun 18 07:08:31 2010
@@ -0,0 +1,165 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.bval.xml;
+
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.bval.example.BusinessObject;
+import org.apache.bval.example.BusinessObjectAddress;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * XMLMetaBean Tester.
+ */
+public class XMLMetaBeanInfosTest extends TestCase {
+
+    public XMLMetaBeanInfosTest(String name) {
+        super(name);
+    }
+
+    public void setUp() throws Exception {
+        super.setUp();
+    }
+
+    public void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    public void testBeanInfosToXML() {
+        XMLMetaBeanInfos infos = new XMLMetaBeanInfos();
+        infos.setBeans(new ArrayList());
+        infos.setValidators(new ArrayList());
+
+        XMLMetaValidator validator = new XMLMetaValidator();
+        validator.setId("mandatory");
+        validator.setJava("org.apache.bval.MandatoryValidator");
+
+        infos.getValidators().add(validator);
+
+        validator = new XMLMetaValidator();
+        validator.setId("email");
+        validator.setJava("org.apache.bval.EMailValidation");
+
+        infos.getValidators().add(validator);
+
+        XMLMetaBean bean = new XMLMetaBean();
+        bean.putFeature("DOMAIN", "TestProfile");
+        bean.putFeature("label-key", "business-object-label");
+        bean.setId("User");
+        bean.setImpl(BusinessObject.class.getName());
+        bean.setProperties(new ArrayList<XMLMetaProperty>());
+        XMLMetaProperty property = new XMLMetaProperty();
+        property.setName("userId");
+        property.setMandatory(XMLMetaValue.MANDATORY);
+        bean.getProperties().add(property);
+
+        property = new XMLMetaProperty();
+        property.setName("firstName");
+        property.setMandatory(XMLMetaValue.MANDATORY);
+        property.setMaxLength(100);
+        bean.getProperties().add(property);
+
+        property = new XMLMetaProperty();
+        property.setName("lastName");
+        property.setMandatory(XMLMetaValue.MANDATORY);
+        property.setMaxLength(100);
+        bean.getProperties().add(property);
+
+        property = new XMLMetaProperty();
+        property.setName("title");
+        property.setMandatory(XMLMetaValue.OPTIONAL);
+        property.setMaxLength(10);
+        bean.getProperties().add(property);
+
+        property = new XMLMetaProperty();
+        property.setName("dateBirth");
+        property.setMandatory(XMLMetaValue.OPTIONAL);
+        property.setTimeLag(XMLMetaValue.TIMELAG_Past);
+        bean.getProperties().add(property);
+
+        property = new XMLMetaProperty();
+        property.setName("validTo");
+        property.setMandatory(XMLMetaValue.OPTIONAL);
+        property.setTimeLag(XMLMetaValue.TIMELAG_Future);
+        bean.getProperties().add(property);
+
+        property = new XMLMetaProperty();
+        property.setName("email");
+        property.putFeature(XMLMetaValue.ANNOKEY_Widget, "entry");
+        property.putFeature(XMLMetaValue.ANNOKEY_TableColumn, true);
+        Map formatterMap = new HashMap();
+        formatterMap.put("locale", "DE");
+        formatterMap.put("style", "info");
+        property.putFeature("ajax-formatter", formatterMap);
+        property.addValidator("email");
+        bean.getProperties().add(property);
+
+        infos.getBeans().add(bean);
+
+        XMLMetaBean bean2 = new XMLMetaBean();
+        bean2.setId("Address");
+        bean2.setImpl(BusinessObjectAddress.class.getName());
+        property = new XMLMetaProperty();
+        property.setName("city");
+        bean2.putProperty(property);
+        property = new XMLMetaProperty();
+        property.setName("country");
+        property.setMaxLength(10);
+        property.setMandatory(XMLMetaValue.MANDATORY);
+        bean2.putProperty(property);
+
+        XMLMetaBeanReference relation = new XMLMetaBeanReference();
+        relation.setName("address");
+        relation.setBeanId("Address");
+        relation.setMandatory(XMLMetaValue.OPTIONAL);
+//        relation.setDisplayName("UserAddress");
+        bean.putBeanRef(relation);
+
+        infos.getBeans().add(bean2);
+
+        String xml = XMLMapper.getInstance().getXStream().toXML(infos);
+//        System.out.println(xml);
+        XMLMetaBeanInfos infos2 =
+              (XMLMetaBeanInfos) XMLMapper.getInstance().getXStream().fromXML(xml);
+        assertEquals(2, infos2.getBeans().size());
+    }
+
+
+    public void testMaxValueParsing() {
+        String xml = "\n" +
+              "<beanInfos>  <bean id=\"org.apache.bval.test.model.Profile\">\n" +
+              "    <property name=\"activationDay\" minValue=\"1\" maxValue=\"31\"/>\n" +
+              "    <property name=\"activationMonth\" minValue=\"1\" maxValue=\"12\"/>\n" +
+              "  </bean></beanInfos>";
+        XMLMetaBeanInfos beanInfos = (XMLMetaBeanInfos) XMLMapper.getInstance()
+              .getXStream().fromXML(xml);
+        Assert.assertNotNull(beanInfos);
+        assertEquals(Integer.valueOf(31),
+              beanInfos.getBeans().get(0).getProperty("activationDay").getMaxValue());
+        assertEquals(Integer.valueOf(1),
+              beanInfos.getBeans().get(0).getProperty("activationDay").getMinValue());
+    }
+
+    public static Test suite() {
+        return new TestSuite(XMLMetaBeanInfosTest.class);
+    }
+}

Added: incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java?rev=955861&view=auto
==============================================================================
--- incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java (added)
+++ incubator/bval/trunk/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java Fri Jun 18 07:08:31 2010
@@ -0,0 +1,99 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.bval.xml;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import org.apache.bval.MetaBeanFinder;
+import org.apache.bval.example.BusinessObject;
+import org.apache.bval.model.MetaBean;
+
+import java.util.Map;
+
+/**
+ * Description: <br>
+ * User: roman.stumm<br>
+ * Date: 17.06.2010<br>
+ * Time: 10:28:48<br>
+ */
+public class XMLMetaBeanManagerTest extends TestCase {
+  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);
+  }
+}

Added: incubator/bval/trunk/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos-custom.xml
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos-custom.xml?rev=955861&view=auto
==============================================================================
--- incubator/bval/trunk/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos-custom.xml (added)
+++ incubator/bval/trunk/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos-custom.xml Fri Jun 18 07:08:31 2010
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<beanInfos>
+
+  <bean id="org.apache.bval.example.BusinessObject"
+        impl="org.apache.bval.example.BusinessObject">
+    <property name="lastName" mandatory="false"/>
+    <property name="unknownName" mandatory="true"/>
+  </bean>
+
+  <bean id="UnknownObject" impl="org.apache.bval.UnknownClass">
+    <property name="fullName" mandatory="true"/>
+  </bean>
+</beanInfos>
\ No newline at end of file

Added: incubator/bval/trunk/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos.xml
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos.xml?rev=955861&view=auto
==============================================================================
--- incubator/bval/trunk/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos.xml (added)
+++ incubator/bval/trunk/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos.xml Fri Jun 18 07:08:31 2010
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<beanInfos>
+  <validator id="standard" java="org.apache.bval.routines.NOPValidation"
+             jsFunction="noop"/>
+  <validator id="email" java="org.apache.bval.routines.EMailValidation"/>
+  <bean id="org.apache.bval.example.BusinessObject"
+        impl="org.apache.bval.example.BusinessObject">
+    <feature key="mainKey">
+      <value class="string">userId</value>
+    </feature>
+    <feature key="DOMAIN">
+      <value class="string">TestObjects</value>
+    </feature>
+    <feature key="WIDGET">
+      <value class="string">entry</value>
+    </feature>
+    <property name="userId" mandatory="true"/>
+    <property name="firstName" mandatory="true" maxLength="100"/>
+    <property name="lastName" mandatory="true" maxLength="100"/>
+    <property name="title" mandatory="false" maxLength="10"/>
+    <property timeLag="PAST" name="dateBirth" mandatory="false"/>
+    <property timeLag="FUTURE" name="validTo" mandatory="false"/>
+    <property name="email">
+      <feature key="WIDGET">
+        <value class="string">entry</value>
+      </feature>
+      <feature key="TABLE_COLUMN">
+        <value class="boolean">true</value>
+      </feature>
+      <feature key="ajax-formatter">
+        <value class="map">
+          <entry>
+            <string>locale</string>
+            <string>DE</string>
+          </entry>
+          <entry>
+            <string>style</string>
+            <string>info</string>
+          </entry>
+        </value>
+      </feature>
+      <validator refId="email"/>
+      <validator refId="standard"/>
+    </property>
+    <relationship beanId="org.apache.bval.example.Address" name="address" mandatory="false"
+                  displayName="UserAddress"/>
+    <relationship beanId="org.apache.bval.example.Address" name="addresses" maxLength="3"/>
+  </bean>
+  <bean id="org.apache.bval.example.Address"
+        impl="org.apache.bval.example.BusinessObjectAddress">
+    <feature key="DOMAIN">
+      <value class="string">TestObjects</value>
+    </feature>
+    <property name="city"/>
+    <property name="country" mandatory="true" maxLength="10"/>
+    <relationship name="owner" beanId="org.apache.bval.example.BusinessObject"
+                  mandatory="true"/>
+  </bean>
+</beanInfos>
\ No newline at end of file

Modified: incubator/bval/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/bval/trunk/pom.xml?rev=955861&r1=955860&r2=955861&view=diff
==============================================================================
--- incubator/bval/trunk/pom.xml (original)
+++ incubator/bval/trunk/pom.xml Fri Jun 18 07:08:31 2010
@@ -172,6 +172,17 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.bval</groupId>
+                <artifactId>bval-xstream</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.bval</groupId>
+                <artifactId>bval-xstream</artifactId>
+                <version>${project.version}</version>
+                <type>test-jar</type>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.bval</groupId>
                 <artifactId>bval-jsr303</artifactId>
                 <version>${project.version}</version>
             </dependency>
@@ -403,6 +414,7 @@
                             <exclude>**/maven-eclipse.xml</exclude>
                             <exclude>**/rat.txt</exclude>
                             <exclude>**/target/**/*</exclude>
+                            <exclude>**/*.iml</exclude>
                         </excludes>
                     </configuration>
                 </plugin>
@@ -493,8 +505,9 @@
 
     <modules>
         <module>bval-core</module>
+        <module>bval-xstream</module>
         <module>bval-jsr303</module>
-        <module>bundle</module>
+        <module>bundle</module>        
         <module>bval-json</module>
         <module>bval-guice</module>
         <module>bval-tck</module>