當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。