@Test public void testFindWithWorkdir() { assertEquals(new Path("/sandbox", EnumSet.of(Path.Type.directory)), new SFTPHomeDirectoryService(null).find(new Path("/", EnumSet.of(Path.Type.directory)), "sandbox")); assertEquals(new Path("/sandbox", EnumSet.of(Path.Type.directory)), new SFTPHomeDirectoryService(null).find(new Path("/", EnumSet.of(Path.Type.directory)), "/sandbox")); }
@Override public Path find() throws BackgroundException { final Path home = super.find(); if(home == DEFAULT_HOME) { try { final String directory = session.sftp().canonicalize("."); return new Path(PathNormalizer.normalize(directory), directory.equals(String.valueOf(Path.DELIMITER)) ? EnumSet.of(Path.Type.volume, Path.Type.directory) : EnumSet.of(Path.Type.directory)); } catch(IOException e) { throw new SFTPExceptionMappingService().map(e); } } return home; }
SFTPHomeDirectoryService extends DefaultHomeFinderService { @Override public Path find() throws BackgroundException { final Path home = super.find(); if(home == DEFAULT_HOME) { try { final String directory = session.sftp().canonicalize("."); return new Path(PathNormalizer.normalize(directory), directory.equals(String.valueOf(Path.DELIMITER)) ? EnumSet.of(Path.Type.volume, Path.Type.directory) : EnumSet.of(Path.Type.directory)); } catch(IOException e) { throw new SFTPExceptionMappingService().map(e); } } return home; } }
SFTPHomeDirectoryService extends DefaultHomeFinderService { @Override public Path find() throws BackgroundException { final Path home = super.find(); if(home == DEFAULT_HOME) { try { final String directory = session.sftp().canonicalize("."); return new Path(PathNormalizer.normalize(directory), directory.equals(String.valueOf(Path.DELIMITER)) ? EnumSet.of(Path.Type.volume, Path.Type.directory) : EnumSet.of(Path.Type.directory)); } catch(IOException e) { throw new SFTPExceptionMappingService().map(e); } } return home; } SFTPHomeDirectoryService(final SFTPSession session); }
SFTPHomeDirectoryService extends DefaultHomeFinderService { @Override public Path find() throws BackgroundException { final Path home = super.find(); if(home == DEFAULT_HOME) { try { final String directory = session.sftp().canonicalize("."); return new Path(PathNormalizer.normalize(directory), directory.equals(String.valueOf(Path.DELIMITER)) ? EnumSet.of(Path.Type.volume, Path.Type.directory) : EnumSet.of(Path.Type.directory)); } catch(IOException e) { throw new SFTPExceptionMappingService().map(e); } } return home; } SFTPHomeDirectoryService(final SFTPSession session); @Override Path find(); }
SFTPHomeDirectoryService extends DefaultHomeFinderService { @Override public Path find() throws BackgroundException { final Path home = super.find(); if(home == DEFAULT_HOME) { try { final String directory = session.sftp().canonicalize("."); return new Path(PathNormalizer.normalize(directory), directory.equals(String.valueOf(Path.DELIMITER)) ? EnumSet.of(Path.Type.volume, Path.Type.directory) : EnumSet.of(Path.Type.directory)); } catch(IOException e) { throw new SFTPExceptionMappingService().map(e); } } return home; } SFTPHomeDirectoryService(final SFTPSession session); @Override Path find();  }