View Javadoc
1   /*
2    *
3    * The DbUnit Database Testing Framework
4    * Copyright (C)2002-2004, DbUnit.org
5    *
6    * This library is free software; you can redistribute it and/or
7    * modify it under the terms of the GNU Lesser General Public
8    * License as published by the Free Software Foundation; either
9    * version 2.1 of the License, or (at your option) any later version.
10   *
11   * This library is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   * Lesser General Public License for more details.
15   *
16   * You should have received a copy of the GNU Lesser General Public
17   * License along with this library; if not, write to the Free Software
18   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19   *
20   */
21  package org.dbunit.dataset.filter;
22  
23  import org.dbunit.dataset.*;
24  import org.dbunit.dataset.xml.XmlDataSet;
25  import org.dbunit.testutil.TestUtils;
26  
27  import java.io.FileReader;
28  
29  /**
30   * @author Manuel Laflamme
31   * @since Mar 9, 2003
32   * @version $Revision$
33   */
34  public abstract class AbstractTableFilterTest
35          extends AbstractTest
36  {
37  
38      public AbstractTableFilterTest(String s)
39      {
40          super(s);
41      }
42  
43      protected IDataSet createDataSet() throws Exception
44      {
45          IDataSet dataSet1 = new XmlDataSet(
46                  TestUtils.getFileReader("xml/dataSetTest.xml"));
47          IDataSet dataSet2 = new DefaultDataSet(
48                  new DefaultTable(getExtraTableName()));
49  
50          IDataSet dataSet = new CompositeDataSet(dataSet1, dataSet2);
51          assertEquals("count before filter", getExpectedNames().length + 1,
52                  dataSet.getTableNames().length);
53          return dataSet;
54      }
55  
56      protected IDataSet createDuplicateDataSet() throws Exception
57      {
58          IDataSet dataSet1 = new XmlDataSet(
59                  TestUtils.getFileReader("xml/xmlDataSetDuplicateTest.xml"));
60          IDataSet dataSet2 = new DefaultDataSet(
61                  new DefaultTable(getExtraTableName()));
62  
63          IDataSet dataSet = new CompositeDataSet(dataSet1, dataSet2, false);
64          assertEquals("count before filter", getExpectedDuplicateNames().length + 1,
65                  dataSet.getTableNames().length);
66          return dataSet;
67      }
68  
69      public abstract void testAccept() throws Exception;
70  
71      public abstract void testIsCaseInsensitiveValidName() throws Exception;
72  
73      public abstract void testIsValidNameAndInvalid() throws Exception;
74  
75      public abstract void testGetTableNames() throws Exception;
76  
77      public abstract void testGetCaseInsensitiveTableNames() throws Exception;
78  
79      public abstract void testGetReverseTableNames() throws Exception;
80  
81      public abstract void testGetTableNamesAndTableNotInDecoratedDataSet() throws Exception;
82  
83      public abstract void testIterator() throws Exception;
84  
85      public abstract void testCaseInsensitiveIterator() throws Exception;
86  
87      public abstract void testReverseIterator() throws Exception;
88  
89      public abstract void testIteratorAndTableNotInDecoratedDataSet() throws Exception;
90  }