|
From: <mla...@us...> - 2003-04-10 02:52:09
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant In directory sc8-pr-cvs1:/tmp/cvs-serv788/dbunit/src/java/org/dbunit/ant Modified Files: Operation.java Log Message: Refactored test suite to works with MySQL. Problems where mostly hard coded SQL using capitalized table names that I converted to lower case. Index: Operation.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant/Operation.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Operation.java 14 Feb 2003 03:21:59 -0000 1.5 --- Operation.java 10 Apr 2003 02:52:05 -0000 1.6 *************** *** 31,36 **** import org.dbunit.operation.mssqlserver.InsertIdentityOperation; ! import java.io.*; ! import java.sql.Connection; import java.sql.SQLException; --- 31,37 ---- import org.dbunit.operation.mssqlserver.InsertIdentityOperation; ! import java.io.File; ! import java.io.FileReader; ! import java.io.IOException; import java.sql.SQLException; *************** *** 46,50 **** public class Operation implements DbUnitTaskStep { ! protected String type; private final String DEFAULT_FORMAT = "flat"; --- 47,51 ---- public class Operation implements DbUnitTaskStep { ! protected String type; private final String DEFAULT_FORMAT = "flat"; *************** *** 78,89 **** } ! /** ! * This returns the actual value of the <code>format</code> field, ! * which makes it possible to determine whether the setFormat() method was ever called ! * despite the fact that the <code>getFormat()</code> method returns a default. ! * ! * @return a <code>String</code>, the actual value of the <code>format</code> field. ! * If <code>setFormat()</code> has not been called, this method will return null. ! */ String getRawFormat() { --- 79,90 ---- } ! /** ! * This returns the actual value of the <code>format</code> field, ! * which makes it possible to determine whether the setFormat() method was ever called ! * despite the fact that the <code>getFormat()</code> method returns a default. ! * ! * @return a <code>String</code>, the actual value of the <code>format</code> field. ! * If <code>setFormat()</code> has not been called, this method will return null. ! */ String getRawFormat() { *************** *** 117,137 **** dbOperation = DatabaseOperation.CLEAN_INSERT; } ! 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 ! { ! throw new IllegalArgumentException("Type must be one of: UPDATE, INSERT," + " REFRESH, DELETE, DELETE_ALL, CLEAN_INSERT, MSSQL_INSERT, " ! + " or MSSQL_REFRESH but was: " + type); } this.type = type; --- 118,138 ---- dbOperation = DatabaseOperation.CLEAN_INSERT; } ! 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 ! { ! throw new IllegalArgumentException("Type must be one of: UPDATE, INSERT," + " REFRESH, DELETE, DELETE_ALL, CLEAN_INSERT, MSSQL_INSERT, " ! + " or MSSQL_REFRESH but was: " + type); } this.type = type; *************** *** 145,157 **** public void setFormat(String format) { ! if (format.equalsIgnoreCase("flat") ! || format.equalsIgnoreCase("xml")) ! { this.format = format; ! } ! else ! { ! throw new IllegalArgumentException("Type must be either 'flat'(default) or 'xml' but was: " + format); ! } } --- 146,158 ---- public void setFormat(String format) { ! if (format.equalsIgnoreCase("flat") ! || format.equalsIgnoreCase("xml")) ! { this.format = format; ! } ! else ! { ! throw new IllegalArgumentException("Type must be either 'flat'(default) or 'xml' but was: " + format); ! } } *************** *** 163,175 **** { IDataSet dataset; ! if (format == null) ! { ! format = DEFAULT_FORMAT; ! } if (format.equalsIgnoreCase("xml")) { dataset = new XmlDataSet(new FileReader(src)); } ! else { dataset = new FlatXmlDataSet(src); --- 164,176 ---- { IDataSet dataset; ! if (format == null) ! { ! format = DEFAULT_FORMAT; ! } if (format.equalsIgnoreCase("xml")) { dataset = new XmlDataSet(new FileReader(src)); } ! else { dataset = new FlatXmlDataSet(src); *************** *** 196,200 **** return "Executing operation: " + type + "\n on file: " + src.getAbsolutePath() ! + "\n with format: " + format; } --- 197,201 ---- return "Executing operation: " + type + "\n on file: " + src.getAbsolutePath() ! + "\n with format: " + format; } |