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 ImportedAndExportedKeysFilteredByPKsTest extends AbstractImportedAndExportedKeysFilteredByPKsTestCase {
11
12 public ImportedAndExportedKeysFilteredByPKsTest(String testName) {
13 super(testName, "hypersonic_dataset.sql");
14 }
15 protected int[] setupTablesSizeFixture() {
16 int[] sizes = new int[] { 2, 8, 4, 2, 4, 2, 2, 2 };
17 return sizes;
18 }
19
20 private void addAllOutput() {
21 addOutput( A, new String[] { A1, A2 } );
22 addOutput( B, new String[] { B1, B2, B3, B4, B5, B6, B7, B8 } );
23 addOutput( C, new String[] { C1, C2, C3, C4 } );
24 addOutput( D, new String[] { D1, D2 } );
25 addOutput( E, new String[] { E1, E2, E3, E4 } );
26 addOutput( F, new String[] { F1, F2 } );
27 addOutput( G, new String[] { G1, G2 } );
28 addOutput( H, new String[] { H1, H2 } );
29 }
30
31 public void testBWithOne() throws DataSetException, SQLException, SearchException {
32 addInput( B, new String[] { B1 } );
33 addOutput( A, new String[] { A1, A2 } );
34 addOutput( B, new String[] { B1 } );
35 addOutput( C, new String[] { C1, C2, C3, C4 } );
36 addOutput( D, new String[] { D1, D2 } );
37 addOutput( E, new String[] { E1, E2, E3, E4 } );
38 addOutput( F, new String[] { F1, F2 } );
39 addOutput( G, new String[] { G1, G2 } );
40 addOutput( H, new String[] { H1, H2 } );
41 doIt();
42 }
43
44 public void testBWithRepeated() throws DataSetException, SQLException, SearchException {
45 addInput( B, new String[] { B1, B4, B3, B2, B1, B1, B8, B7 } );
46 addOutput( A, new String[] { A1, A2 } );
47 addOutput( B, new String[] { B1, B2, B3, B4, B7, B8 } );
48 addOutput( C, new String[] { C1, C2, C3, C4 } );
49 addOutput( D, new String[] { D1, D2 } );
50 addOutput( E, new String[] { E1, E2, E3, E4 } );
51 addOutput( F, new String[] { F1, F2 } );
52 addOutput( G, new String[] { G1, G2 } );
53 addOutput( H, new String[] { H1, H2 } );
54 doIt();
55 }
56
57 public void testBWithAllRepeated() throws DataSetException, SQLException, SearchException {
58 addInput( B, new String[] { B1, B4, B3, B2, B1, B1, B1, B6, B6, B1, B5, B8, B7 } );
59 addAllOutput();
60 doIt();
61 }
62
63 public void testDWithOne() throws DataSetException, SQLException, SearchException {
64 addInput( D, new String[] { D1 } );
65 addInput( B, new String[] { B1 } );
66 addOutput( A, new String[] { A1, A2 } );
67 addOutput( B, new String[] { B1 } );
68 addOutput( C, new String[] { C1, C2, C3, C4 } );
69 addOutput( D, new String[] { D1 } );
70 addOutput( E, new String[] { E1, E2, E3, E4 } );
71 addOutput( F, new String[] { F1, F2 } );
72 addOutput( G, new String[] { G1, G2 } );
73 addOutput( H, new String[] { H1, H2 } );
74 doIt();
75 }
76
77 public void testDWithTwo() throws DataSetException, SQLException, SearchException {
78 addInput( D, new String[] { D1, D2 } );
79 addAllOutput();
80 doIt();
81 }
82
83 public void testDWithRepeated() throws DataSetException, SQLException, SearchException {
84 addInput( D, new String[] { D1, D2, D2, D1, D1, D1, D2, D2 } );
85 addAllOutput();
86 doIt();
87 }
88
89 }