@Test public void testValidateWhenOnlyOneStackIsAliveAndTTLNotSet() { StackTtlViewImpl stack = new StackTtlViewImpl(); stack.setId(STACK_ID); when(stackService.getAllAlive()).thenReturn(Collections.singletonList(stack)); underTest.validate(); verify(flowManager, times(0)).triggerTermination(stack.getId(), false); }
@Scheduled(fixedRate = 60 * 1000, initialDelay = 60 * 1000) public void validate() { stackService.getAllAlive().forEach(stack -> stackService.getTtlValueForStack(stack.getId()).ifPresent(ttl -> { if (isInDeletableStatus(stack) && isExceeded(stack.getCreationFinished(), ttl.toMillis())) { LOGGER.info("Stack is exceeded at {}ms because is in deletable status and ttl is expired, ttl: {}", stack.getCreationFinished() + ttl.toMillis(), ttl.toMillis()); terminateStack(stack); } })); }
ScheduledLifetimeChecker { @Scheduled(fixedRate = 60 * 1000, initialDelay = 60 * 1000) public void validate() { stackService.getAllAlive().forEach(stack -> stackService.getTtlValueForStack(stack.getId()).ifPresent(ttl -> { if (isInDeletableStatus(stack) && isExceeded(stack.getCreationFinished(), ttl.toMillis())) { LOGGER.info("Stack is exceeded at {}ms because is in deletable status and ttl is expired, ttl: {}", stack.getCreationFinished() + ttl.toMillis(), ttl.toMillis()); terminateStack(stack); } })); } }
ScheduledLifetimeChecker { @Scheduled(fixedRate = 60 * 1000, initialDelay = 60 * 1000) public void validate() { stackService.getAllAlive().forEach(stack -> stackService.getTtlValueForStack(stack.getId()).ifPresent(ttl -> { if (isInDeletableStatus(stack) && isExceeded(stack.getCreationFinished(), ttl.toMillis())) { LOGGER.info("Stack is exceeded at {}ms because is in deletable status and ttl is expired, ttl: {}", stack.getCreationFinished() + ttl.toMillis(), ttl.toMillis()); terminateStack(stack); } })); }  }
ScheduledLifetimeChecker { @Scheduled(fixedRate = 60 * 1000, initialDelay = 60 * 1000) public void validate() { stackService.getAllAlive().forEach(stack -> stackService.getTtlValueForStack(stack.getId()).ifPresent(ttl -> { if (isInDeletableStatus(stack) && isExceeded(stack.getCreationFinished(), ttl.toMillis())) { LOGGER.info("Stack is exceeded at {}ms because is in deletable status and ttl is expired, ttl: {}", stack.getCreationFinished() + ttl.toMillis(), ttl.toMillis()); terminateStack(stack); } })); }  @Scheduled(fixedRate = 60 * 1000, initialDelay = 60 * 1000) void validate(); }
ScheduledLifetimeChecker { @Scheduled(fixedRate = 60 * 1000, initialDelay = 60 * 1000) public void validate() { stackService.getAllAlive().forEach(stack -> stackService.getTtlValueForStack(stack.getId()).ifPresent(ttl -> { if (isInDeletableStatus(stack) && isExceeded(stack.getCreationFinished(), ttl.toMillis())) { LOGGER.info("Stack is exceeded at {}ms because is in deletable status and ttl is expired, ttl: {}", stack.getCreationFinished() + ttl.toMillis(), ttl.toMillis()); terminateStack(stack); } })); }  @Scheduled(fixedRate = 60 * 1000, initialDelay = 60 * 1000) void validate();  }