@Test public void createFolderTestAlreadyExists() throws Exception { doReturn(true).when(workspaceClient).isExistingFolder(anyString(), anyString()); assertFalse(processDataManagement.createFolder("folder")); }
@Override public boolean createFolder(String folderName) throws ProcessingStorageWorkspaceException { if (isFolderExist(folderName)) { return false; } try (WorkspaceClient client = workspaceClientFactory.getClient()) { client.createFolder(PROCESS_CONTAINER, folderName); return true; } catch (ContentAddressableStorageServerException exc) { throw new ProcessingStorageWorkspaceException(exc); } catch (ContentAddressableStorageAlreadyExistException e) { LOGGER.warn(e); return false; } }
WorkspaceProcessDataManagement implements ProcessDataManagement { @Override public boolean createFolder(String folderName) throws ProcessingStorageWorkspaceException { if (isFolderExist(folderName)) { return false; } try (WorkspaceClient client = workspaceClientFactory.getClient()) { client.createFolder(PROCESS_CONTAINER, folderName); return true; } catch (ContentAddressableStorageServerException exc) { throw new ProcessingStorageWorkspaceException(exc); } catch (ContentAddressableStorageAlreadyExistException e) { LOGGER.warn(e); return false; } } }
WorkspaceProcessDataManagement implements ProcessDataManagement { @Override public boolean createFolder(String folderName) throws ProcessingStorageWorkspaceException { if (isFolderExist(folderName)) { return false; } try (WorkspaceClient client = workspaceClientFactory.getClient()) { client.createFolder(PROCESS_CONTAINER, folderName); return true; } catch (ContentAddressableStorageServerException exc) { throw new ProcessingStorageWorkspaceException(exc); } catch (ContentAddressableStorageAlreadyExistException e) { LOGGER.warn(e); return false; } } private  WorkspaceProcessDataManagement(); @VisibleForTesting  WorkspaceProcessDataManagement(WorkspaceClientFactory workspaceClientFactory); }
WorkspaceProcessDataManagement implements ProcessDataManagement { @Override public boolean createFolder(String folderName) throws ProcessingStorageWorkspaceException { if (isFolderExist(folderName)) { return false; } try (WorkspaceClient client = workspaceClientFactory.getClient()) { client.createFolder(PROCESS_CONTAINER, folderName); return true; } catch (ContentAddressableStorageServerException exc) { throw new ProcessingStorageWorkspaceException(exc); } catch (ContentAddressableStorageAlreadyExistException e) { LOGGER.warn(e); return false; } } private  WorkspaceProcessDataManagement(); @VisibleForTesting  WorkspaceProcessDataManagement(WorkspaceClientFactory workspaceClientFactory); static ProcessDataManagement getInstance(); @Override boolean createProcessContainer(); @Override boolean isProcessContainerExist(); @Override boolean createFolder(String folderName); @Override boolean isFolderExist(String folderName); @Override boolean removeFolder(String folderName); @Override void persistProcessWorkflow(String folderName, ProcessWorkflow processWorkflow); @Override void persistDistributorIndex(String folderName, String fileName, DistributorIndex distributorIndex); @Override Optional<DistributorIndex> getDistributorIndex(String folderName, String fileName); @Override ProcessWorkflow getProcessWorkflow(String folderName, String asyncId); @Override void removeProcessWorkflow(String folderName, String asyncId); @Override Map<String, ProcessWorkflow> getProcessWorkflowFor(Integer tenantId, String folderName); }
WorkspaceProcessDataManagement implements ProcessDataManagement { @Override public boolean createFolder(String folderName) throws ProcessingStorageWorkspaceException { if (isFolderExist(folderName)) { return false; } try (WorkspaceClient client = workspaceClientFactory.getClient()) { client.createFolder(PROCESS_CONTAINER, folderName); return true; } catch (ContentAddressableStorageServerException exc) { throw new ProcessingStorageWorkspaceException(exc); } catch (ContentAddressableStorageAlreadyExistException e) { LOGGER.warn(e); return false; } } private  WorkspaceProcessDataManagement(); @VisibleForTesting  WorkspaceProcessDataManagement(WorkspaceClientFactory workspaceClientFactory); static ProcessDataManagement getInstance(); @Override boolean createProcessContainer(); @Override boolean isProcessContainerExist(); @Override boolean createFolder(String folderName); @Override boolean isFolderExist(String folderName); @Override boolean removeFolder(String folderName); @Override void persistProcessWorkflow(String folderName, ProcessWorkflow processWorkflow); @Override void persistDistributorIndex(String folderName, String fileName, DistributorIndex distributorIndex); @Override Optional<DistributorIndex> getDistributorIndex(String folderName, String fileName); @Override ProcessWorkflow getProcessWorkflow(String folderName, String asyncId); @Override void removeProcessWorkflow(String folderName, String asyncId); @Override Map<String, ProcessWorkflow> getProcessWorkflowFor(Integer tenantId, String folderName);  }