当前位置: 首页>>代码示例>>Java>>正文


Java CsvParserPlugin类代码示例

本文整理汇总了Java中org.embulk.standards.CsvParserPlugin的典型用法代码示例。如果您正苦于以下问题:Java CsvParserPlugin类的具体用法?Java CsvParserPlugin怎么用?Java CsvParserPlugin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CsvParserPlugin类属于org.embulk.standards包,在下文中一共展示了CsvParserPlugin类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkDefaultValuesP12keyNull

import org.embulk.standards.CsvParserPlugin; //导入依赖的package包/类
@Test(expected = ConfigException.class)
public void checkDefaultValuesP12keyNull()
{
    ConfigSource config = Exec.newConfigSource()
            .set("in", inputConfig())
            .set("parser", parserConfig(schemaConfig()))
            .set("type", "gcs")
            .set("bucket", GCP_BUCKET)
            .set("path_prefix", "my-prefix")
            .set("file_ext", ".csv")
            .set("auth_method", "private_key")
            .set("service_account_email", GCP_EMAIL)
            .set("p12_keyfile", null)
            .set("formatter", formatterConfig());

    Schema schema = config.getNested("parser").loadConfig(CsvParserPlugin.PluginTask.class).getSchemaConfig().toSchema();

    runner.transaction(config, schema, 0, new Control());
}
 
开发者ID:embulk,项目名称:embulk-output-gcs,代码行数:20,代码来源:TestGcsOutputPlugin.java

示例2: checkDefaultValuesConflictSetting

import org.embulk.standards.CsvParserPlugin; //导入依赖的package包/类
@Test(expected = ConfigException.class)
public void checkDefaultValuesConflictSetting()
{
    ConfigSource config = Exec.newConfigSource()
            .set("in", inputConfig())
            .set("parser", parserConfig(schemaConfig()))
            .set("type", "gcs")
            .set("bucket", GCP_BUCKET)
            .set("path_prefix", "my-prefix")
            .set("file_ext", ".csv")
            .set("auth_method", "private_key")
            .set("service_account_email", GCP_EMAIL)
            .set("p12_keyfile", GCP_P12_KEYFILE)
            .set("p12_keyfile_path", GCP_P12_KEYFILE)
            .set("formatter", formatterConfig());

    Schema schema = config.getNested("parser").loadConfig(CsvParserPlugin.PluginTask.class).getSchemaConfig().toSchema();

    runner.transaction(config, schema, 0, new Control());
}
 
开发者ID:embulk,项目名称:embulk-output-gcs,代码行数:21,代码来源:TestGcsOutputPlugin.java

示例3: checkDefaultValuesInvalidPrivateKey

import org.embulk.standards.CsvParserPlugin; //导入依赖的package包/类
@Test(expected = ConfigException.class)
public void checkDefaultValuesInvalidPrivateKey()
{
    ConfigSource config = Exec.newConfigSource()
            .set("in", inputConfig())
            .set("parser", parserConfig(schemaConfig()))
            .set("type", "gcs")
            .set("bucket", GCP_BUCKET)
            .set("path_prefix", "my-prefix")
            .set("file_ext", ".csv")
            .set("auth_method", "private_key")
            .set("service_account_email", GCP_EMAIL)
            .set("p12_keyfile", "invalid-key.p12")
            .set("formatter", formatterConfig());

    Schema schema = config.getNested("parser").loadConfig(CsvParserPlugin.PluginTask.class).getSchemaConfig().toSchema();

    runner.transaction(config, schema, 0, new Control());
}
 
开发者ID:embulk,项目名称:embulk-output-gcs,代码行数:20,代码来源:TestGcsOutputPlugin.java

示例4: checkDefaultValuesJsonKeyfileNull

import org.embulk.standards.CsvParserPlugin; //导入依赖的package包/类
@Test(expected = ConfigException.class)
public void checkDefaultValuesJsonKeyfileNull()
{
    ConfigSource config = Exec.newConfigSource()
            .set("in", inputConfig())
            .set("parser", parserConfig(schemaConfig()))
            .set("type", "gcs")
            .set("bucket", GCP_BUCKET)
            .set("path_prefix", "my-prefix")
            .set("file_ext", ".csv")
            .set("auth_method", "json_key")
            .set("service_account_email", GCP_EMAIL)
            .set("json_keyfile", null)
            .set("formatter", formatterConfig());

    Schema schema = config.getNested("parser").loadConfig(CsvParserPlugin.PluginTask.class).getSchemaConfig().toSchema();

    runner.transaction(config, schema, 0, new Control());
}
 
开发者ID:embulk,项目名称:embulk-output-gcs,代码行数:20,代码来源:TestGcsOutputPlugin.java

示例5: testGcsFileOutputByOpen

import org.embulk.standards.CsvParserPlugin; //导入依赖的package包/类
@Test
public void testGcsFileOutputByOpen() throws Exception
{
    ConfigSource configSource = config();
    PluginTask task = configSource.loadConfig(PluginTask.class);
    Schema schema = configSource.getNested("parser").loadConfig(CsvParserPlugin.PluginTask.class).getSchemaConfig().toSchema();
    runner.transaction(configSource, schema, 0, new Control());

    TransactionalFileOutput output = plugin.open(task.dump(), 0);

    output.nextFile();

    FileInputStream is = new FileInputStream(LOCAL_PATH_PREFIX);
    byte[] bytes = convertInputStreamToByte(is);
    Buffer buffer = Buffer.wrap(bytes);
    output.add(buffer);

    output.finish();
    output.commit();

    String remotePath = GCP_PATH_PREFIX + String.format(task.getSequenceFormat(), 0, 1) + task.getFileNameExtension();
    assertRecords(remotePath);
}
 
开发者ID:embulk,项目名称:embulk-output-gcs,代码行数:24,代码来源:TestGcsOutputPlugin.java

示例6: testTransaction

import org.embulk.standards.CsvParserPlugin; //导入依赖的package包/类
@Test
public void testTransaction() {
    ConfigSource config = config();
    Schema schema = config.getNested("parser").loadConfig(CsvParserPlugin.PluginTask.class).getSchemaConfig()
            .toSchema();
    plugin.transaction(config, schema, 0, new OutputPlugin.Control() {
        @Override
        public List<TaskReport> run(TaskSource taskSource) {
            return Lists.newArrayList(Exec.newTaskReport());
        }
    });
}
 
开发者ID:yahoojapan,项目名称:embulk-output-solr,代码行数:13,代码来源:TestSolrOutputPlugin.java

示例7: testResume

import org.embulk.standards.CsvParserPlugin; //导入依赖的package包/类
@Test
public void testResume() {
    ConfigSource config = config();
    Schema schema = config.getNested("parser").loadConfig(CsvParserPlugin.PluginTask.class).getSchemaConfig()
            .toSchema();
    PluginTask task = config.loadConfig(PluginTask.class);
    plugin.resume(task.dump(), schema, 0, new OutputPlugin.Control() {
        @Override
        public List<TaskReport> run(TaskSource taskSource) {
            return Lists.newArrayList(Exec.newTaskReport());
        }
    });
}
 
开发者ID:yahoojapan,项目名称:embulk-output-solr,代码行数:14,代码来源:TestSolrOutputPlugin.java

示例8: testCleanup

import org.embulk.standards.CsvParserPlugin; //导入依赖的package包/类
@Test
public void testCleanup() {
    ConfigSource config = config();
    Schema schema = config.getNested("parser").loadConfig(CsvParserPlugin.PluginTask.class).getSchemaConfig()
            .toSchema();
    PluginTask task = config.loadConfig(PluginTask.class);
    plugin.cleanup(task.dump(), schema, 0, Arrays.asList(Exec.newTaskReport()));
    // no error happens
}
 
开发者ID:yahoojapan,项目名称:embulk-output-solr,代码行数:10,代码来源:TestSolrOutputPlugin.java

示例9: testGcsClientCreateSuccessfully

import org.embulk.standards.CsvParserPlugin; //导入依赖的package包/类
@Test
public void testGcsClientCreateSuccessfully()
        throws GeneralSecurityException, IOException, NoSuchMethodException,
        IllegalAccessException, InvocationTargetException
{
    ConfigSource configSource = config();
    PluginTask task = configSource.loadConfig(PluginTask.class);
    Schema schema = configSource.getNested("parser").loadConfig(CsvParserPlugin.PluginTask.class).getSchemaConfig().toSchema();
    runner.transaction(configSource, schema, 0, new Control());

    Method method = GcsOutputPlugin.class.getDeclaredMethod("createClient", PluginTask.class);
    method.setAccessible(true);
    method.invoke(plugin, task); // no errors happens
}
 
开发者ID:embulk,项目名称:embulk-output-gcs,代码行数:15,代码来源:TestGcsOutputPlugin.java

示例10: testGcsClientCreateThrowConfigException

import org.embulk.standards.CsvParserPlugin; //导入依赖的package包/类
@Test(expected = ConfigException.class)
public void testGcsClientCreateThrowConfigException()
        throws GeneralSecurityException, IOException, NoSuchMethodException,
        IllegalAccessException, InvocationTargetException
{
    ConfigSource config = Exec.newConfigSource()
            .set("in", inputConfig())
            .set("parser", parserConfig(schemaConfig()))
            .set("type", "gcs")
            .set("bucket", "non-exists-bucket")
            .set("path_prefix", "my-prefix")
            .set("file_ext", ".csv")
            .set("auth_method", "json_key")
            .set("service_account_email", GCP_EMAIL)
            .set("json_keyfile", GCP_JSON_KEYFILE)
            .set("formatter", formatterConfig());

    PluginTask task = config.loadConfig(PluginTask.class);

    Schema schema = config.getNested("parser").loadConfig(CsvParserPlugin.PluginTask.class).getSchemaConfig().toSchema();
    runner.transaction(config, schema, 0, new Control());

    Method method = GcsOutputPlugin.class.getDeclaredMethod("createClient", PluginTask.class);
    method.setAccessible(true);
    try {
        method.invoke(plugin, task);
    }
    catch (InvocationTargetException ex) {
        throw (ConfigException) ex.getCause();
    }
}
 
开发者ID:embulk,项目名称:embulk-output-gcs,代码行数:32,代码来源:TestGcsOutputPlugin.java

示例11: getRecords

import org.embulk.standards.CsvParserPlugin; //导入依赖的package包/类
private List<Object[]> getRecords(ConfigSource config, MockPageOutput output)
{
    Schema schema = config.getNested("parser").loadConfig(CsvParserPlugin.PluginTask.class).getSchemaConfig().toSchema();
    return Pages.toObjects(schema, output.pages);
}
 
开发者ID:civitaspo,项目名称:embulk-input-hdfs,代码行数:6,代码来源:TestHdfsFileInputPlugin.java


注:本文中的org.embulk.standards.CsvParserPlugin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。