changeset 16771:f21b6912d865

8173130: SubjectDelegation2Test.java and SubjectDelegation3Test.java failing on solaris Reviewed-by: dfuchs
author hb
date Thu, 23 Feb 2017 20:35:25 +0530
parents ed98f82f9256
children 6dd2f49fbf96 9a22fca36ecc
files test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation2Test.java test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation3Test.java test/javax/management/remote/mandatory/subjectDelegation/policy21 test/javax/management/remote/mandatory/subjectDelegation/policy22 test/javax/management/remote/mandatory/subjectDelegation/policy23 test/javax/management/remote/mandatory/subjectDelegation/policy24 test/javax/management/remote/mandatory/subjectDelegation/policy25 test/javax/management/remote/mandatory/subjectDelegation/policy31 test/javax/management/remote/mandatory/subjectDelegation/policy32 test/javax/management/remote/mandatory/subjectDelegation/policy33 test/javax/management/remote/mandatory/subjectDelegation/policy34 test/javax/management/remote/mandatory/subjectDelegation/policy35
diffstat 12 files changed, 17 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation2Test.java	Tue Feb 21 22:35:29 2017 +0100
+++ b/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation2Test.java	Thu Feb 23 20:35:25 2017 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,6 @@
 import java.rmi.RemoteException;
 import java.rmi.registry.LocateRegistry;
 import java.rmi.registry.Registry;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.Properties;
 import javax.management.Attribute;
@@ -57,24 +56,11 @@
 import javax.management.remote.JMXConnectorFactory;
 import javax.management.remote.JMXConnectorServer;
 import javax.management.remote.JMXConnectorServerFactory;
-import javax.management.remote.JMXPrincipal;
 import javax.management.remote.JMXServiceURL;
-import javax.security.auth.Subject;
 
 public class SubjectDelegation2Test {
 
     public static void main(String[] args) throws Exception {
-        // Check for supported operating systems: Solaris
-        //
-        // This test runs only on Solaris due to CR 6285916
-        //
-        String osName = System.getProperty("os.name");
-        System.out.println("os.name = " + osName);
-        if (!osName.equals("SunOS")) {
-            System.out.println("This test runs on Solaris only.");
-            System.out.println("Bye! Bye!");
-            return;
-        }
         String policyFile = args[0];
         String testResult = args[1];
         System.out.println("Policy file = " + policyFile);
@@ -137,9 +123,8 @@
             // Create an RMI connector server
             //
             System.out.println("Create an RMI connector server");
-            JMXServiceURL url =
-                new JMXServiceURL("rmi", null, 0,
-                                  "/jndi/rmi://:" + port + "/server" + port);
+            JMXServiceURL url = new JMXServiceURL("rmi", null, 0);
+
             jmxcs =
                 JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs);
             jmxcs.start();
@@ -151,7 +136,7 @@
             //
             String[] credentials = new String[] { "monitorRole" , "QED" };
             cli_env.put("jmx.remote.credentials", credentials);
-            jmxc = JMXConnectorFactory.connect(url, cli_env);
+            jmxc = JMXConnectorFactory.connect(jmxcs.getAddress(), cli_env);
             MBeanServerConnection mbsc = jmxc.getMBeanServerConnection();
             // Get domains from MBeanServer
             //
--- a/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation3Test.java	Tue Feb 21 22:35:29 2017 +0100
+++ b/test/javax/management/remote/mandatory/subjectDelegation/SubjectDelegation3Test.java	Thu Feb 23 20:35:25 2017 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -65,17 +65,6 @@
 public class SubjectDelegation3Test {
 
     public static void main(String[] args) throws Exception {
-        // Check for supported operating systems: Solaris
-        //
-        // This test runs only on Solaris due to CR 6285916
-        //
-        String osName = System.getProperty("os.name");
-        System.out.println("os.name = " + osName);
-        if (!osName.equals("SunOS")) {
-            System.out.println("This test runs on Solaris only.");
-            System.out.println("Bye! Bye!");
-            return;
-        }
         String policyFile = args[0];
         String testResult = args[1];
         System.out.println("Policy file = " + policyFile);
@@ -139,8 +128,7 @@
             //
             System.out.println("Create an RMI connector server");
             JMXServiceURL url =
-                new JMXServiceURL("rmi", null, 0,
-                                  "/jndi/rmi://:" + port + "/server" + port);
+                new JMXServiceURL("rmi", null, 0);
             jmxcs =
                 JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs);
             jmxcs.start();
@@ -152,7 +140,7 @@
             //
             String[] credentials = new String[] { "monitorRole" , "QED" };
             cli_env.put("jmx.remote.credentials", credentials);
-            jmxc = JMXConnectorFactory.connect(url, cli_env);
+            jmxc = JMXConnectorFactory.connect(jmxcs.getAddress(), cli_env);
             Subject delegationSubject =
                 new Subject(true,
                             Collections.singleton(new JMXPrincipal("delegate")),
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy21	Tue Feb 21 22:35:29 2017 +0100
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy21	Thu Feb 23 20:35:25 2017 +0530
@@ -2,6 +2,7 @@
     permission javax.security.auth.AuthPermission "createLoginContext.JMXPluggableAuthenticator";
     permission java.net.SocketPermission "*:*", "accept,connect,listen,resolve";
     permission java.security.SecurityPermission "createAccessControlContext";
+    permission java.lang.RuntimePermission "*";
     permission javax.management.MBeanPermission "*", "getDomains";
     permission javax.management.MBeanPermission "SimpleStandard#State[MBeans:type=SimpleStandard]", "getAttribute";
     permission javax.security.auth.AuthPermission "getSubject";
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy22	Tue Feb 21 22:35:29 2017 +0100
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy22	Thu Feb 23 20:35:25 2017 +0530
@@ -1,6 +1,7 @@
 grant codebase "file:/-" {
     permission javax.security.auth.AuthPermission "createLoginContext.JMXPluggableAuthenticator";
     permission java.net.SocketPermission "*:*", "accept,connect,listen,resolve";
+    permission java.lang.RuntimePermission "*";
     permission java.security.SecurityPermission "createAccessControlContext";
 //    permission javax.management.MBeanPermission "*", "getDomains";
     permission javax.management.MBeanPermission "SimpleStandard#State[MBeans:type=SimpleStandard]", "getAttribute";
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy23	Tue Feb 21 22:35:29 2017 +0100
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy23	Thu Feb 23 20:35:25 2017 +0530
@@ -1,6 +1,7 @@
 grant codebase "file:/-" {
     permission javax.security.auth.AuthPermission "createLoginContext.JMXPluggableAuthenticator";
     permission java.net.SocketPermission "*:*", "accept,connect,listen,resolve";
+    permission java.lang.RuntimePermission "*";
     permission java.security.SecurityPermission "createAccessControlContext";
     permission javax.management.MBeanPermission "*", "getDomains";
     permission javax.management.MBeanPermission "SimpleStandard#State[MBeans:type=SimpleStandard]", "getAttribute";
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy24	Tue Feb 21 22:35:29 2017 +0100
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy24	Thu Feb 23 20:35:25 2017 +0530
@@ -1,5 +1,6 @@
 grant codebase "file:/-" {
     permission javax.security.auth.AuthPermission "createLoginContext.JMXPluggableAuthenticator";
+    permission java.lang.RuntimePermission "*";
     permission java.net.SocketPermission "*:*", "accept,connect,listen,resolve";
     permission java.security.SecurityPermission "createAccessControlContext";
     permission javax.management.remote.SubjectDelegationPermission "javax.management.remote.JMXPrincipal.monitorRole";
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy25	Tue Feb 21 22:35:29 2017 +0100
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy25	Thu Feb 23 20:35:25 2017 +0530
@@ -1,5 +1,6 @@
 grant codebase "file:/-" {
     permission javax.security.auth.AuthPermission "createLoginContext.JMXPluggableAuthenticator";
+    permission java.lang.RuntimePermission "*";
     permission java.net.SocketPermission "*:*", "accept,connect,listen,resolve";
     permission java.security.SecurityPermission "createAccessControlContext";
     permission javax.management.remote.SubjectDelegationPermission "javax.management.remote.JMXPrincipal.monitorRole";
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy31	Tue Feb 21 22:35:29 2017 +0100
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy31	Thu Feb 23 20:35:25 2017 +0530
@@ -1,6 +1,7 @@
 grant codebase "file:/-" {
     permission javax.security.auth.AuthPermission "createLoginContext.JMXPluggableAuthenticator";
     permission java.net.SocketPermission "*:*", "accept,connect,listen,resolve";
+    permission java.lang.RuntimePermission "*";
     permission java.security.SecurityPermission "createAccessControlContext";
     permission javax.management.MBeanPermission "*", "getDomains";
     permission javax.management.MBeanPermission "SimpleStandard#State[MBeans:type=SimpleStandard]", "getAttribute";
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy32	Tue Feb 21 22:35:29 2017 +0100
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy32	Thu Feb 23 20:35:25 2017 +0530
@@ -1,6 +1,7 @@
 grant codebase "file:/-" {
     permission javax.security.auth.AuthPermission "createLoginContext.JMXPluggableAuthenticator";
     permission java.net.SocketPermission "*:*", "accept,connect,listen,resolve";
+    permission java.lang.RuntimePermission "*";
     permission java.security.SecurityPermission "createAccessControlContext";
 //    permission javax.management.MBeanPermission "*", "getDomains";
     permission javax.management.MBeanPermission "SimpleStandard#State[MBeans:type=SimpleStandard]", "getAttribute";
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy33	Tue Feb 21 22:35:29 2017 +0100
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy33	Thu Feb 23 20:35:25 2017 +0530
@@ -1,6 +1,7 @@
 grant codebase "file:/-" {
     permission javax.security.auth.AuthPermission "createLoginContext.JMXPluggableAuthenticator";
     permission java.net.SocketPermission "*:*", "accept,connect,listen,resolve";
+    permission java.lang.RuntimePermission "*";
     permission java.security.SecurityPermission "createAccessControlContext";
     permission javax.management.MBeanPermission "*", "getDomains";
     permission javax.management.MBeanPermission "SimpleStandard#State[MBeans:type=SimpleStandard]", "getAttribute";
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy34	Tue Feb 21 22:35:29 2017 +0100
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy34	Thu Feb 23 20:35:25 2017 +0530
@@ -1,5 +1,6 @@
 grant codebase "file:/-" {
     permission javax.security.auth.AuthPermission "createLoginContext.JMXPluggableAuthenticator";
+    permission java.lang.RuntimePermission "*";
     permission java.net.SocketPermission "*:*", "accept,connect,listen,resolve";
     permission java.security.SecurityPermission "createAccessControlContext";
     permission javax.management.remote.SubjectDelegationPermission "javax.management.remote.JMXPrincipal.monitorRole";
--- a/test/javax/management/remote/mandatory/subjectDelegation/policy35	Tue Feb 21 22:35:29 2017 +0100
+++ b/test/javax/management/remote/mandatory/subjectDelegation/policy35	Thu Feb 23 20:35:25 2017 +0530
@@ -1,5 +1,6 @@
 grant codebase "file:/-" {
     permission javax.security.auth.AuthPermission "createLoginContext.JMXPluggableAuthenticator";
+    permission java.lang.RuntimePermission "*";
     permission java.net.SocketPermission "*:*", "accept,connect,listen,resolve";
     permission java.security.SecurityPermission "createAccessControlContext";
     permission javax.management.remote.SubjectDelegationPermission "javax.management.remote.JMXPrincipal.monitorRole";