Sha256: b326ddbdb16ee0438360e7890e51ea5b4d7710c386717b1d1b5fd62ef41a42d2

Contents?: true

Size: 1.74 KB

Versions: 4

Compression:

Stored size: 1.74 KB

Contents

package org.embulk.input.postgresql;

import static org.embulk.input.postgresql.PostgreSQLTests.execute;
import static org.embulk.test.EmbulkTests.readSortedFile;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;

import java.nio.file.Path;

import org.embulk.config.ConfigSource;
import org.embulk.input.PostgreSQLInputPlugin;
import org.embulk.spi.InputPlugin;
import org.embulk.test.EmbulkTests;
import org.embulk.test.TestingEmbulk;
import org.embulk.test.TestingEmbulk.RunResult;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

public class UUIDTest
{
    private static final String BASIC_RESOURCE_PATH = "org/embulk/input/postgresql/test/expect/uuid/";

    private static ConfigSource loadYamlResource(TestingEmbulk embulk, String fileName)
    {
        return embulk.loadYamlResource(BASIC_RESOURCE_PATH + fileName);
    }

    private static String readResource(String fileName)
    {
        return EmbulkTests.readResource(BASIC_RESOURCE_PATH + fileName);
    }

    @Rule
    public TestingEmbulk embulk = TestingEmbulk.builder()
        .registerPlugin(InputPlugin.class, "postgresql", PostgreSQLInputPlugin.class)
        .build();

    private ConfigSource baseConfig;

    @Before
    public void setup()
    {
        baseConfig = PostgreSQLTests.baseConfig();
    }

    @Test
    public void loadAsStringByDefault() throws Exception
    {
        execute(readResource("setup.sql"));

        Path out1 = embulk.createTempFile("csv");
        RunResult result1 = embulk.runInput(
                baseConfig.merge(loadYamlResource(embulk, "as_string.yml")),
                out1);
        assertThat(
                readSortedFile(out1),
                is(readResource("expected_string.csv")));
    }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
embulk-input-postgresql-0.10.1 src/test/java/org/embulk/input/postgresql/UUIDTest.java
embulk-input-postgresql-0.10.0 src/test/java/org/embulk/input/postgresql/UUIDTest.java
embulk-input-postgresql-0.9.3 src/test/java/org/embulk/input/postgresql/UUIDTest.java
embulk-input-postgresql-0.9.2 src/test/java/org/embulk/input/postgresql/UUIDTest.java