You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(7) |
Aug
(37) |
Sep
|
Oct
|
Nov
(1) |
Dec
(22) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(8) |
Feb
(68) |
Mar
(72) |
Apr
(149) |
May
(32) |
Jun
(46) |
Jul
(26) |
Aug
(59) |
Sep
(25) |
Oct
(18) |
Nov
(4) |
Dec
(3) |
| 2004 |
Jan
(90) |
Feb
(19) |
Mar
(38) |
Apr
(41) |
May
(44) |
Jun
(2) |
Jul
(10) |
Aug
|
Sep
(14) |
Oct
|
Nov
(1) |
Dec
|
| 2005 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(15) |
Jun
(1) |
Jul
|
Aug
(9) |
Sep
|
Oct
(17) |
Nov
|
Dec
|
| 2006 |
Jan
(1) |
Feb
(16) |
Mar
|
Apr
(1) |
May
(48) |
Jun
|
Jul
(2) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(29) |
| 2007 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
(23) |
Mar
(31) |
Apr
|
May
(26) |
Jun
(6) |
Jul
(1) |
Aug
|
Sep
(7) |
Oct
(1) |
Nov
(8) |
Dec
(8) |
| 2009 |
Jan
(5) |
Feb
(9) |
Mar
(1) |
Apr
|
May
(23) |
Jun
(3) |
Jul
|
Aug
(1) |
Sep
(9) |
Oct
(28) |
Nov
(18) |
Dec
(8) |
| 2010 |
Jan
(19) |
Feb
(24) |
Mar
(3) |
Apr
|
May
(5) |
Jun
(4) |
Jul
|
Aug
(1) |
Sep
(11) |
Oct
|
Nov
(2) |
Dec
(1) |
| 2011 |
Jan
|
Feb
(7) |
Mar
|
Apr
(6) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(32) |
Oct
(6) |
Nov
|
Dec
|
|
From: <mla...@us...> - 2003-06-16 01:51:35
|
Update of /cvsroot/dbunit/dbunit/src/java/electric/util/encoding
In directory sc8-pr-cvs1:/tmp/cvs-serv18110/src/java/electric/util/encoding
Added Files:
Tag: branch-1-5
Encodings.java
Log Message:
Fixed long running XML encoding issue.
--- NEW FILE: Encodings.java ---
// copyright 2001-2002 by The Mind Electric
package electric.util.encoding;
import java.io.*;
import java.util.*;
import electric.util.*;
/**
* <tt>Encodings</tt> defines a set of static methods for deciphering encoding
* information. This includes mapping an encoding in Java to an encoding in xml,
* switching back and forth between java and xml encoding, and manipulating the default
* encodings to check through.
*
* @author <a href="http://www.themindelectric.com">The Mind Electric</a>
*/
public class Encodings
{
private static final String[] DEFAULT_SUGGESTED_ENCODINGS = new String[]
{
"UTF8", // ansi standard
"UTF-16BE", // big endian utf-16 doesn't require BOM
"UTF-16LE", // little endian utf-16 doesn't require BOM
"cp037" // 7 bit charsets (EBCDIC-US)
};
private static String[] suggestedEncodings = new String[ 0 ];
private static byte[][] suggestedEncodingBytes = new byte[ 0 ][ 0 ];
private static final String ENCODING = "encoding";
private static final String XML_DECL = "<?xml";
private static final Hashtable xmlToJavaEncodings = new Hashtable();
private static final Hashtable javaToXMLEncodings = new Hashtable();
private static String systemEncoding;
// *********** INITIALIZATION *********************************************
static
{
initSystemEncoding();
initXMLToJavaEncodings();
}
// ********** SUGGESTED ENCODINGS *****************************************
/**
* In order to know the encoding of an XML document, we must get the encoding
* attribute of the xml decl. In order to read the xml decl, we need to know
* what encoding the xml document is in. Since the first 5 characters of an
* xml decl are guaranteed to be "<?xml", and the encoding must be in a latin
* character set, we use suggestions about families of encodings to attempt to
* decode the xml decl. These families all share the same basic encoding for
* the latin character set. UTF-8 is the default if we don't find an xml decl.
* @param encoding
*/
public static void addSuggestedEncoding( String encoding )
throws UnsupportedEncodingException
{
byte[] bytes = XML_DECL.getBytes( encoding );
suggestedEncodingBytes = (byte[][]) ArrayUtil.addElement( suggestedEncodingBytes, bytes );
suggestedEncodings = (String[]) ArrayUtil.addElement( suggestedEncodings, encoding );
}
/**
*
*/
public static String[] getSuggestedEncodings()
{
return suggestedEncodings;
}
// ********** HEADER DECODING *********************************************
/**
* determine what encoding the byte array claims it's in. this searches through
* the bytes for the xml decl, and looks at the encoding stated there.
* @param header
*/
static public String getJavaEncoding( byte[] header )
throws UnsupportedEncodingException
{
if( Strings.isUTF16( header ) )
return "UTF-16";
if( suggestedEncodingBytes.length == 0 )
initSuggestedEncodings( DEFAULT_SUGGESTED_ENCODINGS );
for( int i = 0; i < suggestedEncodingBytes.length; i++ )
if( matches( header, suggestedEncodingBytes[ i ] ) )
{
String encoding = getJavaEncoding( header, suggestedEncodings[ i ] );
if( encoding != null )
return encoding;
}
return "UTF8";
}
/**
* @param header
* @param suggestedEncodingBytes
*/
static private boolean matches( byte[] header, byte[] suggestedEncodingBytes )
{
// gg: this could be a utility method in ArrayUtil
if( header.length < suggestedEncodingBytes.length )
return false;
for( int i = 0; i < suggestedEncodingBytes.length; i++ )
if( header[ i ] != suggestedEncodingBytes[ i ] )
return false;
return true;
}
/**
* @param header
* @param suggestedEncoding
*/
private static String getJavaEncoding( byte[] header, String suggestedEncoding )
throws UnsupportedEncodingException
{
String string = new String( header, suggestedEncoding ).toLowerCase().trim();
if( !string.startsWith( XML_DECL ) )
return null;
int index = string.indexOf( ENCODING );
int endDecl = string.indexOf( "?>" );
// no encoding means this is a malformed document, handle it as best we can
if( index == -1 || endDecl < index )
return suggestedEncoding;
// possible bug here if spaces are allowed around equals on attributes
int equals = string.indexOf( '=', index + ENCODING.length() );
int apostrophe = string.indexOf( '\'', equals );
int quote = string.indexOf( '\"', equals );
int start = apostrophe + 1;
char delimiter = '\'';
// missing equals or both ' and " means malformed attribute in xml
if( equals == -1 || apostrophe == -1 && quote == -1 )
return suggestedEncoding;
if( quote != -1 )
if( apostrophe == -1 || quote < apostrophe )
{
start = quote + 1;
delimiter = '\"';
}
int stop = string.indexOf( delimiter, start );
return getJavaEncoding( string.substring( start, stop ) );
}
// ********** JAVA TO XML CHARACTER ENCODING CONVERSION *******************
/**
* @param xmlEncoding
*/
public static String getJavaEncoding( String xmlEncoding )
{
String javaEncoding = (String) xmlToJavaEncodings.get( xmlEncoding );
return (javaEncoding == null ? xmlEncoding : javaEncoding);
}
/**
* @param javaEncoding
*/
public static String getXMLEncoding( String javaEncoding )
{
String xmlEncoding = (String) javaToXMLEncodings.get( javaEncoding );
return (xmlEncoding == null ? javaEncoding : xmlEncoding);
}
/**
* @param xmlEncoding
* @param javaEncoding
*/
public static void addBidirectionalEncoding( String xmlEncoding, String javaEncoding )
{
xmlToJavaEncodings.put( xmlEncoding, javaEncoding );
javaToXMLEncodings.put( javaEncoding, xmlEncoding );
}
/**
* @param xmlEncoding
* @param javaEncoding
*/
public static void addXMLToJavaEncoding( String xmlEncoding, String javaEncoding )
{
xmlToJavaEncodings.put( xmlEncoding, javaEncoding );
}
/**
* @param javaEncoding
* @param xmlEncoding
*/
public static void addJavaToXMLEncoding( String javaEncoding, String xmlEncoding )
{
javaToXMLEncodings.put( javaEncoding, xmlEncoding );
}
// ********** SYSTEM DEFAULT ENCODING *************************************
/**
* return the default java encoding for the system
*/
public static String getSystemEncoding()
{
return systemEncoding;
}
/**
* return the default xml encoding for the system
*/
public static String getXMLSystemEncoding()
{
return getXMLEncoding( systemEncoding );
}
// *********** INITIALIZATION *********************************************
/**
*
*/
private static void initSystemEncoding()
{
// unfortunately, there seems to be no straightforward way to get this info
ByteArrayInputStream input = new ByteArrayInputStream( new byte[ 0 ] );
InputStreamReader reader = new InputStreamReader( input );
systemEncoding = reader.getEncoding();
try
{
reader.close();
}
catch( IOException exception )
{
// should never happen
}
}
/**
* Warning! This is dangerous territory to play in. If you don't
* reinitialize suggestedEncodings after calling this method, every
* document will be assumed to be UTF-8.
*/
public static void clearSuggestedEncodings()
{
suggestedEncodings = new String[ 0 ];
suggestedEncodingBytes = new byte[ 0 ][ 0 ];
}
/**
* Add encodings to try when attempting to parse the document. Returns
* encodings that could not be resolved.
* @param userSuggestedEncodings
*/
public static String[] initSuggestedEncodings( String[] userSuggestedEncodings )
{
clearSuggestedEncodings();
if( suggestedEncodingBytes.length > 0 )
return new String[ 0 ];
if( userSuggestedEncodings != null || userSuggestedEncodings.length == 0 )
userSuggestedEncodings = DEFAULT_SUGGESTED_ENCODINGS;
Vector unsupportedEncodings = new Vector();
for( int i = 0; i < userSuggestedEncodings.length; i++ )
try
{
addSuggestedEncoding( userSuggestedEncodings[ i ] );
}
catch( Throwable exception )
{
// must be logged by caller
unsupportedEncodings.addElement( userSuggestedEncodings[ i ] );
}
String[] retVal = new String[ unsupportedEncodings.size() ];
unsupportedEncodings.copyInto( retVal );
return retVal;
}
/**
*
*/
public static void initXMLToJavaEncodings()
{
String string = System.getProperty( "java.version" );
// if we're on 1.1, there is no MS932, so pretend it's Shift-JIS
if( string.equals( "1.1" ) || string.startsWith( "1.1." ) )
addXMLToJavaEncoding( "SJIS", "WINDOWS-31J" );
else
addBidirectionalEncoding( "MS932", "WINDOWS-31J" );
addBidirectionalEncoding( "UTF-8", "UTF8" );
addBidirectionalEncoding( "US-ASCII", "ASCII" );
addBidirectionalEncoding( "WINDOWS-1250", "Cp1250" );
addBidirectionalEncoding( "WINDOWS-1251", "Cp1251" );
addBidirectionalEncoding( "WINDOWS-1252", "Cp1252" );
addBidirectionalEncoding( "WINDOWS-1253", "Cp1253" );
addBidirectionalEncoding( "WINDOWS-1254", "Cp1254" );
addBidirectionalEncoding( "WINDOWS-1255", "Cp1255" );
addBidirectionalEncoding( "WINDOWS-1256", "Cp1256" );
addBidirectionalEncoding( "WINDOWS-1257", "Cp1257" );
addBidirectionalEncoding( "WINDOWS-1258", "Cp1258" );
addBidirectionalEncoding( "EBCDIC-CP-US", "CP037" );
addBidirectionalEncoding( "EBCDIC-CP-DK", "CP277" );
addBidirectionalEncoding( "EBCDIC-CP-FI", "CP278" );
addBidirectionalEncoding( "EBCDIC-CP-IT", "CP280" );
addBidirectionalEncoding( "EBCDIC-CP-ES", "CP284" );
addBidirectionalEncoding( "EBCDIC-CP-GB", "CP285" );
addBidirectionalEncoding( "EBCDIC-CP-FR", "CP297" );
addBidirectionalEncoding( "EBCDIC-CP-AR1", "CP420" );
addBidirectionalEncoding( "EBCDIC-CP-HE", "CP424" );
addBidirectionalEncoding( "EBCDIC-CP-CH", "CP500" );
addBidirectionalEncoding( "CP-AR", "CP868" );
addBidirectionalEncoding( "CP-GR", "CP869" );
addBidirectionalEncoding( "EBCDIC-CP-ROECE", "CP870" );
addBidirectionalEncoding( "EBCDIC-CP-IS", "CP871" );
addBidirectionalEncoding( "EBCDIC-CP-AR2", "CP918" );
addBidirectionalEncoding( "TIS-620", "TIS620" );
addBidirectionalEncoding( "ISO-2022-CN", "ISO2022CN" );
addBidirectionalEncoding( "X0201", "JIS0201" );
addBidirectionalEncoding( "X0208", "JIS0208" );
addBidirectionalEncoding( "ISO-IR-159", "JIS0212" );
addXMLToJavaEncoding( "ISO-IR-100", "ISO8859_1" );
addXMLToJavaEncoding( "ISO_8859-1", "ISO8859_1" );
addXMLToJavaEncoding( "LATIN1", "ISO8859_1" );
addXMLToJavaEncoding( "L1", "ISO8859_1" );
addXMLToJavaEncoding( "IBM819", "ISO8859_1" );
addXMLToJavaEncoding( "CP819", "ISO8859_1" );
addXMLToJavaEncoding( "ISO-IR-101", "ISO8859_2" );
addXMLToJavaEncoding( "ISO_8859-2", "ISO8859_2" );
addXMLToJavaEncoding( "LATIN2", "ISO8859_2" );
addXMLToJavaEncoding( "L2", "ISO8859_2" );
addXMLToJavaEncoding( "ISO-IR-109", "ISO8859_3" );
addXMLToJavaEncoding( "ISO_8859-3", "ISO8859_3" );
addXMLToJavaEncoding( "LATIN3", "ISO8859_3" );
addXMLToJavaEncoding( "L3", "ISO8859_3" );
addXMLToJavaEncoding( "ISO-IR-110", "ISO8859_4" );
addXMLToJavaEncoding( "ISO_8859-4", "ISO8859_4" );
addXMLToJavaEncoding( "LATIN4", "ISO8859_4" );
addXMLToJavaEncoding( "L4", "ISO8859_4" );
addXMLToJavaEncoding( "ISO-IR-144", "ISO8859_5" );
addXMLToJavaEncoding( "ISO_8859-5", "ISO8859_5" );
addXMLToJavaEncoding( "CYRILLIC", "ISO8859_5" );
addXMLToJavaEncoding( "ISO-IR-127", "ISO8859_6" );
addXMLToJavaEncoding( "ISO_8859-6", "ISO8859_6" );
addXMLToJavaEncoding( "ECMA-114", "ISO8859_6" );
addXMLToJavaEncoding( "ASMO-708", "ISO8859_6" );
addXMLToJavaEncoding( "ARABIC", "ISO8859_6" );
addXMLToJavaEncoding( "ISO-IR-126", "ISO8859_7" );
addXMLToJavaEncoding( "ISO_8859-7", "ISO8859_7" );
addXMLToJavaEncoding( "ELOT_928", "ISO8859_7" );
addXMLToJavaEncoding( "ECMA-118", "ISO8859_7" );
addXMLToJavaEncoding( "GREEK", "ISO8859_7" );
addXMLToJavaEncoding( "GREEK8", "ISO8859_7" );
addXMLToJavaEncoding( "ISO-IR-138", "ISO8859_8" );
addXMLToJavaEncoding( "ISO_8859-8", "ISO8859_8" );
addXMLToJavaEncoding( "HEBREW", "ISO8859_8" );
addXMLToJavaEncoding( "ISO-IR-148", "ISO8859_9" );
addXMLToJavaEncoding( "ISO_8859-9", "ISO8859_9" );
addXMLToJavaEncoding( "LATIN5", "ISO8859_9" );
addXMLToJavaEncoding( "L5", "ISO8859_9" );
addXMLToJavaEncoding( "ISO-2022-JP", "ISO2022JP" );
addXMLToJavaEncoding( "SHIFT_JIS", "SJIS" );
addXMLToJavaEncoding( "MS_Kanji", "SJIS" );
addXMLToJavaEncoding( "ISO-2022-KR", "ISO2022KR" );
addXMLToJavaEncoding( "EBCDIC-CP-CA", "CP037" );
addXMLToJavaEncoding( "EBCDIC-CP-NL", "CP037" );
addXMLToJavaEncoding( "EBCDIC-CP-WT", "CP037" );
addXMLToJavaEncoding( "EBCDIC-CP-NO", "CP277" );
addXMLToJavaEncoding( "EBCDIC-CP-SE", "CP278" );
addXMLToJavaEncoding( "EBCDIC-CP-BE", "CP500" );
addXMLToJavaEncoding( "EBCDIC-CP-YU", "CP870" );
addXMLToJavaEncoding( "X0212", "JIS0212" );
addJavaToXMLEncoding( "ISO8859_1", "ISO-8859-1" );
addJavaToXMLEncoding( "ISO8859_2", "ISO-8859-2" );
addJavaToXMLEncoding( "ISO8859_3", "ISO-8859-3" );
addJavaToXMLEncoding( "ISO8859_4", "ISO-8859-4" );
addJavaToXMLEncoding( "ISO8859_5", "ISO-8859-5" );
addJavaToXMLEncoding( "ISO8859_6", "ISO-8859-6" );
addJavaToXMLEncoding( "ISO8859_7", "ISO-8859-7" );
addJavaToXMLEncoding( "ISO8859_8", "ISO-8859-8" );
addJavaToXMLEncoding( "ISO8859_9", "ISO-8859-9" );
addJavaToXMLEncoding( "ISO2022JP", "ISO-2022-JP" );
addJavaToXMLEncoding( "SJIS", "Shift_JIS" );
addJavaToXMLEncoding( "MS932", "WINDOWS-31J" );
addJavaToXMLEncoding( "EUC_JP", "EUC-JP" );
addJavaToXMLEncoding( "EUC_KR", "EUC-KR" );
addJavaToXMLEncoding( "ISO2022KR", "ISO-2022-KR" );
addJavaToXMLEncoding( "KOI8_R", "KOI8-R" );
addJavaToXMLEncoding( "JIS0212", "ISO-IR-159" );
}
}
|
|
From: <mla...@us...> - 2003-06-16 01:51:35
|
Update of /cvsroot/dbunit/dbunit
In directory sc8-pr-cvs1:/tmp/cvs-serv18110
Modified Files:
Tag: branch-1-5
electricxml-license.txt
Log Message:
Fixed long running XML encoding issue.
Index: electricxml-license.txt
===================================================================
RCS file: /cvsroot/dbunit/dbunit/electricxml-license.txt,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -C2 -d -r1.4 -r1.4.2.1
*** electricxml-license.txt 18 Mar 2002 16:07:11 -0000 1.4
--- electricxml-license.txt 16 Jun 2003 01:51:32 -0000 1.4.2.1
***************
*** 1,83 ****
! Electric XML Licensing
! http://www.themindelectric.com/products/xml/licensing.html
!
! TERMS AND CONDITIONS FOR ELECTRIC XML
! Please read this license agreement carefully. Your use of
! Electric XML or any related documentation indicates your
! acceptance of the following terms and conditions. If you do
! not agree to these terms and conditions, you may not install
! or use Electric XML.
! The term "Electric XML" refers to both the basic Electric XML
! software and Electric XML+.
!
! 1. Ownership and License.
! Electric XML is owned by The Mind Electric and is copyrighted
! and licensed, not sold. The Mind Electric grants you a
! non-exclusive, non-transferable license to use, modify and
! distribute Electric XML in both binary and source form as long
! as all of the following conditions are met:
! You are not bundling Electric XML or a derivative of it as
! part of a software development environment such as JBuilder,
! WebGain or VisualAge. Note that this restriction is targeted
! at IDE vendors, and does not prevent developers from loading
! Electric XML into an IDE and using it during everyday
! development.
! You are not integrating Electric XML or a derivative of it
! into a distributed computing infrastructure or database
! platform such as WebLogic, Apache SOAP, WebSphere, Oracle
! application server, or HP e-speak. Note that this
! restriction is targeted at software infrastructure vendors,
! and does not prevent developers from using and bundling
! Electric XML with applications that run on these platforms.
! You are not integrating Electric XML or a derivative of it
! into an alternative to Electric XML such as Xerces or JDOM.
! You must not remove any of the copyright information from
! the Electric XML source code or documentation.
! If you cannot meet all of these conditions, please contact us
! to arrange a special custom license.
!
! 2. Term and Termination
! This Agreement is effective until terminated. You may
! terminate this Agreement at any time by destroying all copies
! of Electric XML. This Agreement will terminate immediately
! without notice from The Mind Electric if you fail to comply
! with any provision of this Agreement. Upon termination, you
! must destroy all copies of Electric XML.
!
! 3. Warranty Disclaimer and Limitation of Liability
! The Mind Electric licenses the Software to you on an "as is"
! basis, without warranty of any kind. The Mind Electric hereby
! expressly disclaims all warranties or conditions, either
! express or implied, including, but not limited to, the implied
! warranties or conditions of merchantability and fitness for a
! particular purpose. You are solely responsible for determining
! the appropriateness of using Electic XML and assume all risks
! associated with the use of it, including but not limited to
! the risks of program errors, damage to or loss of data,
! programs or equipment, and unavailability or interruption of
! operations. Some jurisdictions do not allow for the exclusion
! or limitation of implied warranties, so the above limitations
! or exclusions may not apply to you.
! The Mind Electric will not be liable for any direct damages or
! for any special, incidental, or indirect damages or for any
! economic consequential damages (including lost profits or
! savings), even if The Mind Electric has been advised of the
! possibility of such damages. The Mind Electric will not be
! liable for the loss of, or damage to, your records or data, or
! any damages claimed by you based on a third party claim. Some
! jurisdictions do not allow for the exclusion or limitation of
! incidental or consequential damages, so the above limitations
! or exclusions may not apply to you.
!
! 4. General
! This Agreement is governed by the laws of the State of Texas.
! This Agreement is the only understanding and agreement we have
! regarding your use of Electric XML. It supersedes all other
! communications, understandings or agreements we may have had
! prior to this Agreement.
!
! ©2001 The Mind Electric ; Dallas, Texas ; All Rights Reserved
--- 1,62 ----
! TERMS AND CONDITIONS FOR ELECTRIC XML
! Please read this license agreement carefully. Your use of Electric XML or any
! related documentation indicates your acceptance of the following terms and
! conditions. If you do not agree to these terms and conditions, you may not
! install or use Electric XML. The term Electric XML refers to both the basic
! Electric XML software and Electric XML+.
+ 1. Ownership and License.
+ Electric XML is owned by The Mind Electric and is
+ copyrighted and licensed, not sold. The Mind Electric grants you a
+ non-exclusive, non-transferable license to use, modify and distribute Electric
+ XML in both binary and source form as long as all of the following conditions
+ are met:
+ You are not bundling Electric XML or a derivative of it as part of a software
+ development environment such as JBuilder, WebGain or VisualAge. Note that this
+ restriction is targeted at IDE vendors, and does not prevent developers from
+ loading Electric XML into an IDE and using it during everyday development.
+ You are not integrating Electric XML or a derivative of it into a distributed
+ computing infrastructure or database platform such as WebLogic, Apache SOAP,
+ WebSphere, Oracle application server, or HP e-speak. Note that this
+ restriction is targeted at software infrastructure vendors, and does not
+ prevent developers from using and bundling Electric XML with applications that
+ run on these platforms.
+ You are not integrating Electric XML or a derivative of it into an alternative
+ to Electric XML such as Xerces or JDOM.
+ You must not remove any of the copyright information from the Electric XML
+ source code or documentation.
+ If you cannot meet all of these conditions, please contact us to arrange a
+ special custom license.
+ 2. Term and Termination
+ This Agreement is effective until terminated. You may terminate this Agreement
+ at any time by destroying all copies of Electric XML. This Agreement will
+ terminate immediately without notice from The Mind Electric if you fail to
+ comply with any provision of this Agreement. Upon termination, you must destroy
+ all copies of Electric XML.
+ 3. Warranty Disclaimer and Limitation of Liability
+ The Mind Electric licenses the Software to you on an "as is" basis, without
+ warranty of any kind. The Mind Electric hereby expressly disclaims all
+ warranties or conditions, either express or implied, including, but not limited
+ to, the implied warranties or conditions of merchantability and fitness for a
+ particular purpose. You are solely responsible for determining the
+ appropriateness of using Electric XML and assume all risks associated with the
+ use of it, including but not limited to the risks of program errors, damage to
+ or loss of data, programs or equipment, and unavailability or interruption of
+ operations. Some jurisdictions do not allow for the exclusion or limitation of
+ implied warranties, so the above limitations or exclusions may not apply to you.
+ The Mind Electric will not be liable for any direct damages or for any special,
+ incidental, or indirect damages or for any economic consequential damages
+ (including lost profits or savings), even if The Mind Electric has been advised
+ of the possibility of such damages. The Mind Electric will not be liable for the
+ loss of, or damage to, your records or data, or any damages claimed by you based
+ on a third party claim. Some jurisdictions do not allow for the exclusion or
+ limitation of incidental or consequential damages, so the above limitations or
+ exclusions may not apply to you.
+ 4. General
+ This Agreement is governed by the laws of the State of Texas. This Agreement is
+ the only understanding and agreement we have regarding your use of Electric XML.
+ It supersedes all other communications, understandings or agreements we may have
+ had prior to this Agreement.
\ No newline at end of file
|
|
From: <mla...@us...> - 2003-06-16 01:47:35
|
Update of /cvsroot/dbunit/dbunit/src/java/electric/util/encoding In directory sc8-pr-cvs1:/tmp/cvs-serv17572/encoding Log Message: Directory /cvsroot/dbunit/dbunit/src/java/electric/util/encoding added to the repository --> Using per-directory sticky tag `branch-1-5' |
|
From: <mla...@us...> - 2003-06-16 01:47:31
|
Update of /cvsroot/dbunit/dbunit/src/java/electric/util In directory sc8-pr-cvs1:/tmp/cvs-serv17552/util Log Message: Directory /cvsroot/dbunit/dbunit/src/java/electric/util added to the repository --> Using per-directory sticky tag `branch-1-5' |
|
From: <mla...@us...> - 2003-06-16 01:47:28
|
Update of /cvsroot/dbunit/dbunit/src/java/electric In directory sc8-pr-cvs1:/tmp/cvs-serv17533/electric Log Message: Directory /cvsroot/dbunit/dbunit/src/java/electric added to the repository --> Using per-directory sticky tag `branch-1-5' |
|
From: <mla...@us...> - 2003-06-15 22:29:13
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database
In directory sc8-pr-cvs1:/tmp/cvs-serv13770/src/java/org/dbunit/database
Modified Files:
Tag: branch-1-5
DatabaseDataSet.java
Log Message:
Fixed table name issue with some operations and case sensitive database (from Main trunk to branch-1-5).
Index: DatabaseDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/DatabaseDataSet.java,v
retrieving revision 1.19.2.1
retrieving revision 1.19.2.2
diff -C2 -d -r1.19.2.1 -r1.19.2.2
*** DatabaseDataSet.java 15 Jun 2003 22:13:18 -0000 1.19.2.1
--- DatabaseDataSet.java 15 Jun 2003 22:29:10 -0000 1.19.2.2
***************
*** 135,139 ****
}
nameList.add(tableName);
! _tableMap.put(tableName, null);
}
--- 135,139 ----
}
nameList.add(tableName);
! _tableMap.put(tableName.toUpperCase(), null);
}
***************
*** 164,170 ****
initialize();
- String upperTableName = tableName.toUpperCase();
-
// Verify if table exist in the database
if (!_tableMap.containsKey(upperTableName))
{
--- 164,169 ----
initialize();
// Verify if table exist in the database
+ String upperTableName = tableName.toUpperCase();
if (!_tableMap.containsKey(upperTableName))
{
***************
*** 198,201 ****
--- 197,202 ----
public ITable getTable(String tableName) throws DataSetException
{
+ initialize();
+
try
{
|
|
From: <mla...@us...> - 2003-06-15 22:29:13
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation
In directory sc8-pr-cvs1:/tmp/cvs-serv13770/src/java/org/dbunit/operation
Modified Files:
Tag: branch-1-5
AbstractBatchOperation.java
Log Message:
Fixed table name issue with some operations and case sensitive database (from Main trunk to branch-1-5).
Index: AbstractBatchOperation.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation/AbstractBatchOperation.java,v
retrieving revision 1.15.2.1
retrieving revision 1.15.2.2
diff -C2 -d -r1.15.2.1 -r1.15.2.2
*** AbstractBatchOperation.java 3 Apr 2003 00:57:09 -0000 1.15.2.1
--- AbstractBatchOperation.java 15 Jun 2003 22:29:10 -0000 1.15.2.2
***************
*** 72,76 ****
}
! return new DefaultTableMetaData(tableName,
(Column[])columnList.toArray(new Column[0]),
databaseMetaData.getPrimaryKeys());
--- 72,76 ----
}
! return new DefaultTableMetaData(databaseMetaData.getTableName(),
(Column[])columnList.toArray(new Column[0]),
databaseMetaData.getPrimaryKeys());
|
|
From: <mla...@us...> - 2003-06-15 22:13:21
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database
In directory sc8-pr-cvs1:/tmp/cvs-serv10796/src/java/org/dbunit/database
Modified Files:
Tag: branch-1-5
DatabaseDataSet.java
Log Message:
DatabaseDataSet improvements: Faster access to metadata cache and now keeping the original database table ordering. (from Main trunk to branch-1-5).
Index: DatabaseDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/DatabaseDataSet.java,v
retrieving revision 1.19
retrieving revision 1.19.2.1
diff -C2 -d -r1.19 -r1.19.2.1
*** DatabaseDataSet.java 14 Feb 2003 17:22:22 -0000 1.19
--- DatabaseDataSet.java 15 Jun 2003 22:13:18 -0000 1.19.2.1
***************
*** 32,36 ****
* @version $Revision$
*/
! public class DatabaseDataSet implements IDataSet
{
static final String QUALIFIED_TABLE_NAMES =
--- 32,36 ----
* @version $Revision$
*/
! public class DatabaseDataSet extends AbstractDataSet
{
static final String QUALIFIED_TABLE_NAMES =
***************
*** 39,43 ****
private final IDatabaseConnection _connection;
! private Map _tableMap = null;
DatabaseDataSet(IDatabaseConnection connection) throws SQLException
--- 39,44 ----
private final IDatabaseConnection _connection;
! private final Map _tableMap = new HashMap();
! private List _nameList = null;
DatabaseDataSet(IDatabaseConnection connection) throws SQLException
***************
*** 101,109 ****
* Get all the table names form the database that are not system tables.
*/
! private Map getTableMap() throws DataSetException
{
! if (_tableMap != null)
{
! return _tableMap;
}
--- 102,110 ----
* Get all the table names form the database that are not system tables.
*/
! private void initialize() throws DataSetException
{
! if (_nameList != null)
{
! return;
}
***************
*** 119,123 ****
try
{
! Map tableMap = new HashMap();
while (resultSet.next())
{
--- 120,124 ----
try
{
! List nameList = new ArrayList();
while (resultSet.next())
{
***************
*** 129,141 ****
// prevent table name conflict
! if (tableMap.containsKey(tableName))
{
throw new AmbiguousTableNameException(tableName);
}
! tableMap.put(tableName, null);
}
! _tableMap = tableMap;
! return _tableMap;
}
finally
--- 130,142 ----
// prevent table name conflict
! if (_tableMap.containsKey(tableName.toUpperCase()))
{
throw new AmbiguousTableNameException(tableName);
}
! nameList.add(tableName);
! _tableMap.put(tableName, null);
}
! _nameList = nameList;
}
finally
***************
*** 155,196 ****
public String[] getTableNames() throws DataSetException
{
! return (String[])getTableMap().keySet().toArray(new String[0]);
}
public ITableMetaData getTableMetaData(String tableName) throws DataSetException
{
! for (Iterator it = getTableMap().entrySet().iterator(); it.hasNext();)
{
! Map.Entry entry = (Map.Entry)it.next();
! if (tableName.equalsIgnoreCase((String)entry.getKey()))
! {
! ITableMetaData metaData = (ITableMetaData)entry.getValue();
! if (metaData != null)
! {
! return metaData;
! }
! metaData = new DatabaseTableMetaData((String)entry.getKey(), _connection);
! getTableMap().put(metaData.getTableName(), metaData);
! return metaData;
! }
}
! throw new NoSuchTableException(tableName);
! // ITableMetaData metaData = (ITableMetaData)getTableMap().get(tableName);
! // if (metaData != null)
! // {
! // return metaData;
! // }
! //
! // if (!getTableMap().containsKey(tableName))
! // {
! // throw new NoSuchTableException(tableName);
! // }
! //
! // metaData = new DatabaseTableMetaData(tableName, _connection);
! // getTableMap().put(tableName, metaData);
! // return metaData;
}
--- 156,197 ----
public String[] getTableNames() throws DataSetException
{
! initialize();
! return (String[])_nameList.toArray(new String[0]);
}
public ITableMetaData getTableMetaData(String tableName) throws DataSetException
{
! initialize();
!
! String upperTableName = tableName.toUpperCase();
!
! // Verify if table exist in the database
! if (!_tableMap.containsKey(upperTableName))
{
! throw new NoSuchTableException(tableName);
! }
! // Try to find cached metadata
! ITableMetaData metaData = (ITableMetaData)_tableMap.get(upperTableName);
! if (metaData != null)
! {
! return metaData;
}
! // Search for original database table name
! for (Iterator it = _nameList.iterator(); it.hasNext();)
! {
! String databaseTableName = (String)it.next();
! if (databaseTableName.equalsIgnoreCase(tableName))
! {
! // Create metadata and cache it
! metaData = new DatabaseTableMetaData(
! databaseTableName, _connection);
! _tableMap.put(upperTableName, metaData);
! break;
! }
! }
! return metaData;
}
***************
*** 239,242 ****
--- 240,244 ----
return (ITable[])tableList.toArray(new ITable[0]);
}
+
}
|
|
From: <mla...@us...> - 2003-06-15 21:58:08
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement
In directory sc8-pr-cvs1:/tmp/cvs-serv8039/src/java/org/dbunit/database/statement
Modified Files:
Tag: branch-1-5
SimplePreparedStatement.java SimpleStatement.java
Log Message:
Fixed bug "736439-Problems with InsertOperation" (from Main trunk to branch-1-5).
Index: SimplePreparedStatement.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement/SimplePreparedStatement.java,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -C2 -d -r1.7.2.1 -r1.7.2.2
*** SimplePreparedStatement.java 2 Apr 2003 13:51:53 -0000 1.7.2.1
--- SimplePreparedStatement.java 15 Jun 2003 21:58:02 -0000 1.7.2.2
***************
*** 80,84 ****
public void addBatch() throws SQLException
{
! _result += _statement.executeUpdate();
_index = 0;
// _statement.clearParameters();
--- 80,88 ----
public void addBatch() throws SQLException
{
! boolean result = _statement.execute();
! if (!result)
! {
! _result += _statement.getUpdateCount();
! }
_index = 0;
// _statement.clearParameters();
Index: SimpleStatement.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement/SimpleStatement.java,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -C2 -d -r1.4 -r1.4.2.1
*** SimpleStatement.java 13 Jun 2002 17:24:56 -0000 1.4
--- SimpleStatement.java 15 Jun 2003 21:58:02 -0000 1.4.2.1
***************
*** 52,56 ****
{
String sql = (String)_list.get(i);
! result += _statement.executeUpdate(sql);
}
return result;
--- 52,60 ----
{
String sql = (String)_list.get(i);
! boolean r = _statement.execute(sql);
! if(!r)
! {
! result += _statement.getUpdateCount();
! }
}
return result;
|
|
From: <mla...@us...> - 2003-06-15 15:42:23
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit
In directory sc8-pr-cvs1:/tmp/cvs-serv19674/src/test/org/dbunit
Modified Files:
Tag: branch-exml2sax
Main.java
Log Message:
Huge dataset export tests.
Index: Main.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/Main.java,v
retrieving revision 1.30.2.4
retrieving revision 1.30.2.5
diff -C2 -d -r1.30.2.4 -r1.30.2.5
*** Main.java 14 Jun 2003 06:06:48 -0000 1.30.2.4
--- Main.java 15 Jun 2003 15:42:21 -0000 1.30.2.5
***************
*** 34,49 ****
import org.dbunit.dataset.xml.XmlDataSetWriter;
import org.dbunit.dataset.xml.XmlProducer;
import org.xml.sax.InputSource;
! import java.io.File;
! import java.io.FileOutputStream;
! import java.io.FileReader;
! import java.io.FileWriter;
! import java.io.IOException;
! import java.io.OutputStream;
! import java.io.OutputStreamWriter;
! import java.io.Reader;
! import java.io.Writer;
/**
--- 34,42 ----
import org.dbunit.dataset.xml.XmlDataSetWriter;
import org.dbunit.dataset.xml.XmlProducer;
+ import org.dbunit.dataset.xml.FlatXmlWriter;
import org.xml.sax.InputSource;
! import java.io.*;
/**
***************
*** 59,64 ****
// System.setProperty("dbunit.qualified.table.names", "true");
!
IDatabaseConnection connection =
DatabaseEnvironment.getInstance().getConnection();
--- 52,59 ----
// System.setProperty("dbunit.qualified.table.names", "true");
+ // testFlatXmlWriter();
+ testXmlWriter();
! /*
IDatabaseConnection connection =
DatabaseEnvironment.getInstance().getConnection();
***************
*** 86,89 ****
--- 81,85 ----
XmlDataSetWriter writer = new XmlDataSetWriter(new OutputStreamWriter(out, "UTF8"));
writer.write(dataSet);
+ */
// FileWriter writer = new FileWriter("writerTest.xml");
***************
*** 106,112 ****
}
// private static void testWrite() throws Exception
// {
! // Writer out = new FileWriter("test.xml");
//
// Document document = new Document();
--- 102,134 ----
}
+ private static void testFlatXmlWriter() throws Exception
+ {
+ MockDataSetProducer mockProducer = new MockDataSetProducer();
+ mockProducer.setupColumnCount(5);
+ mockProducer.setupRowCount(100000);
+ mockProducer.setupTableCount(10);
+ IDataSet dataSet = new StreamingDataSet(mockProducer);
+
+ OutputStream out = new FileOutputStream("flatXmlWriterTest.xml");
+ FlatXmlWriter writer = new FlatXmlWriter(new OutputStreamWriter(out, "UTF8"));
+ writer.write(dataSet);
+ }
+
+ private static void testXmlWriter() throws Exception
+ {
+ MockDataSetProducer mockProducer = new MockDataSetProducer();
+ mockProducer.setupColumnCount(5);
+ mockProducer.setupRowCount(100000);
+ mockProducer.setupTableCount(10);
+ IDataSet dataSet = new StreamingDataSet(mockProducer);
+
+ OutputStream out = new FileOutputStream("xmlWriterTest.xml");
+ XmlDataSetWriter writer = new XmlDataSetWriter(new OutputStreamWriter(out, "UTF8"));
+ writer.write(dataSet);
+ }
+
// private static void testWrite() throws Exception
// {
! // Writer out = new databaseFileWriter("test.xml");
//
// Document document = new Document();
|
|
From: <mla...@us...> - 2003-06-15 15:40:29
|
Update of /cvsroot/dbunit/dbunit
In directory sc8-pr-cvs1:/tmp/cvs-serv19447
Modified Files:
profile.properties
Log Message:
Added TRUNCATE_TABLE as unsupported feature to Hypersonic profile.
Index: profile.properties
===================================================================
RCS file: /cvsroot/dbunit/dbunit/profile.properties,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** profile.properties 13 Apr 2003 02:43:23 -0000 1.24
--- profile.properties 15 Jun 2003 15:40:25 -0000 1.25
***************
*** 3,10 ****
##
! #dbunit.profile = hypersonic
#dbunit.profile = oracle
#dbunit.profile = mysql
! dbunit.profile = mssql
# dbunit.profile.{profileName}.driverClass = com.acme.driver
--- 3,10 ----
##
! dbunit.profile = hypersonic
#dbunit.profile = oracle
#dbunit.profile = mysql
! #dbunit.profile = mssql
# dbunit.profile.{profileName}.driverClass = com.acme.driver
***************
*** 13,17 ****
# dbunit.profile.{profileName}.user =
# dbunit.profile.{profileName}.password =
! # dbunit.profile.{profileName}.unsupportedFeatures = BLOB,CLOB,TRANSACTION,SCOLLABLE_RESULTSET,INSERT_INDENTITY
dbunit.profile.hypersonic.driverClass = org.hsqldb.jdbcDriver
--- 13,17 ----
# dbunit.profile.{profileName}.user =
# dbunit.profile.{profileName}.password =
! # dbunit.profile.{profileName}.unsupportedFeatures = BLOB,CLOB,TRANSACTION,SCOLLABLE_RESULTSET,INSERT_INDENTITY,TRUNCATE_TABLE
dbunit.profile.hypersonic.driverClass = org.hsqldb.jdbcDriver
***************
*** 20,24 ****
dbunit.profile.hypersonic.user = sa
dbunit.profile.hypersonic.password =
! dbunit.profile.hypersonic.unsupportedFeatures = BLOB,CLOB,SCOLLABLE_RESULTSET,INSERT_IDENTITY
dbunit.profile.oracle.driverClass = oracle.jdbc.driver.OracleDriver
--- 20,24 ----
dbunit.profile.hypersonic.user = sa
dbunit.profile.hypersonic.password =
! dbunit.profile.hypersonic.unsupportedFeatures = BLOB,CLOB,SCOLLABLE_RESULTSET,INSERT_IDENTITY,TRUNCATE_TABLE
dbunit.profile.oracle.driverClass = oracle.jdbc.driver.OracleDriver
***************
*** 57,63 ****
#dbunit.profile.password = ${dbunit.profile.mysql.password}
! dbunit.profile.driverClass = ${dbunit.profile.mssql.driverClass}
! dbunit.profile.connectionUrl = ${dbunit.profile.mssql.connectionUrl}
#dbunit.profile.schema = ${dbunit.profile.mssql.schema}
! dbunit.profile.user = ${dbunit.profile.mssql.user}
! dbunit.profile.password = ${dbunit.profile.mssql.password}
--- 57,63 ----
#dbunit.profile.password = ${dbunit.profile.mysql.password}
! #dbunit.profile.driverClass = ${dbunit.profile.mssql.driverClass}
! #dbunit.profile.connectionUrl = ${dbunit.profile.mssql.connectionUrl}
#dbunit.profile.schema = ${dbunit.profile.mssql.schema}
! #dbunit.profile.user = ${dbunit.profile.mssql.user}
! #dbunit.profile.password = ${dbunit.profile.mssql.password}
|
|
From: <mla...@us...> - 2003-06-15 15:38:52
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database
In directory sc8-pr-cvs1:/tmp/cvs-serv19195/src/java/org/dbunit/database
Modified Files:
CachedResultSetTable.java DatabaseDataSet.java
Log Message:
Ease usage of ForwardOnlyResultSetTable from DatabaseDataSet. Sorry, this is not configurable yet!
Index: CachedResultSetTable.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/CachedResultSetTable.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** CachedResultSetTable.java 19 May 2003 22:09:20 -0000 1.9
--- CachedResultSetTable.java 15 Jun 2003 15:38:49 -0000 1.10
***************
*** 43,46 ****
--- 43,52 ----
}
+ public CachedResultSetTable(ITableMetaData metaData,
+ IDatabaseConnection connection) throws SQLException, DataSetException
+ {
+ this(new ForwardOnlyResultSetTable(metaData, connection));
+ }
+
public CachedResultSetTable(IResultSetTable table) throws DataSetException, SQLException
{
Index: DatabaseDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/DatabaseDataSet.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** DatabaseDataSet.java 19 May 2003 22:09:20 -0000 1.22
--- DatabaseDataSet.java 15 Jun 2003 15:38:49 -0000 1.23
***************
*** 237,261 ****
ITableMetaData metaData = getTableMetaData(tableName);
! Connection jdbcConnection = _connection.getConnection();
! String schema = _connection.getSchema();
! Statement statement = jdbcConnection.createStatement();
!
! try
! {
! String sql = getSelectStatement(schema, metaData);
! ResultSet resultSet = statement.executeQuery(sql);
! try
! {
! return new CachedResultSetTable(metaData, resultSet);
! }
! finally
! {
! resultSet.close();
! }
! }
! finally
! {
! statement.close();
! }
}
catch (SQLException e)
--- 237,244 ----
ITableMetaData metaData = getTableMetaData(tableName);
! // Use ForwardOnlyResultSetTable to export big tables.
! // TODO: Make this configurable
! return new CachedResultSetTable(metaData, _connection);
! // return new ForwardOnlyResultSetTable(metaData, _connection);
}
catch (SQLException e)
|
|
From: <mla...@us...> - 2003-06-15 15:29:06
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database
In directory sc8-pr-cvs1:/tmp/cvs-serv17631/src/java/org/dbunit/database
Modified Files:
DatabaseSequenceFilter.java
Log Message:
Better exception handling.
Index: DatabaseSequenceFilter.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/DatabaseSequenceFilter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DatabaseSequenceFilter.java 6 Apr 2003 00:50:37 -0000 1.1
--- DatabaseSequenceFilter.java 15 Jun 2003 15:29:02 -0000 1.2
***************
*** 23,26 ****
--- 23,27 ----
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.filter.SequenceTableFilter;
+ import org.dbunit.DatabaseUnitRuntimeException;
import java.sql.DatabaseMetaData;
***************
*** 65,71 ****
String[] tableNames) throws DataSetException, SQLException
{
! Arrays.sort((String[])tableNames.clone(),
! new TableSequenceComparator(connection));
! return tableNames;
}
--- 66,89 ----
String[] tableNames) throws DataSetException, SQLException
{
! try
! {
! Arrays.sort((String[])tableNames.clone(),
! new TableSequenceComparator(connection));
! return tableNames;
! }
! catch (DatabaseUnitRuntimeException e)
! {
! if (e.getException() instanceof DataSetException)
! {
! throw (DataSetException)e.getException();
! }
! if (e.getException() instanceof SQLException)
! {
! throw (SQLException)e.getException();
! }
!
! throw e;
! }
!
}
***************
*** 98,106 ****
catch (SQLException e)
{
!
}
catch (CyclicTablesDependencyException e)
{
!
}
--- 116,124 ----
catch (SQLException e)
{
! throw new DatabaseUnitRuntimeException(e);
}
catch (CyclicTablesDependencyException e)
{
! throw new DatabaseUnitRuntimeException(e);
}
|
|
From: <mla...@us...> - 2003-06-14 06:15:59
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/util/xml
In directory sc8-pr-cvs1:/tmp/cvs-serv22045/src/java/org/dbunit/util/xml
Removed Files:
Tag: branch-exml2sax
XMLWriter.java
Log Message:
Trying to rename XMLWriter to XmlWriter.
--- XMLWriter.java DELETED ---
|
|
From: <mla...@us...> - 2003-06-14 06:06:52
|
Update of /cvsroot/dbunit/dbunit/src/xml
In directory sc8-pr-cvs1:/tmp/cvs-serv21218/src/xml
Modified Files:
Tag: branch-exml2sax
sortedTableTest.xml xmlTableTest.xml
Log Message:
Completed transition from Electric XML to SAX2. DbUnit now requires a JAXP 1.1 parser but does not depends on exml.jar and dtdparser.jar anymore.
Index: sortedTableTest.xml
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/xml/sortedTableTest.xml,v
retrieving revision 1.1
retrieving revision 1.1.6.1
diff -C2 -d -r1.1 -r1.1.6.1
*** sortedTableTest.xml 20 Feb 2003 03:55:15 -0000 1.1
--- sortedTableTest.xml 14 Jun 2003 06:06:48 -0000 1.1.6.1
***************
*** 7,15 ****
<TEST_TABLE COLUMN0="row 5 col 0" COLUMN1="row 5 col 1" COLUMN2="row 5 col 2" COLUMN3="row 5 col 3"/>
<TEST_TABLE COLUMN0="row 3 col 0" COLUMN1="row 3 col 1" COLUMN2="row 3 col 2" COLUMN3="row 3 col 3"/>
! <MISSING_VALUES />
<MISSING_VALUES COLUMN0="0" COLUMN2="1"/>
! <MISSING_VALUES />
<MISSING_VALUES COLUMN0="0" COLUMN2="0"/>
! <MISSING_VALUES />
</dataset>
--- 7,15 ----
<TEST_TABLE COLUMN0="row 5 col 0" COLUMN1="row 5 col 1" COLUMN2="row 5 col 2" COLUMN3="row 5 col 3"/>
<TEST_TABLE COLUMN0="row 3 col 0" COLUMN1="row 3 col 1" COLUMN2="row 3 col 2" COLUMN3="row 3 col 3"/>
! <MISSING_VALUES COLUMN0="0"/>
<MISSING_VALUES COLUMN0="0" COLUMN2="1"/>
! <MISSING_VALUES COLUMN0="0"/>
<MISSING_VALUES COLUMN0="0" COLUMN2="0"/>
! <MISSING_VALUES COLUMN0="0"/>
</dataset>
Index: xmlTableTest.xml
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/xml/xmlTableTest.xml,v
retrieving revision 1.5
retrieving revision 1.5.6.1
diff -C2 -d -r1.5 -r1.5.6.1
*** xmlTableTest.xml 27 Mar 2002 13:17:14 -0000 1.5
--- xmlTableTest.xml 14 Jun 2003 06:06:48 -0000 1.5.6.1
***************
*** 54,58 ****
<value>value</value>
<value/>
! <value> </value>
</row>
</table>
--- 54,58 ----
<value>value</value>
<value/>
! <value><![CDATA[ ]]></value>
</row>
</table>
|
|
From: <mla...@us...> - 2003-06-14 06:06:52
|
Update of /cvsroot/dbunit/dbunit/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv21218/lib
Removed Files:
Tag: branch-exml2sax
exml.jar
No tag
oracle-jdbc.jar
Log Message:
Completed transition from Electric XML to SAX2. DbUnit now requires a JAXP 1.1 parser but does not depends on exml.jar and dtdparser.jar anymore.
--- exml.jar DELETED ---
--- oracle-jdbc.jar DELETED ---
|
|
From: <mla...@us...> - 2003-06-14 06:06:52
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit
In directory sc8-pr-cvs1:/tmp/cvs-serv21218/src/test/org/dbunit
Modified Files:
Tag: branch-exml2sax
Main.java
Log Message:
Completed transition from Electric XML to SAX2. DbUnit now requires a JAXP 1.1 parser but does not depends on exml.jar and dtdparser.jar anymore.
Index: Main.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/Main.java,v
retrieving revision 1.30.2.3
retrieving revision 1.30.2.4
diff -C2 -d -r1.30.2.3 -r1.30.2.4
*** Main.java 1 May 2003 03:14:53 -0000 1.30.2.3
--- Main.java 14 Jun 2003 06:06:48 -0000 1.30.2.4
***************
*** 24,46 ****
import org.dbunit.database.IDatabaseConnection;
- import org.dbunit.database.DatabaseDataSet;
- import org.dbunit.dataset.xml.FlatXmlDataSet;
- import org.dbunit.dataset.xml.XmlDataSet;
- import org.dbunit.dataset.xml.FlatXmlWriter;
- import org.dbunit.dataset.xml.FlatXmlProducer;
- import org.dbunit.dataset.excel.XlsDataSet;
import org.dbunit.dataset.DataSetException;
- import org.dbunit.dataset.ITableIterator;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.StreamingDataSet;
! import org.dbunit.dataset.CachedDataSet;
! import org.dbunit.operation.DatabaseOperation;
!
! import electric.xml.Document;
!
! import java.io.*;
import org.xml.sax.InputSource;
/**
* This class is a scratchpad used to try new features.
--- 24,50 ----
import org.dbunit.database.IDatabaseConnection;
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.IDataSet;
+ import org.dbunit.dataset.MockDataSetProducer;
import org.dbunit.dataset.StreamingDataSet;
! import org.dbunit.dataset.excel.XlsDataSet;
! import org.dbunit.dataset.xml.FlatXmlDataSet;
! import org.dbunit.dataset.xml.FlatXmlProducer;
! import org.dbunit.dataset.xml.XmlDataSet;
! import org.dbunit.dataset.xml.XmlDataSetWriter;
! import org.dbunit.dataset.xml.XmlProducer;
import org.xml.sax.InputSource;
+ import java.io.File;
+ import java.io.FileOutputStream;
+ import java.io.FileReader;
+ import java.io.FileWriter;
+ import java.io.IOException;
+ import java.io.OutputStream;
+ import java.io.OutputStreamWriter;
+ import java.io.Reader;
+ import java.io.Writer;
+
/**
* This class is a scratchpad used to try new features.
***************
*** 60,68 ****
DatabaseEnvironment.getInstance().getConnection();
! InputSource source = new InputSource(new File("src/xml/flatXmlProducerTest.xml").toURL().toString());
! IDataSet dataSet = new CachedDataSet(new FlatXmlProducer(source));
// DatabaseOperation.INSERT.execute(connection, dataSet);
! XmlDataSet.write(dataSet, new FileWriter("writerTest.xml"));
// FileWriter writer = new FileWriter("writerTest.xml");
// FlatXmlDataSet.write(connection.createDataSet(), writer);
--- 64,90 ----
DatabaseEnvironment.getInstance().getConnection();
! // IDataSet dataSet = new XmlDataSet(new FileReader("src/xml/dataSetTest.xml"));
! InputSource source = new InputSource(new File("src/xml/xmlTableTest.xml").toURL().toString());
! // InputSource source = new InputSource(new File("writerTest.xml").toURL().toString());
! FlatXmlProducer flatXmlProducer = new FlatXmlProducer(source);
! XmlProducer xmlProducer = new XmlProducer(source);
! MockDataSetProducer producer = new MockDataSetProducer();
! producer.setupColumnCount(4);
! producer.setupRowCount(2);
! producer.setupTableCount(3);
! IDataSet dataSet = new StreamingDataSet(xmlProducer);
! // IDataSet dataSet = new StreamingDataSet(xmlProducer);
!
! // System.out.println(connection.createDataSet());
!
// DatabaseOperation.INSERT.execute(connection, dataSet);
! // IDataSet dataSet = connection.createDataSet();
! // OutputStream out = new FileOutputStream("c://writerTest.xml");
! OutputStream out = System.out;
! // FlatXmlWriter writer = new FlatXmlWriter(new OutputStreamWriter(out, "UTF8"));
! XmlDataSetWriter writer = new XmlDataSetWriter(new OutputStreamWriter(out, "UTF8"));
! writer.write(dataSet);
!
// FileWriter writer = new FileWriter("writerTest.xml");
// FlatXmlDataSet.write(connection.createDataSet(), writer);
***************
*** 84,95 ****
}
! private static void testWrite() throws Exception
! {
! Writer out = new FileWriter("test.xml");
!
! Document document = new Document();
! document.write(out);
! out.flush();
! }
private static void oldMain() throws Exception
--- 106,117 ----
}
! // private static void testWrite() throws Exception
! // {
! // Writer out = new FileWriter("test.xml");
! //
! // Document document = new Document();
! // document.write(out);
! // out.flush();
! // }
private static void oldMain() throws Exception
|
|
From: <mla...@us...> - 2003-06-14 06:06:52
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement
In directory sc8-pr-cvs1:/tmp/cvs-serv21218/src/java/org/dbunit/database/statement
Modified Files:
Tag: branch-exml2sax
PreparedStatementFactory.java
Added Files:
Tag: branch-exml2sax
AutomaticPreparedBatchStatement.java
Log Message:
Completed transition from Electric XML to SAX2. DbUnit now requires a JAXP 1.1 parser but does not depends on exml.jar and dtdparser.jar anymore.
--- NEW FILE: AutomaticPreparedBatchStatement.java ---
/*
*
* The DbUnit Database Testing Framework
* Copyright (C)2002, Manuel Laflamme
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package org.dbunit.database.statement;
import org.dbunit.dataset.datatype.DataType;
import org.dbunit.dataset.datatype.TypeCastException;
import java.sql.SQLException;
/**
* @author Manuel Laflamme
* @since Jun 12, 2003
* @version $Revision: 1.1.2.1 $
*/
public class AutomaticPreparedBatchStatement implements IPreparedBatchStatement
{
private final IPreparedBatchStatement _statement;
private int _batchCount = 0;
private int _threshold;
private int _result = 0;
public AutomaticPreparedBatchStatement(IPreparedBatchStatement statement, int threshold)
{
_statement = statement;
_threshold = threshold;
}
////////////////////////////////////////////////////////////////////////////
// IPreparedBatchStatement interface
public void addValue(Object value, DataType dataType) throws TypeCastException,
SQLException
{
_statement.addValue(value, dataType);
}
public void addBatch() throws SQLException
{
_statement.addBatch();
_batchCount++;
if (_batchCount % _threshold == 0)
{
_result += _statement.executeBatch();
System.out.println(_batchCount);
}
}
public int executeBatch() throws SQLException
{
_result += _statement.executeBatch();
return _result;
}
public void clearBatch() throws SQLException
{
_statement.clearBatch();
_batchCount = 0;
}
public void close() throws SQLException
{
_statement.close();
}
}
Index: PreparedStatementFactory.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement/PreparedStatementFactory.java,v
retrieving revision 1.5
retrieving revision 1.5.6.1
diff -C2 -d -r1.5 -r1.5.6.1
*** PreparedStatementFactory.java 13 Jun 2002 17:24:56 -0000 1.5
--- PreparedStatementFactory.java 14 Jun 2003 06:06:48 -0000 1.5.6.1
***************
*** 49,60 ****
IDatabaseConnection connection) throws SQLException
{
if (supportBatchStatement(connection))
{
! return new PreparedBatchStatement(sql, connection.getConnection());
}
else
{
! return new SimplePreparedStatement(sql, connection.getConnection());
}
}
}
--- 49,62 ----
IDatabaseConnection connection) throws SQLException
{
+ IPreparedBatchStatement statement = null;
if (supportBatchStatement(connection))
{
! statement = new PreparedBatchStatement(sql, connection.getConnection());
}
else
{
! statement = new SimplePreparedStatement(sql, connection.getConnection());
}
+ return new AutomaticPreparedBatchStatement(statement, 1000);
}
}
|
|
From: <mla...@us...> - 2003-06-14 06:06:52
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset
In directory sc8-pr-cvs1:/tmp/cvs-serv21218/src/test/org/dbunit/dataset
Added Files:
Tag: branch-exml2sax
MockDataSetProducer.java
Log Message:
Completed transition from Electric XML to SAX2. DbUnit now requires a JAXP 1.1 parser but does not depends on exml.jar and dtdparser.jar anymore.
--- NEW FILE: MockDataSetProducer.java ---
/*
*
* The DbUnit Database Testing Framework
* Copyright (C)2002, Manuel Laflamme
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package org.dbunit.dataset;
import org.dbunit.dataset.IDataSetProducer;
import org.dbunit.dataset.IDataSetConsumer;
import org.dbunit.dataset.DefaultConsumer;
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.Column;
import org.dbunit.dataset.ITableMetaData;
import org.dbunit.dataset.DefaultTableMetaData;
import org.dbunit.dataset.datatype.DataType;
/**
* @author Manuel Laflamme
* @since Jun 12, 2003
* @version $Revision: 1.1.2.1 $
*/
public class MockDataSetProducer implements IDataSetProducer
{
private int _tableCount;
private int _columnCount;
private int _rowCount;
private IDataSetConsumer _consumer = new DefaultConsumer();
public void setupTableCount(int tableCount)
{
_tableCount = tableCount;
}
public void setupColumnCount(int columnCount)
{
_columnCount = columnCount;
}
public void setupRowCount(int rowCount)
{
_rowCount = rowCount;
}
////////////////////////////////////////////////////////////////////////////
// IDataSetProducer interface
public void setConsumer(IDataSetConsumer consumer) throws DataSetException
{
_consumer = consumer;
}
public void produce() throws DataSetException
{
_consumer.startDataSet();
for (int i = 0; i < _tableCount; i++)
{
String tableName = "TABLE" + i;
Column[] columns = new Column[_columnCount];
for (int j = 0; j < columns.length; j++)
{
columns[j] = new Column("COLUMN" + j, DataType.UNKNOWN);
}
ITableMetaData metaData = new DefaultTableMetaData(tableName, columns);
_consumer.startTable(metaData);
for (int j = 0; j < _rowCount; j++)
{
Object[] values = new Object[_columnCount];
for (int k = 0; k < values.length; k++)
{
values[k] = j + "," + k;
}
_consumer.row(values);
}
_consumer.endTable();
}
_consumer.endDataSet();
}
}
|
|
From: <mla...@us...> - 2003-06-14 06:06:52
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/util/xml
In directory sc8-pr-cvs1:/tmp/cvs-serv21218/src/java/org/dbunit/util/xml
Modified Files:
Tag: branch-exml2sax
XMLWriter.java
Removed Files:
Tag: branch-exml2sax
DataWriter.java
Log Message:
Completed transition from Electric XML to SAX2. DbUnit now requires a JAXP 1.1 parser but does not depends on exml.jar and dtdparser.jar anymore.
Index: XMLWriter.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/util/xml/Attic/XMLWriter.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** XMLWriter.java 23 Apr 2003 02:30:37 -0000 1.1.2.1
--- XMLWriter.java 14 Jun 2003 06:06:48 -0000 1.1.2.2
***************
*** 1,1243 ****
- // XMLWriter.java - serialize an XML document.
- // Written by David Megginson, da...@me...
- // NO WARRANTY! This class is in the public domain.
-
- // $Id$
-
package org.dbunit.util.xml;
! import java.io.IOException;
! import java.io.OutputStreamWriter;
[...1766 lines suppressed...]
! if (this.out != null)
! setEncoding(encoding);
! // if (!(this.out instanceof BufferedWriter))
! // this.out = new BufferedWriter(this.out);
}
! public XmlWriter writeDeclaration() throws IOException
{
! if (this.encoding != null)
! {
! this.out.write("<?xml version='1.0'");
! this.out.write(" encoding='" + this.encoding + "'");
! this.out.write("?>");
! this.out.write(this.newline);
! }
! return this;
}
}
--- DataWriter.java DELETED ---
|
|
From: <mla...@us...> - 2003-06-14 06:06:52
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml
In directory sc8-pr-cvs1:/tmp/cvs-serv21218/src/java/org/dbunit/dataset/xml
Modified Files:
Tag: branch-exml2sax
FlatDtdDataSet.java FlatXmlDataSet.java FlatXmlProducer.java
FlatXmlWriter.java XmlDataSet.java XmlProducer.java
Added Files:
Tag: branch-exml2sax
FlatDtdWriter.java XmlDataSetWriter.java
Removed Files:
Tag: branch-exml2sax
FlatXmlTable.java XmlTable.java
Log Message:
Completed transition from Electric XML to SAX2. DbUnit now requires a JAXP 1.1 parser but does not depends on exml.jar and dtdparser.jar anymore.
--- NEW FILE: FlatDtdWriter.java ---
/*
*
* The DbUnit Database Testing Framework
* Copyright (C)2002, Manuel Laflamme
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package org.dbunit.dataset.xml;
import org.dbunit.dataset.Column;
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.ITableMetaData;
import java.io.PrintWriter;
import java.io.Writer;
/**
* @author Manuel Laflamme
* @since Jun 13, 2003
* @version $Revision: 1.1.2.1 $
*/
public class FlatDtdWriter //implements IDataSetConsumer
{
private Writer _writer;
public FlatDtdWriter(Writer writer)
{
_writer = writer;
}
public void write(IDataSet dataSet) throws DataSetException
{
PrintWriter printOut = new PrintWriter(_writer);
String[] tableNames = dataSet.getTableNames();
// dataset element
printOut.println("<!ELEMENT dataset (");
for (int i = 0; i < tableNames.length; i++)
{
printOut.print(" ");
printOut.print(tableNames[i]);
printOut.print("*");
if (i + 1 < tableNames.length)
{
printOut.println(",");
}
}
printOut.println(")>");
printOut.println();
// tables
for (int i = 0; i < tableNames.length; i++)
{
// table element
String tableName = tableNames[i];
printOut.print("<!ELEMENT ");
printOut.print(tableName);
printOut.println(" EMPTY>");
// column attributes
printOut.print("<!ATTLIST ");
printOut.println(tableName);
Column[] columns = dataSet.getTableMetaData(tableName).getColumns();
for (int j = 0; j < columns.length; j++)
{
Column column = columns[j];
printOut.print(" ");
printOut.print(column.getColumnName());
if (column.getNullable() == Column.NULLABLE)
{
printOut.println(" CDATA #IMPLIED");
}
else
{
printOut.println(" CDATA #REQUIRED");
}
}
printOut.println(">");
printOut.println();
}
printOut.flush();
}
}
--- NEW FILE: XmlDataSetWriter.java ---
/*
*
* The DbUnit Database Testing Framework
* Copyright (C)2002, Manuel Laflamme
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package org.dbunit.dataset.xml;
import org.dbunit.dataset.Column;
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.DataSetProducerAdapter;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.IDataSetConsumer;
import org.dbunit.dataset.ITable;
import org.dbunit.dataset.ITableMetaData;
import org.dbunit.dataset.datatype.DataType;
import org.dbunit.dataset.datatype.TypeCastException;
import org.dbunit.util.xml.XmlWriter;
import java.io.IOException;
import java.io.Writer;
/**
* @author Manuel Laflamme
* @since Jun 13, 2003
* @version $Revision: 1.1.2.1 $
*/
public class XmlDataSetWriter implements IDataSetConsumer
{
private static final String DATASET = "dataset";
private static final String TABLE = "table";
private static final String NAME = "name";
private static final String COLUMN = "column";
private static final String ROW = "row";
private static final String VALUE = "value";
private static final String NULL = "null";
private static final String NONE = "none";
private XmlWriter _xmlWriter;
private ITableMetaData _activeMetaData;
public XmlDataSetWriter(Writer writer)
{
_xmlWriter = new XmlWriter(writer);
_xmlWriter.enablePrettyPrint(true);
}
public XmlDataSetWriter(Writer writer, String encoding)
{
_xmlWriter = new XmlWriter(writer, encoding);
_xmlWriter.enablePrettyPrint(true);
}
public void write(IDataSet dataSet) throws DataSetException
{
DataSetProducerAdapter provider = new DataSetProducerAdapter(dataSet);
provider.setConsumer(this);
provider.produce();
}
////////////////////////////////////////////////////////////////////////////
// IDataSetConsumer interface
public void startDataSet() throws DataSetException
{
try
{
_xmlWriter.writeDeclaration();
_xmlWriter.writeElement(DATASET);
}
catch (IOException e)
{
throw new DataSetException(e);
}
}
public void endDataSet() throws DataSetException
{
try
{
_xmlWriter.endElement();
_xmlWriter.close();
}
catch (IOException e)
{
throw new DataSetException(e);
}
}
public void startTable(ITableMetaData metaData) throws DataSetException
{
try
{
_activeMetaData = metaData;
String tableName = _activeMetaData.getTableName();
_xmlWriter.writeElement(TABLE);
_xmlWriter.writeAttribute(NAME, tableName);
Column[] columns = _activeMetaData.getColumns();
for (int i = 0; i < columns.length; i++)
{
String columnName = columns[i].getColumnName();
_xmlWriter.writeElementWithText(COLUMN, columnName);
}
}
catch (IOException e)
{
throw new DataSetException(e);
}
}
public void endTable() throws DataSetException
{
try
{
_xmlWriter.endElement();
_activeMetaData = null;
}
catch (IOException e)
{
throw new DataSetException(e);
}
}
public void row(Object[] values) throws DataSetException
{
try
{
_xmlWriter.writeElement(ROW);
Column[] columns = _activeMetaData.getColumns();
for (int i = 0; i < columns.length; i++)
{
String columnName = columns[i].getColumnName();
Object value = values[i];
// null
if (value == null)
{
_xmlWriter.writeEmptyElement(NULL);
}
// none
else if (value == ITable.NO_VALUE)
{
_xmlWriter.writeEmptyElement(NONE);
}
// values
else
{
try
{
String stringValue = DataType.asString(value);
_xmlWriter.writeElement(VALUE);
if (stringValue.startsWith(" ") || stringValue.endsWith(" "))
{
_xmlWriter.writeCData(stringValue);
}
else if (stringValue.length() > 0)
{
_xmlWriter.writeText(stringValue);
}
_xmlWriter.endElement();
}
catch (TypeCastException e)
{
throw new DataSetException("table=" +
_activeMetaData.getTableName() + ", row=" + i +
", column=" + columnName +
", value=" + value, e);
}
}
}
_xmlWriter.endElement();
}
catch (IOException e)
{
throw new DataSetException(e);
}
}
}
Index: FlatDtdDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/FlatDtdDataSet.java,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -C2 -d -r1.7.2.1 -r1.7.2.2
*** FlatDtdDataSet.java 30 Apr 2003 21:12:49 -0000 1.7.2.1
--- FlatDtdDataSet.java 14 Jun 2003 06:06:48 -0000 1.7.2.2
***************
*** 44,50 ****
}
- /**
- * @deprecated Use Reader overload instead
- */
public FlatDtdDataSet(InputStream in) throws DataSetException, IOException
{
--- 44,47 ----
***************
*** 78,131 ****
throws IOException, DataSetException
{
! PrintWriter printOut = new PrintWriter(out);
! String[] tableNames = dataSet.getTableNames();
!
! // dataset element
! printOut.println("<!ELEMENT dataset (");
! for (int i = 0; i < tableNames.length; i++)
! {
! printOut.print(" ");
! printOut.print(tableNames[i]);
! printOut.print("*");
! if (i + 1 < tableNames.length)
! {
! printOut.println(",");
! }
! }
! printOut.println(")>");
! printOut.println();
!
! // tables
! for (int i = 0; i < tableNames.length; i++)
! {
! // table element
! String tableName = tableNames[i];
! printOut.print("<!ELEMENT ");
! printOut.print(tableName);
! printOut.println(" EMPTY>");
!
! // column attributes
! printOut.print("<!ATTLIST ");
! printOut.println(tableName);
! Column[] columns = dataSet.getTableMetaData(tableName).getColumns();
! for (int j = 0; j < columns.length; j++)
! {
! Column column = columns[j];
! printOut.print(" ");
! printOut.print(column.getColumnName());
! if (column.getNullable() == Column.NULLABLE)
! {
! printOut.println(" CDATA #IMPLIED");
! }
! else
! {
! printOut.println(" CDATA #REQUIRED");
! }
! }
! printOut.println(">");
! printOut.println();
! }
!
! printOut.flush();
}
--- 75,80 ----
throws IOException, DataSetException
{
! FlatDtdWriter datasetWriter = new FlatDtdWriter(out);
! datasetWriter.write(dataSet);
}
***************
*** 237,245 ****
// no op
}
!
! }
!
!
!
!
!
--- 186,188 ----
// no op
}
! }
\ No newline at end of file
Index: FlatXmlDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/FlatXmlDataSet.java,v
retrieving revision 1.21
retrieving revision 1.21.2.1
diff -C2 -d -r1.21 -r1.21.2.1
*** FlatXmlDataSet.java 9 Apr 2003 22:52:10 -0000 1.21
--- FlatXmlDataSet.java 14 Jun 2003 06:06:48 -0000 1.21.2.1
***************
*** 23,57 ****
package org.dbunit.dataset.xml;
! import org.dbunit.dataset.AbstractDataSet;
! import org.dbunit.dataset.Column;
import org.dbunit.dataset.DataSetException;
- import org.dbunit.dataset.DefaultTableIterator;
import org.dbunit.dataset.IDataSet;
- import org.dbunit.dataset.ITable;
- import org.dbunit.dataset.ITableIterator;
- import org.dbunit.dataset.ITableMetaData;
- import org.dbunit.dataset.datatype.DataType;
- import org.dbunit.dataset.datatype.TypeCastException;
! import electric.xml.DocType;
! import electric.xml.Document;
! import electric.xml.Element;
! import electric.xml.Elements;
! import electric.xml.ParseException;
! import electric.xml.XMLDecl;
- import java.io.BufferedReader;
import java.io.File;
! import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
- import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.util.ArrayList;
- import java.util.List;
/**
--- 23,42 ----
package org.dbunit.dataset.xml;
! import org.dbunit.dataset.CachedDataSet;
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.IDataSet;
! import org.xml.sax.EntityResolver;
! import org.xml.sax.InputSource;
! import org.xml.sax.SAXException;
import java.io.File;
! import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+ import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
/**
***************
*** 59,68 ****
* @version $Revision$
*/
! public class FlatXmlDataSet extends AbstractDataSet
{
! private static final String SYSTEM = "SYSTEM '";
! private static final String DEFAULT_ENCODING = "UTF-8";
! private final ITable[] _tables;
/**
--- 44,58 ----
* @version $Revision$
*/
! public class FlatXmlDataSet extends CachedDataSet
{
! private static final String DEFAULT_ENCODING = "UTF8";
! /**
! * Creates an FlatXmlDataSet object with the specifed InputSource.
! */
! public FlatXmlDataSet(InputSource source) throws IOException, DataSetException
! {
! super(new FlatXmlProducer(source));
! }
/**
***************
*** 87,114 ****
throws IOException, DataSetException
{
! try
! {
! Document document = new Document(new BufferedReader(new FileReader(xmlFile)));
!
! IDataSet metaDataSet = null;
!
! // Create metadata from dtd if defined
! String dtdUri = getDocTypeUri(document);
! if (dtdMetadata && dtdUri != null)
! {
! File dtdFile = new File(dtdUri);
! if (!dtdFile.isAbsolute())
! {
! dtdFile = new File(xmlFile.getParent(), dtdUri);
! }
! metaDataSet = new FlatDtdDataSet(new FileReader(dtdFile));
! }
!
! _tables = getTables(document, metaDataSet);
! }
! catch (ParseException e)
! {
! throw new DataSetException(e);
! }
}
--- 77,83 ----
throws IOException, DataSetException
{
! super(new FlatXmlProducer(
! new InputSource(xmlFile.toURL().toString()),
! dtdMetadata));
}
***************
*** 134,164 ****
throws IOException, DataSetException
{
! try
! {
! Document document = new Document(new BufferedReader(xmlReader));
!
! // Create metadata from dtd if defined
! IDataSet metaDataSet = null;
! String dtdUri = getDocTypeUri(document);
! if (dtdMetadata && dtdUri != null)
! {
! try
! {
! URL dtdUrl = new URL(dtdUri);
! metaDataSet = new FlatDtdDataSet(new InputStreamReader(
! dtdUrl.openStream()));
! }
! catch (MalformedURLException e)
! {
! metaDataSet = new FlatDtdDataSet(new FileReader(dtdUri));
! }
! }
!
! _tables = getTables(document, metaDataSet);
! }
! catch (ParseException e)
! {
! throw new DataSetException(e);
! }
}
--- 103,108 ----
throws IOException, DataSetException
{
! super(new FlatXmlProducer(
! new InputSource(xmlReader), dtdMetadata));
}
***************
*** 172,176 ****
throws IOException, DataSetException
{
! this(xmlReader, new FlatDtdDataSet(dtdReader));
}
--- 116,122 ----
throws IOException, DataSetException
{
! super(new FlatXmlProducer(
! new InputSource(xmlReader),
! new DtdEntityResolver(dtdReader)));
}
***************
*** 184,195 ****
throws IOException, DataSetException
{
! try
! {
! _tables = getTables(new Document(new BufferedReader(xmlReader)), metaDataSet);
! }
! catch (ParseException e)
! {
! throw new DataSetException(e);
! }
}
--- 130,135 ----
throws IOException, DataSetException
{
! super(new FlatXmlProducer(
! new InputSource(xmlReader), metaDataSet));
}
***************
*** 199,203 ****
*
* @param xmlStream the xml input stream
- * @deprecated Use Reader overload instead
*/
public FlatXmlDataSet(InputStream xmlStream) throws IOException, DataSetException
--- 139,142 ----
***************
*** 212,222 ****
* @param xmlStream the xml input stream
* @param dtdMetadata if <code>false</code> do not use DTD as metadata
- * @deprecated Use Reader overload instead
- *
*/
public FlatXmlDataSet(InputStream xmlStream, boolean dtdMetadata)
throws IOException, DataSetException
{
! this(new InputStreamReader(xmlStream), dtdMetadata);
}
--- 151,160 ----
* @param xmlStream the xml input stream
* @param dtdMetadata if <code>false</code> do not use DTD as metadata
*/
public FlatXmlDataSet(InputStream xmlStream, boolean dtdMetadata)
throws IOException, DataSetException
{
! super(new FlatXmlProducer(
! new InputSource(xmlStream), dtdMetadata));
}
***************
*** 227,236 ****
* @param xmlStream the xml input stream
* @param dtdStream the dtd input stream
- * @deprecated Use Reader overload instead
*/
public FlatXmlDataSet(InputStream xmlStream, InputStream dtdStream)
throws IOException, DataSetException
{
! this(xmlStream, new FlatDtdDataSet(dtdStream));
}
--- 165,175 ----
* @param xmlStream the xml input stream
* @param dtdStream the dtd input stream
*/
public FlatXmlDataSet(InputStream xmlStream, InputStream dtdStream)
throws IOException, DataSetException
{
! super(new FlatXmlProducer(
! new InputSource(xmlStream),
! new DtdEntityResolver(dtdStream)));
}
***************
*** 240,270 ****
* @param xmlStream the xml input stream
* @param metaDataSet the dataset used as metadata source.
- * @deprecated Use Reader overload instead
*/
public FlatXmlDataSet(InputStream xmlStream, IDataSet metaDataSet)
throws IOException, DataSetException
{
! try
! {
! _tables = getTables(new Document(xmlStream), metaDataSet);
! }
! catch (ParseException e)
! {
! throw new DataSetException(e);
! }
}
/**
* Write the specified dataset to the specified output stream as xml.
- * @deprecated Use Writer overload instead
*/
public static void write(IDataSet dataSet, OutputStream out)
throws IOException, DataSetException
{
! Document document = buildDocument(dataSet, DEFAULT_ENCODING);
!
! // write xml document
! document.write(out);
! out.flush();
}
--- 179,198 ----
* @param xmlStream the xml input stream
* @param metaDataSet the dataset used as metadata source.
*/
public FlatXmlDataSet(InputStream xmlStream, IDataSet metaDataSet)
throws IOException, DataSetException
{
! super(new FlatXmlProducer(
! new InputSource(xmlStream), metaDataSet));
}
/**
* Write the specified dataset to the specified output stream as xml.
*/
public static void write(IDataSet dataSet, OutputStream out)
throws IOException, DataSetException
{
! OutputStreamWriter writer = new OutputStreamWriter(out, DEFAULT_ENCODING);
! write(dataSet, writer);
}
***************
*** 272,283 ****
* Write the specified dataset to the specified writer as xml.
*/
! public static void write(IDataSet dataSet, Writer out)
throws IOException, DataSetException
{
! Document document = buildDocument(dataSet, DEFAULT_ENCODING);
!
! // write xml document
! document.write(out);
! out.flush();
}
--- 200,207 ----
* Write the specified dataset to the specified writer as xml.
*/
! public static void write(IDataSet dataSet, Writer writer)
throws IOException, DataSetException
{
! write(dataSet, writer, null);
}
***************
*** 285,296 ****
* Write the specified dataset to the specified writer as xml.
*/
! public static void write(IDataSet dataSet, Writer out, String encoding)
throws IOException, DataSetException
{
! Document document = buildDocument(dataSet, encoding);
!
! // write xml document
! document.write(out);
! out.flush();
}
--- 209,218 ----
* Write the specified dataset to the specified writer as xml.
*/
! public static void write(IDataSet dataSet, Writer writer, String encoding)
throws IOException, DataSetException
{
! FlatXmlWriter datasetWriter = new FlatXmlWriter(writer, encoding);
! datasetWriter.setIncludeEmptyTable(true);
! datasetWriter.write(dataSet);
}
***************
*** 305,451 ****
}
! private static Document buildDocument(IDataSet dataSet, String encoding)
! throws DataSetException
! {
! Document document = new Document();
! document.addChild(new XMLDecl("1.0", encoding));
!
! // dataset
! Element rootElem = document.addElement("dataset");
!
! // tables
! ITableIterator iterator = dataSet.iterator();
! while(iterator.next())
! {
! ITable table = iterator.getTable();
! ITableMetaData metaData = table.getTableMetaData();
! String tableName = metaData.getTableName();
!
! Column[] columns = table.getTableMetaData().getColumns();
!
! // table rows
! for (int j = 0; j < table.getRowCount(); j++)
! {
! Element rowElem = rootElem.addElement(tableName);
! for (int k = 0; k < columns.length; k++)
! {
! Column column = columns[k];
! Object value = table.getValue(j, column.getColumnName());
!
! // row values
! if (value != null && value != ITable.NO_VALUE)
! {
! try
! {
! String stringValue = DataType.asString(value);
! rowElem.setAttribute(column.getColumnName(), stringValue);
! }
! catch (TypeCastException e)
! {
! throw new DataSetException("table=" + tableName +
! ", row=" + j + ", column=" +
! column.getColumnName() + ", value=" +
! value, e);
! }
! }
! }
! }
!
! // empty table
! if (table.getRowCount() == 0)
! {
! rootElem.addElement(tableName);
! }
! }
!
! return document;
! }
!
! private ITable[] getTables(Document document, IDataSet metaDataSet)
! throws IOException, DataSetException
{
! List tableList = new ArrayList();
! List rowList = new ArrayList();
! String lastTableName = null;
!
! Elements rowElems = document.getElement("dataset").getElements();
! while (rowElems.hasMoreElements())
! {
! Element rowElem = (Element)rowElems.nextElement();
!
! if (lastTableName != null &&
! !lastTableName.equals(rowElem.getName()))
! {
! Element[] elems = (Element[])rowList.toArray(new Element[0]);
! rowList.clear();
!
! tableList.add(createTable(elems, metaDataSet));
! }
!
! lastTableName = rowElem.getName();
! rowList.add(rowElem);
! }
! if (rowList.size() > 0)
{
! Element[] elems = (Element[])rowList.toArray(new Element[0]);
! tableList.add(createTable(elems, metaDataSet));
}
! return (ITable[])tableList.toArray(new ITable[0]);
! }
!
! private ITable createTable(Element[] rows, IDataSet metaDataSet)
! throws DataSetException
! {
! Element sampleRow = rows[0];
!
! ITableMetaData metaData = null;
! if (metaDataSet != null)
! {
! String tableName = sampleRow.getName();
! metaData = metaDataSet.getTableMetaData(tableName);
! }
! else
{
! metaData = FlatXmlTable.createMetaData(sampleRow);
}
! // Assume empty table when only one row with no columns
! if (rows.length == 1 && sampleRow.getAttributes().size() == 0)
{
! rows = new Element[0];
}
! return new FlatXmlTable(rows, metaData);
! }
!
! /**
! * Returns this document type uri or <code>null</code> if none is defined.
! */
! private String getDocTypeUri(Document document)
! {
! DocType docType = document.getDocType();
! if (docType != null && docType.getExternalId() != null)
{
! String externalId = docType.getExternalId();
! if (externalId.startsWith(SYSTEM))
! {
! externalId = externalId.substring(SYSTEM.length(), externalId.length() - 1);
! }
!
! return externalId;
}
- return null;
- }
-
- ////////////////////////////////////////////////////////////////////////////
- // AbstractDataSet class
-
- protected ITableIterator createIterator(boolean reversed)
- throws DataSetException
- {
- return new DefaultTableIterator(_tables, reversed);
}
}
--- 227,255 ----
}
! private static class DtdEntityResolver implements EntityResolver
{
! InputSource _dtdSource;
! public DtdEntityResolver(InputSource dtdSource)
{
! _dtdSource = dtdSource;
}
! public DtdEntityResolver(Reader dtdReader)
{
! this(new InputSource(dtdReader));
}
! public DtdEntityResolver(InputStream dtdStream)
{
! this(new InputSource(dtdStream));
}
! public InputSource resolveEntity(String publicId, String systemId)
! throws SAXException, IOException
{
! return _dtdSource;
}
}
}
Index: FlatXmlProducer.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/Attic/FlatXmlProducer.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** FlatXmlProducer.java 30 Apr 2003 21:12:50 -0000 1.1.2.2
--- FlatXmlProducer.java 14 Jun 2003 06:06:48 -0000 1.1.2.3
***************
*** 58,63 ****
private final InputSource _inputSource;
private final EntityResolver _resolver;
! private final boolean _ignoreDtd;
! private XMLReader _xmlReader;
private IDataSet _metaDataSet;
--- 58,63 ----
private final InputSource _inputSource;
private final EntityResolver _resolver;
! private final boolean _dtdMetadata;
! private boolean _validating = false;
private IDataSet _metaDataSet;
***************
*** 68,80 ****
{
_inputSource = xmlSource;
- _ignoreDtd = false;
_resolver = this;
}
! public FlatXmlProducer(InputSource xmlSource, boolean ignoreDtd)
{
_inputSource = xmlSource;
- _ignoreDtd = ignoreDtd;
_resolver = this;
}
--- 68,82 ----
{
_inputSource = xmlSource;
_resolver = this;
+ _dtdMetadata = true;
+ _validating = false;
}
! public FlatXmlProducer(InputSource xmlSource, boolean dtdMetadata)
{
_inputSource = xmlSource;
_resolver = this;
+ _dtdMetadata = dtdMetadata;
+ _validating = false;
}
***************
*** 83,88 ****
_inputSource = xmlSource;
_metaDataSet = metaDataSet;
- _ignoreDtd = true;
_resolver = this;
}
--- 85,91 ----
_inputSource = xmlSource;
_metaDataSet = metaDataSet;
_resolver = this;
+ _dtdMetadata = false;
+ _validating = false;
}
***************
*** 90,95 ****
{
_inputSource = xmlSource;
- _ignoreDtd = false;
_resolver = resolver;
}
--- 93,99 ----
{
_inputSource = xmlSource;
_resolver = resolver;
+ _dtdMetadata = true;
+ _validating = false;
}
***************
*** 119,122 ****
--- 123,131 ----
}
+ public void setValidating(boolean validating)
+ {
+ _validating = validating;
+ }
+
////////////////////////////////////////////////////////////////////////////
// IDataSetProducer interface
***************
*** 131,150 ****
try
{
! if (_xmlReader == null)
! {
! SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
! _xmlReader = saxParser.getXMLReader();
! }
! if (!_ignoreDtd)
{
FlatDtdHandler dtdHandler = new FlatDtdHandler();
! FlatDtdHandler.setLexicalHandler(_xmlReader, dtdHandler);
! FlatDtdHandler.setDeclHandler(_xmlReader, dtdHandler);
}
! _xmlReader.setContentHandler(this);
! _xmlReader.setEntityResolver(_resolver);
! _xmlReader.parse(_inputSource);
}
catch (ParserConfigurationException e)
--- 140,157 ----
try
{
! SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
! saxParserFactory.setValidating(_validating);
! XMLReader xmlReader = saxParserFactory.newSAXParser().getXMLReader();
! if (_dtdMetadata)
{
FlatDtdHandler dtdHandler = new FlatDtdHandler();
! FlatDtdHandler.setLexicalHandler(xmlReader, dtdHandler);
! FlatDtdHandler.setDeclHandler(xmlReader, dtdHandler);
}
! xmlReader.setContentHandler(this);
! xmlReader.setEntityResolver(_resolver);
! xmlReader.parse(_inputSource);
}
catch (ParserConfigurationException e)
***************
*** 169,173 ****
throws SAXException
{
! if (_ignoreDtd)
{
return new InputSource(new StringReader(""));
--- 176,180 ----
throws SAXException
{
! if (!_dtdMetadata)
{
return new InputSource(new StringReader(""));
Index: FlatXmlWriter.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/Attic/FlatXmlWriter.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** FlatXmlWriter.java 30 Apr 2003 00:27:46 -0000 1.1.2.3
--- FlatXmlWriter.java 14 Jun 2003 06:06:48 -0000 1.1.2.4
***************
*** 23,37 ****
import org.dbunit.dataset.Column;
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.IDataSet;
import org.dbunit.dataset.ITableMetaData;
import org.dbunit.dataset.datatype.DataType;
! import org.dbunit.dataset.DataSetProducerAdapter;
! import org.dbunit.dataset.IDataSetConsumer;
! import org.dbunit.util.xml.DataWriter;
! import org.dbunit.util.xml.XMLWriter;
! import org.xml.sax.SAXException;
! import org.xml.sax.helpers.AttributesImpl;
import java.io.Writer;
--- 23,36 ----
import org.dbunit.dataset.Column;
import org.dbunit.dataset.DataSetException;
+ import org.dbunit.dataset.DataSetProducerAdapter;
import org.dbunit.dataset.IDataSet;
+ import org.dbunit.dataset.IDataSetConsumer;
import org.dbunit.dataset.ITableMetaData;
import org.dbunit.dataset.datatype.DataType;
! import org.dbunit.dataset.datatype.TypeCastException;
! import org.dbunit.util.xml.XmlWriter;
+ import java.io.IOException;
import java.io.Writer;
***************
*** 41,127 ****
* @version $Revision$
*/
! public class FlatXmlWriter
{
- private static final String CDATA = "CDATA";
private static final String DATASET = "dataset";
! public void write(IDataSet dataSet, Writer writer) throws DataSetException
{
- DataWriter dataWriter = new DataWriter(writer);
- dataWriter.setIndentStep(1);
DataSetProducerAdapter provider = new DataSetProducerAdapter(dataSet);
! provider.setConsumer(new Consumer(dataWriter));
provider.produce();
}
! private class Consumer implements IDataSetConsumer
! {
! private final XMLWriter _xmlWriter;
! private ITableMetaData _activeMetaData;
! public Consumer(XMLWriter xmlWriter)
{
! _xmlWriter = xmlWriter;
}
! ////////////////////////////////////////////////////////////////////////////
! // IDataSetConsumer interface
!
! public void startDataSet() throws DataSetException
{
! try
! {
! _xmlWriter.startDocument();
! _xmlWriter.startElement("", DATASET, DATASET, new AttributesImpl());
! }
! catch (SAXException e)
! {
! throw new DataSetException(e.getException() == null ? e : e.getException());
! }
}
! public void endDataSet() throws DataSetException
{
try
{
! _xmlWriter.endDocument();
! _xmlWriter.endElement("", DATASET, DATASET);
}
! catch (SAXException e)
{
! throw new DataSetException(e.getException() == null ? e : e.getException());
}
}
! public void startTable(ITableMetaData metaData) throws DataSetException
! {
! _activeMetaData = metaData;
! }
! public void endTable() throws DataSetException
{
! _activeMetaData = null;
! }
! public void row(Object[] values) throws DataSetException
! {
! try
{
! AttributesImpl attributes = new AttributesImpl();
! Column[] columns = _activeMetaData.getColumns();
! for (int i = 0; i < columns.length; i++)
{
! String columnName = columns[i].getColumnName();
! Object value = values[i];
! attributes.addAttribute("", columnName, columnName, CDATA,
! DataType.asString(value));
}
- String tableName = _activeMetaData.getTableName();
- _xmlWriter.emptyElement("", tableName, tableName, attributes);
- }
- catch (SAXException e)
- {
- throw new DataSetException(e.getException() == null ? e : e.getException());
}
}
}
--- 40,161 ----
* @version $Revision$
*/
! public class FlatXmlWriter implements IDataSetConsumer
{
private static final String DATASET = "dataset";
! private XmlWriter _xmlWriter;
! private ITableMetaData _activeMetaData;
! private int _activeRowCount;
! private boolean _includeEmptyTable = false;
!
! public FlatXmlWriter(Writer writer)
! {
! _xmlWriter = new XmlWriter(writer);
! _xmlWriter.enablePrettyPrint(true);
! }
!
! public FlatXmlWriter(Writer writer, String encoding)
! {
! _xmlWriter = new XmlWriter(writer, encoding);
! _xmlWriter.enablePrettyPrint(true);
! }
!
! public void setIncludeEmptyTable(boolean includeEmptyTable)
! {
! _includeEmptyTable = includeEmptyTable;
! }
!
! public void write(IDataSet dataSet) throws DataSetException
{
DataSetProducerAdapter provider = new DataSetProducerAdapter(dataSet);
! provider.setConsumer(this);
provider.produce();
}
! ////////////////////////////////////////////////////////////////////////////
! // IDataSetConsumer interface
! public void startDataSet() throws DataSetException
! {
! try
{
! _xmlWriter.writeDeclaration();
! _xmlWriter.writeElement(DATASET);
}
+ catch (IOException e)
+ {
+ throw new DataSetException(e);
+ }
+ }
! public void endDataSet() throws DataSetException
! {
! try
{
! _xmlWriter.endElement();
! _xmlWriter.close();
! }
! catch (IOException e)
! {
! throw new DataSetException(e);
}
+ }
! public void startTable(ITableMetaData metaData) throws DataSetException
! {
! _activeMetaData = metaData;
! _activeRowCount = 0;
! }
!
! public void endTable() throws DataSetException
! {
! if (_includeEmptyTable && _activeRowCount == 0)
{
try
{
! String tableName = _activeMetaData.getTableName();
! _xmlWriter.writeEmptyElement(tableName);
}
! catch (IOException e)
{
! throw new DataSetException(e);
}
}
! _activeMetaData = null;
! }
! public void row(Object[] values) throws DataSetException
! {
! try
{
! String tableName = _activeMetaData.getTableName();
! _xmlWriter.writeElement(tableName);
! Column[] columns = _activeMetaData.getColumns();
! for (int i = 0; i < columns.length; i++)
{
! String columnName = columns[i].getColumnName();
! Object value = values[i];
! try
{
! String stringValue = DataType.asString(value);
! _xmlWriter.writeAttribute(columnName, stringValue);
! }
! catch (TypeCastException e)
! {
! throw new DataSetException("table=" +
! _activeMetaData.getTableName() + ", row=" + i +
! ", column=" + columnName +
! ", value=" + value, e);
}
}
+
+ _activeRowCount++;
+ _xmlWriter.endElement();
+ }
+ catch (IOException e)
+ {
+ throw new DataSetException(e);
}
}
Index: XmlDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/XmlDataSet.java,v
retrieving revision 1.16
retrieving revision 1.16.2.1
diff -C2 -d -r1.16 -r1.16.2.1
*** XmlDataSet.java 9 Apr 2003 22:52:11 -0000 1.16
--- XmlDataSet.java 14 Jun 2003 06:06:48 -0000 1.16.2.1
***************
*** 23,35 ****
package org.dbunit.dataset.xml;
! import org.dbunit.dataset.*;
! import org.dbunit.dataset.datatype.DataType;
! import org.dbunit.dataset.datatype.TypeCastException;
! import java.io.*;
! import java.util.ArrayList;
! import java.util.List;
! import electric.xml.*;
/**
--- 23,38 ----
package org.dbunit.dataset.xml;
! import org.dbunit.dataset.CachedDataSet;
! import org.dbunit.dataset.DataSetException;
! import org.dbunit.dataset.IDataSet;
! import org.xml.sax.InputSource;
! import java.io.IOException;
! import java.io.InputStream;
! import java.io.OutputStream;
! import java.io.OutputStreamWriter;
! import java.io.Reader;
! import java.io.Writer;
/**
***************
*** 40,109 ****
* @version $Revision$
*/
! public class XmlDataSet extends AbstractDataSet
{
! private static final String DEFAULT_ENCODING = "UTF-8";
! private final ITable[] _tables;
/**
* Creates an XmlDataSet with the specified xml reader.
*/
! public XmlDataSet(Reader in) throws DataSetException
{
! try
! {
! Document document = new Document(new BufferedReader(in));
! _tables = getTables(document);
! }
! catch (ParseException e)
! {
! throw new DataSetException(e);
! }
}
/**
* Creates an XmlDataSet with the specified xml input stream.
- *
- * @deprecated Use Reader overload instead
*/
public XmlDataSet(InputStream in) throws DataSetException
{
! try
! {
! Document document = new Document(in);
! _tables = getTables(document);
! }
! catch (ParseException e)
! {
! throw new DataSetException(e);
! }
! }
!
! private ITable[] getTables(Document document) throws DataSetException
! {
! Elements tableElems = document.getElement("dataset").getElements("table");
!
! List tableList = new ArrayList();
! while (tableElems.hasMoreElements())
! {
! Element tableElem = (Element)tableElems.nextElement();
! ITable table = new XmlTable(tableElem);
! tableList.add(table);
! }
!
! return (ITable[])tableList.toArray(new ITable[0]);
}
/**
* Write the specified dataset to the specified output stream as xml.
- * @deprecated Use Writer overload instead
*/
public static void write(IDataSet dataSet, OutputStream out)
throws IOException, DataSetException
{
! Document document = buildDocument(dataSet, DEFAULT_ENCODING);
!
! // write xml document
! document.write(out);
! out.flush();
}
--- 43,74 ----
* @version $Revision$
*/
! public class XmlDataSet extends CachedDataSet
{
! private static final String DEFAULT_ENCODING = "UTF8";
/**
* Creates an XmlDataSet with the specified xml reader.
*/
! public XmlDataSet(Reader reader) throws DataSetException
{
! super(new XmlProducer(new InputSource(reader)));
}
/**
* Creates an XmlDataSet with the specified xml input stream.
*/
public XmlDataSet(InputStream in) throws DataSetException
{
! super(new XmlProducer(new InputSource(in)));
}
/**
* Write the specified dataset to the specified output stream as xml.
*/
public static void write(IDataSet dataSet, OutputStream out)
throws IOException, DataSetException
{
! OutputStreamWriter writer = new OutputStreamWriter(out, DEFAULT_ENCODING);
! write(dataSet, writer);
}
***************
*** 111,122 ****
* Write the specified dataset to the specified writer as xml.
*/
! public static void write(IDataSet dataSet, Writer out)
throws IOException, DataSetException
{
! Document document = buildDocument(dataSet, DEFAULT_ENCODING);
!
! // write xml document
! document.write(out);
! out.flush();
}
--- 76,83 ----
* Write the specified dataset to the specified writer as xml.
*/
! public static void write(IDataSet dataSet, Writer writer)
throws IOException, DataSetException
{
! write(dataSet, writer, null);
}
***************
*** 124,230 ****
* Write the specified dataset to the specified writer as xml.
*/
! public static void write(IDataSet dataSet, Writer out, String encoding)
throws IOException, DataSetException
{
! Document document = buildDocument(dataSet, encoding);
!
! // write xml document
! document.write(out);
! out.flush();
! }
!
! private static Document buildDocument(IDataSet dataSet, String encoding)
! throws DataSetException
! {
! Document document = new Document();
! document.addChild(new XMLDecl("1.0", encoding));
!
! // dataset
! Element rootElem = document.addElement("dataset");
! ITableIterator iterator = dataSet.iterator();
! while(iterator.next())
! {
! ITable table = iterator.getTable();
! ITableMetaData metaData = table.getTableMetaData();
! String tableName = metaData.getTableName();
!
! // table
! Element tableElem = rootElem.addElement("table");
! tableElem.setAttribute("name", tableName);
!
! // columns
! Column[] columns = metaData.getColumns();
! for (int j = 0; j < columns.length; j++)
! {
! Column column = columns[j];
! tableElem.addElement("column").setText(column.getColumnName());
! }
!
! // rows
! for (int j = 0; j < table.getRowCount(); j++)
! {
! Element rowElem = tableElem.addElement("row");
! for (int k = 0; k < columns.length; k++)
! {
! Column column = columns[k];
! Object value = table.getValue(j, column.getColumnName());
!
! // null
! if (value == null)
! {
! rowElem.addElement("null");
! }
! // none
! else if (value == ITable.NO_VALUE)
! {
! rowElem.addElement("none");
! }
! // values
! else
! {
! try
! {
! String string = DataType.asString(value);
!
! Text text = null;
! if (string.startsWith(" ") || string.endsWith(""))
! {
! text = new CData(string);
! }
! else
! {
! text = new Text(string);
! }
!
! rowElem.addElement("value").setText(text);
! }
! catch (TypeCastException e)
! {
! throw new DataSetException("table=" +
! metaData.getTableName() + ", row=" + j +
! ", column=" + column.getColumnName() +
! ", value=" + value, e);
! }
! }
! }
! }
! }
! return document;
! }
!
! ////////////////////////////////////////////////////////////////////////////
! // AbstractDataSet class
!
! protected ITableIterator createIterator(boolean reversed)
! throws DataSetException
! {
! return new DefaultTableIterator(_tables, reversed);
}
! }
!
!
!
!
!
!
!
--- 85,93 ----
* Write the specified dataset to the specified writer as xml.
*/
! public static void write(IDataSet dataSet, Writer writer, String encoding)
throws IOException, DataSetException
{
! XmlDataSetWriter datasetWriter = new XmlDataSetWriter(writer, encoding);
! datasetWriter.write(dataSet);
}
! }
\ No newline at end of file
Index: XmlProducer.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/Attic/XmlProducer.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** XmlProducer.java 1 May 2003 12:53:03 -0000 1.1.2.2
--- XmlProducer.java 14 Jun 2003 06:06:48 -0000 1.1.2.3
***************
*** 28,31 ****
--- 28,32 ----
import org.dbunit.dataset.IDataSetProducer;
import org.dbunit.dataset.ITableMetaData;
+ import org.dbunit.dataset.ITable;
import org.dbunit.dataset.datatype.DataType;
***************
*** 45,48 ****
--- 46,51 ----
import java.util.LinkedList;
import java.util.List;
+ import java.util.Arrays;
+ import java.util.Iterator;
/**
***************
*** 63,66 ****
--- 66,70 ----
private static final String VALUE = "value";
private static final String NULL = "null";
+ private static final String NONE = "none";
private final InputSource _inputSource;
***************
*** 68,72 ****
--- 72,80 ----
private IDataSetConsumer _consumer = EMPTY_CONSUMER;
+
+
private String _activeTableName;
+ private ITableMetaData _activeMetaData;
+
private List _activeColumnNames;
private StringBuffer _activeCharacters;
***************
*** 179,186 ****
if (_activeColumnNames != null)
{
! ITableMetaData metaData =
! createMetaData(_activeTableName, _activeColumnNames);
! _consumer.startTable(metaData);
_activeColumnNames = null;
}
--- 187,195 ----
if (_activeColumnNames != null)
{
! _activeMetaData = createMetaData(_activeTableName,
! _activeColumnNames);
! _consumer.startTable(_activeMetaData);
_activeColumnNames = null;
+
}
***************
*** 202,205 ****
--- 211,221 ----
return;
}
+
+ // none
+ if (qName.equals(NONE))
+ {
+ _activeRowValues.add(ITable.NO_VALUE);
+ return;
+ }
}
catch (DataSetException e)
***************
*** 226,232 ****
if (_activeColumnNames != null)
{
! ITableMetaData metaData =
! createMetaData(_activeTableName, _activeColumnNames);
! _consumer.startTable(metaData);
_activeColumnNames = null;
}
--- 242,248 ----
if (_activeColumnNames != null)
{
! _activeMetaData = createMetaData(_activeTableName,
! _activeColumnNames);
! _consumer.startTable(_activeMetaData);
_activeColumnNames = null;
}
***************
*** 234,237 ****
--- 250,254 ----
_consumer.endTable();
_activeTableName = null;
+ _activeMetaData = null;
return;
}
***************
*** 242,245 ****
--- 259,263 ----
_activeColumnNames.add(_activeCharacters.toString());
_activeCharacters = null;
+ return;
}
***************
*** 247,252 ****
if (qName.equals(ROW))
{
! _consumer.row(_activeRowValues.toArray());
_activeRowValues = null;
}
--- 265,276 ----
if (qName.equals(ROW))
{
! Object[] values = new Object[_activeMetaData.getColumns().length];
! for (int i = 0; i < values.length; i++)
! {
! values[i] = (i >= _activeRowValues.size()) ? ITable.NO_VALUE : _activeRowValues.get(i);
! }
! _consumer.row(values);
_activeRowValues = null;
+ return;
}
***************
*** 256,259 ****
--- 280,284 ----
_activeRowValues.add(_activeCharacters.toString());
_activeCharacters = null;
+ return;
}
***************
*** 262,265 ****
--- 287,298 ----
{
// Nothing to do, already processed in startElement()
+ return;
+ }
+
+ // none
+ if (qName.equals(NONE))
+ {
+ // Nothing to do, already processed in startElement()
+ return;
}
}
--- FlatXmlTable.java DELETED ---
--- XmlTable.java DELETED ---
|
|
From: <mla...@us...> - 2003-06-14 06:06:52
|
Update of /cvsroot/dbunit/dbunit
In directory sc8-pr-cvs1:/tmp/cvs-serv21218
Removed Files:
Tag: branch-exml2sax
electricxml-license.txt
Log Message:
Completed transition from Electric XML to SAX2. DbUnit now requires a JAXP 1.1 parser but does not depends on exml.jar and dtdparser.jar anymore.
--- electricxml-license.txt DELETED ---
|
|
From: <mla...@us...> - 2003-06-14 06:06:52
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset
In directory sc8-pr-cvs1:/tmp/cvs-serv21218/src/java/org/dbunit/dataset
Modified Files:
Tag: branch-exml2sax
CachedDataSet.java StreamingIterator.java
Log Message:
Completed transition from Electric XML to SAX2. DbUnit now requires a JAXP 1.1 parser but does not depends on exml.jar and dtdparser.jar anymore.
Index: CachedDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/Attic/CachedDataSet.java,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** CachedDataSet.java 30 Apr 2003 21:12:48 -0000 1.1.2.5
--- CachedDataSet.java 14 Jun 2003 06:06:48 -0000 1.1.2.6
***************
*** 86,95 ****
_activeMetaData = metaData;
_activeRowList = new ArrayList();
! // System.out.println("START " + _activeMetaData.getTableName());
}
public void endTable() throws DataSetException
{
! // System.out.println("END " + _activeMetaData.getTableName());
_tableList.add(new DefaultTable(_activeMetaData, _activeRowList));
_activeRowList = null;
--- 86,95 ----
_activeMetaData = metaData;
_activeRowList = new ArrayList();
! // System.out.println("START " + _activeMetaData.getTableName());
}
public void endTable() throws DataSetException
{
! // System.out.println("END " + _activeMetaData.getTableName());
_tableList.add(new DefaultTable(_activeMetaData, _activeRowList));
_activeRowList = null;
Index: StreamingIterator.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/Attic/StreamingIterator.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -C2 -d -r1.1.2.3 -r1.1.2.4
*** StreamingIterator.java 30 Apr 2003 00:27:45 -0000 1.1.2.3
--- StreamingIterator.java 14 Jun 2003 06:06:48 -0000 1.1.2.4
***************
*** 55,60 ****
_channel = channel;
! AsynchronousConsumer handler = new AsynchronousConsumer(source, channel);
! new Thread(handler).start();
// Take first element from asyncronous handler
--- 55,62 ----
_channel = channel;
! AsynchronousConsumer consumer = new AsynchronousConsumer(source, channel);
! Thread thread = new Thread(consumer);
! thread.setDaemon(true);
! thread.start();
// Take first element from asyncronous handler
|
|
From: <mla...@us...> - 2003-06-14 06:06:52
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml
In directory sc8-pr-cvs1:/tmp/cvs-serv21218/src/test/org/dbunit/dataset/xml
Modified Files:
Tag: branch-exml2sax
FlatXmlProducerTest.java
Log Message:
Completed transition from Electric XML to SAX2. DbUnit now requires a JAXP 1.1 parser but does not depends on exml.jar and dtdparser.jar anymore.
Index: FlatXmlProducerTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml/Attic/FlatXmlProducerTest.java,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** FlatXmlProducerTest.java 1 May 2003 16:35:17 -0000 1.1.2.4
--- FlatXmlProducerTest.java 14 Jun 2003 06:06:48 -0000 1.1.2.5
***************
*** 119,128 ****
String content =
"<?xml version=\"1.0\"?>" +
! "<!DOCTYPE dataset SYSTEM \"urn:/dummy.dtd\">" +
"<dataset>" +
"<EMPTY_TABLE/>" +
"</dataset>";
InputSource source = new InputSource(new StringReader(content));
! IDataSetProducer producer = new FlatXmlProducer(source, true);
producer.setConsumer(consumer);
--- 119,128 ----
String content =
"<?xml version=\"1.0\"?>" +
! "<!DOCTYPE dataset SYSTEM \"uri:/dummy.dtd\">" +
"<dataset>" +
"<EMPTY_TABLE/>" +
"</dataset>";
InputSource source = new InputSource(new StringReader(content));
! IDataSetProducer producer = new FlatXmlProducer(source, false);
producer.setConsumer(consumer);
|
|
From: <mla...@us...> - 2003-05-20 14:04:37
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement
In directory sc8-pr-cvs1:/tmp/cvs-serv14091/src/java/org/dbunit/database/statement
Modified Files:
SimplePreparedStatement.java SimpleStatement.java
Log Message:
Fixed bug "736439-Problems with InsertOperation".
Index: SimplePreparedStatement.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement/SimplePreparedStatement.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** SimplePreparedStatement.java 17 May 2003 15:38:52 -0000 1.10
--- SimplePreparedStatement.java 20 May 2003 14:04:33 -0000 1.11
***************
*** 64,68 ****
public void addBatch() throws SQLException
{
! _result += _statement.executeUpdate();
_index = 0;
// _statement.clearParameters();
--- 64,72 ----
public void addBatch() throws SQLException
{
! boolean result = _statement.execute();
! if (!result)
! {
! _result += _statement.getUpdateCount();
! }
_index = 0;
// _statement.clearParameters();
Index: SimpleStatement.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement/SimpleStatement.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SimpleStatement.java 13 Jun 2002 17:24:56 -0000 1.4
--- SimpleStatement.java 20 May 2003 14:04:33 -0000 1.5
***************
*** 52,56 ****
{
String sql = (String)_list.get(i);
! result += _statement.executeUpdate(sql);
}
return result;
--- 52,60 ----
{
String sql = (String)_list.get(i);
! boolean r = _statement.execute(sql);
! if(!r)
! {
! result += _statement.getUpdateCount();
! }
}
return result;
|