Java Code Examples for com.oracle.java.testlibrary.Platform#isWindows()

The following examples show how to use com.oracle.java.testlibrary.Platform#isWindows() . 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: DynLibDcmdTest.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    String result = DcmdUtil.executeDcmd("VM.dynlibs");

    String osDependentBaseString = null;
    if (Platform.isSolaris()) {
        osDependentBaseString = "lib%s.so";
    } else if (Platform.isWindows()) {
        osDependentBaseString = "%s.dll";
    } else if (Platform.isOSX()) {
        osDependentBaseString = "lib%s.dylib";
    } else if (Platform.isLinux()) {
        osDependentBaseString = "lib%s.so";
    }

    if (osDependentBaseString == null) {
        throw new Exception("Unsupported OS");
    }

    Set<String> expectedContent = new HashSet<>();
    expectedContent.add(String.format(osDependentBaseString, "jvm"));
    expectedContent.add(String.format(osDependentBaseString, "java"));
    expectedContent.add(String.format(osDependentBaseString, "management"));

    for(String expected : expectedContent) {
        if (!result.contains(expected)) {
            throw new Exception("Dynamic library list output did not contain the expected string: '" + expected + "'");
        }
    }
}
 
Example 2
Source File: DynLibDcmdTest.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    String result = DcmdUtil.executeDcmd("VM.dynlibs");

    String osDependentBaseString = null;
    if (Platform.isSolaris()) {
        osDependentBaseString = "lib%s.so";
    } else if (Platform.isWindows()) {
        osDependentBaseString = "%s.dll";
    } else if (Platform.isOSX()) {
        osDependentBaseString = "lib%s.dylib";
    } else if (Platform.isLinux()) {
        osDependentBaseString = "lib%s.so";
    }

    if (osDependentBaseString == null) {
        throw new Exception("Unsupported OS");
    }

    Set<String> expectedContent = new HashSet<>();
    expectedContent.add(String.format(osDependentBaseString, "jvm"));
    expectedContent.add(String.format(osDependentBaseString, "java"));
    expectedContent.add(String.format(osDependentBaseString, "management"));

    for(String expected : expectedContent) {
        if (!result.contains(expected)) {
            throw new Exception("Dynamic library list output did not contain the expected string: '" + expected + "'");
        }
    }
}
 
Example 3
Source File: DynLibDcmdTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    String result = DcmdUtil.executeDcmd("VM.dynlibs");

    String osDependentBaseString = null;
    if (Platform.isSolaris()) {
        osDependentBaseString = "lib%s.so";
    } else if (Platform.isWindows()) {
        osDependentBaseString = "%s.dll";
    } else if (Platform.isOSX()) {
        osDependentBaseString = "lib%s.dylib";
    } else if (Platform.isLinux()) {
        osDependentBaseString = "lib%s.so";
    }

    if (osDependentBaseString == null) {
        throw new Exception("Unsupported OS");
    }

    Set<String> expectedContent = new HashSet<>();
    expectedContent.add(String.format(osDependentBaseString, "jvm"));
    expectedContent.add(String.format(osDependentBaseString, "java"));
    expectedContent.add(String.format(osDependentBaseString, "management"));

    for(String expected : expectedContent) {
        if (!result.contains(expected)) {
            throw new Exception("Dynamic library list output did not contain the expected string: '" + expected + "'");
        }
    }
}