@Test @SuppressWarnings("unchecked") public void testReceiveWithRuntimeException() throws Exception { final Identifier<Jvm> jvmId = new Identifier<>("1"); Jvm jvm = new Jvm(jvmId, "jvm-name"); final Map<Object, Object> serverInfoMap = new HashMap(); serverInfoMap.put(JvmStateReceiverAdapter.NAME_KEY, jvm.getJvmName()); serverInfoMap.put(JvmStateReceiverAdapter.STATE_KEY, LifecycleState.STOPPING); msg = new Message(); msg.setObject(serverInfoMap); when (mockJvmPersistenceService.findJvmByExactName(jvm.getJvmName())).thenThrow(new NoResultException("")); jvmStateReceiverAdapter.receive(msg); verify(mockJvmStateService, never()).updateState(eq(jvm), eq(JvmState.JVM_STOPPING), eq(StringUtils.EMPTY)); }
@Override public void receive(final Message jGroupMsg) { final Map serverInfoMap = (Map) jGroupMsg.getObject(); final Jvm jvm = getJvm(serverInfoMap); final JvmState jvmState = getJvmState(serverInfoMap); if (jvm != null && !JvmState.JVM_STOPPED.equals(jvmState)) { jvmStateService.updateState(jvm, jvmState, StringUtils.EMPTY); } else if (jvm == null) { LOGGER.error("Cannot update the state since no JVM was found with the following details: {}", serverInfoMap); } }
JvmStateReceiverAdapter extends ReceiverAdapter { @Override public void receive(final Message jGroupMsg) { final Map serverInfoMap = (Map) jGroupMsg.getObject(); final Jvm jvm = getJvm(serverInfoMap); final JvmState jvmState = getJvmState(serverInfoMap); if (jvm != null && !JvmState.JVM_STOPPED.equals(jvmState)) { jvmStateService.updateState(jvm, jvmState, StringUtils.EMPTY); } else if (jvm == null) { LOGGER.error("Cannot update the state since no JVM was found with the following details: {}", serverInfoMap); } } }
JvmStateReceiverAdapter extends ReceiverAdapter { @Override public void receive(final Message jGroupMsg) { final Map serverInfoMap = (Map) jGroupMsg.getObject(); final Jvm jvm = getJvm(serverInfoMap); final JvmState jvmState = getJvmState(serverInfoMap); if (jvm != null && !JvmState.JVM_STOPPED.equals(jvmState)) { jvmStateService.updateState(jvm, jvmState, StringUtils.EMPTY); } else if (jvm == null) { LOGGER.error("Cannot update the state since no JVM was found with the following details: {}", serverInfoMap); } } JvmStateReceiverAdapter(final JvmStateService jvmStateService, final JvmPersistenceService jvmPersistenceService); }
JvmStateReceiverAdapter extends ReceiverAdapter { @Override public void receive(final Message jGroupMsg) { final Map serverInfoMap = (Map) jGroupMsg.getObject(); final Jvm jvm = getJvm(serverInfoMap); final JvmState jvmState = getJvmState(serverInfoMap); if (jvm != null && !JvmState.JVM_STOPPED.equals(jvmState)) { jvmStateService.updateState(jvm, jvmState, StringUtils.EMPTY); } else if (jvm == null) { LOGGER.error("Cannot update the state since no JVM was found with the following details: {}", serverInfoMap); } } JvmStateReceiverAdapter(final JvmStateService jvmStateService, final JvmPersistenceService jvmPersistenceService); @Override void receive(final Message jGroupMsg); @Override void viewAccepted(View view); }
JvmStateReceiverAdapter extends ReceiverAdapter { @Override public void receive(final Message jGroupMsg) { final Map serverInfoMap = (Map) jGroupMsg.getObject(); final Jvm jvm = getJvm(serverInfoMap); final JvmState jvmState = getJvmState(serverInfoMap); if (jvm != null && !JvmState.JVM_STOPPED.equals(jvmState)) { jvmStateService.updateState(jvm, jvmState, StringUtils.EMPTY); } else if (jvm == null) { LOGGER.error("Cannot update the state since no JVM was found with the following details: {}", serverInfoMap); } } JvmStateReceiverAdapter(final JvmStateService jvmStateService, final JvmPersistenceService jvmPersistenceService); @Override void receive(final Message jGroupMsg); @Override void viewAccepted(View view);  }