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-07-15 20:54:47
|
Update of /cvsroot/dbunit/dbunit
In directory sc8-pr-cvs1:/tmp/cvs-serv4548
Modified Files:
Tag: branch-1-5
build.properties
Log Message:
Update for 1.5.5 release.
Index: build.properties
===================================================================
RCS file: /cvsroot/dbunit/dbunit/build.properties,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -C2 -d -r1.8.2.1 -r1.8.2.2
*** build.properties 4 Apr 2003 13:14:26 -0000 1.8.2.1
--- build.properties 15 Jul 2003 20:54:43 -0000 1.8.2.2
***************
*** 1,3 ****
! version = 1.5.1
--- 1,3 ----
! version = 1.5.5
|
|
From: <mla...@us...> - 2003-07-15 16:47:04
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement
In directory sc8-pr-cvs1:/tmp/cvs-serv27134/src/java/org/dbunit/database/statement
Modified Files:
Tag: branch-1-5
AbstractStatementFactory.java
Log Message:
Do not enable batched statement by default anymore. Many JDBC drivers have problems with this feature.
Index: AbstractStatementFactory.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement/AbstractStatementFactory.java,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -C2 -d -r1.2 -r1.2.2.1
*** AbstractStatementFactory.java 13 Jun 2002 17:24:56 -0000 1.2
--- AbstractStatementFactory.java 15 Jul 2003 16:47:00 -0000 1.2.2.1
***************
*** 24,28 ****
throws SQLException
{
! if (System.getProperty(SUPPORT_BATCH_STATEMENT, "true").equals("true"))
{
return connection.getConnection().getMetaData().supportsBatchUpdates();
--- 24,28 ----
throws SQLException
{
! if (System.getProperty(SUPPORT_BATCH_STATEMENT, "false").equals("true"))
{
return connection.getConnection().getMetaData().supportsBatchUpdates();
|
|
From: <mla...@us...> - 2003-07-15 14:34:21
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml
In directory sc8-pr-cvs1:/tmp/cvs-serv3115/src/java/org/dbunit/dataset/xml
Modified Files:
Tag: branch-1-5
FlatXmlDataSet.java
Log Message:
Added new constructor that takes an URL (submitted by Dougall Squair).
Index: FlatXmlDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/FlatXmlDataSet.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
*** FlatXmlDataSet.java 16 Jun 2003 01:51:32 -0000 1.19.2.1
--- FlatXmlDataSet.java 15 Jul 2003 14:34:18 -0000 1.19.2.2
***************
*** 78,86 ****
throws IOException, DataSetException
{
try
{
! Reader reader = getReader(new FileInputStream(xmlFile));
! Document document = new Document(new FastBufferedReader(reader));
!
IDataSet metaDataSet = null;
--- 78,108 ----
throws IOException, DataSetException
{
+ this(xmlFile.toURL(), dtdMetadata);
+ }
+
+ /**
+ * Creates an FlatXmlDataSet object with the specifed xml URL.
+ * Relative DOCTYPE uri are resolved from the xml file path.
+ *
+ * @param xmlURL the xml URL
+ */
+ public FlatXmlDataSet(URL xmlURL) throws IOException, DataSetException
+ {
+ this(xmlURL, true);
+ }
+
+ /**
+ * Creates an FlatXmlDataSet object with the specifed xml URL.
+ * Relative DOCTYPE uri are resolved from the xml file path.
+ *
+ * @param xmlURL the xml URL
+ * @param dtdMetadata if <code>false</code> do not use DTD as metadata
+ */
+ public FlatXmlDataSet(URL xmlURL, boolean dtdMetadata)
+ throws IOException, DataSetException
+ {
try
{
! Document document = new Document(new BufferedReader(new InputStreamReader(xmlURL.openStream())));
IDataSet metaDataSet = null;
***************
*** 89,100 ****
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);
}
--- 111,118 ----
if (dtdMetadata && dtdUri != null)
{
! URL dtdFileURL = new URL(xmlURL, dtdUri);
! // System.out.println("The DTD URL is : " + dtdFileURL);
! metaDataSet = new FlatDtdDataSet(new InputStreamReader(dtdFileURL.openStream()));
}
_tables = getTables(document, metaDataSet);
}
|
|
From: <mla...@us...> - 2003-06-19 03:17:26
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml
In directory sc8-pr-cvs1:/tmp/cvs-serv26612/src/java/org/dbunit/dataset/xml
Modified Files:
FlatDtdDataSet.java FlatXmlDataSet.java XmlDataSet.java
Added Files:
FlatDtdProducer.java FlatDtdWriter.java FlatXmlProducer.java
FlatXmlWriter.java XmlDataSetWriter.java XmlProducer.java
dataset.dtd
Removed Files:
FlatXmlTable.java XmlTable.java
Log Message:
Merge from "branch-exml2sax" to Main trunk. This completes the 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: FlatDtdDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/FlatDtdDataSet.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** FlatDtdDataSet.java 9 Apr 2003 22:52:10 -0000 1.7
--- FlatDtdDataSet.java 19 Jun 2003 03:17:16 -0000 1.8
***************
*** 12,29 ****
import org.dbunit.dataset.*;
- import org.dbunit.dataset.datatype.DataType;
! import com.wutka.dtd.DTD;
! import com.wutka.dtd.DTDAttlist;
! import com.wutka.dtd.DTDAttribute;
! import com.wutka.dtd.DTDContainer;
! import com.wutka.dtd.DTDDecl;
! import com.wutka.dtd.DTDItem;
! import com.wutka.dtd.DTDName;
! import com.wutka.dtd.DTDParser;
import java.io.IOException;
import java.io.InputStream;
- import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
--- 12,20 ----
import org.dbunit.dataset.*;
! import org.xml.sax.InputSource;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
***************
*** 36,40 ****
import java.util.List;
import java.util.Map;
- import java.util.Vector;
/**
--- 27,30 ----
***************
*** 42,85 ****
* @version $Revision$
*/
! public class FlatDtdDataSet extends AbstractDataSet
{
private static final List EMPTY_LIST = Arrays.asList(new Object[0]);
private final List _tableNames = new ArrayList();
private final Map _tableMap = new HashMap();
! /**
! * @deprecated Use Reader overload instead
! */
! public FlatDtdDataSet(InputStream in) throws IOException
{
- this(new InputStreamReader(in));
}
! public FlatDtdDataSet(Reader in) throws IOException
{
! DTDParser dtdParser = new DTDParser(in);
! DTD dtd = dtdParser.parse(true);
!
! // table names
! DTDContainer contents = (DTDContainer)dtd.rootElement.getContent();
! DTDItem[] items = contents.getItems();
! for (int i = 0; i < items.length; i++)
! {
! DTDName tableName = (DTDName)items[i];
! _tableNames.add(tableName.getValue());
! }
! // table metadata
! Vector attrLists = dtd.getItemsByType(DTDAttlist.class);
! for (int i = 0; i < attrLists.size(); i++)
! {
! DTDAttlist attrList = (DTDAttlist)attrLists.elementAt(i);
! if (_tableNames.contains(attrList.getName()))
! {
! _tableMap.put(attrList.getName(), new DefaultTable(
! createTableMetaData(attrList), EMPTY_LIST));
! }
! }
}
--- 32,61 ----
* @version $Revision$
*/
! public class FlatDtdDataSet extends AbstractDataSet implements IDataSetConsumer
{
private static final List EMPTY_LIST = Arrays.asList(new Object[0]);
+
private final List _tableNames = new ArrayList();
private final Map _tableMap = new HashMap();
+ private boolean _ready = false;
! public FlatDtdDataSet()
{
}
! public FlatDtdDataSet(InputStream in) throws DataSetException, IOException
{
! this(new FlatDtdProducer(new InputSource(in)));
! }
! public FlatDtdDataSet(Reader reader) throws DataSetException, IOException
! {
! this(new FlatDtdProducer(new InputSource(reader)));
! }
! public FlatDtdDataSet(IDataSetProducer producer) throws DataSetException
! {
! producer.setConsumer(this);
! producer.produce();
}
***************
*** 99,168 ****
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();
! }
!
! private ITableMetaData createTableMetaData(DTDAttlist attrList)
! {
! DTDAttribute[] attributes = attrList.getAttribute();
! Column[] columns = new Column[attributes.length];
! for (int i = 0; i < attributes.length; i++)
! {
! DTDAttribute attribute = attributes[i];
! Column.Nullable nullable = (attribute.getDecl() == DTDDecl.REQUIRED) ?
! Column.NO_NULLS : Column.NULLABLE;
! columns[i] = new Column(attribute.getName(), DataType.UNKNOWN,
! nullable);
! }
!
! return new DefaultTableMetaData(attrList.getName(), columns);
}
--- 75,80 ----
throws IOException, DataSetException
{
! FlatDtdWriter datasetWriter = new FlatDtdWriter(out);
! datasetWriter.write(dataSet);
}
***************
*** 173,176 ****
--- 85,94 ----
throws DataSetException
{
+ // Verify producer notifications completed
+ if (!_ready)
+ {
+ throw new IllegalStateException("Not ready!");
+ }
+
String[] names = (String[])_tableNames.toArray(new String[0]);
ITable[] tables = new ITable[names.length];
***************
*** 195,204 ****
public String[] getTableNames() throws DataSetException
{
return (String[])_tableNames.toArray(new String[0]);
}
- }
--- 113,188 ----
public String[] getTableNames() throws DataSetException
{
+ // Verify producer notifications completed
+ if (!_ready)
+ {
+ throw new IllegalStateException("Not ready!");
+ }
+
return (String[])_tableNames.toArray(new String[0]);
}
+ public ITableMetaData getTableMetaData(String tableName) throws DataSetException
+ {
+ // Verify producer notifications completed
+ if (!_ready)
+ {
+ throw new IllegalStateException("Not ready!");
+ }
+ String upperTableName = tableName.toUpperCase();
+ if (_tableMap.containsKey(upperTableName))
+ {
+ ITable table = (ITable)_tableMap.get(upperTableName);
+ return table.getTableMetaData();
+ }
+ throw new NoSuchTableException(tableName);
+ }
+ public ITable getTable(String tableName) throws DataSetException
+ {
+ // Verify producer notifications completed
+ if (!_ready)
+ {
+ throw new IllegalStateException("Not ready!");
+ }
+ String upperTableName = tableName.toUpperCase();
+ if (_tableMap.containsKey(upperTableName))
+ {
+ return (ITable)_tableMap.get(upperTableName);
+ }
+
+ throw new NoSuchTableException(tableName);
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ // IDataSetConsumer interface
+
+ public void startDataSet() throws DataSetException
+ {
+ _ready = false;
+ }
+
+ public void endDataSet() throws DataSetException
+ {
+ _ready = true;
+ }
+
+ public void startTable(ITableMetaData metaData) throws DataSetException
+ {
+ String tableName = metaData.getTableName();
+ _tableNames.add(tableName);
+ _tableMap.put(tableName.toUpperCase(), new DefaultTable(metaData, EMPTY_LIST));
+ }
+
+ public void endTable() throws DataSetException
+ {
+ // no op
+ }
+
+ public void row(Object[] values) throws DataSetException
+ {
+ // 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.22
diff -C2 -d -r1.21 -r1.22
*** FlatXmlDataSet.java 9 Apr 2003 22:52:10 -0000 1.21
--- FlatXmlDataSet.java 19 Jun 2003 03:17:16 -0000 1.22
***************
*** 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: XmlDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/XmlDataSet.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** XmlDataSet.java 9 Apr 2003 22:52:11 -0000 1.16
--- XmlDataSet.java 19 Jun 2003 03:17:16 -0000 1.17
***************
*** 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
--- FlatXmlTable.java DELETED ---
--- XmlTable.java DELETED ---
|
|
From: <mla...@us...> - 2003-06-19 03:17:26
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv26612/src/java/org/dbunit/dataset Modified Files: CachedTable.java Column.java Added Files: CachedDataSet.java DataSetProducerAdapter.java DefaultConsumer.java IDataSetConsumer.java IDataSetProducer.java StreamingDataSet.java StreamingIterator.java Log Message: Merge from "branch-exml2sax" to Main trunk. This completes the 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: CachedTable.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/CachedTable.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CachedTable.java 13 Apr 2003 02:40:10 -0000 1.1 --- CachedTable.java 19 Jun 2003 03:17:16 -0000 1.2 *************** *** 1,2 **** --- 1,22 ---- + /* + * + * 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; *************** *** 5,12 **** /** ! * ! * <p> Copyright (c) 2002 OZ.COM. All Rights Reserved. </p> ! * @author manuel.laflamme$ ! * @since Apr 10, 2003$ */ public class CachedTable extends DefaultTable --- 25,31 ---- /** ! * @author Manuel Laflamme ! * @since Apr 10, 2003 ! * @version $Revision$ */ public class CachedTable extends DefaultTable *************** *** 28,41 **** { Column[] columns = table.getTableMetaData().getColumns(); ! ! for (int i = 0; ; i++) { ! Object[] rowValues = new Object[columns.length]; ! for (int j = 0; j < columns.length; j++) { ! Column column = columns[j]; ! rowValues[j] = table.getValue(i, column.getColumnName()); } - rowList.add(rowValues); } } --- 47,62 ---- { Column[] columns = table.getTableMetaData().getColumns(); ! if (columns.length > 0) { ! for (int i = 0; ; i++) { ! Object[] rowValues = new Object[columns.length]; ! for (int j = 0; j < columns.length; j++) ! { ! Column column = columns[j]; ! rowValues[j] = table.getValue(i, column.getColumnName()); ! } ! rowList.add(rowValues); } } } Index: Column.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/Column.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Column.java 13 Jun 2002 17:24:56 -0000 1.10 --- Column.java 19 Jun 2003 03:17:16 -0000 1.11 *************** *** 150,153 **** --- 150,163 ---- } + /** + * Returns the appropriate Nullable constant. + * + * @param nullable <code>true</code> if null is allowed + */ + public static Nullable nullableValue(boolean nullable) + { + return nullable ? NULLABLE : NO_NULLS; + } + //////////////////////////////////////////////////////////////////////////// // Object class *************** *** 157,160 **** --- 167,195 ---- return "(" + _columnName + ", " + _dataType + ", " + _nullable + ")"; // return _columnName; + } + + public boolean equals(Object o) + { + if (this == o) return true; + if (!(o instanceof Column)) return false; + + final Column column = (Column)o; + + if (!_columnName.equals(column._columnName)) return false; + if (!_dataType.equals(column._dataType)) return false; + if (!_nullable.equals(column._nullable)) return false; + if (!_sqlTypeName.equals(column._sqlTypeName)) return false; + + return true; + } + + public int hashCode() + { + int result; + result = _columnName.hashCode(); + result = 29 * result + _dataType.hashCode(); + result = 29 * result + _sqlTypeName.hashCode(); + result = 29 * result + _nullable.hashCode(); + return result; } |
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml
In directory sc8-pr-cvs1:/tmp/cvs-serv26612/src/test/org/dbunit/dataset/xml
Modified Files:
AllTests.java FlatDtdDataSetTest.java FlatXmlDataSetTest.java
Added Files:
FlatDtdProducerTest.java FlatXmlProducerTest.java
XmlProducerTest.java
Log Message:
Merge from "branch-exml2sax" to Main trunk. This completes the 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: AllTests.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml/AllTests.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** AllTests.java 13 Apr 2003 02:40:11 -0000 1.6
--- AllTests.java 19 Jun 2003 03:17:17 -0000 1.7
***************
*** 36,40 ****
--- 36,42 ----
TestSuite suite = new TestSuite();
suite.addTest(new TestSuite(FlatDtdDataSetTest.class));
+ suite.addTest(new TestSuite(FlatDtdProducerTest.class));
suite.addTest(new TestSuite(FlatXmlDataSetTest.class));
+ suite.addTest(new TestSuite(FlatXmlProducerTest.class));
suite.addTest(new TestSuite(FlatXmlTableTest.class));
suite.addTest(new TestSuite(FlatXmlTableWriteTest.class));
Index: FlatDtdDataSetTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml/FlatDtdDataSetTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** FlatDtdDataSetTest.java 9 Apr 2003 22:52:16 -0000 1.9
--- FlatDtdDataSetTest.java 19 Jun 2003 03:17:17 -0000 1.10
***************
*** 12,22 ****
import org.dbunit.DatabaseEnvironment;
- import org.dbunit.util.FileAsserts;
import org.dbunit.database.IDatabaseConnection;
import org.dbunit.dataset.AbstractDataSetTest;
import org.dbunit.dataset.FilteredDataSet;
import org.dbunit.dataset.IDataSet;
! import java.io.*;
/**
--- 12,28 ----
import org.dbunit.DatabaseEnvironment;
import org.dbunit.database.IDatabaseConnection;
import org.dbunit.dataset.AbstractDataSetTest;
import org.dbunit.dataset.FilteredDataSet;
import org.dbunit.dataset.IDataSet;
+ import org.dbunit.dataset.ITable;
+ import org.dbunit.dataset.ITableMetaData;
+ import org.dbunit.util.FileAsserts;
! import java.io.BufferedReader;
! import java.io.File;
! import java.io.FileReader;
! import java.io.FileWriter;
! import java.io.Writer;
/**
***************
*** 56,59 ****
--- 62,85 ----
////////////////////////////////////////////////////////////////////////////
// Test methods
+
+ public void testGetDuplicateTable() throws Exception
+ {
+ String expectedTableName = getDuplicateTableName();
+
+ IDataSet dataSet = createDuplicateDataSet();
+ ITable table = dataSet.getTable(expectedTableName);
+ String actualTableName = table.getTableMetaData().getTableName();
+ assertEquals("table name", expectedTableName, actualTableName);
+ }
+
+ public void testGetDuplicateTableMetaData() throws Exception
+ {
+ String expectedTableName = getDuplicateTableName();
+
+ IDataSet dataSet = createDuplicateDataSet();
+ ITableMetaData metaData = dataSet.getTableMetaData(expectedTableName);
+ String actualTableName = metaData.getTableName();
+ assertEquals("table name", expectedTableName, actualTableName);
+ }
public void testWriteFromDtd() throws Exception
Index: FlatXmlDataSetTest.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml/FlatXmlDataSetTest.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** FlatXmlDataSetTest.java 9 Apr 2003 22:52:17 -0000 1.14
--- FlatXmlDataSetTest.java 19 Jun 2003 03:17:17 -0000 1.15
***************
*** 41,44 ****
--- 41,49 ----
public class FlatXmlDataSetTest extends AbstractDataSetTest
{
+ protected static final File DATASET_FILE =
+ new File("src/xml/flatXmlDataSetTest.xml");
+ protected static final File DUPLICATE_DATASET_FILE =
+ new File("src/xml/flatXmlDataSetDuplicateTest.xml");
+
public FlatXmlDataSetTest(String s)
{
***************
*** 48,52 ****
protected IDataSet createDataSet() throws Exception
{
! return new FlatXmlDataSet(new File("src/xml/flatXmlDataSetTest.xml"));
}
--- 53,57 ----
protected IDataSet createDataSet() throws Exception
{
! return new FlatXmlDataSet(DATASET_FILE);
}
***************
*** 54,58 ****
{
return new FlatXmlDataSet(
! new File("src/xml/flatXmlDataSetDuplicateTest.xml"));
}
--- 59,63 ----
{
return new FlatXmlDataSet(
! DUPLICATE_DATASET_FILE);
}
|
|
From: <mla...@us...> - 2003-06-19 03:17:26
|
Update of /cvsroot/dbunit/dbunit/src/xml In directory sc8-pr-cvs1:/tmp/cvs-serv26612/src/xml Modified Files: sortedTableTest.xml xmlTableTest.xml Added Files: flatXmlProducerTest.xml xmlProducerTest.xml Log Message: Merge from "branch-exml2sax" to Main trunk. This completes the 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.2 diff -C2 -d -r1.1 -r1.2 *** sortedTableTest.xml 20 Feb 2003 03:55:15 -0000 1.1 --- sortedTableTest.xml 19 Jun 2003 03:17:17 -0000 1.2 *************** *** 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.6 diff -C2 -d -r1.5 -r1.6 *** xmlTableTest.xml 27 Mar 2002 13:17:14 -0000 1.5 --- xmlTableTest.xml 19 Jun 2003 03:17:17 -0000 1.6 *************** *** 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-19 03:17:26
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset
In directory sc8-pr-cvs1:/tmp/cvs-serv26612/src/test/org/dbunit/dataset
Modified Files:
AllTests.java
Added Files:
AbstractProducerTest.java CachedDataSetTest.java
DataSetProducerAdapterTest.java MockDataSetConsumer.java
MockDataSetProducer.java StreamingDataSetTest.java
StreamingTableTest.java
Log Message:
Merge from "branch-exml2sax" to Main trunk. This completes the 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: AllTests.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/AllTests.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** AllTests.java 13 Apr 2003 02:40:11 -0000 1.18
--- AllTests.java 19 Jun 2003 03:17:17 -0000 1.19
***************
*** 44,47 ****
--- 44,48 ----
suite.addTest(new TestSuite(CompositeDataSetTest.class));
suite.addTest(new TestSuite(CompositeTableTest.class));
+ suite.addTest(new TestSuite(DataSetProducerAdapterTest.class));
suite.addTest(new TestSuite(DataSetUtilsTest.class));
suite.addTest(new TestSuite(DefaultDataSetTest.class));
***************
*** 59,62 ****
--- 60,65 ----
suite.addTest(new TestSuite(SortedDataSetTest.class));
suite.addTest(new TestSuite(SortedTableTest.class));
+ suite.addTest(new TestSuite(StreamingDataSetTest.class));
+ suite.addTest(new TestSuite(StreamingTableTest.class));
return suite;
|
|
From: <mla...@us...> - 2003-06-19 03:17:26
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/util/xml In directory sc8-pr-cvs1:/tmp/cvs-serv26612/src/java/org/dbunit/util/xml Added Files: XmlWriter.java Log Message: Merge from "branch-exml2sax" to Main trunk. This completes the 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. |
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/util/concurrent In directory sc8-pr-cvs1:/tmp/cvs-serv26612/src/java/org/dbunit/util/concurrent Added Files: BoundedBuffer.java BoundedChannel.java BoundedLinkedQueue.java Channel.java DefaultChannelCapacity.java Executor.java LinkedNode.java LinkedQueue.java PropertyChangeMulticaster.java Puttable.java Semaphore.java SemaphoreControlledChannel.java Slot.java Sync.java SynchronizedInt.java SynchronizedVariable.java SynchronousChannel.java Takable.java TimeoutException.java Log Message: Merge from "branch-exml2sax" to Main trunk. This completes the 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. |
|
From: <mla...@us...> - 2003-06-19 03:17:24
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv26612/src/test/org/dbunit Modified Files: Main.java Log Message: Merge from "branch-exml2sax" to Main trunk. This completes the 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 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Main.java 13 Apr 2003 02:40:10 -0000 1.30 --- Main.java 19 Jun 2003 03:17:16 -0000 1.31 *************** *** 24,35 **** 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.excel.XlsDataSet; ! import org.dbunit.dataset.DataSetException; ! import org.dbunit.dataset.ITableIterator; ! import electric.xml.Document; import java.io.*; --- 24,40 ---- 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.dbunit.dataset.xml.FlatXmlWriter; ! import org.xml.sax.InputSource; import java.io.*; *************** *** 47,57 **** // System.setProperty("dbunit.qualified.table.names", "true"); IDatabaseConnection connection = DatabaseEnvironment.getInstance().getConnection(); ! ITableIterator iterator = connection.createDataSet().iterator(); ! while(iterator.next()) ! { ! System.out.println(iterator.getTableMetaData().getTableName()); ! } // oldMain(); // testWrite(); --- 52,95 ---- // System.setProperty("dbunit.qualified.table.names", "true"); + // testFlatXmlWriter(); + testXmlWriter(); + + /* IDatabaseConnection connection = 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); ! // new FlatXmlWriter().write(connection.createDataSet(), writer); ! // writer.close(); ! // ITableIterator iterator = connection.createDataSet().iterator(); ! // while(iterator.next()) ! // { ! // System.out.println(iterator.getTableMetaData().getTableName()); ! // } // oldMain(); // testWrite(); *************** *** 64,75 **** } ! 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 --- 102,139 ---- } ! 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(); + // document.write(out); + // out.flush(); + // } private static void oldMain() throws Exception |
|
From: <mla...@us...> - 2003-06-19 03:17:24
|
Update of /cvsroot/dbunit/dbunit/src/dtd In directory sc8-pr-cvs1:/tmp/cvs-serv26612/src/dtd Added Files: flatDtdProducerTest.dtd Removed Files: dataset.dtd Log Message: Merge from "branch-exml2sax" to Main trunk. This completes the 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. --- dataset.dtd DELETED --- |
|
From: <mla...@us...> - 2003-06-19 03:17:19
|
Update of /cvsroot/dbunit/dbunit
In directory sc8-pr-cvs1:/tmp/cvs-serv26612
Modified Files:
build.xml dbunit.ipr dbunit.iws
Removed Files:
electricxml-license.txt
Log Message:
Merge from "branch-exml2sax" to Main trunk. This completes the 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: build.xml
===================================================================
RCS file: /cvsroot/dbunit/dbunit/build.xml,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** build.xml 24 Feb 2003 01:43:39 -0000 1.7
--- build.xml 19 Jun 2003 03:17:16 -0000 1.8
***************
*** 35,43 ****
--- 35,56 ----
<mkdir dir="${build.dir}"/>
</target>
+
<target name="clean" depends="init">
<delete dir="${build.dir}"/>
</target>
+
<target name="compile" depends="init">
+
<mkdir dir="${java.classes.dir}"/>
+
+ <!-- Copy resource files -->
+ <copy todir="${java.classes.dir}" includeEmptyDirs="no">
+ <fileset dir="${java.src.dir}">
+ <!-- <include name="**/*.xml"/> -->
+ <exclude name="**/*.java"/>
+ </fileset>
+ </copy>
+
+ <!-- Compile src -->
<javac srcdir="${java.src.dir}" destdir="${java.classes.dir}" debug="${debug}" >
<classpath>
***************
*** 104,107 ****
--- 117,126 ----
</copy>
+ <!-- Copy XML dataset DTD from src to root dist dir -->
+ <copy tofile="${dist.dir}/dataset.dtd" includeEmptyDirs="no">
+ <fileset dir="${src.dir}">
+ <include name="**/dataset.dtd"/>
+ </fileset>
+ </copy>
<!-- Copy html doc -->
Index: dbunit.ipr
===================================================================
RCS file: /cvsroot/dbunit/dbunit/dbunit.ipr,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -d -r1.55 -r1.56
*** dbunit.ipr 13 Apr 2003 02:43:23 -0000 1.55
--- dbunit.ipr 19 Jun 2003 03:17:16 -0000 1.56
***************
*** 22,32 ****
<root type="jdk" rootType="classPath" name="java version "1.3.1_07"" />
<root type="output" />
- <root type="simple" url="jar://$PROJECT_DIR$/lib/dtdparser.jar!/" />
- <root type="simple" url="jar://$PROJECT_DIR$/lib/exml.jar!/" />
<root type="simple" url="jar://$PROJECT_DIR$/lib/junit.jar!/" />
<root type="simple" url="jar://$PROJECT_DIR$/lib/j2ee.jar!/" />
<root type="simple" url="jar://$PROJECT_DIR$/lib/ant.jar!/" />
<root type="simple" url="jar://$PROJECT_DIR$/lib/crimson.jar!/" />
- <root type="simple" url="jar://$PROJECT_DIR$/lib/jaxp.jar!/" />
<root type="simple" url="jar://$PROJECT_DIR$/lib/hsqldb.jar!/" />
<root type="simple" url="jar://$PROJECT_DIR$/lib/mysql-connector-java-3.0.6-stable-bin.jar!/" />
--- 22,29 ----
***************
*** 146,150 ****
<option name="OUTPUT_DIRECTORY" />
</component>
- <component name="WebReferencesManager" />
</project>
--- 143,146 ----
Index: dbunit.iws
===================================================================
RCS file: /cvsroot/dbunit/dbunit/dbunit.iws,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** dbunit.iws 13 Mar 2003 02:24:12 -0000 1.7
--- dbunit.iws 19 Jun 2003 03:17:16 -0000 1.8
***************
*** 1,52 ****
<?xml version="1.0" encoding="UTF-8"?>
<project version="3" relativePaths="true">
- <component name="WebReferencesConfigurable">
- <property name="CUSTOM_MAP_LOOKUP" type="list" />
- <property name="INTERFACE_POSTFIX" value="" type="string" />
- <property name="electric.home" value="/electric" type="string" />
- <property name="INTERFACE_PREFIX" value="I" type="string" />
- <property name="INCLUDE_SYSTEM_MAP" value="true" type="boolean" />
- <property name="THROW_EXCEPTIONS" value="false" type="boolean" />
- <property name="ENABLED" value="false" type="boolean" />
- </component>
<component name="FileEditorManager">
<history>
- <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/datatype/BytesDataTypeTest.java" line="31" column="13" vertical-scroll-proportion="-0.30497926" horizontal-scroll-proportion="0.15853658" />
- <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/datatype/AbstractDataTypeTest.java" line="30" column="22" vertical-scroll-proportion="0.3188119" horizontal-scroll-proportion="0.2682927" />
- <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/filter/SequenceTableFilterTest.java" line="57" column="16" vertical-scroll-proportion="2.023622" horizontal-scroll-proportion="0.19512194" />
- <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/filter/AbstractTableFilterTest.java" line="53" column="15" vertical-scroll-proportion="1.2992126" horizontal-scroll-proportion="0.18292683" />
- <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/FilteredDataSet.java" line="74" column="0" vertical-scroll-proportion="0.2874016" horizontal-scroll-proportion="0.0" />
- <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/AbstractDataSetTest.java" line="296" column="0" vertical-scroll-proportion="0.27559054" horizontal-scroll-proportion="0.0" />
<source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/FilteredDataSetTest.java" line="151" column="0" vertical-scroll-proportion="0.63529414" horizontal-scroll-proportion="0.0" />
! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/filter/ExcludeTableFilter.java" line="47" column="0" vertical-scroll-proportion="0.4319066" horizontal-scroll-proportion="0.0" />
! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/filter/IncludeTableFilter.java" line="20" column="45" vertical-scroll-proportion="0.0" horizontal-scroll-proportion="0.50239235" />
! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/filter/SequenceTableFilter.java" line="120" column="0" vertical-scroll-proportion="1.0875486" horizontal-scroll-proportion="0.0" />
! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/filter/AllTests.java" line="40" column="24" vertical-scroll-proportion="0.88521403" horizontal-scroll-proportion="0.26794258" />
! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/filter/IncludeTableFilterTest.java" line="27" column="13" vertical-scroll-proportion="0.22178988" horizontal-scroll-proportion="0.14513557" />
! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/xml/FlatDtdDataSet.java" line="25" column="13" vertical-scroll-proportion="0.3463035" horizontal-scroll-proportion="0.14513557" />
! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/Main.java" line="47" column="21" vertical-scroll-proportion="0.5642023" horizontal-scroll-proportion="0.23444976" />
! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/xml/FlatDtdDataSetTest.java" line="0" column="0" vertical-scroll-proportion="0.0" horizontal-scroll-proportion="0.0">
<folding>
<element signature="imports" expanded="true" />
</folding>
</source-position-entry>
! </history>
! <open-files>
! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/filter/IncludeTableFilter.java" line="20" column="45" vertical-scroll-proportion="0.0" horizontal-scroll-proportion="0.50239235" />
! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/filter/SequenceTableFilter.java" line="120" column="0" vertical-scroll-proportion="1.0875486" horizontal-scroll-proportion="0.0" />
! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/filter/IncludeTableFilterTest.java" line="27" column="13" vertical-scroll-proportion="0.22178988" horizontal-scroll-proportion="0.14513557" />
! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/xml/FlatDtdDataSet.java" line="25" column="13" vertical-scroll-proportion="0.3463035" horizontal-scroll-proportion="0.14513557" />
! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/xml/FlatDtdDataSetTest.java" line="0" column="0" vertical-scroll-proportion="0.0" horizontal-scroll-proportion="0.0" selected="true">
<folding>
<element signature="imports" expanded="true" />
</folding>
</source-position-entry>
! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/Main.java" line="47" column="21" vertical-scroll-proportion="0.5642023" horizontal-scroll-proportion="0.23444976" />
! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/filter/AllTests.java" line="40" column="24" vertical-scroll-proportion="0.88521403" horizontal-scroll-proportion="0.26794258" />
! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/filter/ExcludeTableFilter.java" line="47" column="0" vertical-scroll-proportion="0.4319066" horizontal-scroll-proportion="0.0" />
! </open-files>
</component>
<component name="ToolWindowManager">
! <frame x="0" y="0" width="1024" height="738" extended-state="0" />
<editor active="true" />
<layout>
--- 1,38 ----
<?xml version="1.0" encoding="UTF-8"?>
<project version="3" relativePaths="true">
<component name="FileEditorManager">
<history>
<source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/FilteredDataSetTest.java" line="151" column="0" vertical-scroll-proportion="0.63529414" horizontal-scroll-proportion="0.0" />
! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/filter/ExcludeTableFilter.java" line="47" column="0" vertical-scroll-proportion="0.46692607" horizontal-scroll-proportion="0.0" />
! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/filter/IncludeTableFilter.java" line="20" column="45" vertical-scroll-proportion="0.0" horizontal-scroll-proportion="0.50159234" />
! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/filter/SequenceTableFilter.java" line="115" column="0" vertical-scroll-proportion="1.2159534" horizontal-scroll-proportion="0.0" />
! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/filter/AllTests.java" line="40" column="24" vertical-scroll-proportion="0.95525295" horizontal-scroll-proportion="0.26751593" />
! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/filter/IncludeTableFilterTest.java" line="27" column="13" vertical-scroll-proportion="0.24902724" horizontal-scroll-proportion="0.14490446">
<folding>
<element signature="imports" expanded="true" />
</folding>
</source-position-entry>
! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/xml/FlatDtdDataSet.java" line="25" column="13" vertical-scroll-proportion="0.38715953" horizontal-scroll-proportion="0.14490446">
<folding>
<element signature="imports" expanded="true" />
</folding>
</source-position-entry>
! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/xml/FlatDtdDataSetTest.java" line="0" column="0" vertical-scroll-proportion="0.0" horizontal-scroll-proportion="0.0">
! <folding>
! <element signature="imports" expanded="true" />
! </folding>
! </source-position-entry>
! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/xml/FlatDtdProducerTest.java" line="38" column="13" vertical-scroll-proportion="0.33268481" horizontal-scroll-proportion="0.14490446" />
! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/IDataSetProducer.java" line="32" column="22" vertical-scroll-proportion="0.33268481" horizontal-scroll-proportion="0.24522293" />
! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/IDataSetConsumer.java" line="32" column="21" vertical-scroll-proportion="0.33268481" horizontal-scroll-proportion="0.23407644" />
! <source-position-entry url="file://$PROJECT_DIR$/profile.properties" line="62" column="0" vertical-scroll-proportion="1.5433333" horizontal-scroll-proportion="0.0" />
! <source-position-entry url="file://$PROJECT_DIR$/build.properties" line="0" column="16" vertical-scroll-proportion="0.0" horizontal-scroll-proportion="0.17834395" />
! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/DefaultConsumer.java" line="30" column="13" vertical-scroll-proportion="0.56031126" horizontal-scroll-proportion="0.14490446" />
! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/Main.java" line="47" column="21" vertical-scroll-proportion="1.0447471" horizontal-scroll-proportion="0.23407644" />
! </history>
! <open-files />
</component>
<component name="ToolWindowManager">
! <frame x="0" y="0" width="1024" height="738" extended-state="1" />
<editor active="true" />
<layout>
***************
*** 56,60 ****
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="7" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="sliding" type="sliding" visible="false" weight="0.4" order="0" />
! <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.28381148" order="0" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.39967105" order="3" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1" />
--- 42,46 ----
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="7" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="sliding" type="sliding" visible="false" weight="0.4" order="0" />
! <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.28278688" order="0" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.39967105" order="3" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1" />
***************
*** 279,291 ****
</component>
<component name="ProjectViewSettings">
! <navigator currentView="SourcepathPane" flattenPackages="false" showMembers="false" showStructure="false" autoscrollToSource="false" splitterProportion="0.5" />
<view id="ProjectPane">
<expanded_node type="directory" url="file://$PROJECT_DIR$" />
</view>
<view id="SourcepathPane">
<expanded_node type="directory" url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset" />
<expanded_node type="directory" url="file://$PROJECT_DIR$/src/test/org/dbunit" />
- <expanded_node type="directory" url="file://$PROJECT_DIR$/src/test" />
<expanded_node type="directory" url="file://$PROJECT_DIR$/src/test/org" />
</view>
<view id="ClasspathPane" />
--- 265,282 ----
</component>
<component name="ProjectViewSettings">
! <navigator currentView="ProjectPane" flattenPackages="false" showMembers="false" showStructure="false" autoscrollToSource="false" splitterProportion="0.5" />
<view id="ProjectPane">
<expanded_node type="directory" url="file://$PROJECT_DIR$" />
</view>
<view id="SourcepathPane">
+ <expanded_node type="directory" url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset" />
+ <expanded_node type="directory" url="file://$PROJECT_DIR$/src/java/org/dbunit" />
+ <expanded_node type="directory" url="file://$PROJECT_DIR$/src/java/org" />
+ <expanded_node type="directory" url="file://$PROJECT_DIR$/src/java" />
<expanded_node type="directory" url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset" />
+ <expanded_node type="directory" url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/xml" />
<expanded_node type="directory" url="file://$PROJECT_DIR$/src/test/org/dbunit" />
<expanded_node type="directory" url="file://$PROJECT_DIR$/src/test/org" />
+ <expanded_node type="directory" url="file://$PROJECT_DIR$/src/test" />
</view>
<view id="ClasspathPane" />
***************
*** 294,298 ****
<option name="SHOW_SETTINGS_BEFORE_RUNNING" value="false" />
<option name="COMPILE_BEFORE_RUNNING" value="true" />
! <activeType name="Application" />
<configuration name="<template>" type="Application" default="true" selected="false">
<option name="MAIN_CLASS_NAME" />
--- 285,289 ----
<option name="SHOW_SETTINGS_BEFORE_RUNNING" value="false" />
<option name="COMPILE_BEFORE_RUNNING" value="true" />
! <activeType name="Remote" />
<configuration name="<template>" type="Application" default="true" selected="false">
<option name="MAIN_CLASS_NAME" />
***************
*** 356,494 ****
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
</configuration>
- <configuration name="SequenceTableFilterTest.testIsValidName" type="JUnit" default="false" selected="false">
- <option name="PACKAGE_NAME" />
- <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" />
- <option name="METHOD_NAME" value="testIsValidName" />
- <option name="TEST_OBJECT" value="method" />
- <option name="VM_PARAMETERS" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- </configuration>
- <configuration name="SequenceTableFilterTest.testIsCaseInsensitiveValidName" type="JUnit" default="false" selected="false">
- <option name="PACKAGE_NAME" />
- <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" />
- <option name="METHOD_NAME" value="testIsCaseInsensitiveValidName" />
- <option name="TEST_OBJECT" value="method" />
- <option name="VM_PARAMETERS" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- </configuration>
- <configuration name="SequenceTableFilterTest.testIsValidNameAndInvalid" type="JUnit" default="false" selected="false">
- <option name="PACKAGE_NAME" />
- <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" />
- <option name="METHOD_NAME" value="testIsValidNameAndInvalid" />
- <option name="TEST_OBJECT" value="method" />
- <option name="VM_PARAMETERS" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- </configuration>
- <configuration name="SequenceTableFilterTest.testGetTableNames" type="JUnit" default="false" selected="false">
- <option name="PACKAGE_NAME" />
- <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" />
- <option name="METHOD_NAME" value="testGetTableNames" />
- <option name="TEST_OBJECT" value="method" />
- <option name="VM_PARAMETERS" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- </configuration>
- <configuration name="SequenceTableFilterTest.testGetDuplicateTableNames" type="JUnit" default="false" selected="false">
- <option name="PACKAGE_NAME" />
- <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" />
- <option name="METHOD_NAME" value="testGetDuplicateTableNames" />
- <option name="TEST_OBJECT" value="method" />
- <option name="VM_PARAMETERS" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- </configuration>
- <configuration name="SequenceTableFilterTest.testGetCaseInsensitiveTableNames" type="JUnit" default="false" selected="false">
- <option name="PACKAGE_NAME" />
- <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" />
- <option name="METHOD_NAME" value="testGetCaseInsensitiveTableNames" />
- <option name="TEST_OBJECT" value="method" />
- <option name="VM_PARAMETERS" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- </configuration>
- <configuration name="SequenceTableFilterTest.testGetReverseTableNames" type="JUnit" default="false" selected="false">
- <option name="PACKAGE_NAME" />
- <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" />
- <option name="METHOD_NAME" value="testGetReverseTableNames" />
- <option name="TEST_OBJECT" value="method" />
- <option name="VM_PARAMETERS" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- </configuration>
- <configuration name="SequenceTableFilterTest.testGetTables" type="JUnit" default="false" selected="false">
- <option name="PACKAGE_NAME" />
- <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" />
- <option name="METHOD_NAME" value="testGetTables" />
- <option name="TEST_OBJECT" value="method" />
- <option name="VM_PARAMETERS" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- </configuration>
- <configuration name="SequenceTableFilterTest.testGetCaseInsensitiveTables" type="JUnit" default="false" selected="false">
- <option name="PACKAGE_NAME" />
- <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" />
- <option name="METHOD_NAME" value="testGetCaseInsensitiveTables" />
- <option name="TEST_OBJECT" value="method" />
- <option name="VM_PARAMETERS" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- </configuration>
- <configuration name="SequenceTableFilterTest.testGetReverseTables" type="JUnit" default="false" selected="false">
- <option name="PACKAGE_NAME" />
- <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" />
- <option name="METHOD_NAME" value="testGetReverseTables" />
- <option name="TEST_OBJECT" value="method" />
- <option name="VM_PARAMETERS" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- </configuration>
- <configuration name="SequenceTableFilterTest" type="JUnit" default="false" selected="false">
- <option name="PACKAGE_NAME" />
- <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" />
- <option name="METHOD_NAME" />
- <option name="TEST_OBJECT" value="class" />
- <option name="VM_PARAMETERS" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- </configuration>
- <configuration name="AllTests" type="JUnit" default="false" selected="false">
- <option name="PACKAGE_NAME" />
- <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.AllTests" />
- <option name="METHOD_NAME" />
- <option name="TEST_OBJECT" value="class" />
- <option name="VM_PARAMETERS" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- </configuration>
- <configuration name="SequenceTableFilterTest.testIsValidName2" type="JUnit" default="false" selected="false">
- <option name="PACKAGE_NAME" />
- <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" />
- <option name="METHOD_NAME" value="testIsValidName2" />
- <option name="TEST_OBJECT" value="method" />
- <option name="VM_PARAMETERS" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- </configuration>
- <configuration name="FlatDtdDataSetTest" type="JUnit" default="false" selected="false">
- <option name="PACKAGE_NAME" />
- <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.xml.FlatDtdDataSetTest" />
- <option name="METHOD_NAME" />
- <option name="TEST_OBJECT" value="class" />
- <option name="VM_PARAMETERS" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- </configuration>
- <configuration name="FlatDtdDataSetTest.testWriteFromDatabase" type="JUnit" default="false" selected="false">
- <option name="PACKAGE_NAME" />
- <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.xml.FlatDtdDataSetTest" />
- <option name="METHOD_NAME" value="testWriteFromDatabase" />
- <option name="TEST_OBJECT" value="method" />
- <option name="VM_PARAMETERS" />
- <option name="PARAMETERS" />
- <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
- </configuration>
</component>
<component name="BookmarkManager">
--- 347,350 ----
***************
*** 665,668 ****
--- 521,558 ----
<component name="VcsManagerConfiguration">
<option name="ACTIVE_VCS_NAME" value="" />
+ </component>
+ <component name="ideajad">
+ <property name="annotate" value="false" />
+ <property name="annotateFully" value="false" />
+ <property name="braces" value="false" />
+ <property name="clear" value="false" />
+ <property name="confirmNavigationTriggeredDecompile" value="false" />
+ <property name="dead" value="false" />
+ <property name="defaultInitializers" value="false" />
+ <property name="dissassemblerOnly" value="false" />
+ <property name="fieldsFirst" value="false" />
+ <property name="fileExtension" value="java" />
+ <property name="fullyQualifiedNames" value="false" />
+ <property name="indentation" value="4" />
+ <property name="intRadix" value="10" />
+ <property name="lineNumbersAsComments" value="false" />
+ <property name="longRadix" value="10" />
+ <property name="maxStringLength" value="64" />
+ <property name="nocast" value="false" />
+ <property name="noclass" value="false" />
+ <property name="nocode" value="false" />
+ <property name="noconv" value="false" />
+ <property name="noctor" value="false" />
+ <property name="nodos" value="false" />
+ <property name="nofd" value="false" />
+ <property name="noinner" value="false" />
+ <property name="nolvt" value="false" />
+ <property name="nonlb" value="true" />
+ <property name="outputDirectory" value="" />
+ <property name="readonly" value="false" />
+ <property name="safe" value="false" />
+ <property name="spaceAfterKeyword" value="false" />
+ <property name="splitStringsAtNewline" value="false" />
+ <property name="useTabs" value="false" />
</component>
<component name="StarteamConfiguration">
--- electricxml-license.txt DELETED ---
|
|
From: <mla...@us...> - 2003-06-19 03:17:19
|
Update of /cvsroot/dbunit/dbunit/lib In directory sc8-pr-cvs1:/tmp/cvs-serv26612/lib Modified Files: crimson.jar Removed Files: dtdparser.jar exml.jar jaxp.jar Log Message: Merge from "branch-exml2sax" to Main trunk. This completes the 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: crimson.jar =================================================================== RCS file: /cvsroot/dbunit/dbunit/lib/crimson.jar,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvsH58TSF and /tmp/cvscG3SNc differ --- dtdparser.jar DELETED --- --- exml.jar DELETED --- --- jaxp.jar DELETED --- |
|
From: <mla...@us...> - 2003-06-19 03:17:19
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement
In directory sc8-pr-cvs1:/tmp/cvs-serv26612/src/java/org/dbunit/database/statement
Modified Files:
PreparedStatementFactory.java
Added Files:
AutomaticPreparedBatchStatement.java
Log Message:
Merge from "branch-exml2sax" to Main trunk. This completes the 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: PreparedStatementFactory.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement/PreparedStatementFactory.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** PreparedStatementFactory.java 13 Jun 2002 17:24:56 -0000 1.5
--- PreparedStatementFactory.java 19 Jun 2003 03:17:16 -0000 1.6
***************
*** 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-18 01:27:18
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/util/xml
In directory sc8-pr-cvs1:/tmp/cvs-serv25004/src/java/org/dbunit/util/xml
Added Files:
Tag: branch-exml2sax
XmlWriter.java
Log Message:
Trying to rename XMLWriter to XmlWriter.
--- NEW FILE: XmlWriter.java ---
package org.dbunit.util.xml;
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Commons" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact ap...@ap....
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.Stack;
/**
* Makes writing XML much much easier.
* Improved from
* <a href="http://builder.com.com/article.jhtml?id=u00220020318yan01.htm&page=1&vf=tt">article</a>
*
* @author <a href="mailto:ba...@ap...">Henri Yandell</a>
* @author <a href="mailto:pe...@fi...">Peter Cassetta</a>
* @version 1.0
*/
public class XmlWriter
{
private Writer out; // underlying writer
private String encoding;
private Stack stack = new Stack(); // of xml element names
private StringBuffer attrs; // current attribute string
private boolean empty; // is the current node empty
private boolean closed = true; // is the current node closed...
private boolean pretty = true; // is pretty printing enabled?
private boolean wroteText = false; // was text the last thing output?
private String indent = " "; // output this to indent one level when pretty printing
private String newline = "\n"; // output this to end a line when pretty printing
/**
* Create an XmlWriter on top of an existing java.io.Writer.
*/
public XmlWriter(Writer writer)
{
this(writer, null);
}
/**
* Create an XmlWriter on top of an existing java.io.Writer.
*/
public XmlWriter(Writer writer, String encoding)
{
setWriter(writer, encoding);
}
/**
* Turn pretty printing on or off.
* Pretty printing is enabled by default, but it can be turned off
* to generate more compact XML.
*
* @param boolean true to enable, false to disable pretty printing.
*/
public void enablePrettyPrint(boolean enable)
{
this.pretty = enable;
}
/**
* Specify the string to prepend to a line for each level of indent.
* It is 2 spaces (" ") by default. Some may prefer a single tab ("\t")
* or a different number of spaces. Specifying an empty string will turn
* off indentation when pretty printing.
*
* @param String representing one level of indentation while pretty printing.
*/
public void setIndent(String indent)
{
this.indent = indent;
}
/**
* Specify the string used to terminate each line when pretty printing.
* It is a single newline ("\n") by default. Users who need to read
* generated XML documents in Windows editors like Notepad may wish to
* set this to a carriage return/newline sequence ("\r\n"). Specifying
* an empty string will turn off generation of line breaks when pretty
* printing.
*
* @param String representing the newline sequence when pretty printing.
*/
public void setNewline(String newline)
{
this.newline = newline;
}
/**
* A helper method. It writes out an element which contains only text.
*
* @param name String name of tag
* @param text String of text to go inside the tag
*/
public XmlWriter writeElementWithText(String name, String text) throws IOException
{
writeElement(name);
writeText(text);
return endElement();
}
/**
* A helper method. It writes out empty entities.
*
* @param name String name of tag
*/
public XmlWriter writeEmptyElement(String name) throws IOException
{
writeElement(name);
return endElement();
}
/**
* Begin to write out an element. Unlike the helper tags, this tag
* will need to be ended with the endElement method.
*
* @param name String name of tag
*/
public XmlWriter writeElement(String name) throws IOException
{
return openElement(name);
}
/**
* Begin to output an element.
*
* @param String name of element.
*/
private XmlWriter openElement(String name) throws IOException
{
boolean wasClosed = this.closed;
closeOpeningTag();
this.closed = false;
if (this.pretty)
{
// ! wasClosed separates adjacent opening tags by a newline.
// this.wroteText makes sure an element embedded within the text of
// its parent element begins on a new line, indented to the proper
// level. This solves only part of the problem of pretty printing
// entities which contain both text and child entities.
if (!wasClosed || this.wroteText)
{
this.out.write(newline);
}
for (int i = 0; i < this.stack.size(); i++)
{
this.out.write(indent); // Indent opening tag to proper level
}
}
this.out.write("<");
this.out.write(name);
stack.add(name);
this.empty = true;
this.wroteText = false;
return this;
}
// close off the opening tag
private void closeOpeningTag() throws IOException
{
if (!this.closed)
{
writeAttributes();
this.closed = true;
this.out.write(">");
}
}
// write out all current attributes
private void writeAttributes() throws IOException
{
if (this.attrs != null)
{
this.out.write(this.attrs.toString());
this.attrs.setLength(0);
this.empty = false;
}
}
/**
* Write an attribute out for the current element.
* Any xml characters in the value are escaped.
* Currently it does not actually throw the exception, but
* the api is set that way for future changes.
*
* @param String name of attribute.
* @param String value of attribute.
*/
public XmlWriter writeAttribute(String attr, String value) throws IOException
{
// maintain api
if (false) throw new IOException();
if (this.attrs == null)
{
this.attrs = new StringBuffer();
}
this.attrs.append(" ");
this.attrs.append(attr);
this.attrs.append("=\"");
this.attrs.append(escapeXml(value));
this.attrs.append("\"");
return this;
}
/**
* End the current element. This will throw an exception
* if it is called when there is not a currently open
* element.
*/
public XmlWriter endElement() throws IOException
{
if (this.stack.empty())
{
throw new IOException("Called endElement too many times. ");
}
String name = (String)this.stack.pop();
if (name != null)
{
if (this.empty)
{
writeAttributes();
this.out.write("/>");
}
else
{
if (this.pretty && !this.wroteText)
{
for (int i = 0; i < this.stack.size(); i++)
{
this.out.write(indent); // Indent closing tag to proper level
}
}
this.out.write("</");
this.out.write(name);
this.out.write(">");
}
if (this.pretty)
this.out.write(newline); // Add a newline after the closing tag
this.empty = false;
this.closed = true;
this.wroteText = false;
}
return this;
}
/**
* Close this writer. It does not close the underlying
* writer, but does throw an exception if there are
* as yet unclosed tags.
*/
public void close() throws IOException
{
this.out.flush();
if (!this.stack.empty())
{
throw new IOException("Tags are not all closed. " +
"Possibly, " + this.stack.pop() + " is unclosed. ");
}
}
/**
* Output body text. Any xml characters are escaped.
*/
public XmlWriter writeText(String text) throws IOException
{
closeOpeningTag();
this.empty = false;
this.wroteText = true;
this.out.write(escapeXml(text));
return this;
}
/**
* Write out a chunk of CDATA. This helper method surrounds the
* passed in data with the CDATA tag.
*
* @param String of CDATA text.
*/
public XmlWriter writeCData(String cdata) throws IOException
{
closeOpeningTag();
this.empty = false;
this.wroteText = true;
this.out.write("<![CDATA[");
this.out.write(cdata);
this.out.write("]]>");
return this;
}
/**
* Write out a chunk of comment. This helper method surrounds the
* passed in data with the xml comment tag.
*
* @param String of text to comment.
*/
public XmlWriter writeComment(String comment) throws IOException
{
writeChunk("<!-- " + comment + " -->");
return this;
}
private void writeChunk(String data) throws IOException
{
closeOpeningTag();
this.empty = false;
if (this.pretty && !this.wroteText)
{
for (int i = 0; i < this.stack.size(); i++)
{
this.out.write(indent);
}
}
this.out.write(data);
if (this.pretty)
{
this.out.write(newline);
}
}
// Two example methods. They should output the same XML:
// <person name="fred" age="12"><phone>425343</phone><bob/></person>
static public void main(String[] args) throws IOException
{
test1();
test2();
}
static public void test1() throws IOException
{
Writer writer = new java.io.StringWriter();
XmlWriter xmlwriter = new XmlWriter(writer);
xmlwriter.writeElement("person").writeAttribute("name", "fred").writeAttribute("age", "12").writeElement("phone").writeText("4254343").endElement().writeElement("friends").writeElement("bob").endElement().writeElement("jim").endElement().endElement().endElement();
xmlwriter.close();
System.err.println(writer.toString());
}
static public void test2() throws IOException
{
Writer writer = new java.io.StringWriter();
XmlWriter xmlwriter = new XmlWriter(writer);
xmlwriter.writeComment("Example of XmlWriter running");
xmlwriter.writeElement("person");
xmlwriter.writeAttribute("name", "fred");
xmlwriter.writeAttribute("age", "12");
xmlwriter.writeElement("phone");
xmlwriter.writeText("4254343");
xmlwriter.endElement();
xmlwriter.writeComment("Examples of empty tags");
// xmlwriter.setDefaultNamespace("test");
xmlwriter.writeElement("friends");
xmlwriter.writeEmptyElement("bob");
xmlwriter.writeEmptyElement("jim");
xmlwriter.endElement();
xmlwriter.writeElementWithText("foo", "This is an example.");
xmlwriter.endElement();
xmlwriter.close();
System.err.println(writer.toString());
}
////////////////////////////////////////////////////////////////////////////
// Added by Manu for DbUnit
private String escapeXml(String str)
{
str = replace(str, "&", "&");
str = replace(str, "<", "<");
str = replace(str, ">", ">");
str = replace(str, "\"", """);
str = replace(str, "'", "'");
return str;
}
private String replace(String value, String original, String replacement)
{
StringBuffer buffer = null;
int startIndex = 0;
int lastEndIndex = 0;
for (; ;)
{
startIndex = value.indexOf(original, lastEndIndex);
if (startIndex == -1)
{
if (buffer != null)
{
buffer.append(value.substring(lastEndIndex));
}
break;
}
if (buffer == null)
{
buffer = new StringBuffer((int)(original.length() * 1.5));
}
buffer.append(value.substring(lastEndIndex, startIndex));
buffer.append(replacement);
lastEndIndex = startIndex + original.length();
}
return buffer == null ? value : buffer.toString();
}
private void setEncoding(String encoding)
{
if (encoding == null && out instanceof OutputStreamWriter)
encoding = ((OutputStreamWriter)out).getEncoding();
if (encoding != null)
{
encoding = encoding.toUpperCase();
// Use official encoding names where we know them,
// avoiding the Java-only names. When using common
// encodings where we can easily tell if characters
// are out of range, we'll escape out-of-range
// characters using character refs for safety.
// I _think_ these are all the main synonyms for these!
if ("UTF8".equals(encoding))
{
encoding = "UTF-8";
}
else if ("US-ASCII".equals(encoding)
|| "ASCII".equals(encoding))
{
// dangerMask = (short)0xff80;
encoding = "US-ASCII";
}
else if ("ISO-8859-1".equals(encoding)
|| "8859_1".equals(encoding)
|| "ISO8859_1".equals(encoding))
{
// dangerMask = (short)0xff00;
encoding = "ISO-8859-1";
}
else if ("UNICODE".equals(encoding)
|| "UNICODE-BIG".equals(encoding)
|| "UNICODE-LITTLE".equals(encoding))
{
encoding = "UTF-16";
// TODO: UTF-16BE, UTF-16LE ... no BOM; what
// release of JDK supports those Unicode names?
}
// if (dangerMask != 0)
// stringBuf = new StringBuffer();
}
this.encoding = encoding;
}
/**
* Resets the handler to write a new text document.
*
* @param writer XML text is written to this writer.
* @param encoding if non-null, and an XML declaration is written,
* this is the name that will be used for the character encoding.
*
* @exception IllegalStateException if the current
* document hasn't yet ended (with {@link #endDocument})
*/
final public void setWriter(Writer writer, String encoding)
{
if (this.out != null)
throw new IllegalStateException(
"can't change stream in mid course");
this.out = writer;
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;
}
}
|
|
From: <mla...@us...> - 2003-06-17 17:34:11
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database
In directory sc8-pr-cvs1:/tmp/cvs-serv10305/src/java/org/dbunit/database
Modified Files:
DatabaseSequenceFilter.java
Log Message:
Applied patch submitted by Erik Price in the developer list. He tested, debugged and rewritten this class to make it work.
Index: DatabaseSequenceFilter.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/DatabaseSequenceFilter.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DatabaseSequenceFilter.java 15 Jun 2003 15:29:02 -0000 1.2
--- DatabaseSequenceFilter.java 17 Jun 2003 17:34:08 -0000 1.3
***************
*** 23,27 ****
import org.dbunit.dataset.DataSetException;
import org.dbunit.dataset.filter.SequenceTableFilter;
- import org.dbunit.DatabaseUnitRuntimeException;
import java.sql.DatabaseMetaData;
--- 23,26 ----
***************
*** 29,35 ****
import java.sql.SQLException;
import java.util.Arrays;
- import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
--- 28,36 ----
import java.sql.SQLException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
+ import java.util.Iterator;
+ import java.util.LinkedList;
+ import java.util.List;
import java.util.Map;
import java.util.Set;
***************
*** 40,43 ****
--- 41,45 ----
*
* @author Manuel Laflamme
+ * @author Erik Price
* @since Mar 23, 2003
* @version $Revision$
***************
*** 45,48 ****
--- 47,55 ----
public class DatabaseSequenceFilter extends SequenceTableFilter
{
+
+ /** Cache for tablename/foreign key mappings. */
+ private static Map _dependentMap;
+
+
/**
* Create a DatabaseSequenceFilter that only exposes specified table names.
***************
*** 63,163 ****
}
! private static String[] sortTableNames(IDatabaseConnection connection,
! 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;
! }
!
! }
!
! private static class TableSequenceComparator implements Comparator
! {
! IDatabaseConnection _connection;
! Map _dependentMap = new HashMap();
!
! public TableSequenceComparator(IDatabaseConnection connection)
! {
! _connection = connection;
! }
!
! public int compare(Object o1, Object o2)
! {
! String tableName1 = (String)o1;
! String tableName2 = (String)o2;
! try
! {
! if (getDependentTableNames(tableName1).contains(tableName2))
{
! if (getDependentTableNames(tableName2).contains(tableName1))
{
! throw new CyclicTablesDependencyException(tableName1, tableName2);
}
! return -1;
}
}
! catch (SQLException e)
{
! throw new DatabaseUnitRuntimeException(e);
}
! catch (CyclicTablesDependencyException e)
{
! throw new DatabaseUnitRuntimeException(e);
}
! return tableName1.compareTo(tableName2);
}
! private Set getDependentTableNames(String tableName)
! throws SQLException
! {
! if (_dependentMap.containsKey(tableName))
! {
! return (Set)_dependentMap.get(tableName);
! }
! DatabaseMetaData metaData = _connection.getConnection().getMetaData();
! String schema = _connection.getSchema();
! ResultSet resultSet = metaData.getExportedKeys(null, schema, tableName);
! try
{
! Set foreignTableSet = new HashSet();
!
! while (resultSet.next())
! {
! // TODO : add support for qualified table names
// String foreignSchemaName = resultSet.getString(6);
! String foreignTableName = resultSet.getString(7);
!
! foreignTableSet.add(foreignTableName);
! }
! _dependentMap.put(tableName, foreignTableSet);
! return foreignTableSet;
! }
! finally
! {
! resultSet.close();
}
- }
}
--- 70,198 ----
}
! /**
! * Re-orders a string array of table names, placing dependent ("parent")
! * tables after their dependencies ("children").
! *
! * @param tableNames A string array of table names to be ordered.
! * @return The re-ordered array of table names.
! * @throws DataSetException
! * @throws SQLException If an exception is encountered in accessing the database.
! */
! static String[] sortTableNames(
! IDatabaseConnection connection,
! String[] tableNames)
! throws DataSetException, SQLException
! // not sure why this throws DataSetException ? - ENP
{
! boolean reprocess = true;
! List tmpTableNames = Arrays.asList(tableNames);
! List sortedTableNames = null;
! DatabaseSequenceFilter._dependentMap = new HashMap();
!
! while (reprocess) {
! sortedTableNames = new LinkedList();
!
! // re-order 'tmpTableNames' into 'sortedTableNames'
! for (Iterator i = tmpTableNames.iterator(); i.hasNext();)
{
! boolean foundDependentInSortedTableNames = false;
! String tmpTable = (String)i.next();
! Set tmpTableDependents = getDependentTableNames(connection, tmpTable);
!
! int sortedTableIndex = -1;
! for (Iterator k = sortedTableNames.iterator(); k.hasNext();)
{
! String sortedTable = (String)k.next();
! if (tmpTableDependents.contains(sortedTable))
{
! sortedTableIndex = sortedTableNames.indexOf(sortedTable);
! foundDependentInSortedTableNames = true;
! break; // end for loop; we know the index
}
! }
!
!
! // add 'tmpTable' to 'sortedTableNames'.
! // Insert it before its first dependent if there are any,
! // otherwise append it to the end of 'sortedTableNames'
! if (foundDependentInSortedTableNames) {
! if (sortedTableIndex < 0) {
! throw new IllegalStateException(
! "sortedTableIndex should be 0 or greater, but is "
! + sortedTableIndex);
! }
! sortedTableNames.add(sortedTableIndex, tmpTable);
! }
! else
! {
! sortedTableNames.add(tmpTable);
}
}
!
!
!
! // don't stop processing until we have a perfect run (no re-ordering)
! if (tmpTableNames.equals(sortedTableNames))
{
! reprocess = false;
}
! else
{
!
! tmpTableNames = null;
! tmpTableNames = (List)((LinkedList)sortedTableNames).clone();
}
+ }// end 'while (reprocess)'
+
+ return (String[])sortedTableNames.toArray(new String[0]);
+ }
+
! /**
! * Returns a Set containing the names of all tables which are dependent upon
! * <code>tableName</code>'s primary key as foreign keys.
! *
! * @param connection An IDatabaseConnection to a database that supports
! * referential integrity.
! * @param tableName The table whose primary key is to be used in determining
! * dependent foreign key tables.
! * @return The Set of dependent foreign key table names.
! * @throws SQLException If an exception is encountered in accessing the database.
! */
! private static Set getDependentTableNames(
! IDatabaseConnection connection,
! String tableName)
! throws SQLException
! {
! if (_dependentMap.containsKey(tableName))
! {
! return (Set)_dependentMap.get(tableName);
}
! DatabaseMetaData metaData = connection.getConnection().getMetaData();
! String schema = connection.getSchema();
! ResultSet resultSet = metaData.getExportedKeys(null, schema, tableName);
! try
! {
! Set foreignTableSet = new HashSet();
! while (resultSet.next())
{
! // TODO : add support for qualified table names
// String foreignSchemaName = resultSet.getString(6);
! String foreignTableName = resultSet.getString(7);
! foreignTableSet.add(foreignTableName);
}
+ _dependentMap.put(tableName, foreignTableSet);
+ return foreignTableSet;
+ }
+ finally
+ {
+ resultSet.close();
+ }
}
|
|
From: <mla...@us...> - 2003-06-17 01:17:53
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml
In directory sc8-pr-cvs1:/tmp/cvs-serv4131/src/java/org/dbunit/dataset/xml
Modified Files:
Tag: branch-exml2sax
XmlDataSetWriter.java
Log Message:
More efficient XmlDataSet writing. Now put values in CData block only when necessary. Previously all values were systematically written inside CData.
Index: XmlDataSetWriter.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/Attic/XmlDataSetWriter.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
*** XmlDataSetWriter.java 14 Jun 2003 06:06:48 -0000 1.1.2.1
--- XmlDataSetWriter.java 17 Jun 2003 01:17:50 -0000 1.1.2.2
***************
*** 51,54 ****
--- 51,59 ----
private static final String NONE = "none";
+ static char[] CDATA_DETECTION_CHARS = new char[] {
+ 0x20, '\n', '\r', '\t', // whitespace
+ '&', '<', // forbiden char
+ };
+
private XmlWriter _xmlWriter;
private ITableMetaData _activeMetaData;
***************
*** 73,76 ****
--- 78,102 ----
}
+ boolean needsCData(String text)
+ {
+ if (text == null)
+ {
+ return false;
+ }
+
+ for (int i = 0; i < text.length(); i++)
+ {
+ char c = text.charAt(i);
+ for (int j = 0; j < CDATA_DETECTION_CHARS.length; j++)
+ {
+ if (CDATA_DETECTION_CHARS[j] == c)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
////////////////////////////////////////////////////////////////////////////
// IDataSetConsumer interface
***************
*** 169,173 ****
_xmlWriter.writeElement(VALUE);
! if (stringValue.startsWith(" ") || stringValue.endsWith(" "))
{
_xmlWriter.writeCData(stringValue);
--- 195,199 ----
_xmlWriter.writeElement(VALUE);
! if (needsCData(stringValue))
{
_xmlWriter.writeCData(stringValue);
|
|
From: <mla...@us...> - 2003-06-17 01:13:25
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml
In directory sc8-pr-cvs1:/tmp/cvs-serv3676/src/java/org/dbunit/dataset/xml
Modified Files:
Tag: branch-1-5
XmlDataSet.java
Log Message:
More efficient XmlDataSet writing. Now put values in CData block only when necessary. Previously all values were systematically written inside CData.
Index: XmlDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/XmlDataSet.java,v
retrieving revision 1.14.2.1
retrieving revision 1.14.2.2
diff -C2 -d -r1.14.2.1 -r1.14.2.2
*** XmlDataSet.java 16 Jun 2003 01:51:32 -0000 1.14.2.1
--- XmlDataSet.java 17 Jun 2003 01:13:21 -0000 1.14.2.2
***************
*** 45,48 ****
--- 45,53 ----
{
private static final String DEFAULT_XML_ENCODING = "UTF-8";
+ static char[] CDATA_DETECTION_CHARS = new char[] {
+ 0x20, '\n', '\r', '\t', // whitespace
+ '&', '<', // forbiden char
+ };
+
private final ITable[] _tables;
***************
*** 200,213 ****
try
{
! String string = DataType.asString(value);
Text text = null;
! if (string.startsWith(" ") || string.endsWith(""))
{
! text = new CData(string);
}
else
{
! text = new Text(string);
}
--- 205,218 ----
try
{
! String stringValue = DataType.asString(value);
Text text = null;
! if (needsCData(stringValue))
{
! text = new CData(stringValue);
}
else
{
! text = new Text(stringValue);
}
***************
*** 226,229 ****
--- 231,255 ----
}
return document;
+ }
+
+ static boolean needsCData(String text)
+ {
+ if (text == null)
+ {
+ return false;
+ }
+
+ for (int i = 0; i < text.length(); i++)
+ {
+ char c = text.charAt(i);
+ for (int j = 0; j < CDATA_DETECTION_CHARS.length; j++)
+ {
+ if (CDATA_DETECTION_CHARS[j] == c)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
}
|
|
From: <mla...@us...> - 2003-06-16 02:09:49
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation
In directory sc8-pr-cvs1:/tmp/cvs-serv21629/src/java/org/dbunit/operation
Modified Files:
Tag: branch-1-5
RefreshOperation.java
Log Message:
Fixed "736967-Wrong scale for numeric value" (from Main trunk to branch-1-5).
Index: RefreshOperation.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/operation/RefreshOperation.java,v
retrieving revision 1.21.2.1
retrieving revision 1.21.2.2
diff -C2 -d -r1.21.2.1 -r1.21.2.2
*** RefreshOperation.java 2 Apr 2003 13:51:53 -0000 1.21.2.1
--- RefreshOperation.java 16 Jun 2003 02:09:46 -0000 1.21.2.2
***************
*** 247,252 ****
Object value = table.getValue(row, _columns[i].getColumnName());
DataType dataType = _columns[i].getDataType();
! _countStatement.setObject(i + 1, dataType.typeCast(value),
! dataType.getSqlType());
}
--- 247,251 ----
Object value = table.getValue(row, _columns[i].getColumnName());
DataType dataType = _columns[i].getDataType();
! dataType.setSqlValue(value, i + 1, _countStatement);
}
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype
In directory sc8-pr-cvs1:/tmp/cvs-serv21629/src/java/org/dbunit/dataset/datatype
Modified Files:
Tag: branch-1-5
AbstractDataType.java BooleanDataType.java BytesDataType.java
DataType.java DateDataType.java DoubleDataType.java
FloatDataType.java IntegerDataType.java LongDataType.java
NumberDataType.java StringDataType.java TimeDataType.java
TimestampDataType.java
Log Message:
Fixed "736967-Wrong scale for numeric value" (from Main trunk to branch-1-5).
Index: AbstractDataType.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/AbstractDataType.java,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -C2 -d -r1.5 -r1.5.2.1
*** AbstractDataType.java 13 Jun 2002 17:24:56 -0000 1.5
--- AbstractDataType.java 16 Jun 2003 02:09:46 -0000 1.5.2.1
***************
*** 23,26 ****
--- 23,30 ----
package org.dbunit.dataset.datatype;
+ import java.sql.ResultSet;
+ import java.sql.PreparedStatement;
+ import java.sql.SQLException;
+
/**
* @author Manuel Laflamme
***************
*** 59,62 ****
--- 63,78 ----
{
return _isNumber;
+ }
+
+ public Object getSqlValue(int column, ResultSet resultSet)
+ throws SQLException, TypeCastException
+ {
+ return resultSet.getObject(column);
+ }
+
+ public void setSqlValue(Object value, int column, PreparedStatement statement)
+ throws SQLException, TypeCastException
+ {
+ statement.setObject(column, typeCast(value), getSqlType());
}
Index: BooleanDataType.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/BooleanDataType.java,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -C2 -d -r1.9 -r1.9.2.1
*** BooleanDataType.java 13 Jun 2002 17:24:56 -0000 1.9
--- BooleanDataType.java 16 Jun 2003 02:09:46 -0000 1.9.2.1
***************
*** 23,26 ****
--- 23,29 ----
import java.sql.Types;
+ import java.sql.ResultSet;
+ import java.sql.SQLException;
+ import java.sql.PreparedStatement;
/**
***************
*** 74,77 ****
--- 77,92 ----
throw new TypeCastException(value.toString());
+ }
+
+ public Object getSqlValue(int column, ResultSet resultSet)
+ throws SQLException, TypeCastException
+ {
+ return resultSet.getBoolean(column) ? Boolean.TRUE : Boolean.FALSE;
+ }
+
+ public void setSqlValue(Object value, int column, PreparedStatement statement)
+ throws SQLException, TypeCastException
+ {
+ statement.setBoolean(column, ((Boolean)typeCast(value)).booleanValue());
}
}
Index: BytesDataType.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/BytesDataType.java,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -C2 -d -r1.8 -r1.8.2.1
*** BytesDataType.java 13 Jun 2002 17:24:56 -0000 1.8
--- BytesDataType.java 16 Jun 2003 02:09:46 -0000 1.8.2.1
***************
*** 27,30 ****
--- 27,32 ----
import java.sql.Blob;
import java.sql.SQLException;
+ import java.sql.ResultSet;
+ import java.sql.PreparedStatement;
/**
***************
*** 74,77 ****
--- 76,99 ----
throw new TypeCastException(value.toString());
+ }
+
+ public Object getSqlValue(int column, ResultSet resultSet)
+ throws SQLException, TypeCastException
+ {
+ return resultSet.getBytes(column);
+ }
+
+ public void setSqlValue(Object value, int column, PreparedStatement statement)
+ throws SQLException, TypeCastException
+ {
+ // Special BLOB handling
+ if (this == DataType.BLOB)
+ {
+ statement.setObject(column, typeCast(value),
+ DataType.LONGVARBINARY.getSqlType());
+ return;
+ }
+
+ super.setSqlValue(value, column, statement);
}
}
Index: DataType.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/DataType.java,v
retrieving revision 1.16
retrieving revision 1.16.2.1
diff -C2 -d -r1.16 -r1.16.2.1
*** DataType.java 14 Feb 2003 05:12:29 -0000 1.16
--- DataType.java 16 Jun 2003 02:09:46 -0000 1.16.2.1
***************
*** 22,26 ****
--- 22,29 ----
package org.dbunit.dataset.datatype;
+ import java.sql.PreparedStatement;
+ import java.sql.ResultSet;
import java.sql.Types;
+ import java.sql.SQLException;
***************
*** 104,107 ****
--- 107,122 ----
*/
public abstract boolean isNumber();
+
+ /**
+ * Returns the specified column value from the specified resultset object.
+ */
+ public abstract Object getSqlValue(int column, ResultSet resultSet)
+ throws SQLException, TypeCastException;
+
+ /**
+ * Set the specified value to the specified prepared statement object.
+ */
+ public abstract void setSqlValue(Object value, int column,
+ PreparedStatement statement) throws SQLException, TypeCastException;
/**
Index: DateDataType.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/DateDataType.java,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -C2 -d -r1.9 -r1.9.2.1
*** DateDataType.java 13 Jun 2002 17:24:56 -0000 1.9
--- DateDataType.java 16 Jun 2003 02:09:46 -0000 1.9.2.1
***************
*** 24,27 ****
--- 24,30 ----
import java.sql.Types;
+ import java.sql.ResultSet;
+ import java.sql.SQLException;
+ import java.sql.PreparedStatement;
/**
***************
*** 76,79 ****
--- 79,94 ----
throw new TypeCastException(value.toString());
+ }
+
+ public Object getSqlValue(int column, ResultSet resultSet)
+ throws SQLException, TypeCastException
+ {
+ return resultSet.getDate(column);
+ }
+
+ public void setSqlValue(Object value, int column, PreparedStatement statement)
+ throws SQLException, TypeCastException
+ {
+ statement.setDate(column, (java.sql.Date)typeCast(value));
}
}
Index: DoubleDataType.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/DoubleDataType.java,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -C2 -d -r1.9 -r1.9.2.1
*** DoubleDataType.java 13 Jun 2002 17:24:56 -0000 1.9
--- DoubleDataType.java 16 Jun 2003 02:09:46 -0000 1.9.2.1
***************
*** 23,26 ****
--- 23,29 ----
import java.math.BigDecimal;
+ import java.sql.ResultSet;
+ import java.sql.SQLException;
+ import java.sql.PreparedStatement;
/**
***************
*** 58,61 ****
--- 61,76 ----
throw new TypeCastException(e);
}
+ }
+
+ public Object getSqlValue(int column, ResultSet resultSet)
+ throws SQLException, TypeCastException
+ {
+ return new Double(resultSet.getDouble(column));
+ }
+
+ public void setSqlValue(Object value, int column, PreparedStatement statement)
+ throws SQLException, TypeCastException
+ {
+ statement.setDouble(column, ((Number)typeCast(value)).doubleValue());
}
}
Index: FloatDataType.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/FloatDataType.java,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -C2 -d -r1.9 -r1.9.2.1
*** FloatDataType.java 13 Jun 2002 17:24:57 -0000 1.9
--- FloatDataType.java 16 Jun 2003 02:09:46 -0000 1.9.2.1
***************
*** 24,27 ****
--- 24,30 ----
import java.math.BigDecimal;
import java.sql.Types;
+ import java.sql.ResultSet;
+ import java.sql.SQLException;
+ import java.sql.PreparedStatement;
/**
***************
*** 59,62 ****
--- 62,77 ----
throw new TypeCastException(e);
}
+ }
+
+ public Object getSqlValue(int column, ResultSet resultSet)
+ throws SQLException, TypeCastException
+ {
+ return new Float(resultSet.getFloat(column));
+ }
+
+ public void setSqlValue(Object value, int column, PreparedStatement statement)
+ throws SQLException, TypeCastException
+ {
+ statement.setFloat(column, ((Number)typeCast(value)).floatValue());
}
}
Index: IntegerDataType.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/IntegerDataType.java,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -C2 -d -r1.9 -r1.9.2.1
*** IntegerDataType.java 13 Jun 2002 17:24:57 -0000 1.9
--- IntegerDataType.java 16 Jun 2003 02:09:46 -0000 1.9.2.1
***************
*** 23,26 ****
--- 23,29 ----
import java.math.BigDecimal;
+ import java.sql.ResultSet;
+ import java.sql.SQLException;
+ import java.sql.PreparedStatement;
/**
***************
*** 58,61 ****
--- 61,76 ----
throw new TypeCastException(e);
}
+ }
+
+ public Object getSqlValue(int column, ResultSet resultSet)
+ throws SQLException, TypeCastException
+ {
+ return new Integer(resultSet.getInt(column));
+ }
+
+ public void setSqlValue(Object value, int column, PreparedStatement statement)
+ throws SQLException, TypeCastException
+ {
+ statement.setInt(column, ((Integer)typeCast(value)).intValue());
}
}
Index: LongDataType.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/LongDataType.java,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -C2 -d -r1.9 -r1.9.2.1
*** LongDataType.java 13 Jun 2002 17:24:57 -0000 1.9
--- LongDataType.java 16 Jun 2003 02:09:46 -0000 1.9.2.1
***************
*** 24,27 ****
--- 24,30 ----
import java.math.BigDecimal;
import java.sql.Types;
+ import java.sql.ResultSet;
+ import java.sql.SQLException;
+ import java.sql.PreparedStatement;
/**
***************
*** 59,62 ****
--- 62,77 ----
throw new TypeCastException(e);
}
+ }
+
+ public Object getSqlValue(int column, ResultSet resultSet)
+ throws SQLException, TypeCastException
+ {
+ return new Long(resultSet.getLong(column));
+ }
+
+ public void setSqlValue(Object value, int column, PreparedStatement statement)
+ throws SQLException, TypeCastException
+ {
+ statement.setLong(column, ((Number)typeCast(value)).longValue());
}
}
Index: NumberDataType.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/NumberDataType.java,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -C2 -d -r1.8 -r1.8.2.1
*** NumberDataType.java 13 Jun 2002 17:24:57 -0000 1.8
--- NumberDataType.java 16 Jun 2003 02:09:46 -0000 1.8.2.1
***************
*** 24,27 ****
--- 24,30 ----
import java.math.BigDecimal;
+ import java.sql.ResultSet;
+ import java.sql.SQLException;
+ import java.sql.PreparedStatement;
/**
***************
*** 59,62 ****
--- 62,77 ----
throw new TypeCastException(e);
}
+ }
+
+ public Object getSqlValue(int column, ResultSet resultSet)
+ throws SQLException, TypeCastException
+ {
+ return resultSet.getBigDecimal(column);
+ }
+
+ public void setSqlValue(Object value, int column, PreparedStatement statement)
+ throws SQLException, TypeCastException
+ {
+ statement.setBigDecimal(column, (BigDecimal)typeCast(value));
}
}
Index: StringDataType.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/StringDataType.java,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -C2 -d -r1.14 -r1.14.2.1
*** StringDataType.java 13 Jun 2002 17:24:57 -0000 1.14
--- StringDataType.java 16 Jun 2003 02:09:46 -0000 1.14.2.1
***************
*** 24,28 ****
import org.dbunit.util.Base64;
! import java.sql.*;
/**
--- 24,32 ----
import org.dbunit.util.Base64;
! import java.sql.Blob;
! import java.sql.Clob;
! import java.sql.PreparedStatement;
! import java.sql.ResultSet;
! import java.sql.SQLException;
/**
***************
*** 109,112 ****
--- 113,136 ----
throw new TypeCastException(value.toString());
+ }
+
+ public Object getSqlValue(int column, ResultSet resultSet)
+ throws SQLException, TypeCastException
+ {
+ return resultSet.getString(column);
+ }
+
+ public void setSqlValue(Object value, int column, PreparedStatement statement)
+ throws SQLException, TypeCastException
+ {
+ // Special CLOB handling
+ if (this == DataType.CLOB)
+ {
+ statement.setObject(column, typeCast(value),
+ DataType.LONGVARCHAR.getSqlType());
+ return;
+ }
+
+ statement.setString(column, asString(value));
}
}
Index: TimeDataType.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/TimeDataType.java,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -C2 -d -r1.9 -r1.9.2.1
*** TimeDataType.java 13 Jun 2002 17:24:57 -0000 1.9
--- TimeDataType.java 16 Jun 2003 02:09:46 -0000 1.9.2.1
***************
*** 25,28 ****
--- 25,31 ----
import java.sql.Time;
import java.sql.Types;
+ import java.sql.ResultSet;
+ import java.sql.SQLException;
+ import java.sql.PreparedStatement;
/**
***************
*** 77,80 ****
--- 80,95 ----
throw new TypeCastException(value.toString());
+ }
+
+ public Object getSqlValue(int column, ResultSet resultSet)
+ throws SQLException, TypeCastException
+ {
+ return resultSet.getTime(column);
+ }
+
+ public void setSqlValue(Object value, int column, PreparedStatement statement)
+ throws SQLException, TypeCastException
+ {
+ statement.setTime(column, (java.sql.Time)typeCast(value));
}
}
Index: TimestampDataType.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/TimestampDataType.java,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -C2 -d -r1.9 -r1.9.2.1
*** TimestampDataType.java 13 Jun 2002 17:24:57 -0000 1.9
--- TimestampDataType.java 16 Jun 2003 02:09:46 -0000 1.9.2.1
***************
*** 25,28 ****
--- 25,31 ----
import java.sql.Timestamp;
import java.sql.Types;
+ import java.sql.ResultSet;
+ import java.sql.SQLException;
+ import java.sql.PreparedStatement;
/**
***************
*** 77,80 ****
--- 80,95 ----
throw new TypeCastException(value.toString());
+ }
+
+ public Object getSqlValue(int column, ResultSet resultSet)
+ throws SQLException, TypeCastException
+ {
+ return resultSet.getTimestamp(column);
+ }
+
+ public void setSqlValue(Object value, int column, PreparedStatement statement)
+ throws SQLException, TypeCastException
+ {
+ statement.setTimestamp(column, (java.sql.Timestamp)typeCast(value));
}
}
|
|
From: <mla...@us...> - 2003-06-16 02:09:49
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database
In directory sc8-pr-cvs1:/tmp/cvs-serv21629/src/java/org/dbunit/database
Modified Files:
Tag: branch-1-5
CachedResultSetTable.java
Log Message:
Fixed "736967-Wrong scale for numeric value" (from Main trunk to branch-1-5).
Index: CachedResultSetTable.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/CachedResultSetTable.java,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -C2 -d -r1.7 -r1.7.2.1
*** CachedResultSetTable.java 13 Jun 2002 17:24:56 -0000 1.7
--- CachedResultSetTable.java 16 Jun 2003 02:09:46 -0000 1.7.2.1
***************
*** 24,27 ****
--- 24,28 ----
import org.dbunit.dataset.*;
+ import org.dbunit.dataset.datatype.DataType;
import java.sql.ResultSet;
***************
*** 52,56 ****
for (int i = 0; i < columns.length; i++)
{
! Object value = resultSet.getObject(columns[i].getColumnName());
row[i] = value;
}
--- 53,60 ----
for (int i = 0; i < columns.length; i++)
{
! Column column = columns[i];
! int columnIndex = getColumnIndex(column.getColumnName(), metaData) + 1;
! DataType columnDataType = column.getDataType();
! Object value = columnDataType.getSqlValue(columnIndex, resultSet);
row[i] = value;
}
***************
*** 59,62 ****
--- 63,81 ----
}
return list;
+ }
+
+ private static int getColumnIndex(String columnName, ITableMetaData metaData) throws DataSetException
+ {
+ Column[] columns = metaData.getColumns();
+ for (int i = 0; i < columns.length; i++)
+ {
+ Column column = columns[i];
+ if (column.getColumnName().equalsIgnoreCase(columnName))
+ {
+ return i;
+ }
+ }
+
+ throw new NoSuchColumnException(metaData.getTableName() + "." + columnName);
}
|
|
From: <mla...@us...> - 2003-06-16 02:09:49
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement
In directory sc8-pr-cvs1:/tmp/cvs-serv21629/src/java/org/dbunit/database/statement
Modified Files:
Tag: branch-1-5
PreparedBatchStatement.java SimplePreparedStatement.java
Log Message:
Fixed "736967-Wrong scale for numeric value" (from Main trunk to branch-1-5).
Index: PreparedBatchStatement.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement/PreparedBatchStatement.java,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -C2 -d -r1.8.2.1 -r1.8.2.2
*** PreparedBatchStatement.java 2 Apr 2003 13:51:53 -0000 1.8.2.1
--- PreparedBatchStatement.java 16 Jun 2003 02:09:46 -0000 1.8.2.2
***************
*** 57,77 ****
}
! // Special BLOB handling
! if (dataType == DataType.CLOB)
! {
! _statement.setObject(++_index, dataType.typeCast(value),
! DataType.LONGVARCHAR.getSqlType());
! return;
! }
!
! // Special CLOB handling
! if (dataType == DataType.BLOB)
! {
! _statement.setObject(++_index, dataType.typeCast(value),
! DataType.LONGVARBINARY.getSqlType());
! return;
! }
!
! _statement.setObject(++_index, dataType.typeCast(value), dataType.getSqlType());
}
--- 57,61 ----
}
! dataType.setSqlValue(value, ++_index, _statement);
}
Index: SimplePreparedStatement.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/statement/SimplePreparedStatement.java,v
retrieving revision 1.7.2.2
retrieving revision 1.7.2.3
diff -C2 -d -r1.7.2.2 -r1.7.2.3
*** SimplePreparedStatement.java 15 Jun 2003 21:58:02 -0000 1.7.2.2
--- SimplePreparedStatement.java 16 Jun 2003 02:09:46 -0000 1.7.2.3
***************
*** 59,79 ****
}
! // Special BLOB handling
! if (dataType == DataType.CLOB)
! {
! _statement.setObject(++_index, dataType.typeCast(value),
! DataType.LONGVARCHAR.getSqlType());
! return;
! }
!
! // Special CLOB handling
! if (dataType == DataType.BLOB)
! {
! _statement.setObject(++_index, dataType.typeCast(value),
! DataType.LONGVARBINARY.getSqlType());
! return;
! }
!
! _statement.setObject(++_index, dataType.typeCast(value), dataType.getSqlType());
}
--- 59,63 ----
}
! dataType.setSqlValue(value, ++_index, _statement);
}
|
|
From: <mla...@us...> - 2003-06-16 01:58:23
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml
In directory sc8-pr-cvs1:/tmp/cvs-serv19286/src/java/org/dbunit/dataset/xml
Modified Files:
Tag: branch-1-5
FlatDtdDataSet.java
Log Message:
Fixed long running XML encoding issue.
Index: FlatDtdDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/FlatDtdDataSet.java,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -C2 -d -r1.6 -r1.6.2.1
*** FlatDtdDataSet.java 1 Mar 2003 06:51:17 -0000 1.6
--- FlatDtdDataSet.java 16 Jun 2003 01:58:20 -0000 1.6.2.1
***************
*** 30,39 ****
private final Map _tableMap = new HashMap();
- /**
- * @deprecated Use Reader overload instead
- */
public FlatDtdDataSet(InputStream in) throws IOException
{
! this(new InputStreamReader(in));
}
--- 30,36 ----
private final Map _tableMap = new HashMap();
public FlatDtdDataSet(InputStream in) throws IOException
{
! this(new BufferedReader(new InputStreamReader(in)));
}
|
|
From: <mla...@us...> - 2003-06-16 01:51:35
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml
In directory sc8-pr-cvs1:/tmp/cvs-serv18110/src/java/org/dbunit/dataset/xml
Modified Files:
Tag: branch-1-5
FlatXmlDataSet.java XmlDataSet.java
Added Files:
Tag: branch-1-5
AbstractXmlDataSet.java
Log Message:
Fixed long running XML encoding issue.
--- NEW FILE: AbstractXmlDataSet.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.AbstractDataSet;
import electric.util.io.Streams;
import electric.util.encoding.Encodings;
import java.io.Reader;
import java.io.InputStream;
import java.io.IOException;
import java.io.BufferedInputStream;
import java.io.InputStreamReader;
/**
* @author Manuel Laflamme
* @since Jun 15, 2003
* @version $Revision: 1.1.2.1 $
*/
public abstract class AbstractXmlDataSet extends AbstractDataSet
{
protected static Reader getReader(InputStream input) throws IOException
{
if (!(input instanceof BufferedInputStream))
{
input = new BufferedInputStream(input);
}
input.mark(100);
byte[] header = Streams.readUpTo(input, 100);
input.reset();
String encoding = Encodings.getJavaEncoding(header);
return new InputStreamReader(input, encoding);
}
}
Index: FlatXmlDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/FlatXmlDataSet.java,v
retrieving revision 1.19
retrieving revision 1.19.2.1
diff -C2 -d -r1.19 -r1.19.2.1
*** FlatXmlDataSet.java 1 Mar 2003 06:51:17 -0000 1.19
--- FlatXmlDataSet.java 16 Jun 2003 01:51:32 -0000 1.19.2.1
***************
*** 23,30 ****
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.net.MalformedURLException;
--- 23,43 ----
package org.dbunit.dataset.xml;
! import org.dbunit.dataset.Column;
! import org.dbunit.dataset.DataSetException;
! import org.dbunit.dataset.IDataSet;
! import org.dbunit.dataset.ITable;
! import org.dbunit.dataset.ITableMetaData;
import org.dbunit.dataset.datatype.DataType;
import org.dbunit.dataset.datatype.TypeCastException;
+ import electric.util.encoding.Encodings;
+ import electric.util.io.FastBufferedReader;
+ 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.*;
import java.net.MalformedURLException;
***************
*** 33,46 ****
import java.util.List;
- import electric.xml.*;
-
/**
* @author Manuel Laflamme
* @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;
--- 46,57 ----
import java.util.List;
/**
* @author Manuel Laflamme
* @version $Revision$
*/
! public class FlatXmlDataSet extends AbstractXmlDataSet
{
private static final String SYSTEM = "SYSTEM '";
! private static final String DEFAULT_XML_ENCODING = "UTF-8";
private final ITable[] _tables;
***************
*** 69,73 ****
try
{
! Document document = new Document(new BufferedReader(new FileReader(xmlFile)));
IDataSet metaDataSet = null;
--- 80,85 ----
try
{
! Reader reader = getReader(new FileInputStream(xmlFile));
! Document document = new Document(new FastBufferedReader(reader));
IDataSet metaDataSet = null;
***************
*** 116,120 ****
try
{
! Document document = new Document(new BufferedReader(xmlReader));
// Create metadata from dtd if defined
--- 128,132 ----
try
{
! Document document = new Document(new FastBufferedReader(xmlReader));
// Create metadata from dtd if defined
***************
*** 166,170 ****
try
{
! _tables = getTables(new Document(new BufferedReader(xmlReader)), metaDataSet);
}
catch (ParseException e)
--- 178,183 ----
try
{
! xmlReader = new FastBufferedReader(xmlReader);
! _tables = getTables(new Document(xmlReader), metaDataSet);
}
catch (ParseException e)
***************
*** 179,183 ****
*
* @param xmlStream the xml input stream
- * @deprecated Use Reader overload instead
*/
public FlatXmlDataSet(InputStream xmlStream) throws IOException, DataSetException
--- 192,195 ----
***************
*** 192,196 ****
* @param xmlStream the xml input stream
* @param dtdMetadata if <code>false</code> do not use DTD as metadata
- * @deprecated Use Reader overload instead
*
*/
--- 204,207 ----
***************
*** 198,202 ****
throws IOException, DataSetException
{
! this(new InputStreamReader(xmlStream), dtdMetadata);
}
--- 209,213 ----
throws IOException, DataSetException
{
! this(getReader(xmlStream), dtdMetadata);
}
***************
*** 207,211 ****
* @param xmlStream the xml input stream
* @param dtdStream the dtd input stream
- * @deprecated Use Reader overload instead
*/
public FlatXmlDataSet(InputStream xmlStream, InputStream dtdStream)
--- 218,221 ----
***************
*** 220,224 ****
* @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)
--- 230,233 ----
***************
*** 227,231 ****
try
{
! _tables = getTables(new Document(xmlStream), metaDataSet);
}
catch (ParseException e)
--- 236,241 ----
try
{
! Reader xmlReader = new FastBufferedReader(getReader(xmlStream));
! _tables = getTables(new Document(xmlReader), metaDataSet);
}
catch (ParseException e)
***************
*** 241,249 ****
throws IOException, DataSetException
{
! Document document = buildDocument(dataSet, DEFAULT_ENCODING);
// write xml document
! document.write(out);
! out.flush();
}
--- 251,261 ----
throws IOException, DataSetException
{
! Writer writer = new OutputStreamWriter(out,
! Encodings.getJavaEncoding(DEFAULT_XML_ENCODING));
! Document document = buildDocument(dataSet, DEFAULT_XML_ENCODING);
// write xml document
! document.write(writer);
! writer.flush();
}
***************
*** 254,258 ****
throws IOException, DataSetException
{
! Document document = buildDocument(dataSet, DEFAULT_ENCODING);
// write xml document
--- 266,276 ----
throws IOException, DataSetException
{
! String xmlEncoding = null;
! if (out instanceof OutputStreamWriter)
! {
! String javaEncoding = ((OutputStreamWriter)out).getEncoding();
! xmlEncoding = Encodings.getXMLEncoding(javaEncoding);
! }
! Document document = buildDocument(dataSet, xmlEncoding);
// write xml document
***************
*** 290,294 ****
Document document = new Document();
! document.addChild(new XMLDecl("1.0", encoding));
// dataset
--- 308,315 ----
Document document = new Document();
! if (encoding != null)
! {
! document.addChild(new XMLDecl("1.0", encoding));
! }
// dataset
Index: XmlDataSet.java
===================================================================
RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/XmlDataSet.java,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -C2 -d -r1.14 -r1.14.2.1
*** XmlDataSet.java 1 Mar 2003 06:51:17 -0000 1.14
--- XmlDataSet.java 16 Jun 2003 01:51:32 -0000 1.14.2.1
***************
*** 32,35 ****
--- 32,37 ----
import electric.xml.*;
+ import electric.util.io.FastBufferedReader;
+ import electric.util.encoding.Encodings;
/**
***************
*** 40,46 ****
* @version $Revision$
*/
! public class XmlDataSet extends AbstractDataSet
{
! private static final String DEFAULT_ENCODING = "UTF-8";
private final ITable[] _tables;
--- 42,48 ----
* @version $Revision$
*/
! public class XmlDataSet extends AbstractXmlDataSet
{
! private static final String DEFAULT_XML_ENCODING = "UTF-8";
private final ITable[] _tables;
***************
*** 52,56 ****
try
{
! Document document = new Document(new BufferedReader(in));
_tables = getTables(document);
}
--- 54,58 ----
try
{
! Document document = new Document(new FastBufferedReader(in));
_tables = getTables(document);
}
***************
*** 63,68 ****
/**
* Creates an XmlDataSet with the specified xml input stream.
- *
- * @deprecated Use Reader overload instead
*/
public XmlDataSet(InputStream in) throws DataSetException
--- 65,68 ----
***************
*** 70,86 ****
try
{
! Document document = new Document(in);
_tables = getTables(document);
- // 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);
- // }
- //
- // _tables = (ITable[])tableList.toArray(new ITable[0]);
}
catch (ParseException e)
--- 70,75 ----
try
{
! Document document = new Document(new FastBufferedReader(getReader(in)));
_tables = getTables(document);
}
catch (ParseException e)
***************
*** 88,91 ****
--- 77,84 ----
throw new DataSetException(e);
}
+ catch (IOException e)
+ {
+ throw new DataSetException(e);
+ }
}
***************
*** 111,119 ****
throws IOException, DataSetException
{
! Document document = buildDocument(dataSet, DEFAULT_ENCODING);
// write xml document
! document.write(out);
! out.flush();
}
--- 104,114 ----
throws IOException, DataSetException
{
! Writer writer = new OutputStreamWriter(out,
! Encodings.getJavaEncoding(DEFAULT_XML_ENCODING));
! Document document = buildDocument(dataSet, DEFAULT_XML_ENCODING);
// write xml document
! document.write(writer);
! writer.flush();
}
***************
*** 124,128 ****
throws IOException, DataSetException
{
! Document document = buildDocument(dataSet, DEFAULT_ENCODING);
// write xml document
--- 119,129 ----
throws IOException, DataSetException
{
! String xmlEncoding = null;
! if (out instanceof OutputStreamWriter)
! {
! String javaEncoding = ((OutputStreamWriter)out).getEncoding();
! xmlEncoding = Encodings.getXMLEncoding(javaEncoding);
! }
! Document document = buildDocument(dataSet, xmlEncoding);
// write xml document
***************
*** 150,154 ****
Document document = new Document();
! document.addChild(new XMLDecl("1.0", encoding));
// dataset
--- 151,158 ----
Document document = new Document();
! if (encoding != null)
! {
! document.addChild(new XMLDecl("1.0", encoding));
! }
// dataset
|