< prev index next >

test/jdk/javax/management/security/AuthorizationTest.java

Print this page
rev 51638 : [mq]: 8210112


  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8058865
  27  * @summary Checks various authentication behavior from remote jmx client
  28  * @author Olivier Lagneau
  29  * @modules java.management.rmi
  30  * @library /lib/testlibrary

  31  * @compile Simple.java
  32  * @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=username1 -Dpassword=password1 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials
  33  * @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=username2 -Dpassword=password2 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials -expectedCreateException -expectedSetException -expectedInvokeException
  34  * @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=username6 -Dpassword=password6 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials -expectedCreateException -expectedGetException -expectedSetException -expectedInvokeException
  35  * @run main/othervm/timeout=300/policy=java.policy.authorization -DDEBUG_STANDARD -Dusername=username1 -Dpassword=password1 AuthorizationTest -server -mapType x.password.file -populate -client -mapType credentials
  36  * @run main/othervm/timeout=300/policy=java.policy.authorization -DDEBUG_STANDARD -Dusername=username3 -Dpassword=password3 AuthorizationTest -server -mapType x.password.file -populate -client -mapType credentials -expectedGetException
  37  * @run main/othervm/timeout=300/policy=java.policy.authorization -DDEBUG_STANDARD -Dusername=username5 -Dpassword=password5 AuthorizationTest -server -mapType x.password.file -populate -client -mapType credentials -expectedCreateException -expectedGetException -expectedSetException -expectedInvokeException
  38  * @run main/othervm/timeout=300/policy=java.policy.authorization -DDEBUG_STANDARD -Dusername=username6 -Dpassword=password6 AuthorizationTest -server -mapType x.password.file -populate -client -mapType credentials -expectedCreateException -expectedGetException -expectedSetException -expectedInvokeException
  39  * @run main/othervm/timeout=300/policy=java.policy.authorization -DDEBUG_STANDARD -Dusername=username1 -Dpassword=password1 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials
  40  * @run main/othervm/timeout=300/policy=java.policy.authorization -DDEBUG_STANDARD -Dusername=username2 -Dpassword=password2 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials -expectedCreateException -expectedSetException -expectedInvokeException
  41  * @run main/othervm/timeout=300/policy=java.policy.authorization -DDEBUG_STANDARD -Dusername=username3 -Dpassword=password3 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials -expectedCreateException -expectedGetException -expectedSetException -expectedInvokeException
  42  * @run main/othervm/timeout=300/policy=java.policy.authorization -DDEBUG_STANDARD -Dusername=username4 -Dpassword=password4 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials -expectedGetException -expectedSetException
  43  * @run main/othervm/timeout=300/policy=java.policy.authorization -DDEBUG_STANDARD -Dusername=username5 -Dpassword=password5 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials -expectedCreateException -expectedGetException -expectedSetException -expectedInvokeException
  44  */
  45 
  46 import java.io.File;
  47 import java.util.Map ;
  48 import java.util.HashMap ;
  49 import java.util.List;
  50 import java.util.ArrayList;
  51 import java.util.Arrays;
  52 
  53 import java.lang.management.ManagementFactory;
  54 
  55 import javax.management.MBeanServer;
  56 import javax.management.MBeanServerFactory ;
  57 import javax.management.MBeanServerConnection;
  58 import javax.management.remote.JMXConnector;
  59 import javax.management.remote.JMXConnectorFactory;
  60 import javax.management.remote.JMXConnectorServer;
  61 import javax.management.remote.JMXConnectorServerFactory;
  62 import javax.management.remote.JMXServiceURL;
  63 
  64 import javax.management.Attribute ;
  65 import javax.management.ObjectName ;
  66 
  67 import jdk.testlibrary.ProcessTools;
  68 import jdk.testlibrary.JDKToolFinder;
  69 
  70 public class AuthorizationTest {
  71 
  72     static final String SERVER_CLASS_NAME = "AuthorizationTest";
  73     static final String CLIENT_CLASS_NAME = "AuthorizationTest$ClientSide";
  74     static final String CLIENT_CLASS_MAIN = CLIENT_CLASS_NAME;
  75 
  76     static final String USERNAME_PROPERTY = "username";
  77     static final String PASSWORD_PROPERTY = "password";
  78 
  79     private JMXConnectorServer cs;
  80 
  81     /*
  82      * First Debug properties and arguments are collect in expected
  83      * map  (argName, value) format, then calls original test's run method.
  84      */
  85     public static void main(String args[]) throws Exception {
  86 
  87         System.out.println("=================================================");




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8058865
  27  * @summary Checks various authentication behavior from remote jmx client
  28  * @author Olivier Lagneau
  29  * @modules java.management.rmi
  30  * @library /lib/testlibrary
  31  * @library /test/lib
  32  * @compile Simple.java
  33  * @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=username1 -Dpassword=password1 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials
  34  * @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=username2 -Dpassword=password2 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials -expectedCreateException -expectedSetException -expectedInvokeException
  35  * @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=username6 -Dpassword=password6 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials -expectedCreateException -expectedGetException -expectedSetException -expectedInvokeException
  36  * @run main/othervm/timeout=300/policy=java.policy.authorization -DDEBUG_STANDARD -Dusername=username1 -Dpassword=password1 AuthorizationTest -server -mapType x.password.file -populate -client -mapType credentials
  37  * @run main/othervm/timeout=300/policy=java.policy.authorization -DDEBUG_STANDARD -Dusername=username3 -Dpassword=password3 AuthorizationTest -server -mapType x.password.file -populate -client -mapType credentials -expectedGetException
  38  * @run main/othervm/timeout=300/policy=java.policy.authorization -DDEBUG_STANDARD -Dusername=username5 -Dpassword=password5 AuthorizationTest -server -mapType x.password.file -populate -client -mapType credentials -expectedCreateException -expectedGetException -expectedSetException -expectedInvokeException
  39  * @run main/othervm/timeout=300/policy=java.policy.authorization -DDEBUG_STANDARD -Dusername=username6 -Dpassword=password6 AuthorizationTest -server -mapType x.password.file -populate -client -mapType credentials -expectedCreateException -expectedGetException -expectedSetException -expectedInvokeException
  40  * @run main/othervm/timeout=300/policy=java.policy.authorization -DDEBUG_STANDARD -Dusername=username1 -Dpassword=password1 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials
  41  * @run main/othervm/timeout=300/policy=java.policy.authorization -DDEBUG_STANDARD -Dusername=username2 -Dpassword=password2 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials -expectedCreateException -expectedSetException -expectedInvokeException
  42  * @run main/othervm/timeout=300/policy=java.policy.authorization -DDEBUG_STANDARD -Dusername=username3 -Dpassword=password3 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials -expectedCreateException -expectedGetException -expectedSetException -expectedInvokeException
  43  * @run main/othervm/timeout=300/policy=java.policy.authorization -DDEBUG_STANDARD -Dusername=username4 -Dpassword=password4 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials -expectedGetException -expectedSetException
  44  * @run main/othervm/timeout=300/policy=java.policy.authorization -DDEBUG_STANDARD -Dusername=username5 -Dpassword=password5 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials -expectedCreateException -expectedGetException -expectedSetException -expectedInvokeException
  45  */
  46 
  47 import java.io.File;
  48 import java.util.Map ;
  49 import java.util.HashMap ;
  50 import java.util.List;
  51 import java.util.ArrayList;
  52 import java.util.Arrays;
  53 
  54 import java.lang.management.ManagementFactory;
  55 
  56 import javax.management.MBeanServer;
  57 import javax.management.MBeanServerFactory ;
  58 import javax.management.MBeanServerConnection;
  59 import javax.management.remote.JMXConnector;
  60 import javax.management.remote.JMXConnectorFactory;
  61 import javax.management.remote.JMXConnectorServer;
  62 import javax.management.remote.JMXConnectorServerFactory;
  63 import javax.management.remote.JMXServiceURL;
  64 
  65 import javax.management.Attribute ;
  66 import javax.management.ObjectName ;
  67 
  68 import jdk.test.lib.process.ProcessTools;
  69 import jdk.testlibrary.JDKToolFinder;
  70 
  71 public class AuthorizationTest {
  72 
  73     static final String SERVER_CLASS_NAME = "AuthorizationTest";
  74     static final String CLIENT_CLASS_NAME = "AuthorizationTest$ClientSide";
  75     static final String CLIENT_CLASS_MAIN = CLIENT_CLASS_NAME;
  76 
  77     static final String USERNAME_PROPERTY = "username";
  78     static final String PASSWORD_PROPERTY = "password";
  79 
  80     private JMXConnectorServer cs;
  81 
  82     /*
  83      * First Debug properties and arguments are collect in expected
  84      * map  (argName, value) format, then calls original test's run method.
  85      */
  86     public static void main(String args[]) throws Exception {
  87 
  88         System.out.println("=================================================");


< prev index next >