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 ImportedAndExportedKeysFilteredByPKsSingleTest extends AbstractImportedAndExportedKeysFilteredByPKsTestCase {
11  
12    public ImportedAndExportedKeysFilteredByPKsSingleTest(String testName) {
13     this(testName, "hypersonic_simple_dataset.sql");
14    }
15    public ImportedAndExportedKeysFilteredByPKsSingleTest(String testName, String sqlFile) {
16      super( testName, sqlFile );
17    }
18    protected int[] setupTablesSizeFixture() {
19      int[] sizes = new int[] { 1, 1, 2 };
20      return sizes;
21    }
22    
23    public void testCWithOne() throws DataSetException, SQLException, SearchException {
24      addInput( C, new String[] { C1 } );
25      addOutput( C, new String[] { C1 } );
26      addOutput( B, new String[] { B1 } );
27      addOutput( A, new String[] { A1 } );
28      doIt();      
29    }
30    
31    public void testCWithTwo() throws DataSetException, SQLException, SearchException {
32      addInput( C, new String[] { C1, C2 } );
33      addOutput( C, new String[] { C1, C2 } );
34      addOutput( B, new String[] { B1 } );
35      addOutput( A, new String[] { A1 } );
36      doIt();      
37    }
38    
39    public void testCWithTwoInvertedInput() throws DataSetException, SQLException, SearchException {
40      addInput( C, new String[] { C2, C1 } );
41      addOutput( C, new String[] { C1, C2 } );
42      addOutput( B, new String[] { B1 } );
43      addOutput( A, new String[] { A1 } );
44      doIt();      
45    }
46    
47    public void testCWithTwoInvertedOutput() throws DataSetException, SQLException, SearchException {
48      addInput( C, new String[] { C1, C2 } );
49      addOutput( C, new String[] { C2, C1 } );
50      addOutput( B, new String[] { B1 } );
51      addOutput( A, new String[] { A1 } );
52      doIt();      
53    }
54    
55    public void testCWithRepeated() throws DataSetException, SQLException, SearchException {
56      addInput( C, new String[] { C1, C2, C2, C1, C1, C1, C2, C2 } );
57      addOutput( C, new String[] { C2, C1 } );
58      addOutput( B, new String[] { B1 } );
59      addOutput( A, new String[] { A1 } );
60      doIt();      
61    }
62    
63    public void testB() throws DataSetException, SQLException, SearchException {
64      addInput( B, new String[] { B1 } );
65      addOutput( C, new String[] { C1, C2 } );
66      addOutput( B, new String[] { B1 } );
67      addOutput( A, new String[] { A1 } );
68      doIt();      
69    }
70  
71    public void testA() throws DataSetException, SQLException, SearchException {
72      addInput( A, new String[] { A1 } );
73      addOutput( C, new String[] { C1, C2 } );
74      addOutput( B, new String[] { B1 } );
75      addOutput( A, new String[] { A1 } );
76      doIt();      
77    }
78  }