~ubuntu-branches/ubuntu/wily/apgdiff/wily

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Berg
  • Date: 2009-12-02 11:11:33 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20091202111133-k5wrh3zb2pzmbv8c
Tags: 1.4-1
* New upstream version. (Without changelog, I am afraid.)
* Test suite still not enabled as it needs network access. (The junit
  version in Debian needs upgrading.)
* Optimize rules files a bit so debhelper doesn't clean twice, and quilt's
  patch target doesn't prevent build-stamp from working.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * $Id: PgDiffTest.java 94 2008-09-30 11:07:28Z fordfrog $
3
 
 */
4
1
package cz.startnet.utils.pgdiff;
5
2
 
6
3
import org.junit.Assert;
25
22
 * Tests for PgDiff class.
26
23
 *
27
24
 * @author fordfrog
28
 
 * @version $Id: PgDiffTest.java 94 2008-09-30 11:07:28Z fordfrog $
29
25
 */
30
26
@RunWith(value = Parameterized.class)
31
27
public class PgDiffTest {
62
58
     * @param ignoreFunctionWhitespace {@link #ignoreFunctionWhitespace}
63
59
     * @param ignoreStartWith {@link #ignoreStartWith}
64
60
     */
65
 
    public PgDiffTest(
66
 
            final String fileNameTemplate,
67
 
            final boolean addDefaults,
68
 
            final boolean addTransaction,
 
61
    public PgDiffTest(final String fileNameTemplate,
 
62
            final boolean addDefaults, final boolean addTransaction,
69
63
            final boolean ignoreFunctionWhitespace,
70
64
            final boolean ignoreStartWith) {
71
65
        super();
82
76
     * @return parameters for the tests
83
77
     */
84
78
    @Parameters
85
 
    public static Collection parameters() {
 
79
    public static Collection<?> parameters() {
86
80
        return Arrays.asList(
87
81
                new Object[][]{
88
82
                    // Tests scenario where COLUMN type is modified.
236
230
     * @throws IOException Thrown if problem occured while reading expected
237
231
     *         diff.
238
232
     */
239
 
    @Test(/*timeout = 1000*/)
 
233
    @Test(timeout = 1000)
240
234
    public void runDiff() throws FileNotFoundException, IOException {
241
235
        final ByteArrayOutputStream diffInput = new ByteArrayOutputStream();
242
236
        final PrintWriter writer = new PrintWriter(diffInput, true);
244
238
        arguments.setAddDefaults(addDefaults);
245
239
        arguments.setIgnoreFunctionWhitespace(ignoreFunctionWhitespace);
246
240
        arguments.setIgnoreStartWith(ignoreStartWith);
247
 
        PgDiff.createDiff(
248
 
                writer,
249
 
                arguments,
 
241
        PgDiff.createDiff(writer, arguments,
250
242
                PgDiffTest.class.getResourceAsStream(
251
243
                fileNameTemplate + "_original.sql"),
252
244
                PgDiffTest.class.getResourceAsStream(
253
245
                fileNameTemplate + "_new.sql"));
254
246
        writer.flush();
255
247
 
256
 
        final BufferedReader reader =
257
 
                new BufferedReader(
258
 
                new InputStreamReader(
 
248
        final BufferedReader reader = new BufferedReader(new InputStreamReader(
259
249
                PgDiffTest.class.getResourceAsStream(
260
250
                fileNameTemplate + "_diff.sql")));
261
251
        final char[] part = new char[1024];