use of org.sonar.process.sharedmemoryfile.ProcessCommands in project sonarqube by SonarSource.
the class ProcessCommandsManagedProcessTest method ProcessMonitorImpl_is_a_proxy_of_Process.
@Test
public void ProcessMonitorImpl_is_a_proxy_of_Process() throws Exception {
Process process = mock(Process.class, RETURNS_DEEP_STUBS);
ProcessCommands commands = mock(ProcessCommands.class, RETURNS_DEEP_STUBS);
ProcessCommandsManagedProcess underTest = new ProcessCommandsManagedProcess(process, ProcessId.WEB_SERVER, commands);
underTest.waitFor();
verify(process).waitFor();
underTest.closeStreams();
verify(process.getErrorStream()).close();
verify(process.getInputStream()).close();
verify(process.getOutputStream()).close();
underTest.destroyForcibly();
verify(process).destroyForcibly();
assertThat(underTest.getInputStream()).isNotNull();
underTest.isAlive();
verify(process).isAlive();
underTest.waitFor(123, TimeUnit.MILLISECONDS);
verify(process).waitFor(123, TimeUnit.MILLISECONDS);
}
use of org.sonar.process.sharedmemoryfile.ProcessCommands in project sonarqube by SonarSource.
the class ProcessCommandsManagedProcessTest method ProcessMonitorImpl_is_a_proxy_of_Commands.
@Test
public void ProcessMonitorImpl_is_a_proxy_of_Commands() {
Process process = mock(Process.class, RETURNS_DEEP_STUBS);
ProcessCommands commands = mock(ProcessCommands.class, RETURNS_DEEP_STUBS);
ProcessCommandsManagedProcess underTest = new ProcessCommandsManagedProcess(process, null, commands);
underTest.askForHardStop();
verify(commands).askForHardStop();
underTest.acknowledgeAskForRestart();
verify(commands).acknowledgeAskForRestart();
underTest.askedForRestart();
verify(commands).askedForRestart();
underTest.isOperational();
verify(commands).isOperational();
}
Aggregations