@Test(expected = ProcessingStorageWorkspaceException.class) public void persistProcessWorkflowTestException() throws Exception { doThrow(new ContentAddressableStorageServerException("fail")) .when(workspaceClient) .putObject(anyString(), anyString(), any(Object.class)); ProcessWorkflow processWorkflow = new ProcessWorkflow(); processDataManagement.persistProcessWorkflow("folder", processWorkflow); }
@Override public void persistProcessWorkflow(String folderName, ProcessWorkflow processWorkflow) throws ProcessingStorageWorkspaceException, InvalidParseOperationException { LOGGER.debug("[PERSIST] workflow process with execution status : <{}>", processWorkflow.getState()); try (WorkspaceClient client = workspaceClientFactory.getClient()) { client.putObject(PROCESS_CONTAINER, getPathToObjectFromFolder(folderName, processWorkflow.getOperationId()), JsonHandler.writeAsString(processWorkflow).getBytes()); } catch (ContentAddressableStorageServerException exc) { throw new ProcessingStorageWorkspaceException(exc); } }
WorkspaceProcessDataManagement implements ProcessDataManagement { @Override public void persistProcessWorkflow(String folderName, ProcessWorkflow processWorkflow) throws ProcessingStorageWorkspaceException, InvalidParseOperationException { LOGGER.debug("[PERSIST] workflow process with execution status : <{}>", processWorkflow.getState()); try (WorkspaceClient client = workspaceClientFactory.getClient()) { client.putObject(PROCESS_CONTAINER, getPathToObjectFromFolder(folderName, processWorkflow.getOperationId()), JsonHandler.writeAsString(processWorkflow).getBytes()); } catch (ContentAddressableStorageServerException exc) { throw new ProcessingStorageWorkspaceException(exc); } } }
WorkspaceProcessDataManagement implements ProcessDataManagement { @Override public void persistProcessWorkflow(String folderName, ProcessWorkflow processWorkflow) throws ProcessingStorageWorkspaceException, InvalidParseOperationException { LOGGER.debug("[PERSIST] workflow process with execution status : <{}>", processWorkflow.getState()); try (WorkspaceClient client = workspaceClientFactory.getClient()) { client.putObject(PROCESS_CONTAINER, getPathToObjectFromFolder(folderName, processWorkflow.getOperationId()), JsonHandler.writeAsString(processWorkflow).getBytes()); } catch (ContentAddressableStorageServerException exc) { throw new ProcessingStorageWorkspaceException(exc); } } private  WorkspaceProcessDataManagement(); @VisibleForTesting  WorkspaceProcessDataManagement(WorkspaceClientFactory workspaceClientFactory); }
WorkspaceProcessDataManagement implements ProcessDataManagement { @Override public void persistProcessWorkflow(String folderName, ProcessWorkflow processWorkflow) throws ProcessingStorageWorkspaceException, InvalidParseOperationException { LOGGER.debug("[PERSIST] workflow process with execution status : <{}>", processWorkflow.getState()); try (WorkspaceClient client = workspaceClientFactory.getClient()) { client.putObject(PROCESS_CONTAINER, getPathToObjectFromFolder(folderName, processWorkflow.getOperationId()), JsonHandler.writeAsString(processWorkflow).getBytes()); } catch (ContentAddressableStorageServerException exc) { throw new ProcessingStorageWorkspaceException(exc); } } 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 void persistProcessWorkflow(String folderName, ProcessWorkflow processWorkflow) throws ProcessingStorageWorkspaceException, InvalidParseOperationException { LOGGER.debug("[PERSIST] workflow process with execution status : <{}>", processWorkflow.getState()); try (WorkspaceClient client = workspaceClientFactory.getClient()) { client.putObject(PROCESS_CONTAINER, getPathToObjectFromFolder(folderName, processWorkflow.getOperationId()), JsonHandler.writeAsString(processWorkflow).getBytes()); } catch (ContentAddressableStorageServerException exc) { throw new ProcessingStorageWorkspaceException(exc); } } 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);  }