hotspot/test/runtime/logging/ProtectionDomainVerificationTest.java
author mockner
Mon, 29 Feb 2016 16:58:09 -0500
changeset 36381 b9ed6bef9364
child 38152 80e5da81fb2c
permissions -rw-r--r--
8149064: TraceProtectionDomainVerification has been converted to Unified Logging. Summary: TraceProtectionDomainVerification has been converted to Unified Logging with tag protectiondomain. Reviewed-by: coleenp, iklam
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36381
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
     1
/*
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
     4
 *
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
     7
 * published by the Free Software Foundation.
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
     8
 *
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    13
 * accompanied this code).
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    14
 *
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    18
 *
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    21
 * questions.
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    22
 */
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    23
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    24
/*
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    25
 * @test ProtectionDomainVerificationTest
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    26
 * @bug 8149064
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    27
 * @library /testlibrary
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    28
 * @build jdk.test.lib.OutputAnalyzer jdk.test.lib.Platform jdk.test.lib.ProcessTools
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    29
 * @run driver ProtectionDomainVerificationTest
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    30
 */
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    31
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    32
import jdk.test.lib.OutputAnalyzer;
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    33
import jdk.test.lib.Platform;
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    34
import jdk.test.lib.ProcessTools;
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    35
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    36
public class ProtectionDomainVerificationTest {
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    37
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    38
    public static void main(String... args) throws Exception {
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    39
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    40
        // -Xlog:protectiondomain=trace
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    41
        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:protectiondomain=trace",
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    42
                                                                  "-Xmx64m",
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    43
                                                                  Hello.class.getName());
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    44
        OutputAnalyzer out = new OutputAnalyzer(pb.start());
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    45
        out.shouldContain("[protectiondomain] Checking package access");
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    46
        out.shouldContain("[protectiondomain] pd set count = #");
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    47
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    48
        // -Xlog:protectiondomain=debug
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    49
        pb = ProcessTools.createJavaProcessBuilder("-Xlog:protectiondomain=debug",
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    50
                                                                  "-Xmx64m",
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    51
                                                                  Hello.class.getName());
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    52
        out = new OutputAnalyzer(pb.start());
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    53
        out.shouldContain("[protectiondomain] Checking package access");
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    54
        out.shouldNotContain("pd set count = #");
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    55
    }
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    56
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    57
    public static class Hello {
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    58
        public static void main(String[] args) {
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    59
            System.out.print("Hello!");
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    60
        }
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    61
    }
b9ed6bef9364 8149064: TraceProtectionDomainVerification has been converted to Unified Logging.
mockner
parents:
diff changeset
    62
}