本文整理汇总了Java中org.embulk.spi.FileInput.nextFile方法的典型用法代码示例。如果您正苦于以下问题:Java FileInput.nextFile方法的具体用法?Java FileInput.nextFile怎么用?Java FileInput.nextFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.embulk.spi.FileInput
的用法示例。
在下文中一共展示了FileInput.nextFile方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testOpenForNoFile
import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test
public void testOpenForNoFile(@Mocked final FileInput input) throws Exception
{
new NonStrictExpectations() {{
taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
task.getFormat(); result = "tar";
input.nextFile(); result = true; result = false;
input.poll(); result = getResourceAsBuffer("sample_0.tar");
task.getBufferAllocator(); result = newBufferAllocator();
}};
CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
FileInput archiveFileInput = plugin.open(taskSource, input);
Assert.assertFalse("Verify there is no file.", archiveFileInput.nextFile());
archiveFileInput.close();
new Verifications() {{
input.nextFile(); times = 2;
input.close(); times = 1;
}};
}
示例2: testOpenForOneFile
import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test
public void testOpenForOneFile(@Mocked final FileInput input) throws Exception
{
new NonStrictExpectations() {{
taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
task.getFormat(); result = "tar";
input.nextFile(); result = true; result = false;
input.poll(); result = getResourceAsBuffer("sample_1.tar");
task.getBufferAllocator(); result = newBufferAllocator();
}};
CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
FileInput archiveFileInput = plugin.open(taskSource, input);
verifyContents(archiveFileInput, "1,foo");
new Verifications() {{
input.nextFile(); times = 2;
input.close(); times = 1;
}};
}
示例3: testOpenForTwoFiles
import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test
public void testOpenForTwoFiles(@Mocked final FileInput input) throws Exception
{
new NonStrictExpectations() {{
taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
task.getFormat(); result = "tar";
input.nextFile(); result = true; result = false;
input.poll(); result = getResourceAsBuffer("samples.tar");
task.getBufferAllocator(); result = newBufferAllocator();
}};
CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
FileInput archiveFileInput = plugin.open(taskSource, input);
verifyContents(archiveFileInput, "1,foo", "2,bar");
new Verifications() {{
input.nextFile(); times = 2;
input.close(); times = 1;
}};
}
示例4: testOpenForFourFiles
import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test
public void testOpenForFourFiles(@Mocked final FileInput input) throws Exception
{
new NonStrictExpectations() {{
taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
task.getFormat(); result = "zip";
input.nextFile(); result = true; result = true; result = false; // two files.
input.poll(); result = getResourceAsBuffer("samples.zip"); result = getResourceAsBuffer("samples.zip");
task.getBufferAllocator(); result = newBufferAllocator();
}};
CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
FileInput archiveFileInput = plugin.open(taskSource, input);
verifyContents(archiveFileInput, "1,foo", "2,bar", "1,foo", "2,bar");
new Verifications() {{
input.nextFile(); times = 3;
input.close(); times = 1;
}};
}
示例5: testOpenArchiveFormatAutoDetect
import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test
public void testOpenArchiveFormatAutoDetect(@Mocked final FileInput input) throws Exception
{
new NonStrictExpectations() {{
taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
task.getFormat(); result = "";
input.nextFile(); result = true; result = false;
input.poll(); result = getResourceAsBuffer("sample_1.tar");
task.getBufferAllocator(); result = newBufferAllocator();
}};
CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
FileInput archiveFileInput = plugin.open(taskSource, input);
verifyContents(archiveFileInput, "1,foo");
new Verifications() {{
input.nextFile(); times = 2;
input.close(); times = 1;
}};
}
示例6: testOpenForTGZFormat
import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test
public void testOpenForTGZFormat(@Mocked final FileInput input) throws Exception
{
new NonStrictExpectations() {{
taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
task.getFormat(); result = "tgz";
input.nextFile(); result = true; result = false;
input.poll(); result = getResourceAsBuffer("samples.tgz");
task.getBufferAllocator(); result = newBufferAllocator();
}};
CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
FileInput archiveFileInput = plugin.open(taskSource, input);
verifyContents(archiveFileInput, "1,foo", "2,bar");
new Verifications() {{
input.nextFile(); times = 2;
input.close(); times = 1;
}};
}
示例7: testOpenForTarGZFormat
import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test
public void testOpenForTarGZFormat(@Mocked final FileInput input) throws Exception
{
new NonStrictExpectations() {{
taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
task.getFormat(); result = "tar.gz";
input.nextFile(); result = true; result = false;
input.poll(); result = getResourceAsBuffer("samples.tar.gz");
task.getBufferAllocator(); result = newBufferAllocator();
}};
CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
FileInput archiveFileInput = plugin.open(taskSource, input);
verifyContents(archiveFileInput, "1,foo", "2,bar");
new Verifications() {{
input.nextFile(); times = 2;
input.close(); times = 1;
}};
}
示例8: testOpenForTarBZ2Format
import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test
public void testOpenForTarBZ2Format(@Mocked final FileInput input) throws Exception
{
new NonStrictExpectations() {{
taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
task.getFormat(); result = "tar.bz2";
input.nextFile(); result = true; result = false;
input.poll(); result = getResourceAsBuffer("samples.tar.bz2");
task.getBufferAllocator(); result = newBufferAllocator();
}};
CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
FileInput archiveFileInput = plugin.open(taskSource, input);
verifyContents(archiveFileInput, "1,foo", "2,bar");
new Verifications() {{
input.nextFile(); times = 2;
input.close(); times = 1;
}};
}
示例9: testOpenForTarZFormat
import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test
public void testOpenForTarZFormat(@Mocked final FileInput input) throws Exception
{
new NonStrictExpectations() {{
taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
task.getFormat(); result = "tar.Z";
input.nextFile(); result = true; result = false;
input.poll(); result = getResourceAsBuffer("samples.tar.Z");
task.getBufferAllocator(); result = newBufferAllocator();
}};
CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
FileInput archiveFileInput = plugin.open(taskSource, input);
verifyContents(archiveFileInput, "1,foo", "2,bar");
new Verifications() {{
input.nextFile(); times = 2;
input.close(); times = 1;
}};
}
示例10: run
import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Override
public void run(TaskSource taskSource, Schema schema,
FileInput input, PageOutput output)
{
PluginTask task = taskSource.loadTask(PluginTask.class);
LineDecoder lineDecoder = new LineDecoder(input,task);
PageBuilder pageBuilder = new PageBuilder(Exec.getBufferAllocator(), schema, output);
String line = null;
final String columnName = task.getColumnName();
while( input.nextFile() ){
while(true){
line = lineDecoder.poll();
if( line == null ){
break;
}
pageBuilder.setString(0, line);
pageBuilder.addRecord();
}
}
pageBuilder.finish();
}
示例11: testOpenAutoDetectFailed
import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test(expected=RuntimeException.class)
public void testOpenAutoDetectFailed(@Mocked final FileInput input) throws Exception
{
new NonStrictExpectations() {{
taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
task.getFormat(); result = "";
input.nextFile(); result = true; result = false;
input.poll(); result = getResourceAsBuffer("sample_1.csv"); // This is not an archive.
task.getBufferAllocator(); result = newBufferAllocator();
}};
CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
FileInput archiveFileInput = plugin.open(taskSource, input);
archiveFileInput.nextFile();
}
示例12: testOpenExplicitConfigFailed
import org.embulk.spi.FileInput; //导入方法依赖的package包/类
@Test(expected=RuntimeException.class)
public void testOpenExplicitConfigFailed(@Mocked final FileInput input) throws Exception
{
new NonStrictExpectations() {{
taskSource.loadTask(CommonsCompressDecoderPlugin.PluginTask.class); result = task;
task.getFormat(); result = "tar";
input.nextFile(); result = true; result = false;
input.poll(); result = getResourceAsBuffer("samples.zip"); // This is not tar file.
task.getBufferAllocator(); result = newBufferAllocator();
}};
CommonsCompressDecoderPlugin plugin = new CommonsCompressDecoderPlugin();
FileInput archiveFileInput = plugin.open(taskSource, input);
archiveFileInput.nextFile();
}