@Test public void testResolve() throws Exception { final ArrayList<TransferItem> files = new ArrayList<TransferItem>(); final Path a = new Path("/a", EnumSet.of(Path.Type.directory)); files.add(new TransferItem(a, new NullLocal(System.getProperty("java.io.tmpdir"), "a") { @Override public boolean isFile() { return false; } @Override public boolean isDirectory() { return true; } })); UploadSymlinkResolver resolver = new UploadSymlinkResolver(new Symlink() { @Override public void symlink(final Path file, final String target) { } }, files); assertTrue(resolver.resolve(new NullLocal(System.getProperty("java.io.tmpdir"), "a" + File.separator + "b") { @Override public boolean isSymbolicLink() { return true; } @Override public boolean isFile() { return true; } @Override public Local getSymlinkTarget() { return new NullLocal(System.getProperty("java.io.tmpdir"), "a" + File.separator + "c"); } })); assertFalse(resolver.resolve(new NullLocal("/a/b") { public boolean isSymbolicLink() { return true; } @Override public boolean isFile() { return true; } @Override public Local getSymlinkTarget() { return new NullLocal("/b/c"); } })); }
@Override public boolean resolve(final Local file) throws NotfoundException, LocalAccessDeniedException { if(PreferencesFactory.get().getBoolean("local.symboliclink.resolve")) { return false; } if(feature != null) { final Local target = file.getSymlinkTarget(); for(TransferItem root : files) { if(this.findTarget(target, root.local)) { if(log.isDebugEnabled()) { log.debug(String.format("Resolved target %s for %s", target, file)); } return true; } } } return false; }
UploadSymlinkResolver extends AbstractSymlinkResolver<Local> { @Override public boolean resolve(final Local file) throws NotfoundException, LocalAccessDeniedException { if(PreferencesFactory.get().getBoolean("local.symboliclink.resolve")) { return false; } if(feature != null) { final Local target = file.getSymlinkTarget(); for(TransferItem root : files) { if(this.findTarget(target, root.local)) { if(log.isDebugEnabled()) { log.debug(String.format("Resolved target %s for %s", target, file)); } return true; } } } return false; } }
UploadSymlinkResolver extends AbstractSymlinkResolver<Local> { @Override public boolean resolve(final Local file) throws NotfoundException, LocalAccessDeniedException { if(PreferencesFactory.get().getBoolean("local.symboliclink.resolve")) { return false; } if(feature != null) { final Local target = file.getSymlinkTarget(); for(TransferItem root : files) { if(this.findTarget(target, root.local)) { if(log.isDebugEnabled()) { log.debug(String.format("Resolved target %s for %s", target, file)); } return true; } } } return false; } UploadSymlinkResolver(final Symlink feature, final List<TransferItem> files); }
UploadSymlinkResolver extends AbstractSymlinkResolver<Local> { @Override public boolean resolve(final Local file) throws NotfoundException, LocalAccessDeniedException { if(PreferencesFactory.get().getBoolean("local.symboliclink.resolve")) { return false; } if(feature != null) { final Local target = file.getSymlinkTarget(); for(TransferItem root : files) { if(this.findTarget(target, root.local)) { if(log.isDebugEnabled()) { log.debug(String.format("Resolved target %s for %s", target, file)); } return true; } } } return false; } UploadSymlinkResolver(final Symlink feature, final List<TransferItem> files); @Override boolean resolve(final Local file); }
UploadSymlinkResolver extends AbstractSymlinkResolver<Local> { @Override public boolean resolve(final Local file) throws NotfoundException, LocalAccessDeniedException { if(PreferencesFactory.get().getBoolean("local.symboliclink.resolve")) { return false; } if(feature != null) { final Local target = file.getSymlinkTarget(); for(TransferItem root : files) { if(this.findTarget(target, root.local)) { if(log.isDebugEnabled()) { log.debug(String.format("Resolved target %s for %s", target, file)); } return true; } } } return false; } UploadSymlinkResolver(final Symlink feature, final List<TransferItem> files); @Override boolean resolve(final Local file);  }