@Override public void sync() throws IOException { outputStream.sync(); }
@Override public void sync() throws IOException { try { originalStream.sync(); } catch (IOException e) { handleIOException(e); } }
@Test public void testDelegateOutStreamMethods() throws IOException { // mock the output stream final FSDataOutputStream mockOut = mock(FSDataOutputStream.class); final long outPos = 46651L; when(mockOut.getPos()).thenReturn(outPos); final FileSystem fs = mock(FileSystem.class); when(fs.create(any(Path.class), any(WriteMode.class))).thenReturn(mockOut); final LimitedConnectionsFileSystem lfs = new LimitedConnectionsFileSystem(fs, 100); final FSDataOutputStream out = lfs.create(mock(Path.class), WriteMode.OVERWRITE); // validate the output stream out.write(77); verify(mockOut).write(77); { byte[] bytes = new byte[1786]; out.write(bytes, 100, 111); verify(mockOut).write(bytes, 100, 111); } assertEquals(outPos, out.getPos()); out.flush(); verify(mockOut).flush(); out.sync(); verify(mockOut).sync(); out.close(); verify(mockOut).close(); }
@Override public void sync() throws IOException { outputStream.sync(); }
@Override public void sync() throws IOException { out.sync(); }
@Override public void sync() throws IOException { outStream.sync(); }
@Override public void sync() throws IOException { outputStream.sync(); }
@Override public void sync() throws IOException { outStream.sync(); }
@Override public void sync() throws IOException { out.sync(); }
@Override public void sync() throws IOException { outStream.sync(); }
@Override public void sync() throws IOException { outStream.sync(); }
@Override public void sync() throws IOException { out.sync(); }
@Override public void sync() throws IOException { out.sync(); }
@Override public void sync() throws IOException { out.sync(); }
@Override public void sync() throws IOException { out.sync(); }
@Override public void sync() throws IOException { try { originalStream.sync(); } catch (IOException e) { handleIOException(e); } }
@Override public void sync() throws IOException { try { originalStream.sync(); } catch (IOException e) { handleIOException(e); } }