jstrachan 02/05/28 04:49:30
Modified: betwixt/src/test/org/apache/commons/betwixt
TestRSSRoundTrip.java TestBeanReader.java
RSSBeanReader.java TestXMLBeanInfoDigester.java
RSSBeanWriter.java
betwixt/src/test/org/apache/commons/betwixt/project
TestProjectRoundTrip.java
betwixt build.xml project.properties project.xml
betwixt/src/java/org/apache/commons/betwixt/io
BeanReader.java BeanCreateRule.java
Added: betwixt/src/test/org/apache/commons/betwixt
TestMavenProject.java
Removed: betwixt OVERVIEW.html build.properties.sample STATUS.html
PROPOSAL.html
Log:
Removed the old build files now that we have the maven build up and running.
Also added a new JUnit test that tests parsing Maven project.xml documents using
Betwixt.
Also patched the BeanReader to properly handle the use of explicit named paths when
registering beans. Though we still need support for name mapping strategy (such as
start with lowercase and use-dashes rather than mixed case) as well as a strategy for
the plural stemmer for detecting addFoo() and getFoos() methods
Revision Changes Path
1.5 +8 -7
jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestRSSRoundTrip.java
Index: TestRSSRoundTrip.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestRSSRoundTrip.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TestRSSRoundTrip.java 17 May 2002 15:24:10 -0000 1.4
+++ TestRSSRoundTrip.java 28 May 2002 11:49:29 -0000 1.5
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestRSSRoundTrip.java,v
1.4 2002/05/17 15:24:10 jstrachan Exp $
- * $Revision: 1.4 $
- * $Date: 2002/05/17 15:24:10 $
+ * $Header:
/home/cvs/jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestRSSRoundTrip.java,v
1.5 2002/05/28 11:49:29 jstrachan Exp $
+ * $Revision: 1.5 $
+ * $Date: 2002/05/28 11:49:29 $
*
* ====================================================================
*
@@ -57,10 +57,11 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
- * $Id: TestRSSRoundTrip.java,v 1.4 2002/05/17 15:24:10 jstrachan Exp $
+ * $Id: TestRSSRoundTrip.java,v 1.5 2002/05/28 11:49:29 jstrachan Exp $
*/
package org.apache.commons.betwixt;
+import java.io.FileInputStream;
import java.io.InputStream;
import java.io.StringReader;
import java.io.StringWriter;
@@ -88,7 +89,7 @@
* to check that the document is parseable again.
*
* @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a>
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class TestRSSRoundTrip extends AbstractTestCase {
@@ -121,7 +122,7 @@
// lets parse the example
RSSDigester digester = new RSSDigester();
- InputStream in = getClass().getResourceAsStream( "rss-example.xml" );
+ InputStream in = new FileInputStream(
"src/test/org/apache/commons/betwixt/rss-example.xml" );
Object bean = digester.parse( in );
in.close();
@@ -156,7 +157,7 @@
// lets parse the example using the RSSDigester
RSSDigester digester = new RSSDigester();
- InputStream in = getClass().getResourceAsStream( "rss-example.xml" );
+ InputStream in = new FileInputStream(
"src/test/org/apache/commons/betwixt/rss-example.xml" );
Object bean = digester.parse( in );
in.close();
1.6 +4 -3
jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestBeanReader.java
Index: TestBeanReader.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestBeanReader.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TestBeanReader.java 17 May 2002 15:24:10 -0000 1.5
+++ TestBeanReader.java 28 May 2002 11:49:29 -0000 1.6
@@ -5,10 +5,11 @@
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*
- * $Id: TestBeanReader.java,v 1.5 2002/05/17 15:24:10 jstrachan Exp $
+ * $Id: TestBeanReader.java,v 1.6 2002/05/28 11:49:29 jstrachan Exp $
*/
package org.apache.commons.betwixt;
+import java.io.FileInputStream;
import java.io.StringWriter;
import java.io.StringBufferInputStream;
import java.io.InputStream;
@@ -30,7 +31,7 @@
/** Test harness for the BeanReader
*
* @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public class TestBeanReader extends TestCase {
@@ -77,7 +78,7 @@
}
protected InputStream getXMLInput() throws IOException {
- return getClass().getResourceAsStream( "customer.xml" );
+ return new FileInputStream(
"src/test/org/apache/commons/betwixt/customer.xml" );
}
public void testWriteThenRead() throws Exception
1.4 +4 -3
jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/RSSBeanReader.java
Index: RSSBeanReader.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/RSSBeanReader.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RSSBeanReader.java 17 May 2002 15:24:10 -0000 1.3
+++ RSSBeanReader.java 28 May 2002 11:49:29 -0000 1.4
@@ -5,11 +5,12 @@
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*
- * $Id: RSSBeanReader.java,v 1.3 2002/05/17 15:24:10 jstrachan Exp $
+ * $Id: RSSBeanReader.java,v 1.4 2002/05/28 11:49:29 jstrachan Exp $
*/
package org.apache.commons.betwixt;
import java.net.URL;
+import java.io.FileInputStream;
import java.io.InputStream;
import junit.framework.Test;
@@ -27,7 +28,7 @@
* outputs it again.
*
* @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a>
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
public class RSSBeanReader extends AbstractTestCase {
@@ -69,7 +70,7 @@
bean = reader.parse( args[0] );
}
else {
- InputStream in = getClass().getResourceAsStream( "rss-example.xml" );
+ InputStream in = new FileInputStream(
"src/test/org/apache/commons/betwixt/rss-example.xml" );
bean = reader.parse( in );
in.close();
}
1.5 +7 -6
jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestXMLBeanInfoDigester.java
Index: TestXMLBeanInfoDigester.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestXMLBeanInfoDigester.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TestXMLBeanInfoDigester.java 17 May 2002 15:24:10 -0000 1.4
+++ TestXMLBeanInfoDigester.java 28 May 2002 11:49:29 -0000 1.5
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestXMLBeanInfoDigester.java,v
1.4 2002/05/17 15:24:10 jstrachan Exp $
- * $Revision: 1.4 $
- * $Date: 2002/05/17 15:24:10 $
+ * $Header:
/home/cvs/jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestXMLBeanInfoDigester.java,v
1.5 2002/05/28 11:49:29 jstrachan Exp $
+ * $Revision: 1.5 $
+ * $Date: 2002/05/28 11:49:29 $
*
* ====================================================================
*
@@ -57,10 +57,11 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
- * $Id: TestXMLBeanInfoDigester.java,v 1.4 2002/05/17 15:24:10 jstrachan Exp $
+ * $Id: TestXMLBeanInfoDigester.java,v 1.5 2002/05/28 11:49:29 jstrachan Exp $
*/
package org.apache.commons.betwixt;
+import java.io.FileInputStream;
import java.io.InputStream;
import junit.framework.Test;
@@ -74,7 +75,7 @@
/** Test harness for the Digester of XMLBeanInfo
*
* @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a>
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class TestXMLBeanInfoDigester extends AbstractTestCase {
@@ -93,7 +94,7 @@
public void testDigester() throws Exception {
XMLBeanInfoDigester digester = new XMLBeanInfoDigester();
- InputStream in = Channel.class.getResourceAsStream( "Channel.betwixt" );
+ InputStream in = new FileInputStream(
"src/test/org/apache/commons/digester/rss/Channel.betwixt" );
assertTrue( "Found betwixt config file", in != null );
1.4 +4 -3
jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/RSSBeanWriter.java
Index: RSSBeanWriter.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/RSSBeanWriter.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- RSSBeanWriter.java 17 May 2002 15:24:10 -0000 1.3
+++ RSSBeanWriter.java 28 May 2002 11:49:29 -0000 1.4
@@ -5,10 +5,11 @@
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*
- * $Id: RSSBeanWriter.java,v 1.3 2002/05/17 15:24:10 jstrachan Exp $
+ * $Id: RSSBeanWriter.java,v 1.4 2002/05/28 11:49:29 jstrachan Exp $
*/
package org.apache.commons.betwixt;
+import java.io.FileInputStream;
import java.io.InputStream;
import junit.framework.Test;
@@ -24,7 +25,7 @@
* to output it as XML again.
*
* @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a>
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
public class RSSBeanWriter extends AbstractTestCase {
@@ -44,7 +45,7 @@
bean = digester.parse( args[0] );
}
else {
- InputStream in = getClass().getResourceAsStream( "rss-example.xml" );
+ InputStream in = new FileInputStream(
"src/test/org/apache/commons/betwixt/rss-example.xml" );
bean = digester.parse( in );
in.close();
}
1.1
jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestMavenProject.java
Index: TestMavenProject.java
===================================================================
/*
* $Header:
/home/cvs/jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/TestRSSRoundTrip.java,v
1.4 2002/05/17 15:24:10 jstrachan Exp $
* $Revision: 1.4 $
* $Date: 2002/05/17 15:24:10 $
*
* ====================================================================
*
* 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: TestRSSRoundTrip.java,v 1.4 2002/05/17 15:24:10 jstrachan Exp $
*/
package org.apache.commons.betwixt;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.InputStream;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
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.maven.project.Project;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/** Test harness which round trips a Maven project.xml file
* using Bewixt and Maven's Project beans..
*
* @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a>
* @version $Revision: 1.4 $
*/
public class TestMavenProject extends AbstractTestCase {
public static void main( String[] args ) {
TestRunner.run( suite() );
}
public static Test suite() {
return new TestSuite(TestMavenProject.class);
}
public TestMavenProject(String testName) {
super(testName);
}
/**
* Tests we can parse a project.xml
*/
public void testParse() throws Exception {
// create a BeanReader
BeanReader reader = new BeanReader();
// #### remove the need to name the element, via a lower-case-naming strategy
reader.registerBeanClass( "project", Project.class );
// now lets try parse the output sing the BeanReader
Project project = (Project) reader.parse( new FileInputStream( "project.xml"
) );
assertTrue( "Returned null project instance", project != null );
assertEquals( "commons-betwixt", project.getName() );
assertEquals( "commons-betwixt", project.getId() );
assertEquals( "org.apache.commons.betwixt", project.getPackage() );
assertEquals( "jakarta.apache.org", project.getSiteAddress() );
}
/*
public void testRoundTrip() throws Exception {
// create a BeanReader
BeanReader reader = new BeanReader();
reader.registerBeanClass( Project.class );
// now lets try parse the output sing the BeanReader
String text = buffer.toString();
Project project = (Project) reader.parse( new FileReader( "project.xml" ) );
// lets parse the example using the RSSDigester
RSSDigester digester = new RSSDigester();
InputStream in = new FileInputStream(
"src/test/org/apache/commons/betwixt/rss-example.xml" );
Object bean = digester.parse( in );
in.close();
// now lets output it to a buffer
StringWriter buffer = new StringWriter();
write( bean, buffer );
// create a BeanReader
BeanReader reader = new BeanReader();
reader.registerBeanClass( Project.class );
// now lets try parse the output sing the BeanReader
String text = buffer.toString();
Project project = (Project) reader.parse( new StringReader(text ) );
// managed to parse it again!
// now lets write it to another buffer
buffer = new StringWriter();
write( bean, buffer );
String text2 = buffer.toString();
// if the two strings are equal then we've done a full round trip
// with the XML staying the same. Though the original source XML
// could well be different
assertEquals( "Round trip value should remain unchanged", text, text2 );
}
*/
protected void write(Object bean, Writer out) throws Exception {
BeanWriter writer = new BeanWriter(out);
writer.getXMLIntrospector().setAttributesForPrimitives(false);
writer.enablePrettyPrint();
writer.write( bean );
}
}
1.6 +4 -3
jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/project/TestProjectRoundTrip.java
Index: TestProjectRoundTrip.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/betwixt/src/test/org/apache/commons/betwixt/project/TestProjectRoundTrip.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TestProjectRoundTrip.java 17 May 2002 15:24:11 -0000 1.5
+++ TestProjectRoundTrip.java 28 May 2002 11:49:29 -0000 1.6
@@ -5,10 +5,11 @@
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*
- * $Id: TestProjectRoundTrip.java,v 1.5 2002/05/17 15:24:11 jstrachan Exp $
+ * $Id: TestProjectRoundTrip.java,v 1.6 2002/05/28 11:49:29 jstrachan Exp $
*/
package org.apache.commons.betwixt.project;
+import java.io.FileInputStream;
import java.io.InputStream;
import java.io.IOException;
@@ -28,7 +29,7 @@
/** Test harness for the BeanReader that deals with project definitions.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public class TestProjectRoundTrip extends TestCase {
@@ -86,7 +87,7 @@
}
protected InputStream getXMLInput() throws IOException {
- return getClass().getResourceAsStream( "project.xml" );
+ return new FileInputStream(
"src/test/org/apache/commons/betwixt/project/project.xml" );
}
}
1.17 +209 -378 jakarta-commons-sandbox/betwixt/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/betwixt/build.xml,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- build.xml 22 May 2002 18:13:40 -0000 1.16
+++ build.xml 28 May 2002 11:49:29 -0000 1.17
@@ -1,8 +1,10 @@
-<!-- $Id: build.xml,v 1.16 2002/05/22 18:13:40 jstrachan Exp $ -->
+<?xml version="1.0"?>
+<!-- $Id: build.xml,v 1.17 2002/05/28 11:49:29 jstrachan Exp $ -->
<project name="betwixt" default="maven:jar" basedir=".">
+
<!-- ========== Initialize Properties ===================================== -->
<!-- Allow any user specific values to override the defaults -->
@@ -12,388 +14,200 @@
<!-- Set default values for the build -->
<property file="project.properties" />
-<!-- maven:start -->
-
-<!-- ======================================================== -->
-<!-- D E L E G A T O R S -->
-<!-- ======================================================== -->
-
-<target name="maven:gump-descriptor">
- <ant antfile="${maven.home}/plugins/core/build.xml" target="gump-descriptor"/>
-</target>
-
-<target name="maven:maven-update">
- <ant antfile="${maven.home}/plugins/core/build.xml" target="maven-update"/>
-</target>
-
-<target name="maven:update-jars">
- <ant antfile="${maven.home}/plugins/core/build.xml" target="update-jars"/>
-</target>
-
-<target name="maven:jar">
- <ant antfile="${maven.home}/plugins/core/build.xml" target="jar"/>
-</target>
-
-<target name="maven:docs-quick">
- <ant antfile="${maven.home}/plugins/docs/build.xml" target="docs-quick"/>
-</target>
-
-<target name="maven:run-singletest">
- <ant antfile="${maven.home}/plugins/test/build.xml" target="run-singletest"/>
-</target>
-
-<target name="maven:compile">
- <ant antfile="${maven.home}/plugins/core/build.xml" target="compile"/>
-</target>
-
-<target name="maven:fo">
- <ant antfile="${maven.home}/plugins/docs/build.xml" target="fo"/>
-</target>
-
-<target name="maven:cvs-change-log">
- <ant antfile="${maven.home}/plugins/docs/build.xml" target="cvs-change-log"/>
-</target>
-
-<target name="maven:war">
- <ant antfile="${maven.home}/plugins/j2ee/build.xml" target="war"/>
-</target>
-
-<target name="maven:generate-reactor">
- <ant antfile="${maven.home}/plugins/reactor/build.xml" target="generate-reactor"/>
-</target>
-
-<target name="maven:cross-ref">
- <ant antfile="${maven.home}/plugins/docs/build.xml" target="cross-ref"/>
-</target>
-
-<target name="maven:deploy-site">
- <ant antfile="${maven.home}/plugins/docs/build.xml" target="deploy-site"/>
-</target>
-
-<target name="maven:ear">
- <ant antfile="${maven.home}/plugins/j2ee/build.xml" target="ear"/>
-</target>
-
-<target name="maven:install-jar">
- <ant antfile="${maven.home}/plugins/core/build.xml" target="install-jar"/>
-</target>
-
-<target name="maven:task-list">
- <ant antfile="${maven.home}/plugins/docs/build.xml" target="task-list"/>
-</target>
-
-<target name="maven:docs">
- <ant antfile="${maven.home}/plugins/docs/build.xml" target="docs"/>
-</target>
-
-<target name="maven:site">
- <ant antfile="${maven.home}/plugins/docs/build.xml" target="site"/>
-</target>
-
-<target name="maven:deploy-dist">
- <ant antfile="${maven.home}/plugins/core/build.xml" target="deploy-dist"/>
-</target>
-
-<target name="maven:javadocs">
- <ant antfile="${maven.home}/plugins/docs/build.xml" target="javadocs"/>
-</target>
-
-<target name="maven:announce">
- <ant antfile="${maven.home}/plugins/core/build.xml" target="announce"/>
-</target>
-
-<target name="maven:check-source">
- <ant antfile="${maven.home}/plugins/core/build.xml" target="check-source"/>
-</target>
-
-<target name="maven:dist">
- <ant antfile="${maven.home}/plugins/core/build.xml" target="dist"/>
-</target>
-
-<target name="maven:dist-build">
- <ant antfile="${maven.home}/plugins/core/build.xml" target="dist-build"/>
-</target>
-
-<target name="maven:metrics">
- <ant antfile="${maven.home}/plugins/metrics/build.xml" target="metrics"/>
-</target>
-
-<target name="maven:clean">
- <ant antfile="${maven.home}/plugins/core/build.xml" target="clean"/>
-</target>
-
-<target name="maven:env">
- <ant antfile="${maven.home}/plugins/core/build.xml" target="env"/>
-</target>
-
-<target name="maven:test">
- <ant antfile="${maven.home}/plugins/test/build.xml" target="test"/>
-</target>
-
-<target name="maven:pdf">
- <ant antfile="${maven.home}/plugins/docs/build.xml" target="pdf"/>
-</target>
-
-<target name="maven:iutest">
- <ant antfile="${maven.home}/plugins/iutest/build.xml" target="iutest"/>
-</target>
-
-<target name="maven:activity-log">
- <ant antfile="${maven.home}/plugins/docs/build.xml" target="activity-log"/>
-</target>
-
-<target name="maven:verify-project">
- <ant antfile="${maven.home}/plugins/core/build.xml" target="verify-project"/>
-</target>
-
-<target name="maven:validate-pom">
- <ant antfile="${maven.home}/plugins/core/build.xml" target="validate-pom"/>
-</target>
-
-<target name="maven:validate-war">
- <ant antfile="${maven.home}/plugins/j2ee/build.xml" target="validate-war"/>
-</target>
-
-<!-- maven:end -->
-
-
-<!-- ========== External Dependencies ===================================== -->
-
-
- <!-- The directories corresponding to your necessary dependencies -->
- <property name="jaxp.home" value="/usr/local/jaxp1.1"/>
- <property name="jdk.home" value="/usr/local/jdk1.3"/>
- <property name="junit.home" value="/usr/local/junit3.7"/>
- <property name="commons.home" value="../../jakarta-commons"/>
- <property name="beanutils.home" value="${commons.home}/beanutils"/>
- <property name="collections.home" value="${commons.home}/collections"/>
- <property name="logging.home" value="${commons.home}/logging"/>
- <property name="digester.home" value="${commons.home}/digester"/>
-
-
-<!-- ========== Derived Values ============================================ -->
-
-
- <!-- The locations of necessary jar files -->
- <property name="jdk.api" value="${jdk.home}/docs/api"/>
- <property name="jaxp.jaxp.jar" value="${jaxp.home}/jaxp.jar"/>
- <property name="jaxp.parser.jar" value="${jaxp.home}/crimson.jar"/>
- <property name="jaxp.api" value="${jaxp.home}/docs/api"/>
- <property name="junit.jar" value="${junit.home}/junit.jar"/>
- <property name="commons-beanutils.api" value="${beanutils.home}/dist/docs/api"/>
- <property name="commons-beanutils.jar"
value="${beanutils.home}/dist/commons-beanutils.jar"/>
- <property name="commons-collections.api"
value="${collections.home}/dist/docs/api"/>
- <property name="commons-collections.jar"
value="${collections.home}/dist/commons-collections.jar"/>
- <property name="commons-logging.api" value="${logging.home}/dist/docs/api"/>
- <property name="commons-logging.jar"
value="${logging.home}/dist/commons-logging.jar"/>
- <property name="commons-digester.api" value="${digester.home}/dist/docs/api"/>
- <property name="commons-digester.jar"
value="${digester.home}/dist/commons-digester.jar"/>
+ <!-- maven:start -->
-
-<!-- ========== Component Declarations ==================================== -->
-
-
- <!-- The name of this component -->
- <property name="component.name" value="betwixt"/>
-
- <!-- The primary package name of this component -->
- <property name="component.package" value="org.apache.commons.betwixt"/>
-
- <!-- The title of this component -->
- <property name="component.title" value="Betwixt - mapping beans to XML"/>
-
- <!-- The current version number of this component -->
- <property name="component.version" value="1.0-dev"/>
-
- <!-- The base directory for compilation targets -->
- <property name="build.home" value="target"/>
-
- <!-- The base directory for component configuration files -->
- <property name="conf.home" value="src/conf"/>
-
- <!-- The base directory for distribution targets -->
- <property name="dist.home" value="dist"/>
-
- <!-- The base directory for component sources -->
- <property name="source.home" value="src/java"/>
-
- <!-- The base directory for unit test sources -->
- <property name="test.home" value="src/test"/>
-
-
-<!-- ========== Compiler Defaults ========================================= -->
-
-
- <!-- Should Java compilations set the 'debug' compiler option? -->
- <property name="compile.debug" value="true"/>
-
- <!-- Should Java compilations set the 'deprecation' compiler option? -->
- <property name="compile.deprecation" value="false"/>
-
- <!-- Should Java compilations set the 'optimize' compiler option? -->
- <property name="compile.optimize" value="true"/>
-
- <!-- Construct compile classpath -->
- <path id="compile.classpath">
- <pathelement location="${build.home}/classes"/>
- <pathelement location="${jaxp.jaxp.jar}"/>
- <pathelement location="${jaxp.parser.jar}"/>
- <pathelement location="${commons-beanutils.jar}"/>
- <pathelement location="${commons-collections.jar}"/>
- <pathelement location="${commons-logging.jar}"/>
- <pathelement location="${commons-digester.jar}"/>
- <pathelement location="${junit.jar}"/>
- </path>
-
-
-<!-- ========== Test Execution Defaults =================================== -->
-
-
- <!-- Construct unit test classpath -->
- <path id="test.classpath">
- <pathelement location="${build.home}/classes"/>
- <pathelement location="${build.home}/tests"/>
- <pathelement location="${junit.jar}"/>
- <pathelement location="${jaxp.jaxp.jar}"/>
- <pathelement location="${jaxp.parser.jar}"/>
- <pathelement location="${commons-beanutils.jar}"/>
- <pathelement location="${commons-collections.jar}"/>
- <pathelement location="${commons-logging.jar}"/>
- <pathelement location="${commons-digester.jar}"/>
- </path>
-
- <!-- Should all tests fail if one does? -->
- <property name="test.failonerror" value="true"/>
-
- <!-- The test runner to execute -->
- <property name="test.runner" value="junit.textui.TestRunner"/>
-
-
-<!-- ========== Executable Targets ======================================== -->
-
-
- <target name="init"
- description="Initialize and evaluate conditionals">
- <echo message="-------- ${component.name} ${component.version} --------"/>
- <filter token="name" value="${component.package}"/>
- <filter token="version" value="${component.version}"/>
- </target>
-
-
- <target name="prepare" depends="init"
- description="Prepare build directory">
- <mkdir dir="${build.home}"/>
- <mkdir dir="${build.home}/classes"/>
- <mkdir dir="${build.home}/conf"/>
- <mkdir dir="${build.home}/tests"/>
- </target>
-
-
- <target name="static" depends="prepare"
- description="Copy static files to build directory">
- <tstamp/>
- <copy todir="${build.home}/conf" filtering="on">
- <fileset dir="${conf.home}" includes="*.MF"/>
- </copy>
- </target>
-
-
- <target name="compile" depends="static"
- description="Compile shareable components">
- <javac srcdir="${source.home}"
- destdir="${build.home}/classes"
- debug="${compile.debug}"
- deprecation="${compile.deprecation}"
- optimize="${compile.optimize}">
- <classpath refid="compile.classpath"/>
- </javac>
- <copy todir="${build.home}/classes" filtering="on">
- <fileset dir="${source.home}" excludes="**/*.java"/>
- </copy>
- </target>
-
-
- <target name="compile.tests" depends="compile"
- description="Compile unit test cases">
- <javac srcdir="${test.home}"
- destdir="${build.home}/tests"
- debug="${compile.debug}"
- deprecation="${compile.deprecation}"
- optimize="${compile.optimize}">
- <classpath refid="test.classpath"/>
- </javac>
- <copy todir="${build.home}/tests" filtering="on">
- <fileset dir="${test.home}" excludes="**/*.java"/>
- </copy>
- </target>
-
-
- <target name="clean"
- description="Clean build and distribution directories">
- <delete dir="${build.home}"/>
- <delete dir="${dist.home}"/>
- </target>
-
-
- <target name="all" depends="clean,compile"
- description="Clean and compile all components"/>
-
-
- <target name="javadoc" depends="compile"
- description="Create component Javadoc documentation">
- <mkdir dir="${dist.home}"/>
- <mkdir dir="${dist.home}/docs"/>
- <mkdir dir="${dist.home}/docs/api"/>
- <javadoc sourcepath="${source.home}"
- destdir="${dist.home}/docs/api"
- packagenames="org.apache.commons.*"
- author="true"
- private="true"
- version="true"
- doctitle="<h1>${component.title}</h1>"
- windowtitle="${component.title} (Version ${component.version})"
- bottom="Copyright (c) 2002 - Apache Software Foundation">
- <link offline="true" packagelistLoc="${commons-beanutils.api}"
- href="http://jakarta.apache.org/commons/beanutils/api/"/>
- <link offline="true" packagelistLoc="${commons-collections.api}"
- href="http://jakarta.apache.org/commons/collections/api/"/>
- <link offline="true" packagelistLoc="${commons-logging.api}"
- href="http://jakarta.apache.org/commons/logging/api/"/>
- <link offline="true" packagelistLoc="${commons-digester.api}"
- href="http://jakarta.apache.org/commons/digester/api/"/>
- <link offline="true" packagelistLoc="${jdk.api}"
- href="http://java.sun.com/products/jdk/1.3/docs/api"/>
- <link offline="true" packagelistLoc="${jaxp.api}"
- href="http://java.sun.com/xml/jaxp-docs-1.1/docs/api"/>
- <classpath refid="compile.classpath"/>
- </javadoc>
- </target>
-
-
- <target name="dist" depends="compile,javadoc"
- description="Create binary distribution">
- <mkdir dir="${dist.home}"/>
- <copy file="../LICENSE"
- todir="${dist.home}"/>
- <mkdir dir="${build.home}/classes/META-INF"/>
- <copy file="../LICENSE"
- tofile="${build.home}/classes/META-INF/LICENSE.txt"/>
- <jar jarfile="${dist.home}/commons-${component.name}.jar"
- basedir="${build.home}/classes"
- manifest="${build.home}/conf/MANIFEST.MF"/>
- </target>
-
+ <!-- ================================================================== -->
+ <!-- D E F I N E A N T T A S K S -->
+ <!-- ================================================================== -->
+ <taskdef
+ name="maven-ant"
+ classname="org.apache.maven.ant.Ant">
+ <classpath>
+ <pathelement location="${lib.repo}/maven.jar"/>
+ </classpath>
+ </taskdef>
+
+
+ <!-- ================================================================== -->
+ <!-- D E L E G A T O R S -->
+ <!-- ================================================================== -->
+
+ <target name="maven:gump-descriptor">
+ <maven-ant antfile="${maven.home}/plugins/core/build.xml"
target="gump-descriptor"/>
+ </target>
+
+ <target name="maven:maven-update">
+ <maven-ant antfile="${maven.home}/plugins/core/build.xml"
target="maven-update"/>
+ </target>
+
+ <target name="maven:update-jars">
+ <maven-ant antfile="${maven.home}/plugins/core/build.xml"
target="update-jars"/>
+ </target>
+
+ <target name="maven:jar">
+ <maven-ant antfile="${maven.home}/plugins/core/build.xml" target="jar"/>
+ </target>
+
+ <target name="maven:docs-quick">
+ <maven-ant antfile="${maven.home}/plugins/docs/build.xml"
target="docs-quick"/>
+ </target>
+
+ <target name="maven:run-singletest">
+ <maven-ant antfile="${maven.home}/plugins/test/build.xml"
target="run-singletest"/>
+ </target>
+
+ <target name="maven:compile">
+ <maven-ant antfile="${maven.home}/plugins/core/build.xml" target="compile"/>
+ </target>
+
+ <target name="maven:jar-resources">
+ <maven-ant antfile="${maven.home}/plugins/core/build.xml"
target="jar-resources"/>
+ </target>
+
+ <target name="maven:fo">
+ <maven-ant antfile="${maven.home}/plugins/docs/build.xml" target="fo"/>
+ </target>
+
+ <target name="maven:cvs-change-log">
+ <maven-ant antfile="${maven.home}/plugins/docs/build.xml"
target="cvs-change-log"/>
+ </target>
+
+ <target name="maven:war">
+ <maven-ant antfile="${maven.home}/plugins/j2ee/build.xml" target="war"/>
+ </target>
+
+ <target name="maven:generate-reactor">
+ <maven-ant antfile="${maven.home}/plugins/reactor/build.xml"
target="generate-reactor"/>
+ </target>
+
+ <target name="maven:cross-ref">
+ <maven-ant antfile="${maven.home}/plugins/docs/build.xml"
target="cross-ref"/>
+ </target>
+
+ <target name="maven:deploy-site">
+ <maven-ant antfile="${maven.home}/plugins/docs/build.xml"
target="deploy-site"/>
+ </target>
+
+ <target name="maven:ear">
+ <maven-ant antfile="${maven.home}/plugins/j2ee/build.xml" target="ear"/>
+ </target>
+
+ <target name="maven:install-jar">
+ <maven-ant antfile="${maven.home}/plugins/core/build.xml"
target="install-jar"/>
+ </target>
+
+ <target name="maven:task-list">
+ <maven-ant antfile="${maven.home}/plugins/docs/build.xml"
target="task-list"/>
+ </target>
+
+ <target name="maven:docs">
+ <maven-ant antfile="${maven.home}/plugins/docs/build.xml" target="docs"/>
+ </target>
+
+ <target name="maven:site">
+ <maven-ant antfile="${maven.home}/plugins/docs/build.xml" target="site"/>
+ </target>
+
+ <target name="maven:deploy-dist">
+ <maven-ant antfile="${maven.home}/plugins/core/build.xml"
target="deploy-dist"/>
+ </target>
+
+ <target name="maven:javadocs">
+ <maven-ant antfile="${maven.home}/plugins/docs/build.xml" target="javadocs"/>
+ </target>
+
+ <target name="maven:announce">
+ <maven-ant antfile="${maven.home}/plugins/core/build.xml" target="announce"/>
+ </target>
+
+ <target name="maven:check-source">
+ <maven-ant antfile="${maven.home}/plugins/core/build.xml"
target="check-source"/>
+ </target>
+
+ <target name="maven:dist">
+ <maven-ant antfile="${maven.home}/plugins/core/build.xml" target="dist"/>
+ </target>
+
+ <target name="maven:dist-build">
+ <maven-ant antfile="${maven.home}/plugins/core/build.xml"
target="dist-build"/>
+ </target>
+
+ <target name="maven:metrics">
+ <maven-ant antfile="${maven.home}/plugins/metrics/build.xml"
target="metrics"/>
+ </target>
+
+ <target name="maven:clean">
+ <maven-ant antfile="${maven.home}/plugins/core/build.xml" target="clean"/>
+ </target>
+
+ <target name="maven:env">
+ <maven-ant antfile="${maven.home}/plugins/core/build.xml" target="env"/>
+ </target>
+
+ <target name="maven:compile-test">
+ <maven-ant antfile="${maven.home}/plugins/test/build.xml" target="compile"/>
+ </target>
+
+ <target name="maven:test">
+ <maven-ant antfile="${maven.home}/plugins/test/build.xml" target="test"/>
+ </target>
+
+ <target name="maven:pdf">
+ <maven-ant antfile="${maven.home}/plugins/docs/build.xml" target="pdf"/>
+ </target>
+
+ <target name="maven:iutest">
+ <maven-ant antfile="${maven.home}/plugins/uitest/build.xml" target="iutest"/>
+ </target>
+
+ <target name="maven:activity-log">
+ <maven-ant antfile="${maven.home}/plugins/docs/build.xml"
target="activity-log"/>
+ </target>
+
+ <target name="maven:verify-project">
+ <maven-ant antfile="${maven.home}/plugins/core/build.xml"
target="verify-project"/>
+ </target>
+
+ <target name="maven:validate-pom">
+ <maven-ant antfile="${maven.home}/plugins/core/build.xml"
target="validate-pom"/>
+ </target>
+
+ <target name="maven:validate-war">
+ <maven-ant antfile="${maven.home}/plugins/j2ee/build.xml"
target="validate-war"/>
+ </target>
+
+
+ <!-- maven:end -->
+
+<!-- ========== Helper Targets ============================================ -->
+
+ <target name="clean" depends="maven:clean">
+ <delete file="velocity.log"/>
+ </target>
+
+
+ <target name="compile" depends="maven:compile, maven:jar-resources">
+ <path id="test.classpath">
+ <pathelement path="${maven.build.dest}"/>
+ <pathelement path="${maven.test.dest}"/>
+ <path refid="maven.dependency.classpath"/>
+ <pathelement location="${lib.repo}/junit-3.7.jar"/>
+ <pathelement location="${lib.repo}/xmlParserAPIs-2.0.0.jar"/>
+ <pathelement location="${lib.repo}/xercesImpl-2.0.0.jar"/>
+ <path path="${classpath}"/>
+ <path path="${java.classpath}"/>
+ </path>
+ </target>
+
+ <target name="compile.tests" depends="compile, maven:compile-test"/>
+ <target name="test" depends="maven:test"/>
+ <target name="dist" depends="maven:dist"/>
+ <target name="site" depends="maven:site"/>
+
<!-- ========== Unit Test Targets ========================================= -->
- <target name="test" depends="compile.tests"
- description="Run all unit test cases">
- <java classname="org.apache.commons.betwixt.TestAll" fork="yes"
failonerror="${test.failonerror}">
- <classpath refid="test.classpath"/>
- </java>
- </target>
-
<target name="test.write" depends="compile.tests"
description="Runs sample bean write">
<java classname="org.apache.commons.betwixt.TestBeanWriter" fork="yes">
@@ -429,6 +243,23 @@
<java classname="org.apache.commons.betwixt.TestRSSRoundTrip" fork="yes">
<classpath refid="test.classpath"/>
<sysproperty key="org.apache.commons.logging.simplelog.defaultlog"
value="info"/>
+ </java>
+ </target>
+
+ <target name="test.maven"
+ description="Runs the RSS round trip unit tests">
+ <property name="maven.testcase"
value="org.apache.commons.betwixt.TestMavenProject"/>
+ <maven-ant antfile="${maven.home}/plugins/test/build.xml"
target="run-singletest"/>
+ </target>
+
+
+ <target name="test.maven2" depends="compile.tests"
+ description="Runs the RSS round trip unit tests">
+ <java classname="org.apache.commons.betwixt.TestMavenProject" fork="yes">
+ <classpath refid="test.classpath"/>
+ <sysproperty key="org.apache.commons.logging.simplelog.defaultlog"
value="debug"/>
+ <sysproperty
key="org.apache.commons.logging.simplelog.log.org.apache.commons.digester.Digester"
value="warn"/>
+ <sysproperty
key="org.apache.commons.logging.simplelog.log.org.apache.commons.digester.Digester.sax"
value="warn"/>
</java>
</target>
1.2 +1 -1 jakarta-commons-sandbox/betwixt/project.properties
Index: project.properties
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/betwixt/project.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- project.properties 22 May 2002 18:13:40 -0000 1.1
+++ project.properties 28 May 2002 11:49:29 -0000 1.2
@@ -7,7 +7,7 @@
compile.deprecation = off
maven.jarResources.basedir=${basedir}/src/java
-
+maven.junit.usefile = false
# use Sun coding standards
1.2 +10 -2 jakarta-commons-sandbox/betwixt/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/betwixt/project.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- project.xml 22 May 2002 18:13:40 -0000 1.1
+++ project.xml 28 May 2002 11:49:29 -0000 1.2
@@ -58,8 +58,8 @@
<dependency>
<name>commons-beanutils</name>
<type>required</type>
- <version>1.2</version>
- <jar>commons-beanutils-1.2.jar</jar>
+ <version>20020520</version>
+ <jar>commons-beanutils-20020520.jar</jar>
</dependency>
<dependency>
@@ -92,6 +92,14 @@
<jar>xmlParserAPIs-2.0.0.jar</jar>
</dependency>
-->
+
+ <!-- for unit tests -->
+ <dependency>
+ <name>maven</name>
+ <type>required</type>
+ <version>1.0</version>
+ <jar>maven.jar</jar>
+ </dependency>
</dependencies>
1.6 +3 -3
jakarta-commons-sandbox/betwixt/src/java/org/apache/commons/betwixt/io/BeanReader.java
Index: BeanReader.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/betwixt/src/java/org/apache/commons/betwixt/io/BeanReader.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- BeanReader.java 17 May 2002 15:24:12 -0000 1.5
+++ BeanReader.java 28 May 2002 11:49:29 -0000 1.6
@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*
- * $Id: BeanReader.java,v 1.5 2002/05/17 15:24:12 jstrachan Exp $
+ * $Id: BeanReader.java,v 1.6 2002/05/28 11:49:29 jstrachan Exp $
*/
package org.apache.commons.betwixt.io;
@@ -34,7 +34,7 @@
/** <p><code>BeanReader</code> reads a tree of beans from an XML document.</p>
*
* @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a>
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public class BeanReader extends Digester {
@@ -153,7 +153,7 @@
* Adds a new bean create rule for the specified path
*/
protected void addBeanCreateRule( String path, ElementDescriptor
elementDescriptor, Class beanClass ) {
- Rule rule = new BeanCreateRule( this, elementDescriptor, beanClass );
+ Rule rule = new BeanCreateRule( this, elementDescriptor, beanClass, path +
"/" );
addRule( path, rule );
if ( log.isDebugEnabled() ) {
1.8 +8 -4
jakarta-commons-sandbox/betwixt/src/java/org/apache/commons/betwixt/io/BeanCreateRule.java
Index: BeanCreateRule.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/betwixt/src/java/org/apache/commons/betwixt/io/BeanCreateRule.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- BeanCreateRule.java 17 May 2002 15:24:12 -0000 1.7
+++ BeanCreateRule.java 28 May 2002 11:49:30 -0000 1.8
@@ -5,7 +5,7 @@
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*
- * $Id: BeanCreateRule.java,v 1.7 2002/05/17 15:24:12 jstrachan Exp $
+ * $Id: BeanCreateRule.java,v 1.8 2002/05/28 11:49:30 jstrachan Exp $
*/
package org.apache.commons.betwixt.io;
@@ -33,7 +33,7 @@
* from the betwixt XML metadata.</p>
*
* @author <a href="mailto:[EMAIL PROTECTED]">James Strachan</a>
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
*/
public class BeanCreateRule extends Rule {
@@ -53,12 +53,16 @@
/** The prefix added to digester rules */
private String pathPrefix;
- public BeanCreateRule(BeanReader digester, ElementDescriptor descriptor, Class
beanClass) {
+ public BeanCreateRule(BeanReader digester, ElementDescriptor descriptor, Class
beanClass, String pathPrefix) {
super( digester );
this.descriptor = descriptor;
this.context = new Context();
this.beanClass = beanClass;
- this.pathPrefix = descriptor.getQualifiedName() + "/";
+ this.pathPrefix = pathPrefix;
+ }
+
+ public BeanCreateRule(BeanReader digester, ElementDescriptor descriptor, Class
beanClass) {
+ this( digester, descriptor, beanClass, descriptor.getQualifiedName() + "/"
);
}
public BeanCreateRule(BeanReader digester, ElementDescriptor descriptor,
Context context, String pathPrefix) {
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>