Sha256: 4dfda74faa06e186ef15ee0973d385dbbb15b0dc57657987c7786bf5db499332

Contents?: true

Size: 1.77 KB

Versions: 2

Compression:

Stored size: 1.77 KB

Contents

package org.embulk.plugin;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import org.embulk.EmbulkTestRuntime;
import org.junit.Rule;
import org.junit.Test;

public class TestPluginTypeSerDe
{
    @Rule
    public EmbulkTestRuntime testRuntime = new EmbulkTestRuntime();

    @Test
    public void testParseTypeString()
    {
        PluginType pluginType = testRuntime.getModelManager().readObjectWithConfigSerDe(
            PluginType.class,
            "\"file\"");
        assertTrue(pluginType instanceof DefaultPluginType);
        assertEquals(PluginSource.Type.DEFAULT, pluginType.getSourceType());
        assertEquals("file", pluginType.getName());
    }

    @Test
    public void testParseTypeMapping()
    {
        PluginType pluginType = testRuntime.getModelManager().readObjectWithConfigSerDe(
            PluginType.class,
            "{ \"name\": \"dummy\" }");
        assertTrue(pluginType instanceof DefaultPluginType);
        assertEquals(PluginSource.Type.DEFAULT, pluginType.getSourceType());
        assertEquals("dummy", pluginType.getName());
    }

    @Test
    public void testParseTypeMaven()
    {
        PluginType pluginType = testRuntime.getModelManager().readObjectWithConfigSerDe(
            PluginType.class,
            "{ \"name\": \"foo\", \"source\": \"maven\", \"group\": \"org.embulk.bar\", \"version\": \"0.1.2\" }");
        assertTrue(pluginType instanceof MavenPluginType);
        assertEquals(PluginSource.Type.MAVEN, pluginType.getSourceType());
        MavenPluginType mavenPluginType = (MavenPluginType) pluginType;
        assertEquals(mavenPluginType.getName(), "foo");
        assertEquals(mavenPluginType.getGroup(), "org.embulk.bar");
        assertEquals(mavenPluginType.getVersion(), "0.1.2");
    }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
embulk-0.8.25 embulk-core/src/test/java/org/embulk/plugin/TestPluginTypeSerDe.java
embulk-0.8.25-java embulk-core/src/test/java/org/embulk/plugin/TestPluginTypeSerDe.java