@Test public void testUpload() { final URI fileUri = URI.create("some.uri"); final File file = mock(File.class); when(file.toURI()).thenReturn(fileUri); final URI remoteUri = URI.create("remoteUri"); mockStatic(FileAssistant.class); when(FileAssistant.createRemotePath(file)).thenReturn(remoteUri); final FileRequest fileRequest = mock(FileRequest.class); mockStatic(FileRequestFactory.class); when(FileRequestFactory.create(fileUri, remoteUri)).thenReturn(fileRequest); cclUploader.queueUpload(file); final Map<File, URI> uploadMap = cclUploader.upload(); assertThat(uploadMap).isNotNull(); assertThat(uploadMap).includes(entry(file, remoteUri)); verify(uploader).ignoreChmodErrors(true); verify(uploader).upload(Collections.singleton(fileRequest)); verify(jetmMock).collect(); }
@Override public Map<File, URI> upload() { final EtmPoint point = PointFactory.getPoint(getClass(), "upload"); try { if (requestedFiles.isEmpty()) return Collections.<File, URI> emptyMap(); final Map<File, URI> uploads = new HashMap<File, URI>(requestedFiles.size()); final Set<FileRequest> uploadRequests = new HashSet<FileRequest>(requestedFiles.size()); for (final File requestedFile : requestedFiles) { final URI remotePath = FileAssistant.createRemotePath(requestedFile); uploadRequests.add(FileRequestFactory.create(requestedFile.toURI(), remotePath)); uploads.put(requestedFile, remotePath); } final Uploader uploader = SftpUploader.createUploader(AuthHelper.fromCurrentSubject()); uploader.ignoreChmodErrors(true); uploader.upload(uploadRequests); return uploads; } finally { point.collect(); } }
CclResourceUploaderImpl extends CclResourceUploader { @Override public Map<File, URI> upload() { final EtmPoint point = PointFactory.getPoint(getClass(), "upload"); try { if (requestedFiles.isEmpty()) return Collections.<File, URI> emptyMap(); final Map<File, URI> uploads = new HashMap<File, URI>(requestedFiles.size()); final Set<FileRequest> uploadRequests = new HashSet<FileRequest>(requestedFiles.size()); for (final File requestedFile : requestedFiles) { final URI remotePath = FileAssistant.createRemotePath(requestedFile); uploadRequests.add(FileRequestFactory.create(requestedFile.toURI(), remotePath)); uploads.put(requestedFile, remotePath); } final Uploader uploader = SftpUploader.createUploader(AuthHelper.fromCurrentSubject()); uploader.ignoreChmodErrors(true); uploader.upload(uploadRequests); return uploads; } finally { point.collect(); } } }
CclResourceUploaderImpl extends CclResourceUploader { @Override public Map<File, URI> upload() { final EtmPoint point = PointFactory.getPoint(getClass(), "upload"); try { if (requestedFiles.isEmpty()) return Collections.<File, URI> emptyMap(); final Map<File, URI> uploads = new HashMap<File, URI>(requestedFiles.size()); final Set<FileRequest> uploadRequests = new HashSet<FileRequest>(requestedFiles.size()); for (final File requestedFile : requestedFiles) { final URI remotePath = FileAssistant.createRemotePath(requestedFile); uploadRequests.add(FileRequestFactory.create(requestedFile.toURI(), remotePath)); uploads.put(requestedFile, remotePath); } final Uploader uploader = SftpUploader.createUploader(AuthHelper.fromCurrentSubject()); uploader.ignoreChmodErrors(true); uploader.upload(uploadRequests); return uploads; } finally { point.collect(); } }  }
CclResourceUploaderImpl extends CclResourceUploader { @Override public Map<File, URI> upload() { final EtmPoint point = PointFactory.getPoint(getClass(), "upload"); try { if (requestedFiles.isEmpty()) return Collections.<File, URI> emptyMap(); final Map<File, URI> uploads = new HashMap<File, URI>(requestedFiles.size()); final Set<FileRequest> uploadRequests = new HashSet<FileRequest>(requestedFiles.size()); for (final File requestedFile : requestedFiles) { final URI remotePath = FileAssistant.createRemotePath(requestedFile); uploadRequests.add(FileRequestFactory.create(requestedFile.toURI(), remotePath)); uploads.put(requestedFile, remotePath); } final Uploader uploader = SftpUploader.createUploader(AuthHelper.fromCurrentSubject()); uploader.ignoreChmodErrors(true); uploader.upload(uploadRequests); return uploads; } finally { point.collect(); } }  @Override void queueUpload(final File file); @Override Map<File, URI> upload(); }
CclResourceUploaderImpl extends CclResourceUploader { @Override public Map<File, URI> upload() { final EtmPoint point = PointFactory.getPoint(getClass(), "upload"); try { if (requestedFiles.isEmpty()) return Collections.<File, URI> emptyMap(); final Map<File, URI> uploads = new HashMap<File, URI>(requestedFiles.size()); final Set<FileRequest> uploadRequests = new HashSet<FileRequest>(requestedFiles.size()); for (final File requestedFile : requestedFiles) { final URI remotePath = FileAssistant.createRemotePath(requestedFile); uploadRequests.add(FileRequestFactory.create(requestedFile.toURI(), remotePath)); uploads.put(requestedFile, remotePath); } final Uploader uploader = SftpUploader.createUploader(AuthHelper.fromCurrentSubject()); uploader.ignoreChmodErrors(true); uploader.upload(uploadRequests); return uploads; } finally { point.collect(); } }  @Override void queueUpload(final File file); @Override Map<File, URI> upload();  }