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 8068721 27 * @summary test RMI-IIOP call with ConcurrentHashMap as an argument 28 * @library /lib/testlibrary 29 * @modules java.corba 30 * @build jdk.testlibrary.* 31 * @compile -addmods java.corba Test.java HelloInterface.java HelloServer.java HelloClient.java 32 * HelloImpl.java _HelloImpl_Tie.java _HelloInterface_Stub.java ConcurrentHashMapTest.java 33 * @run main/othervm -addmods java.corba -Djava.naming.provider.url=iiop://localhost:1050 34 * -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory ConcurrentHashMapTest 35 * @run main/othervm/secure=java.lang.SecurityManager/policy=jtreg.test.policy 36 * -addmods java.corba -Djava.naming.provider.url=iiop://localhost:1050 37 * -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory ConcurrentHashMapTest 38 * @key intermittent 39 */ 40 41 42 import java.util.ArrayList; 43 import java.util.Arrays; 44 import java.util.List; 45 import jdk.testlibrary.JDKToolFinder; 46 import jdk.testlibrary.JDKToolLauncher; 47 48 public class ConcurrentHashMapTest { 49 50 static final String ORBD = JDKToolFinder.getTestJDKTool("orbd"); 51 static final String JAVA = JDKToolFinder.getTestJDKTool("java"); 52 static final JDKToolLauncher orbdLauncher = JDKToolLauncher.createUsingTestJDK("orbd"); 53 static final String CLASSPATH = System.getProperty("java.class.path"); 54 static final int FIVE_SECONDS = 5000; 55 56 private static Exception clientException; 81 throw new RuntimeException("Expected Response not received"); 82 } 83 } 84 85 static void startOrbd() throws Exception { 86 System.out.println("\nStarting orbd with NS port 1050 "); 87 88 //orbd -ORBInitialHost localhost -ORBInitialPort 1050 89 orbdLauncher.addToolArg("-ORBInitialHost").addToolArg("localhost") 90 .addToolArg("-ORBInitialPort").addToolArg("1050"); 91 92 System.out.println("ConcurrentHashMapTest: Executing: " + Arrays.asList(orbdLauncher.getCommand())); 93 ProcessBuilder pb = new ProcessBuilder(orbdLauncher.getCommand()); 94 pb.redirectError(ProcessBuilder.Redirect.INHERIT); 95 orbdProcess = pb.start(); 96 } 97 98 99 static void startRmiIiopServer() throws Exception { 100 System.out.println("\nStarting RmiServer"); 101 // java -cp . -addmods java.corba 102 // -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory 103 // -Djava.naming.provider.url=iiop://localhost:1050 HelloServer 104 List<String> commands = new ArrayList<>(); 105 commands.add(ConcurrentHashMapTest.JAVA); 106 commands.add("-addmods"); 107 commands.add("java.corba"); 108 commands.add("-Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory"); 109 commands.add("-Djava.naming.provider.url=iiop://localhost:1050"); 110 commands.add("-cp"); 111 commands.add(ConcurrentHashMapTest.CLASSPATH); 112 commands.add("HelloServer"); 113 114 System.out.println("ConcurrentHashMapTest: Executing: " + commands); 115 ProcessBuilder pb = new ProcessBuilder(commands); 116 pb.redirectError(ProcessBuilder.Redirect.INHERIT); 117 rmiServerProcess = pb.start(); 118 } 119 120 static boolean isResponseReceived() { 121 return HelloClient.isResponseReceived(); 122 } 123 124 static void stopRmiIiopServer() throws Exception { 125 rmiServerProcess.destroyForcibly(); 126 rmiServerProcess.waitFor(); | 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 8068721 27 * @summary test RMI-IIOP call with ConcurrentHashMap as an argument 28 * @library /lib/testlibrary 29 * @modules java.corba 30 * @build jdk.testlibrary.* 31 * @compile Test.java HelloInterface.java HelloServer.java HelloClient.java 32 * HelloImpl.java _HelloImpl_Tie.java _HelloInterface_Stub.java ConcurrentHashMapTest.java 33 * @run main/othervm -Djava.naming.provider.url=iiop://localhost:1050 34 * -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory ConcurrentHashMapTest 35 * @run main/othervm/secure=java.lang.SecurityManager/policy=jtreg.test.policy 36 * -Djava.naming.provider.url=iiop://localhost:1050 37 * -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory ConcurrentHashMapTest 38 * @key intermittent 39 */ 40 41 42 import java.util.ArrayList; 43 import java.util.Arrays; 44 import java.util.List; 45 import jdk.testlibrary.JDKToolFinder; 46 import jdk.testlibrary.JDKToolLauncher; 47 48 public class ConcurrentHashMapTest { 49 50 static final String ORBD = JDKToolFinder.getTestJDKTool("orbd"); 51 static final String JAVA = JDKToolFinder.getTestJDKTool("java"); 52 static final JDKToolLauncher orbdLauncher = JDKToolLauncher.createUsingTestJDK("orbd"); 53 static final String CLASSPATH = System.getProperty("java.class.path"); 54 static final int FIVE_SECONDS = 5000; 55 56 private static Exception clientException; 81 throw new RuntimeException("Expected Response not received"); 82 } 83 } 84 85 static void startOrbd() throws Exception { 86 System.out.println("\nStarting orbd with NS port 1050 "); 87 88 //orbd -ORBInitialHost localhost -ORBInitialPort 1050 89 orbdLauncher.addToolArg("-ORBInitialHost").addToolArg("localhost") 90 .addToolArg("-ORBInitialPort").addToolArg("1050"); 91 92 System.out.println("ConcurrentHashMapTest: Executing: " + Arrays.asList(orbdLauncher.getCommand())); 93 ProcessBuilder pb = new ProcessBuilder(orbdLauncher.getCommand()); 94 pb.redirectError(ProcessBuilder.Redirect.INHERIT); 95 orbdProcess = pb.start(); 96 } 97 98 99 static void startRmiIiopServer() throws Exception { 100 System.out.println("\nStarting RmiServer"); 101 // java -cp . --add-modules java.corba 102 // -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory 103 // -Djava.naming.provider.url=iiop://localhost:1050 HelloServer 104 List<String> commands = new ArrayList<>(); 105 commands.add(ConcurrentHashMapTest.JAVA); 106 commands.add("--add-modules"); 107 commands.add("java.corba"); 108 commands.add("-Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory"); 109 commands.add("-Djava.naming.provider.url=iiop://localhost:1050"); 110 commands.add("-cp"); 111 commands.add(ConcurrentHashMapTest.CLASSPATH); 112 commands.add("HelloServer"); 113 114 System.out.println("ConcurrentHashMapTest: Executing: " + commands); 115 ProcessBuilder pb = new ProcessBuilder(commands); 116 pb.redirectError(ProcessBuilder.Redirect.INHERIT); 117 rmiServerProcess = pb.start(); 118 } 119 120 static boolean isResponseReceived() { 121 return HelloClient.isResponseReceived(); 122 } 123 124 static void stopRmiIiopServer() throws Exception { 125 rmiServerProcess.destroyForcibly(); 126 rmiServerProcess.waitFor(); |