@Test public void testUpdateStateOnStateStopped() { final Identifier<Jvm> id = new Identifier<>(1L); final Jvm mockJvm = mock(Jvm.class); final CurrentState<Jvm, JvmState> mockCurrentState = mock(CurrentState.class); when(mockCurrentState.getState()).thenReturn(JvmState.JVM_STOPPED); when(mockCurrentState.getMessage()).thenReturn(StringUtils.EMPTY); when(mockJvm.getId()).thenReturn(id); when(mockInMemoryStateManagerService.get(eq(id))).thenReturn(mockCurrentState); when(mockInMemoryStateManagerService.containsKey(eq(id))).thenReturn(true); jvmStateService.updateState(mockJvm, JvmState.JVM_STOPPED); verify(mockJvmPersistenceService, never()).updateState(eq(id), eq(JvmState.JVM_STOPPED), eq(StringUtils.EMPTY)); }
@Override public void updateState(Jvm jvm, final JvmState state) { updateState(jvm, state, StringUtils.EMPTY); }
JvmStateServiceImpl implements JvmStateService { @Override public void updateState(Jvm jvm, final JvmState state) { updateState(jvm, state, StringUtils.EMPTY); } }
JvmStateServiceImpl implements JvmStateService { @Override public void updateState(Jvm jvm, final JvmState state) { updateState(jvm, state, StringUtils.EMPTY); } @Autowired  JvmStateServiceImpl(final JvmPersistenceService jvmPersistenceService,
                               @Qualifier("jvmInMemoryStateManagerService")
                               final InMemoryStateManagerService<Identifier<Jvm>, CurrentState<Jvm, JvmState>> inMemoryStateManagerService,
                               final JvmStateResolverWorker jvmStateResolverWorker,
                               final MessagingService messagingService,
                               final GroupStateNotificationService groupStateNotificationService,
                               @Value("${jvm.state.update.interval:60000}")
                               final long jvmStateUpdateInterval,
                               final JvmCommandFactory jvmCommandFactory,
                               final SshConfiguration sshConfig,
                               @Value("${jvm.state.key.lock.timeout.millis:600000}")
                               final long lockTimeout,
                               @Value("${jvm.state.key.lock.stripe.count:120}")
                               final int keyLockStripeCount); }
JvmStateServiceImpl implements JvmStateService { @Override public void updateState(Jvm jvm, final JvmState state) { updateState(jvm, state, StringUtils.EMPTY); } @Autowired  JvmStateServiceImpl(final JvmPersistenceService jvmPersistenceService,
                               @Qualifier("jvmInMemoryStateManagerService")
                               final InMemoryStateManagerService<Identifier<Jvm>, CurrentState<Jvm, JvmState>> inMemoryStateManagerService,
                               final JvmStateResolverWorker jvmStateResolverWorker,
                               final MessagingService messagingService,
                               final GroupStateNotificationService groupStateNotificationService,
                               @Value("${jvm.state.update.interval:60000}")
                               final long jvmStateUpdateInterval,
                               final JvmCommandFactory jvmCommandFactory,
                               final SshConfiguration sshConfig,
                               @Value("${jvm.state.key.lock.timeout.millis:600000}")
                               final long lockTimeout,
                               @Value("${jvm.state.key.lock.stripe.count:120}")
                               final int keyLockStripeCount); @Override @Scheduled(fixedDelayString = "${ping.jvm.period.millis}") void verifyAndUpdateJvmStates(); @Override void updateNotInMemOrStaleState(final Jvm jvm, final JvmState state, final String errMsg); @Override RemoteCommandReturnInfo getServiceStatus(final Jvm jvm); @Override void updateState(Jvm jvm, final JvmState state); @Override void updateState(final Jvm jvm, final JvmState state, final String errMsg); }
JvmStateServiceImpl implements JvmStateService { @Override public void updateState(Jvm jvm, final JvmState state) { updateState(jvm, state, StringUtils.EMPTY); } @Autowired  JvmStateServiceImpl(final JvmPersistenceService jvmPersistenceService,
                               @Qualifier("jvmInMemoryStateManagerService")
                               final InMemoryStateManagerService<Identifier<Jvm>, CurrentState<Jvm, JvmState>> inMemoryStateManagerService,
                               final JvmStateResolverWorker jvmStateResolverWorker,
                               final MessagingService messagingService,
                               final GroupStateNotificationService groupStateNotificationService,
                               @Value("${jvm.state.update.interval:60000}")
                               final long jvmStateUpdateInterval,
                               final JvmCommandFactory jvmCommandFactory,
                               final SshConfiguration sshConfig,
                               @Value("${jvm.state.key.lock.timeout.millis:600000}")
                               final long lockTimeout,
                               @Value("${jvm.state.key.lock.stripe.count:120}")
                               final int keyLockStripeCount); @Override @Scheduled(fixedDelayString = "${ping.jvm.period.millis}") void verifyAndUpdateJvmStates(); @Override void updateNotInMemOrStaleState(final Jvm jvm, final JvmState state, final String errMsg); @Override RemoteCommandReturnInfo getServiceStatus(final Jvm jvm); @Override void updateState(Jvm jvm, final JvmState state); @Override void updateState(final Jvm jvm, final JvmState state, final String errMsg);  }