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-03-20 03:07:29
|
Update of /cvsroot/dbunit/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv9675/dbunit Modified Files: todo.txt Log Message: Added pattern tests. Index: todo.txt =================================================================== RCS file: /cvsroot/dbunit/dbunit/todo.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** todo.txt 19 Mar 2003 01:56:19 -0000 1.8 --- todo.txt 20 Mar 2003 03:07:27 -0000 1.9 *************** *** 13,19 **** * Alternate DTD export method using choice (OR) instead sequence (AND). ! * Add wildcard capability to IncludeTableFilter strategy. ! ! * Replace system properties with a DatabaseConfig class pushed to the DatabaseConnection. This is possible to replace all system properties with this class because they are all related to database connection. * DisableConstrainsOperation??? The way to disable/enable database constraints is vendor specific so this is impossible to implement on all RDMS platform. Big question, is the performance acceptable??? http://sourceforge.net/mailarchive/message.php?msg_id=4148317 --- 13,17 ---- * Alternate DTD export method using choice (OR) instead sequence (AND). ! * Replace system properties with a DatabaseConfig class pushed to the DatabaseConnection. This is possible to replace all system properties with this class because they are all related to database connection. * DisableConstrainsOperation??? The way to disable/enable database constraints is vendor specific so this is impossible to implement on all RDMS platform. Big question, is the performance acceptable??? http://sourceforge.net/mailarchive/message.php?msg_id=4148317 |
From: <mla...@us...> - 2003-03-20 03:05:19
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/filter In directory sc8-pr-cvs1:/tmp/cvs-serv8958/dbunit/src/test/org/dbunit/dataset/filter Modified Files: IncludeTableFilterTest.java ExcludeTableFilterTest.java Log Message: Added pattern tests. Index: IncludeTableFilterTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/filter/IncludeTableFilterTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IncludeTableFilterTest.java 19 Mar 2003 01:56:18 -0000 1.1 --- IncludeTableFilterTest.java 20 Mar 2003 03:05:12 -0000 1.2 *************** *** 21,30 **** package org.dbunit.dataset.filter; ! import org.dbunit.database.AmbiguousTableNameException; ! import org.dbunit.dataset.*; import java.util.Arrays; import java.util.List; - import java.util.ArrayList; /** --- 21,34 ---- package org.dbunit.dataset.filter; ! import org.dbunit.dataset.DataSetUtils; ! import org.dbunit.dataset.DefaultDataSet; ! import org.dbunit.dataset.IDataSet; ! import org.dbunit.dataset.ITable; ! import org.dbunit.dataset.LowerCaseDataSet; ! import org.dbunit.dataset.DefaultTable; + import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** *************** *** 35,38 **** --- 39,67 ---- public class IncludeTableFilterTest extends AbstractTableFilterTest { + static final String MATCHING_NAME = "aBcDe"; + static final String[] MATCHING_PATTERNS = { + "?bcde", + "?bc*", + "*", + "a?cde", + "abcd?", + "*e", + "a*", + "a*e", + "a*d*e", + "a**e", + "abcde*", + "*abcde", + "?????", + }; + static final String[] NONMATCHING_PATTERNS = { + "?abcde", + "abcde?", + "*f*", + "??????", + "????", + }; + + public IncludeTableFilterTest(String s) { *************** *** 245,247 **** --- 274,429 ---- Arrays.asList(expectedNames), Arrays.asList(actualNames)); } + + //////////////////////////////////////////////////////////////////////////// + + public void testIsValidNameWithPatterns() throws Exception + { + String validName = MATCHING_NAME; + + String[] patterns = MATCHING_PATTERNS; + for (int i = 0; i < patterns.length; i++) + { + String pattern = patterns[i]; + IncludeTableFilter filter = new IncludeTableFilter(); + filter.includeTable(pattern); + assertEquals(pattern, true, filter.isValidName(validName)); + } + } + + public void testIsValidNameInvalidWithPatterns() throws Exception + { + String validName = MATCHING_NAME; + + String[] patterns = NONMATCHING_PATTERNS; + for (int i = 0; i < patterns.length; i++) + { + String pattern = patterns[i]; + IncludeTableFilter filter = new IncludeTableFilter(); + filter.includeTable(pattern); + assertEquals(pattern, false, filter.isValidName(validName)); + } + } + + public void testGetTableNamesWithPatterns() throws Exception + { + String[] expectedNames = new String[] {MATCHING_NAME}; + IDataSet dataSet = new DefaultDataSet(new ITable[] { + new DefaultTable(MATCHING_NAME), + new DefaultTable("toto"), + new DefaultTable("1234"), + new DefaultTable("fedcba"), + }); + assertTrue("dataset names count", + dataSet.getTableNames().length > expectedNames.length); + + String[] patterns = MATCHING_PATTERNS; + for (int i = 0; i < patterns.length; i++) + { + String pattern = patterns[i]; + IncludeTableFilter filter = new IncludeTableFilter(); + filter.includeTable(pattern); + + // this pattern match everything, so ensure nothing is filtered + if (pattern.equals("*")) + { + String[] actualNames = filter.getTableNames(dataSet); + assertEquals("name count - " + pattern, + dataSet.getTableNames().length, actualNames.length); + assertEquals("names - " + pattern, + Arrays.asList(dataSet.getTableNames()), + Arrays.asList(actualNames)); + } + else + { + String[] actualNames = filter.getTableNames(dataSet); + assertEquals("name count - " + pattern, + expectedNames.length, actualNames.length); + assertEquals("names - " + pattern, + Arrays.asList(expectedNames), Arrays.asList(actualNames)); + } + } + } + + public void testGetTableNamesWithNonMatchingPatterns() throws Exception + { + IDataSet dataSet = new DefaultDataSet(new ITable[] { + new DefaultTable(MATCHING_NAME), + }); + assertTrue("dataset names count", + dataSet.getTableNames().length > 0); + + String[] patterns = NONMATCHING_PATTERNS; + for (int i = 0; i < patterns.length; i++) + { + String pattern = patterns[i]; + IncludeTableFilter filter = new IncludeTableFilter(); + filter.includeTable(pattern); + + String[] actualNames = filter.getTableNames(dataSet); + assertEquals("name count - " + pattern, 0, actualNames.length); + } + } + + public void testGetTablesWithPatterns() throws Exception + { + String[] expectedNames = new String[] {MATCHING_NAME}; + IDataSet dataSet = new DefaultDataSet(new ITable[] { + new DefaultTable(MATCHING_NAME), + new DefaultTable("toto"), + new DefaultTable("1234"), + new DefaultTable("fedcba"), + }); + assertTrue("dataset names count", + dataSet.getTableNames().length > expectedNames.length); + + String[] patterns = MATCHING_PATTERNS; + for (int i = 0; i < patterns.length; i++) + { + String pattern = patterns[i]; + IncludeTableFilter filter = new IncludeTableFilter(); + filter.includeTable(pattern); + + // this pattern match everything, so ensure nothing is filtered + if (pattern.equals("*")) + { + ITable[] actualTables = filter.getTables(dataSet); + String[] actualNames = new DefaultDataSet(actualTables).getTableNames(); + assertEquals("table count - " + pattern, + dataSet.getTableNames().length, actualNames.length); + assertEquals("table names - " + pattern, + Arrays.asList(dataSet.getTableNames()), + Arrays.asList(actualNames)); + } + else + { + ITable[] actualTables = filter.getTables(dataSet); + String[] actualNames = new DefaultDataSet(actualTables).getTableNames(); + assertEquals("table count - " + pattern, + expectedNames.length, actualTables.length); + assertEquals("table names - " + pattern, + Arrays.asList(expectedNames), Arrays.asList(actualNames)); + } + } + } + + public void testGetTablesWithNonMatchingPatterns() throws Exception + { + IDataSet dataSet = new DefaultDataSet(new ITable[] { + new DefaultTable(MATCHING_NAME), + }); + assertTrue("dataset names count", + dataSet.getTableNames().length > 0); + + String[] patterns = NONMATCHING_PATTERNS; + for (int i = 0; i < patterns.length; i++) + { + String pattern = patterns[i]; + IncludeTableFilter filter = new IncludeTableFilter(); + filter.includeTable(pattern); + + ITable[] actualTables = filter.getTables(dataSet); + assertEquals("table count - " + pattern, 0, actualTables.length); + } + } + } Index: ExcludeTableFilterTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/filter/ExcludeTableFilterTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExcludeTableFilterTest.java 19 Mar 2003 01:56:18 -0000 1.1 --- ExcludeTableFilterTest.java 20 Mar 2003 03:05:12 -0000 1.2 *************** *** 21,30 **** package org.dbunit.dataset.filter; ! import org.dbunit.database.AmbiguousTableNameException; ! import org.dbunit.dataset.*; import java.util.Arrays; - import java.util.List; - import java.util.ArrayList; /** --- 21,31 ---- package org.dbunit.dataset.filter; ! import org.dbunit.dataset.DefaultDataSet; ! import org.dbunit.dataset.IDataSet; ! import org.dbunit.dataset.ITable; ! import org.dbunit.dataset.LowerCaseDataSet; ! import org.dbunit.dataset.DefaultTable; import java.util.Arrays; /** *************** *** 35,38 **** --- 36,45 ---- public class ExcludeTableFilterTest extends AbstractTableFilterTest { + static final String MATCHING_NAME = "aBcDe"; + static final String[] MATCHING_PATTERNS = + IncludeTableFilterTest.MATCHING_PATTERNS; + static final String[] NONMATCHING_PATTERNS = + IncludeTableFilterTest.NONMATCHING_PATTERNS; + public ExcludeTableFilterTest(String s) { *************** *** 224,226 **** --- 231,385 ---- Arrays.asList(expectedNames), Arrays.asList(actualNames)); } + + //////////////////////////////////////////////////////////////////////////// + + public void testIsValidNameWithPatterns() throws Exception + { + String validName = MATCHING_NAME; + + String[] patterns = NONMATCHING_PATTERNS; + for (int i = 0; i < patterns.length; i++) + { + String pattern = patterns[i]; + ExcludeTableFilter filter = new ExcludeTableFilter(); + filter.excludeTable(pattern); + assertEquals(pattern, true, filter.isValidName(validName)); + } + } + + public void testIsValidNameInvalidWithPatterns() throws Exception + { + String validName = MATCHING_NAME; + + String[] patterns = MATCHING_PATTERNS; + for (int i = 0; i < patterns.length; i++) + { + String pattern = patterns[i]; + ExcludeTableFilter filter = new ExcludeTableFilter(); + filter.excludeTable(pattern); + assertEquals(pattern, false, filter.isValidName(validName)); + } + } + + public void testGetTableNamesWithPatterns() throws Exception + { + String nonMatchingName = "toto titi tata"; + String[] expectedNames = new String[] {nonMatchingName}; + IDataSet dataSet = new DefaultDataSet(new ITable[] { + new DefaultTable(MATCHING_NAME), + new DefaultTable(nonMatchingName), + }); + assertTrue("dataset names count", + dataSet.getTableNames().length > expectedNames.length); + + String[] patterns = MATCHING_PATTERNS; + for (int i = 0; i < patterns.length; i++) + { + String pattern = patterns[i]; + ExcludeTableFilter filter = new ExcludeTableFilter(); + filter.excludeTable(pattern); + + // this pattern match everything, so ensure everything filtered + if (pattern.equals("*")) + { + String[] actualNames = filter.getTableNames(dataSet); + assertEquals("name count - " + pattern, + 0, actualNames.length); + } + else + { + String[] actualNames = filter.getTableNames(dataSet); + assertEquals("name count - " + pattern, + expectedNames.length, actualNames.length); + assertEquals("names - " + pattern, + Arrays.asList(expectedNames), Arrays.asList(actualNames)); + } + } + } + + public void testGetTableNamesWithNonMatchingPatterns() throws Exception + { + String[] expectedNames = new String[] {MATCHING_NAME}; + IDataSet dataSet = new DefaultDataSet(new ITable[] { + new DefaultTable(MATCHING_NAME), + }); + + String[] patterns = NONMATCHING_PATTERNS; + for (int i = 0; i < patterns.length; i++) + { + String pattern = patterns[i]; + ExcludeTableFilter filter = new ExcludeTableFilter(); + filter.excludeTable(pattern); + + String[] actualNames = filter.getTableNames(dataSet); + assertEquals("name count - " + pattern, + expectedNames.length, actualNames.length); + assertEquals("names - " + pattern, + Arrays.asList(expectedNames), Arrays.asList(actualNames)); + } + } + + public void testGetTablesWithPatterns() throws Exception + { + String nonMatchingName = "toto titi tata"; + String[] expectedNames = new String[] {nonMatchingName}; + IDataSet dataSet = new DefaultDataSet(new ITable[] { + new DefaultTable(MATCHING_NAME), + new DefaultTable(nonMatchingName), + }); + assertTrue("dataset names count", + dataSet.getTableNames().length > expectedNames.length); + + String[] patterns = MATCHING_PATTERNS; + for (int i = 0; i < patterns.length; i++) + { + String pattern = patterns[i]; + ExcludeTableFilter filter = new ExcludeTableFilter(); + filter.excludeTable(pattern); + + // this pattern match everything, so ensure everything is filtered + if (pattern.equals("*")) + { + ITable[] actualTables = filter.getTables(dataSet); + String[] actualNames = new DefaultDataSet(actualTables).getTableNames(); + assertEquals("table count - " + pattern, + 0, actualNames.length); + } + else + { + ITable[] actualTables = filter.getTables(dataSet); + String[] actualNames = new DefaultDataSet(actualTables).getTableNames(); + assertEquals("table count - " + pattern, + expectedNames.length, actualTables.length); + assertEquals("table names - " + pattern, + Arrays.asList(expectedNames), Arrays.asList(actualNames)); + } + } + } + + public void testGetTablesWithNonMatchingPatterns() throws Exception + { + String[] expectedNames = new String[] {MATCHING_NAME}; + IDataSet dataSet = new DefaultDataSet(new ITable[] { + new DefaultTable(MATCHING_NAME), + }); + assertTrue("dataset names count", + dataSet.getTableNames().length > 0); + + String[] patterns = NONMATCHING_PATTERNS; + for (int i = 0; i < patterns.length; i++) + { + String pattern = patterns[i]; + ExcludeTableFilter filter = new ExcludeTableFilter(); + filter.excludeTable(pattern); + + ITable[] actualTables = filter.getTables(dataSet); + String[] actualNames = new DefaultDataSet(actualTables).getTableNames(); + assertEquals("table count - " + pattern, + expectedNames.length, actualTables.length); + assertEquals("table names - " + pattern, + Arrays.asList(expectedNames), Arrays.asList(actualNames)); + } + } + } |
From: <mla...@us...> - 2003-03-20 03:05:19
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/filter In directory sc8-pr-cvs1:/tmp/cvs-serv8958/dbunit/src/java/org/dbunit/dataset/filter Modified Files: IncludeTableFilter.java Log Message: Added pattern tests. Index: IncludeTableFilter.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/filter/IncludeTableFilter.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IncludeTableFilter.java 19 Mar 2003 02:59:21 -0000 1.3 --- IncludeTableFilter.java 20 Mar 2003 03:05:13 -0000 1.4 *************** *** 30,35 **** * dataset and support duplicate table names. * <p> ! * The pattern matching code is taken from the DirectoryScanner class part of ! * the Apache Ant project and authored by Arnout J. Kuiper. * * @author Manuel Laflamme --- 30,34 ---- * dataset and support duplicate table names. * <p> ! * The pattern matching code is taken from the Apache Ant project. * * @author Manuel Laflamme |
From: <mla...@us...> - 2003-03-19 02:59:24
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/filter In directory sc8-pr-cvs1:/tmp/cvs-serv28932/dbunit/src/java/org/dbunit/dataset/filter Modified Files: ExcludeTableFilter.java IncludeTableFilter.java Log Message: Added wildcard capability to IncludeTableFilter strategy. The following special characters can be used: '*' matches zero or more characters, '?' matches one character. Index: ExcludeTableFilter.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/filter/ExcludeTableFilter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ExcludeTableFilter.java 18 Mar 2003 03:35:38 -0000 1.2 --- ExcludeTableFilter.java 19 Mar 2003 02:59:21 -0000 1.3 *************** *** 55,63 **** /** ! * Add a new table name to exclude in this filter. */ ! public void excludeTable(String tableName) { ! _includeFilter.includeTable(tableName); } --- 55,66 ---- /** ! * Add a new table pattern name to exclude in this filter. ! * The following special characters can be used: ! * '*' matches zero or more characters, ! * '?' matches one character. */ ! public void excludeTable(String patternName) { ! _includeFilter.includeTable(patternName); } Index: IncludeTableFilter.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/filter/IncludeTableFilter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IncludeTableFilter.java 18 Mar 2003 03:35:38 -0000 1.2 --- IncludeTableFilter.java 19 Mar 2003 02:59:21 -0000 1.3 *************** *** 23,26 **** --- 23,27 ---- import java.util.HashSet; import java.util.Set; + import java.util.Iterator; /** *************** *** 28,31 **** --- 29,35 ---- * implementation do not modify the original table sequence from the filtered * dataset and support duplicate table names. + * <p> + * The pattern matching code is taken from the DirectoryScanner class part of + * the Apache Ant project and authored by Arnout J. Kuiper. * * @author Manuel Laflamme *************** *** 36,39 **** --- 40,44 ---- { private final Set _allowedNames = new HashSet(); + private final Set _allowedPatterns = new HashSet(); /** *************** *** 58,66 **** /** ! * Add a new table name to include in this filter. */ ! public void includeTable(String tableName) { ! _allowedNames.add(tableName.toUpperCase()); } --- 63,278 ---- /** ! * Add a new table name pattern to include in this filter. ! * The following special characters can be used: ! * '*' matches zero or more characters, ! * '?' matches one character. */ ! public void includeTable(String patternName) { ! if (patternName.indexOf("*") != -1 || patternName.indexOf("?") != -1) ! { ! _allowedPatterns.add(patternName); ! } ! else ! { ! _allowedNames.add(patternName.toUpperCase()); ! } ! } ! ! /** ! * Matches a string against a pattern. The pattern contains two special ! * characters: ! * '*' which means zero or more characters, ! * '?' which means one and only one character. ! * ! * @param pattern the (non-null) pattern to match against ! * @param str the (non-null) string that must be matched against the ! * pattern ! * ! * @return <code>true</code> when the string matches against the pattern, ! * <code>false</code> otherwise. ! */ ! private boolean match(String pattern, String str, boolean isCaseSensitive) ! { ! char[] patArr = pattern.toCharArray(); ! char[] strArr = str.toCharArray(); ! int patIdxStart = 0; ! int patIdxEnd = patArr.length - 1; ! int strIdxStart = 0; ! int strIdxEnd = strArr.length - 1; ! char ch; ! ! boolean containsStar = false; ! for (int i = 0; i < patArr.length; i++) ! { ! if (patArr[i] == '*') ! { ! containsStar = true; ! break; ! } ! } ! ! if (!containsStar) ! { ! // No '*'s, so we make a shortcut ! if (patIdxEnd != strIdxEnd) ! { ! return false; // Pattern and string do not have the same size ! } ! for (int i = 0; i <= patIdxEnd; i++) ! { ! ch = patArr[i]; ! if (ch != '?') ! { ! if (isCaseSensitive && ch != strArr[i]) ! { ! return false;// Character mismatch ! } ! if (!isCaseSensitive && Character.toUpperCase(ch) != ! Character.toUpperCase(strArr[i])) ! { ! return false; // Character mismatch ! } ! } ! } ! return true; // String matches against pattern ! } ! ! if (patIdxEnd == 0) ! { ! return true; // Pattern contains only '*', which matches anything ! } ! ! // Process characters before first star ! while ((ch = patArr[patIdxStart]) != '*' && strIdxStart <= strIdxEnd) ! { ! if (ch != '?') ! { ! if (isCaseSensitive && ch != strArr[strIdxStart]) ! { ! return false;// Character mismatch ! } ! if (!isCaseSensitive && Character.toUpperCase(ch) != ! Character.toUpperCase(strArr[strIdxStart])) ! { ! return false;// Character mismatch ! } ! } ! patIdxStart++; ! strIdxStart++; ! } ! if (strIdxStart > strIdxEnd) ! { ! // All characters in the string are used. Check if only '*'s are ! // left in the pattern. If so, we succeeded. Otherwise failure. ! for (int i = patIdxStart; i <= patIdxEnd; i++) ! { ! if (patArr[i] != '*') ! { ! return false; ! } ! } ! return true; ! } ! ! // Process characters after last star ! while ((ch = patArr[patIdxEnd]) != '*' && strIdxStart <= strIdxEnd) ! { ! if (ch != '?') ! { ! if (isCaseSensitive && ch != strArr[strIdxEnd]) ! { ! return false;// Character mismatch ! } ! if (!isCaseSensitive && Character.toUpperCase(ch) != ! Character.toUpperCase(strArr[strIdxEnd])) ! { ! return false;// Character mismatch ! } ! } ! patIdxEnd--; ! strIdxEnd--; ! } ! if (strIdxStart > strIdxEnd) ! { ! // All characters in the string are used. Check if only '*'s are ! // left in the pattern. If so, we succeeded. Otherwise failure. ! for (int i = patIdxStart; i <= patIdxEnd; i++) ! { ! if (patArr[i] != '*') ! { ! return false; ! } ! } ! return true; ! } ! ! // process pattern between stars. padIdxStart and patIdxEnd point ! // always to a '*'. ! while (patIdxStart != patIdxEnd && strIdxStart <= strIdxEnd) ! { ! int patIdxTmp = -1; ! for (int i = patIdxStart + 1; i <= patIdxEnd; i++) ! { ! if (patArr[i] == '*') ! { ! patIdxTmp = i; ! break; ! } ! } ! if (patIdxTmp == patIdxStart + 1) ! { ! // Two stars next to each other, skip the first one. ! patIdxStart++; ! continue; ! } ! // Find the pattern between padIdxStart & padIdxTmp in str between ! // strIdxStart & strIdxEnd ! int patLength = (patIdxTmp - patIdxStart - 1); ! int strLength = (strIdxEnd - strIdxStart + 1); ! int foundIdx = -1; ! strLoop: ! for (int i = 0; i <= strLength - patLength; i++) ! { ! for (int j = 0; j < patLength; j++) ! { ! ch = patArr[patIdxStart + j + 1]; ! if (ch != '?') ! { ! if (isCaseSensitive && ch != strArr[strIdxStart + i + j]) ! { ! continue strLoop; ! } ! if (!isCaseSensitive && Character.toUpperCase(ch) != ! Character.toUpperCase(strArr[strIdxStart + i + j])) ! { ! continue strLoop; ! } ! } ! } ! ! foundIdx = strIdxStart + i; ! break; ! } ! ! if (foundIdx == -1) ! { ! return false; ! } ! ! patIdxStart = patIdxTmp; ! strIdxStart = foundIdx + patLength; ! } ! ! // All characters in the string are used. Check if only '*'s are left ! // in the pattern. If so, we succeeded. Otherwise failure. ! for (int i = patIdxStart; i <= patIdxEnd; i++) ! { ! if (patArr[i] != '*') ! { ! return false; ! } ! } ! return true; } *************** *** 70,74 **** public boolean isValidName(String tableName) { ! return _allowedNames.contains(tableName.toUpperCase()); } } --- 282,303 ---- public boolean isValidName(String tableName) { ! if (_allowedNames.contains(tableName.toUpperCase())) ! { ! return true; ! } ! ! if (_allowedPatterns.size() > 0) ! { ! for (Iterator it = _allowedPatterns.iterator(); it.hasNext();) ! { ! String pattern = (String)it.next(); ! if (match(pattern, tableName, false)) ! { ! return true; ! } ! } ! } ! ! return false; } } |
From: <mla...@us...> - 2003-03-19 01:57:43
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv10638/dbunit/src/test/org/dbunit/dataset Modified Files: ReplacementTableTest.java Log Message: Small test case fix . Index: ReplacementTableTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/ReplacementTableTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ReplacementTableTest.java 18 Mar 2003 03:29:46 -0000 1.1 --- ReplacementTableTest.java 19 Mar 2003 01:57:38 -0000 1.2 *************** *** 64,68 **** String tableName = "TABLE_NAME"; BigDecimal trueObject = new BigDecimal(1); ! BigDecimal falseObject = new BigDecimal(1); Date now = new Date(System.currentTimeMillis()); --- 64,68 ---- String tableName = "TABLE_NAME"; BigDecimal trueObject = new BigDecimal(1); ! BigDecimal falseObject = new BigDecimal(0); Date now = new Date(System.currentTimeMillis()); |
From: <mla...@us...> - 2003-03-19 01:56:22
|
Update of /cvsroot/dbunit/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv10308/dbunit Modified Files: todo.txt Log Message: Added tests for Include/ExcludeTableFilter. Index: todo.txt =================================================================== RCS file: /cvsroot/dbunit/dbunit/todo.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** todo.txt 17 Mar 2003 02:44:17 -0000 1.7 --- todo.txt 19 Mar 2003 01:56:19 -0000 1.8 *************** *** 13,18 **** * Alternate DTD export method using choice (OR) instead sequence (AND). - * Complete tests of FilteredDataSet filtering strategy (IncludeTableFilter & ExcludeTableFilter). - * Add wildcard capability to IncludeTableFilter strategy. --- 13,16 ---- |
Update of /cvsroot/dbunit/./dbunit/src/test/org/dbunit/dataset/filter In directory sc8-pr-cvs1:/tmp/cvs-serv10308/dbunit/src/test/org/dbunit/dataset/filter Modified Files: AllTests.java AbstractTableFilterTest.java SequenceTableFilterTest.java Added Files: ExcludeTableFilterTest.java IncludeTableFilterTest.java Log Message: Added tests for Include/ExcludeTableFilter. --- NEW FILE: ExcludeTableFilterTest.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.filter; import org.dbunit.database.AmbiguousTableNameException; import org.dbunit.dataset.*; import java.util.Arrays; import java.util.List; import java.util.ArrayList; /** * @author Manuel Laflamme * @since Mar 18, 2003 * @version $Revision: 1.1 $ */ public class ExcludeTableFilterTest extends AbstractTableFilterTest { public ExcludeTableFilterTest(String s) { super(s); } public void testIsValidName() throws Exception { String[] validNames = getExpectedNames(); ExcludeTableFilter filter = new ExcludeTableFilter(); filter.excludeTable(getExtraTableName()); for (int i = 0; i < validNames.length; i++) { String validName = validNames[i]; assertEquals(validName, true, filter.isValidName(validName)); } } public void testIsCaseInsensitiveValidName() throws Exception { String[] validNames = getExpectedNames(); ExcludeTableFilter filter = new ExcludeTableFilter(); filter.excludeTable(getExtraTableName()); for (int i = 0; i < validNames.length; i++) { String validName = validNames[i]; assertEquals(validName, true, filter.isValidName(validName)); } } public void testIsValidNameAndInvalid() throws Exception { String[] invalidNames = new String[] { "INVALID_TABLE", "UNKNOWN_TABLE", }; ITableFilter filter = new ExcludeTableFilter(invalidNames); for (int i = 0; i < invalidNames.length; i++) { String invalidName = invalidNames[i]; assertEquals(invalidName, false, filter.isValidName(invalidName)); } } public void testGetTableNames() throws Exception { String[] expectedNames = getExpectedNames(); ExcludeTableFilter filter = new ExcludeTableFilter(); filter.excludeTable(getExtraTableName()); IDataSet dataSet = createDataSet(); assertTrue("dataset names count", dataSet.getTableNames().length > expectedNames.length); String[] actualNames = filter.getTableNames(dataSet); assertEquals("name count", expectedNames.length, actualNames.length); assertEquals("names", Arrays.asList(expectedNames), Arrays.asList(actualNames)); } public void testGetTableNamesAndTableNotInDecoratedDataSet() throws Exception { String[] expectedNames = getExpectedNames(); ExcludeTableFilter filter = new ExcludeTableFilter(); filter.excludeTable(getExtraTableName()); filter.excludeTable("UNKNOWN_TABLE"); IDataSet dataSet = createDataSet(); assertTrue("dataset names count", dataSet.getTableNames().length > expectedNames.length); String[] actualNames = filter.getTableNames(dataSet); assertEquals("name count", expectedNames.length, actualNames.length); assertEquals("names", Arrays.asList(expectedNames), Arrays.asList(actualNames)); } public void testGetDuplicateTableNames() throws Exception { String[] expectedNames = getExpectedDuplicateNames(); ExcludeTableFilter filter = new ExcludeTableFilter(); filter.excludeTable(getExtraTableName()); IDataSet dataSet = createDuplicateDataSet(); assertTrue("dataset names count", dataSet.getTableNames().length > expectedNames.length); String[] actualNames = filter.getTableNames(dataSet); assertEquals("name count", expectedNames.length, actualNames.length); assertEquals("names", Arrays.asList(expectedNames), Arrays.asList(actualNames)); } public void testGetCaseInsensitiveTableNames() throws Exception { ExcludeTableFilter filter = new ExcludeTableFilter(); filter.excludeTable(getExtraTableName()); String[] expectedNames = getExpectedLowerNames(); IDataSet dataSet = new LowerCaseDataSet(createDataSet()); assertTrue("dataset names count", dataSet.getTableNames().length > expectedNames.length); String[] actualNames = filter.getTableNames(dataSet); assertEquals("name count", expectedNames.length, actualNames.length); assertEquals("names", Arrays.asList(expectedNames), Arrays.asList(actualNames)); } public void testGetReverseTableNames() throws Exception { // Cannot test! } public void testGetTables() throws Exception { String[] expectedNames = getExpectedNames(); ExcludeTableFilter filter = new ExcludeTableFilter(); filter.excludeTable(getExtraTableName()); IDataSet dataSet = createDataSet(); assertTrue("dataset names count", dataSet.getTableNames().length > expectedNames.length); ITable[] actualTables = filter.getTables(dataSet); String[] actualNames = new DefaultDataSet(actualTables).getTableNames(); assertEquals("table count", expectedNames.length, actualTables.length); assertEquals("table names", Arrays.asList(expectedNames), Arrays.asList(actualNames)); } public void testGetDuplicateTables() throws Exception { String[] expectedNames = getExpectedDuplicateNames(); ExcludeTableFilter filter = new ExcludeTableFilter(); filter.excludeTable(getExtraTableName()); IDataSet dataSet = createDuplicateDataSet(); assertTrue("dataset names count", dataSet.getTableNames().length > expectedNames.length); ITable[] actualTables = filter.getTables(dataSet); String[] actualNames = new DefaultDataSet(actualTables).getTableNames(); assertEquals("table count", expectedNames.length, actualTables.length); assertEquals("table names", Arrays.asList(expectedNames), Arrays.asList(actualNames)); } public void testGetCaseInsensitiveTables() throws Exception { ExcludeTableFilter filter = new ExcludeTableFilter(); filter.excludeTable(getExtraTableName()); String[] expectedNames = getExpectedLowerNames(); IDataSet dataSet = new LowerCaseDataSet(createDataSet()); assertTrue("dataset names count", dataSet.getTableNames().length > expectedNames.length); ITable[] actualTables = filter.getTables(dataSet); String[] actualNames = new DefaultDataSet(actualTables).getTableNames(); assertEquals("table count", expectedNames.length, actualTables.length); assertEquals("table names", Arrays.asList(expectedNames), Arrays.asList(actualNames)); } public void testGetReverseTables() throws Exception { // Cannot test! } public void testGetTablesAndTableNotInDecoratedDataSet() throws Exception { String[] expectedNames = getExpectedNames(); ExcludeTableFilter filter = new ExcludeTableFilter(); filter.excludeTable(getExtraTableName()); filter.excludeTable("UNKNOWN_TABLE"); IDataSet dataSet = createDataSet(); assertTrue("dataset names count", dataSet.getTableNames().length > expectedNames.length); ITable[] actualTables = filter.getTables(dataSet); String[] actualNames = new DefaultDataSet(actualTables).getTableNames(); assertEquals("table count", expectedNames.length, actualTables.length); assertEquals("table names", Arrays.asList(expectedNames), Arrays.asList(actualNames)); } } --- NEW FILE: IncludeTableFilterTest.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.filter; import org.dbunit.database.AmbiguousTableNameException; import org.dbunit.dataset.*; import java.util.Arrays; import java.util.List; import java.util.ArrayList; /** * @author Manuel Laflamme * @since Mar 11, 2003 * @version $Revision: 1.1 $ */ public class IncludeTableFilterTest extends AbstractTableFilterTest { public IncludeTableFilterTest(String s) { super(s); } public void testIsValidName() throws Exception { String[] validNames = getExpectedNames(); ITableFilter filter = new IncludeTableFilter(validNames); for (int i = 0; i < validNames.length; i++) { String validName = validNames[i]; assertEquals(validName, true, filter.isValidName(validName)); } } public void testIsCaseInsensitiveValidName() throws Exception { String[] validNames = getExpectedNames(); ITableFilter filter = new IncludeTableFilter(validNames); for (int i = 0; i < validNames.length; i++) { String validName = validNames[i]; assertEquals(validName, true, filter.isValidName(validName)); } } public void testIsValidNameAndInvalid() throws Exception { String[] invalidNames = new String[] { "INVALID_TABLE", "UNKNOWN_TABLE", }; String[] validNames = getExpectedNames(); ITableFilter filter = new IncludeTableFilter(validNames); for (int i = 0; i < invalidNames.length; i++) { String invalidName = invalidNames[i]; assertEquals(invalidName, false, filter.isValidName(invalidName)); } } public void testGetTableNames() throws Exception { String[] expectedNames = getExpectedNames(); ITableFilter filter = new IncludeTableFilter(expectedNames); IDataSet dataSet = createDataSet(); assertTrue("dataset names count", dataSet.getTableNames().length > expectedNames.length); String[] actualNames = filter.getTableNames(dataSet); assertEquals("name count", expectedNames.length, actualNames.length); assertEquals("names", Arrays.asList(expectedNames), Arrays.asList(actualNames)); } public void testGetTableNamesAndTableNotInDecoratedDataSet() throws Exception { String[] expectedNames = getExpectedNames(); List filterNameList = new ArrayList(Arrays.asList(expectedNames)); filterNameList.add("UNKNOWN_TABLE"); String[] filterNames = (String[])filterNameList.toArray(new String[0]); ITableFilter filter = new IncludeTableFilter(filterNames); IDataSet dataSet = createDataSet(); assertTrue("dataset names count", dataSet.getTableNames().length > expectedNames.length); String[] actualNames = filter.getTableNames(dataSet); assertEquals("name count", expectedNames.length, actualNames.length); assertEquals("names", Arrays.asList(expectedNames), Arrays.asList(actualNames)); } public void testGetDuplicateTableNames() throws Exception { String[] expectedNames = getExpectedDuplicateNames(); ITableFilter filter = new IncludeTableFilter(expectedNames); IDataSet dataSet = createDuplicateDataSet(); assertTrue("dataset names count", dataSet.getTableNames().length > expectedNames.length); String[] actualNames = filter.getTableNames(dataSet); assertEquals("name count", expectedNames.length, actualNames.length); assertEquals("names", Arrays.asList(expectedNames), Arrays.asList(actualNames)); } public void testGetCaseInsensitiveTableNames() throws Exception { String[] filterNames = getExpectedNames(); ITableFilter filter = new IncludeTableFilter(filterNames); String[] expectedNames = getExpectedLowerNames(); IDataSet dataSet = new LowerCaseDataSet(createDataSet()); assertTrue("dataset names count", dataSet.getTableNames().length > expectedNames.length); String[] actualNames = filter.getTableNames(dataSet); assertEquals("name count", expectedNames.length, actualNames.length); assertEquals("names", Arrays.asList(expectedNames), Arrays.asList(actualNames)); } public void testGetReverseTableNames() throws Exception { String[] expectedNames = getExpectedNames(); String[] filterNames = DataSetUtils.reverseStringArray(expectedNames); ITableFilter filter = new IncludeTableFilter(filterNames); IDataSet dataSet = createDataSet(); assertTrue("dataset names count", dataSet.getTableNames().length > expectedNames.length); String[] actualNames = filter.getTableNames(dataSet); assertEquals("name count", expectedNames.length, actualNames.length); assertEquals("names", Arrays.asList(expectedNames), Arrays.asList(actualNames)); } public void testGetTables() throws Exception { String[] expectedNames = getExpectedNames(); ITableFilter filter = new IncludeTableFilter(expectedNames); IDataSet dataSet = createDataSet(); assertTrue("dataset names count", dataSet.getTableNames().length > expectedNames.length); ITable[] actualTables = filter.getTables(dataSet); String[] actualNames = new DefaultDataSet(actualTables).getTableNames(); assertEquals("table count", expectedNames.length, actualTables.length); assertEquals("table names", Arrays.asList(expectedNames), Arrays.asList(actualNames)); } public void testGetDuplicateTables() throws Exception { String[] expectedNames = getExpectedDuplicateNames(); ITableFilter filter = new IncludeTableFilter(expectedNames); IDataSet dataSet = createDuplicateDataSet(); assertTrue("dataset names count", dataSet.getTableNames().length > expectedNames.length); ITable[] actualTables = filter.getTables(dataSet); String[] actualNames = new DefaultDataSet(actualTables).getTableNames(); assertEquals("table count", expectedNames.length, actualTables.length); assertEquals("table names", Arrays.asList(expectedNames), Arrays.asList(actualNames)); } public void testGetCaseInsensitiveTables() throws Exception { ITableFilter filter = new IncludeTableFilter(getExpectedNames()); String[] lowerNames = getExpectedLowerNames(); IDataSet dataSet = new LowerCaseDataSet(createDataSet()); assertTrue("dataset names count", dataSet.getTableNames().length > lowerNames.length); ITable[] actualTables = filter.getTables(dataSet); String[] actualNames = new DefaultDataSet(actualTables).getTableNames(); assertEquals("table count", lowerNames.length, actualTables.length); assertEquals("table names", Arrays.asList(lowerNames), Arrays.asList(actualNames)); } public void testGetReverseTables() throws Exception { String[] expectedNames = getExpectedNames(); String[] filterNames = DataSetUtils.reverseStringArray(expectedNames); ITableFilter filter = new IncludeTableFilter(filterNames); IDataSet dataSet = createDataSet(); assertTrue("dataset names count", dataSet.getTableNames().length > expectedNames.length); ITable[] actualTables = filter.getTables(dataSet); String[] actualNames = new DefaultDataSet(actualTables).getTableNames(); assertEquals("table count", expectedNames.length, actualTables.length); assertEquals("table names", Arrays.asList(expectedNames), Arrays.asList(actualNames)); } public void testGetTablesAndTableNotInDecoratedDataSet() throws Exception { String[] expectedNames = getExpectedNames(); List filterNameList = new ArrayList(Arrays.asList(expectedNames)); filterNameList.add("UNKNOWN_TABLE"); String[] filterNames = (String[])filterNameList.toArray(new String[0]); ITableFilter filter = new IncludeTableFilter(filterNames); IDataSet dataSet = createDataSet(); assertTrue("dataset names count", dataSet.getTableNames().length > expectedNames.length); ITable[] actualTables = filter.getTables(dataSet); String[] actualNames = new DefaultDataSet(actualTables).getTableNames(); assertEquals("table count", expectedNames.length, actualTables.length); assertEquals("table names", Arrays.asList(expectedNames), Arrays.asList(actualNames)); } } Index: AllTests.java =================================================================== RCS file: /cvsroot/dbunit/./dbunit/src/test/org/dbunit/dataset/filter/AllTests.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AllTests.java 11 Mar 2003 13:26:02 -0000 1.1 --- AllTests.java 19 Mar 2003 01:56:18 -0000 1.2 *************** *** 34,37 **** --- 34,39 ---- { TestSuite suite = new TestSuite(); + suite.addTest(new TestSuite(ExcludeTableFilterTest.class)); + suite.addTest(new TestSuite(IncludeTableFilterTest.class)); suite.addTest(new TestSuite(SequenceTableFilterTest.class)); Index: AbstractTableFilterTest.java =================================================================== RCS file: /cvsroot/dbunit/./dbunit/src/test/org/dbunit/dataset/filter/AbstractTableFilterTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AbstractTableFilterTest.java 11 Mar 2003 13:26:02 -0000 1.1 --- AbstractTableFilterTest.java 19 Mar 2003 01:56:18 -0000 1.2 *************** *** 23,26 **** --- 23,28 ---- import org.dbunit.dataset.IDataSet; import org.dbunit.dataset.CompositeDataSet; + import org.dbunit.dataset.DefaultDataSet; + import org.dbunit.dataset.DefaultTable; import org.dbunit.dataset.xml.XmlDataSet; *************** *** 44,47 **** --- 46,50 ---- "EMPTY_MULTITYPE_TABLE", }; + private static final String[] DUPLICATE_TABLE_NAMES = { "DUPLICATE_TABLE", *************** *** 50,53 **** --- 53,58 ---- }; + private static final String EXTRA_TABLE_NAME = "EXTRA_TABLE"; + public AbstractTableFilterTest(String s) { *************** *** 76,85 **** } protected IDataSet createDataSet() throws Exception { IDataSet dataSet1 = new XmlDataSet( new FileReader("src/xml/dataSetTest.xml")); ! IDataSet dataSet2 = new XmlDataSet( ! new FileReader("src/xml/filteredDataSetTest.xml")); IDataSet dataSet = new CompositeDataSet(dataSet1, dataSet2); --- 81,95 ---- } + public String getExtraTableName() + { + return EXTRA_TABLE_NAME; + } + protected IDataSet createDataSet() throws Exception { IDataSet dataSet1 = new XmlDataSet( new FileReader("src/xml/dataSetTest.xml")); ! IDataSet dataSet2 = new DefaultDataSet( ! new DefaultTable(getExtraTableName())); IDataSet dataSet = new CompositeDataSet(dataSet1, dataSet2); *************** *** 93,98 **** IDataSet dataSet1 = new XmlDataSet( new FileReader("src/xml/xmlDataSetDuplicateTest.xml")); ! IDataSet dataSet2 = new XmlDataSet( ! new FileReader("src/xml/filteredDataSetTest.xml")); IDataSet dataSet = new CompositeDataSet(dataSet1, dataSet2, false); --- 103,108 ---- IDataSet dataSet1 = new XmlDataSet( new FileReader("src/xml/xmlDataSetDuplicateTest.xml")); ! IDataSet dataSet2 = new DefaultDataSet( ! new DefaultTable(getExtraTableName())); IDataSet dataSet = new CompositeDataSet(dataSet1, dataSet2, false); *************** *** 116,119 **** --- 126,131 ---- public abstract void testGetReverseTableNames() throws Exception; + public abstract void testGetTableNamesAndTableNotInDecoratedDataSet() throws Exception; + public abstract void testGetTables() throws Exception; *************** *** 123,125 **** --- 135,140 ---- public abstract void testGetReverseTables() throws Exception; + + public abstract void testGetTablesAndTableNotInDecoratedDataSet() throws Exception; + } Index: SequenceTableFilterTest.java =================================================================== RCS file: /cvsroot/dbunit/./dbunit/src/test/org/dbunit/dataset/filter/SequenceTableFilterTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SequenceTableFilterTest.java 18 Mar 2003 03:35:39 -0000 1.2 --- SequenceTableFilterTest.java 19 Mar 2003 01:56:18 -0000 1.3 *************** *** 29,32 **** --- 29,34 ---- import java.io.FileReader; import java.util.Arrays; + import java.util.List; + import java.util.ArrayList; /** *************** *** 101,105 **** { String[] expectedNames = getExpectedNames(); ! ITableFilter filter = new SequenceTableFilter(expectedNames); IDataSet dataSet = createDataSet(); --- 103,111 ---- { String[] expectedNames = getExpectedNames(); ! ! List filterNameList = new ArrayList(Arrays.asList(expectedNames)); ! filterNameList.add("UNKNOWN_TABLE"); ! String[] filterNames = (String[])filterNameList.toArray(new String[0]); ! ITableFilter filter = new SequenceTableFilter(filterNames); IDataSet dataSet = createDataSet(); *************** *** 231,233 **** --- 237,258 ---- } + public void testGetTablesAndTableNotInDecoratedDataSet() throws Exception + { + String[] expectedNames = getExpectedNames(); + + List filterNameList = new ArrayList(Arrays.asList(expectedNames)); + filterNameList.add("UNKNOWN_TABLE"); + String[] filterNames = (String[])filterNameList.toArray(new String[0]); + ITableFilter filter = new SequenceTableFilter(filterNames); + + IDataSet dataSet = createDataSet(); + assertTrue("dataset names count", + dataSet.getTableNames().length > expectedNames.length); + + ITable[] actualTables = filter.getTables(dataSet); + String[] actualNames = new DefaultDataSet(actualTables).getTableNames(); + assertEquals("table count", expectedNames.length, actualTables.length); + assertEquals("table names", + Arrays.asList(expectedNames), Arrays.asList(actualNames)); + } } |
From: <mla...@us...> - 2003-03-18 12:49:40
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv21263/dbunit/src/java/org/dbunit/dataset Modified Files: ReplacementTable.java Log Message: Optimize object replacement. Index: ReplacementTable.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/ReplacementTable.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ReplacementTable.java 18 Mar 2003 03:29:47 -0000 1.1 --- ReplacementTable.java 18 Mar 2003 12:49:37 -0000 1.2 *************** *** 103,124 **** // Object replacement ! for (Iterator it = _objectMap.entrySet().iterator(); it.hasNext();) { ! Map.Entry entry = (Map.Entry)it.next(); ! Object original = entry.getKey(); ! Object replacement = entry.getValue(); ! ! if (objectValue == null && original == null) ! { ! return replacement; ! } ! ! if (objectValue != null && objectValue.equals(original)) ! { ! return replacement; ! } } ! if (!(objectValue instanceof String)) { return objectValue; --- 103,113 ---- // Object replacement ! if (_objectMap.containsKey(objectValue)) { ! return _objectMap.get(objectValue); } ! // Stop here if substring replacement not applicable ! if (_substringMap.size() == 0 || !(objectValue instanceof String)) { return objectValue; |
From: <mla...@us...> - 2003-03-18 03:35:42
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/filter In directory sc8-pr-cvs1:/tmp/cvs-serv17904/dbunit/src/java/org/dbunit/dataset/filter Modified Files: ExcludeTableFilter.java IncludeTableFilter.java Log Message: Reuse IncludeTableFilter to implement ExcludeTableFilter. Index: ExcludeTableFilter.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/filter/ExcludeTableFilter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExcludeTableFilter.java 11 Mar 2003 13:26:03 -0000 1.1 --- ExcludeTableFilter.java 18 Mar 2003 03:35:38 -0000 1.2 *************** *** 35,46 **** public class ExcludeTableFilter extends AbstractTableFilter implements ITableFilter { ! private Set _forbidenNames = new HashSet(); /** ! * Create a new empty ExcludeTableFilter. Use {@link #addTableName} to hide * some tables. */ public ExcludeTableFilter() { } --- 35,47 ---- public class ExcludeTableFilter extends AbstractTableFilter implements ITableFilter { ! private final IncludeTableFilter _includeFilter; /** ! * Create a new empty ExcludeTableFilter. Use {@link #excludeTable} to hide * some tables. */ public ExcludeTableFilter() { + _includeFilter = new IncludeTableFilter(); } *************** *** 50,58 **** public ExcludeTableFilter(String[] tableNames) { ! for (int i = 0; i < tableNames.length; i++) ! { ! String tableName = tableNames[i]; ! addTableName(tableName); ! } } --- 51,55 ---- public ExcludeTableFilter(String[] tableNames) { ! _includeFilter = new IncludeTableFilter(tableNames); } *************** *** 60,66 **** * Add a new table name to exclude in this filter. */ ! public void addTableName(String tableName) { ! _forbidenNames.add(tableName.toUpperCase()); } --- 57,63 ---- * Add a new table name to exclude in this filter. */ ! public void excludeTable(String tableName) { ! _includeFilter.includeTable(tableName); } *************** *** 70,74 **** public boolean isValidName(String tableName) { ! return !_forbidenNames.contains(tableName.toUpperCase()); } } --- 67,71 ---- public boolean isValidName(String tableName) { ! return !_includeFilter.isValidName(tableName); } } Index: IncludeTableFilter.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/filter/IncludeTableFilter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** IncludeTableFilter.java 11 Mar 2003 13:26:03 -0000 1.1 --- IncludeTableFilter.java 18 Mar 2003 03:35:38 -0000 1.2 *************** *** 38,42 **** /** ! * Create a new empty IncludeTableFilter. Use {@link #addTableName} to allow * access to some tables. */ --- 38,42 ---- /** ! * Create a new empty IncludeTableFilter. Use {@link #includeTable} to allow * access to some tables. */ *************** *** 53,57 **** { String tableName = tableNames[i]; ! addTableName(tableName); } } --- 53,57 ---- { String tableName = tableNames[i]; ! includeTable(tableName); } } *************** *** 60,64 **** * Add a new table name to include in this filter. */ ! public void addTableName(String tableName) { _allowedNames.add(tableName.toUpperCase()); --- 60,64 ---- * Add a new table name to include in this filter. */ ! public void includeTable(String tableName) { _allowedNames.add(tableName.toUpperCase()); |
From: <mla...@us...> - 2003-03-18 03:35:42
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/filter In directory sc8-pr-cvs1:/tmp/cvs-serv17904/dbunit/src/test/org/dbunit/dataset/filter Modified Files: SequenceTableFilterTest.java Log Message: Reuse IncludeTableFilter to implement ExcludeTableFilter. Index: SequenceTableFilterTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/filter/SequenceTableFilterTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SequenceTableFilterTest.java 11 Mar 2003 13:26:02 -0000 1.1 --- SequenceTableFilterTest.java 18 Mar 2003 03:35:39 -0000 1.2 *************** *** 55,70 **** } - public void testIsValidName2() throws Exception - { - // String[] validNames = getExpectedNames(); - // ITableFilter filter = new SequenceTableFilter(validNames); - // - // for (int i = 0; i < validNames.length; i++) - // { - // String validName = validNames[i]; - // assertEquals(validName, true, filter.isValidName(validName)); - // } - } - public void testIsCaseInsensitiveValidName() throws Exception { --- 55,58 ---- *************** *** 96,99 **** --- 84,102 ---- public void testGetTableNames() throws Exception + { + String[] expectedNames = getExpectedNames(); + ITableFilter filter = new SequenceTableFilter(expectedNames); + + IDataSet dataSet = createDataSet(); + assertTrue("dataset names count", + dataSet.getTableNames().length > expectedNames.length); + + String[] actualNames = filter.getTableNames(dataSet); + assertEquals("name count", expectedNames.length, actualNames.length); + assertEquals("names", + Arrays.asList(expectedNames), Arrays.asList(actualNames)); + } + + public void testGetTableNamesAndTableNotInDecoratedDataSet() throws Exception { String[] expectedNames = getExpectedNames(); |
From: <mla...@us...> - 2003-03-18 03:29:50
|
Update of /cvsroot/dbunit/./dbunit/src/java/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv16231/dbunit/src/java/org/dbunit/dataset Added Files: ReplacementDataSet.java ReplacementTable.java Log Message: Added ReplacementDataSet/ReplacementTable. --- NEW FILE: ReplacementDataSet.java --- /* * * The DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.dataset; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.HashMap; /** * Decorator that replace configured values from the decorated dataset * with replacement values. * * @author Manuel Laflamme * @since Mar 17, 2003 * @version $Revision: 1.1 $ */ public class ReplacementDataSet implements IDataSet { private final IDataSet _dataSet; private final Map _objectMap; private final Map _substringMap; /** * Create a new ReplacementDataSet object that decorates the specified dataset. * * @param dataSet the decorated table */ public ReplacementDataSet(IDataSet dataSet) { _dataSet = dataSet; _objectMap = new HashMap(); _substringMap = new HashMap(); } /** * Add a new Object replacement mapping. * * @param originalObject the object to replace * @param replacementObject the replacement object */ public void addReplacementObject(Object originalObject, Object replacementObject) { _objectMap.put(originalObject, replacementObject); } /** * Add a new substring replacement mapping. * * @param originalSubstring the substring to replace * @param replacementSubstring the replacement substring */ public void addReplacementSubstring(String originalSubstring, String replacementSubstring) { if (originalSubstring == null || replacementSubstring == null) { throw new NullPointerException(); } _substringMap.put(originalSubstring, replacementSubstring); } //////////////////////////////////////////////////////////////////////////// // IDataSet interface public String[] getTableNames() throws DataSetException { return _dataSet.getTableNames(); } public ITableMetaData getTableMetaData(String tableName) throws DataSetException { return _dataSet.getTableMetaData(tableName); } public ITable getTable(String tableName) throws DataSetException { return new ReplacementTable(_dataSet.getTable(tableName), _objectMap, _substringMap); } public ITable[] getTables() throws DataSetException { List tableList = new ArrayList(); ITable[] tables = _dataSet.getTables(); for (int i = 0; i < tables.length; i++) { ITable table = tables[i]; tableList.add(new ReplacementTable(table, _objectMap, _substringMap)); } return (ITable[])tableList.toArray(new ITable[0]); } } --- NEW FILE: ReplacementTable.java --- /* * * The DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.dataset; import java.math.BigDecimal; import java.util.Map; import java.util.HashMap; import java.util.Iterator; /** * Decorator that replace configured values from the decorated table * with replacement values. * * @author Manuel Laflamme * @since Mar 17, 2003 * @version $Revision: 1.1 $ */ public class ReplacementTable implements ITable { private final ITable _table; private final Map _objectMap; private final Map _substringMap; /** * Create a new ReplacementTable object that decorates the specified table. * * @param table the decorated table */ public ReplacementTable(ITable table) { this(table, new HashMap(), new HashMap()); } ReplacementTable(ITable table, Map objectMap, Map substringMap) { _table = table; _objectMap = objectMap; _substringMap = substringMap; } /** * Add a new Object replacement mapping. * * @param originalObject the object to replace * @param replacementObject the replacement object */ public void addReplacementObject(Object originalObject, Object replacementObject) { _objectMap.put(originalObject, replacementObject); } /** * Add a new substring replacement mapping. * * @param originalSubstring the substring to replace * @param replacementSubstring the replacement substring */ public void addReplacementSubstring(String originalSubstring, String replacementSubstring) { if (originalSubstring == null || replacementSubstring == null) { throw new NullPointerException(); } _substringMap.put(originalSubstring, replacementSubstring); } //////////////////////////////////////////////////////////////////////// // ITable interface public ITableMetaData getTableMetaData() { return _table.getTableMetaData(); } public int getRowCount() { return _table.getRowCount(); } public Object getValue(int row, String column) throws DataSetException { Object objectValue = _table.getValue(row, column); // Object replacement for (Iterator it = _objectMap.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry)it.next(); Object original = entry.getKey(); Object replacement = entry.getValue(); if (objectValue == null && original == null) { return replacement; } if (objectValue != null && objectValue.equals(original)) { return replacement; } } if (!(objectValue instanceof String)) { return objectValue; } // Substring replacement String stringValue = (String)objectValue; for (Iterator it = _substringMap.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry)it.next(); String original = (String)entry.getKey(); String replacement = (String)entry.getValue(); int startIndex = 0; int lastEndIndex = 0; StringBuffer buffer = null; for(;;) { startIndex = stringValue.indexOf(original, lastEndIndex); if (startIndex == -1) { if (buffer != null) { buffer.append(stringValue.substring(lastEndIndex)); } break; } if (buffer == null) { buffer = new StringBuffer(); } buffer.append(stringValue.substring(lastEndIndex, startIndex)); buffer.append(replacement); lastEndIndex = startIndex + original.length(); } if (buffer != null) { return buffer.toString(); } } return objectValue; } } |
From: <mla...@us...> - 2003-03-18 03:29:50
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv16231/dbunit/src/test/org/dbunit/dataset Modified Files: AllTests.java Added Files: ReplacementTableTest.java ReplacementDataSetTest.java Log Message: Added ReplacementDataSet/ReplacementTable. --- NEW FILE: ReplacementTableTest.java --- /* * * The DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.dataset; import org.dbunit.dataset.xml.FlatXmlDataSet; import org.dbunit.dataset.datatype.DataType; import org.dbunit.Assertion; import java.io.File; import java.util.List; import java.util.ArrayList; import java.sql.Date; import java.math.BigDecimal; /** * * @author Manuel Laflamme * @since Mar 17, 2003 * @version $Revision: 1.1 $ */ public class ReplacementTableTest extends AbstractTableTest { public ReplacementTableTest(String s) { super(s); } protected ITable createTable() throws Exception { return createDataSet().getTable("TEST_TABLE"); } private IDataSet createDataSet() throws Exception { return new BooleanDataSet( new FlatXmlDataSet(new File("src/xml/flatXmlTableTest.xml"))); } public void testGetMissingValue() throws Exception { // TODO test something usefull } public void testObjectReplacement() throws Exception { String tableName = "TABLE_NAME"; BigDecimal trueObject = new BigDecimal(1); BigDecimal falseObject = new BigDecimal(1); Date now = new Date(System.currentTimeMillis()); Column[] columns = new Column[] { new Column("BOOLEAN_TRUE", DataType.BOOLEAN), new Column("BOOLEAN_FALSE", DataType.BOOLEAN), new Column("STRING_TRUE", DataType.CHAR), new Column("STRING_FALSE", DataType.CHAR), new Column("STRING_VALUE", DataType.CHAR), new Column("DATE_VALUE", DataType.DATE), new Column("NULL_TO_STRING_VALUE", DataType.CHAR), new Column("STRING_TO_NULL_VALUE", DataType.CHAR), }; // Setup actual table Object[] actualRow = new Object[] { Boolean.TRUE, Boolean.FALSE, Boolean.TRUE.toString(), Boolean.FALSE.toString(), "value", "now", null, "null", }; List actualRowList = new ArrayList(); actualRowList.add(actualRow); ITable originalTable = new DefaultTable(tableName, columns, actualRowList); ReplacementTable actualTable = new ReplacementTable(originalTable); actualTable.addReplacementObject(Boolean.TRUE, trueObject); actualTable.addReplacementObject(Boolean.FALSE, falseObject); actualTable.addReplacementObject("now", now); actualTable.addReplacementObject("null", null); actualTable.addReplacementObject(null, "nullreplacement"); // Setup expected table Object[] expectedRow = new Object[] { trueObject, falseObject, Boolean.TRUE.toString(), Boolean.FALSE.toString(), "value", now, "nullreplacement", null, }; List expectedRowList = new ArrayList(); expectedRowList.add(expectedRow); ITable expectedTable = new DefaultTable(tableName, columns, expectedRowList); Assertion.assertEquals(expectedTable, actualTable); } public void testSubstringReplacement() throws Exception { String tableName = "TABLE_NAME"; Column[] columns = new Column[] { new Column("ONLY_SUBSTRING", DataType.CHAR), new Column("START_SUBSTRING", DataType.CHAR), new Column("MIDDLE_SUBSTRING", DataType.CHAR), new Column("END_SUBSTRING", DataType.CHAR), new Column("MULTIPLE_SUBSTRING", DataType.CHAR), new Column("NO_SUBSTRING", DataType.CHAR), new Column("NOT_A_STRING", DataType.NUMERIC), new Column("NULL_VALUE", DataType.CHAR), }; // Setup actual table Object[] actualRow = new Object[] { "substring", "substring_", "_substring_", "_substring", "substringsubstring substring", "this is a string", new Long(0), null, }; List actualRowList = new ArrayList(); actualRowList.add(actualRow); ITable originalTable = new DefaultTable(tableName, columns, actualRowList); ReplacementTable actualTable = new ReplacementTable(originalTable); actualTable.addReplacementSubstring("substring", "replacement"); // Setup expected table Object[] expectedRow = new Object[] { "replacement", "replacement_", "_replacement_", "_replacement", "replacementreplacement replacement", "this is a string", new Long(0), null, }; List expectedRowList = new ArrayList(); expectedRowList.add(expectedRow); ITable expectedTable = new DefaultTable(tableName, columns, expectedRowList); Assertion.assertEquals(expectedTable, actualTable); } public void testAddNullReplacementSubstring() throws Exception { ReplacementTable replacementTable = new ReplacementTable(new DefaultTable("TABLE")); try { replacementTable.addReplacementSubstring(null, "replacement"); fail("Should not be here!"); } catch (NullPointerException e) { } try { replacementTable.addReplacementSubstring("substring", null); fail("Should not be here!"); } catch (NullPointerException e) { } } } --- NEW FILE: ReplacementDataSetTest.java --- /* * * The DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.dataset; import org.dbunit.dataset.xml.FlatXmlDataSet; import java.io.FileReader; /** * @author Manuel Laflamme * @since Mar 17, 2003 * @version $Revision: 1.1 $ */ public class ReplacementDataSetTest extends AbstractDataSetTest { public ReplacementDataSetTest(String s) { super(s); } //////////////////////////////////////////////////////////////////////////// // AbstractDataSetTest class protected IDataSet createDataSet() throws Exception { return new ReplacementDataSet(new FlatXmlDataSet(new FileReader( "src/xml/flatXmlDataSetTest.xml"))); } protected IDataSet createDuplicateDataSet() throws Exception { return new ReplacementDataSet(new FlatXmlDataSet(new FileReader( "src/xml/flatXmlDataSetDuplicateTest.xml"))); } } Index: AllTests.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/AllTests.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** AllTests.java 17 Mar 2003 00:51:24 -0000 1.13 --- AllTests.java 18 Mar 2003 03:29:46 -0000 1.14 *************** *** 55,58 **** --- 55,60 ---- suite.addTest(new TestSuite(LowerCaseDataSetTest.class)); suite.addTest(new TestSuite(LowerCaseTableMetaDataTest.class)); + suite.addTest(new TestSuite(ReplacementDataSetTest.class)); + suite.addTest(new TestSuite(ReplacementTableTest.class)); suite.addTest(new TestSuite(SortedDataSetTest.class)); suite.addTest(new TestSuite(SortedTableTest.class)); |
From: <mla...@us...> - 2003-03-17 02:44:20
|
Update of /cvsroot/dbunit/./dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv11429/dbunit Added Files: todo.txt Log Message: TODO list |
From: <mla...@us...> - 2003-03-17 01:40:20
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv25403/dbunit/src/java/org/dbunit/dataset Modified Files: BooleanDataSet.java BooleanTable.java Log Message: Added some javadoc. Index: BooleanDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/BooleanDataSet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BooleanDataSet.java 17 Mar 2003 00:51:25 -0000 1.1 --- BooleanDataSet.java 17 Mar 2003 01:40:12 -0000 1.2 *************** *** 21,29 **** package org.dbunit.dataset; - import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; /** * @author Manuel Laflamme * @since Mar 14, 2003 --- 21,31 ---- package org.dbunit.dataset; import java.util.ArrayList; import java.util.List; /** + * Decorator that exposes Boolean value of the decorated dataset tables to + * specified replacement values. + * * @author Manuel Laflamme * @since Mar 14, 2003 *************** *** 36,39 **** --- 38,47 ---- private final Object _falseValue; + /** + * Creates a BooleanDataSet that decorates the specified dataset using + * numbers 0 and 1 as replacement values. + * + * @param dataSet the decorated dataset + */ public BooleanDataSet(IDataSet dataSet) { *************** *** 41,44 **** --- 49,67 ---- _falseValue = BooleanTable.DEFAULT_FALSE_VALUE; _trueValue = BooleanTable.DEFAULT_TRUE_VALUE; + } + + /** + * Creates a BooleanDataSet that decorates the specified dataset using + * specified replacement values. + * + * @param dataSet the decorated dataset. + * @param trueValue the replacement value for {@link Boolean#TRUE} + * @param falseValue the replacement value for {@link Boolean#FALSE} + */ + public BooleanDataSet(IDataSet dataSet, Object trueValue, Object falseValue) + { + _dataSet = dataSet; + _trueValue = trueValue; + _falseValue = falseValue; } Index: BooleanTable.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/BooleanTable.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BooleanTable.java 17 Mar 2003 00:51:25 -0000 1.1 --- BooleanTable.java 17 Mar 2003 01:40:12 -0000 1.2 *************** *** 21,30 **** package org.dbunit.dataset; - import org.dbunit.dataset.datatype.NumberDataType; - import org.dbunit.dataset.datatype.DataType; - import java.math.BigDecimal; /** * @author Manuel Laflamme * @since Mar 14, 2003 --- 21,30 ---- package org.dbunit.dataset; import java.math.BigDecimal; /** + * Decorator that exposes Boolean value of the decorated table to specified + * replacement values. + * * @author Manuel Laflamme * @since Mar 14, 2003 *************** *** 40,43 **** --- 40,49 ---- private final Object _falseValue; + /** + * Creates a BooleanTable that decorates the specified table using numbers + * 0 and 1 as replacement values. + * + * @param table the decorated table + */ public BooleanTable(ITable table) { *************** *** 45,48 **** --- 51,62 ---- } + /** + * Creates a BooleanTable that decorates the specified table and using the + * specified replacement values. + * + * @param table the decorated table + * @param trueValue the replacement value for {@link Boolean#TRUE} + * @param falseValue the replacement value for {@link Boolean#FALSE} + */ BooleanTable(ITable table, Object trueValue, Object falseValue) { |
From: <mla...@us...> - 2003-03-17 00:51:28
|
Update of /cvsroot/dbunit/./dbunit/src/java/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv8234a/dbunit/src/java/org/dbunit/dataset Added Files: BooleanDataSet.java BooleanTable.java Log Message: Added BooleanDataSet and BooleanTable, which convert Boolean value to 0 or 1 numeric value. --- NEW FILE: BooleanDataSet.java --- /* * * The DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.dataset; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; /** * @author Manuel Laflamme * @since Mar 14, 2003 * @version $Revision: 1.1 $ */ public class BooleanDataSet implements IDataSet { private final IDataSet _dataSet; private final Object _trueValue; private final Object _falseValue; public BooleanDataSet(IDataSet dataSet) { _dataSet = dataSet; _falseValue = BooleanTable.DEFAULT_FALSE_VALUE; _trueValue = BooleanTable.DEFAULT_TRUE_VALUE; } //////////////////////////////////////////////////////////////////////////// // IDataSet interface public String[] getTableNames() throws DataSetException { return _dataSet.getTableNames(); } public ITableMetaData getTableMetaData(String tableName) throws DataSetException { return _dataSet.getTableMetaData(tableName); } public ITable getTable(String tableName) throws DataSetException { return new BooleanTable(_dataSet.getTable(tableName), _trueValue, _falseValue); } public ITable[] getTables() throws DataSetException { List tableList = new ArrayList(); ITable[] tables = _dataSet.getTables(); for (int i = 0; i < tables.length; i++) { ITable table = tables[i]; tableList.add(new BooleanTable(table, _trueValue, _falseValue)); } return (ITable[])tableList.toArray(new ITable[0]); } } --- NEW FILE: BooleanTable.java --- /* * * The DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.dataset; import org.dbunit.dataset.datatype.NumberDataType; import org.dbunit.dataset.datatype.DataType; import java.math.BigDecimal; /** * @author Manuel Laflamme * @since Mar 14, 2003 * @version $Revision: 1.1 $ */ public class BooleanTable implements ITable { static final Number DEFAULT_TRUE_VALUE = new BigDecimal(1); static final Number DEFAULT_FALSE_VALUE = new BigDecimal(0); private final ITable _table; private final Object _trueValue; private final Object _falseValue; public BooleanTable(ITable table) { this(table, DEFAULT_TRUE_VALUE, DEFAULT_FALSE_VALUE); } BooleanTable(ITable table, Object trueValue, Object falseValue) { _table = table; _trueValue = trueValue; _falseValue = falseValue; } //////////////////////////////////////////////////////////////////////// // ITable interface public ITableMetaData getTableMetaData() { return _table.getTableMetaData(); } public int getRowCount() { return _table.getRowCount(); } public Object getValue(int row, String column) throws DataSetException { Object value = _table.getValue(row, column); if (value instanceof Boolean) { return value.equals(Boolean.TRUE) ? _trueValue : _falseValue; } return value; } } |
From: <mla...@us...> - 2003-03-17 00:51:28
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype In directory sc8-pr-cvs1:/tmp/cvs-serv8234a/dbunit/src/test/org/dbunit/dataset/datatype Modified Files: NumberDataTypeTest.java Log Message: Added BooleanDataSet and BooleanTable, which convert Boolean value to 0 or 1 numeric value. Index: NumberDataTypeTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/datatype/NumberDataTypeTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** NumberDataTypeTest.java 13 Jun 2002 17:25:00 -0000 1.7 --- NumberDataTypeTest.java 17 Mar 2003 00:51:24 -0000 1.8 *************** *** 73,76 **** --- 73,78 ---- "1234", "12.34", + Boolean.TRUE, + Boolean.FALSE, }; BigDecimal[] expected = { *************** *** 79,82 **** --- 81,86 ---- new BigDecimal(1234), new BigDecimal("12.34"), + new BigDecimal("1"), + new BigDecimal("0"), }; |
From: <mla...@us...> - 2003-03-17 00:51:28
|
Update of /cvsroot/dbunit/./dbunit/src/test/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv8234a/dbunit/src/test/org/dbunit/dataset Modified Files: AllTests.java Added Files: BooleanTableTest.java BooleanDataSetTest.java Log Message: Added BooleanDataSet and BooleanTable, which convert Boolean value to 0 or 1 numeric value. --- NEW FILE: BooleanTableTest.java --- /* * * The DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.dataset; import org.dbunit.dataset.xml.FlatXmlDataSet; import org.dbunit.dataset.datatype.DataType; import org.dbunit.Assertion; import java.io.File; import java.util.List; import java.util.ArrayList; import java.math.BigDecimal; /** * @author Manuel Laflamme * @since Mar 14, 2003 * @version $Revision: 1.1 $ */ public class BooleanTableTest extends AbstractTableTest { public BooleanTableTest(String s) { super(s); } protected ITable createTable() throws Exception { return createDataSet().getTable("TEST_TABLE"); } private IDataSet createDataSet() throws Exception { return new BooleanDataSet( new FlatXmlDataSet(new File("src/xml/flatXmlTableTest.xml"))); } public void testGetMissingValue() throws Exception { // TODO test something usefull } public void testBooleanValue() throws Exception { String tableName = "TABLE_NAME"; BigDecimal trueObject = new BigDecimal(1); BigDecimal falseObject = new BigDecimal(1); Column[] columns = new Column[] { new Column("BOOLEAN_TRUE", DataType.BOOLEAN), new Column("BOOLEAN_FALSE", DataType.BOOLEAN), new Column("STRING_TRUE", DataType.CHAR), new Column("STRING_FALSE", DataType.CHAR), new Column("STRING_VALUE", DataType.CHAR), new Column("NULL_VALUE", DataType.CHAR), }; // Setup actual table Object[] actualRow = new Object[] { Boolean.TRUE, Boolean.FALSE, Boolean.TRUE.toString(), Boolean.FALSE.toString(), "value", null, }; List actualRowList = new ArrayList(); actualRowList.add(actualRow); ITable actualTable = new DefaultTable(tableName, columns, actualRowList); actualTable = new BooleanTable(actualTable, trueObject, falseObject); // Setup expected table Object[] expectedRow = new Object[] { trueObject, falseObject, Boolean.TRUE.toString(), Boolean.FALSE.toString(), "value", null, }; List expectedRowList = new ArrayList(); expectedRowList.add(expectedRow); ITable expectedTable = new DefaultTable(tableName, columns, expectedRowList); Assertion.assertEquals(expectedTable, actualTable); } } --- NEW FILE: BooleanDataSetTest.java --- /* * * The DbUnit Database Testing Framework * Copyright (C)2002, Manuel Laflamme * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package org.dbunit.dataset; import org.dbunit.dataset.xml.FlatXmlDataSet; import java.io.FileReader; /** * @author Manuel Laflamme * @since Mar 14, 2003 * @version $Revision: 1.1 $ */ public class BooleanDataSetTest extends AbstractDataSetTest { public BooleanDataSetTest(String s) { super(s); } //////////////////////////////////////////////////////////////////////////// // AbstractDataSetTest class protected IDataSet createDataSet() throws Exception { return new BooleanDataSet(new FlatXmlDataSet(new FileReader( "src/xml/flatXmlDataSetTest.xml"))); } protected IDataSet createDuplicateDataSet() throws Exception { return new BooleanDataSet(new FlatXmlDataSet(new FileReader( "src/xml/flatXmlDataSetDuplicateTest.xml"))); } } Index: AllTests.java =================================================================== RCS file: /cvsroot/dbunit/./dbunit/src/test/org/dbunit/dataset/AllTests.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** AllTests.java 11 Mar 2003 13:26:02 -0000 1.12 --- AllTests.java 17 Mar 2003 00:51:24 -0000 1.13 *************** *** 41,44 **** --- 41,46 ---- suite.addTest(org.dbunit.dataset.filter.AllTests.suite()); suite.addTest(org.dbunit.dataset.xml.AllTests.suite()); + suite.addTest(new TestSuite(BooleanDataSetTest.class)); + suite.addTest(new TestSuite(BooleanTableTest.class)); suite.addTest(new TestSuite(CaseInsensitiveDataSetTest.class)); suite.addTest(new TestSuite(CaseInsensitiveTableTest.class)); |
From: <mla...@us...> - 2003-03-17 00:51:28
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype In directory sc8-pr-cvs1:/tmp/cvs-serv8234a/dbunit/src/java/org/dbunit/dataset/datatype Modified Files: NumberDataType.java Log Message: Added BooleanDataSet and BooleanTable, which convert Boolean value to 0 or 1 numeric value. Index: NumberDataType.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/datatype/NumberDataType.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** NumberDataType.java 13 Jun 2002 17:24:57 -0000 1.8 --- NumberDataType.java 17 Mar 2003 00:51:25 -0000 1.9 *************** *** 31,34 **** --- 31,37 ---- public class NumberDataType extends AbstractDataType { + private static final Number TRUE = new BigDecimal(1); + private static final Number FALSE = new BigDecimal(0); + NumberDataType(String name, int sqlType) { *************** *** 49,52 **** --- 52,60 ---- { return value; + } + + if (value instanceof Boolean) + { + return ((Boolean)value).booleanValue() ? TRUE : FALSE; } |
From: <mla...@us...> - 2003-03-17 00:43:55
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant In directory sc8-pr-cvs1:/tmp/cvs-serv5829/dbunit/src/java/org/dbunit/ant Modified Files: Export.java Log Message: Export optimization: do not fetch table data since DTD export only use tables metadata. Index: Export.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/ant/Export.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Export.java 15 Feb 2003 18:57:47 -0000 1.7 --- Export.java 17 Mar 2003 00:43:51 -0000 1.8 *************** *** 30,38 **** import org.dbunit.dataset.xml.XmlDataSet; ! import java.io.*; import java.sql.SQLException; import java.util.ArrayList; - import java.util.List; import java.util.Iterator; /** --- 30,41 ---- import org.dbunit.dataset.xml.XmlDataSet; ! import java.io.File; ! import java.io.FileWriter; ! import java.io.IOException; ! import java.io.Writer; import java.sql.SQLException; import java.util.ArrayList; import java.util.Iterator; + import java.util.List; /** *************** *** 50,56 **** private File _dest; ! private String _format = "flat"; private List _tables = new ArrayList(); ! // private List queries = new ArrayList(); public Export() --- 53,61 ---- 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() *************** *** 85,91 **** public void setFormat(String format) { ! if (format.equalsIgnoreCase("flat") ! || format.equalsIgnoreCase("xml") ! || format.equalsIgnoreCase("dtd")) { _format = format; --- 90,96 ---- public void setFormat(String format) { ! if (format.equalsIgnoreCase(FORMAT_FLAT) ! || format.equalsIgnoreCase(FORMAT_XML) ! || format.equalsIgnoreCase(FORMAT_DTD)) { _format = format; *************** *** 147,159 **** try { ! if (_format.equalsIgnoreCase("flat")) { FlatXmlDataSet.write(dataset, out); } ! else if (_format.equalsIgnoreCase("xml")) { XmlDataSet.write(dataset, out); } ! else if (_format.equalsIgnoreCase("dtd")) { FlatDtdDataSet.write(dataset, out); --- 152,164 ---- try { ! if (_format.equalsIgnoreCase(FORMAT_FLAT)) { FlatXmlDataSet.write(dataset, out); } ! else if (_format.equalsIgnoreCase(FORMAT_XML)) { XmlDataSet.write(dataset, out); } ! else if (_format.equalsIgnoreCase(FORMAT_DTD)) { FlatDtdDataSet.write(dataset, out); *************** *** 179,183 **** throws DataSetException, SQLException { ! return connection.createDataSet().getTable(table.getName()); } --- 184,199 ---- 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()); } *************** *** 186,200 **** { return connection.createQueryTable(query.getName(), query.getSql()); - } - - private String[] getTableArray() - { - String[] result = new String[_tables.size()]; - for (int i = 0; i < _tables.size(); i++) - { - Table table = (Table)_tables.get(i); - result[i] = table.getName(); - } - return result; } --- 202,205 ---- |
From: <mla...@us...> - 2003-03-13 02:24:16
|
Update of /cvsroot/dbunit/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv10843/dbunit Modified Files: dbunit.ipr dbunit.iws Log Message: FlatDtdDataSetTest improvement. Index: dbunit.ipr =================================================================== RCS file: /cvsroot/dbunit/dbunit/dbunit.ipr,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** dbunit.ipr 1 Mar 2003 06:51:17 -0000 1.53 --- dbunit.ipr 13 Mar 2003 02:24:12 -0000 1.54 *************** *** 30,33 **** --- 30,34 ---- <root type="simple" url="jar://$PROJECT_DIR$/lib/jaxp.jar!/" /> <root type="simple" url="jar://$PROJECT_DIR$/lib/hsqldb.jar!/" /> + <root type="simple" url="jar://$PROJECT_DIR$/lib/jakarta-poi.jar!/" /> </root> </classPath> Index: dbunit.iws =================================================================== RCS file: /cvsroot/dbunit/dbunit/dbunit.iws,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dbunit.iws 1 Mar 2003 17:29:51 -0000 1.6 --- dbunit.iws 13 Mar 2003 02:24:12 -0000 1.7 *************** *** 12,49 **** <component name="FileEditorManager"> <history> ! <source-position-entry url="file://$PROJECT_DIR$/profile.properties" line="37" column="30" vertical-scroll-proportion="0.35640138" horizontal-scroll-proportion="0.34146342" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/ant/DbUnitTaskTest.java" line="303" column="0" vertical-scroll-proportion="0.25373134" horizontal-scroll-proportion="0.0" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/xml/antTestBuildFile.xml" line="293" column="41" vertical-scroll-proportion="0.5018657" horizontal-scroll-proportion="0.46666667" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/ant/DbUnitTask.java" line="278" column="58" vertical-scroll-proportion="0.5242537" horizontal-scroll-proportion="0.6601626" /> ! <source-position-entry url="jar://$PROJECT_DIR$/lib/ant.jar!/org/apache/tools/ant/BuildException.class" line="38" column="11" vertical-scroll-proportion="0.92350745" horizontal-scroll-proportion="0.12520325" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/xml/FlatDtdDataSet.java" line="131" column="25" vertical-scroll-proportion="0.116094984" horizontal-scroll-proportion="0.28455284" /> ! <source-position-entry url="jar://C:/java/jdk1.3.1_07/src.jar!/src/java/io/OutputStreamWriter.java" line="112" column="18" vertical-scroll-proportion="0.3324468" horizontal-scroll-proportion="0.20487805" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/xml/caseInsensitiveTableTest.xml" line="0" column="0" vertical-scroll-proportion="0.0" horizontal-scroll-proportion="0.0" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/xml/compositeDataSetDuplicateTest2.xml" line="0" column="0" vertical-scroll-proportion="0.0" horizontal-scroll-proportion="0.0" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/xml/caseInsensitiveDataSetDuplicateTest.xml" line="0" column="0" vertical-scroll-proportion="0.0" horizontal-scroll-proportion="0.0" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/Main.java" line="49" column="10" vertical-scroll-proportion="-0.85064936" horizontal-scroll-proportion="0.0952381" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/xml/XmlDataSet.java" line="162" column="13" vertical-scroll-proportion="2.168831" horizontal-scroll-proportion="0.123809524" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/xml/FlatXmlDataSet.java" line="232" column="34" vertical-scroll-proportion="5.0" horizontal-scroll-proportion="0.32380953" /> </history> <open-files> ! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/Main.java" line="49" column="10" vertical-scroll-proportion="-0.85064936" horizontal-scroll-proportion="0.0952381" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/xml/FlatXmlDataSet.java" line="232" column="34" vertical-scroll-proportion="5.0" horizontal-scroll-proportion="0.32380953" selected="true" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/xml/XmlDataSet.java" line="162" column="13" vertical-scroll-proportion="2.168831" horizontal-scroll-proportion="0.123809524" /> </open-files> </component> <component name="ToolWindowManager"> <frame x="0" y="0" width="1024" height="738" extended-state="0" /> ! <editor active="false" /> <layout> ! <window_info id="Ant Build" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.17315574" order="3" /> ! <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.38311687" order="2" /> <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="7" /> <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="sliding" type="sliding" visible="false" weight="0.4" order="0" /> ! <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.29713115" order="0" /> ! <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.3993808" order="3" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1" /> ! <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.48701298" order="1" /> ! <window_info id="Messages" active="true" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.3963816" order="8" x="20" y="232" width="984" height="274" /> <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.4" order="6" /> <window_info id="Web" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="2" /> --- 12,64 ---- <component name="FileEditorManager"> <history> ! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/datatype/BytesDataTypeTest.java" line="31" column="13" vertical-scroll-proportion="-0.30497926" horizontal-scroll-proportion="0.15853658" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/datatype/AbstractDataTypeTest.java" line="30" column="22" vertical-scroll-proportion="0.3188119" horizontal-scroll-proportion="0.2682927" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/filter/SequenceTableFilterTest.java" line="57" column="16" vertical-scroll-proportion="2.023622" horizontal-scroll-proportion="0.19512194" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/filter/AbstractTableFilterTest.java" line="53" column="15" vertical-scroll-proportion="1.2992126" horizontal-scroll-proportion="0.18292683" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/FilteredDataSet.java" line="74" column="0" vertical-scroll-proportion="0.2874016" horizontal-scroll-proportion="0.0" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/AbstractDataSetTest.java" line="296" column="0" vertical-scroll-proportion="0.27559054" horizontal-scroll-proportion="0.0" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/FilteredDataSetTest.java" line="151" column="0" vertical-scroll-proportion="0.63529414" horizontal-scroll-proportion="0.0" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/filter/ExcludeTableFilter.java" line="47" column="0" vertical-scroll-proportion="0.4319066" horizontal-scroll-proportion="0.0" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/filter/IncludeTableFilter.java" line="20" column="45" vertical-scroll-proportion="0.0" horizontal-scroll-proportion="0.50239235" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/filter/SequenceTableFilter.java" line="120" column="0" vertical-scroll-proportion="1.0875486" horizontal-scroll-proportion="0.0" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/filter/AllTests.java" line="40" column="24" vertical-scroll-proportion="0.88521403" horizontal-scroll-proportion="0.26794258" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/filter/IncludeTableFilterTest.java" line="27" column="13" vertical-scroll-proportion="0.22178988" horizontal-scroll-proportion="0.14513557" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/xml/FlatDtdDataSet.java" line="25" column="13" vertical-scroll-proportion="0.3463035" horizontal-scroll-proportion="0.14513557" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/Main.java" line="47" column="21" vertical-scroll-proportion="0.5642023" horizontal-scroll-proportion="0.23444976" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/xml/FlatDtdDataSetTest.java" line="0" column="0" vertical-scroll-proportion="0.0" horizontal-scroll-proportion="0.0"> ! <folding> ! <element signature="imports" expanded="true" /> ! </folding> ! </source-position-entry> </history> <open-files> ! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/filter/IncludeTableFilter.java" line="20" column="45" vertical-scroll-proportion="0.0" horizontal-scroll-proportion="0.50239235" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/filter/SequenceTableFilter.java" line="120" column="0" vertical-scroll-proportion="1.0875486" horizontal-scroll-proportion="0.0" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/filter/IncludeTableFilterTest.java" line="27" column="13" vertical-scroll-proportion="0.22178988" horizontal-scroll-proportion="0.14513557" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/xml/FlatDtdDataSet.java" line="25" column="13" vertical-scroll-proportion="0.3463035" horizontal-scroll-proportion="0.14513557" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/xml/FlatDtdDataSetTest.java" line="0" column="0" vertical-scroll-proportion="0.0" horizontal-scroll-proportion="0.0" selected="true"> ! <folding> ! <element signature="imports" expanded="true" /> ! </folding> ! </source-position-entry> ! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/Main.java" line="47" column="21" vertical-scroll-proportion="0.5642023" horizontal-scroll-proportion="0.23444976" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset/filter/AllTests.java" line="40" column="24" vertical-scroll-proportion="0.88521403" horizontal-scroll-proportion="0.26794258" /> ! <source-position-entry url="file://$PROJECT_DIR$/src/java/org/dbunit/dataset/filter/ExcludeTableFilter.java" line="47" column="0" vertical-scroll-proportion="0.4319066" horizontal-scroll-proportion="0.0" /> </open-files> </component> <component name="ToolWindowManager"> <frame x="0" y="0" width="1024" height="738" extended-state="0" /> ! <editor active="true" /> <layout> ! <window_info id="Ant Build" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.17008197" order="3" /> ! <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.34375" order="2" /> <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="7" /> <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="sliding" type="sliding" visible="false" weight="0.4" order="0" /> ! <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="true" weight="0.28381148" order="0" /> ! <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.39967105" order="3" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1" /> ! <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.4868421" order="1" /> ! <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.3963816" order="8" x="20" y="232" width="984" height="274" /> <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.4" order="6" /> <window_info id="Web" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="2" /> *************** *** 72,75 **** --- 87,106 ---- <option name="SUSPEND_POLICY" value="SuspendAll" /> </breakpoint_any> + <breakpoint class_name="org.dbunit.dataset.datatype.TypeCastException"> + <option name="NOTIFY_CAUGHT" value="true" /> + <option name="NOTIFY_UNCAUGHT" value="true" /> + <option name="ENABLED" value="true" /> + <option name="SUSPEND_VM" value="true" /> + <option name="COUNT_FILTER_ENABLED" value="false" /> + <option name="COUNT_FILTER" value="0" /> + <option name="CONDITION_ENABLED" value="false" /> + <option name="CONDITION" /> + <option name="LOG_ENABLED" value="false" /> + <option name="LOG_EXPRESSION_ENABLED" value="false" /> + <option name="LOG_MESSAGE" /> + <option name="CLASS_FILTERS_ENABLED" value="false" /> + <option name="INVERSE_CLASS_FILLTERS" value="false" /> + <option name="SUSPEND_POLICY" value="SuspendAll" /> + </breakpoint> </exception_breakpoints> <field_breakpoints /> *************** *** 253,259 **** </view> <view id="SourcepathPane"> ! <expanded_node type="directory" url="file://$PROJECT_DIR$/src/java" /> ! <expanded_node type="directory" url="file://$PROJECT_DIR$/src/java/org" /> ! <expanded_node type="directory" url="file://$PROJECT_DIR$/src/java/org/dbunit" /> </view> <view id="ClasspathPane" /> --- 284,291 ---- </view> <view id="SourcepathPane"> ! <expanded_node type="directory" url="file://$PROJECT_DIR$/src/test/org/dbunit/dataset" /> ! <expanded_node type="directory" url="file://$PROJECT_DIR$/src/test/org/dbunit" /> ! <expanded_node type="directory" url="file://$PROJECT_DIR$/src/test" /> ! <expanded_node type="directory" url="file://$PROJECT_DIR$/src/test/org" /> </view> <view id="ClasspathPane" /> *************** *** 322,325 **** --- 354,492 ---- <option name="VM_PARAMETERS" /> <option name="PROGRAM_PARAMETERS" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + </configuration> + <configuration name="SequenceTableFilterTest.testIsValidName" type="JUnit" default="false" selected="false"> + <option name="PACKAGE_NAME" /> + <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" /> + <option name="METHOD_NAME" value="testIsValidName" /> + <option name="TEST_OBJECT" value="method" /> + <option name="VM_PARAMETERS" /> + <option name="PARAMETERS" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + </configuration> + <configuration name="SequenceTableFilterTest.testIsCaseInsensitiveValidName" type="JUnit" default="false" selected="false"> + <option name="PACKAGE_NAME" /> + <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" /> + <option name="METHOD_NAME" value="testIsCaseInsensitiveValidName" /> + <option name="TEST_OBJECT" value="method" /> + <option name="VM_PARAMETERS" /> + <option name="PARAMETERS" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + </configuration> + <configuration name="SequenceTableFilterTest.testIsValidNameAndInvalid" type="JUnit" default="false" selected="false"> + <option name="PACKAGE_NAME" /> + <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" /> + <option name="METHOD_NAME" value="testIsValidNameAndInvalid" /> + <option name="TEST_OBJECT" value="method" /> + <option name="VM_PARAMETERS" /> + <option name="PARAMETERS" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + </configuration> + <configuration name="SequenceTableFilterTest.testGetTableNames" type="JUnit" default="false" selected="false"> + <option name="PACKAGE_NAME" /> + <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" /> + <option name="METHOD_NAME" value="testGetTableNames" /> + <option name="TEST_OBJECT" value="method" /> + <option name="VM_PARAMETERS" /> + <option name="PARAMETERS" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + </configuration> + <configuration name="SequenceTableFilterTest.testGetDuplicateTableNames" type="JUnit" default="false" selected="false"> + <option name="PACKAGE_NAME" /> + <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" /> + <option name="METHOD_NAME" value="testGetDuplicateTableNames" /> + <option name="TEST_OBJECT" value="method" /> + <option name="VM_PARAMETERS" /> + <option name="PARAMETERS" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + </configuration> + <configuration name="SequenceTableFilterTest.testGetCaseInsensitiveTableNames" type="JUnit" default="false" selected="false"> + <option name="PACKAGE_NAME" /> + <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" /> + <option name="METHOD_NAME" value="testGetCaseInsensitiveTableNames" /> + <option name="TEST_OBJECT" value="method" /> + <option name="VM_PARAMETERS" /> + <option name="PARAMETERS" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + </configuration> + <configuration name="SequenceTableFilterTest.testGetReverseTableNames" type="JUnit" default="false" selected="false"> + <option name="PACKAGE_NAME" /> + <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" /> + <option name="METHOD_NAME" value="testGetReverseTableNames" /> + <option name="TEST_OBJECT" value="method" /> + <option name="VM_PARAMETERS" /> + <option name="PARAMETERS" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + </configuration> + <configuration name="SequenceTableFilterTest.testGetTables" type="JUnit" default="false" selected="false"> + <option name="PACKAGE_NAME" /> + <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" /> + <option name="METHOD_NAME" value="testGetTables" /> + <option name="TEST_OBJECT" value="method" /> + <option name="VM_PARAMETERS" /> + <option name="PARAMETERS" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + </configuration> + <configuration name="SequenceTableFilterTest.testGetCaseInsensitiveTables" type="JUnit" default="false" selected="false"> + <option name="PACKAGE_NAME" /> + <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" /> + <option name="METHOD_NAME" value="testGetCaseInsensitiveTables" /> + <option name="TEST_OBJECT" value="method" /> + <option name="VM_PARAMETERS" /> + <option name="PARAMETERS" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + </configuration> + <configuration name="SequenceTableFilterTest.testGetReverseTables" type="JUnit" default="false" selected="false"> + <option name="PACKAGE_NAME" /> + <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" /> + <option name="METHOD_NAME" value="testGetReverseTables" /> + <option name="TEST_OBJECT" value="method" /> + <option name="VM_PARAMETERS" /> + <option name="PARAMETERS" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + </configuration> + <configuration name="SequenceTableFilterTest" type="JUnit" default="false" selected="false"> + <option name="PACKAGE_NAME" /> + <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" /> + <option name="METHOD_NAME" /> + <option name="TEST_OBJECT" value="class" /> + <option name="VM_PARAMETERS" /> + <option name="PARAMETERS" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + </configuration> + <configuration name="AllTests" type="JUnit" default="false" selected="false"> + <option name="PACKAGE_NAME" /> + <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.AllTests" /> + <option name="METHOD_NAME" /> + <option name="TEST_OBJECT" value="class" /> + <option name="VM_PARAMETERS" /> + <option name="PARAMETERS" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + </configuration> + <configuration name="SequenceTableFilterTest.testIsValidName2" type="JUnit" default="false" selected="false"> + <option name="PACKAGE_NAME" /> + <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.filter.SequenceTableFilterTest" /> + <option name="METHOD_NAME" value="testIsValidName2" /> + <option name="TEST_OBJECT" value="method" /> + <option name="VM_PARAMETERS" /> + <option name="PARAMETERS" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + </configuration> + <configuration name="FlatDtdDataSetTest" type="JUnit" default="false" selected="false"> + <option name="PACKAGE_NAME" /> + <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.xml.FlatDtdDataSetTest" /> + <option name="METHOD_NAME" /> + <option name="TEST_OBJECT" value="class" /> + <option name="VM_PARAMETERS" /> + <option name="PARAMETERS" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + </configuration> + <configuration name="FlatDtdDataSetTest.testWriteFromDatabase" type="JUnit" default="false" selected="false"> + <option name="PACKAGE_NAME" /> + <option name="MAIN_CLASS_NAME" value="org.dbunit.dataset.xml.FlatDtdDataSetTest" /> + <option name="METHOD_NAME" value="testWriteFromDatabase" /> + <option name="TEST_OBJECT" value="method" /> + <option name="VM_PARAMETERS" /> + <option name="PARAMETERS" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> </configuration> |
From: <mla...@us...> - 2003-03-13 02:24:16
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml In directory sc8-pr-cvs1:/tmp/cvs-serv10843/dbunit/src/test/org/dbunit/dataset/xml Modified Files: FlatDtdDataSetTest.java Log Message: FlatDtdDataSetTest improvement. Index: FlatDtdDataSetTest.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/dataset/xml/FlatDtdDataSetTest.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** FlatDtdDataSetTest.java 24 Feb 2003 02:37:22 -0000 1.7 --- FlatDtdDataSetTest.java 13 Mar 2003 02:24:12 -0000 1.8 *************** *** 12,24 **** import org.dbunit.DatabaseEnvironment; ! import org.dbunit.Assertion; ! import org.dbunit.database.*; ! import org.dbunit.dataset.*; import java.io.*; - import java.util.Arrays; - import java.util.Comparator; - - import org.dbunit.util.FileAsserts; /** --- 12,22 ---- import org.dbunit.DatabaseEnvironment; ! import org.dbunit.util.FileAsserts; ! import org.dbunit.database.IDatabaseConnection; ! import org.dbunit.dataset.AbstractDataSetTest; ! import org.dbunit.dataset.FilteredDataSet; ! import org.dbunit.dataset.IDataSet; import java.io.*; /** *************** *** 51,78 **** } - protected void sort(Object[] array) - { - if (ITable[].class.isInstance(array)) - { - Arrays.sort(array, new TableComparator()); - } - else - { - Arrays.sort(array); - } - } - - private class TableComparator implements Comparator - { - public int compare(Object o1, Object o2) - { - String name1 = ((ITable)o1).getTableMetaData().getTableName(); - String name2 = ((ITable)o2).getTableMetaData().getTableName(); - - return name1.compareTo(name2); - } - } - - protected int[] getExpectedDuplicateRows() { --- 49,52 ---- *************** *** 96,103 **** { // write DTD in temp file ! String[] tableNames = dataSet.getTableNames(); ! Arrays.sort(tableNames); ! FlatDtdDataSet.write(new FilteredDataSet( ! tableNames, dataSet), out); } finally --- 70,74 ---- { // write DTD in temp file ! FlatDtdDataSet.write(dataSet, out); } finally *************** *** 106,110 **** } ! org.dbunit.util.FileAsserts.assertEquals( new BufferedReader(new FileReader(DTD_FILE)), new BufferedReader(new FileReader(tempFile))); --- 77,81 ---- } ! FileAsserts.assertEquals( new BufferedReader(new FileReader(DTD_FILE)), new BufferedReader(new FileReader(tempFile))); *************** *** 132,137 **** { // write DTD in temp file ! String[] tableNames = dataSet.getTableNames(); ! Arrays.sort(tableNames); FlatDtdDataSet.write(new FilteredDataSet( tableNames, dataSet), out); --- 103,107 ---- { // write DTD in temp file ! String[] tableNames = getExpectedNames(); FlatDtdDataSet.write(new FilteredDataSet( tableNames, dataSet), out); *************** *** 142,146 **** } ! org.dbunit.util.FileAsserts.assertEquals( new BufferedReader(new FileReader(DTD_FILE)), new BufferedReader(new FileReader(tempFile))); --- 112,116 ---- } ! FileAsserts.assertEquals( new BufferedReader(new FileReader(DTD_FILE)), new BufferedReader(new FileReader(tempFile))); |
From: <mla...@us...> - 2003-03-13 02:24:15
|
Update of /cvsroot/dbunit/dbunit/src/test/org/dbunit In directory sc8-pr-cvs1:/tmp/cvs-serv10843/dbunit/src/test/org/dbunit Modified Files: Main.java Log Message: FlatDtdDataSetTest improvement. Index: Main.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/test/org/dbunit/Main.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Main.java 4 Mar 2003 00:14:32 -0000 1.28 --- Main.java 13 Mar 2003 02:24:12 -0000 1.29 *************** *** 25,33 **** import org.dbunit.database.IDatabaseConnection; import org.dbunit.dataset.xml.FlatXmlDataSet; import electric.xml.Document; ! import java.io.FileWriter; ! import java.io.Writer; /** --- 25,35 ---- import org.dbunit.database.IDatabaseConnection; import org.dbunit.dataset.xml.FlatXmlDataSet; + import org.dbunit.dataset.xml.XmlDataSet; + import org.dbunit.dataset.excel.XlsDataSet; + import org.dbunit.dataset.DataSetException; import electric.xml.Document; ! import java.io.*; /** *************** *** 41,45 **** public static void main(String[] args) throws Exception { ! oldMain(); // testWrite(); // writeXls(); --- 43,47 ---- public static void main(String[] args) throws Exception { ! // oldMain(); // testWrite(); // writeXls(); *************** *** 102,106 **** } - /* private static void writeXls() throws IOException, DataSetException { --- 104,107 ---- *************** *** 108,116 **** "P:/dbunit-cvs/dbunit/src/xml/dataSetTest.xml"); FileOutputStream out = new FileOutputStream( ! "P:/dbunit-cvs/dbunit/src/xml/dataSetTest.xls"); XlsDataSet.write(new XmlDataSet(in), out); out.close(); } public static void newSheet() throws Exception { --- 109,118 ---- "P:/dbunit-cvs/dbunit/src/xml/dataSetTest.xml"); FileOutputStream out = new FileOutputStream( ! "P:/dbunit-cvs/dbunit/dataSetTest.xls"); XlsDataSet.write(new XmlDataSet(in), out); out.close(); } + /* public static void newSheet() throws Exception { |
From: <mla...@us...> - 2003-03-13 02:24:15
|
Update of /cvsroot/dbunit/dbunit/src/dtd In directory sc8-pr-cvs1:/tmp/cvs-serv10843/dbunit/src/dtd Modified Files: flatDtdDataSetTest.dtd Log Message: FlatDtdDataSetTest improvement. Index: flatDtdDataSetTest.dtd =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/dtd/flatDtdDataSetTest.dtd,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** flatDtdDataSetTest.dtd 3 Aug 2002 02:26:41 -0000 1.1 --- flatDtdDataSetTest.dtd 13 Mar 2003 02:24:12 -0000 1.2 *************** *** 1,20 **** <!ELEMENT dataset ( ! EMPTY_MULTITYPE_TABLE*, EMPTY_TABLE*, - ONLY_PK_TABLE*, PK_TABLE*, ! SECOND_TABLE*, ! TEST_TABLE*)> ! <!ELEMENT EMPTY_MULTITYPE_TABLE EMPTY> ! <!ATTLIST EMPTY_MULTITYPE_TABLE ! VARCHAR_COL CDATA #IMPLIED ! NUMERIC_COL CDATA #IMPLIED ! TIMESTAMP_COL CDATA #IMPLIED ! VARBINARY_COL CDATA #IMPLIED > ! <!ELEMENT EMPTY_TABLE EMPTY> ! <!ATTLIST EMPTY_TABLE COLUMN0 CDATA #IMPLIED COLUMN1 CDATA #IMPLIED --- 1,20 ---- <!ELEMENT dataset ( ! TEST_TABLE*, ! SECOND_TABLE*, EMPTY_TABLE*, PK_TABLE*, ! ONLY_PK_TABLE*, ! EMPTY_MULTITYPE_TABLE*)> ! <!ELEMENT TEST_TABLE EMPTY> ! <!ATTLIST TEST_TABLE ! COLUMN0 CDATA #IMPLIED ! COLUMN1 CDATA #IMPLIED ! COLUMN2 CDATA #IMPLIED ! COLUMN3 CDATA #IMPLIED > ! <!ELEMENT SECOND_TABLE EMPTY> ! <!ATTLIST SECOND_TABLE COLUMN0 CDATA #IMPLIED COLUMN1 CDATA #IMPLIED *************** *** 23,29 **** > ! <!ELEMENT ONLY_PK_TABLE EMPTY> ! <!ATTLIST ONLY_PK_TABLE ! PK0 CDATA #REQUIRED > --- 23,32 ---- > ! <!ELEMENT EMPTY_TABLE EMPTY> ! <!ATTLIST EMPTY_TABLE ! COLUMN0 CDATA #IMPLIED ! COLUMN1 CDATA #IMPLIED ! COLUMN2 CDATA #IMPLIED ! COLUMN3 CDATA #IMPLIED > *************** *** 37,54 **** > ! <!ELEMENT SECOND_TABLE EMPTY> ! <!ATTLIST SECOND_TABLE ! COLUMN0 CDATA #IMPLIED ! COLUMN1 CDATA #IMPLIED ! COLUMN2 CDATA #IMPLIED ! COLUMN3 CDATA #IMPLIED > ! <!ELEMENT TEST_TABLE EMPTY> ! <!ATTLIST TEST_TABLE ! COLUMN0 CDATA #IMPLIED ! COLUMN1 CDATA #IMPLIED ! COLUMN2 CDATA #IMPLIED ! COLUMN3 CDATA #IMPLIED > --- 40,54 ---- > ! <!ELEMENT ONLY_PK_TABLE EMPTY> ! <!ATTLIST ONLY_PK_TABLE ! PK0 CDATA #REQUIRED > ! <!ELEMENT EMPTY_MULTITYPE_TABLE EMPTY> ! <!ATTLIST EMPTY_MULTITYPE_TABLE ! VARCHAR_COL CDATA #IMPLIED ! NUMERIC_COL CDATA #IMPLIED ! TIMESTAMP_COL CDATA #IMPLIED ! VARBINARY_COL CDATA #IMPLIED > |
From: <mla...@us...> - 2003-03-11 13:26:09
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv11400/dbunit/src/java/org/dbunit/dataset Modified Files: DefaultTableMetaData.java Log Message: Implemented toString() method. Index: DefaultTableMetaData.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/DefaultTableMetaData.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DefaultTableMetaData.java 13 Jun 2002 17:24:56 -0000 1.8 --- DefaultTableMetaData.java 11 Mar 2003 12:57:10 -0000 1.9 *************** *** 23,26 **** --- 23,28 ---- package org.dbunit.dataset; + import java.util.Arrays; + /** *************** *** 54,57 **** --- 56,66 ---- _columns = columns; _primaryKeys = primaryKeys; + } + + public String toString() + { + return "tableName=" + _tableName + + ", columns=" + Arrays.asList(_columns) + + ", keys=" + Arrays.asList(_primaryKeys) + ""; } |
From: <mla...@us...> - 2003-03-11 13:26:08
|
Update of /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset In directory sc8-pr-cvs1:/tmp/cvs-serv27072/dbunit/src/java/org/dbunit/dataset Modified Files: DataSetUtils.java FilteredDataSet.java Log Message: Refactoring of FilteredDataSet to allow plugable filtering strategy. Index: DataSetUtils.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/DataSetUtils.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** DataSetUtils.java 15 Feb 2003 05:42:42 -0000 1.14 --- DataSetUtils.java 11 Mar 2003 13:26:03 -0000 1.15 *************** *** 247,251 **** } ! private static String[] reverseStringArray(String[] array) { String[] newArray = new String[array.length]; --- 247,251 ---- } ! public static String[] reverseStringArray(String[] array) { String[] newArray = new String[array.length]; Index: FilteredDataSet.java =================================================================== RCS file: /cvsroot/dbunit/dbunit/src/java/org/dbunit/dataset/FilteredDataSet.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** FilteredDataSet.java 13 Feb 2003 04:32:42 -0000 1.11 --- FilteredDataSet.java 11 Mar 2003 13:26:03 -0000 1.12 *************** *** 23,34 **** package org.dbunit.dataset; ! import org.dbunit.database.AmbiguousTableNameException; ! ! import java.util.Arrays; ! /** * Decorates a dataset and exposes only some tables from it. * * @author Manuel Laflamme * @version $Revision$ --- 23,39 ---- package org.dbunit.dataset; ! import org.dbunit.dataset.filter.IncludeTableFilter; ! import org.dbunit.dataset.filter.SequenceTableFilter; ! import org.dbunit.dataset.filter.ExcludeTableFilter; ! import org.dbunit.dataset.filter.ITableFilter; /** * Decorates a dataset and exposes only some tables from it. * + * @see ITableFilter + * @see SequenceTableFilter + * @see IncludeTableFilter + * @see ExcludeTableFilter + * * @author Manuel Laflamme * @version $Revision$ *************** *** 37,71 **** { private final IDataSet _dataSet; ! private final String[] _tableNames; /** * Creates a FilteredDataSet that decorates the specified dataset and ! * exposes only the specified tables. */ public FilteredDataSet(String[] tableNames, IDataSet dataSet) { ! _tableNames = tableNames; _dataSet = dataSet; } ! protected void assertValidTableName(String tableName) throws DataSetException { ! boolean found = false; ! for (int i = 0; i < _tableNames.length; i++) ! { ! if (tableName.equalsIgnoreCase(_tableNames[i])) ! { ! if (found) ! { ! throw new AmbiguousTableNameException(tableName); ! } ! found = true; ! } ! } ! ! if (!found) ! { ! throw new NoSuchTableException(tableName); ! } } --- 42,69 ---- { private final IDataSet _dataSet; ! private final ITableFilter _filter; /** * Creates a FilteredDataSet that decorates the specified dataset and ! * exposes only the specified tables. Use the {@link SequenceTableFilter} as ! * filtering startegy. */ public FilteredDataSet(String[] tableNames, IDataSet dataSet) { ! _filter = new SequenceTableFilter(tableNames); _dataSet = dataSet; } ! /** ! * Creates a FilteredDataSet that decorates the specified dataset and ! * exposes only the tables allowed by the specified filtering strategy. ! * ! * @param dataSet the filtered dataset ! * @param filter the filtering strategy ! */ ! public FilteredDataSet(ITableFilter filter, IDataSet dataSet) { ! _dataSet = dataSet; ! _filter = filter; } *************** *** 75,79 **** public String[] getTableNames() throws DataSetException { ! return (String[])_tableNames.clone(); } --- 73,77 ---- public String[] getTableNames() throws DataSetException { ! return _filter.getTableNames(_dataSet); } *************** *** 81,85 **** throws DataSetException { ! assertValidTableName(tableName); return _dataSet.getTableMetaData(tableName); } --- 79,87 ---- throws DataSetException { ! if (!_filter.isValidName(tableName)) ! { ! throw new NoSuchTableException(tableName); ! } ! return _dataSet.getTableMetaData(tableName); } *************** *** 87,91 **** public ITable getTable(String tableName) throws DataSetException { ! assertValidTableName(tableName); return _dataSet.getTable(tableName); } --- 89,97 ---- public ITable getTable(String tableName) throws DataSetException { ! if (!_filter.isValidName(tableName)) ! { ! throw new NoSuchTableException(tableName); ! } ! return _dataSet.getTable(tableName); } *************** *** 93,102 **** public ITable[] getTables() throws DataSetException { ! ITable[] tables = new ITable[_tableNames.length]; ! for (int i = 0; i < tables.length; i++) ! { ! tables[i] = _dataSet.getTable(_tableNames[i]); ! } ! return tables; } --- 99,103 ---- public ITable[] getTables() throws DataSetException { ! return _filter.getTables(_dataSet); } |