Search in sources :

Example 6 with ProcessCommands

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);
}
Also used : ProcessCommands(org.sonar.process.sharedmemoryfile.ProcessCommands) Test(org.junit.Test)

Example 7 with ProcessCommands

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();
}
Also used : ProcessCommands(org.sonar.process.sharedmemoryfile.ProcessCommands) Test(org.junit.Test)

Aggregations

ProcessCommands (org.sonar.process.sharedmemoryfile.ProcessCommands)7 Test (org.junit.Test)5 File (java.io.File)1 IOException (java.io.IOException)1 EsScriptCommand (org.sonar.application.command.EsScriptCommand)1 JavaCommand (org.sonar.application.command.JavaCommand)1 EsConnectorImpl (org.sonar.application.es.EsConnectorImpl)1 EsInstallation (org.sonar.application.es.EsInstallation)1 EsManagedProcess (org.sonar.application.process.EsManagedProcess)1 ManagedProcess (org.sonar.application.process.ManagedProcess)1 ProcessCommandsManagedProcess (org.sonar.application.process.ProcessCommandsManagedProcess)1 ProcessId (org.sonar.process.ProcessId)1 DefaultProcessCommands (org.sonar.process.sharedmemoryfile.DefaultProcessCommands)1