Java Code Examples for jdk.testlibrary.OutputAnalyzer#shouldMatchByLineFrom()

The following examples show how to use jdk.testlibrary.OutputAnalyzer#shouldMatchByLineFrom() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestJcmdSanity.java    From dragonwell8_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Verifies the generated output from the PerfCounter.print command
 * matches a certain pattern.
 *
 * The output of perf counters should look like:
 * java.property.java.vm.name="Java HotSpot(TM) 64-Bit Server VM"
 * java.threads.daemon=7
 * sun.rt.javaCommand="com.sun.javatest.regtest.MainWrapper /tmp/jtreg/jtreg-workdir/classes/sun/tools/jcmd/TestJcmdSanity.jta"
 *
 * @param output The generated output from the PerfCounter.print command.
 * @throws Exception
 */
private static void matchPerfCounters(OutputAnalyzer output) throws Exception {
    int matchedCount = output.shouldMatchByLineFrom(PERF_COUNTER_REGEX,
            PERF_COUNTER_REGEX);
    assertGreaterThan(matchedCount , 0,
            "Found no lines matching pattern: " + PERF_COUNTER_REGEX);
}
 
Example 2
Source File: TestJcmdSanity.java    From TencentKona-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Verifies the generated output from the PerfCounter.print command
 * matches a certain pattern.
 *
 * The output of perf counters should look like:
 * java.property.java.vm.name="Java HotSpot(TM) 64-Bit Server VM"
 * java.threads.daemon=7
 * sun.rt.javaCommand="com.sun.javatest.regtest.MainWrapper /tmp/jtreg/jtreg-workdir/classes/sun/tools/jcmd/TestJcmdSanity.jta"
 *
 * @param output The generated output from the PerfCounter.print command.
 * @throws Exception
 */
private static void matchPerfCounters(OutputAnalyzer output) throws Exception {
    int matchedCount = output.shouldMatchByLineFrom(PERF_COUNTER_REGEX,
            PERF_COUNTER_REGEX);
    assertGreaterThan(matchedCount , 0,
            "Found no lines matching pattern: " + PERF_COUNTER_REGEX);
}
 
Example 3
Source File: TestJcmdSanity.java    From openjdk-jdk8u with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Verifies the generated output from the PerfCounter.print command
 * matches a certain pattern.
 *
 * The output of perf counters should look like:
 * java.property.java.vm.name="Java HotSpot(TM) 64-Bit Server VM"
 * java.threads.daemon=7
 * sun.rt.javaCommand="com.sun.javatest.regtest.MainWrapper /tmp/jtreg/jtreg-workdir/classes/sun/tools/jcmd/TestJcmdSanity.jta"
 *
 * @param output The generated output from the PerfCounter.print command.
 * @throws Exception
 */
private static void matchPerfCounters(OutputAnalyzer output) throws Exception {
    int matchedCount = output.shouldMatchByLineFrom(PERF_COUNTER_REGEX,
            PERF_COUNTER_REGEX);
    assertGreaterThan(matchedCount , 0,
            "Found no lines matching pattern: " + PERF_COUNTER_REGEX);
}
 
Example 4
Source File: TestJcmdSanity.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Verifies the generated output from the PerfCounter.print command
 * matches a certain pattern.
 *
 * The output of perf counters should look like:
 * java.property.java.vm.name="Java HotSpot(TM) 64-Bit Server VM"
 * java.threads.daemon=7
 * sun.rt.javaCommand="com.sun.javatest.regtest.MainWrapper /tmp/jtreg/jtreg-workdir/classes/sun/tools/jcmd/TestJcmdSanity.jta"
 *
 * @param output The generated output from the PerfCounter.print command.
 * @throws Exception
 */
private static void matchPerfCounters(OutputAnalyzer output) throws Exception {
    int matchedCount = output.shouldMatchByLineFrom(PERF_COUNTER_REGEX,
            PERF_COUNTER_REGEX);
    assertGreaterThan(matchedCount , 0,
            "Found no lines matching pattern: " + PERF_COUNTER_REGEX);
}
 
Example 5
Source File: TestJcmdSanity.java    From openjdk-jdk9 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Verifies the generated output from the PerfCounter.print command
 * matches a certain pattern.
 *
 * The output of perf counters should look like:
 * java.property.java.vm.name="Java HotSpot(TM) 64-Bit Server VM"
 * java.threads.daemon=7
 * sun.rt.javaCommand="com.sun.javatest.regtest.MainWrapper /tmp/jtreg/jtreg-workdir/classes/sun/tools/jcmd/TestJcmdSanity.jta"
 *
 * @param output The generated output from the PerfCounter.print command.
 * @throws Exception
 */
private static void matchPerfCounters(OutputAnalyzer output) throws Exception {
    int matchedCount = output.shouldMatchByLineFrom(PERF_COUNTER_REGEX,
            PERF_COUNTER_REGEX);
    assertGreaterThan(matchedCount , 0,
            "Found no lines matching pattern: " + PERF_COUNTER_REGEX);
}
 
Example 6
Source File: TestJcmdSanity.java    From jdk8u-jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Verifies the generated output from the PerfCounter.print command
 * matches a certain pattern.
 *
 * The output of perf counters should look like:
 * java.property.java.vm.name="Java HotSpot(TM) 64-Bit Server VM"
 * java.threads.daemon=7
 * sun.rt.javaCommand="com.sun.javatest.regtest.MainWrapper /tmp/jtreg/jtreg-workdir/classes/sun/tools/jcmd/TestJcmdSanity.jta"
 *
 * @param output The generated output from the PerfCounter.print command.
 * @throws Exception
 */
private static void matchPerfCounters(OutputAnalyzer output) throws Exception {
    int matchedCount = output.shouldMatchByLineFrom(PERF_COUNTER_REGEX,
            PERF_COUNTER_REGEX);
    assertGreaterThan(matchedCount , 0,
            "Found no lines matching pattern: " + PERF_COUNTER_REGEX);
}
 
Example 7
Source File: TestJcmdSanity.java    From hottub with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Verifies the generated output from the PerfCounter.print command
 * matches a certain pattern.
 *
 * The output of perf counters should look like:
 * java.property.java.vm.name="Java HotSpot(TM) 64-Bit Server VM"
 * java.threads.daemon=7
 * sun.rt.javaCommand="com.sun.javatest.regtest.MainWrapper /tmp/jtreg/jtreg-workdir/classes/sun/tools/jcmd/TestJcmdSanity.jta"
 *
 * @param output The generated output from the PerfCounter.print command.
 * @throws Exception
 */
private static void matchPerfCounters(OutputAnalyzer output) throws Exception {
    int matchedCount = output.shouldMatchByLineFrom(PERF_COUNTER_REGEX,
            PERF_COUNTER_REGEX);
    assertGreaterThan(matchedCount , 0,
            "Found no lines matching pattern: " + PERF_COUNTER_REGEX);
}
 
Example 8
Source File: TestJcmdSanity.java    From jdk8u_jdk with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Verifies the generated output from the PerfCounter.print command
 * matches a certain pattern.
 *
 * The output of perf counters should look like:
 * java.property.java.vm.name="Java HotSpot(TM) 64-Bit Server VM"
 * java.threads.daemon=7
 * sun.rt.javaCommand="com.sun.javatest.regtest.MainWrapper /tmp/jtreg/jtreg-workdir/classes/sun/tools/jcmd/TestJcmdSanity.jta"
 *
 * @param output The generated output from the PerfCounter.print command.
 * @throws Exception
 */
private static void matchPerfCounters(OutputAnalyzer output) throws Exception {
    int matchedCount = output.shouldMatchByLineFrom(PERF_COUNTER_REGEX,
            PERF_COUNTER_REGEX);
    assertGreaterThan(matchedCount , 0,
            "Found no lines matching pattern: " + PERF_COUNTER_REGEX);
}
 
Example 9
Source File: JpsHelper.java    From dragonwell8_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Verify jps output contains pids and programs' name information.
 * The function will discard any lines that come before the first line with pid.
 * This can happen if the JVM outputs a warning message for some reason
 * before running jps.
 *
 * The output can look like:
 * 35536 Jps
 * 35417 Main
 * 31103 org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
 */
public static void verifyJpsOutput(OutputAnalyzer output, String regex) throws Exception {
    output.shouldHaveExitValue(0);
    int matchedCount = output.shouldMatchByLineFrom(regex, regex);
    assertGreaterThan(matchedCount , 0, "Found no lines matching pattern: " + regex);
}
 
Example 10
Source File: JpsHelper.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Verify jps output contains pids and programs' name information.
 * The function will discard any lines that come before the first line with pid.
 * This can happen if the JVM outputs a warning message for some reason
 * before running jps.
 *
 * The output can look like:
 * 35536 Jps
 * 35417 Main
 * 31103 org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
 */
public static void verifyJpsOutput(OutputAnalyzer output, String regex) throws Exception {
    output.shouldHaveExitValue(0);
    int matchedCount = output.shouldMatchByLineFrom(regex, regex);
    assertGreaterThan(matchedCount , 0, "Found no lines matching pattern: " + regex);
}
 
Example 11
Source File: JpsHelper.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Verify jps output contains pids and programs' name information.
 * The function will discard any lines that come before the first line with pid.
 * This can happen if the JVM outputs a warning message for some reason
 * before running jps.
 *
 * The output can look like:
 * 35536 Jps
 * 35417 Main
 * 31103 org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
 */
public static void verifyJpsOutput(OutputAnalyzer output, String regex) throws Exception {
    output.shouldHaveExitValue(0);
    int matchedCount = output.shouldMatchByLineFrom(regex, regex);
    assertGreaterThan(matchedCount , 0, "Found no lines matching pattern: " + regex);
}
 
Example 12
Source File: JpsHelper.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Verify jps output contains pids and programs' name information.
 * The function will discard any lines that come before the first line with pid.
 * This can happen if the JVM outputs a warning message for some reason
 * before running jps.
 *
 * The output can look like:
 * 35536 Jps
 * 35417 Main
 * 31103 org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
 */
public static void verifyJpsOutput(OutputAnalyzer output, String regex) throws Exception {
    output.shouldHaveExitValue(0);
    int matchedCount = output.shouldMatchByLineFrom(regex, regex);
    assertGreaterThan(matchedCount , 0, "Found no lines matching pattern: " + regex);
}
 
Example 13
Source File: JpsHelper.java    From jdk8u-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Verify jps output contains pids and programs' name information.
 * The function will discard any lines that come before the first line with pid.
 * This can happen if the JVM outputs a warning message for some reason
 * before running jps.
 *
 * The output can look like:
 * 35536 Jps
 * 35417 Main
 * 31103 org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
 */
public static void verifyJpsOutput(OutputAnalyzer output, String regex) throws Exception {
    output.shouldHaveExitValue(0);
    int matchedCount = output.shouldMatchByLineFrom(regex, regex);
    assertGreaterThan(matchedCount , 0, "Found no lines matching pattern: " + regex);
}
 
Example 14
Source File: JpsHelper.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Verify jps output contains pids and programs' name information.
 * The function will discard any lines that come before the first line with pid.
 * This can happen if the JVM outputs a warning message for some reason
 * before running jps.
 *
 * The output can look like:
 * 35536 Jps
 * 35417 Main
 * 31103 org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
 */
public static void verifyJpsOutput(OutputAnalyzer output, String regex) throws Exception {
    output.shouldHaveExitValue(0);
    int matchedCount = output.shouldMatchByLineFrom(regex, regex);
    assertGreaterThan(matchedCount , 0, "Found no lines matching pattern: " + regex);
}
 
Example 15
Source File: JpsHelper.java    From jdk8u_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Verify jps output contains pids and programs' name information.
 * The function will discard any lines that come before the first line with pid.
 * This can happen if the JVM outputs a warning message for some reason
 * before running jps.
 *
 * The output can look like:
 * 35536 Jps
 * 35417 Main
 * 31103 org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar
 */
public static void verifyJpsOutput(OutputAnalyzer output, String regex) throws Exception {
    output.shouldHaveExitValue(0);
    int matchedCount = output.shouldMatchByLineFrom(regex, regex);
    assertGreaterThan(matchedCount , 0, "Found no lines matching pattern: " + regex);
}