@Test(expected = NotfoundException.class) public void testMoveNotFound() throws Exception { final ProtocolFactory factory = new ProtocolFactory(new HashSet<>(Collections.singleton(new IRODSProtocol()))); final Profile profile = new ProfilePlistReader(factory).read( new Local("../profiles/iRODS (iPlant Collaborative).cyberduckprofile")); final Host host = new Host(profile, profile.getDefaultHostname(), new Credentials( System.getProperties().getProperty("irods.key"), System.getProperties().getProperty("irods.secret") )); final IRODSSession session = new IRODSSession(host); session.open(Proxy.DIRECT, new DisabledHostKeyCallback(), new DisabledLoginCallback()); session.login(Proxy.DIRECT, new DisabledLoginCallback(), new DisabledCancelCallback()); final Path source = new Path(new IRODSHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)); final Path destination = new Path(new IRODSHomeFinderService(session).find(), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.directory)); assertFalse(session.getFeature(Find.class).find(source)); assertFalse(session.getFeature(Find.class).find(destination)); new IRODSMoveFeature(session).move(source, destination, new TransferStatus(), new Delete.DisabledCallback(), new DisabledConnectionCallback()); }
@Override public Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback) throws BackgroundException { try { final IRODSFileSystemAO fs = session.getClient(); final IRODSFile s = fs.getIRODSFileFactory().instanceIRODSFile(file.getAbsolute()); if(!s.exists()) { throw new NotfoundException(String.format("%s doesn't exist", file.getAbsolute())); } if(status.isExists()) { delete.delete(Collections.singletonMap(renamed, status), connectionCallback, callback); } final IRODSFile d = fs.getIRODSFileFactory().instanceIRODSFile(renamed.getAbsolute()); s.renameTo(d); return renamed; } catch(JargonException e) { throw new IRODSExceptionMappingService().map("Cannot rename {0}", e, file); } }
IRODSMoveFeature implements Move { @Override public Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback) throws BackgroundException { try { final IRODSFileSystemAO fs = session.getClient(); final IRODSFile s = fs.getIRODSFileFactory().instanceIRODSFile(file.getAbsolute()); if(!s.exists()) { throw new NotfoundException(String.format("%s doesn't exist", file.getAbsolute())); } if(status.isExists()) { delete.delete(Collections.singletonMap(renamed, status), connectionCallback, callback); } final IRODSFile d = fs.getIRODSFileFactory().instanceIRODSFile(renamed.getAbsolute()); s.renameTo(d); return renamed; } catch(JargonException e) { throw new IRODSExceptionMappingService().map("Cannot rename {0}", e, file); } } }
IRODSMoveFeature implements Move { @Override public Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback) throws BackgroundException { try { final IRODSFileSystemAO fs = session.getClient(); final IRODSFile s = fs.getIRODSFileFactory().instanceIRODSFile(file.getAbsolute()); if(!s.exists()) { throw new NotfoundException(String.format("%s doesn't exist", file.getAbsolute())); } if(status.isExists()) { delete.delete(Collections.singletonMap(renamed, status), connectionCallback, callback); } final IRODSFile d = fs.getIRODSFileFactory().instanceIRODSFile(renamed.getAbsolute()); s.renameTo(d); return renamed; } catch(JargonException e) { throw new IRODSExceptionMappingService().map("Cannot rename {0}", e, file); } } IRODSMoveFeature(IRODSSession session); }
IRODSMoveFeature implements Move { @Override public Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback) throws BackgroundException { try { final IRODSFileSystemAO fs = session.getClient(); final IRODSFile s = fs.getIRODSFileFactory().instanceIRODSFile(file.getAbsolute()); if(!s.exists()) { throw new NotfoundException(String.format("%s doesn't exist", file.getAbsolute())); } if(status.isExists()) { delete.delete(Collections.singletonMap(renamed, status), connectionCallback, callback); } final IRODSFile d = fs.getIRODSFileFactory().instanceIRODSFile(renamed.getAbsolute()); s.renameTo(d); return renamed; } catch(JargonException e) { throw new IRODSExceptionMappingService().map("Cannot rename {0}", e, file); } } IRODSMoveFeature(IRODSSession session); @Override Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback); @Override boolean isRecursive(final Path source, final Path target); }
IRODSMoveFeature implements Move { @Override public Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback) throws BackgroundException { try { final IRODSFileSystemAO fs = session.getClient(); final IRODSFile s = fs.getIRODSFileFactory().instanceIRODSFile(file.getAbsolute()); if(!s.exists()) { throw new NotfoundException(String.format("%s doesn't exist", file.getAbsolute())); } if(status.isExists()) { delete.delete(Collections.singletonMap(renamed, status), connectionCallback, callback); } final IRODSFile d = fs.getIRODSFileFactory().instanceIRODSFile(renamed.getAbsolute()); s.renameTo(d); return renamed; } catch(JargonException e) { throw new IRODSExceptionMappingService().map("Cannot rename {0}", e, file); } } IRODSMoveFeature(IRODSSession session); @Override Path move(final Path file, final Path renamed, final TransferStatus status, final Delete.Callback callback, final ConnectionCallback connectionCallback); @Override boolean isRecursive(final Path source, final Path target);  }