@Test public void testMovePath() throws IOException, URISyntaxException { String expected = "test"; ByteArrayOutputStream actual = new ByteArrayOutputStream(); Path src = new Path("/src/file.txt"); Path dst = new Path("/dst/file.txt"); FileSystem fs1 = Mockito.mock(FileSystem.class); Mockito.when(fs1.exists(src)).thenReturn(true); Mockito.when(fs1.isFile(src)).thenReturn(true); Mockito.when(fs1.getUri()).thenReturn(new URI("fs1: Mockito.when(fs1.getFileStatus(src)).thenReturn(new FileStatus(1, false, 1, 1, 1, src)); Mockito.when(fs1.open(src)) .thenReturn(new FSDataInputStream(new SeekableFSInputStream(new ByteArrayInputStream(expected.getBytes())))); Mockito.when(fs1.delete(src, true)).thenReturn(true); FileSystem fs2 = Mockito.mock(FileSystem.class); Mockito.when(fs2.exists(dst)).thenReturn(false); Mockito.when(fs2.getUri()).thenReturn(new URI("fs2: Mockito.when(fs2.getConf()).thenReturn(new Configuration()); Mockito.when(fs2.create(dst, false)).thenReturn(new FSDataOutputStream(actual, null)); try (ParallelRunner parallelRunner = new ParallelRunner(1, fs1)) { parallelRunner.movePath(src, fs2, dst, Optional.<String>absent()); } Assert.assertEquals(actual.toString(), expected); }
public void movePath(final Path src, final FileSystem dstFs, final Path dst, final Optional<String> group) { movePath(src, dstFs, dst, false, group); }
ParallelRunner implements Closeable { public void movePath(final Path src, final FileSystem dstFs, final Path dst, final Optional<String> group) { movePath(src, dstFs, dst, false, group); } }
ParallelRunner implements Closeable { public void movePath(final Path src, final FileSystem dstFs, final Path dst, final Optional<String> group) { movePath(src, dstFs, dst, false, group); } ParallelRunner(int threads, FileSystem fs);  ParallelRunner(int threads, FileSystem fs, FailPolicy failPolicy); }
ParallelRunner implements Closeable { public void movePath(final Path src, final FileSystem dstFs, final Path dst, final Optional<String> group) { movePath(src, dstFs, dst, false, group); } ParallelRunner(int threads, FileSystem fs);  ParallelRunner(int threads, FileSystem fs, FailPolicy failPolicy); void serializeToFile(final T state, final Path outputFilePath); void deserializeFromFile(final T state, final Path inputFilePath); void deserializeFromSequenceFile(final Class<? extends Writable> keyClass,
      final Class<T> stateClass, final Path inputFilePath, final Collection<T> states, final boolean deleteAfter); void deletePath(final Path path, final boolean recursive); void renamePath(final Path src, final Path dst, final Optional<String> group); void movePath(final Path src, final FileSystem dstFs, final Path dst, final Optional<String> group); void movePath(final Path src, final FileSystem dstFs, final Path dst, final boolean overwrite,
      final Optional<String> group); void submitCallable(Callable<Void> callable, String name); void waitForTasks(long timeoutInMills); void waitForTasks(); @Override void close(); }
ParallelRunner implements Closeable { public void movePath(final Path src, final FileSystem dstFs, final Path dst, final Optional<String> group) { movePath(src, dstFs, dst, false, group); } ParallelRunner(int threads, FileSystem fs);  ParallelRunner(int threads, FileSystem fs, FailPolicy failPolicy); void serializeToFile(final T state, final Path outputFilePath); void deserializeFromFile(final T state, final Path inputFilePath); void deserializeFromSequenceFile(final Class<? extends Writable> keyClass,
      final Class<T> stateClass, final Path inputFilePath, final Collection<T> states, final boolean deleteAfter); void deletePath(final Path path, final boolean recursive); void renamePath(final Path src, final Path dst, final Optional<String> group); void movePath(final Path src, final FileSystem dstFs, final Path dst, final Optional<String> group); void movePath(final Path src, final FileSystem dstFs, final Path dst, final boolean overwrite,
      final Optional<String> group); void submitCallable(Callable<Void> callable, String name); void waitForTasks(long timeoutInMills); void waitForTasks(); @Override void close(); static final String PARALLEL_RUNNER_THREADS_KEY; static final int DEFAULT_PARALLEL_RUNNER_THREADS; }