@Test public void testLockNotfound() throws Exception { final DropboxTouchFeature touch = new DropboxTouchFeature(session); final Path file = touch.touch(new Path(new Path(new DropboxHomeFinderFeature(session).find(), "Projects", EnumSet.of(Path.Type.directory, Path.Type.shared)).withAttributes(new PathAttributes().withVersionId("7581509952")), new AlphanumericRandomStringService().random(), EnumSet.of(Path.Type.file)), new TransferStatus()); final DropboxLockFeature f = new DropboxLockFeature(session); f.unlock(file, "l"); new DropboxDeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback()); }
@Override public void unlock(final Path file, final String token) throws BackgroundException { try { for(LockFileResultEntry result : new DbxUserFilesRequests(session.getClient(file)).unlockFileBatch(Collections.singletonList( new UnlockFileArg(containerService.getKey(file)))).getEntries()) { if(result.isFailure()) { throw failure(result); } if(log.isDebugEnabled()) { log.debug(String.format("Unlocked file %s with result %s", file, result.getSuccessValue())); } } } catch(DbxException e) { throw new DropboxExceptionMappingService().map("Failure to write attributes of {0}", e, file); } }
DropboxLockFeature implements Lock<String> { @Override public void unlock(final Path file, final String token) throws BackgroundException { try { for(LockFileResultEntry result : new DbxUserFilesRequests(session.getClient(file)).unlockFileBatch(Collections.singletonList( new UnlockFileArg(containerService.getKey(file)))).getEntries()) { if(result.isFailure()) { throw failure(result); } if(log.isDebugEnabled()) { log.debug(String.format("Unlocked file %s with result %s", file, result.getSuccessValue())); } } } catch(DbxException e) { throw new DropboxExceptionMappingService().map("Failure to write attributes of {0}", e, file); } } }
DropboxLockFeature implements Lock<String> { @Override public void unlock(final Path file, final String token) throws BackgroundException { try { for(LockFileResultEntry result : new DbxUserFilesRequests(session.getClient(file)).unlockFileBatch(Collections.singletonList( new UnlockFileArg(containerService.getKey(file)))).getEntries()) { if(result.isFailure()) { throw failure(result); } if(log.isDebugEnabled()) { log.debug(String.format("Unlocked file %s with result %s", file, result.getSuccessValue())); } } } catch(DbxException e) { throw new DropboxExceptionMappingService().map("Failure to write attributes of {0}", e, file); } } DropboxLockFeature(final DropboxSession session); }
DropboxLockFeature implements Lock<String> { @Override public void unlock(final Path file, final String token) throws BackgroundException { try { for(LockFileResultEntry result : new DbxUserFilesRequests(session.getClient(file)).unlockFileBatch(Collections.singletonList( new UnlockFileArg(containerService.getKey(file)))).getEntries()) { if(result.isFailure()) { throw failure(result); } if(log.isDebugEnabled()) { log.debug(String.format("Unlocked file %s with result %s", file, result.getSuccessValue())); } } } catch(DbxException e) { throw new DropboxExceptionMappingService().map("Failure to write attributes of {0}", e, file); } } DropboxLockFeature(final DropboxSession session); @Override String lock(final Path file); @Override void unlock(final Path file, final String token); }
DropboxLockFeature implements Lock<String> { @Override public void unlock(final Path file, final String token) throws BackgroundException { try { for(LockFileResultEntry result : new DbxUserFilesRequests(session.getClient(file)).unlockFileBatch(Collections.singletonList( new UnlockFileArg(containerService.getKey(file)))).getEntries()) { if(result.isFailure()) { throw failure(result); } if(log.isDebugEnabled()) { log.debug(String.format("Unlocked file %s with result %s", file, result.getSuccessValue())); } } } catch(DbxException e) { throw new DropboxExceptionMappingService().map("Failure to write attributes of {0}", e, file); } } DropboxLockFeature(final DropboxSession session); @Override String lock(final Path file); @Override void unlock(final Path file, final String token);  }