本文整理汇总了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());
}
示例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());
}
示例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());
}
示例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());
}
示例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);
}
示例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());
}
});
}
示例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());
}
});
}
示例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
}
示例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
}
示例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();
}
}
示例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);
}