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-10-16 15:49:58
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml In directory sc8-pr-cvs1:/tmp/cvs-serv6024/src/java/org/dbunit/dataset/xml Modified Files: FlatXmlProducer.java Log Message: Finalized support for flat XML validation against its DTD. See Feature Request 677408 to know how to enable it. Index: FlatXmlProducer.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/FlatXmlProducer.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FlatXmlProducer.java 10 Oct 2003 21:12:37 -0000 1.4 --- FlatXmlProducer.java 16 Oct 2003 15:47:22 -0000 1.5 *************** *** 42,45 **** --- 42,46 ---- import org.xml.sax.SAXException; import org.xml.sax.XMLReader; + import org.xml.sax.SAXParseException; import org.xml.sax.helpers.DefaultHandler; *************** *** 151,154 **** --- 152,156 ---- xmlReader.setContentHandler(this); + xmlReader.setErrorHandler(this); xmlReader.setEntityResolver(_resolver); xmlReader.parse(_inputSource); *************** *** 160,164 **** --- 162,177 ---- catch (SAXException e) { + int lineNumber = -1; + if (e instanceof SAXParseException) + { + lineNumber = ((SAXParseException)e).getLineNumber(); + } Exception exception = e.getException() == null ? e : e.getException(); + + if (lineNumber >= 0) + { + String message = "Line " + lineNumber + ": " + exception.getMessage(); + throw new DataSetException(message, e); + } throw new DataSetException(exception); } *************** *** 180,183 **** --- 193,205 ---- } return null; + } + + //////////////////////////////////////////////////////////////////////////// + // ErrorHandler interface + + public void error(SAXParseException e) throws SAXException + { + throw e; + } |
From: <mla...@us...> - 2003-10-10 21:12:42
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv13962/src/test/org/dbunit/dataset Modified Files: AllTests.java DataSetProducerAdapterTest.java Removed Files: AbstractProducerTest.java MockDataSetConsumer.java MockDataSetProducer.java StreamingDataSetTest.java StreamingTableTest.java Log Message: Moved Streaming dataset related classes to the 'org.dbunit.dataset.stream' package. Index: AllTests.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/AllTests.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** AllTests.java 19 Jun 2003 03:17:17 -0000 1.19 --- AllTests.java 10 Oct 2003 21:12:37 -0000 1.20 *************** *** 38,41 **** --- 38,42 ---- suite.addTest(org.dbunit.dataset.excel.AllTests.suite()); suite.addTest(org.dbunit.dataset.filter.AllTests.suite()); + suite.addTest(org.dbunit.dataset.stream.AllTests.suite()); suite.addTest(org.dbunit.dataset.xml.AllTests.suite()); suite.addTest(new TestSuite(CaseInsensitiveDataSetTest.class)); *************** *** 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; --- 61,64 ---- Index: DataSetProducerAdapterTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/DataSetProducerAdapterTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DataSetProducerAdapterTest.java 9 Aug 2003 11:23:09 -0000 1.3 --- DataSetProducerAdapterTest.java 10 Oct 2003 21:12:37 -0000 1.4 *************** *** 24,27 **** --- 24,30 ---- import org.dbunit.dataset.xml.FlatXmlDataSet; + import org.dbunit.dataset.stream.IDataSetProducer; + import org.dbunit.dataset.stream.DataSetProducerAdapter; + import org.dbunit.dataset.stream.AbstractProducerTest; /** --- AbstractProducerTest.java DELETED --- --- MockDataSetConsumer.java DELETED --- --- MockDataSetProducer.java DELETED --- --- StreamingDataSetTest.java DELETED --- --- StreamingTableTest.java DELETED --- |
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/stream In directory sc8-pr-cvs1:/tmp/cvs-serv13962/src/test/org/dbunit/dataset/stream Added Files: AbstractProducerTest.java AllTests.java MockDataSetConsumer.java MockDataSetProducer.java StreamingDataSetTest.java StreamingTableTest.java Log Message: Moved Streaming dataset related classes to the 'org.dbunit.dataset.stream' package. --- NEW FILE: AbstractProducerTest.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.stream; import org.dbunit.dataset.datatype.DataType; import org.dbunit.dataset.stream.IDataSetProducer; import org.dbunit.dataset.stream.MockDataSetConsumer; import org.dbunit.dataset.Column; import junit.framework.TestCase; /** * @author Manuel Laflamme * @since Apr 29, 2003 * @version $Revision: 1.1 $ */ public abstract class AbstractProducerTest extends TestCase { private static final String[] TABLE_NAMES = { "DUPLICATE_TABLE", "SECOND_TABLE", "TEST_TABLE", "DUPLICATE_TABLE", "NOT_NULL_TABLE", "EMPTY_TABLE", }; public AbstractProducerTest(String s) { super(s); } protected String[] getExpectedNames() throws Exception { return (String[])TABLE_NAMES.clone(); } protected int[] getExpectedRowCount() throws Exception { return new int[] {1, 2, 3, 2, 1, 0}; } protected String getNotNullTableName() throws Exception { return "NOT_NULL_TABLE"; } protected Column[] createExpectedColumns(Column.Nullable nullable) throws Exception { Column[] columns = new Column[4]; for (int i = 0; i < columns.length; i++) { columns[i] = new Column("COLUMN" + i, DataType.UNKNOWN, nullable); } return columns; } protected Object[] createExpectedRow(int row) throws Exception { Object[] values = new Object[4]; for (int i = 0; i < values.length; i++) { values[i] = "row " + row + " col " + i; } return values; } protected abstract IDataSetProducer createProducer() throws Exception; public void testProduce() throws Exception { // Setup consumer MockDataSetConsumer consumer = new MockDataSetConsumer(); consumer.addExpectedStartDataSet(); String[] expectedNames = getExpectedNames(); int[] rowCounts = getExpectedRowCount(); for (int i = 0; i < expectedNames.length; i++) { String expectedName = expectedNames[i]; Column.Nullable nullable = expectedName.equals(getNotNullTableName()) ? Column.NO_NULLS : Column.NULLABLE; Column[] expectedColumns = createExpectedColumns(nullable); consumer.addExpectedStartTable(expectedName, expectedColumns); for (int j = 0; j < rowCounts[i]; j++) { consumer.addExpectedRow(expectedName, createExpectedRow(j)); } consumer.addExpectedEndTable(expectedName); } consumer.addExpectedEndDataSet(); // Setup producer IDataSetProducer producer = createProducer(); producer.setConsumer(consumer); // Produce and verify consumer producer.produce(); consumer.verify(); } public void testProduceWithoutConsumer() throws Exception { IDataSetProducer producer = createProducer(); producer.produce(); } } --- NEW FILE: AllTests.java --- /* * AllTests.java Feb 18, 2002 * * 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.stream; import junit.framework.Test; import junit.framework.TestSuite; /** * @author Manuel Laflamme * @version $Revision: 1.1 $ */ public class AllTests { public static Test suite() { TestSuite suite = new TestSuite(); suite.addTest(new TestSuite(StreamingDataSetTest.class)); suite.addTest(new TestSuite(StreamingTableTest.class)); return suite; } } --- NEW FILE: MockDataSetConsumer.java --- package org.dbunit.dataset.stream; /* * * 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 * */ import org.dbunit.dataset.stream.IDataSetConsumer; import org.dbunit.dataset.ITableMetaData; import org.dbunit.dataset.Column; import org.dbunit.dataset.DefaultTableMetaData; import org.dbunit.dataset.DataSetException; import com.mockobjects.ExpectationList; import com.mockobjects.Verifiable; import java.util.Arrays; /** * @author Manuel Laflamme * @since Apr 29, 2003 * @version $Revision: 1.1 $ */ public class MockDataSetConsumer implements Verifiable, IDataSetConsumer { private static final ProducerEvent START_DATASET_EVENT = new ProducerEvent("startDataSet()"); private static final ProducerEvent END_DATASET_EVENT = new ProducerEvent("endDataSet()"); private final ExpectationList _expectedList = new ExpectationList(""); private String _actualTableName; public void addExpectedStartDataSet() throws Exception { _expectedList.addExpected(START_DATASET_EVENT); } public void addExpectedEndDataSet() throws Exception { _expectedList.addExpected(END_DATASET_EVENT); } public void addExpectedStartTable(ITableMetaData metaData) throws Exception { _expectedList.addExpected(new StartTableEvent(metaData, false)); } public void addExpectedStartTable(String tableName, Column[] columns) throws Exception { addExpectedStartTable(new DefaultTableMetaData(tableName, columns)); } public void addExpectedStartTableIgnoreColumns(String tableName) throws Exception { _expectedList.addExpected(new StartTableEvent(tableName, true)); } public void addExpectedEmptyTable(String tableName, Column[] columns) throws Exception { addExpectedStartTable(tableName, columns); addExpectedEndTable(tableName); } public void addExpectedEmptyTableIgnoreColumns(String tableName) throws Exception { addExpectedStartTableIgnoreColumns(tableName); addExpectedEndTable(tableName); } public void addExpectedEndTable(String tableName) throws Exception { _expectedList.addExpected(new EndTableEvent(tableName)); } public void addExpectedRow(String tableName, Object[] values) throws Exception { _expectedList.addExpected(new RowEvent(tableName, values)); } //////////////////////////////////////////////////////////////////////////// // Verifiable interface public void verify() { _expectedList.verify(); } //////////////////////////////////////////////////////////////////////////// // IDataSetConsumer interface public void startDataSet() throws DataSetException { _expectedList.addActual(START_DATASET_EVENT); } public void endDataSet() throws DataSetException { _expectedList.addActual(END_DATASET_EVENT); } public void startTable(ITableMetaData metaData) throws DataSetException { _expectedList.addActual(new StartTableEvent(metaData, false)); _actualTableName = metaData.getTableName(); } public void endTable() throws DataSetException { _expectedList.addActual(new EndTableEvent(_actualTableName)); _actualTableName = null; } public void row(Object[] values) throws DataSetException { _expectedList.addActual( new RowEvent(_actualTableName, values)); } //////////////////////////////////////////////////////////////////////////// // private static class ProducerEvent { protected final String _name; public ProducerEvent(String name) { _name = name; } public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof ProducerEvent)) return false; final ProducerEvent item = (ProducerEvent)o; if (!_name.equals(item._name)) return false; return true; } public int hashCode() { return _name.hashCode(); } public String toString() { return _name; } } private static class StartTableEvent extends ProducerEvent { private final String _tableName; private final Column[] _columns; private final boolean _ignoreColumns; public StartTableEvent(ITableMetaData metaData, boolean ignoreColumns) throws DataSetException { super("startTable()"); _tableName = metaData.getTableName(); _columns = metaData.getColumns(); _ignoreColumns = ignoreColumns; } public StartTableEvent(String tableName, boolean ignoreColumns) throws DataSetException { super("startTable()"); _tableName = tableName; _columns = new Column[0]; _ignoreColumns = ignoreColumns; } public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof StartTableEvent)) return false; if (!super.equals(o)) return false; final StartTableEvent startTableItem = (StartTableEvent)o; if (!_tableName.equals(startTableItem._tableName)) return false; if (!_ignoreColumns) { if (!Arrays.equals(_columns, startTableItem._columns)) return false; } return true; } public int hashCode() { int result = super.hashCode(); result = 29 * result + _tableName.hashCode(); return result; } public String toString() { String string = _name + ": table=" + _tableName; if (!_ignoreColumns) { string += ", columns=" + Arrays.asList(_columns); } return string; } } private static class EndTableEvent extends ProducerEvent { private final String _tableName; public EndTableEvent(String tableName) { super("endTable()"); _tableName = tableName; } public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof EndTableEvent)) return false; if (!super.equals(o)) return false; final EndTableEvent endTableItem = (EndTableEvent)o; if (!_tableName.equals(endTableItem._tableName)) return false; return true; } public int hashCode() { int result = super.hashCode(); result = 29 * result + _tableName.hashCode(); return result; } public String toString() { return _name + ": table=" + _tableName; } } private static class RowEvent extends ProducerEvent { private final String _tableName; private final Object[] _values; public RowEvent(String tableName, Object[] values) { super("row()"); _tableName = tableName; _values = values; } public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof RowEvent)) return false; if (!super.equals(o)) return false; final RowEvent rowItem = (RowEvent)o; if (!_tableName.equals(rowItem._tableName)) return false; // Probably incorrect - comparing Object[] arrays with Arrays.equals if (!Arrays.equals(_values, rowItem._values)) return false; return true; } public int hashCode() { int result = super.hashCode(); result = 29 * result + _tableName.hashCode(); return result; } public String toString() { return _name + ": table=" + _tableName + ", values=" + Arrays.asList(_values); } } } --- NEW FILE: MockDataSetProducer.java --- /* * * The DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.dataset.stream; import org.dbunit.dataset.stream.IDataSetProducer; import org.dbunit.dataset.stream.IDataSetConsumer; import org.dbunit.dataset.stream.DefaultConsumer; import org.dbunit.dataset.DataSetException; import org.dbunit.dataset.Column; import org.dbunit.dataset.ITableMetaData; import org.dbunit.dataset.DefaultTableMetaData; import org.dbunit.dataset.datatype.DataType; /** * @author Manuel Laflamme * @since Jun 12, 2003 * @version $Revision: 1.1 $ */ public class MockDataSetProducer implements IDataSetProducer { private int _tableCount; private int _columnCount; private int _rowCount; private IDataSetConsumer _consumer = new DefaultConsumer(); public void setupTableCount(int tableCount) { _tableCount = tableCount; } public void setupColumnCount(int columnCount) { _columnCount = columnCount; } public void setupRowCount(int rowCount) { _rowCount = rowCount; } //////////////////////////////////////////////////////////////////////////// // IDataSetProducer interface public void setConsumer(IDataSetConsumer consumer) throws DataSetException { _consumer = consumer; } public void produce() throws DataSetException { _consumer.startDataSet(); for (int i = 0; i < _tableCount; i++) { String tableName = "TABLE" + i; Column[] columns = new Column[_columnCount]; for (int j = 0; j < columns.length; j++) { columns[j] = new Column("COLUMN" + j, DataType.UNKNOWN); } ITableMetaData metaData = new DefaultTableMetaData(tableName, columns); _consumer.startTable(metaData); for (int j = 0; j < _rowCount; j++) { Object[] values = new Object[_columnCount]; for (int k = 0; k < values.length; k++) { values[k] = j + "," + k; } _consumer.row(values); } _consumer.endTable(); } _consumer.endDataSet(); } } --- NEW FILE: StreamingDataSetTest.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.stream; import org.dbunit.dataset.stream.DataSetProducerAdapter; import org.dbunit.dataset.ForwardOnlyDataSetTest; import org.dbunit.dataset.IDataSet; import org.dbunit.dataset.stream.IDataSetProducer; import org.dbunit.dataset.stream.StreamingDataSet; import org.dbunit.dataset.xml.FlatXmlProducer; import org.xml.sax.InputSource; import java.io.FileReader; /** * @author Manuel Laflamme * @since Apr 18, 2003 * @version $Revision: 1.1 $ */ public class StreamingDataSetTest extends ForwardOnlyDataSetTest { public StreamingDataSetTest(String s) { super(s); } protected IDataSet createDataSet() throws Exception { IDataSetProducer source = new FlatXmlProducer( new InputSource(new FileReader("src/xml/flatXmlDataSetTest.xml"))); return new StreamingDataSet(source); // return new StreamingDataSet( // new DataSetProducerAdapter(super.createDataSet())); } protected IDataSet createDuplicateDataSet() throws Exception { return new StreamingDataSet( new DataSetProducerAdapter(super.createDuplicateDataSet())); } } --- NEW FILE: StreamingTableTest.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.stream; import org.dbunit.dataset.xml.FlatXmlProducer; import org.dbunit.dataset.stream.StreamingDataSet; import org.dbunit.dataset.stream.IDataSetProducer; import org.dbunit.dataset.ForwardOnlyTableTest; import org.dbunit.dataset.ITable; import org.dbunit.dataset.ITableIterator; import org.xml.sax.InputSource; import java.io.FileReader; /** * @author Manuel Laflamme * @since Apr 11, 2003 * @version $Revision: 1.1 $ */ public class StreamingTableTest extends ForwardOnlyTableTest { private static final String TEST_TABLE = "TEST_TABLE"; public StreamingTableTest(String s) { super(s); } protected ITable createTable() throws Exception { FileReader reader = new FileReader("src/xml/flatXmlDataSetTest.xml"); // IDataSetProducer source = new DataSetProducerAdapter(new FlatXmlDataSet(reader)); IDataSetProducer source = new FlatXmlProducer(new InputSource(reader)); ITableIterator iterator = new StreamingDataSet(source).iterator(); while(iterator.next()) { ITable table = iterator.getTable(); String tableName = table.getTableMetaData().getTableName(); if (tableName.equals(TEST_TABLE)) { return table; } } throw new IllegalStateException(); } } |
From: <mla...@us...> - 2003-10-10 21:12:42
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml In directory sc8-pr-cvs1:/tmp/cvs-serv13962/src/test/org/dbunit/dataset/xml Modified Files: FlatDtdProducerTest.java FlatXmlProducerTest.java XmlProducerTest.java Log Message: Moved Streaming dataset related classes to the 'org.dbunit.dataset.stream' package. Index: FlatDtdProducerTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml/FlatDtdProducerTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FlatDtdProducerTest.java 19 Jun 2003 03:17:17 -0000 1.2 --- FlatDtdProducerTest.java 10 Oct 2003 21:12:37 -0000 1.3 *************** *** 21,28 **** package org.dbunit.dataset.xml; ! import org.dbunit.dataset.AbstractProducerTest; import org.dbunit.dataset.Column; ! import org.dbunit.dataset.IDataSetProducer; ! import org.dbunit.dataset.MockDataSetConsumer; import org.xml.sax.InputSource; --- 21,28 ---- package org.dbunit.dataset.xml; ! import org.dbunit.dataset.stream.AbstractProducerTest; import org.dbunit.dataset.Column; ! import org.dbunit.dataset.stream.IDataSetProducer; ! import org.dbunit.dataset.stream.MockDataSetConsumer; import org.xml.sax.InputSource; Index: FlatXmlProducerTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml/FlatXmlProducerTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FlatXmlProducerTest.java 19 Jun 2003 03:17:17 -0000 1.2 --- FlatXmlProducerTest.java 10 Oct 2003 21:12:37 -0000 1.3 *************** *** 21,28 **** package org.dbunit.dataset.xml; ! import org.dbunit.dataset.AbstractProducerTest; import org.dbunit.dataset.Column; ! import org.dbunit.dataset.IDataSetProducer; ! import org.dbunit.dataset.MockDataSetConsumer; import org.dbunit.dataset.DefaultDataSet; import org.dbunit.dataset.DefaultTable; --- 21,28 ---- package org.dbunit.dataset.xml; ! import org.dbunit.dataset.stream.AbstractProducerTest; import org.dbunit.dataset.Column; ! import org.dbunit.dataset.stream.IDataSetProducer; ! import org.dbunit.dataset.stream.MockDataSetConsumer; import org.dbunit.dataset.DefaultDataSet; import org.dbunit.dataset.DefaultTable; Index: XmlProducerTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml/XmlProducerTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** XmlProducerTest.java 19 Jun 2003 03:17:17 -0000 1.2 --- XmlProducerTest.java 10 Oct 2003 21:12:37 -0000 1.3 *************** *** 21,29 **** package org.dbunit.dataset.xml; ! import org.dbunit.dataset.AbstractProducerTest; import org.dbunit.dataset.Column; import org.dbunit.dataset.DataSetException; ! import org.dbunit.dataset.IDataSetProducer; ! import org.dbunit.dataset.MockDataSetConsumer; import org.dbunit.dataset.datatype.DataType; --- 21,29 ---- package org.dbunit.dataset.xml; ! import org.dbunit.dataset.stream.AbstractProducerTest; import org.dbunit.dataset.Column; import org.dbunit.dataset.DataSetException; ! import org.dbunit.dataset.stream.IDataSetProducer; ! import org.dbunit.dataset.stream.MockDataSetConsumer; import org.dbunit.dataset.datatype.DataType; |
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/stream In directory sc8-pr-cvs1:/tmp/cvs-serv13962/src/java/org/dbunit/dataset/stream Added Files: DataSetProducerAdapter.java DefaultConsumer.java IDataSetConsumer.java IDataSetProducer.java StreamingDataSet.java StreamingIterator.java Log Message: Moved Streaming dataset related classes to the 'org.dbunit.dataset.stream' package. --- NEW FILE: DataSetProducerAdapter.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.stream; import org.dbunit.dataset.stream.IDataSetProducer; import org.dbunit.dataset.stream.IDataSetConsumer; import org.dbunit.dataset.ITableIterator; import org.dbunit.dataset.IDataSet; import org.dbunit.dataset.DataSetException; import org.dbunit.dataset.ITable; import org.dbunit.dataset.ITableMetaData; import org.dbunit.dataset.Column; import org.dbunit.dataset.RowOutOfBoundsException; /** * @author Manuel Laflamme * @since Apr 17, 2003 * @version $Revision: 1.1 $ */ public class DataSetProducerAdapter implements IDataSetProducer { private static final IDataSetConsumer EMPTY_CONSUMER = new DefaultConsumer(); private final ITableIterator _iterator; private IDataSetConsumer _consumer = EMPTY_CONSUMER; public DataSetProducerAdapter(ITableIterator iterator) { _iterator = iterator; } public DataSetProducerAdapter(IDataSet dataSet) throws DataSetException { _iterator = dataSet.iterator(); } //////////////////////////////////////////////////////////////////////////// // IDataSetProducer interface public void setConsumer(IDataSetConsumer consumer) throws DataSetException { _consumer = consumer; } public void produce() throws DataSetException { _consumer.startDataSet(); while(_iterator.next()) { ITable table = _iterator.getTable(); ITableMetaData metaData = table.getTableMetaData(); _consumer.startTable(metaData); try { Column[] columns = metaData.getColumns(); if (columns.length == 0) { _consumer.endTable(); continue; } for (int i = 0; ; i++) { Object[] values = new Object[columns.length]; for (int j = 0; j < columns.length; j++) { Column column = columns[j]; values[j] = table.getValue(i, column.getColumnName()); } _consumer.row(values); } } catch (RowOutOfBoundsException e) { // end of table _consumer.endTable(); } } _consumer.endDataSet(); } } --- NEW FILE: DefaultConsumer.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.stream; import org.dbunit.dataset.stream.IDataSetConsumer; import org.dbunit.dataset.DataSetException; import org.dbunit.dataset.ITableMetaData; /** * This class provides no op implementations for all of the callbacks in the * {@link org.dbunit.dataset.stream.IDataSetConsumer} interface. * * @author Manuel Laflamme * @since Apr 29, 2003 * @version $Revision: 1.1 $ */ public class DefaultConsumer implements IDataSetConsumer { public void startDataSet() throws DataSetException { // no op } public void endDataSet() throws DataSetException { // no op } public void startTable(ITableMetaData metaData) throws DataSetException { // no op } public void endTable() throws DataSetException { // no op } public void row(Object[] values) throws DataSetException { // no op } } --- NEW FILE: IDataSetConsumer.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.stream; import org.dbunit.dataset.DataSetException; import org.dbunit.dataset.ITableMetaData; /** * Receive notification of the content of a dataset. * * @author Manuel Laflamme * @since Apr 17, 2003 * @version $Revision: 1.1 $ */ public interface IDataSetConsumer { /** * Receive notification of the beginning of a dataset. This method is * invoked only once, before any other methods in this interface. */ public void startDataSet() throws DataSetException; /** * Receive notification of the end of a dataset. This method is invoked only * once, and it will be the last method invoked in this interface. */ public void endDataSet() throws DataSetException; /** * Receive notification of the beginning of a table. This method is invoked * at the beginning of every table in the dataset; there will be a * corresponding {@link #endDataSet} event for every <code>startTable</code> * event (even when the table is empty). * @param metaData the table metadata */ public void startTable(ITableMetaData metaData) throws DataSetException; /** * Receive notification of the end of a table. */ public void endTable() throws DataSetException; /** * Receive notification of a table row. This method is invoked to report * each row of a table. * @param values The row values. */ public void row(Object[] values) throws DataSetException; } --- NEW FILE: IDataSetProducer.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.stream; import org.dbunit.dataset.DataSetException; /** * Interface for reading a dataset using callback. * * @author Manuel Laflamme * @since Apr 17, 2003 * @version $Revision: 1.1 $ */ public interface IDataSetProducer { public void setConsumer(IDataSetConsumer consumer) throws DataSetException; /** * Process this dataset source. During the processing, the IDataSetProducer * will provide information about the dataset through the specified event * listener. * <p> * This method is synchronous: it will not return until processing has ended. * If a client application wants to terminate parsing early, it should * throw an exception from the listener. */ public void produce() throws DataSetException; } --- NEW FILE: StreamingDataSet.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.stream; import org.dbunit.dataset.AbstractDataSet; import org.dbunit.dataset.DataSetException; import org.dbunit.dataset.ITable; import org.dbunit.dataset.ITableIterator; import org.dbunit.dataset.ITableMetaData; import org.dbunit.dataset.stream.StreamingIterator; /** * @author Manuel Laflamme * @since Apr 18, 2003 * @version $Revision: 1.1 $ */ public class StreamingDataSet extends AbstractDataSet { private IDataSetProducer _source; private int _iteratorCount; public StreamingDataSet(IDataSetProducer source) { _source = source; } //////////////////////////////////////////////////////////////////////////// // AbstractDataSet class protected ITableIterator createIterator(boolean reversed) throws DataSetException { if (reversed) { throw new UnsupportedOperationException( "Reverse iterator not supported!"); } if (_iteratorCount > 0) { throw new UnsupportedOperationException( "Only one iterator allowed!"); } _iteratorCount++; return new StreamingIterator(_source); } //////////////////////////////////////////////////////////////////////////// // IDataSet interface public String[] getTableNames() throws DataSetException { throw new UnsupportedOperationException(); } public ITableMetaData getTableMetaData(String tableName) throws DataSetException { throw new UnsupportedOperationException(); } public ITable getTable(String tableName) throws DataSetException { throw new UnsupportedOperationException(); } } --- NEW FILE: StreamingIterator.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.stream; import org.dbunit.DatabaseUnitRuntimeException; import org.dbunit.dataset.AbstractTable; import org.dbunit.dataset.DataSetException; import org.dbunit.dataset.ITable; import org.dbunit.dataset.ITableIterator; import org.dbunit.dataset.ITableMetaData; import org.dbunit.dataset.RowOutOfBoundsException; import org.dbunit.util.concurrent.BoundedBuffer; import org.dbunit.util.concurrent.Channel; import org.dbunit.util.concurrent.Puttable; import org.dbunit.util.concurrent.Takable; /** * @author Manuel Laflamme * @since Apr 17, 2003 * @version $Revision: 1.1 $ */ public class StreamingIterator implements ITableIterator { private static final Object EOD = new Object(); // end of dataset marker private final Takable _channel; private StreamingTable _activeTable; private Object _taken = null; private boolean _eod = false; public StreamingIterator(IDataSetProducer source) throws DataSetException { Channel channel = new BoundedBuffer(30); _channel = channel; AsynchronousConsumer consumer = new AsynchronousConsumer(source, channel); Thread thread = new Thread(consumer); thread.setDaemon(true); thread.start(); // Take first element from asyncronous handler try { _taken = _channel.take(); } catch (InterruptedException e) { throw new DataSetException(e); } } //////////////////////////////////////////////////////////////////////////// // ITableIterator interface public boolean next() throws DataSetException { // End of dataset has previously been reach if (_eod) { return false; } // Iterate to the end of current table. while (_activeTable != null && _activeTable.next()) ; // End of dataset is reach if (_taken == EOD) { _eod = true; _activeTable = null; // System.out.println("End of iterator! - " + System.currentTimeMillis()); return false; } // New table if (_taken instanceof ITableMetaData) { _activeTable = new StreamingTable((ITableMetaData)_taken); return true; } throw new IllegalStateException( "Unexpected object taken from asyncronous handler: " + _taken); } public ITableMetaData getTableMetaData() throws DataSetException { return _activeTable.getTableMetaData(); } public ITable getTable() throws DataSetException { return _activeTable; } //////////////////////////////////////////////////////////////////////////// // StreamingTable class private class StreamingTable extends AbstractTable { private ITableMetaData _metaData; private int _lastRow = -1; private boolean _eot = false; private Object[] _rowValues; public StreamingTable(ITableMetaData metaData) { _metaData = metaData; } boolean next() throws DataSetException { // End of table has previously been reach if (_eot) { return false; } try { _taken = _channel.take(); if (!(_taken instanceof Object[])) { _eot = true; return false; } _lastRow++; _rowValues = (Object[])_taken; return true; } catch (InterruptedException e) { throw new DataSetException(); } } //////////////////////////////////////////////////////////////////////// // ITable interface public ITableMetaData getTableMetaData() { return _metaData; } public int getRowCount() { throw new UnsupportedOperationException(); } public Object getValue(int row, String column) throws DataSetException { // Iterate up to specified row while (!_eot && row > _lastRow) { next(); } if (row < _lastRow) { throw new UnsupportedOperationException("Cannot go backward!"); } if (_eot || row > _lastRow) { throw new RowOutOfBoundsException(row + " > " + _lastRow); } return _rowValues[getColumnIndex(column)]; } } //////////////////////////////////////////////////////////////////////////// // AsynchronousConsumer class private static class AsynchronousConsumer implements Runnable, IDataSetConsumer { private final IDataSetProducer _producer; private final Puttable _channel; public AsynchronousConsumer(IDataSetProducer source, Puttable channel) { _producer = source; _channel = channel; } //////////////////////////////////////////////////////////////////////// // Runnable interface public void run() { try { _producer.setConsumer(this); _producer.produce(); // System.out.println("End of thread! - " + System.currentTimeMillis()); } catch (DataSetException e) { throw new DatabaseUnitRuntimeException(e); } } //////////////////////////////////////////////////////////////////////// // IDataSetConsumer interface public void startDataSet() throws DataSetException { } public void endDataSet() throws DataSetException { try { _channel.put(EOD); } catch (InterruptedException e) { throw new DataSetException(); } } public void startTable(ITableMetaData metaData) throws DataSetException { try { _channel.put(metaData); } catch (InterruptedException e) { throw new DataSetException(); } } public void endTable() throws DataSetException { } public void row(Object[] values) throws DataSetException { try { _channel.put(values); } catch (InterruptedException e) { throw new DataSetException(); } } } } |
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml In directory sc8-pr-cvs1:/tmp/cvs-serv13962/src/java/org/dbunit/dataset/xml Modified Files: FlatDtdDataSet.java FlatDtdProducer.java FlatXmlProducer.java FlatXmlWriter.java XmlDataSetWriter.java XmlProducer.java Log Message: Moved Streaming dataset related classes to the 'org.dbunit.dataset.stream' package. Index: FlatDtdDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/FlatDtdDataSet.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** FlatDtdDataSet.java 9 Aug 2003 11:23:21 -0000 1.9 --- FlatDtdDataSet.java 10 Oct 2003 21:12:37 -0000 1.10 *************** *** 28,33 **** import org.dbunit.dataset.DefaultTableIterator; import org.dbunit.dataset.IDataSet; ! import org.dbunit.dataset.IDataSetConsumer; ! import org.dbunit.dataset.IDataSetProducer; import org.dbunit.dataset.ITable; import org.dbunit.dataset.ITableIterator; --- 28,33 ---- import org.dbunit.dataset.DefaultTableIterator; import org.dbunit.dataset.IDataSet; ! import org.dbunit.dataset.stream.IDataSetConsumer; ! import org.dbunit.dataset.stream.IDataSetProducer; import org.dbunit.dataset.ITable; import org.dbunit.dataset.ITableIterator; Index: FlatDtdProducer.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/FlatDtdProducer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FlatDtdProducer.java 19 Jun 2003 03:17:16 -0000 1.2 --- FlatDtdProducer.java 10 Oct 2003 21:12:37 -0000 1.3 *************** *** 23,30 **** import org.dbunit.dataset.Column; import org.dbunit.dataset.DataSetException; ! import org.dbunit.dataset.DefaultConsumer; import org.dbunit.dataset.DefaultTableMetaData; ! import org.dbunit.dataset.IDataSetConsumer; ! import org.dbunit.dataset.IDataSetProducer; import org.dbunit.dataset.datatype.DataType; --- 23,30 ---- import org.dbunit.dataset.Column; import org.dbunit.dataset.DataSetException; ! import org.dbunit.dataset.stream.DefaultConsumer; import org.dbunit.dataset.DefaultTableMetaData; ! import org.dbunit.dataset.stream.IDataSetConsumer; ! import org.dbunit.dataset.stream.IDataSetProducer; import org.dbunit.dataset.datatype.DataType; Index: FlatXmlProducer.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/FlatXmlProducer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FlatXmlProducer.java 9 Aug 2003 11:23:22 -0000 1.3 --- FlatXmlProducer.java 10 Oct 2003 21:12:37 -0000 1.4 *************** *** 29,37 **** import org.dbunit.dataset.Column; import org.dbunit.dataset.DataSetException; ! import org.dbunit.dataset.DefaultConsumer; import org.dbunit.dataset.DefaultTableMetaData; import org.dbunit.dataset.IDataSet; ! import org.dbunit.dataset.IDataSetConsumer; ! import org.dbunit.dataset.IDataSetProducer; import org.dbunit.dataset.ITableMetaData; import org.dbunit.dataset.datatype.DataType; --- 29,37 ---- import org.dbunit.dataset.Column; import org.dbunit.dataset.DataSetException; ! import org.dbunit.dataset.stream.DefaultConsumer; import org.dbunit.dataset.DefaultTableMetaData; import org.dbunit.dataset.IDataSet; ! import org.dbunit.dataset.stream.IDataSetConsumer; ! import org.dbunit.dataset.stream.IDataSetProducer; import org.dbunit.dataset.ITableMetaData; import org.dbunit.dataset.datatype.DataType; Index: FlatXmlWriter.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/FlatXmlWriter.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FlatXmlWriter.java 8 Sep 2003 21:05:23 -0000 1.3 --- FlatXmlWriter.java 10 Oct 2003 21:12:37 -0000 1.4 *************** *** 23,29 **** import org.dbunit.dataset.Column; import org.dbunit.dataset.DataSetException; ! import org.dbunit.dataset.DataSetProducerAdapter; import org.dbunit.dataset.IDataSet; ! import org.dbunit.dataset.IDataSetConsumer; import org.dbunit.dataset.ITableMetaData; import org.dbunit.dataset.datatype.DataType; --- 23,29 ---- import org.dbunit.dataset.Column; import org.dbunit.dataset.DataSetException; ! import org.dbunit.dataset.stream.DataSetProducerAdapter; import org.dbunit.dataset.IDataSet; ! import org.dbunit.dataset.stream.IDataSetConsumer; import org.dbunit.dataset.ITableMetaData; import org.dbunit.dataset.datatype.DataType; Index: XmlDataSetWriter.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/XmlDataSetWriter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** XmlDataSetWriter.java 19 Jun 2003 03:17:16 -0000 1.2 --- XmlDataSetWriter.java 10 Oct 2003 21:12:37 -0000 1.3 *************** *** 23,29 **** import org.dbunit.dataset.Column; import org.dbunit.dataset.DataSetException; ! import org.dbunit.dataset.DataSetProducerAdapter; import org.dbunit.dataset.IDataSet; ! import org.dbunit.dataset.IDataSetConsumer; import org.dbunit.dataset.ITable; import org.dbunit.dataset.ITableMetaData; --- 23,29 ---- import org.dbunit.dataset.Column; import org.dbunit.dataset.DataSetException; ! import org.dbunit.dataset.stream.DataSetProducerAdapter; import org.dbunit.dataset.IDataSet; ! import org.dbunit.dataset.stream.IDataSetConsumer; import org.dbunit.dataset.ITable; import org.dbunit.dataset.ITableMetaData; Index: XmlProducer.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/xml/XmlProducer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** XmlProducer.java 9 Aug 2003 11:23:22 -0000 1.3 --- XmlProducer.java 10 Oct 2003 21:12:37 -0000 1.4 *************** *** 31,38 **** import org.dbunit.dataset.Column; import org.dbunit.dataset.DataSetException; ! import org.dbunit.dataset.DefaultConsumer; import org.dbunit.dataset.DefaultTableMetaData; ! import org.dbunit.dataset.IDataSetConsumer; ! import org.dbunit.dataset.IDataSetProducer; import org.dbunit.dataset.ITable; import org.dbunit.dataset.ITableMetaData; --- 31,38 ---- import org.dbunit.dataset.Column; import org.dbunit.dataset.DataSetException; ! import org.dbunit.dataset.stream.DefaultConsumer; import org.dbunit.dataset.DefaultTableMetaData; ! import org.dbunit.dataset.stream.IDataSetConsumer; ! import org.dbunit.dataset.stream.IDataSetProducer; import org.dbunit.dataset.ITable; import org.dbunit.dataset.ITableMetaData; |
From: <mla...@us...> - 2003-10-10 21:12:41
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv13962/src/java/org/dbunit/dataset Modified Files: CachedDataSet.java Removed Files: DataSetProducerAdapter.java DefaultConsumer.java IDataSetConsumer.java IDataSetProducer.java StreamingDataSet.java StreamingIterator.java Log Message: Moved Streaming dataset related classes to the 'org.dbunit.dataset.stream' package. Index: CachedDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/CachedDataSet.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CachedDataSet.java 19 Jun 2003 03:17:16 -0000 1.2 --- CachedDataSet.java 10 Oct 2003 21:12:37 -0000 1.3 *************** *** 21,24 **** --- 21,27 ---- package org.dbunit.dataset; + import org.dbunit.dataset.stream.IDataSetProducer; + import org.dbunit.dataset.stream.IDataSetConsumer; + import java.util.ArrayList; import java.util.List; --- DataSetProducerAdapter.java DELETED --- --- DefaultConsumer.java DELETED --- --- IDataSetConsumer.java DELETED --- --- IDataSetProducer.java DELETED --- --- StreamingDataSet.java DELETED --- --- StreamingIterator.java DELETED --- |
From: <mla...@us...> - 2003-10-10 21:12:40
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant In directory sc8-pr-cvs1:/tmp/cvs-serv13962/src/java/org/dbunit/ant Modified Files: Operation.java Log Message: Moved Streaming dataset related classes to the 'org.dbunit.dataset.stream' package. Index: Operation.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant/Operation.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Operation.java 16 Sep 2003 02:50:37 -0000 1.8 --- Operation.java 10 Oct 2003 21:12:37 -0000 1.9 *************** *** 26,31 **** import org.dbunit.database.IDatabaseConnection; import org.dbunit.dataset.IDataSet; ! import org.dbunit.dataset.IDataSetProducer; ! import org.dbunit.dataset.StreamingDataSet; import org.dbunit.dataset.CachedDataSet; import org.dbunit.dataset.xml.FlatXmlDataSet; --- 26,31 ---- import org.dbunit.database.IDatabaseConnection; import org.dbunit.dataset.IDataSet; ! import org.dbunit.dataset.stream.IDataSetProducer; ! import org.dbunit.dataset.stream.StreamingDataSet; import org.dbunit.dataset.CachedDataSet; import org.dbunit.dataset.xml.FlatXmlDataSet; |
From: <mla...@us...> - 2003-10-10 20:58:33
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/stream In directory sc8-pr-cvs1:/tmp/cvs-serv10701/stream Log Message: Directory /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/stream added to the repository |
From: <mla...@us...> - 2003-10-10 20:58:24
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/stream In directory sc8-pr-cvs1:/tmp/cvs-serv10667/stream Log Message: Directory /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/stream added to the repository |
From: <mla...@us...> - 2003-10-10 20:33:36
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant In directory sc8-pr-cvs1:/tmp/cvs-serv4999/src/java/org/dbunit/ant Modified Files: Export.java Log Message: Use OutputStream instead of Writer. Index: Export.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant/Export.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Export.java 16 Sep 2003 05:08:30 -0000 1.10 --- Export.java 10 Oct 2003 20:29:48 -0000 1.11 *************** *** 25,33 **** import org.dbunit.DatabaseUnitException; import org.dbunit.database.IDatabaseConnection; - import org.dbunit.database.DatabaseConfig; - import org.dbunit.database.ForwardOnlyResultSetTableFactory; - import org.dbunit.database.CachedResultSetTableFactory; import org.dbunit.database.QueryDataSet; ! import org.dbunit.dataset.*; import org.dbunit.dataset.xml.FlatDtdDataSet; import org.dbunit.dataset.xml.FlatXmlDataSet; --- 25,30 ---- import org.dbunit.DatabaseUnitException; import org.dbunit.database.IDatabaseConnection; import org.dbunit.database.QueryDataSet; ! import org.dbunit.dataset.IDataSet; import org.dbunit.dataset.xml.FlatDtdDataSet; import org.dbunit.dataset.xml.FlatXmlDataSet; *************** *** 35,41 **** import java.io.File; ! import java.io.FileWriter; import java.io.IOException; ! import java.io.Writer; import java.sql.SQLException; import java.util.ArrayList; --- 32,38 ---- import java.io.File; ! import java.io.FileOutputStream; import java.io.IOException; ! import java.io.OutputStream; import java.sql.SQLException; import java.util.ArrayList; *************** *** 62,66 **** private String _format = FORMAT_FLAT; private List _tables = new ArrayList(); - private boolean _hasQuery = false; public Export() --- 59,62 ---- *************** *** 115,119 **** { _tables.add(query); - _hasQuery = true; } --- 111,114 ---- *************** *** 156,160 **** // Write the dataset ! Writer out = new FileWriter(_dest); try { --- 151,155 ---- // Write the dataset ! OutputStream out = new FileOutputStream(_dest); try { |
From: <fsp...@us...> - 2003-10-10 14:12:17
|
Update of /cvsroot/dbunit/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv29065 Modified Files: project.xml Log Message: Added myself as a developer in the developers list (:-) Index: project.xml =================================================================== RCS file: /cvsroot/dbunit/dbunit/project.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** project.xml 10 Oct 2003 09:51:16 -0000 1.7 --- project.xml 10 Oct 2003 14:12:06 -0000 1.8 *************** *** 86,89 **** --- 86,96 ---- <role>Java Developer</role> </roles> + <name>Federico Spinazzi</name> + <id>fspinazzi</id> + <email>f.s...@ma...</email> + <organization>MH</organization> + <roles> + <role>Java Developer</role> + </roles> </developer> </developers> |
From: <mla...@us...> - 2003-10-09 18:42:57
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype In directory sc8-pr-cvs1:/tmp/cvs-serv20415/src/java/org/dbunit/dataset/datatype Modified Files: BytesDataType.java Log Message: Fixed Oracle BLOB issue. Index: BytesDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/BytesDataType.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** BytesDataType.java 17 May 2003 15:38:52 -0000 1.10 --- BytesDataType.java 9 Oct 2003 18:42:53 -0000 1.11 *************** *** 149,152 **** --- 149,158 ---- throws SQLException, TypeCastException { + // Special BLOB handling + if (this == DataType.BLOB) + { + return typeCast(resultSet.getBlob(column)); + } + return resultSet.getBytes(column); } |
From: <mla...@us...> - 2003-10-09 18:42:25
|
Update of /cvsroot/dbunit/dbunit/src/sql In directory sc8-pr-cvs1:/tmp/cvs-serv20367/src/sql Added Files: oracle.sql Log Message: DDL for Oracle. --- NEW FILE: oracle.sql --- ----------------------------------------------------------------------------- -- TEST_TABLE ----------------------------------------------------------------------------- CREATE TABLE TEST_TABLE (COLUMN0 VARCHAR2(32), COLUMN1 VARCHAR2(32), COLUMN2 VARCHAR2(32), COLUMN3 VARCHAR2(32)); ----------------------------------------------------------------------------- -- SECOND_TABLE ----------------------------------------------------------------------------- CREATE TABLE SECOND_TABLE (COLUMN0 VARCHAR2(32), COLUMN1 VARCHAR2(32), COLUMN2 VARCHAR2(32), COLUMN3 VARCHAR2(32)); ----------------------------------------------------------------------------- -- EMPTY_TABLE ----------------------------------------------------------------------------- CREATE TABLE EMPTY_TABLE (COLUMN0 VARCHAR2(32), COLUMN1 VARCHAR2(32), COLUMN2 VARCHAR2(32), COLUMN3 VARCHAR2(32)); ----------------------------------------------------------------------------- -- PK_TABLE ----------------------------------------------------------------------------- CREATE TABLE PK_TABLE (PK0 NUMERIC(38, 0) NOT NULL, PK1 NUMERIC(38, 0) NOT NULL, PK2 NUMERIC(38, 0) NOT NULL, NORMAL0 VARCHAR2(32), NORMAL1 VARCHAR2(32), PRIMARY KEY (PK0, PK1, PK2)); ----------------------------------------------------------------------------- -- ONLY_PK_TABLE ----------------------------------------------------------------------------- CREATE TABLE ONLY_PK_TABLE (PK0 NUMERIC(38, 0) NOT NULL PRIMARY KEY); ----------------------------------------------------------------------------- -- EMPTY_MULTITYPE_TABLE ----------------------------------------------------------------------------- CREATE TABLE EMPTY_MULTITYPE_TABLE (VARCHAR_COL VARCHAR2(32), NUMERIC_COL NUMERIC(38, 0), TIMESTAMP_COL DATE, VARBINARY_COL RAW(255)); ----------------------------------------------------------------------------- -- CLOB_TABLE ----------------------------------------------------------------------------- CREATE TABLE CLOB_TABLE (PK NUMERIC(38, 0) NOT NULL, CLOB CLOB, PRIMARY KEY (PK)); ----------------------------------------------------------------------------- -- BLOB_TABLE ----------------------------------------------------------------------------- CREATE TABLE BLOB_TABLE (PK NUMERIC(38, 0) NOT NULL, BLOB BLOB, PRIMARY KEY (PK)); |
From: <mla...@us...> - 2003-10-09 17:48:50
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/ext/oracle In directory sc8-pr-cvs1:/tmp/cvs-serv4334/src/java/org/dbunit/ext/oracle Modified Files: OracleDataTypeFactory.java Log Message: Added support for NVARCHAR2 in OracleDataTypeFactory Index: OracleDataTypeFactory.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/ext/oracle/OracleDataTypeFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** OracleDataTypeFactory.java 3 Sep 2003 20:04:42 -0000 1.3 --- OracleDataTypeFactory.java 9 Oct 2003 17:48:37 -0000 1.4 *************** *** 53,56 **** --- 53,62 ---- } + // NVARCHAR2 + if ("NVARCHAR2".equals(sqlTypeName)) + { + return DataType.VARCHAR; + } + // TIMESTAMP if (sqlTypeName.startsWith("TIMESTAMP")) |
From: <mla...@us...> - 2003-10-09 17:48:41
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype In directory sc8-pr-cvs1:/tmp/cvs-serv4334/src/java/org/dbunit/dataset/datatype Modified Files: DefaultDataTypeFactory.java Log Message: Added support for NVARCHAR2 in OracleDataTypeFactory Index: DefaultDataTypeFactory.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/DefaultDataTypeFactory.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DefaultDataTypeFactory.java 1 Aug 2003 02:29:11 -0000 1.3 --- DefaultDataTypeFactory.java 9 Oct 2003 17:48:37 -0000 1.4 *************** *** 42,47 **** { // Necessary for compatibility with DbUnit 1.5 and older - /* - // BLOB if ("BLOB".equals(sqlTypeName)) --- 42,45 ---- *************** *** 55,59 **** return DataType.CLOB; } - */ } return dataType; --- 53,56 ---- |
From: <mla...@us...> - 2003-10-06 01:20:56
|
Update of /cvsroot/dbunit/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv32550 Modified Files: Tag: branch-1-5 build.properties Log Message: DbUnit 1.5.6 Index: build.properties =================================================================== RCS file: /cvsroot/dbunit/dbunit/build.properties,v retrieving revision 1.8.2.2 retrieving revision 1.8.2.3 diff -C2 -d -r1.8.2.2 -r1.8.2.3 *** build.properties 15 Jul 2003 20:54:43 -0000 1.8.2.2 --- build.properties 6 Oct 2003 01:20:52 -0000 1.8.2.3 *************** *** 1,3 **** ! version = 1.5.5 --- 1,3 ---- ! version = 1.5.6 |
From: <mla...@us...> - 2003-10-06 01:08:27
|
Update of /cvsroot/dbunit/dbunit/docs In directory sc8-pr-cvs1:/tmp/cvs-serv31182/docs Modified Files: Tag: branch-1-5 changes.html components.html download.html faq.html howto.html index.html properties.html resources.html Log Message: DbUnit 1.5.6 Index: changes.html =================================================================== RCS file: /cvsroot/dbunit/dbunit/docs/changes.html,v retrieving revision 1.27.2.5 retrieving revision 1.27.2.6 diff -C2 -d -r1.27.2.5 -r1.27.2.6 *** changes.html 16 Jul 2003 21:13:44 -0000 1.27.2.5 --- changes.html 6 Oct 2003 01:08:18 -0000 1.27.2.6 *************** *** 45,48 **** --- 45,61 ---- <td class="body" valign="top"> <!-- #BeginEditable "body" --> <h2>History of Changes</h2> + <a name="1.5.6"> + <h3>Version 1.5.6 (October 5, 2003)</h3> + </a> + <ul> + <li>Bugfixes:</li> + <ul> + <li> + <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=786543&group_id=47439&atid=449491">786543</a> + - NULL primitive values incorrectly returned as zero (0). + </li> + <li>Not NULL Oracle CLOB values incorrectly returned as NULL.</li> + </ul> + </ul> <a name="1.5.5"> <h3>Version 1.5.5 (July 16, 2003)</h3> Index: components.html =================================================================== RCS file: /cvsroot/dbunit/dbunit/docs/components.html,v retrieving revision 1.19 retrieving revision 1.19.2.1 diff -C2 -d -r1.19 -r1.19.2.1 *** components.html 26 Feb 2003 22:52:47 -0000 1.19 --- components.html 6 Oct 2003 01:08:18 -0000 1.19.2.1 *************** *** 62,71 **** <ul> <li><a href="#XmlDataSet">XmlDataSet</a></li> ! <li><a href="#FlatXmlDataSet">FlatXmlDataSet</a> <font color="#FF0000">(updated)</font></li> <li><a href="#DatabaseDataSet">DatabaseDataSet</a></li> <li><a href="#DefaultDataSet">DefaultDataSet</a></li> <li><a href="#CompositeDataSet">CompositeDataSet</a></li> <li><a href="#FilteredDataSet">FilteredDataSet</a></li> ! <li><a href="#QueryDataSet" >QueryDataSet</a> <font color="#FF0000">(new)</font></li> </ul> The <a class="code">IDataSet</a> interface: --- 62,71 ---- <ul> <li><a href="#XmlDataSet">XmlDataSet</a></li> ! <li><a href="#FlatXmlDataSet">FlatXmlDataSet</a> <font color="#FF0000"></font></li> <li><a href="#DatabaseDataSet">DatabaseDataSet</a></li> <li><a href="#DefaultDataSet">DefaultDataSet</a></li> <li><a href="#CompositeDataSet">CompositeDataSet</a></li> <li><a href="#FilteredDataSet">FilteredDataSet</a></li> ! <li><a href="#QueryDataSet" >QueryDataSet</a> <font color="#FF0000"></font></li> </ul> The <a class="code">IDataSet</a> interface: Index: download.html =================================================================== RCS file: /cvsroot/dbunit/dbunit/docs/download.html,v retrieving revision 1.22.2.2 retrieving revision 1.22.2.3 diff -C2 -d -r1.22.2.2 -r1.22.2.3 *** download.html 15 Jul 2003 20:54:43 -0000 1.22.2.2 --- download.html 6 Oct 2003 01:08:18 -0000 1.22.2.3 *************** *** 45,52 **** <td class="body" valign="top"> <!-- #BeginEditable "body" --> <h2>Download</h2> ! <p>The current Dbunit release is version 1.5.5. The distribution archive contains the compiled classes, the java code and the java API documentation.</p> ! <p><a href="http://sourceforge.net/project/showfiles.php?group_id=47439&release_id=171703">Download ! version 1.5.5</a></p> <p>If your are not reading this page online, please visit the <a href="http://www.dbunit.org/">online version</a> of this site since a more recent version of Dbunit might be --- 45,52 ---- <td class="body" valign="top"> <!-- #BeginEditable "body" --> <h2>Download</h2> ! <p>The current Dbunit release is version 1.5.6. The distribution archive contains the compiled classes, the java code and the java API documentation.</p> ! <p><a href="http://sourceforge.net/project/showfiles.php?group_id=47439&release_id=189117">Download ! version 1.5.6</a></p> <p>If your are not reading this page online, please visit the <a href="http://www.dbunit.org/">online version</a> of this site since a more recent version of Dbunit might be Index: faq.html =================================================================== RCS file: /cvsroot/dbunit/dbunit/docs/faq.html,v retrieving revision 1.21 retrieving revision 1.21.2.1 diff -C2 -d -r1.21 -r1.21.2.1 *** faq.html 26 Feb 2003 22:52:46 -0000 1.21 --- faq.html 6 Oct 2003 01:08:18 -0000 1.21.2.1 *************** *** 55,58 **** --- 55,59 ---- <li><a href="#AmbiguousTableNameException">Why do I get a AmbiguousTableNameException?</a></li> <li><a href="#flatxmlnull">How to specify NULL values with flat XML dataset?</a> + <li><a href="#p6spy">How to see SQL statements issued by DbUnit using P6Spy?</a></li> <font color="#FF0000">(new)</font> </li> </ul> *************** *** 106,109 **** --- 107,134 ---- <h3><a name="flatxmlnull">How to specify NULL values with flat XML dataset</a></h3> <p>See FlatXmlDataSet documentation <a href="components.html#FlatXmlDataSet">here</a>.</p> + <h3><a name="p6spy">How to see SQL statements issued by DbUnit using P6Spy?</a></h3> + <p><cite>p6spy</cite> is a trasparent JDBC proxy-driver + specialized to log the statements performed against the actual driver you normally would use. + Using p6spy would allow to log the SQL statements issued by DbUnit. + See more at (<a href="http://www.p6spy.com">www.p6spy.com</a>). It could be useful to stick with version 1.1 + as 1.2 as some reported minor problems.</p> + <p>To install P6Spy, complete the following steps: + <ol> + <li>Put the p6spy.jar file in your classpath. + <li>Move spy.properties into a directory listed in your classpath. Unlike + JAR files, you do not directly reference your property file in the + classpath (e.g.: if you have the file c:\r\proj\confspy.properties make sure you + put c:\r\proj\conf in the classpath). + <li>Modify your application to use the P6Spy database driver i.e. + com.p6spy.engine.spy.P6SpyDriver. + <li>Modify the realdriver line in the spy.properties file to reflect the + wrapped database driver. An example of a modified realdriver line follows: + realdriver = oracle.jdbc.driver.OracleDriver + </ol> + Installation is complete. When you run your application, a spy.log file is + generated in the same directory from where you run the application. + The log file contains a list of all of the database statements + executed. You can change both the destination of spy.log and what it logs by + editing the spy.properties file.</p> <!-- #EndEditable --> <hr> Index: howto.html =================================================================== RCS file: /cvsroot/dbunit/dbunit/docs/howto.html,v retrieving revision 1.23 retrieving revision 1.23.2.1 diff -C2 -d -r1.23 -r1.23.2.1 *** howto.html 1 Mar 2003 16:02:31 -0000 1.23 --- howto.html 6 Oct 2003 01:08:18 -0000 1.23.2.1 *************** *** 53,60 **** schema</a></li> <li><a href="#assertdata">How to verify that your database contains expected ! data</a> <font color="#FF0000">(updated)</font></li> <li><a href="#multipleschema">How to export data from or import data to multiple database schemas</a></li> ! <li><a href="#canoo">How to Use DbUnit with Canoo WebTest </a> <font color="#FF0000">(new)</font></li> </ul> <hr> --- 53,60 ---- schema</a></li> <li><a href="#assertdata">How to verify that your database contains expected ! data</a> <font color="#FF0000"></font></li> <li><a href="#multipleschema">How to export data from or import data to multiple database schemas</a></li> ! <li><a href="#canoo">How to Use DbUnit with Canoo WebTest </a> <font color="#FF0000"></font></li> </ul> <hr> *************** *** 261,265 **** // Assert actual database table match expected table ! Assertion.assertEquals(expectedTable, databaseTable); } }</pre> --- 261,265 ---- // Assert actual database table match expected table ! Assertion.assertEquals(expectedTable, actualTable); } }</pre> Index: index.html =================================================================== RCS file: /cvsroot/dbunit/dbunit/docs/index.html,v retrieving revision 1.28.2.4 retrieving revision 1.28.2.5 diff -C2 -d -r1.28.2.4 -r1.28.2.5 *** index.html 16 Jul 2003 21:13:44 -0000 1.28.2.4 --- index.html 6 Oct 2003 01:08:18 -0000 1.28.2.5 *************** *** 59,62 **** --- 59,63 ---- </a> <ul> + <li>2003-10-05 - Version 1.5.6 released. See <a href="changes.html#1.5.6">changes</a>.</li> <li>2003-07-16 - Federico Spinazzi joined the DbUnit developement team.</li> <li>2003-07-16 - Version 1.5.5 released. See <a href="changes.html#1.5.5">changes</a>.</li> Index: properties.html =================================================================== RCS file: /cvsroot/dbunit/dbunit/docs/properties.html,v retrieving revision 1.3 retrieving revision 1.3.2.1 diff -C2 -d -r1.3 -r1.3.2.1 *** properties.html 24 Feb 2003 01:40:18 -0000 1.3 --- properties.html 6 Oct 2003 01:08:18 -0000 1.3.2.1 *************** *** 91,95 **** </tr> </table> ! <h3><a name=escapepattern></a>dbunit.name.escapePattern <font color="#FF0000">(new)</font></h3> <table border="1"> <tr> --- 91,95 ---- </tr> </table> ! <h3><a name=escapepattern></a>dbunit.name.escapePattern <font color="#FF0000"></font></h3> <table border="1"> <tr> Index: resources.html =================================================================== RCS file: /cvsroot/dbunit/dbunit/docs/resources.html,v retrieving revision 1.15.2.1 retrieving revision 1.15.2.2 diff -C2 -d -r1.15.2.1 -r1.15.2.2 *** resources.html 4 Apr 2003 13:14:33 -0000 1.15.2.1 --- resources.html 6 Oct 2003 01:08:18 -0000 1.15.2.2 *************** *** 44,48 **** </td> <td class="body" valign="top"> <!-- #BeginEditable "body" --> ! <h2>Project Ressources</h2> <p><a href="http://sourceforge.net/projects/dbunit/">Project summary</a></p> <p><a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dbunit/">Browse --- 44,48 ---- </td> <td class="body" valign="top"> <!-- #BeginEditable "body" --> ! <h2>SourceForge Project Ressources</h2> <p><a href="http://sourceforge.net/projects/dbunit/">Project summary</a></p> <p><a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dbunit/">Browse *************** *** 52,59 **** <p></p> <p><a href="http://groups.yahoo.com/group/agileDatabases/">The Agile Database ! Mailing List</a> <font color="#FF0000">(new)</font><br> Discussion about Database management with regards to Extreme Programming practices and principles.</p> ! <p><a href="http://www.agiledata.org/">The Agile Data Home Page</a> <font color="#FF0000">(new)</font><br> Scott W. Ambler's site about Agile Data methodology. Ambler is sharing multiple techniques about data-related software development issues. Online --- 52,59 ---- <p></p> <p><a href="http://groups.yahoo.com/group/agileDatabases/">The Agile Database ! Mailing List</a> <font color="#FF0000"></font><br> Discussion about Database management with regards to Extreme Programming practices and principles.</p> ! <p><a href="http://www.agiledata.org/">The Agile Data Home Page</a> <font color="#FF0000"></font><br> Scott W. Ambler's site about Agile Data methodology. Ambler is sharing multiple techniques about data-related software development issues. Online *************** *** 62,66 **** <br> <a href="http://www.martinfowler.com/articles/evodb.html">Evolutionary ! Database Design</a> <font color="#FF0000">(new)</font><br> A Martin Fowler's white paper that describes techniques that allows a database design to evolve as an application develops<br> --- 62,66 ---- <br> <a href="http://www.martinfowler.com/articles/evodb.html">Evolutionary ! Database Design</a> <font color="#FF0000"></font><br> A Martin Fowler's white paper that describes techniques that allows a database design to evolve as an application develops<br> |
From: <mla...@us...> - 2003-09-16 12:24:12
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/database In directory sc8-pr-cvs1:/tmp/cvs-serv10850/src/test/org/dbunit/database Modified Files: QueryDataSetTest.java Log Message: Small QueryDataSet improvement: now reuse table from DatabaseDataSet when no query is specified in add() method. Index: QueryDataSetTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/database/QueryDataSetTest.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** QueryDataSetTest.java 16 Sep 2003 05:08:31 -0000 1.6 --- QueryDataSetTest.java 16 Sep 2003 12:24:08 -0000 1.7 *************** *** 82,86 **** { String name = names[i]; ! dataSet.addTable(name); } return dataSet; --- 82,98 ---- { String name = names[i]; ! String query = "select * from " + name; ! dataSet.addTable(name, query); ! /* ! if (i % 2 == 0) ! { ! String query = "select * from " + name; ! dataSet.addTable(name, query); ! } ! else ! { ! dataSet.addTable(name); ! } ! */ } return dataSet; *************** *** 97,101 **** // second table expect 0 row ! String queryNoRow = "select * from empty_table"; dataSet.addTable(names[1], queryNoRow); --- 109,113 ---- // second table expect 0 row ! String queryNoRow = "select * from empty_table"; dataSet.addTable(names[1], queryNoRow); |
From: <mla...@us...> - 2003-09-16 12:24:12
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database In directory sc8-pr-cvs1:/tmp/cvs-serv10850/src/java/org/dbunit/database Modified Files: QueryDataSet.java QueryTableIterator.java Log Message: Small QueryDataSet improvement: now reuse table from DatabaseDataSet when no query is specified in add() method. Index: QueryDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/QueryDataSet.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** QueryDataSet.java 16 Sep 2003 05:08:31 -0000 1.5 --- QueryDataSet.java 16 Sep 2003 12:24:08 -0000 1.6 *************** *** 78,89 **** public void addTable(String tableName) { ! String escapePattern = (String)_connection.getConfig().getProperty( ! DatabaseConfig.PROPERTY_ESCAPE_PATTERN); ! String schema = _connection.getSchema(); ! ! String selectStatement = "select * from " + ! DataSetUtils.getQualifiedName(schema, tableName, escapePattern); ! ! _tableEntries.add(new TableEntry(tableName, selectStatement)); } --- 78,82 ---- public void addTable(String tableName) { ! _tableEntries.add(new TableEntry(tableName, null)); } *************** *** 121,125 **** private final String _tableName; private final String _query; - private ITable _table; public TableEntry(String tableName, String query) --- 114,117 ---- *************** *** 137,150 **** { return _query; - } - - public ITable getTable() - { - return _table; - } - - public void setTable(ITable table) - { - _table = table; } } --- 129,132 ---- Index: QueryTableIterator.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/QueryTableIterator.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** QueryTableIterator.java 16 Sep 2003 05:08:31 -0000 1.1 --- QueryTableIterator.java 16 Sep 2003 12:24:08 -0000 1.2 *************** *** 69,73 **** public ITableMetaData getTableMetaData() throws DataSetException { ! return getTable().getTableMetaData(); } --- 69,91 ---- public ITableMetaData getTableMetaData() throws DataSetException { ! QueryDataSet.TableEntry entry = (QueryDataSet.TableEntry)_tableEntries.get(_index); ! ! // No query specified, use metadata from dataset ! if (entry.getQuery() == null) ! { ! try ! { ! IDataSet dataSet = _connection.createDataSet(); ! return dataSet.getTableMetaData(entry.getTableName()); ! } ! catch (SQLException e) ! { ! throw new DataSetException(e); ! } ! } ! else ! { ! return getTable().getTableMetaData(); ! } } *************** *** 80,88 **** QueryDataSet.TableEntry entry = (QueryDataSet.TableEntry)_tableEntries.get(_index); ! DatabaseConfig config = _connection.getConfig(); ! IResultSetTableFactory factory = (IResultSetTableFactory)config.getProperty( ! DatabaseConfig.PROPERTY_RESULTSET_TABLE_FACTORY); ! _currentTable = factory.createTable(entry.getTableName(), entry.getQuery(), _connection); } catch (SQLException e) --- 98,115 ---- QueryDataSet.TableEntry entry = (QueryDataSet.TableEntry)_tableEntries.get(_index); ! // No query specified, use table from dataset ! if (entry.getQuery() == null) ! { ! IDataSet dataSet = _connection.createDataSet(); ! _currentTable = (IResultSetTable)dataSet.getTable(entry.getTableName()); ! } ! else ! { ! DatabaseConfig config = _connection.getConfig(); ! IResultSetTableFactory factory = (IResultSetTableFactory)config.getProperty( ! DatabaseConfig.PROPERTY_RESULTSET_TABLE_FACTORY); ! _currentTable = factory.createTable(entry.getTableName(), entry.getQuery(), _connection); ! } } catch (SQLException e) |
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/database In directory sc8-pr-cvs1:/tmp/cvs-serv29865/src/java/org/dbunit/database Modified Files: AbstractResultSetTable.java ForwardOnlyResultSetTable.java QueryDataSet.java ScrollableResultSetTable.java Added Files: QueryTableIterator.java Log Message: Modified QueryDataSet to make is compatible with ForwardOnlyResultSet. Also modified the Ant task to make it possible to export very large dataset when using <query> tag. --- NEW FILE: QueryTableIterator.java --- /* * * The DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.database; import org.dbunit.dataset.DataSetException; import org.dbunit.dataset.ITable; import org.dbunit.dataset.ITableIterator; import org.dbunit.dataset.ITableMetaData; import org.dbunit.dataset.IDataSet; import java.util.List; import java.util.ArrayList; import java.sql.SQLException; /** * @author Manuel Laflamme * @since Sep 15, 2003 * @version $Revision: 1.1 $ */ public class QueryTableIterator implements ITableIterator { private final List _tableEntries; private final IDatabaseConnection _connection; private IResultSetTable _currentTable; private int _index = -1; public QueryTableIterator(List tableEntries, IDatabaseConnection connection) { _tableEntries = tableEntries; _connection = connection; _currentTable = null; } //////////////////////////////////////////////////////////////////////////// // ITableIterator interface public boolean next() throws DataSetException { _index++; // Ensure previous table is closed if (_currentTable != null) { _currentTable.close(); _currentTable = null; } return _index < _tableEntries.size(); } public ITableMetaData getTableMetaData() throws DataSetException { return getTable().getTableMetaData(); } public ITable getTable() throws DataSetException { if (_currentTable == null) { try { QueryDataSet.TableEntry entry = (QueryDataSet.TableEntry)_tableEntries.get(_index); DatabaseConfig config = _connection.getConfig(); IResultSetTableFactory factory = (IResultSetTableFactory)config.getProperty( DatabaseConfig.PROPERTY_RESULTSET_TABLE_FACTORY); _currentTable = factory.createTable(entry.getTableName(), entry.getQuery(), _connection); } catch (SQLException e) { throw new DataSetException(e); } } return _currentTable; } } Index: AbstractResultSetTable.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/AbstractResultSetTable.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AbstractResultSetTable.java 1 Aug 2003 02:29:10 -0000 1.3 --- AbstractResultSetTable.java 16 Sep 2003 05:08:31 -0000 1.4 *************** *** 55,59 **** public AbstractResultSetTable(String tableName, String selectStatement, ! IDatabaseConnection connection, IDataTypeFactory dataTypeFactory) throws DataSetException, SQLException { --- 55,59 ---- public AbstractResultSetTable(String tableName, String selectStatement, ! IDatabaseConnection connection) throws DataSetException, SQLException { *************** *** 61,64 **** --- 61,68 ---- _statement = jdbcConnection.createStatement(); // _statement.setFetchDirection(ResultSet.FETCH_FORWARD); + + DatabaseConfig config = connection.getConfig(); + IDataTypeFactory dataTypeFactory = (IDataTypeFactory)config.getProperty( + DatabaseConfig.PROPERTY_DATATYPE_FACTORY); try Index: ForwardOnlyResultSetTable.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/ForwardOnlyResultSetTable.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ForwardOnlyResultSetTable.java 19 May 2003 22:09:20 -0000 1.4 --- ForwardOnlyResultSetTable.java 16 Sep 2003 05:08:31 -0000 1.5 *************** *** 26,29 **** --- 26,30 ---- import org.dbunit.dataset.Column; import org.dbunit.dataset.datatype.DefaultDataTypeFactory; + import org.dbunit.dataset.datatype.IDataTypeFactory; import java.sql.ResultSet; *************** *** 55,59 **** IDatabaseConnection connection) throws DataSetException, SQLException { ! super(tableName, selectStatement, connection, new DefaultDataTypeFactory()); } --- 56,60 ---- IDatabaseConnection connection) throws DataSetException, SQLException { ! super(tableName, selectStatement, connection); } Index: QueryDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/QueryDataSet.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** QueryDataSet.java 9 Aug 2003 11:23:11 -0000 1.4 --- QueryDataSet.java 16 Sep 2003 05:08:31 -0000 1.5 *************** *** 26,29 **** --- 26,31 ---- import java.util.Iterator; import java.util.List; + import java.util.Arrays; + import java.util.Collections; import org.dbunit.dataset.AbstractDataSet; *************** *** 32,35 **** --- 34,38 ---- import org.dbunit.dataset.ITable; import org.dbunit.dataset.ITableIterator; + import org.dbunit.dataset.DataSetUtils; /** *************** *** 42,46 **** private final IDatabaseConnection _connection; ! private final List _tables = new ArrayList(); --- 45,49 ---- private final IDatabaseConnection _connection; ! private final List _tableEntries = new ArrayList(); *************** *** 65,69 **** public void addTable(String tableName, String query) { ! _tables.add(new TableEntry(tableName, query)); } --- 68,89 ---- public void addTable(String tableName, String query) { ! _tableEntries.add(new TableEntry(tableName, query)); ! } ! ! /** ! * Adds a table with using 'SELECT * FROM <code>tableName</code>' as query. ! * ! * @param tableName The name of the table ! */ ! public void addTable(String tableName) ! { ! String escapePattern = (String)_connection.getConfig().getProperty( ! DatabaseConfig.PROPERTY_ESCAPE_PATTERN); ! String schema = _connection.getSchema(); ! ! String selectStatement = "select * from " + ! DataSetUtils.getQualifiedName(schema, tableName, escapePattern); ! ! _tableEntries.add(new TableEntry(tableName, selectStatement)); } *************** *** 73,100 **** protected ITableIterator createIterator(boolean reversed) throws DataSetException { ! try ! { ! List tableList = new ArrayList(); ! for (Iterator it = _tables.iterator(); it.hasNext();) ! { ! TableEntry entry = (TableEntry)it.next(); ! ! ITable table = entry.getTable(); ! if (table == null) ! { ! table = _connection.createQueryTable( ! entry.getTableName(), entry.getQuery()); ! entry.setTable(table); ! } ! tableList.add(table); ! } ! ! ITable[] tables = (ITable[])tableList.toArray(new ITable[0]); ! return new DefaultTableIterator(tables, reversed); ! } ! catch (SQLException e) { ! throw new DataSetException(e); } } --- 93,103 ---- protected ITableIterator createIterator(boolean reversed) throws DataSetException { ! List tableEntries = new ArrayList(_tableEntries); ! if (reversed) { ! Collections.reverse(tableEntries); } + + return new QueryTableIterator(tableEntries, _connection); } *************** *** 105,109 **** { List names = new ArrayList(); ! for (Iterator it = _tables.iterator(); it.hasNext();) { TableEntry entry = (TableEntry)it.next(); --- 108,112 ---- { List names = new ArrayList(); ! for (Iterator it = _tableEntries.iterator(); it.hasNext();) { TableEntry entry = (TableEntry)it.next(); *************** *** 114,118 **** } ! private static class TableEntry { private final String _tableName; --- 117,121 ---- } ! static class TableEntry { private final String _tableName; Index: ScrollableResultSetTable.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/database/ScrollableResultSetTable.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ScrollableResultSetTable.java 19 May 2003 22:09:20 -0000 1.3 --- ScrollableResultSetTable.java 16 Sep 2003 05:08:31 -0000 1.4 *************** *** 86,90 **** IDatabaseConnection connection) throws DataSetException, SQLException { ! super(tableName, selectStatement, connection, new DefaultDataTypeFactory()); try --- 86,90 ---- IDatabaseConnection connection) throws DataSetException, SQLException { ! super(tableName, selectStatement, connection); try |
From: <mla...@us...> - 2003-09-16 05:08:37
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant In directory sc8-pr-cvs1:/tmp/cvs-serv29865/src/java/org/dbunit/ant Modified Files: DbUnitTask.java Export.java Log Message: Modified QueryDataSet to make is compatible with ForwardOnlyResultSet. Also modified the Ant task to make it possible to export very large dataset when using <query> tag. Index: DbUnitTask.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant/DbUnitTask.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DbUnitTask.java 9 Sep 2003 17:58:48 -0000 1.8 --- DbUnitTask.java 16 Sep 2003 05:08:30 -0000 1.9 *************** *** 28,31 **** --- 28,32 ---- import org.dbunit.database.DatabaseConnection; import org.dbunit.database.DatabaseConfig; + import org.dbunit.database.ForwardOnlyResultSetTableFactory; import java.sql.*; *************** *** 354,357 **** --- 355,360 ---- config.setFeature(DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES, useQualifiedTableNames); config.setProperty(DatabaseConfig.PROPERTY_ESCAPE_PATTERN, escapePattern); + config.setProperty(DatabaseConfig.PROPERTY_RESULTSET_TABLE_FACTORY, + new ForwardOnlyResultSetTableFactory()); // Setup data type factory Index: Export.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant/Export.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Export.java 16 Sep 2003 02:50:37 -0000 1.9 --- Export.java 16 Sep 2003 05:08:30 -0000 1.10 *************** *** 28,31 **** --- 28,32 ---- import org.dbunit.database.ForwardOnlyResultSetTableFactory; import org.dbunit.database.CachedResultSetTableFactory; + import org.dbunit.database.QueryDataSet; import org.dbunit.dataset.*; import org.dbunit.dataset.xml.FlatDtdDataSet; *************** *** 129,182 **** // Retrieve the complete database if no tables or queries specified. - DatabaseConfig config = connection.getConfig(); if (_tables.size() == 0) { - config.setProperty(DatabaseConfig.PROPERTY_RESULTSET_TABLE_FACTORY, - new ForwardOnlyResultSetTableFactory()); - dataset = connection.createDataSet(); } - // No query but some tables specified - else if (!_hasQuery) - { - config.setProperty(DatabaseConfig.PROPERTY_RESULTSET_TABLE_FACTORY, - new ForwardOnlyResultSetTableFactory()); - - List tableNameList = new ArrayList(); - for (Iterator it = _tables.iterator(); it.hasNext();) - { - Table table = (Table)it.next(); - tableNameList.add(table.getName()); - } - - String[] tableNames = (String[])tableNameList.toArray(new String[0]); - dataset = connection.createDataSet(tableNames); - } - // At least a query specified else { ! config.setProperty(DatabaseConfig.PROPERTY_RESULTSET_TABLE_FACTORY, ! new CachedResultSetTableFactory()); ! ! // TODO: Use the resultset factory in QueryDataSet implementation ! List tableList = new ArrayList(); for (Iterator it = _tables.iterator(); it.hasNext();) { ! Object table = it.next(); ! if (table instanceof Query) { ! tableList.add(createTable((Query)table, connection)); } else { ! tableList.add(createTable((Table)table, connection)); } } ! ITable[] tables = (ITable[])tableList.toArray(new ITable[0]); ! dataset = new DefaultDataSet(tables); ! } ! // save the dataset Writer out = new FileWriter(_dest); try --- 130,159 ---- // Retrieve the complete database if no tables or queries specified. if (_tables.size() == 0) { dataset = connection.createDataSet(); } else { ! QueryDataSet queryDataset = new QueryDataSet(connection); for (Iterator it = _tables.iterator(); it.hasNext();) { ! Object item = it.next(); ! if (item instanceof Query) { ! Query queryItem = (Query)item; ! queryDataset.addTable(queryItem.getName(), queryItem.getSql()); } else { ! Table tableItem = (Table)item; ! queryDataset.addTable(tableItem.getName()); } } ! dataset = queryDataset; } ! ! // Write the dataset Writer out = new FileWriter(_dest); try *************** *** 209,235 **** throw new DatabaseUnitException(e); } - } - - private ITable createTable(Table table, IDatabaseConnection connection) - throws DataSetException, SQLException - { - IDataSet databaseDataSet = connection.createDataSet(); - - // Optimization: do not fetch table data since DTD export only use - // table metadata. - if (_format.equalsIgnoreCase(FORMAT_DTD)) - { - ITableMetaData metaData = - databaseDataSet.getTableMetaData(table.getName()); - return new DefaultTable(metaData, new ArrayList()); - } - - return databaseDataSet.getTable(table.getName()); - } - - private ITable createTable(Query query, IDatabaseConnection connection) - throws DataSetException, SQLException - { - return connection.createQueryTable(query.getName(), query.getSql()); } --- 186,189 ---- |
From: <mla...@us...> - 2003-09-16 05:08:35
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/database In directory sc8-pr-cvs1:/tmp/cvs-serv29865/src/test/org/dbunit/database Modified Files: QueryDataSetTest.java Log Message: Modified QueryDataSet to make is compatible with ForwardOnlyResultSet. Also modified the Ant task to make it possible to export very large dataset when using <query> tag. Index: QueryDataSetTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/database/QueryDataSetTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** QueryDataSetTest.java 9 Aug 2003 11:23:30 -0000 1.5 --- QueryDataSetTest.java 16 Sep 2003 05:08:31 -0000 1.6 *************** *** 28,31 **** --- 28,34 ---- import org.dbunit.dataset.ITable; import org.dbunit.dataset.NoSuchColumnException; + import org.dbunit.dataset.DataSetUtils; + import org.dbunit.dataset.ITableMetaData; + import org.dbunit.dataset.Column; import org.dbunit.operation.DatabaseOperation; *************** *** 71,76 **** } - - protected IDataSet createDataSet() throws Exception { --- 74,77 ---- *************** *** 81,86 **** { String name = names[i]; ! String query = "select * from " + name; ! dataSet.addTable(name, query); } return dataSet; --- 82,86 ---- { String name = names[i]; ! dataSet.addTable(name); } return dataSet; *************** *** 223,227 **** ptds.addTable("PK_TABLE", null); } - } --- 223,226 ---- |
From: <mla...@us...> - 2003-09-16 02:50:41
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant In directory sc8-pr-cvs1:/tmp/cvs-serv2915/src/java/org/dbunit/ant Modified Files: Export.java Operation.java Log Message: Modified Ant task to import and export of very large dataset without getting the infamous OutOfMemoryError. Not compatible with Query table and with DELETE, DELETE_ALL and CLEAN_INSERT operations. If one of these options is used, DbUnit revert back to the memory hungry mode. Index: Export.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant/Export.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Export.java 17 Mar 2003 00:43:51 -0000 1.8 --- Export.java 16 Sep 2003 02:50:37 -0000 1.9 *************** *** 25,28 **** --- 25,31 ---- import org.dbunit.DatabaseUnitException; import org.dbunit.database.IDatabaseConnection; + import org.dbunit.database.DatabaseConfig; + import org.dbunit.database.ForwardOnlyResultSetTableFactory; + import org.dbunit.database.CachedResultSetTableFactory; import org.dbunit.dataset.*; import org.dbunit.dataset.xml.FlatDtdDataSet; *************** *** 51,61 **** public class Export implements DbUnitTaskStep { private File _dest; - private static final String FORMAT_FLAT = "flat"; private String _format = FORMAT_FLAT; private List _tables = new ArrayList(); ! private static final String FORMAT_XML = "xml"; ! private static final String FORMAT_DTD = "dtd"; public Export() --- 54,65 ---- public class Export implements DbUnitTaskStep { + private static final String FORMAT_FLAT = "flat"; + private static final String FORMAT_XML = "xml"; + private static final String FORMAT_DTD = "dtd"; private File _dest; private String _format = FORMAT_FLAT; private List _tables = new ArrayList(); ! private boolean _hasQuery = false; public Export() *************** *** 110,113 **** --- 114,118 ---- { _tables.add(query); + _hasQuery = true; } *************** *** 123,133 **** } ! // retrieve the complete database if no tables or queries specified. if (_tables.size() == 0) { dataset = connection.createDataSet(); } else { List tableList = new ArrayList(); for (Iterator it = _tables.iterator(); it.hasNext();) --- 128,163 ---- } ! // Retrieve the complete database if no tables or queries specified. ! DatabaseConfig config = connection.getConfig(); if (_tables.size() == 0) { + config.setProperty(DatabaseConfig.PROPERTY_RESULTSET_TABLE_FACTORY, + new ForwardOnlyResultSetTableFactory()); + dataset = connection.createDataSet(); } + // No query but some tables specified + else if (!_hasQuery) + { + config.setProperty(DatabaseConfig.PROPERTY_RESULTSET_TABLE_FACTORY, + new ForwardOnlyResultSetTableFactory()); + + List tableNameList = new ArrayList(); + for (Iterator it = _tables.iterator(); it.hasNext();) + { + Table table = (Table)it.next(); + tableNameList.add(table.getName()); + } + + String[] tableNames = (String[])tableNameList.toArray(new String[0]); + dataset = connection.createDataSet(tableNames); + } + // At least a query specified else { + config.setProperty(DatabaseConfig.PROPERTY_RESULTSET_TABLE_FACTORY, + new CachedResultSetTableFactory()); + + // TODO: Use the resultset factory in QueryDataSet implementation List tableList = new ArrayList(); for (Iterator it = _tables.iterator(); it.hasNext();) Index: Operation.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant/Operation.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Operation.java 9 Sep 2003 17:58:48 -0000 1.7 --- Operation.java 16 Sep 2003 02:50:37 -0000 1.8 *************** *** 26,34 **** --- 26,41 ---- import org.dbunit.database.IDatabaseConnection; import org.dbunit.dataset.IDataSet; + import org.dbunit.dataset.IDataSetProducer; + import org.dbunit.dataset.StreamingDataSet; + import org.dbunit.dataset.CachedDataSet; import org.dbunit.dataset.xml.FlatXmlDataSet; import org.dbunit.dataset.xml.XmlDataSet; + import org.dbunit.dataset.xml.XmlProducer; + import org.dbunit.dataset.xml.FlatXmlProducer; import org.dbunit.operation.DatabaseOperation; import org.dbunit.operation.mssqlserver.InsertIdentityOperation; + import org.xml.sax.InputSource; + import java.io.File; import java.io.FileReader; *************** *** 47,61 **** public class Operation implements DbUnitTaskStep { ! protected String type; ! private final String DEFAULT_FORMAT = "flat"; private String format; private File src; ! private DatabaseOperation dbOperation; ! ! public Operation() ! { ! this.type = "CLEAN_INSERT"; ! } public String getType() --- 54,64 ---- public class Operation implements DbUnitTaskStep { + private static final String DEFAULT_FORMAT = "flat"; ! protected String type = "CLEAN_INSERT"; private String format; private File src; ! private DatabaseOperation _operation; ! private boolean _forwardOperation = true; public String getType() *************** *** 71,75 **** public DatabaseOperation getDbOperation() { ! return dbOperation; } --- 74,78 ---- public DatabaseOperation getDbOperation() { ! return _operation; } *************** *** 96,136 **** if ("UPDATE".equals(type)) { ! dbOperation = DatabaseOperation.UPDATE; } else if ("INSERT".equals(type)) { ! dbOperation = DatabaseOperation.INSERT; } else if ("REFRESH".equals(type)) { ! dbOperation = DatabaseOperation.REFRESH; } else if ("DELETE".equals(type)) { ! dbOperation = DatabaseOperation.DELETE; } else if ("DELETE_ALL".equals(type)) { ! dbOperation = DatabaseOperation.DELETE_ALL; } else if ("CLEAN_INSERT".equals(type)) { ! dbOperation = DatabaseOperation.CLEAN_INSERT; } else if ("NONE".equals(type)) { ! dbOperation = DatabaseOperation.NONE; } else if ("MSSQL_CLEAN_INSERT".equals(type)) { ! dbOperation = InsertIdentityOperation.CLEAN_INSERT; } else if ("MSSQL_INSERT".equals(type)) { ! dbOperation = InsertIdentityOperation.INSERT; } else if ("MSSQL_REFRESH".equals(type)) { ! dbOperation = InsertIdentityOperation.REFRESH; } else --- 99,149 ---- if ("UPDATE".equals(type)) { ! _operation = DatabaseOperation.UPDATE; ! _forwardOperation = true; } else if ("INSERT".equals(type)) { ! _operation = DatabaseOperation.INSERT; ! _forwardOperation = true; } else if ("REFRESH".equals(type)) { ! _operation = DatabaseOperation.REFRESH; ! _forwardOperation = true; } else if ("DELETE".equals(type)) { ! _operation = DatabaseOperation.DELETE; ! _forwardOperation = false; } else if ("DELETE_ALL".equals(type)) { ! _operation = DatabaseOperation.DELETE_ALL; ! _forwardOperation = false; } else if ("CLEAN_INSERT".equals(type)) { ! _operation = DatabaseOperation.CLEAN_INSERT; ! _forwardOperation = false; } else if ("NONE".equals(type)) { ! _operation = DatabaseOperation.NONE; ! _forwardOperation = true; } else if ("MSSQL_CLEAN_INSERT".equals(type)) { ! _operation = InsertIdentityOperation.CLEAN_INSERT; ! _forwardOperation = false; } else if ("MSSQL_INSERT".equals(type)) { ! _operation = InsertIdentityOperation.INSERT; ! _forwardOperation = true; } else if ("MSSQL_REFRESH".equals(type)) { ! _operation = InsertIdentityOperation.REFRESH; ! _forwardOperation = true; } else *************** *** 163,172 **** public void execute(IDatabaseConnection connection) throws DatabaseUnitException { ! if (dbOperation == null) { throw new DatabaseUnitException("Operation.execute(): setType(String) must be called before execute()!"); } ! if (dbOperation == DatabaseOperation.NONE) { return; --- 176,185 ---- public void execute(IDatabaseConnection connection) throws DatabaseUnitException { ! if (_operation == null) { throw new DatabaseUnitException("Operation.execute(): setType(String) must be called before execute()!"); } ! if (_operation == DatabaseOperation.NONE) { return; *************** *** 175,192 **** try { - IDataSet dataset; if (format == null) { format = DEFAULT_FORMAT; } if (format.equalsIgnoreCase("xml")) { ! dataset = new XmlDataSet(new FileReader(src)); } else { ! dataset = new FlatXmlDataSet(src); } ! dbOperation.execute(connection, dataset); } catch (IOException e) --- 188,217 ---- try { if (format == null) { format = DEFAULT_FORMAT; } + + IDataSetProducer producer = null; if (format.equalsIgnoreCase("xml")) { ! producer = new XmlProducer(new InputSource(src.toURL().toString())); } else { ! producer = new FlatXmlProducer(new InputSource(src.toURL().toString())); } ! ! IDataSet dataset = null; ! if (_forwardOperation) ! { ! dataset = new StreamingDataSet(producer); ! } ! else ! { ! dataset = new CachedDataSet(producer); ! } ! ! _operation.execute(connection, dataset); } catch (IOException e) *************** *** 215,219 **** result.append(", format=" + format); result.append(", src=" + src == null ? null : src.getAbsolutePath()); ! result.append(", dbOperation = " + dbOperation); return result.toString(); --- 240,244 ---- result.append(", format=" + format); result.append(", src=" + src == null ? null : src.getAbsolutePath()); ! result.append(", _operation = " + _operation); return result.toString(); |
From: <mla...@us...> - 2003-09-09 17:58:53
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/ant In directory sc8-pr-cvs1:/tmp/cvs-serv7695/src/test/org/dbunit/ant Modified Files: DbUnitTaskTest.java Log Message: Added 'datatypeFactory' and 'escapePattern' attributes to <DbUnit> ant task. Index: DbUnitTaskTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/ant/DbUnitTaskTest.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** DbUnitTaskTest.java 9 Aug 2003 11:23:31 -0000 1.10 --- DbUnitTaskTest.java 9 Sep 2003 17:58:48 -0000 1.11 *************** *** 24,27 **** --- 24,31 ---- import org.dbunit.DatabaseEnvironment; + import org.dbunit.ext.oracle.OracleDataTypeFactory; + import org.dbunit.dataset.datatype.IDataTypeFactory; + import org.dbunit.database.IDatabaseConnection; + import org.dbunit.database.DatabaseConfig; import org.dbunit.operation.DatabaseOperation; import org.dbunit.operation.mssqlserver.InsertIdentityOperation; *************** *** 129,132 **** --- 133,138 ---- { assertOperationType("Should have been an DELETE_ALL operation", + "set-type-none", DatabaseOperation.NONE); + assertOperationType("Should have been an DELETE_ALL operation", "set-type-delete-all", DatabaseOperation.DELETE_ALL); assertOperationType("Should have been an INSERT operation", *************** *** 291,294 **** --- 297,326 ---- } + public void testDataTypeFactory() throws Exception + { + String targetName = "test-datatypefactory"; + DbUnitTask task = getFirstTargetTask(targetName); + + IDatabaseConnection connection = task.createConnection(); + IDataTypeFactory factory = (IDataTypeFactory)connection.getConfig().getProperty( + DatabaseConfig.PROPERTY_DATATYPE_FACTORY); + + Class expectedClass = OracleDataTypeFactory.class; + assertEquals("factory", expectedClass, factory.getClass()); + } + + public void testEscapePattern() throws Exception + { + String targetName = "test-escapepattern"; + DbUnitTask task = getFirstTargetTask(targetName); + + IDatabaseConnection connection = task.createConnection(); + String actualPattern = (String)connection.getConfig().getProperty( + DatabaseConfig.PROPERTY_ESCAPE_PATTERN); + + String expectedPattern = "[?]"; + assertEquals("factory", expectedPattern, actualPattern); + } + public void testClasspath() throws Exception { *************** *** 363,370 **** { DbUnitTaskStep result = null; ! Hashtable targets = project.getTargets(); ! executeTarget(targetName); ! Target target = (Target)targets.get(targetName); ! DbUnitTask task = (DbUnitTask)target.getTasks()[0]; List steps = task.getSteps(); if (steps != null && steps.size() > 0) --- 395,399 ---- { DbUnitTaskStep result = null; ! DbUnitTask task = getFirstTargetTask(targetName); List steps = task.getSteps(); if (steps != null && steps.size() > 0) *************** *** 377,380 **** --- 406,418 ---- } return result; + } + + private DbUnitTask getFirstTargetTask(String targetName) + { + Hashtable targets = project.getTargets(); + executeTarget(targetName); + Target target = (Target)targets.get(targetName); + DbUnitTask task = (DbUnitTask)target.getTasks()[0]; + return task; } |