View Javadoc
1   package org.dbunit.database.search;
2   
3   import java.sql.SQLException;
4   
5   import org.dbunit.database.AbstractImportedKeysFilteredByPKsTestCase;
6   import org.dbunit.dataset.DataSetException;
7   
8   import org.dbunit.util.search.SearchException;
9   
10  public class ImportedKeysFilteredByPKsSingleTest extends AbstractImportedKeysFilteredByPKsTestCase {
11  
12    public ImportedKeysFilteredByPKsSingleTest(String testName) {
13     this(testName, "hypersonic_simple_dataset.sql");
14    }
15    public ImportedKeysFilteredByPKsSingleTest(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      doIt();      
27    }
28    
29    public void testCWithTwo() throws DataSetException, SQLException, SearchException {
30      addInput( C, new String[] { C1, C2 } );
31      addOutput( C, new String[] { C1, C2 } );
32      doIt();      
33    }
34    
35    public void testCWithTwoInvertedInput() throws DataSetException, SQLException, SearchException {
36      addInput( C, new String[] { C2, C1 } );
37      addOutput( C, new String[] { C1, C2 } );
38      doIt();      
39    }
40    
41    public void testCWithTwoInvertedOutput() throws DataSetException, SQLException, SearchException {
42      addInput( C, new String[] { C1, C2 } );
43      addOutput( C, new String[] { C2, C1 } );
44      doIt();      
45    }
46    
47    public void testCWithRepeated() throws DataSetException, SQLException, SearchException {
48      addInput( C, new String[] { C1, C2, C1, C1, C2, C2, C2, C1, C1, C2 } );
49      addOutput( C, new String[] { C2, C1 } );
50      doIt();      
51    }
52    
53    public void testB() throws DataSetException, SQLException, SearchException {
54      addInput( B, new String[] { B1 } );
55      addOutput( C, new String[] { C2 } );
56      addOutput( B, new String[] { B1 } );
57      doIt();      
58    }
59  
60    public void testBWithRepeated() throws DataSetException, SQLException, SearchException {
61      addInput( B, new String[] { B1, B1, B1, B1 } );
62      addOutput( C, new String[] { C2 } );
63      addOutput( B, new String[] { B1 } );
64      doIt();      
65    }
66  
67    public void testA() throws DataSetException, SQLException, SearchException {
68      addInput( A, new String[] { A1 } );
69      addOutput( C, new String[] { C1, C2 } );
70      addOutput( B, new String[] { B1 } );
71      addOutput( A, new String[] { A1 } );
72      doIt();      
73    }
74    
75    public void testAWithRepeated() throws DataSetException, SQLException, SearchException {
76      addInput( A, new String[] { A1, A1, A1 } );
77      addOutput( C, new String[] { C1, C2 } );
78      addOutput( B, new String[] { B1 } );
79      addOutput( A, new String[] { A1 } );
80      doIt();      
81    }
82    
83    
84  }