Search in sources :

Example 1 with EquinoxLaunchConfiguration

use of org.eclipse.sisu.equinox.launching.internal.EquinoxLaunchConfiguration in project tycho by eclipse.

the class TestMojoTest method testAddProgramArgsWithSpaces.

@Test
public void testAddProgramArgsWithSpaces() throws Exception {
    EquinoxLaunchConfiguration cli = createEquinoxConfiguration();
    TestMojo testMojo = new TestMojo();
    testMojo.addProgramArgs(cli, "-data", "/path with spaces ");
    assertEquals(2, cli.getProgramArguments().length);
    assertEquals("-data", cli.getProgramArguments()[0]);
    assertEquals("/path with spaces ", cli.getProgramArguments()[1]);
}
Also used : EquinoxLaunchConfiguration(org.eclipse.sisu.equinox.launching.internal.EquinoxLaunchConfiguration) Test(org.junit.Test)

Example 2 with EquinoxLaunchConfiguration

use of org.eclipse.sisu.equinox.launching.internal.EquinoxLaunchConfiguration in project tycho by eclipse.

the class TestMojo method createCommandLine.

LaunchConfiguration createCommandLine(EquinoxInstallation testRuntime) throws MalformedURLException, MojoExecutionException {
    EquinoxLaunchConfiguration cli = new EquinoxLaunchConfiguration(testRuntime);
    String executable = null;
    Toolchain tc = getToolchain();
    if (tc != null) {
        getLog().info("Toolchain in tycho-surefire-plugin: " + tc);
        executable = tc.findTool("java");
    }
    cli.setJvmExecutable(executable);
    cli.setWorkingDirectory(project.getBasedir());
    if (debugPort > 0) {
        cli.addVMArguments("-Xdebug", "-Xrunjdwp:transport=dt_socket,address=" + debugPort + ",server=y,suspend=y");
    }
    cli.addVMArguments("-Dosgi.noShutdown=false");
    Properties properties = (Properties) project.getContextValue(TychoConstants.CTX_MERGED_PROPERTIES);
    // 
    cli.addVMArguments(// 
    "-Dosgi.os=" + PlatformPropertiesUtils.getOS(properties), // 
    "-Dosgi.ws=" + PlatformPropertiesUtils.getWS(properties), "-Dosgi.arch=" + PlatformPropertiesUtils.getArch(properties));
    addCustomProfileArg(cli);
    cli.addVMArguments(splitArgLine(argLine));
    for (Map.Entry<String, String> entry : getMergedSystemProperties().entrySet()) {
        cli.addVMArguments("-D" + entry.getKey() + "=" + entry.getValue());
    }
    if (getLog().isDebugEnabled() || showEclipseLog) {
        cli.addProgramArguments("-debug", "-consolelog");
    }
    addProgramArgs(// 
    cli, // 
    "-data", // 
    osgiDataDirectory.getAbsolutePath(), // 
    "-install", // 
    testRuntime.getLocation().getAbsolutePath(), // 
    "-configuration", // 
    testRuntime.getConfigurationLocation().getAbsolutePath(), // 
    "-application", // 
    getTestApplication(testRuntime.getInstallationDescription()), "-testproperties", surefireProperties.getAbsolutePath());
    if (application != null) {
        cli.addProgramArguments("-testApplication", application);
    }
    if (product != null) {
        cli.addProgramArguments("-product", product);
    }
    if (useUIHarness && !useUIThread) {
        cli.addProgramArguments("-nouithread");
    }
    cli.addProgramArguments(splitArgLine(appArgLine));
    if (environmentVariables != null) {
        cli.addEnvironmentVariables(environmentVariables);
    }
    return cli;
}
Also used : Toolchain(org.apache.maven.toolchain.Toolchain) EquinoxLaunchConfiguration(org.eclipse.sisu.equinox.launching.internal.EquinoxLaunchConfiguration) Properties(java.util.Properties) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap)

Example 3 with EquinoxLaunchConfiguration

use of org.eclipse.sisu.equinox.launching.internal.EquinoxLaunchConfiguration in project tycho by eclipse.

the class TestMojoTest method testAddProgramArgsNullArg.

@Test
public void testAddProgramArgsNullArg() throws Exception {
    EquinoxLaunchConfiguration cli = createEquinoxConfiguration();
    TestMojo testMojo = new TestMojo();
    // null arg must be ignored
    testMojo.addProgramArgs(cli, "-data", null);
    assertEquals(1, cli.getProgramArguments().length);
}
Also used : EquinoxLaunchConfiguration(org.eclipse.sisu.equinox.launching.internal.EquinoxLaunchConfiguration) Test(org.junit.Test)

Aggregations

EquinoxLaunchConfiguration (org.eclipse.sisu.equinox.launching.internal.EquinoxLaunchConfiguration)3 Test (org.junit.Test)2 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 Properties (java.util.Properties)1 Toolchain (org.apache.maven.toolchain.Toolchain)1