@Test public void shouldFailFromStrategyRetrievalException() throws ContentAddressableStorageServerException, ProcessingException, InvalidParseOperationException, StorageServerClientException { HandlerIO handler = mock(HandlerIO.class); WorkerParameters workerParameters = mock(WorkerParameters.class); when(storageClient.getStorageStrategies()).thenThrow(new StorageServerClientException("Exception")); ItemStatus itemStatus = prepareStorageStrategiesPlugin.execute(workerParameters, handler); StatusCode globalStatus = itemStatus.getGlobalStatus(); assertThat(globalStatus).isEqualTo(StatusCode.FATAL); }
@Override public ItemStatus execute(WorkerParameters params, HandlerIO handlerIO) throws ProcessingException { try { storeStrategies(handlerIO); return buildItemStatus(PLUGIN_NAME, StatusCode.OK, createObjectNode()); } catch (ProcessingException e) { LOGGER.error(String.format("Prepare Storage Strategies failed with status [%s]", FATAL), e); ObjectNode error = createObjectNode().put("error", e.getMessage()); return buildItemStatus(PLUGIN_NAME, FATAL, error); } }
PrepareStorageStrategiesPlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters params, HandlerIO handlerIO) throws ProcessingException { try { storeStrategies(handlerIO); return buildItemStatus(PLUGIN_NAME, StatusCode.OK, createObjectNode()); } catch (ProcessingException e) { LOGGER.error(String.format("Prepare Storage Strategies failed with status [%s]", FATAL), e); ObjectNode error = createObjectNode().put("error", e.getMessage()); return buildItemStatus(PLUGIN_NAME, FATAL, error); } } }
PrepareStorageStrategiesPlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters params, HandlerIO handlerIO) throws ProcessingException { try { storeStrategies(handlerIO); return buildItemStatus(PLUGIN_NAME, StatusCode.OK, createObjectNode()); } catch (ProcessingException e) { LOGGER.error(String.format("Prepare Storage Strategies failed with status [%s]", FATAL), e); ObjectNode error = createObjectNode().put("error", e.getMessage()); return buildItemStatus(PLUGIN_NAME, FATAL, error); } } PrepareStorageStrategiesPlugin(); @VisibleForTesting  PrepareStorageStrategiesPlugin(StorageClientFactory storageClientFactory); }
PrepareStorageStrategiesPlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters params, HandlerIO handlerIO) throws ProcessingException { try { storeStrategies(handlerIO); return buildItemStatus(PLUGIN_NAME, StatusCode.OK, createObjectNode()); } catch (ProcessingException e) { LOGGER.error(String.format("Prepare Storage Strategies failed with status [%s]", FATAL), e); ObjectNode error = createObjectNode().put("error", e.getMessage()); return buildItemStatus(PLUGIN_NAME, FATAL, error); } } PrepareStorageStrategiesPlugin(); @VisibleForTesting  PrepareStorageStrategiesPlugin(StorageClientFactory storageClientFactory); @Override ItemStatus execute(WorkerParameters params, HandlerIO handlerIO); }
PrepareStorageStrategiesPlugin extends ActionHandler { @Override public ItemStatus execute(WorkerParameters params, HandlerIO handlerIO) throws ProcessingException { try { storeStrategies(handlerIO); return buildItemStatus(PLUGIN_NAME, StatusCode.OK, createObjectNode()); } catch (ProcessingException e) { LOGGER.error(String.format("Prepare Storage Strategies failed with status [%s]", FATAL), e); ObjectNode error = createObjectNode().put("error", e.getMessage()); return buildItemStatus(PLUGIN_NAME, FATAL, error); } } PrepareStorageStrategiesPlugin(); @VisibleForTesting  PrepareStorageStrategiesPlugin(StorageClientFactory storageClientFactory); @Override ItemStatus execute(WorkerParameters params, HandlerIO handlerIO);  }