test/java/rmi/server/useCustomRef/UseCustomRef.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1998, 2007, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 1998, 2012, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 33,42 **** --- 33,43 ---- * @library ../../testlibrary * @build UseCustomRef * @build Ping * @build UseCustomRef_Stub * @build UseCustomRef_Skel + * @build TestLibrary * @run main/othervm/policy=security.policy/secure=java.rmi.RMISecurityManager/timeout=120 UseCustomRef * * This test was failing to run because the synthetic access * control context used by the application class loader to find and define * CustomServerRef does not have accessClassInPackage.sun.rmi.server runtime
*** 82,93 **** * create registry */ TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); System.err.println("creating Registry..."); - registry = LocateRegistry.createRegistry(TestLibrary.REGISTRY_PORT); /* * create object with custom ref and bind in registry */ System.err.println("creating UseCustomRef..."); UseCustomRef cr = new UseCustomRef(); --- 83,95 ---- * create registry */ TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager"); System.err.println("creating Registry..."); + registry = TestLibrary.createRegistryOnUnusedPort(); + int port = TestLibrary.getRegistryPort(registry); /* * create object with custom ref and bind in registry */ System.err.println("creating UseCustomRef..."); UseCustomRef cr = new UseCustomRef();
*** 95,105 **** if (!(ref instanceof CustomServerRef)) { TestLibrary.bomb("test failed: reference not " + "instanceof CustomServerRef"); } ! String name = "//:" + TestLibrary.REGISTRY_PORT + "/UseCustomRef"; // String name = "UseCustomRef"; System.err.println("binding object in registry..."); Naming.rebind(name, cr); /* --- 97,107 ---- if (!(ref instanceof CustomServerRef)) { TestLibrary.bomb("test failed: reference not " + "instanceof CustomServerRef"); } ! String name = "//:" + port + "/UseCustomRef"; // String name = "UseCustomRef"; System.err.println("binding object in registry..."); Naming.rebind(name, cr); /*