当前位置: 首页>>代码示例>>Java>>正文


Java JDKToolLauncher.getCommand方法代码示例

本文整理汇总了Java中jdk.testlibrary.JDKToolLauncher.getCommand方法的典型用法代码示例。如果您正苦于以下问题:Java JDKToolLauncher.getCommand方法的具体用法?Java JDKToolLauncher.getCommand怎么用?Java JDKToolLauncher.getCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jdk.testlibrary.JDKToolLauncher的用法示例。


在下文中一共展示了JDKToolLauncher.getCommand方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: jps

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
/**
 * Start jps utility with VM args and tool arguments
 */
public static OutputAnalyzer jps(List<String> vmArgs, List<String> toolArgs) throws Exception {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jps");
    if (vmArgs != null) {
        for (String vmArg : vmArgs) {
            launcher.addVMArg(vmArg);
        }
    }
    if (toolArgs != null) {
        for (String toolArg : toolArgs) {
            launcher.addToolArg(toolArg);
        }
    }

    ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
    System.out.println(Arrays.toString(processBuilder.command().toArray()).replace(",", ""));
    OutputAnalyzer output = new OutputAnalyzer(processBuilder.start());
    System.out.println(output.getOutput());

    return output;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:24,代码来源:JpsHelper.java

示例2: runSchemaGen

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
private static void runSchemaGen(String classFile, Path runDir) {
    try {
        JDKToolLauncher sgl = JDKToolLauncher.createUsingTestJDK("schemagen");
        sgl.addToolArg(classFile);
        System.out.println("Executing: " + Arrays.asList(sgl.getCommand()));
        ProcessBuilder pb = new ProcessBuilder(sgl.getCommand());
        pb.directory(runDir.toFile());
        pb.redirectErrorStream(true);
        pb.inheritIO();
        Process p = pb.start();
        int result = p.waitFor();
        p.destroy();
        if (result != 0) {
            throw new RuntimeException("schemagen failed");
        }
    } catch (IOException | InterruptedException e) {
        System.err.println("Can't run schemagen tool. Exception:");
        e.printStackTrace(System.err);
        throw new RuntimeException("Error launching schemagen tool");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:GenerateEnumSchema.java

示例3: runJstat

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
/**
 * Depending on test settings command line can look like:
 *
 * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil [email protected] 250 5
 * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil [email protected]:port 250 5
 * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil [email protected]/serverName 250 5
 * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil [email protected]:port/serverName 250 5
 */
private OutputAnalyzer runJstat() throws Exception {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstat");
    launcher.addVMArg("-XX:+UsePerfData");
    launcher.addVMArg("-Duser.language=en");
    launcher.addToolArg("-gcutil");
    launcher.addToolArg(jstatdPid + "@" + getDestination());
    launcher.addToolArg(Integer.toString(JSTAT_GCUTIL_INTERVAL_MS));
    launcher.addToolArg(Integer.toString(JSTAT_GCUTIL_SAMPLES));

    String[] cmd = launcher.getCommand();
    log("Start jstat", cmd);

    ProcessBuilder processBuilder = new ProcessBuilder(cmd);
    OutputAnalyzer output = new OutputAnalyzer(processBuilder.start());
    System.out.println(output.getOutput());

    return output;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:JstatdTest.java

示例4: getJstatdCmd

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
/**
 * Depending on test settings command line can look like:
 *
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -p port
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -n serverName
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -p port -n serverName
 */
private String[] getJstatdCmd() throws Exception {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstatd");
    launcher.addVMArg("-XX:+UsePerfData");
    String testSrc = System.getProperty("test.src");
    File policy = new File(testSrc, "all.policy");
    assertTrue(policy.exists() && policy.isFile(),
            "Security policy " + policy.getAbsolutePath() + " does not exist or not a file");
    launcher.addVMArg("-Djava.security.policy=" + policy.getAbsolutePath());
    // -Dparent.pid.<pid> will help to identify jstad process started by this test
    launcher.addVMArg("-Dparent.pid." + ProcessTools.getProcessId());
    if (port != null) {
        launcher.addToolArg("-p");
        launcher.addToolArg(port);
    }
    if (serverName != null) {
        launcher.addToolArg("-n");
        launcher.addToolArg(serverName);
    }

    String[] cmd = launcher.getCommand();
    log("Start jstatd", cmd);
    return cmd;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:32,代码来源:JstatdTest.java

示例5: runJstat

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
/**
 * Depending on test settings command line can look like:
 *
 * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil [email protected] 250 5
 * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil [email protected]:port 250 5
 * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil [email protected]/serverName 250 5
 * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil [email protected]:port/serverName 250 5
 */
private OutputAnalyzer runJstat() throws Exception {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstat");
    launcher.addVMArg("-XX:+UsePerfData");
    launcher.addVMArg("-Duser.language=en");
    launcher.addToolArg("-gcutil");
    launcher.addToolArg(jstatdPid + "@" + getDestination());
    launcher.addToolArg(Integer.toString(JSTAT_GCUTIL_INTERVAL_MS));
    launcher.addToolArg(Integer.toString(JSTAT_GCUTIL_SAMPLES));

    String[] cmd = launcher.getCommand();
    log("Start jstat", cmd);

    ProcessBuilder processBuilder = new ProcessBuilder(cmd);
    OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
    System.out.println(output.getOutput());

    return output;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:JstatdTest.java

示例6: getJstatdCmd

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
/**
 * Depending on test settings command line can look like:
 *
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -p port
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -n serverName
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -p port -n serverName
 */
private String[] getJstatdCmd() throws Exception {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstatd");
    launcher.addVMArg("-XX:+UsePerfData");
    String testSrc = System.getProperty("test.src");
    File policy = new File(testSrc, "all.policy");
    assertTrue(policy.exists() && policy.isFile(),
            "Security policy " + policy.getAbsolutePath() + " does not exist or not a file");
    launcher.addVMArg("-Djava.security.policy=" + policy.getAbsolutePath());
    if (port != null) {
        launcher.addToolArg("-p");
        launcher.addToolArg(port);
    }
    if (serverName != null) {
        launcher.addToolArg("-n");
        launcher.addToolArg(serverName);
    }
    if (withExternalRegistry) {
        launcher.addToolArg("-nr");
    }

    String[] cmd = launcher.getCommand();
    log("Start jstatd", cmd);
    return cmd;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:JstatdTest.java

示例7: jps

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
/**
 * Start jps utility with VM args and tool arguments
 */
public static OutputAnalyzer jps(List<String> vmArgs, List<String> toolArgs) throws Exception {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jps");
    launcher.addVMArg("-XX:+UsePerfData");
    if (vmArgs != null) {
        for (String vmArg : vmArgs) {
            launcher.addVMArg(vmArg);
        }
    }
    if (toolArgs != null) {
        for (String toolArg : toolArgs) {
            launcher.addToolArg(toolArg);
        }
    }

    ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
    System.out.println(Arrays.toString(processBuilder.command().toArray()).replace(",", ""));
    OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
    System.out.println(output.getOutput());

    return output;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:JpsHelper.java

示例8: runJps

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
/**
 * Depending on test settings command line can look like:
 *
 * jps -J-XX:+UsePerfData hostname
 * jps -J-XX:+UsePerfData hostname:port
 * jps -J-XX:+UsePerfData hostname/serverName
 * jps -J-XX:+UsePerfData hostname:port/serverName
 */
private OutputAnalyzer runJps() throws Exception {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jps");
    launcher.addVMArg("-XX:+UsePerfData");
    // Run jps with -v flag to obtain -Dparent.pid.<pid>
    launcher.addToolArg("-v");
    launcher.addToolArg(getDestination());

    String[] cmd = launcher.getCommand();
    log("Start jps", cmd);

    ProcessBuilder processBuilder = new ProcessBuilder(cmd);
    OutputAnalyzer output = new OutputAnalyzer(processBuilder.start());
    System.out.println(output.getOutput());

    return output;
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:25,代码来源:JstatdTest.java

示例9: getJstatdCmd

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
/**
 * Depending on test settings command line can look like:
 *
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -p port
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -n serverName
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -p port -n serverName
 */
private String[] getJstatdCmd() throws UnknownHostException {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstatd");
    launcher.addVMArg("-XX:+UsePerfData");
    String testSrc = System.getProperty("test.src");
    File policy = new File(testSrc, "all.policy");
    assertTrue(policy.exists() && policy.isFile(),
            "Security policy " + policy.getAbsolutePath() + " does not exist or not a file");
    launcher.addVMArg("-Djava.security.policy=" + policy.getAbsolutePath());
    if (port != null) {
        launcher.addToolArg("-p");
        launcher.addToolArg(port);
    }
    if (serverName != null) {
        launcher.addToolArg("-n");
        launcher.addToolArg(serverName);
    }

    String[] cmd = launcher.getCommand();
    log("Start jstatd", cmd);
    return cmd;
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:30,代码来源:JstatdTest.java

示例10: testUsage

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
private static void testUsage(String option) throws Exception {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstatd");
    launcher.addToolArg(option);
    ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
    OutputAnalyzer output = new OutputAnalyzer(processBuilder.start());

    output.shouldContain("usage: jstatd [-nr] [-p port] [-n rminame]");
    output.shouldHaveExitValue(1);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:10,代码来源:TestJstatdUsage.java

示例11: runXjc

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
void runXjc(String xsdFileName) throws Exception {
    // Prepare process builder to run schemagen tool and save its output
    JDKToolLauncher xjcLauncher = JDKToolLauncher.createUsingTestJDK("xjc");
    xjcLauncher.addToolArg(xsdFileName);
    System.out.println("Executing xjc command: " + Arrays.asList(xjcLauncher.getCommand()));
    ProcessBuilder pb = new ProcessBuilder(xjcLauncher.getCommand());
    // Set xjc work directory with the input java file
    pb.directory(testWorkDir.toFile());
    pb.inheritIO();
    Process p = pb.start();
    p.waitFor();
    p.destroy();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:JaxbMarshallTest.java

示例12: compileXjcGeneratedClasses

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
void compileXjcGeneratedClasses() throws Exception {
    JDKToolLauncher javacLauncher = JDKToolLauncher.createUsingTestJDK("javac");
    javacLauncher.addToolArg(xjcResultDir.resolve("ObjectFactory.java").toString());
    javacLauncher.addToolArg(xjcResultDir.resolve("TypesLongList.java").toString());
    javacLauncher.addToolArg(xjcResultDir.resolve("package-info.java").toString());
    System.out.println("Compiling xjc generated classes: " + Arrays.asList(javacLauncher.getCommand()));
    ProcessBuilder pb = new ProcessBuilder(javacLauncher.getCommand());
    pb.inheritIO();
    pb.directory(testWorkDir.toFile());
    Process p = pb.start();
    p.waitFor();
    p.destroy();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:JaxbMarshallTest.java

示例13: launchJStack

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
public static void launchJStack() throws IOException {

        if (Platform.isOSX()) {
            // Coredump stackwalking is not implemented for Darwin
            System.out.println("This test is not expected to work on OS X. Skipping");
            return;
        }

        System.out.println("Starting LingeredApp");
        try {
            theApp = LingeredApp.startApp(Arrays.asList("-Xmx256m"));

            System.out.println("Starting jstack against " + theApp.getPid());
            JDKToolLauncher launcher = createSALauncher();

            launcher.addToolArg("jstack");
            launcher.addToolArg("--pid=" + Long.toString(theApp.getPid()));

            ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
            OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);;
            output.shouldContain("No deadlocks found");
            output.shouldNotContain("illegal bci");
            output.shouldNotContain("AssertionFailure");
            output.shouldHaveExitValue(0);

        } catch (Exception ex) {
            throw new RuntimeException("Test ERROR " + ex, ex);
        } finally {
            LingeredApp.stopApp(theApp);
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:BasicLauncherTest.java

示例14: compileXjcGeneratedClasses

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
void compileXjcGeneratedClasses() throws Exception {
    JDKToolLauncher javacLauncher = JDKToolLauncher.createUsingTestJDK("javac");
    javacLauncher.addToolArg("--add-modules");
    javacLauncher.addToolArg("java.xml.bind");
    javacLauncher.addToolArg(xjcResultDir.resolve("ObjectFactory.java").toString());
    javacLauncher.addToolArg(xjcResultDir.resolve("TypesLongList.java").toString());
    javacLauncher.addToolArg(xjcResultDir.resolve("package-info.java").toString());
    System.out.println("Compiling xjc generated classes: " + Arrays.asList(javacLauncher.getCommand()));
    ProcessBuilder pb = new ProcessBuilder(javacLauncher.getCommand());
    pb.inheritIO();
    pb.directory(testWorkDir.toFile());
    Process p = pb.start();
    p.waitFor();
    p.destroy();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:JaxbMarshallTest.java

示例15: runJps

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
/**
 * Depending on test settings command line can look like:
 *
 * jps -J-XX:+UsePerfData hostname
 * jps -J-XX:+UsePerfData hostname:port
 * jps -J-XX:+UsePerfData hostname/serverName
 * jps -J-XX:+UsePerfData hostname:port/serverName
 */
private OutputAnalyzer runJps() throws Exception {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jps");
    launcher.addVMArg("-XX:+UsePerfData");
    launcher.addToolArg(getDestination());

    String[] cmd = launcher.getCommand();
    log("Start jps", cmd);

    ProcessBuilder processBuilder = new ProcessBuilder(cmd);
    OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
    System.out.println(output.getOutput());

    return output;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:JstatdTest.java


注:本文中的jdk.testlibrary.JDKToolLauncher.getCommand方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。