Repository: bval Updated Branches: refs/heads/bv2 92c64b3ce -> ed299e4f1
http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanInfosTest.java ---------------------------------------------------------------------- diff --git a/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanInfosTest.java b/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanInfosTest.java deleted file mode 100644 index d6e96f8..0000000 --- a/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanInfosTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * 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 static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import org.apache.bval.example.BusinessObject; -import org.apache.bval.example.BusinessObjectAddress; -import org.junit.Test; - -/** - * XMLMetaBean Tester. - */ -public class XMLMetaBeanInfosTest { - - @Test - public void testBeanInfosToXML() { - XMLMetaBeanInfos infos = new XMLMetaBeanInfos(); - infos.setBeans(new ArrayList<XMLMetaBean>()); - infos.setValidators(new ArrayList<XMLMetaValidator>()); - - 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<String, String> formatterMap = new HashMap<String, String>(); - 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); - bean.putBeanRef(relation); - - infos.getBeans().add(bean2); - - String xml = XMLMapper.getInstance().getXStream().toXML(infos); - XMLMetaBeanInfos infos2 = (XMLMetaBeanInfos) XMLMapper.getInstance().getXStream().fromXML(xml); - assertEquals(2, infos2.getBeans().size()); - } - - @Test - 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); - assertNotNull(beanInfos); - assertEquals(Integer.valueOf(31), beanInfos.getBeans().get(0).getProperty("activationDay").getMaxValue()); - assertEquals(Integer.valueOf(1), beanInfos.getBeans().get(0).getProperty("activationDay").getMinValue()); - } - -} http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java ---------------------------------------------------------------------- diff --git a/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java b/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java deleted file mode 100644 index e200d41..0000000 --- a/bval-xstream/src/test/java/org/apache/bval/xml/XMLMetaBeanManagerTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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 static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; - -import java.util.Map; - -import org.apache.bval.MetaBeanFinder; -import org.apache.bval.example.BusinessObject; -import org.apache.bval.model.MetaBean; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * Description: <br> - * User: roman.stumm<br> - * Date: 17.06.2010<br> - * Time: 10:28:48<br> - */ -public class XMLMetaBeanManagerTest { - private static XMLMetaBeanManager mbm = new XMLMetaBeanManager(); - - @BeforeClass - public static void setUp() throws Exception { - mbm.addLoader(new XMLMetaBeanURLLoader(BusinessObject.class.getResource("test-beanInfos.xml"))); - } - - @Test - 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()); - } - - @Test - public void testCopy() { - MetaBean mb = mbm.findForClass(BusinessObject.class); - MetaBean mb2 = mb.copy(); - assertNotSame(mb, mb2); - assertNotSame(mb.getProperty("dateBirth"), mb2.getProperty("dateBirth")); - } - - @SuppressWarnings("deprecation") - @Test - public void testFindForClass() throws Exception { - MetaBeanFinder finder = mbm; - MetaBean info = finder.findForClass(BusinessObject.class); - assertNotNull(info); - assertSame(info, info.getProperty("address").getMetaBean().getProperty("owner").getMetaBean()); - assertSame(info, info.getProperty("addresses").getMetaBean().getProperty("owner").getMetaBean()); - assertTrue(info.getProperty("email").getJavaScriptValidations().length > 0); - } - - @Test - public void testFindAll() { - Map<String, MetaBean> all = mbm.findAll(); - assertNotNull(all); - Map<String, MetaBean> all2 = mbm.findAll(); - assertEquals(all.size(), all2.size()); - assertSame(all.get(BusinessObject.class.getName()), all2.get(BusinessObject.class.getName())); - assertNotNull(all.get(BusinessObject.class.getName())); - MetaBean bean = all.get(BusinessObject.class.getName()); - assertSame(bean, bean.getProperty("address").getMetaBean().getProperty("owner").getMetaBean()); - assertSame(bean, bean.getProperty("addresses").getMetaBean().getProperty("owner").getMetaBean()); - } - - static void assertNotSame(Object o1, Object o2) { - assertFalse(o1 == o2); - } -} http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos-custom.xml ---------------------------------------------------------------------- diff --git a/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos-custom.xml b/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos-custom.xml deleted file mode 100644 index d9f6b72..0000000 --- a/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos-custom.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?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 http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos.xml ---------------------------------------------------------------------- diff --git a/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos.xml b/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos.xml deleted file mode 100644 index f78aa47..0000000 --- a/bval-xstream/src/test/resources/org/apache/bval/example/test-beanInfos.xml +++ /dev/null @@ -1,77 +0,0 @@ -<?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 http://git-wip-us.apache.org/repos/asf/bval/blob/ed299e4f/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index cc73e25..6e1df5b 100644 --- a/pom.xml +++ b/pom.xml @@ -52,9 +52,9 @@ <url>http://bval.apache.org/</url> <scm> - <connection>scm:svn:http://svn.apache.org/repos/asf/bval/trunk/</connection> - <developerConnection>scm:svn:https://svn.apache.org/repos/asf/bval/trunk/</developerConnection> - <url>http://svn.apache.org/repos/asf/bval/trunk/</url> + <connection>scm:git:http://git-wip-us.apache.org/repos/asf/bval</connection> + <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/bval</developerConnection> + <url>http://git-wip-us.apache.org/repos/asf/bval</url> </scm> <mailingLists> @@ -577,7 +577,7 @@ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>buildnumber-maven-plugin</artifactId> - <version>1.2</version> + <version>1.4</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -660,6 +660,7 @@ <configuration> <getRevisionOnlyOnce>true</getRevisionOnlyOnce> <revisionOnScmFailure>offline</revisionOnScmFailure> + <shortRevisionLength>10</shortRevisionLength> </configuration> <executions> <execution> @@ -692,10 +693,7 @@ </build> <modules> - <module>bval-core</module> - <module>bval-xstream</module> <module>bval-jsr</module> - <module>bval-json</module> <module>bval-extras</module> <module>bval-tck</module> <module>bundle</module>
