View Javadoc
1   package org.dbunit.database.search;
2   
3   import java.sql.SQLException;
4   
5   import org.dbunit.database.AbstractImportedAndExportedKeysFilteredByPKsTestCase;
6   import org.dbunit.dataset.DataSetException;
7   
8   import org.dbunit.util.search.SearchException;
9   
10  public class ImportedAndExportedKeysFilteredByPKsSingleInputTest extends AbstractImportedAndExportedKeysFilteredByPKsTestCase {
11  
12    public ImportedAndExportedKeysFilteredByPKsSingleInputTest(String testName) {
13     this(testName, "hypersonic_simple_input_dataset.sql");
14    }
15    public ImportedAndExportedKeysFilteredByPKsSingleInputTest(String testName, String sqlFile) {
16      super( testName, sqlFile );
17    }
18    protected int[] setupTablesSizeFixture() {
19      int[] sizes = new int[] { 2, 1 };
20      return sizes;
21    }
22    
23    public void testAWithOne() throws DataSetException, SQLException, SearchException {
24      addInput( A, new String[] { A1 } );
25      addOutput( B, new String[] { B1 } );
26      addOutput( A, new String[] { A1 } );
27      doIt();      
28    }
29    
30    public void testAWithOneRepeated() throws DataSetException, SQLException, SearchException {
31      addInput( A, new String[] { A1, A1, A1, A1, A1 } );
32      addOutput( B, new String[] { B1 } );
33      addOutput( A, new String[] { A1 } );
34      doIt();      
35    }
36    
37    public void testAWithTwo() throws DataSetException, SQLException, SearchException {
38      addInput( A, new String[] { A1, A2 } );
39      addOutput( B, new String[] { B1 } );
40      addOutput( A, new String[] { A1, A2 } );
41      doIt();      
42    }
43    
44    public void testAWithTwoRepeated() throws DataSetException, SQLException, SearchException {
45      addInput( A, new String[] { A1, A2 , A1, A2, A2, A1, A1, A1 } );
46      addOutput( B, new String[] { B1 } );
47      addOutput( A, new String[] { A1, A2 } );
48      doIt();      
49    }
50    
51    public void testAWithTwoInvertedInput() throws DataSetException, SQLException, SearchException {
52      addInput( A, new String[] { A2, A1 } );
53      addOutput( B, new String[] { B1 } );
54      addOutput( A, new String[] { A1, A2 } );
55      doIt();      
56    }
57  
58    public void testAWithTwoInvertedOutput() throws DataSetException, SQLException, SearchException {
59      addInput( A, new String[] { A1, A2 } );
60      addOutput( B, new String[] { B1 } );
61      addOutput( A, new String[] { A2, A1 } );
62      doIt();      
63    }
64     
65    public void testB() throws DataSetException, SQLException, SearchException {
66      addInput( B, new String[] { B1 } );
67      addOutput( B, new String[] { B1 } );
68      addOutput( A, new String[] { A2, A1 } );
69      doIt();      
70    }
71    
72  }