Search in sources :

Example 11 with ProcessResult

use of org.eclipse.n4js.utils.process.ProcessResult in project n4js by eclipse.

the class RunExternalLibrariesPluginTest method runClientWithAllDeletedWorkspaceProjects.

/**
 */
@Test
public void runClientWithAllDeletedWorkspaceProjects() throws CoreException {
    for (final String libProjectName : LIB_PROJECT_IDS) {
        getProjectByName(libProjectName).delete(true, new NullProgressMonitor());
        waitForAutoBuildCheckIndexRigid();
    }
    final ProcessResult result = runClient();
    // @formatter:off
    assertEquals("Unexpected output after running the client module: " + result, "External A<init>" + NL + "External B<init>" + NL + "External C<init>" + NL + "External D<init>" + NL, result.getStdOut());
// @formatter:on
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ProcessResult(org.eclipse.n4js.utils.process.ProcessResult) Test(org.junit.Test) AbstractBuilderParticipantTest(org.eclipse.n4js.tests.builder.AbstractBuilderParticipantTest)

Example 12 with ProcessResult

use of org.eclipse.n4js.utils.process.ProcessResult in project n4js by eclipse.

the class RunExternalLibrariesPluginTest method runClient.

private ProcessResult runClient() {
    final String pathToModuleToRun = getResourceName(CLIENT, CLIENT_MODULE);
    final org.eclipse.emf.common.util.URI moduleToRun = createPlatformResourceURI(pathToModuleToRun, true);
    final RunConfiguration config = runnerFrontEnd.createConfiguration(ID, null, moduleToRun);
    final Process process = runnerFrontEndUI.runInUI(config);
    final ProcessResult result = processExecutor.execute(process, "", OutputRedirection.REDIRECT);
    if (result.isOK())
        return result;
    throw new RuntimeException("Client exited with error.\n" + result);
}
Also used : RunConfiguration(org.eclipse.n4js.runner.RunConfiguration) ProcessResult(org.eclipse.n4js.utils.process.ProcessResult)

Example 13 with ProcessResult

use of org.eclipse.n4js.utils.process.ProcessResult in project n4js by eclipse.

the class RunExternalLibrariesPluginTest method runClientWithAllOpenedWorkspaceProjects.

/**
 */
@Test
public void runClientWithAllOpenedWorkspaceProjects() throws CoreException {
    waitForAutoBuildCheckIndexRigid();
    final ProcessResult result = runClient();
    // @formatter:off
    assertEquals("Unexpected output after running the client module: " + result, "Workspace A<init>" + NL + "Workspace B<init>" + NL + "Workspace C<init>" + NL + "Workspace D<init>" + NL, result.getStdOut());
// @formatter:on
}
Also used : ProcessResult(org.eclipse.n4js.utils.process.ProcessResult) Test(org.junit.Test) AbstractBuilderParticipantTest(org.eclipse.n4js.tests.builder.AbstractBuilderParticipantTest)

Example 14 with ProcessResult

use of org.eclipse.n4js.utils.process.ProcessResult in project n4js by eclipse.

the class NodeVersionTest method testNodeJsVersion.

/**
 * Simply checks if the node version found by default matches the required version. Prints out path if this fails.
 */
@Test
public void testNodeJsVersion() {
    final ProcessResult result = commandFactory.checkBinaryVersionCommand(nodeJsBinary).execute();
    final Version currentVersion = Version.createFromString(result.getStdOut().trim());
    assertTrue("Version of node in " + nodeJsBinary.getBinaryAbsolutePath() + ": " + currentVersion + ",  need at least " + NodeBinariesConstants.NODE_MIN_VERSION, currentVersion.compareTo(NodeBinariesConstants.NODE_MIN_VERSION) >= 0);
}
Also used : Version(org.eclipse.n4js.utils.Version) ProcessResult(org.eclipse.n4js.utils.process.ProcessResult) Test(org.junit.Test)

Example 15 with ProcessResult

use of org.eclipse.n4js.utils.process.ProcessResult in project n4js by eclipse.

the class NodeVersionTest method testNPMVersion.

/**
 * Simply checks if the npm version found by default matches the required version. Prints out path if this fails.
 */
@Test
public void testNPMVersion() {
    final ProcessResult result = commandFactory.checkBinaryVersionCommand(npmBinary).execute();
    final Version currentVersion = Version.createFromString(result.getStdOut().trim());
    assertTrue("Version of node in " + npmBinary.getBinaryAbsolutePath() + ": " + currentVersion + ",  need at least " + NodeBinariesConstants.NPM_MIN_VERSION, currentVersion.compareTo(NodeBinariesConstants.NPM_MIN_VERSION) >= 0);
}
Also used : Version(org.eclipse.n4js.utils.Version) ProcessResult(org.eclipse.n4js.utils.process.ProcessResult) Test(org.junit.Test)

Aggregations

ProcessResult (org.eclipse.n4js.utils.process.ProcessResult)15 Test (org.junit.Test)10 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)8 AbstractBuilderParticipantTest (org.eclipse.n4js.tests.builder.AbstractBuilderParticipantTest)8 File (java.io.File)3 Version (org.eclipse.n4js.utils.Version)3 RunConfiguration (org.eclipse.n4js.runner.RunConfiguration)2 IFile (org.eclipse.core.resources.IFile)1 IProject (org.eclipse.core.resources.IProject)1 IStatus (org.eclipse.core.runtime.IStatus)1