/** * Deletes the alerting definition. * * @param alertingDefinition * AlertingDefinition to delete. * @throws IOException * If {@link IOException} occurs during delete. */ public void deleteAlertingDefinition(AlertingDefinition alertingDefinition) throws IOException { String id = alertingDefinition.getId(); AlertingDefinition local = existingAlertingDefinitions.remove(id); if (local != null) { Files.deleteIfExists(pathResolver.getAlertingDefinitionFilePath(local)); eventPublisher.publishEvent(new AbstractAlertingDefinitionEvent.AlertingDefinitionDeletedEvent(this, local)); } }
/** * Save the given {@link AlertingDefinition}. * * @param alertingDefinition * the {@link AlertingDefinition} to save * @throws IOException * if {@link IOException} occurs * @throws JAXBException * if {@link JAXBException} occurs. If saving fails */ private void saveAlertingDefinition(AlertingDefinition alertingDefinition) throws JAXBException, IOException { transformator.marshall(pathResolver.getAlertingDefinitionFilePath(alertingDefinition), alertingDefinition, getRelativeToSchemaPath(pathResolver.getDefaultCiPath()).toString(), ISchemaVersionAware.ConfigurationInterface.SCHEMA_VERSION); }
@Override public Path answer(InvocationOnMock invocation) throws Throwable { return Paths.get(TEST_FOLDER).resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getAlertingDefinitionsPath())) .resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getAlertingDefinitionFilePath((AlertingDefinition) invocation.getArguments()[0]))); } }).when(pathResolver).getAlertingDefinitionFilePath(Matchers.<AlertingDefinition> any());
.resolve(EXT_RESOURCES_PATH.relativize(resolverHelper.getAlertingDefinitionFilePath((AlertingDefinition) invocation.getArguments()[0]))); }).when(pathResolver).getAlertingDefinitionFilePath(Matchers.<AlertingDefinition> any());
Files.deleteIfExists(pathResolver.getAlertingDefinitionFilePath(local));