@WithMockUser @Test void testDownloadResources() { ResourceDownloadJobExecution downloadJobExecution = mock(ResourceDownloadJobExecution.class); when(downloadJobExecutionFactory.create()).thenReturn(downloadJobExecution); List<ResourceIdentifier> resources = asList( ResourceIdentifier.builder().setType(ResourceType.PACKAGE).setId("p0").build(), ResourceIdentifier.builder().setType(ResourceType.ENTITY_TYPE).setId("e0").build()); assertEquals(downloadJobExecution, navigatorServiceImpl.downloadResources(resources)); verify(downloadJobExecution).setResources(resources); verify(jobExecutor).submit(downloadJobExecution); }
@Override public JobExecution downloadResources(List<ResourceIdentifier> resources) { if (resources.isEmpty()) { throw new IllegalArgumentException(MESSAGE_EMPTY_RESOURCES); } ResourceDownloadJobExecution jobExecution = downloadJobExecutionFactory.create(); jobExecution.setResources(resources); jobExecutor.submit(jobExecution); return jobExecution; }
NavigatorServiceImpl implements NavigatorService { @Override public JobExecution downloadResources(List<ResourceIdentifier> resources) { if (resources.isEmpty()) { throw new IllegalArgumentException(MESSAGE_EMPTY_RESOURCES); } ResourceDownloadJobExecution jobExecution = downloadJobExecutionFactory.create(); jobExecution.setResources(resources); jobExecutor.submit(jobExecution); return jobExecution; } }
NavigatorServiceImpl implements NavigatorService { @Override public JobExecution downloadResources(List<ResourceIdentifier> resources) { if (resources.isEmpty()) { throw new IllegalArgumentException(MESSAGE_EMPTY_RESOURCES); } ResourceDownloadJobExecution jobExecution = downloadJobExecutionFactory.create(); jobExecution.setResources(resources); jobExecutor.submit(jobExecution); return jobExecution; } NavigatorServiceImpl(
      DataService dataService,
      JobExecutor jobExecutor,
      ResourceDownloadJobExecutionFactory downloadJobExecutionFactory,
      ResourceCopyJobExecutionFactory copyJobExecutionFactory,
      ResourceDeleteJobExecutionFactory resourceDeleteJobExecutionFactory); }
NavigatorServiceImpl implements NavigatorService { @Override public JobExecution downloadResources(List<ResourceIdentifier> resources) { if (resources.isEmpty()) { throw new IllegalArgumentException(MESSAGE_EMPTY_RESOURCES); } ResourceDownloadJobExecution jobExecution = downloadJobExecutionFactory.create(); jobExecution.setResources(resources); jobExecutor.submit(jobExecution); return jobExecution; } NavigatorServiceImpl(
      DataService dataService,
      JobExecutor jobExecutor,
      ResourceDownloadJobExecutionFactory downloadJobExecutionFactory,
      ResourceCopyJobExecutionFactory copyJobExecutionFactory,
      ResourceDeleteJobExecutionFactory resourceDeleteJobExecutionFactory); @Transactional(readOnly = true) @Override @Nullable @CheckForNull Folder getFolder(@Nullable @CheckForNull String folderId); @Transactional(readOnly = true) @Override List<Resource> getResources(@Nullable @CheckForNull String folderId); @Transactional(readOnly = true) @Override List<Resource> findResources(String query); @Transactional @Override void moveResources(
      List<ResourceIdentifier> resources, @Nullable @CheckForNull String targetFolderId); @Override JobExecution copyResources(
      List<ResourceIdentifier> resources, @Nullable @CheckForNull String targetFolderId); @Override JobExecution downloadResources(List<ResourceIdentifier> resources); @Transactional @Override JobExecution deleteResources(List<ResourceIdentifier> resources); @Transactional @Override void updateResource(Resource resource); }
NavigatorServiceImpl implements NavigatorService { @Override public JobExecution downloadResources(List<ResourceIdentifier> resources) { if (resources.isEmpty()) { throw new IllegalArgumentException(MESSAGE_EMPTY_RESOURCES); } ResourceDownloadJobExecution jobExecution = downloadJobExecutionFactory.create(); jobExecution.setResources(resources); jobExecutor.submit(jobExecution); return jobExecution; } NavigatorServiceImpl(
      DataService dataService,
      JobExecutor jobExecutor,
      ResourceDownloadJobExecutionFactory downloadJobExecutionFactory,
      ResourceCopyJobExecutionFactory copyJobExecutionFactory,
      ResourceDeleteJobExecutionFactory resourceDeleteJobExecutionFactory); @Transactional(readOnly = true) @Override @Nullable @CheckForNull Folder getFolder(@Nullable @CheckForNull String folderId); @Transactional(readOnly = true) @Override List<Resource> getResources(@Nullable @CheckForNull String folderId); @Transactional(readOnly = true) @Override List<Resource> findResources(String query); @Transactional @Override void moveResources(
      List<ResourceIdentifier> resources, @Nullable @CheckForNull String targetFolderId); @Override JobExecution copyResources(
      List<ResourceIdentifier> resources, @Nullable @CheckForNull String targetFolderId); @Override JobExecution downloadResources(List<ResourceIdentifier> resources); @Transactional @Override JobExecution deleteResources(List<ResourceIdentifier> resources); @Transactional @Override void updateResource(Resource resource);  }