use of org.embulk.spi.util.InputStreamFileInput in project embulk by embulk.
the class TestInputStreamFileInput method testEmptyProvider.
@Test
public void testEmptyProvider() throws IOException {
InputStreamFileInput subject = new InputStreamFileInput(runtime.getBufferAllocator(), provider(new InputStream[0]));
assertEquals(false, subject.nextFile());
subject.close();
}
use of org.embulk.spi.util.InputStreamFileInput in project embulk by embulk.
the class TestInputStreamFileInput method testInputStreamReadException.
@Test
public void testInputStreamReadException() {
InputStreamFileInput subject = new InputStreamFileInput(runtime.getBufferAllocator(), new InputStreamFileInput.Provider() {
@Override
public InputStream openNext() throws IOException {
return new InputStream() {
@Override
public int read() throws IOException {
throw new IOException("emulated exception");
}
};
}
@Override
public void close() throws IOException {
}
});
assertEquals(true, subject.nextFile());
try {
subject.poll();
fail();
} catch (RuntimeException re) {
// OK
}
subject.close();
}
use of org.embulk.spi.util.InputStreamFileInput in project embulk by embulk.
the class TestInputStreamFileInput method testEmptyStream.
@Test
public void testEmptyStream() throws IOException {
InputStreamFileInput subject = new InputStreamFileInput(runtime.getBufferAllocator(), provider(new ByteArrayInputStream(new byte[0])));
assertEquals(true, subject.nextFile());
assertEquals(null, subject.poll());
subject.close();
}
use of org.embulk.spi.util.InputStreamFileInput in project embulk by embulk.
the class TestInputStreamFileInput method testProviderOpenNextException.
@Test
public void testProviderOpenNextException() {
InputStreamFileInput subject = new InputStreamFileInput(runtime.getBufferAllocator(), new InputStreamFileInput.Provider() {
@Override
public InputStream openNext() throws IOException {
throw new IOException("emulated exception");
}
@Override
public void close() throws IOException {
}
});
try {
subject.nextFile();
fail();
} catch (RuntimeException re) {
// OK
}
subject.close();
}
use of org.embulk.spi.util.InputStreamFileInput in project embulk by embulk.
the class TestInputStreamFileInput method testProviderCloseException.
@Test
public void testProviderCloseException() {
InputStreamFileInput subject = new InputStreamFileInput(runtime.getBufferAllocator(), new InputStreamFileInput.Provider() {
@Override
public InputStream openNext() throws IOException {
return new ByteArrayInputStream(new byte[0]);
}
@Override
public void close() throws IOException {
throw new IOException("emulated exception");
}
});
try {
subject.close();
fail();
} catch (RuntimeException re) {
// OK
}
}
Aggregations