Search in sources :

Example 1 with DtoWithPid

use of org.eclipse.che.api.machine.shared.dto.execagent.event.DtoWithPid in project che by eclipse.

the class TestServiceClientTest method sucessfulTestsAfterCompilation.

@Test
public void sucessfulTestsAfterCompilation() {
    Promise<CommandImpl> compileCommandPromise = createCommandPromise(new CommandImpl("test-compile", "mvn test-compile -f ${current.project.path}", "mvn"));
    when(devMachine.getDescriptor()).thenReturn(machine);
    Promise<TestResult> resultPromise = testServiceClient.runTestsAfterCompilation(projectPath, testFramework, parameters, statusNotification, compileCommandPromise);
    triggerProcessEvents(processStartResponse(true), processStarted(), processStdErr("A small warning"), processStdOut("BUILD SUCCESS"), processDied());
    verify(testServiceClient).sendTests(projectPath, testFramework, parameters);
    verify(statusNotification).setContent("Compiling the project before starting the test session.");
    verify(execAgentCommandManager).startProcess("DevMachineId", new CommandImpl("test-compile", "mvn test-compile -f " + rootOfProjects + "/" + projectPath, "mvn"));
    verify(statusNotification).setContent(TestServiceClient.EXECUTING_TESTS_MESSAGE);
    resultPromise.then(testResult -> {
        Assert.assertNotNull(testResult);
    });
    ArrayList<String> eventStrings = new ArrayList<>();
    for (DtoWithPid event : consoleEvents) {
        eventStrings.add(event.toString());
    }
    Assert.assertEquals(eventStrings, Arrays.asList("Started", "StdErr - A small warning", "StdOut - BUILD SUCCESS", "Died"));
}
Also used : CommandImpl(org.eclipse.che.ide.api.command.CommandImpl) DtoWithPid(org.eclipse.che.api.machine.shared.dto.execagent.event.DtoWithPid) ArrayList(java.util.ArrayList) TestResult(org.eclipse.che.api.testing.shared.TestResult) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 DtoWithPid (org.eclipse.che.api.machine.shared.dto.execagent.event.DtoWithPid)1 TestResult (org.eclipse.che.api.testing.shared.TestResult)1 CommandImpl (org.eclipse.che.ide.api.command.CommandImpl)1 Test (org.junit.Test)1 Matchers.anyString (org.mockito.Matchers.anyString)1