@Test public void parseErrorExtractCleanUpDelay() { when(listenerEvent.getTableParameters()).thenReturn(Map.of(EXTRACTOR_KEY, "1")); Duration cleanupDelay = cleanupDelayExtractor.extractCleanupDelay(listenerEvent); assertThat(cleanupDelay).isEqualTo(Duration.parse(EXTRACTOR_DEFAULT_VALUE)); }
public Duration extractCleanupDelay(ListenerEvent listenerEvent) { String tableCleanupDelay = listenerEvent.getTableParameters().get(propertyKey); try { return Duration.parse(tableCleanupDelay); } catch (DateTimeParseException | NullPointerException e) { log.error( "Overridden delay value '{}' for key '{}' cannot be parsed to a Duration for table '{}.{}'. Using default setting.", tableCleanupDelay, propertyKey, listenerEvent.getDbName(), listenerEvent.getTableName()); return defaultValue; } }
CleanupDelayExtractor { public Duration extractCleanupDelay(ListenerEvent listenerEvent) { String tableCleanupDelay = listenerEvent.getTableParameters().get(propertyKey); try { return Duration.parse(tableCleanupDelay); } catch (DateTimeParseException | NullPointerException e) { log.error( "Overridden delay value '{}' for key '{}' cannot be parsed to a Duration for table '{}.{}'. Using default setting.", tableCleanupDelay, propertyKey, listenerEvent.getDbName(), listenerEvent.getTableName()); return defaultValue; } } }
CleanupDelayExtractor { public Duration extractCleanupDelay(ListenerEvent listenerEvent) { String tableCleanupDelay = listenerEvent.getTableParameters().get(propertyKey); try { return Duration.parse(tableCleanupDelay); } catch (DateTimeParseException | NullPointerException e) { log.error( "Overridden delay value '{}' for key '{}' cannot be parsed to a Duration for table '{}.{}'. Using default setting.", tableCleanupDelay, propertyKey, listenerEvent.getDbName(), listenerEvent.getTableName()); return defaultValue; } } CleanupDelayExtractor(String propertyKey, String defaultValue); }
CleanupDelayExtractor { public Duration extractCleanupDelay(ListenerEvent listenerEvent) { String tableCleanupDelay = listenerEvent.getTableParameters().get(propertyKey); try { return Duration.parse(tableCleanupDelay); } catch (DateTimeParseException | NullPointerException e) { log.error( "Overridden delay value '{}' for key '{}' cannot be parsed to a Duration for table '{}.{}'. Using default setting.", tableCleanupDelay, propertyKey, listenerEvent.getDbName(), listenerEvent.getTableName()); return defaultValue; } } CleanupDelayExtractor(String propertyKey, String defaultValue); Duration extractCleanupDelay(ListenerEvent listenerEvent); }
CleanupDelayExtractor { public Duration extractCleanupDelay(ListenerEvent listenerEvent) { String tableCleanupDelay = listenerEvent.getTableParameters().get(propertyKey); try { return Duration.parse(tableCleanupDelay); } catch (DateTimeParseException | NullPointerException e) { log.error( "Overridden delay value '{}' for key '{}' cannot be parsed to a Duration for table '{}.{}'. Using default setting.", tableCleanupDelay, propertyKey, listenerEvent.getDbName(), listenerEvent.getTableName()); return defaultValue; } } CleanupDelayExtractor(String propertyKey, String defaultValue); Duration extractCleanupDelay(ListenerEvent listenerEvent);  }