--- old/test/TEST.groups Mon Feb 6 21:19:39 2017 +++ new/test/TEST.groups Mon Feb 6 21:19:39 2017 @@ -273,6 +273,7 @@ jdk/internal/jline \ com/sun/jndi \ com/sun/corba \ + org/omg/CORBA \ lib/testlibrary \ sample --- /dev/null Mon Feb 6 21:19:41 2017 +++ new/test/org/omg/CORBA/OrbPropertiesTest.java Mon Feb 6 21:19:41 2017 @@ -0,0 +1,74 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; + +import org.omg.CORBA.ORB; + +/* + * @test + * @bug 8049375 + * @summary Extend how the org.omg.CORBA.ORB handles the search for orb.properties + * @library /lib/testlibrary + * @build jdk.testlibrary.* + * @modules java.corba + * @compile OrbPropertiesTest.java TestOrbImpl.java TestSingletonOrbImpl.java + * @run main/othervm + * -Djava.naming.provider.url=iiop://localhost:1050 + * -Djava.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory + * OrbPropertiesTest -port 1049 + */ +public class OrbPropertiesTest { + + public static void main(String[] args) throws Exception { + updateOrbPropertiesFile(); + // create and initialize the ORB + ORB orb = ORB.init(args, null); + if (!(orb instanceof TestOrbImpl)) { + throw new RuntimeException("org.omg.CORBA.ORBClass property not set as expected"); + } + ORB singletonOrb = ORB.init(); + System.out.println("singletonOrb class == " + singletonOrb.getClass().getName()); + if (!(singletonOrb instanceof TestSingletonOrbImpl)) { + throw new RuntimeException("org.omg.CORBA.ORBSingletonClass property not set as expected"); + } + + } + + private static void updateOrbPropertiesFile() throws Exception { + String orbPropertiesFile = System.getProperty("java.home", ".") + "/conf/orb.properties"; + String orbClassMapping = "org.omg.CORBA.ORBClass TestOrbImpl"; + String orbSingletonClassMapping = "org.omg.CORBA.ORBSingletonClass TestSingletonOrbImpl"; + String orbPropertiesMappings = orbClassMapping + "\n" + orbSingletonClassMapping +"\n"; + try (PrintWriter hfPWriter = new PrintWriter(new BufferedWriter( + new FileWriter(orbPropertiesFile, false)))) { + hfPWriter.println(orbPropertiesMappings); + } catch (IOException ioEx) { + ioEx.printStackTrace(); + throw ioEx; + } + } +} --- /dev/null Mon Feb 6 21:19:43 2017 +++ new/test/org/omg/CORBA/TestOrbImpl.java Mon Feb 6 21:19:42 2017 @@ -0,0 +1,233 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.applet.Applet; +import java.util.Properties; + +import org.omg.CORBA.Any; +import org.omg.CORBA.Context; +import org.omg.CORBA.ContextList; +import org.omg.CORBA.Environment; +import org.omg.CORBA.ExceptionList; +import org.omg.CORBA.NVList; +import org.omg.CORBA.NamedValue; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Object; +import org.omg.CORBA.Request; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.UnionMember; +import org.omg.CORBA.WrongTransaction; +import org.omg.CORBA.ORBPackage.InvalidName; +import org.omg.CORBA.portable.OutputStream; + + +public class TestOrbImpl extends ORB{ + + @Override + protected void set_parameters(String[] args, Properties props) { + // TODO Auto-generated method stub + + } + + @Override + protected void set_parameters(Applet app, Properties props) { + // TODO Auto-generated method stub + + } + + @Override + public String[] list_initial_services() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Object resolve_initial_references(String object_name) + throws InvalidName { + // TODO Auto-generated method stub + return null; + } + + @Override + public String object_to_string(Object obj) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Object string_to_object(String str) { + // TODO Auto-generated method stub + return null; + } + + @Override + public NVList create_list(int count) { + // TODO Auto-generated method stub + return null; + } + + @Override + public NamedValue create_named_value(String s, Any any, int flags) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ExceptionList create_exception_list() { + // TODO Auto-generated method stub + return null; + } + + @Override + public ContextList create_context_list() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Context get_default_context() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Environment create_environment() { + // TODO Auto-generated method stub + return null; + } + + @Override + public OutputStream create_output_stream() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void send_multiple_requests_oneway(Request[] req) { + // TODO Auto-generated method stub + + } + + @Override + public void send_multiple_requests_deferred(Request[] req) { + // TODO Auto-generated method stub + + } + + @Override + public boolean poll_next_response() { + // TODO Auto-generated method stub + return false; + } + + @Override + public Request get_next_response() throws WrongTransaction { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode get_primitive_tc(TCKind tcKind) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_struct_tc(String id, String name, + StructMember[] members) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_union_tc(String id, String name, + TypeCode discriminator_type, UnionMember[] members) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_enum_tc(String id, String name, String[] members) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_alias_tc(String id, String name, + TypeCode original_type) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_exception_tc(String id, String name, + StructMember[] members) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_interface_tc(String id, String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_string_tc(int bound) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_wstring_tc(int bound) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_sequence_tc(int bound, TypeCode element_type) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_recursive_sequence_tc(int bound, int offset) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_array_tc(int length, TypeCode element_type) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Any create_any() { + // TODO Auto-generated method stub + return null; + } + +} --- /dev/null Mon Feb 6 21:19:44 2017 +++ new/test/org/omg/CORBA/TestSingletonOrbImpl.java Mon Feb 6 21:19:44 2017 @@ -0,0 +1,233 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.applet.Applet; +import java.util.Properties; + +import org.omg.CORBA.Any; +import org.omg.CORBA.Context; +import org.omg.CORBA.ContextList; +import org.omg.CORBA.Environment; +import org.omg.CORBA.ExceptionList; +import org.omg.CORBA.NVList; +import org.omg.CORBA.NamedValue; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Object; +import org.omg.CORBA.Request; +import org.omg.CORBA.StructMember; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.UnionMember; +import org.omg.CORBA.WrongTransaction; +import org.omg.CORBA.ORBPackage.InvalidName; +import org.omg.CORBA.portable.OutputStream; + + +public class TestSingletonOrbImpl extends ORB { + + @Override + protected void set_parameters(String[] args, Properties props) { + // TODO Auto-generated method stub + + } + + @Override + protected void set_parameters(Applet app, Properties props) { + // TODO Auto-generated method stub + + } + + @Override + public String[] list_initial_services() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Object resolve_initial_references(String object_name) + throws InvalidName { + // TODO Auto-generated method stub + return null; + } + + @Override + public String object_to_string(Object obj) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Object string_to_object(String str) { + // TODO Auto-generated method stub + return null; + } + + @Override + public NVList create_list(int count) { + // TODO Auto-generated method stub + return null; + } + + @Override + public NamedValue create_named_value(String s, Any any, int flags) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ExceptionList create_exception_list() { + // TODO Auto-generated method stub + return null; + } + + @Override + public ContextList create_context_list() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Context get_default_context() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Environment create_environment() { + // TODO Auto-generated method stub + return null; + } + + @Override + public OutputStream create_output_stream() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void send_multiple_requests_oneway(Request[] req) { + // TODO Auto-generated method stub + + } + + @Override + public void send_multiple_requests_deferred(Request[] req) { + // TODO Auto-generated method stub + + } + + @Override + public boolean poll_next_response() { + // TODO Auto-generated method stub + return false; + } + + @Override + public Request get_next_response() throws WrongTransaction { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode get_primitive_tc(TCKind tcKind) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_struct_tc(String id, String name, + StructMember[] members) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_union_tc(String id, String name, + TypeCode discriminator_type, UnionMember[] members) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_enum_tc(String id, String name, String[] members) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_alias_tc(String id, String name, + TypeCode original_type) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_exception_tc(String id, String name, + StructMember[] members) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_interface_tc(String id, String name) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_string_tc(int bound) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_wstring_tc(int bound) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_sequence_tc(int bound, TypeCode element_type) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_recursive_sequence_tc(int bound, int offset) { + // TODO Auto-generated method stub + return null; + } + + @Override + public TypeCode create_array_tc(int length, TypeCode element_type) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Any create_any() { + // TODO Auto-generated method stub + return null; + } + +}