mvdb 2002/12/30 10:16:48 Modified: betwixt/src/test/org/apache/commons/betwixt/schema PhysicalSchema.java DbDataType.java TestSchema.java betwixt/src/test/org/apache/commons/betwixt RSSBeanReader.java SampleBeanWriter.java RSSBeanWriter.java TestBeanWriter.java TestRSSRoundTrip.java TestBeanReader.java PersonListBean.java TestXMLIntrospector.java TestXMLBeanInfoDigester.java betwixt/src/test/org/apache/commons/betwixt/nowrap Componenttest.java POTest.java TestNoWrap.java betwixt/src/test/org/apache/commons/betwixt/strategy/alt TestElementsAlt.java betwixt/src/test/org/apache/commons/betwixt/strategy TestCapitalizeNameMapper.java TestDefaultNameMapper.java TestDefaultPluralStemmer.java TestHyphenatedNameMapper.java TestElementsIO.java TestDecapitalizeNameMapper.java betwixt/src/test/org/apache/commons/betwixt/recursion Element.java TestRecursion.java IdBean.java betwixt/src/test/org/apache/commons/betwixt/dotbetwixt TestBeanToXml.java betwixt/src/test/org/apache/commons/betwixt/xmlunit XmlTestCase.java betwixt/src/test/org/apache/commons/betwixt/registry TestXMLBeanInfoRegistry.java betwixt/src/test/org/apache/commons/betwixt/digester IDBean.java TestIDRead.java TestXMLIntrospectorHelper.java Log: Fixed imports and added license where they were missing Revision Changes Path 1.2 +5 -6 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/schema/PhysicalSchema.java Index: PhysicalSchema.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/schema/PhysicalSchema.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- PhysicalSchema.java 11 Jun 2002 16:05:21 -0000 1.1 +++ PhysicalSchema.java 30 Dec 2002 18:16:47 -0000 1.2 @@ -62,7 +62,6 @@ package org.apache.commons.betwixt.schema; -import java.util.Vector; import java.util.ArrayList; import java.util.List; 1.2 +5 -8 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/schema/DbDataType.java Index: DbDataType.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/schema/DbDataType.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- DbDataType.java 11 Jun 2002 16:05:21 -0000 1.1 +++ DbDataType.java 30 Dec 2002 18:16:47 -0000 1.2 @@ -62,9 +62,6 @@ package org.apache.commons.betwixt.schema; -import java.util.ArrayList; -import java.util.List; - /** * @author <a href="mailto:[EMAIL PROTECTED]">Martin van den Bemt</a> * @version $Id$ 1.5 +9 -8 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/schema/TestSchema.java Index: TestSchema.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/schema/TestSchema.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- TestSchema.java 27 Nov 2002 22:19:12 -0000 1.4 +++ TestSchema.java 30 Dec 2002 18:16:47 -0000 1.5 @@ -65,15 +65,16 @@ import java.io.StringWriter; import java.io.Writer; -import junit.framework.TestCase; import junit.framework.Test; import junit.framework.TestSuite; -import org.apache.commons.betwixt.*; + +import org.apache.commons.betwixt.AbstractTestCase; +import org.apache.commons.betwixt.XMLIntrospector; import org.apache.commons.betwixt.io.BeanReader; import org.apache.commons.betwixt.io.BeanWriter; +import org.apache.commons.betwixt.registry.DefaultXMLBeanInfoRegistry; import org.apache.commons.betwixt.strategy.DecapitalizeNameMapper; import org.apache.commons.betwixt.strategy.HyphenatedNameMapper; -import org.apache.commons.betwixt.registry.DefaultXMLBeanInfoRegistry; /** 1.3 +1 -7 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/RSSBeanReader.java Index: RSSBeanReader.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/RSSBeanReader.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- RSSBeanReader.java 26 Jul 2002 21:04:05 -0000 1.2 +++ RSSBeanReader.java 30 Dec 2002 18:16:47 -0000 1.3 @@ -9,18 +9,12 @@ */ package org.apache.commons.betwixt; -import java.net.URL; import java.io.FileInputStream; import java.io.InputStream; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; -import junit.textui.TestRunner; +import java.net.URL; import org.apache.commons.betwixt.io.BeanReader; import org.apache.commons.betwixt.io.BeanWriter; - import org.apache.commons.digester.rss.Channel; import org.apache.commons.digester.rss.RSSDigester; 1.2 +0 -7 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/SampleBeanWriter.java Index: SampleBeanWriter.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/SampleBeanWriter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- SampleBeanWriter.java 10 Jun 2002 17:53:32 -0000 1.1 +++ SampleBeanWriter.java 30 Dec 2002 18:16:47 -0000 1.2 @@ -61,13 +61,6 @@ */ package org.apache.commons.betwixt; -import java.io.StringWriter; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; -import junit.textui.TestRunner; - import org.apache.commons.betwixt.io.BeanWriter; 1.3 +0 -6 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/RSSBeanWriter.java Index: RSSBeanWriter.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/RSSBeanWriter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- RSSBeanWriter.java 26 Jul 2002 21:04:05 -0000 1.2 +++ RSSBeanWriter.java 30 Dec 2002 18:16:47 -0000 1.3 @@ -12,13 +12,7 @@ import java.io.FileInputStream; import java.io.InputStream; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; -import junit.textui.TestRunner; - import org.apache.commons.betwixt.io.BeanWriter; - import org.apache.commons.digester.rss.RSSDigester; /** Reads an RSS file using Digesters's RSS demo then uses Betwixt 1.7 +0 -5 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/TestBeanWriter.java Index: TestBeanWriter.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/TestBeanWriter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- TestBeanWriter.java 15 Dec 2002 19:03:34 -0000 1.6 +++ TestBeanWriter.java 30 Dec 2002 18:16:47 -0000 1.7 @@ -63,18 +63,13 @@ import java.io.ByteArrayOutputStream; import java.io.PrintStream; -import java.io.StringWriter; import junit.framework.Test; -import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.apache.commons.betwixt.io.BeanWriter; import org.apache.commons.betwixt.io.CyclicReferenceException; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.impl.SimpleLog; 1.4 +0 -6 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/TestRSSRoundTrip.java Index: TestRSSRoundTrip.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/TestRSSRoundTrip.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestRSSRoundTrip.java 23 Dec 2002 20:04:08 -0000 1.3 +++ TestRSSRoundTrip.java 30 Dec 2002 18:16:47 -0000 1.4 @@ -69,19 +69,13 @@ import java.net.URL; import junit.framework.Test; -import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.apache.commons.betwixt.io.BeanReader; import org.apache.commons.betwixt.io.BeanWriter; - import org.apache.commons.digester.rss.Channel; import org.apache.commons.digester.rss.RSSDigester; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.commons.logging.impl.SimpleLog; /** Test harness which parses an RSS document using Digester 1.8 +1 -10 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/TestBeanReader.java Index: TestBeanReader.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/TestBeanReader.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- TestBeanReader.java 11 Dec 2002 22:12:11 -0000 1.7 +++ TestBeanReader.java 30 Dec 2002 18:16:47 -0000 1.8 @@ -10,8 +10,8 @@ package org.apache.commons.betwixt; import java.io.FileInputStream; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.io.StringReader; import java.io.StringWriter; import java.math.BigDecimal; @@ -22,21 +22,12 @@ import java.util.List; import junit.framework.Test; -import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.apache.commons.beanutils.ConvertUtils; - import org.apache.commons.betwixt.io.BeanReader; import org.apache.commons.betwixt.io.BeanWriter; -import org.apache.commons.betwixt.io.BeanCreateRule; - -import org.apache.commons.betwixt.digester.XMLIntrospectorHelper; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.commons.logging.impl.SimpleLog; /** Test harness for the BeanReader 1.2 +4 -4 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/PersonListBean.java Index: PersonListBean.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/PersonListBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- PersonListBean.java 11 Dec 2002 22:12:39 -0000 1.1 +++ PersonListBean.java 30 Dec 2002 18:16:47 -0000 1.2 @@ -61,8 +61,8 @@ */ package org.apache.commons.betwixt; -import java.util.List; import java.util.ArrayList; +import java.util.List; /** <p>Bean to test lists of people</p> * 1.3 +1 -4 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/TestXMLIntrospector.java Index: TestXMLIntrospector.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/TestXMLIntrospector.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestXMLIntrospector.java 27 Nov 2002 22:19:12 -0000 1.2 +++ TestXMLIntrospector.java 30 Dec 2002 18:16:47 -0000 1.3 @@ -61,15 +61,12 @@ */ package org.apache.commons.betwixt; -import java.io.StringWriter; - import junit.framework.Test; -import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; -import org.apache.commons.betwixt.registry.NoCacheRegistry; import org.apache.commons.betwixt.registry.DefaultXMLBeanInfoRegistry; +import org.apache.commons.betwixt.registry.NoCacheRegistry; /** Test harness for the XMLIntrospector 1.3 +0 -2 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/TestXMLBeanInfoDigester.java Index: TestXMLBeanInfoDigester.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/TestXMLBeanInfoDigester.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestXMLBeanInfoDigester.java 26 Jul 2002 21:04:05 -0000 1.2 +++ TestXMLBeanInfoDigester.java 30 Dec 2002 18:16:47 -0000 1.3 @@ -65,12 +65,10 @@ import java.io.InputStream; import junit.framework.Test; -import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; import org.apache.commons.betwixt.digester.XMLBeanInfoDigester; -import org.apache.commons.digester.rss.Channel; /** Test harness for the Digester of XMLBeanInfo * 1.2 +60 -0 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/nowrap/Componenttest.java Index: Componenttest.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/nowrap/Componenttest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Componenttest.java 8 Jul 2002 16:40:06 -0000 1.1 +++ Componenttest.java 30 Dec 2002 18:16:47 -0000 1.2 @@ -1,3 +1,63 @@ +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999-2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Commons", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ package org.apache.commons.betwixt.nowrap; public class Componenttest 1.2 +60 -1 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/nowrap/POTest.java Index: POTest.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/nowrap/POTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- POTest.java 8 Jul 2002 16:40:06 -0000 1.1 +++ POTest.java 30 Dec 2002 18:16:47 -0000 1.2 @@ -1,6 +1,65 @@ +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999-2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Commons", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ package org.apache.commons.betwixt.nowrap; -// Java Core Classes import java.util.ArrayList; import java.util.List; 1.5 +66 -10 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/nowrap/TestNoWrap.java Index: TestNoWrap.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/nowrap/TestNoWrap.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- TestNoWrap.java 10 Sep 2002 12:41:24 -0000 1.4 +++ TestNoWrap.java 30 Dec 2002 18:16:47 -0000 1.5 @@ -1,21 +1,77 @@ +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999-2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Commons", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + */ package org.apache.commons.betwixt.nowrap; -import java.util.ArrayList; import java.io.File; import java.io.FileInputStream; -import java.io.IOException; +import junit.framework.Test; +import junit.framework.TestSuite; + +import org.apache.commons.betwixt.AbstractTestCase; +import org.apache.commons.betwixt.XMLIntrospector; import org.apache.commons.betwixt.io.BeanReader; import org.apache.commons.betwixt.io.BeanWriter; -import org.apache.commons.betwixt.XMLIntrospector; import org.apache.commons.betwixt.strategy.DecapitalizeNameMapper; import org.apache.commons.betwixt.strategy.DefaultPluralStemmer; -import org.apache.commons.betwixt.AbstractTestCase; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; -import junit.textui.TestRunner; /** * Test harness for the base PO object 1.2 +180 -184 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/strategy/alt/TestElementsAlt.java Index: TestElementsAlt.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/strategy/alt/TestElementsAlt.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestElementsAlt.java 23 Dec 2002 19:26:53 -0000 1.1 +++ TestElementsAlt.java 30 Dec 2002 18:16:48 -0000 1.2 @@ -1,184 +1,180 @@ -/* - * $Header$ - * $Revision$ - * $Date$ - * - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2002 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Commons", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact [EMAIL PROTECTED] - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - * - * $Id$ - */ - -package org.apache.commons.betwixt.strategy.alt; - -import java.io.InputStream; -import java.io.StringReader; -import java.io.StringWriter; -import java.io.Writer; - -import junit.framework.TestCase; - -import org.apache.commons.logging.impl.SimpleLog; - -import org.apache.commons.betwixt.XMLIntrospector; -import org.apache.commons.betwixt.io.BeanReader; -import org.apache.commons.betwixt.io.BeanWriter; -import org.apache.commons.betwixt.io.BeanCreateRule; -import org.apache.commons.betwixt.strategy.CapitalizeNameMapper; -import org.apache.commons.betwixt.strategy.DecapitalizeNameMapper; -import org.apache.commons.betwixt.strategy.DefaultNameMapper; -import org.apache.commons.betwixt.strategy.HyphenatedNameMapper; -import org.apache.commons.betwixt.strategy.NameMapper; - - -/** - * Tests streaming/destreaming of an <code>Elements</code> bean, - * a container for <code>Element</code> instances, using various name mappers - * The objective of this is to verify that containers whose names - * are plurals of their contents can be written and read back successfully. - * - * @author <a href="mailto:[EMAIL PROTECTED]">Tim Anderson</a> - */ -public class TestElementsAlt extends TestCase { - -// private SimpleLog testLog; - - public TestElementsAlt(String name) { - super(name); -// testLog = new SimpleLog("[TestElementsAlt]"); -// testLog.setLevel(SimpleLog.LOG_LEVEL_TRACE); - } - - public void testCapitalizeNameMapper() throws Exception { -// testLog.debug("Testing capitalize name mapper"); - doTest(new CapitalizeNameMapper(), "capitalize name mapper"); - } - - public void testDecapitalizeNameMapper() throws Exception { -// testLog.debug("Testing decapitalize name mapper"); - doTest(new DecapitalizeNameMapper(), "decapitalize name mapper"); - } - - public void testDefaultElementMapper() throws Exception { -// testLog.debug("Testing default name mapper"); - doTest(new DefaultNameMapper(), "default name mapper"); - } - - public void testHyphenatedNameMapper() throws Exception { -// testLog.debug("Testing hyphenated name mapper"); - doTest(new HyphenatedNameMapper(), "hyphenated name mapper"); - } - - private void doTest(NameMapper mapper, String testName) throws Exception { - Elements elements = new Elements(); - elements.addElement(new Element("a")); - elements.addElement(new Element("b")); - elements.addElement(new Element("c")); - - StringWriter out = new StringWriter(); - BeanWriter writer = newBeanWriter(out, mapper); - writer.write(elements); - writer.flush(); - - String xmlOut = out.toString(); - -// testLog.debug(xmlOut); - - StringReader in = new StringReader(xmlOut); - -// SimpleLog log = new SimpleLog("[TestElementsAlt:BeanReader]"); -// log.setLevel(SimpleLog.LOG_LEVEL_TRACE); - - BeanReader reader = new BeanReader(); -// reader.setLog(log); - -// log = new SimpleLog("[TestElementsAlt:BeanReader]"); -// log.setLevel(SimpleLog.LOG_LEVEL_TRACE); -// BeanCreateRule.setLog(log); - - reader.setXMLIntrospector(newXMLIntrospector(mapper)); - reader.registerBeanClass(Elements.class); - Elements result = (Elements) reader.parse(in); - - assertNotNull("Element 'a' is null (" + testName + ")", result.getElement("a")); - assertNotNull("Element 'b' is null (" + testName + ")", result.getElement("b")); - assertNotNull("Element 'c' is null (" + testName + ")", result.getElement("c")); - } - - private BeanWriter newBeanWriter(Writer writer, NameMapper mapper) { -// SimpleLog log = new SimpleLog("[TestElementsAlt:BeanWriter]"); -// log.setLevel(SimpleLog.LOG_LEVEL_TRACE); - - BeanWriter result = new BeanWriter(writer); -// result.setLog(log); - -// log = new SimpleLog("[TestElementsAlt:AbstractBeanWriter]"); -// log.setLevel(SimpleLog.LOG_LEVEL_TRACE); -// result.setAbstractBeanWriterLog(log); - - result.setXMLIntrospector(newXMLIntrospector(mapper)); - result.enablePrettyPrint(); - result.setWriteIDs(false); - return result; - } - - private XMLIntrospector newXMLIntrospector(NameMapper mapper) { - XMLIntrospector introspector = new XMLIntrospector(); - introspector.setAttributesForPrimitives(true); - introspector.setWrapCollectionsInElement(false); - introspector.setElementNameMapper(mapper); - return introspector; - } -} - +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999-2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Commons", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + * $Id$ + */ + +package org.apache.commons.betwixt.strategy.alt; + +import java.io.StringReader; +import java.io.StringWriter; +import java.io.Writer; + +import junit.framework.TestCase; + +import org.apache.commons.betwixt.XMLIntrospector; +import org.apache.commons.betwixt.io.BeanReader; +import org.apache.commons.betwixt.io.BeanWriter; +import org.apache.commons.betwixt.strategy.CapitalizeNameMapper; +import org.apache.commons.betwixt.strategy.DecapitalizeNameMapper; +import org.apache.commons.betwixt.strategy.DefaultNameMapper; +import org.apache.commons.betwixt.strategy.HyphenatedNameMapper; +import org.apache.commons.betwixt.strategy.NameMapper; + + +/** + * Tests streaming/destreaming of an <code>Elements</code> bean, + * a container for <code>Element</code> instances, using various name mappers + * The objective of this is to verify that containers whose names + * are plurals of their contents can be written and read back successfully. + * + * @author <a href="mailto:[EMAIL PROTECTED]">Tim Anderson</a> + */ +public class TestElementsAlt extends TestCase { + +// private SimpleLog testLog; + + public TestElementsAlt(String name) { + super(name); +// testLog = new SimpleLog("[TestElementsAlt]"); +// testLog.setLevel(SimpleLog.LOG_LEVEL_TRACE); + } + + public void testCapitalizeNameMapper() throws Exception { +// testLog.debug("Testing capitalize name mapper"); + doTest(new CapitalizeNameMapper(), "capitalize name mapper"); + } + + public void testDecapitalizeNameMapper() throws Exception { +// testLog.debug("Testing decapitalize name mapper"); + doTest(new DecapitalizeNameMapper(), "decapitalize name mapper"); + } + + public void testDefaultElementMapper() throws Exception { +// testLog.debug("Testing default name mapper"); + doTest(new DefaultNameMapper(), "default name mapper"); + } + + public void testHyphenatedNameMapper() throws Exception { +// testLog.debug("Testing hyphenated name mapper"); + doTest(new HyphenatedNameMapper(), "hyphenated name mapper"); + } + + private void doTest(NameMapper mapper, String testName) throws Exception { + Elements elements = new Elements(); + elements.addElement(new Element("a")); + elements.addElement(new Element("b")); + elements.addElement(new Element("c")); + + StringWriter out = new StringWriter(); + BeanWriter writer = newBeanWriter(out, mapper); + writer.write(elements); + writer.flush(); + + String xmlOut = out.toString(); + +// testLog.debug(xmlOut); + + StringReader in = new StringReader(xmlOut); + +// SimpleLog log = new SimpleLog("[TestElementsAlt:BeanReader]"); +// log.setLevel(SimpleLog.LOG_LEVEL_TRACE); + + BeanReader reader = new BeanReader(); +// reader.setLog(log); + +// log = new SimpleLog("[TestElementsAlt:BeanReader]"); +// log.setLevel(SimpleLog.LOG_LEVEL_TRACE); +// BeanCreateRule.setLog(log); + + reader.setXMLIntrospector(newXMLIntrospector(mapper)); + reader.registerBeanClass(Elements.class); + Elements result = (Elements) reader.parse(in); + + assertNotNull("Element 'a' is null (" + testName + ")", result.getElement("a")); + assertNotNull("Element 'b' is null (" + testName + ")", result.getElement("b")); + assertNotNull("Element 'c' is null (" + testName + ")", result.getElement("c")); + } + + private BeanWriter newBeanWriter(Writer writer, NameMapper mapper) { +// SimpleLog log = new SimpleLog("[TestElementsAlt:BeanWriter]"); +// log.setLevel(SimpleLog.LOG_LEVEL_TRACE); + + BeanWriter result = new BeanWriter(writer); +// result.setLog(log); + +// log = new SimpleLog("[TestElementsAlt:AbstractBeanWriter]"); +// log.setLevel(SimpleLog.LOG_LEVEL_TRACE); +// result.setAbstractBeanWriterLog(log); + + result.setXMLIntrospector(newXMLIntrospector(mapper)); + result.enablePrettyPrint(); + result.setWriteIDs(false); + return result; + } + + private XMLIntrospector newXMLIntrospector(NameMapper mapper) { + XMLIntrospector introspector = new XMLIntrospector(); + introspector.setAttributesForPrimitives(true); + introspector.setWrapCollectionsInElement(false); + introspector.setElementNameMapper(mapper); + return introspector; + } +} + 1.2 +6 -6 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/strategy/TestCapitalizeNameMapper.java Index: TestCapitalizeNameMapper.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/strategy/TestCapitalizeNameMapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestCapitalizeNameMapper.java 2 Jul 2002 21:21:19 -0000 1.1 +++ TestCapitalizeNameMapper.java 30 Dec 2002 18:16:48 -0000 1.2 @@ -61,9 +61,9 @@ */ package org.apache.commons.betwixt.strategy; +import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; -import junit.framework.Test; /** * Test that harnasses the CapitlizeNameMapper 1.2 +6 -6 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/strategy/TestDefaultNameMapper.java Index: TestDefaultNameMapper.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/strategy/TestDefaultNameMapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestDefaultNameMapper.java 11 Jun 2002 16:05:21 -0000 1.1 +++ TestDefaultNameMapper.java 30 Dec 2002 18:16:48 -0000 1.2 @@ -61,9 +61,9 @@ */ package org.apache.commons.betwixt.strategy; +import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; -import junit.framework.Test; /** * Testcase that covers the DefaultNameMapper. 1.3 +9 -7 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/strategy/TestDefaultPluralStemmer.java Index: TestDefaultPluralStemmer.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/strategy/TestDefaultPluralStemmer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestDefaultPluralStemmer.java 20 Sep 2002 14:00:41 -0000 1.2 +++ TestDefaultPluralStemmer.java 30 Dec 2002 18:16:48 -0000 1.3 @@ -61,11 +61,13 @@ */ package org.apache.commons.betwixt.strategy; -import junit.framework.TestCase; +import java.util.HashMap; + import junit.framework.Test; +import junit.framework.TestCase; import junit.framework.TestSuite; + import org.apache.commons.betwixt.ElementDescriptor; -import java.util.HashMap; /** * Tests the defaultPluralStemmer 1.5 +7 -7 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/strategy/TestHyphenatedNameMapper.java Index: TestHyphenatedNameMapper.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/strategy/TestHyphenatedNameMapper.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- TestHyphenatedNameMapper.java 16 Dec 2002 21:59:21 -0000 1.4 +++ TestHyphenatedNameMapper.java 30 Dec 2002 18:16:48 -0000 1.5 @@ -64,11 +64,11 @@ import java.util.ArrayList; -import org.apache.commons.betwixt.XMLIntrospector; - import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; + +import org.apache.commons.betwixt.XMLIntrospector; /** Test harness for the HyphenatedNameMapper * 1.2 +175 -184 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/strategy/TestElementsIO.java Index: TestElementsIO.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/strategy/TestElementsIO.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestElementsIO.java 16 Dec 2002 21:59:21 -0000 1.1 +++ TestElementsIO.java 30 Dec 2002 18:16:48 -0000 1.2 @@ -1,184 +1,175 @@ -/* - * $Header$ - * $Revision$ - * $Date$ - * - * ==================================================================== - * - * The Apache Software License, Version 1.1 - * - * Copyright (c) 1999-2002 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, if - * any, must include the following acknowlegement: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowlegement may appear in the software itself, - * if and wherever such third-party acknowlegements normally appear. - * - * 4. The names "The Jakarta Project", "Commons", and "Apache Software - * Foundation" must not be used to endorse or promote products derived - * from this software without prior written permission. For written - * permission, please contact [EMAIL PROTECTED] - * - * 5. Products derived from this software may not be called "Apache" - * nor may "Apache" appear in their names without prior written - * permission of the Apache Group. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - * - * $Id$ - */ - -package org.apache.commons.betwixt.strategy; - -import java.io.InputStream; -import java.io.StringReader; -import java.io.StringWriter; -import java.io.Writer; - -import junit.framework.TestCase; - -import org.apache.commons.logging.impl.SimpleLog; - -import org.apache.commons.betwixt.XMLIntrospector; -import org.apache.commons.betwixt.io.BeanReader; -import org.apache.commons.betwixt.io.BeanWriter; -import org.apache.commons.betwixt.io.BeanCreateRule; -import org.apache.commons.betwixt.strategy.CapitalizeNameMapper; -import org.apache.commons.betwixt.strategy.DecapitalizeNameMapper; -import org.apache.commons.betwixt.strategy.DefaultNameMapper; -import org.apache.commons.betwixt.strategy.HyphenatedNameMapper; -import org.apache.commons.betwixt.strategy.NameMapper; - - -/** - * Tests streaming/destreaming of an <code>Elements</code> bean, - * a container for <code>Element</code> instances, using various name mappers - * The objective of this is to verify that containers whose names - * are plurals of their contents can be written and read back successfully. - * - * @author <a href="mailto:[EMAIL PROTECTED]">Tim Anderson</a> - */ -public class TestElementsIO extends TestCase { - -// private SimpleLog testLog; - - public TestElementsIO(String name) { - super(name); -// testLog = new SimpleLog("[TextElementsIO]"); -// testLog.setLevel(SimpleLog.LOG_LEVEL_TRACE); - } - - public void testCapitalizeNameMapper() throws Exception { -// testLog.debug("Testing capitalize name mapper"); - doTest(new CapitalizeNameMapper(), "capitalize name mapper"); - } - - public void testDecapitalizeNameMapper() throws Exception { -// testLog.debug("Testing decapitalize name mapper"); - doTest(new DecapitalizeNameMapper(), "decapitalize name mapper"); - } - - public void testDefaultElementMapper() throws Exception { -// testLog.debug("Testing default name mapper"); - doTest(new DefaultNameMapper(), "default name mapper"); - } - - public void testHyphenatedNameMapper() throws Exception { -// testLog.debug("Testing hyphenated name mapper"); - doTest(new HyphenatedNameMapper(), "hyphenated name mapper"); - } - - private void doTest(NameMapper mapper, String testName) throws Exception { - Elements elements = new Elements(); - elements.addElement(new Element("a")); - elements.addElement(new Element("b")); - elements.addElement(new Element("c")); - - StringWriter out = new StringWriter(); - BeanWriter writer = newBeanWriter(out, mapper); - writer.write(elements); - writer.flush(); - - String xmlOut = out.toString(); - -// testLog.debug(xmlOut); - - StringReader in = new StringReader(xmlOut); - -// SimpleLog log = new SimpleLog("[TextElementsIO:BeanReader]"); -// log.setLevel(SimpleLog.LOG_LEVEL_TRACE); - - BeanReader reader = new BeanReader(); -// reader.setLog(log); - -// log = new SimpleLog("[TextElementsIO:BeanReader]"); -// log.setLevel(SimpleLog.LOG_LEVEL_TRACE); -// BeanCreateRule.setLog(log); - - reader.setXMLIntrospector(newXMLIntrospector(mapper)); - reader.registerBeanClass(Elements.class); - Elements result = (Elements) reader.parse(in); - - assertNotNull("Element 'a' is null (" + testName + ")", result.getElement("a")); - assertNotNull("Element 'b' is null (" + testName + ")", result.getElement("b")); - assertNotNull("Element 'c' is null (" + testName + ")", result.getElement("c")); - } - - private BeanWriter newBeanWriter(Writer writer, NameMapper mapper) { -// SimpleLog log = new SimpleLog("[TextElementsIO:BeanWriter]"); -// log.setLevel(SimpleLog.LOG_LEVEL_TRACE); - - BeanWriter result = new BeanWriter(writer); -// result.setLog(log); - -// log = new SimpleLog("[TextElementsIO:AbstractBeanWriter]"); -// log.setLevel(SimpleLog.LOG_LEVEL_TRACE); -// result.setAbstractBeanWriterLog(log); - - result.setXMLIntrospector(newXMLIntrospector(mapper)); - result.enablePrettyPrint(); - result.setWriteIDs(false); - return result; - } - - private XMLIntrospector newXMLIntrospector(NameMapper mapper) { - XMLIntrospector introspector = new XMLIntrospector(); - introspector.setAttributesForPrimitives(true); - introspector.setWrapCollectionsInElement(false); - introspector.setElementNameMapper(mapper); - return introspector; - } -} - +/* + * $Header$ + * $Revision$ + * $Date$ + * + * ==================================================================== + * + * The Apache Software License, Version 1.1 + * + * Copyright (c) 1999-2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Commons", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact [EMAIL PROTECTED] + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + * + * $Id$ + */ + +package org.apache.commons.betwixt.strategy; + +import java.io.StringReader; +import java.io.StringWriter; +import java.io.Writer; + +import junit.framework.TestCase; + +import org.apache.commons.betwixt.XMLIntrospector; +import org.apache.commons.betwixt.io.BeanReader; +import org.apache.commons.betwixt.io.BeanWriter; + + +/** + * Tests streaming/destreaming of an <code>Elements</code> bean, + * a container for <code>Element</code> instances, using various name mappers + * The objective of this is to verify that containers whose names + * are plurals of their contents can be written and read back successfully. + * + * @author <a href="mailto:[EMAIL PROTECTED]">Tim Anderson</a> + */ +public class TestElementsIO extends TestCase { + +// private SimpleLog testLog; + + public TestElementsIO(String name) { + super(name); +// testLog = new SimpleLog("[TextElementsIO]"); +// testLog.setLevel(SimpleLog.LOG_LEVEL_TRACE); + } + + public void testCapitalizeNameMapper() throws Exception { +// testLog.debug("Testing capitalize name mapper"); + doTest(new CapitalizeNameMapper(), "capitalize name mapper"); + } + + public void testDecapitalizeNameMapper() throws Exception { +// testLog.debug("Testing decapitalize name mapper"); + doTest(new DecapitalizeNameMapper(), "decapitalize name mapper"); + } + + public void testDefaultElementMapper() throws Exception { +// testLog.debug("Testing default name mapper"); + doTest(new DefaultNameMapper(), "default name mapper"); + } + + public void testHyphenatedNameMapper() throws Exception { +// testLog.debug("Testing hyphenated name mapper"); + doTest(new HyphenatedNameMapper(), "hyphenated name mapper"); + } + + private void doTest(NameMapper mapper, String testName) throws Exception { + Elements elements = new Elements(); + elements.addElement(new Element("a")); + elements.addElement(new Element("b")); + elements.addElement(new Element("c")); + + StringWriter out = new StringWriter(); + BeanWriter writer = newBeanWriter(out, mapper); + writer.write(elements); + writer.flush(); + + String xmlOut = out.toString(); + +// testLog.debug(xmlOut); + + StringReader in = new StringReader(xmlOut); + +// SimpleLog log = new SimpleLog("[TextElementsIO:BeanReader]"); +// log.setLevel(SimpleLog.LOG_LEVEL_TRACE); + + BeanReader reader = new BeanReader(); +// reader.setLog(log); + +// log = new SimpleLog("[TextElementsIO:BeanReader]"); +// log.setLevel(SimpleLog.LOG_LEVEL_TRACE); +// BeanCreateRule.setLog(log); + + reader.setXMLIntrospector(newXMLIntrospector(mapper)); + reader.registerBeanClass(Elements.class); + Elements result = (Elements) reader.parse(in); + + assertNotNull("Element 'a' is null (" + testName + ")", result.getElement("a")); + assertNotNull("Element 'b' is null (" + testName + ")", result.getElement("b")); + assertNotNull("Element 'c' is null (" + testName + ")", result.getElement("c")); + } + + private BeanWriter newBeanWriter(Writer writer, NameMapper mapper) { +// SimpleLog log = new SimpleLog("[TextElementsIO:BeanWriter]"); +// log.setLevel(SimpleLog.LOG_LEVEL_TRACE); + + BeanWriter result = new BeanWriter(writer); +// result.setLog(log); + +// log = new SimpleLog("[TextElementsIO:AbstractBeanWriter]"); +// log.setLevel(SimpleLog.LOG_LEVEL_TRACE); +// result.setAbstractBeanWriterLog(log); + + result.setXMLIntrospector(newXMLIntrospector(mapper)); + result.enablePrettyPrint(); + result.setWriteIDs(false); + return result; + } + + private XMLIntrospector newXMLIntrospector(NameMapper mapper) { + XMLIntrospector introspector = new XMLIntrospector(); + introspector.setAttributesForPrimitives(true); + introspector.setWrapCollectionsInElement(false); + introspector.setElementNameMapper(mapper); + return introspector; + } +} + 1.2 +6 -6 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/strategy/TestDecapitalizeNameMapper.java Index: TestDecapitalizeNameMapper.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/strategy/TestDecapitalizeNameMapper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestDecapitalizeNameMapper.java 11 Jun 2002 16:05:21 -0000 1.1 +++ TestDecapitalizeNameMapper.java 30 Dec 2002 18:16:48 -0000 1.2 @@ -61,9 +61,9 @@ */ package org.apache.commons.betwixt.strategy; +import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; -import junit.framework.Test; /** * Test that harnasses the DecapitlizeNameMapper 1.3 +6 -6 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/recursion/Element.java Index: Element.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/recursion/Element.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Element.java 15 Dec 2002 19:03:34 -0000 1.2 +++ Element.java 30 Dec 2002 18:16:48 -0000 1.3 @@ -62,8 +62,8 @@ package org.apache.commons.betwixt.recursion; import java.util.ArrayList; -import java.util.List; import java.util.Iterator; +import java.util.List; /** * This is just a simple element bean.. 1.6 +8 -11 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/recursion/TestRecursion.java Index: TestRecursion.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/recursion/TestRecursion.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- TestRecursion.java 15 Dec 2002 19:03:34 -0000 1.5 +++ TestRecursion.java 30 Dec 2002 18:16:48 -0000 1.6 @@ -61,20 +61,17 @@ */ package org.apache.commons.betwixt.recursion; -import java.io.StringReader; import java.io.StringWriter; import java.io.Writer; -import junit.framework.TestCase; import junit.framework.Test; import junit.framework.TestSuite; -import org.apache.commons.betwixt.*; + +import org.apache.commons.betwixt.AbstractTestCase; +import org.apache.commons.betwixt.XMLIntrospector; import org.apache.commons.betwixt.io.BeanReader; import org.apache.commons.betwixt.io.BeanWriter; import org.apache.commons.betwixt.io.CyclicReferenceException; -import org.apache.commons.betwixt.strategy.DecapitalizeNameMapper; -import org.apache.commons.betwixt.strategy.HyphenatedNameMapper; -import org.apache.commons.logging.impl.SimpleLog; /** 1.2 +5 -6 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/recursion/IdBean.java Index: IdBean.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/recursion/IdBean.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- IdBean.java 26 Sep 2002 20:00:10 -0000 1.1 +++ IdBean.java 30 Dec 2002 18:16:48 -0000 1.2 @@ -62,8 +62,7 @@ package org.apache.commons.betwixt.recursion; -import java.util.ArrayList; -import java.util.List; + /** * Used to test mapping of id's to 1.6 +5 -9 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/dotbetwixt/TestBeanToXml.java Index: TestBeanToXml.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/dotbetwixt/TestBeanToXml.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- TestBeanToXml.java 23 Dec 2002 19:26:53 -0000 1.5 +++ TestBeanToXml.java 30 Dec 2002 18:16:48 -0000 1.6 @@ -66,12 +66,8 @@ import junit.framework.Test; import junit.framework.TestSuite; -import org.apache.commons.betwixt.xmlunit.XmlTestCase; import org.apache.commons.betwixt.io.BeanWriter; -import org.apache.commons.betwixt.digester.XMLIntrospectorHelper; - -import org.apache.commons.logging.impl.SimpleLog; -import org.apache.commons.logging.LogFactory; +import org.apache.commons.betwixt.xmlunit.XmlTestCase; /** 1.3 +10 -13 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/xmlunit/XmlTestCase.java Index: XmlTestCase.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/xmlunit/XmlTestCase.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- XmlTestCase.java 15 Dec 2002 19:03:35 -0000 1.2 +++ XmlTestCase.java 30 Dec 2002 18:16:48 -0000 1.3 @@ -61,26 +61,23 @@ */ package org.apache.commons.betwixt.xmlunit; +import java.io.File; import java.io.IOException; import java.io.StringReader; -import java.io.File; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; - -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -import junit.framework.TestCase; import junit.framework.AssertionFailedError; +import junit.framework.TestCase; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; import org.w3c.dom.Attr; -import org.w3c.dom.NamedNodeMap; import org.w3c.dom.DOMException; import org.w3c.dom.Document; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; /** * Provides xml test utilities. 1.2 +6 -10 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/registry/TestXMLBeanInfoRegistry.java Index: TestXMLBeanInfoRegistry.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/registry/TestXMLBeanInfoRegistry.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestXMLBeanInfoRegistry.java 27 Nov 2002 22:19:12 -0000 1.1 +++ TestXMLBeanInfoRegistry.java 30 Dec 2002 18:16:48 -0000 1.2 @@ -61,16 +61,12 @@ */ package org.apache.commons.betwixt.registry; -import java.io.FileInputStream; -import java.io.InputStream; - import junit.framework.Test; -import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; -import org.apache.commons.betwixt.XMLBeanInfo; import org.apache.commons.betwixt.AbstractTestCase; +import org.apache.commons.betwixt.XMLBeanInfo; /** Test harness for the XMLBeanInfoRegistry * 1.3 +6 -6 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/digester/IDBean.java Index: IDBean.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/digester/IDBean.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- IDBean.java 11 Dec 2002 22:12:11 -0000 1.2 +++ IDBean.java 30 Dec 2002 18:16:48 -0000 1.3 @@ -62,8 +62,8 @@ */ package org.apache.commons.betwixt.digester; -import java.util.List; import java.util.ArrayList; +import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; 1.4 +9 -16 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/digester/TestIDRead.java Index: TestIDRead.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/digester/TestIDRead.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestIDRead.java 11 Dec 2002 22:12:11 -0000 1.3 +++ TestIDRead.java 30 Dec 2002 18:16:48 -0000 1.4 @@ -65,20 +65,13 @@ import java.io.FileInputStream; import java.io.InputStream; -import org.apache.commons.betwixt.expression.MethodUpdater; - -import org.apache.commons.betwixt.io.BeanWriter; -import org.apache.commons.betwixt.io.BeanReader; -import org.apache.commons.betwixt.io.BeanCreateRule; - -import org.apache.commons.betwixt.AbstractTestCase; - -import org.apache.commons.logging.impl.SimpleLog; - import junit.framework.Test; -import junit.framework.TestCase; import junit.framework.TestSuite; import junit.textui.TestRunner; + +import org.apache.commons.betwixt.AbstractTestCase; +import org.apache.commons.betwixt.io.BeanReader; +import org.apache.commons.betwixt.io.BeanWriter; /** Test harness for ID-IDRef reading. * 1.2 +6 -6 jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/digester/TestXMLIntrospectorHelper.java Index: TestXMLIntrospectorHelper.java =================================================================== RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/digester/TestXMLIntrospectorHelper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- TestXMLIntrospectorHelper.java 14 Aug 2002 20:26:22 -0000 1.1 +++ TestXMLIntrospectorHelper.java 30 Dec 2002 18:16:48 -0000 1.2 @@ -63,8 +63,8 @@ package org.apache.commons.betwixt.digester; import java.beans.BeanInfo; -import java.beans.Introspector; import java.beans.IntrospectionException; +import java.beans.Introspector; import java.beans.PropertyDescriptor; import junit.framework.Test;
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>