jdk/test/sun/management/jmxremote/bootstrap/SSLConfigFilePermissionTest.java
author iignatyev
Tue, 27 Jun 2017 08:43:35 -0700
changeset 45709 841996818446
parent 44423 306c020eb154
permissions -rw-r--r--
8182154: merge jdk.testlibrary.Platform and jdk.test.lib.Platform Reviewed-by: sspitsyn, plevart
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23031
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
     1
/*
30376
2ccf2cf7ea48 8078896: Add @modules as needed to the jdk_svc tests
ykantser
parents: 24509
diff changeset
     2
 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
23031
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
     4
 *
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
     7
 * published by the Free Software Foundation.
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
     8
 *
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    13
 * accompanied this code).
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    14
 *
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    18
 *
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    21
 * questions.
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    22
 */
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    23
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    24
import java.io.IOException;
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    25
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    26
/**
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    27
 * @test
44423
306c020eb154 8176176: fix @modules in jdk_svc tests
iignatyev
parents: 43494
diff changeset
    28
 * @bug 6557093
306c020eb154 8176176: fix @modules in jdk_svc tests
iignatyev
parents: 43494
diff changeset
    29
 * @summary Check SSL config file permission for out-of-the-box management
306c020eb154 8176176: fix @modules in jdk_svc tests
iignatyev
parents: 43494
diff changeset
    30
 * @author Taras Ledkov
306c020eb154 8176176: fix @modules in jdk_svc tests
iignatyev
parents: 43494
diff changeset
    31
 *
45709
841996818446 8182154: merge jdk.testlibrary.Platform and jdk.test.lib.Platform
iignatyev
parents: 44423
diff changeset
    32
 * @library /lib/testlibrary /test/lib
44423
306c020eb154 8176176: fix @modules in jdk_svc tests
iignatyev
parents: 43494
diff changeset
    33
 *
45709
841996818446 8182154: merge jdk.testlibrary.Platform and jdk.test.lib.Platform
iignatyev
parents: 44423
diff changeset
    34
 * @build jdk.testlibrary.* jdk.test.lib.Platform Dummy AbstractFilePermissionTest
23031
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    35
 * @run main/timeout=300 SSLConfigFilePermissionTest
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    36
 */
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    37
public class SSLConfigFilePermissionTest extends AbstractFilePermissionTest {
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    38
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    39
    private final String TEST_SRC = System.getProperty("test.src");
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    40
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    41
    private SSLConfigFilePermissionTest() {
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    42
        super("jmxremote.ssl.config");
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    43
    }
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    44
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    45
    public void testSetup() throws IOException {
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    46
        createFile(mgmt,
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    47
                "# management.properties",
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    48
                "com.sun.management.jmxremote.authenticate=false",
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    49
                "com.sun.management.jmxremote.ssl.config.file=" + file2PermissionTest.toFile().getAbsolutePath());
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    50
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    51
        createFile(file2PermissionTest,
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    52
                "# management.properties",
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    53
                "javax.net.ssl.keyStore = " +
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    54
                        FS.getPath(TEST_SRC, "ssl", "keystore").toFile().getAbsolutePath(),
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    55
                "javax.net.ssl.keyStorePassword = password");
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    56
    }
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    57
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    58
    public static void main(String[] args) throws Exception {
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    59
        SSLConfigFilePermissionTest test = new SSLConfigFilePermissionTest();
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    60
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    61
        test.runTest(args);
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    62
    }
995cf5c2eb55 7195249: Some jtreg tests use hard coded ports
sla
parents:
diff changeset
    63
}