~ubuntu-branches/ubuntu/raring/apgdiff/raring

« back to all changes in this revision

Viewing changes to src/test/java/cz/startnet/utils/pgdiff/loader/PgDumpLoaderTest.java

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Berg
  • Date: 2008-09-09 15:42:54 UTC
  • Revision ID: james.westby@ubuntu.com-20080909154254-458sv7ew1rczdal1
Tags: upstream-1.2
ImportĀ upstreamĀ versionĀ 1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * $Id: PgDumpLoaderTest.java 91 2008-08-01 17:35:19Z fordfrog $
 
3
 */
 
4
package cz.startnet.utils.pgdiff.loader;
 
5
 
 
6
import org.junit.Test;
 
7
 
 
8
import org.junit.runner.RunWith;
 
9
 
 
10
import org.junit.runners.Parameterized;
 
11
import org.junit.runners.Parameterized.Parameters;
 
12
 
 
13
import java.util.Arrays;
 
14
import java.util.Collection;
 
15
 
 
16
/**
 
17
 * Tests for PgDiffLoader class.
 
18
 *
 
19
 * @author fordfrog
 
20
 * @version $Id: PgDumpLoaderTest.java 91 2008-08-01 17:35:19Z fordfrog $
 
21
 */
 
22
@RunWith(value = Parameterized.class)
 
23
public class PgDumpLoaderTest {
 
24
 
 
25
    /**
 
26
     * Index of the file that should be tested.
 
27
     */
 
28
    private final int fileIndex;
 
29
 
 
30
    /**
 
31
     * Creates a new instance of PgDumpLoaderTest.
 
32
     *
 
33
     * @param fileIndex {@link #fileIndex}
 
34
     */
 
35
    public PgDumpLoaderTest(final int fileIndex) {
 
36
        this.fileIndex = fileIndex;
 
37
    }
 
38
 
 
39
    /**
 
40
     * Provides parameters for running the tests.
 
41
     *
 
42
     * @return parameters for the tests
 
43
     */
 
44
    @Parameters
 
45
    public static Collection parameters() {
 
46
        return Arrays.asList(
 
47
            new Object[][]{
 
48
                {1},
 
49
                {2},
 
50
                {3},
 
51
                {4},
 
52
                {5},
 
53
                {6}
 
54
            });
 
55
    }
 
56
 
 
57
    /**
 
58
     * Runs single test.
 
59
     */
 
60
    @Test(timeout = 1000)
 
61
    public void loadSchema() {
 
62
        PgDumpLoader.loadDatabaseSchema(
 
63
            getClass().getResourceAsStream("schema_" + fileIndex + ".sql"),
 
64
            "UTF-8");
 
65
    }
 
66
}