< prev index next >

jdk/test/javax/rmi/PortableRemoteObject/8146975/RmiIiopReturnValueTest.java

Print this page




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  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 8146975
  27  * @summary test RMI-IIOP with value object return

  28  * @library /lib/testlibrary
  29  * @build jdk.testlibrary.*
  30  * @compile -addmods java.corba Test.java Test3.java Test4.java
  31  *    HelloInterface.java HelloServer.java
  32  *    HelloClient.java HelloImpl.java _HelloImpl_Tie.java _HelloInterface_Stub.java
  33  *    RmiIiopReturnValueTest.java
  34  * @run main/othervm -addmods java.corba
  35  *    -Djava.naming.provider.url=iiop://localhost:5050
  36  *    -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
  37  *    RmiIiopReturnValueTest -port 5049
  38  * @run main/othervm/secure=java.lang.SecurityManager/policy=jtreg.test.policy
  39  *    -addmods java.corba -Djava.naming.provider.url=iiop://localhost:5050
  40  *    -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
  41  *    RmiIiopReturnValueTest -port 5049
  42  */
  43 
  44 
  45 import java.util.ArrayList;
  46 import java.util.Arrays;
  47 import java.util.List;
  48 import jdk.testlibrary.JDKToolFinder;
  49 import jdk.testlibrary.JDKToolLauncher;
  50 
  51 public class RmiIiopReturnValueTest {
  52 
  53     static final String ORBD = JDKToolFinder.getTestJDKTool("orbd");
  54     static final String JAVA = JDKToolFinder.getTestJDKTool("java");
  55     static final JDKToolLauncher orbdLauncher = JDKToolLauncher.createUsingTestJDK("orbd");
  56     static final String CLASSPATH = System.getProperty("java.class.path");
  57     static final int FIVE_SECONDS = 5000;
  58 
  59     private static Throwable clientException;


  85         }
  86     }
  87 
  88     static void startOrbd() throws Exception {
  89         System.out.println("\nStarting orbd with NS port 5050 and activation port 5049 ");
  90 
  91         //orbd -ORBInitialHost localhost -ORBInitialPort 5050 -port 5049
  92         orbdLauncher.addToolArg("-ORBInitialHost").addToolArg("localhost")
  93             .addToolArg("-ORBInitialPort").addToolArg("5050")
  94             .addToolArg("-port").addToolArg("5049");
  95 
  96         System.out.println("RmiIiopReturnValueTest: Executing: " + Arrays.asList(orbdLauncher.getCommand()));
  97         ProcessBuilder pb = new ProcessBuilder(orbdLauncher.getCommand());
  98         pb.redirectError(ProcessBuilder.Redirect.INHERIT);
  99         orbdProcess = pb.start();
 100     }
 101 
 102 
 103     static void startRmiIiopServer() throws Exception {
 104         System.out.println("\nStarting RmiIiopServer");
 105         // java -addmods java.corba -cp .
 106         // -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
 107         // -Djava.naming.provider.url=iiop://localhost:5050 HelloServer -port 5049
 108         List<String> commands = new ArrayList<>();
 109         commands.add(RmiIiopReturnValueTest.JAVA);
 110         commands.add("-addmods");
 111         commands.add("java.corba");
 112         commands.add("-Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory");
 113         commands.add("-Djava.naming.provider.url=iiop://localhost:5050");
 114         commands.add("-cp");
 115         commands.add(RmiIiopReturnValueTest.CLASSPATH);
 116         commands.add("HelloServer");
 117         commands.add("-port");
 118         commands.add("5049");
 119 
 120         System.out.println("RmiIiopReturnValueTest: Executing: " + commands);
 121         ProcessBuilder pb = new ProcessBuilder(commands);
 122         pb.redirectError(ProcessBuilder.Redirect.INHERIT);
 123         rmiServerProcess = pb.start();
 124     }
 125 
 126     static boolean isResponseReceived() {
 127         return HelloClient.isResponseReceived();
 128     }
 129 
 130     static void stopRmiIiopServer() throws Exception {




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  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 8146975
  27  * @summary test RMI-IIOP with value object return
  28  * @modules java.corba
  29  * @library /lib/testlibrary
  30  * @build jdk.testlibrary.*
  31  * @compile Test.java Test3.java Test4.java
  32  *    HelloInterface.java HelloServer.java
  33  *    HelloClient.java HelloImpl.java _HelloImpl_Tie.java _HelloInterface_Stub.java
  34  *    RmiIiopReturnValueTest.java
  35  * @run main/othervm
  36  *    -Djava.naming.provider.url=iiop://localhost:5050
  37  *    -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
  38  *    RmiIiopReturnValueTest -port 5049
  39  * @run main/othervm/secure=java.lang.SecurityManager/policy=jtreg.test.policy
  40  *    -Djava.naming.provider.url=iiop://localhost:5050
  41  *    -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
  42  *    RmiIiopReturnValueTest -port 5049
  43  */
  44 
  45 
  46 import java.util.ArrayList;
  47 import java.util.Arrays;
  48 import java.util.List;
  49 import jdk.testlibrary.JDKToolFinder;
  50 import jdk.testlibrary.JDKToolLauncher;
  51 
  52 public class RmiIiopReturnValueTest {
  53 
  54     static final String ORBD = JDKToolFinder.getTestJDKTool("orbd");
  55     static final String JAVA = JDKToolFinder.getTestJDKTool("java");
  56     static final JDKToolLauncher orbdLauncher = JDKToolLauncher.createUsingTestJDK("orbd");
  57     static final String CLASSPATH = System.getProperty("java.class.path");
  58     static final int FIVE_SECONDS = 5000;
  59 
  60     private static Throwable clientException;


  86         }
  87     }
  88 
  89     static void startOrbd() throws Exception {
  90         System.out.println("\nStarting orbd with NS port 5050 and activation port 5049 ");
  91 
  92         //orbd -ORBInitialHost localhost -ORBInitialPort 5050 -port 5049
  93         orbdLauncher.addToolArg("-ORBInitialHost").addToolArg("localhost")
  94             .addToolArg("-ORBInitialPort").addToolArg("5050")
  95             .addToolArg("-port").addToolArg("5049");
  96 
  97         System.out.println("RmiIiopReturnValueTest: Executing: " + Arrays.asList(orbdLauncher.getCommand()));
  98         ProcessBuilder pb = new ProcessBuilder(orbdLauncher.getCommand());
  99         pb.redirectError(ProcessBuilder.Redirect.INHERIT);
 100         orbdProcess = pb.start();
 101     }
 102 
 103 
 104     static void startRmiIiopServer() throws Exception {
 105         System.out.println("\nStarting RmiIiopServer");
 106         // java --add-modules java.corba -cp .
 107         // -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory
 108         // -Djava.naming.provider.url=iiop://localhost:5050 HelloServer -port 5049
 109         List<String> commands = new ArrayList<>();
 110         commands.add(RmiIiopReturnValueTest.JAVA);
 111         commands.add("--add-modules");
 112         commands.add("java.corba");
 113         commands.add("-Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory");
 114         commands.add("-Djava.naming.provider.url=iiop://localhost:5050");
 115         commands.add("-cp");
 116         commands.add(RmiIiopReturnValueTest.CLASSPATH);
 117         commands.add("HelloServer");
 118         commands.add("-port");
 119         commands.add("5049");
 120 
 121         System.out.println("RmiIiopReturnValueTest: Executing: " + commands);
 122         ProcessBuilder pb = new ProcessBuilder(commands);
 123         pb.redirectError(ProcessBuilder.Redirect.INHERIT);
 124         rmiServerProcess = pb.start();
 125     }
 126 
 127     static boolean isResponseReceived() {
 128         return HelloClient.isResponseReceived();
 129     }
 130 
 131     static void stopRmiIiopServer() throws Exception {


< prev index next >