@Test public void testCheckSameState(){ assertTrue(cut.checkSameState(JvmControlOperation.START, JvmState.JVM_STARTED)); assertTrue(cut.checkSameState(JvmControlOperation.START, JvmState.JVM_INITIALIZING)); assertTrue(cut.checkSameState(JvmControlOperation.START, JvmState.JVM_INITIALIZED)); assertTrue(cut.checkSameState(JvmControlOperation.START, JvmState.JVM_START)); assertTrue(cut.checkSameState(JvmControlOperation.START, JvmState.JVM_STARTING)); assertTrue(cut.checkSameState(JvmControlOperation.STOP, JvmState.JVM_STOPPED)); assertTrue(cut.checkSameState(JvmControlOperation.START, JvmState.JVM_INITIALIZING)); assertTrue(cut.checkSameState(JvmControlOperation.START, JvmState.JVM_INITIALIZED)); assertTrue(cut.checkSameState(JvmControlOperation.START, JvmState.JVM_STARTING)); assertTrue(cut.checkSameState(JvmControlOperation.START, JvmState.JVM_STOP)); assertTrue(cut.checkSameState(JvmControlOperation.START, JvmState.JVM_STOPPING)); assertTrue(cut.checkSameState(JvmControlOperation.START, JvmState.JVM_DESTROYING)); assertTrue(cut.checkSameState(JvmControlOperation.STOP, JvmState.JVM_DESTROYED)); assertTrue(cut.checkSameState(JvmControlOperation.STOP, JvmState.JVM_UNEXPECTED_STATE)); assertTrue(cut.checkSameState(JvmControlOperation.STOP, JvmState.JVM_FAILED)); assertTrue(cut.checkSameState(JvmControlOperation.STOP, JvmState.FORCED_STOPPED)); assertTrue(cut.checkSameState(JvmControlOperation.STOP, JvmState.JVM_UNKNOWN)); assertFalse(cut.checkSameState(JvmControlOperation.STOP, JvmState.JVM_STARTED)); assertFalse(cut.checkSameState(JvmControlOperation.START, JvmState.JVM_STOPPED)); assertFalse(cut.checkSameState(JvmControlOperation.STOP, JvmState.JVM_INITIALIZING)); assertFalse(cut.checkSameState(JvmControlOperation.STOP, JvmState.JVM_INITIALIZED)); assertFalse(cut.checkSameState(JvmControlOperation.STOP, JvmState.JVM_STARTING)); assertFalse(cut.checkSameState(JvmControlOperation.STOP, JvmState.JVM_STOP)); assertFalse(cut.checkSameState(JvmControlOperation.STOP, JvmState.JVM_STOPPING)); assertFalse(cut.checkSameState(JvmControlOperation.STOP, JvmState.JVM_DESTROYING)); assertFalse(cut.checkSameState(JvmControlOperation.START, JvmState.JVM_DESTROYED)); assertFalse(cut.checkSameState(JvmControlOperation.START, JvmState.JVM_UNEXPECTED_STATE)); assertFalse(cut.checkSameState(JvmControlOperation.START, JvmState.JVM_FAILED)); assertFalse(cut.checkSameState(JvmControlOperation.START, JvmState.FORCED_STOPPED)); assertFalse(cut.checkSameState(JvmControlOperation.START, JvmState.JVM_UNKNOWN)); }
public boolean checkSameState(final JvmControlOperation jvmControlOperation, final JvmState jvmState) { return jvmControlOperation.START.toString().equals(jvmControlOperation.name()) && jvmState.isStartedState() || jvmControlOperation.STOP.toString().equals(jvmControlOperation.name()) && !jvmState.isStartedState(); }
GroupJvmControlServiceImpl implements GroupJvmControlService { public boolean checkSameState(final JvmControlOperation jvmControlOperation, final JvmState jvmState) { return jvmControlOperation.START.toString().equals(jvmControlOperation.name()) && jvmState.isStartedState() || jvmControlOperation.STOP.toString().equals(jvmControlOperation.name()) && !jvmState.isStartedState(); } }
GroupJvmControlServiceImpl implements GroupJvmControlService { public boolean checkSameState(final JvmControlOperation jvmControlOperation, final JvmState jvmState) { return jvmControlOperation.START.toString().equals(jvmControlOperation.name()) && jvmState.isStartedState() || jvmControlOperation.STOP.toString().equals(jvmControlOperation.name()) && !jvmState.isStartedState(); } GroupJvmControlServiceImpl(final GroupService theGroupService, final JvmControlService theJvmControlService); }
GroupJvmControlServiceImpl implements GroupJvmControlService { public boolean checkSameState(final JvmControlOperation jvmControlOperation, final JvmState jvmState) { return jvmControlOperation.START.toString().equals(jvmControlOperation.name()) && jvmState.isStartedState() || jvmControlOperation.STOP.toString().equals(jvmControlOperation.name()) && !jvmState.isStartedState(); } GroupJvmControlServiceImpl(final GroupService theGroupService, final JvmControlService theJvmControlService); @Transactional @Override void controlGroup(final ControlGroupJvmRequest controlGroupJvmRequest, final User aUser); @Override void controlAllJvms(final ControlGroupJvmRequest controlGroupJvmRequest, final User user); boolean checkSameState(final JvmControlOperation jvmControlOperation, final JvmState jvmState); }
GroupJvmControlServiceImpl implements GroupJvmControlService { public boolean checkSameState(final JvmControlOperation jvmControlOperation, final JvmState jvmState) { return jvmControlOperation.START.toString().equals(jvmControlOperation.name()) && jvmState.isStartedState() || jvmControlOperation.STOP.toString().equals(jvmControlOperation.name()) && !jvmState.isStartedState(); } GroupJvmControlServiceImpl(final GroupService theGroupService, final JvmControlService theJvmControlService); @Transactional @Override void controlGroup(final ControlGroupJvmRequest controlGroupJvmRequest, final User aUser); @Override void controlAllJvms(final ControlGroupJvmRequest controlGroupJvmRequest, final User user); boolean checkSameState(final JvmControlOperation jvmControlOperation, final JvmState jvmState);  }