jvanzyl 02/03/09 18:59:24 Modified: betwixt/src/test/org/apache/commons/betwixt TestAll.java Added: betwixt/src/test/org/apache/commons/betwixt Project.java TestProjectRoundTrip.java project.xml Log: Adding some more beans for testing, starting out with a scaled down version of the maven project bean and will work up to have it mapping completely so I can toss the mapper that I made. Updated TestAll to include the new project mapping test. Revision Changes Path 1.8 +6 -5 jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestAll.java Index: TestAll.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestAll.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- TestAll.java 25 Feb 2002 22:04:24 -0000 1.7 +++ TestAll.java 10 Mar 2002 02:59:24 -0000 1.8 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestAll.java,v 1.7 2002/02/25 22:04:24 rdonkin Exp $ - * $Revision: 1.7 $ - * $Date: 2002/02/25 22:04:24 $ + * $Header: /home/cvs/jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestAll.java,v 1.8 2002/03/10 02:59:24 jvanzyl Exp $ + * $Revision: 1.8 $ + * $Date: 2002/03/10 02:59:24 $ * * ==================================================================== * @@ -57,7 +57,7 @@ * information on the Apache Software Foundation, please see * <http://www.apache.org/>. * - * $Id: TestAll.java,v 1.7 2002/02/25 22:04:24 rdonkin Exp $ + * $Id: TestAll.java,v 1.8 2002/03/10 02:59:24 jvanzyl Exp $ */ package org.apache.commons.betwixt; @@ -70,7 +70,7 @@ /** Entry point for all JUnit tests. * * @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a> - * @version $Revision: 1.7 $ + * @version $Revision: 1.8 $ */ public class TestAll extends TestCase { @@ -84,6 +84,7 @@ suite.addTest(TestXMLIntrospector.suite()); suite.addTest(TestXMLBeanInfoDigester.suite()); suite.addTest(TestRSSRoundTrip.suite()); + suite.addTest(TestProjectRoundTrip.suite()); return suite; } 1.1 jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/Project.java Index: Project.java =================================================================== /* * $Header: /home/cvs/jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/Project.java,v 1.1 2002/03/10 02:59:24 jvanzyl Exp $ * $Revision: 1.1 $ * $Date: 2002/03/10 02:59:24 $ * * ==================================================================== * * 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: Project.java,v 1.1 2002/03/10 02:59:24 jvanzyl Exp $ */ package org.apache.commons.betwixt; import java.io.Serializable; import java.util.ArrayList; import java.util.Enumeration; import java.util.Iterator; import java.util.List; import java.util.Map; import org.apache.commons.collections.IteratorEnumeration; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** <p><code>Project</code> is a sample bean for use by the test cases.</p> * * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a> * @version $Revision: 1.1 $ */ public class Project implements Serializable { /** Logger */ private static final Log log = LogFactory.getLog( Project.class ); private String description; private String projectPackage; public Project() { } public void setDescription(String description) { this.description = description; } public String getDescription() { return description; } public void setPackage(String projectPackage) { this.projectPackage = projectPackage; } public String getPackage() { return projectPackage; } } 1.1 jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestProjectRoundTrip.java Index: TestProjectRoundTrip.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE file. * * $Id: TestProjectRoundTrip.java,v 1.1 2002/03/10 02:59:24 jvanzyl Exp $ */ package org.apache.commons.betwixt; import java.io.InputStream; import java.io.IOException; 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.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.impl.SimpleLog; /** Test harness for the BeanReader that deals with project definitions. * * @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a> * @version $Revision: 1.1 $ */ public class TestProjectRoundTrip extends TestCase { public static void main( String[] args ) { TestRunner.run( suite() ); } public static Test suite() { return new TestSuite(TestProjectRoundTrip.class); } public TestProjectRoundTrip(String testName) { super(testName); } public void testBeanWriter() throws Exception { BeanReader reader = new BeanReader(); reader.registerBeanClass( getBeanClass() ); InputStream in = getXMLInput(); try { Project bean = (Project) reader.parse( in ); assertEquals("org.apache.maven", bean.getPackage()); //assertEquals("Project Description", bean.getDescription()); //writeBean( bean ); } catch (Exception e) { e.printStackTrace(); fail(); } finally { in.close(); } } public void writeBean(Object bean) throws Exception { BeanWriter writer = new BeanWriter(); writer.enablePrettyPrint(); writer.write( bean ); } /** @return the bean class to use as the root */ public Class getBeanClass() { return Project.class; } protected InputStream getXMLInput() throws IOException { return getClass().getResourceAsStream( "project.xml" ); } } 1.1 jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/project.xml Index: project.xml =================================================================== <?xml version="1.0"?> <Project> <name>jakarta-turbine-maven</name> <id>maven</id> <currentVersion>0.1</currentVersion> <organization>Apache Software Foundation</organization> <inceptionYear>2001</inceptionYear> <package>org.apache.maven</package> <shortDescription>Project Management Tools</shortDescription> <description> Maven: a person who has special knowledge or experience; an expert or connoisseur. In short, Maven strives to be a Java project expert. The entire concept of Maven is based around an object model for a project. </description> <url>http://jakarta.apache.org/turbine/maven/</url> <cvsWebUrl>http://cvs.apache.org/viewcvs/jakarta-turbine-maven/</cvsWebUrl> <mailingLists> <mailingList> <name>Turbine User List</name> <subscribe>[EMAIL PROTECTED]</subscribe> <unsubscribe>[EMAIL PROTECTED]</unsubscribe> <archive>http://www.mail-archive.com/turbine-user@jakarta.apache.org/</archive> </mailingList> <mailingList> <name>Turbine Developer List</name> <subscribe>mailto:[EMAIL PROTECTED]</subscribe> <unsubscribe>mailto:[EMAIL PROTECTED]</unsubscribe> <archive>http://www.mail-archive.com/turbine-dev@jakarta.apache.org/</archive> </mailingList> </mailingLists> </Project>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>