diff options
Diffstat (limited to 'java')
384 files changed, 7763 insertions, 7991 deletions
diff --git a/java/allTests.py b/java/allTests.py index 68c2cae18d1..8c8825008fb 100755 --- a/java/allTests.py +++ b/java/allTests.py @@ -21,6 +21,11 @@ sys.path.append(os.path.join(toplevel)) from scripts import * # +# TODO: custom14 is commented out. We need to determine a java2 vs java5 build to determine +# which custom test to run. +# + +# # List of all basic tests. # tests = [ @@ -39,9 +44,10 @@ tests = [ ("Ice/adapterDeactivation", ["core"]), ("Ice/slicing/exceptions", ["core"]), ("Ice/slicing/objects", ["core"]), - ("Ice/custom", ["core"]), + #("Ice/custom14", ["core"]), + ("Ice/custom15", ["core"]), ("Ice/checksum", ["core"]), - ("Ice/package", ["core"]), + ("Ice/packagemd", ["core"]), ("Ice/stream", ["core"]), ("Ice/hold", ["core"]), ("Ice/retry", ["core"]), diff --git a/java/build.xml b/java/build.xml index 4ba03729fa1..e7e15e06b60 100644 --- a/java/build.xml +++ b/java/build.xml @@ -17,6 +17,8 @@ <!-- import common definitions --> <import file="config/common.xml"/> + <property name="generated.test.dir" value="generated.test"/> + <property name="test.dir" value="test"/> <property name="src.dir" value="src"/> <property name="lib.dir" value="lib${build.suffix}"/> <property name="cache.dir" value="depcache${build.suffix}"/> @@ -188,6 +190,7 @@ <include name="**/*.class"/> <exclude name="Freeze/**"/> <exclude name="IceGridGUI/**"/> + <exclude name="test/**"/> <exclude name="ant/**"/> <exclude name="*.jar"/> <manifest> @@ -197,6 +200,328 @@ </jar> </target> + <target name="test-generate" depends="tasks, task-init"> + <mkdir dir="${generated.test.dir}"/> + <!-- Create the output directory for generated code --> + <slice2java outputdir="${generated.test.dir}" dependencyfile="${generated.test.dir}/.depend.Test"> + <meta value="${java2metadata}"/> + <includepath> + <pathelement path="${slice.dir}" /> + </includepath> + <fileset dir="test/Ice/udp"> + <include name="Test.ice" /> + </fileset> + <fileset dir="test/Ice/adapterDeactivation"> + <include name="Test.ice" /> + </fileset> + <fileset dir="test/Ice/background"> + <include name="Test.ice" /> + </fileset> + <fileset dir="test/Ice/binding"> + <include name="Test.ice" /> + </fileset> + <fileset dir="test/Ice/exceptions"> + <include name="Test.ice" /> + <include name="TestAMD.ice" /> + </fileset> + <fileset dir="test/Ice/facets"> + <include name="Test.ice" /> + </fileset> + <fileset dir="test/Ice/faultTolerance"> + <include name="Test.ice" /> + </fileset> + <fileset dir="test/Ice/hold"> + <include name="Test.ice" /> + </fileset> + <fileset dir="test/Ice/inheritance"> + <include name="Test.ice" /> + </fileset> + <fileset dir="test/Ice/interceptor"> + <include name="Test.ice" /> + </fileset> + <fileset dir="test/Ice/location"> + <include name="Test.ice" /> + </fileset> + <fileset dir="test/Ice/operations"> + <include name="Test.ice" /> + <include name="TestAMD.ice" /> + </fileset> + <fileset dir="test/Ice/proxy"> + <include name="Test.ice" /> + <include name="TestAMD.ice" /> + </fileset> + <fileset dir="test/Ice/retry"> + <include name="Test.ice" /> + </fileset> + <fileset dir="test/Ice/seqMapping"> + <include name="Test.ice" /> + <include name="TestAMD.ice" /> + </fileset> + <fileset dir="test/Ice/servantLocator"> + <include name="Test.ice" /> + <include name="TestAMD.ice" /> + </fileset> + <fileset dir="test/Ice/serialize"> + <include name="Test.ice" /> + </fileset> + <fileset dir="test/Ice/slicing/exceptions"> + <include name="Test.ice" /> + <include name="ServerPrivate.ice" /> + <include name="ServerPrivateAMD.ice" /> + </fileset> + <fileset dir="test/Ice/slicing/objects"> + <include name="ServerPrivate.ice" /> + <include name="ServerPrivateAMD.ice" /> + <include name="ClientPrivate.ice" /> + </fileset> + <fileset dir="test/Ice/timeout"> + <include name="Test.ice" /> + </fileset> + <fileset dir="test/Freeze/complex"> + <include name="Complex.ice" /> + </fileset> + <fileset dir="test/Glacier2/router/"> + <include name="Callback.ice" /> + </fileset> + <fileset dir="test/IceGrid/simple/"> + <include name="Test.ice" /> + </fileset> + <fileset dir="test/IceBox/configuration/"> + <include name="Test.ice" /> + </fileset> + <fileset dir="test/IceSSL/configuration/"> + <include name="Test.ice" /> + </fileset> + <fileset dir="test/Slice/keyword/"> + <include name="Key.ice" /> + </fileset> + <fileset dir="test/Ice/throughput"> + <include name="Throughput.ice" /> + </fileset> + </slice2java> + + <slice2java tie="on" outputdir="${generated.test.dir}" dependencyfile="${generated.test.dir}/.depend.Test"> + <includepath> + <pathelement path="${slice.dir}" /> + </includepath> + <meta value="${java2metadata}"/> + <fileset dir="test/Freeze/evictor"> + <include name="Test.ice" /> + </fileset> + <fileset dir="test/Freeze/oldevictor"> + <include name="Test.ice" /> + </fileset> + </slice2java> + + <!-- test/Freeze/complex --> + <slice2freezej outputdir="${generated.test.dir}" dependencyfile="${generated.test.dir}/.depend.Test"> + <meta value="${java2metadata}"/> + <dict name="test.Freeze.complex.Complex.ComplexDict" key="Complex::Key" value="Complex::Node"/> + <fileset dir="test/Freeze/complex"> + <include name="Complex.ice" /> + </fileset> + </slice2freezej> + + <!-- test/Freeze/dbmap --> + <slice2freezej outputdir="${generated.test.dir}" dependencyfile="${generated.test.dir}/.depend.Test"> + <meta value="${java2metadata}"/> + <dict name="test.Freeze.dbmap.ByteIntMap" key="byte" value="int"/> + <dictindex name="test.Freeze.dbmap.ByteIntMap"/> + </slice2freezej> + <slice2freezej ice="on" outputdir="${generated.test.dir}"> + <meta value="${java2metadata}"/> + <includepath> + <pathelement path="${slice.dir}" /> + </includepath> + <fileset dir="${slice.dir}/Ice" includes="Identity.ice"/> + <dict name="test.Freeze.dbmap.IntIdentityMap" key="int" value="Ice::Identity"/> + </slice2freezej> + <slice2freezej ice="on" outputdir="${generated.test.dir}"> + <meta value="${java2metadata}"/> + <includepath> + <pathelement path="${slice.dir}" /> + </includepath> + <fileset dir="${slice.dir}/Ice" includes="Identity.ice"/> + <dict name="test.Freeze.dbmap.IntIdentityMapWithIndex" key="int" value="Ice::Identity"/> + <dictindex name="test.Freeze.dbmap.IntIdentityMapWithIndex" member="category"/> + </slice2freezej> + <slice2freezej ice="on" outputdir="${generated.test.dir}"> + <meta value="${java2metadata}"/> + <includepath> + <pathelement path="${slice.dir}" /> + </includepath> + <fileset dir="${slice.dir}/Ice" includes="Identity.ice"/> + <dict name="test.Freeze.dbmap.SortedMap" key="int" value="Ice::Identity"/> + <dictindex name="test.Freeze.dbmap.SortedMap" member="category"/> + </slice2freezej> + + <slice2java stream="on" outputdir="${generated.test.dir}" dependencyfile="${generated.test.dir}/.depend.Test"> + <meta value="${java2metadata}"/> + <includepath> + <pathelement path="${slice.dir}" /> + </includepath> + <fileset dir="test/Ice/objects"> + <include name="Test.ice" /> + </fileset> + <fileset dir="test/Ice/stream"> + <include name="Test.ice" /> + </fileset> + </slice2java> + + <slice2java checksum="test.Ice.checksum.Test.SliceChecksums" outputdir="${generated.test.dir}" dependencyfile="${generated.test.dir}/.depend.Test"> + <meta value="${java2metadata}"/> + <includepath> + <pathelement path="${slice.dir}" /> + </includepath> + <fileset dir="test/Ice/checksum"> + <include name="Test.ice" /> + <include name="Types.ice" /> + </fileset> + </slice2java> + + <slice2java outputdir="${generated.test.dir}" dependencyfile="${generated.test.dir}/.depend.Test"> + <meta value="${java2metadata}"/> + <includepath> + <pathelement path="${slice.dir}" /> + <pathelement path="test/Ice/packagemd" /> + </includepath> + <fileset dir="test/Ice/packagemd"> + <include name="Test.ice" /> + <include name="Package.ice" /> + <include name="NoPackage.ice" /> + </fileset> + </slice2java> + + <slice2java checksum="test.Ice.checksum.server.Test.SliceChecksums" outputdir="${generated.test.dir}" dependencyfile="${generated.test.dir}/.depend.Test"> + <meta value="${java2metadata}"/> + <includepath> + <pathelement path="${slice.dir}" /> + </includepath> + <fileset dir="test/Ice/checksum"> + <include name="TestServer.ice" /> + <include name="TypesServer.ice" /> + </fileset> + </slice2java> + </target> + + <target name="custom-test-generate4" depends="test-generate" if="java2"> + <!-- Create the output directory for generated code --> + <mkdir dir="${generated.test.dir}"/> + <slice2java outputdir="${generated.test.dir}" dependencyfile="${generated.test.dir}/.depend.Test"> + <meta value="${java2metadata}"/> + <fileset dir="test/Ice/custom14"> + <include name="Test.ice" /> + </fileset> + </slice2java> + </target> + + <target name="custom-test-generate5" depends="test-generate" unless="java2"> + <!-- Create the output directory for generated code --> + <mkdir dir="${generated.test.dir}"/> + <slice2java outputdir="${generated.test.dir}" dependencyfile="${generated.test.dir}/.depend.Test"> + <fileset dir="test/Ice/custom15"> + <include name="Test.ice" /> + </fileset> + </slice2java> + </target> + + <target name="custom-test-generate" depends="custom-test-generate4,custom-test-generate5"/> + + <target name="test-compile-generated" depends="ice-compile,test-generate,custom-test-generate"> + </target> + + <target name="test-compile-base" depends="test-compile-generated"> + <mkdir dir="${lib.dir}"/> + <mkdir dir="${cache.dir}"/> + <depend srcdir="." destdir="${lib.dir}" cache="${cache.dir}"/> + <javac destdir="${lib.dir}" + source="1.5" debug="${debug}" + deprecation="on"> + + <src path="."/> + <src path="${generated.test.dir}"/> + + <include name="test/Util/"/> + <include name="test/Ice/adapterDeactivation/"/> + <include name="test/Ice/background/"/> + <include name="test/Ice/binding/"/> + <include name="test/Ice/exceptions/"/> + <include name="test/Ice/exceptionsAMD/"/> + <include name="test/Ice/checksum/"/> + <include name="test/Ice/facets/"/> + <include name="test/Ice/faultTolerance/"/> + <include name="test/Ice/hold/"/> + <include name="test/Ice/inheritance/"/> + <include name="test/Ice/interceptor/"/> + <include name="test/Ice/location/"/> + <include name="test/Ice/objects/"/> + <include name="test/Ice/operations/"/> + <include name="test/Ice/operationsAMD/"/> + <include name="test/Ice/packagemd/"/> + <include name="test/Ice/proxy/"/> + <include name="test/Ice/proxyAMD/"/> + <include name="test/Ice/retry/"/> + <include name="test/Ice/serialize/"/> + <include name="test/Ice/servantLocator/"/> + <include name="test/Ice/servantLocatorAMD/"/> + <include name="test/Ice/seqMapping/"/> + <include name="test/Ice/seqMappingAMD/"/> + <include name="test/Ice/slicing/exceptions/"/> + <include name="test/Ice/slicing/objects/"/> + <include name="test/Ice/stream/"/> + <include name="test/Ice/timeout/"/> + <include name="test/Ice/udp/"/> + <include name="test/Freeze/complex/"/> + <include name="test/Freeze/dbmap/"/> + <include name="test/Freeze/evictor/"/> + <include name="test/Freeze/oldevictor/"/> + <include name="test/Glacier2/router/"/> + <include name="test/IceGrid/simple/"/> + <include name="test/IceBox/configuration/"/> + <include name="test/IceSSL/configuration/"/> + <include name="test/IceUtil/inputUtil/"/> + <include name="test/Slice/keyword/"/> + <include name="test/Ice/throughput/"/> + <compilerarg value="${javac.lint}"/> + </javac> + </target> + + <target name="test-custom-compile4" depends="test-compile-generated" if="java2"> + <mkdir dir="${lib.dir}"/> + <mkdir dir="${cache.dir}"/> + <depend srcdir="." destdir="${lib.dir}" cache="${cache.dir}"/> + <javac destdir="${lib.dir}" debug="${debug}"> + <src path="."/> + <src path="${generated.test.dir}"/> + <include name="test/Ice/custom14/"/> + </javac> + </target> + + <target name="test-custom-compile5" depends="test-compile-generated" unless="java2"> + <mkdir dir="${lib.dir}"/> + <mkdir dir="${cache.dir}"/> + <depend srcdir="." destdir="${lib.dir}" cache="${cache.dir}"/> + <javac destdir="${lib.dir}" debug="${debug}" source="1.5"> + <src path="."/> + <src path="${generated.test.dir}"/> + <include name="test/Ice/custom15/"/> + <compilerarg value="${javac.lint}"/> + </javac> + </target> + + <target name="test-compile" depends="test-compile-base,test-custom-compile4,test-custom-compile5"/> + + <target name="test-jar" depends="test-compile"> + <jar jarfile="${lib.dir}/IceTest.jar" basedir="${lib.dir}"> + <include name="test/**"/> + <exclude name="test/Freeze/**"/> + <manifest> + <attribute name="Built-By" value="ZeroC, Inc."/> + <attribute name="Class-Path" value="Ice.jar"/> + </manifest> + </jar> + </target> + <target name="freeze-jar" depends="ice-compile"> <jar jarfile="${lib.dir}/Freeze.jar" basedir="${lib.dir}"> <include name="Freeze/**"/> @@ -296,7 +621,9 @@ <target name="compile" depends="ice-compile, icegridadmin-compile"> </target> - <target name="jar" depends="ice-jar, freeze-jar, icegridadmin-plain-jar, icegridadmin-pro-jar"/> + <target name="jar" depends="ice-jar, test-jar, freeze-jar, icegridadmin-plain-jar, icegridadmin-pro-jar"/> + + <target name="test" depends="test-compile, ice-compile"/> <target name="all" depends="jar"> <ant inheritAll="false" dir="demo"/> @@ -349,6 +676,7 @@ <target name="clean" depends="config-init"> <delete dir="${generated.dir}"/> + <delete dir="${generated.test.dir}"/> <delete deleteonexit="true" dir="${lib.dir}"/> <delete dir="${cache.dir}"/> <ant inheritAll="false" dir="demo" target="clean"/> diff --git a/java/test/Freeze/complex/Client.java b/java/test/Freeze/complex/Client.java index e6dc2d363bd..151337e2469 100644 --- a/java/test/Freeze/complex/Client.java +++ b/java/test/Freeze/complex/Client.java @@ -7,6 +7,9 @@ // // ********************************************************************** +package test.Freeze.complex; +import test.Freeze.complex.Complex.*; + import Freeze.*; public class Client @@ -26,7 +29,7 @@ public class Client validate(String dbName) throws DatabaseException { - Complex.ComplexDict m = new Complex.ComplexDict(_connection, dbName, true); + ComplexDict m = new ComplexDict(_connection, dbName, true); try { @@ -38,17 +41,17 @@ public class Client { java.util.Map.Entry e = (java.util.Map.Entry)p.next(); - Complex.Key key = (Complex.Key)e.getKey(); + Key key = (Key)e.getKey(); // // Verify the stored record is correct. // - test(key.result == ((Complex.Node)e.getValue()).calc()); + test(key.result == ((Node)e.getValue()).calc()); // // Verify that the expression & result again. // - Complex.Node root = parser.parse(key.expression); + Node root = parser.parse(key.expression); test(root.calc(null) == key.result); } System.out.println("ok"); @@ -77,7 +80,7 @@ public class Client "10+(10+(20+(8*(2*(3*2+4+5+6)))))" }; - Complex.ComplexDict m = new Complex.ComplexDict(_connection, dbName, true); + ComplexDict m = new ComplexDict(_connection, dbName, true); try { @@ -86,9 +89,9 @@ public class Client System.out.print("populating the database... "); for(int i = 0 ; i < expressions.length; ++i) { - Complex.Node root = parser.parse(expressions[i]); + Node root = parser.parse(expressions[i]); assert(root != null); - Complex.Key k = new Complex.Key(); + Key k = new Key(); k.expression = expressions[i]; k.result = root.calc(null); m.put(k, root); @@ -120,7 +123,7 @@ public class Client // // Register a factory for the node types. // - Ice.ObjectFactory factory = new Complex.ObjectFactoryI(); + Ice.ObjectFactory factory = new ObjectFactoryI(); _communicator.addObjectFactory(factory, "::Complex::NumberNode"); _communicator.addObjectFactory(factory, "::Complex::AddNode"); _communicator.addObjectFactory(factory, "::Complex::MultiplyNode"); diff --git a/java/test/Freeze/complex/Complex.ice b/java/test/Freeze/complex/Complex.ice index 9e2592d8d4d..e207c372e58 100644 --- a/java/test/Freeze/complex/Complex.ice +++ b/java/test/Freeze/complex/Complex.ice @@ -7,6 +7,7 @@ // // ********************************************************************** +[["java:package:test.Freeze.complex"]] module Complex { diff --git a/java/test/Freeze/complex/Complex/AddNodeI.java b/java/test/Freeze/complex/Complex/AddNodeI.java index c46e8e09d51..257874ee898 100644 --- a/java/test/Freeze/complex/Complex/AddNodeI.java +++ b/java/test/Freeze/complex/Complex/AddNodeI.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Complex; +package test.Freeze.complex.Complex; public class AddNodeI extends AddNode { diff --git a/java/test/Freeze/complex/Complex/MultiplyNodeI.java b/java/test/Freeze/complex/Complex/MultiplyNodeI.java index 4092cbc61ee..4a26ff336fd 100644 --- a/java/test/Freeze/complex/Complex/MultiplyNodeI.java +++ b/java/test/Freeze/complex/Complex/MultiplyNodeI.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Complex; +package test.Freeze.complex.Complex; public class MultiplyNodeI extends MultiplyNode { diff --git a/java/test/Freeze/complex/Complex/NumberNodeI.java b/java/test/Freeze/complex/Complex/NumberNodeI.java index 32066758795..298a6036bea 100644 --- a/java/test/Freeze/complex/Complex/NumberNodeI.java +++ b/java/test/Freeze/complex/Complex/NumberNodeI.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Complex; +package test.Freeze.complex.Complex; public class NumberNodeI extends NumberNode { diff --git a/java/test/Freeze/complex/Complex/ObjectFactoryI.java b/java/test/Freeze/complex/Complex/ObjectFactoryI.java index 549d758f644..50a2f18a1b5 100644 --- a/java/test/Freeze/complex/Complex/ObjectFactoryI.java +++ b/java/test/Freeze/complex/Complex/ObjectFactoryI.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Complex; +package test.Freeze.complex.Complex; public class ObjectFactoryI implements Ice.ObjectFactory { diff --git a/java/test/Freeze/complex/ParseError.java b/java/test/Freeze/complex/ParseError.java index c0778e429d4..9a4e7b5ab63 100644 --- a/java/test/Freeze/complex/ParseError.java +++ b/java/test/Freeze/complex/ParseError.java @@ -7,6 +7,8 @@ // // ********************************************************************** +package test.Freeze.complex; + public class ParseError extends Exception { public ParseError(String msg) diff --git a/java/test/Freeze/complex/Parser.java b/java/test/Freeze/complex/Parser.java index 8f4f7e4ec4d..d2aa4b1c93f 100644 --- a/java/test/Freeze/complex/Parser.java +++ b/java/test/Freeze/complex/Parser.java @@ -7,9 +7,12 @@ // // ********************************************************************** +package test.Freeze.complex; +import test.Freeze.complex.Complex.*; + public class Parser { - public Complex.Node + public Node parse(String buf) throws ParseError { @@ -20,12 +23,12 @@ public class Parser return start(); } - private Complex.Node + private Node start() throws ParseError { nextToken(); - Complex.Node node = expr(); + Node node = expr(); if(_token != null) { throw new ParseError("Extra garbage: " + _token); @@ -33,7 +36,7 @@ public class Parser return node; } - private Complex.Node + private Node expr() throws ParseError { @@ -51,7 +54,7 @@ public class Parser { nextToken(); - Complex.Node node = expr(); + Node node = expr(); if(_token.charAt(0) != ')') { throw new ParseError("Expected ')'"); @@ -69,8 +72,8 @@ public class Parser throw new ParseError("Expected number"); } - Complex.NumberNode number = new Complex.NumberNodeI(Integer.parseInt(_token)); - Complex.Node result = number; + NumberNode number = new NumberNodeI(Integer.parseInt(_token)); + Node result = number; // // expr? @@ -84,8 +87,8 @@ public class Parser if(_token.charAt(0) == '+') { nextToken(); - Complex.Node right = expr(); - result = new Complex.AddNodeI(number, right); + Node right = expr(); + result = new AddNodeI(number, right); } // @@ -94,8 +97,8 @@ public class Parser else if(_token.charAt(0) == '*') { nextToken(); - Complex.Node right = expr(); - result = new Complex.MultiplyNodeI(number, right); + Node right = expr(); + result = new MultiplyNodeI(number, right); } } return result; diff --git a/java/test/Freeze/complex/build.xml b/java/test/Freeze/complex/build.xml index 08f23a97390..9a632671c30 100644 --- a/java/test/Freeze/complex/build.xml +++ b/java/test/Freeze/complex/build.xml @@ -17,37 +17,9 @@ <!-- import common definitions --> <import file="${top.dir}/config/common.xml"/> - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Complex.ice"/> - </slice2java> - <slice2freezej outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Complex.ice"/> - <dict name="Complex.ComplexDict" key="Complex::Key" value="Complex::Node"/> - </slice2freezej> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> + <target name="all"/> <target name="clean"> - <delete dir="${class.dir}"/> - <delete dir="${generated.dir}"/> <delete> <fileset dir="db" includes="log.*"/> <fileset dir="db" includes="test"/> diff --git a/java/test/Freeze/complex/run.py b/java/test/Freeze/complex/run.py index 6ebf89e573f..233b4b4221a 100755 --- a/java/test/Freeze/complex/run.py +++ b/java/test/Freeze/complex/run.py @@ -20,8 +20,6 @@ if len(path) == 0: sys.path.append(os.path.join(path[0])) from scripts import * -TestUtil.addClasspath(os.path.join(os.getcwd(), "classes")) - # # Clean the contents of the database directory. # @@ -29,14 +27,15 @@ dbdir = os.path.join(os.getcwd(), "db") TestUtil.cleanDbDir(dbdir) print "starting populate...", -populateProc = TestUtil.startClient("Client", " --dbdir %s populate" % os.getcwd(), startReader = False) +populateProc = TestUtil.startClient("test.Freeze.complex.Client", " --dbdir %s populate" % os.getcwd(), + startReader=False) print "ok" populateProc.startReader() populateProc.waitTestSuccess() print "starting verification client...", -clientProc = TestUtil.startClient("Client", " --dbdir %s validate" % os.getcwd(), startReader = False) +clientProc = TestUtil.startClient("test.Freeze.complex.Client", " --dbdir %s validate" % os.getcwd(), startReader=False) print "ok" clientProc.startReader() diff --git a/java/test/Freeze/dbmap/Client.java b/java/test/Freeze/dbmap/Client.java index 203e14cf2a8..ba99c46a2d2 100644 --- a/java/test/Freeze/dbmap/Client.java +++ b/java/test/Freeze/dbmap/Client.java @@ -7,6 +7,8 @@ // // ********************************************************************** +package test.Freeze.dbmap; + import Freeze.*; public class Client diff --git a/java/test/Freeze/dbmap/build.xml b/java/test/Freeze/dbmap/build.xml index 30167c9d4fe..318c597c735 100644 --- a/java/test/Freeze/dbmap/build.xml +++ b/java/test/Freeze/dbmap/build.xml @@ -17,63 +17,9 @@ <!-- import common definitions --> <import file="${top.dir}/config/common.xml"/> - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2freezej outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <dict name="ByteIntMap" key="byte" value="int"/> - <dictindex name="ByteIntMap"/> - </slice2freezej> - <slice2freezej ice="on" outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <includepath> - <pathelement path="${slice.dir}" /> - </includepath> - <fileset dir="${slice.dir}/Ice" includes="Identity.ice"/> - <dict name="IntIdentityMap" key="int" value="Ice::Identity"/> - </slice2freezej> - <slice2freezej ice="on" outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <includepath> - <pathelement path="${slice.dir}" /> - </includepath> - <fileset dir="${slice.dir}/Ice" includes="Identity.ice"/> - <dict name="IntIdentityMapWithIndex" key="int" value="Ice::Identity"/> - <dictindex name="IntIdentityMapWithIndex" member="category"/> - </slice2freezej> - <slice2freezej ice="on" outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <includepath> - <pathelement path="${slice.dir}" /> - </includepath> - <fileset dir="${slice.dir}/Ice" includes="Identity.ice"/> - <dict name="SortedMap" key="int" value="Ice::Identity"/> - <dictindex name="SortedMap" member="category"/> - </slice2freezej> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - debug="${debug}"> - <classpath> - <path refid="ice.classpath"/> - <path refid="db.classpath"/> - </classpath> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> + <target name="all"/> <target name="clean"> - <delete dir="${class.dir}"/> - <delete dir="${generated.dir}"/> <delete> <fileset dir="db" includes="log.*"/> <fileset dir="db" includes="__catalog*"/> diff --git a/java/test/Freeze/dbmap/run.py b/java/test/Freeze/dbmap/run.py index 045d0e62c99..1ffda5b95b4 100755 --- a/java/test/Freeze/dbmap/run.py +++ b/java/test/Freeze/dbmap/run.py @@ -20,13 +20,11 @@ if len(path) == 0: sys.path.append(os.path.join(path[0])) from scripts import * -TestUtil.addClasspath(os.path.join(os.getcwd(), "classes")) - dbdir = os.path.join(os.getcwd(), "db") TestUtil.cleanDbDir(dbdir) print "starting client...", -clientProc = TestUtil.startClient("Client", os.getcwd(), startReader = False) +clientProc = TestUtil.startClient("test.Freeze.dbmap.Client", os.getcwd(), startReader=False) print "ok" clientProc.startReader() clientProc.waitTestSuccess() diff --git a/java/test/Freeze/evictor/AccountI.java b/java/test/Freeze/evictor/AccountI.java index 7ec38f04d4a..b2d7823555a 100644 --- a/java/test/Freeze/evictor/AccountI.java +++ b/java/test/Freeze/evictor/AccountI.java @@ -7,7 +7,10 @@ // // ********************************************************************** -public class AccountI extends Test.Account +package test.Freeze.evictor; +import test.Freeze.evictor.Test.*; + +public class AccountI extends Account { public int getBalance(Ice.Current current) @@ -16,7 +19,7 @@ public class AccountI extends Test.Account } public void - deposit(int amount, Ice.Current current) throws Test.InsufficientFundsException + deposit(int amount, Ice.Current current) throws InsufficientFundsException { // // No need to synchronize since everything occurs within its own transaction @@ -24,13 +27,13 @@ public class AccountI extends Test.Account int newBalance = balance + amount; if(newBalance < 0) { - throw new Test.InsufficientFundsException(); + throw new InsufficientFundsException(); } balance = newBalance; } public void - transfer(int amount, Test.AccountPrx toAccount, Ice.Current current) throws Test.InsufficientFundsException + transfer(int amount, AccountPrx toAccount, Ice.Current current) throws InsufficientFundsException { test(_evictor.getCurrentTransaction() != null); @@ -39,7 +42,7 @@ public class AccountI extends Test.Account } public void - transfer2_async(Test.AMD_Account_transfer2 cb, int amount, Test.AccountPrx toAccount, Ice.Current current) + transfer2_async(AMD_Account_transfer2 cb, int amount, AccountPrx toAccount, Ice.Current current) { // // Here the dispatch thread does everything @@ -51,7 +54,7 @@ public class AccountI extends Test.Account toAccount.deposit(amount); // collocated call deposit(-amount, current); // direct call } - catch(Test.InsufficientFundsException ex) + catch(InsufficientFundsException ex) { cb.ice_exception(ex); return; @@ -61,7 +64,7 @@ public class AccountI extends Test.Account } public void - transfer3_async(final Test.AMD_Account_transfer3 cb, int amount, Test.AccountPrx toAccount, Ice.Current current) + transfer3_async(final AMD_Account_transfer3 cb, int amount, AccountPrx toAccount, Ice.Current current) { // // Here the dispatch thread does the actual work, but a separate thread sends the response diff --git a/java/test/Freeze/evictor/Client.java b/java/test/Freeze/evictor/Client.java index 462da193412..ab8a7989bad 100644 --- a/java/test/Freeze/evictor/Client.java +++ b/java/test/Freeze/evictor/Client.java @@ -7,7 +7,11 @@ // // ********************************************************************** -public class Client +package test.Freeze.evictor; +import test.Freeze.evictor.Test.*; +import java.io.PrintWriter; + +public class Client extends test.Util.Application { private static void test(boolean b) @@ -18,7 +22,7 @@ public class Client } } - private static class AMI_Servant_setValueAsyncI extends Test.AMI_Servant_setValueAsync + private static class AMI_Servant_setValueAsyncI extends AMI_Servant_setValueAsync { public void ice_response() @@ -33,7 +37,7 @@ public class Client static class ReadThread extends Thread { - ReadThread(Test.ServantPrx[] servants) + ReadThread(ServantPrx[] servants) { _servants = servants; } @@ -64,7 +68,7 @@ public class Client } } - private Test.ServantPrx[] _servants; + private ServantPrx[] _servants; } public static final int StateRunning = 0; @@ -73,7 +77,7 @@ public class Client static class ReadForeverThread extends Thread { - ReadForeverThread(Test.ServantPrx[] servants) + ReadForeverThread(ServantPrx[] servants) { _servants = servants; } @@ -140,14 +144,14 @@ public class Client _state = s; } - private Test.ServantPrx[] _servants; + private ServantPrx[] _servants; private int _state = StateRunning; } static class AddForeverThread extends Thread { - AddForeverThread(Test.RemoteEvictorPrx evictor, int prefix) + AddForeverThread(RemoteEvictorPrx evictor, int prefix) { _evictor = evictor; _prefix = "" + prefix; @@ -173,7 +177,7 @@ public class Client _evictor.createServant(id, 0); } } - catch(Test.EvictorDeactivatedException e) + catch(EvictorDeactivatedException e) { // // Expected @@ -189,7 +193,7 @@ public class Client test(validEx()); return; } - catch(Test.AlreadyRegisteredException e) + catch(AlreadyRegisteredException e) { System.err.println("Caught unexpected AlreadyRegistedException:" + e.toString()); System.err.println("index is " + index); @@ -230,7 +234,7 @@ public class Client _state = s; } - private Test.RemoteEvictorPrx _evictor; + private RemoteEvictorPrx _evictor; private String _prefix; private int _state = StateRunning; } @@ -238,7 +242,7 @@ public class Client static class CreateDestroyThread extends Thread { - CreateDestroyThread(Test.RemoteEvictorPrx evictor, int id, int size) + CreateDestroyThread(RemoteEvictorPrx evictor, int id, int size) { _evictor = evictor; _id = "" + id; @@ -264,7 +268,7 @@ public class Client if(loops % 2 == 0) { - Test.ServantPrx servant = _evictor.getServant(id); + ServantPrx servant = _evictor.getServant(id); servant.destroy(); // @@ -282,7 +286,7 @@ public class Client } else { - Test.ServantPrx servant = _evictor.createServant(id, i); + ServantPrx servant = _evictor.createServant(id, i); // // Twice @@ -292,7 +296,7 @@ public class Client servant = _evictor.createServant(id, 0); test(false); } - catch(Test.AlreadyRegisteredException e) + catch(AlreadyRegisteredException e) { // Expected } @@ -303,7 +307,7 @@ public class Client // // Just read/write the value // - Test.ServantPrx servant = _evictor.getServant(id); + ServantPrx servant = _evictor.getServant(id); try { int val = servant.getValue(); @@ -327,14 +331,14 @@ public class Client } } - private Test.RemoteEvictorPrx _evictor; + private RemoteEvictorPrx _evictor; private String _id; private int _size; } static class TransferThread extends Thread { - TransferThread(Test.AccountPrx[] accounts, int count) + TransferThread(AccountPrx[] accounts, int count) { _accounts = accounts; _random = new java.util.Random(count); @@ -350,9 +354,9 @@ public class Client // // Transfer 100 at random between two distinct accounts // - Test.AccountPrx from = _accounts[Math.abs(_random.nextInt() % _accounts.length)]; + AccountPrx from = _accounts[Math.abs(_random.nextInt() % _accounts.length)]; - Test.AccountPrx to = null; + AccountPrx to = null; do { to = _accounts[Math.abs(_random.nextInt() % _accounts.length)]; @@ -389,7 +393,7 @@ public class Client transferOp++; transferOp = transferOp % 3; } - catch(Test.InsufficientFundsException e) + catch(InsufficientFundsException e) { // // Expected from time to time @@ -413,47 +417,46 @@ public class Client } } - private final Test.AccountPrx[] _accounts; + private final AccountPrx[] _accounts; private final java.util.Random _random; } - - - private static int - run(String[] args, Ice.Communicator communicator, boolean transactional, boolean shutdown) - throws Test.AlreadyRegisteredException, Test.NotRegisteredException, Test.EvictorDeactivatedException + private int + run(String[] args, PrintWriter out, boolean transactional, boolean shutdown) + throws AlreadyRegisteredException, NotRegisteredException, EvictorDeactivatedException { + Ice.Communicator communicator = communicator(); String ref = "factory:default -p 12010 -t 30000"; Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); - Test.RemoteEvictorFactoryPrx factory = Test.RemoteEvictorFactoryPrxHelper.checkedCast(base); + RemoteEvictorFactoryPrx factory = RemoteEvictorFactoryPrxHelper.checkedCast(base); if(transactional) { - System.out.print("testing transactional Freeze Evictor... "); + out.print("testing transactional Freeze Evictor... "); } else { - System.out.print("testing background-save Freeze Evictor... "); + out.print("testing background-save Freeze Evictor... "); } - System.out.flush(); + out.flush(); final int size = 5; - Test.RemoteEvictorPrx evictor = factory.createEvictor("Test", transactional); + RemoteEvictorPrx evictor = factory.createEvictor("Test", transactional); evictor.setSize(size); // // Create some servants // - Test.ServantPrx[] servants = new Test.ServantPrx[size]; + ServantPrx[] servants = new ServantPrx[size]; for(int i = 0; i < size; i++) { String id = "" + i; servants[i] = evictor.createServant(id, i); servants[i].ice_ping(); - Test.FacetPrx facet1 = Test.FacetPrxHelper.uncheckedCast(servants[i], "facet1"); + FacetPrx facet1 = FacetPrxHelper.uncheckedCast(servants[i], "facet1"); try { facet1.ice_ping(); @@ -467,11 +470,11 @@ public class Client } servants[i].addFacet("facet1", "data"); facet1.ice_ping(); - facet1 = Test.FacetPrxHelper.checkedCast(servants[i], "facet1"); + facet1 = FacetPrxHelper.checkedCast(servants[i], "facet1"); test(facet1 != null); facet1.setValue(10 * i); facet1.addFacet("facet2", "moreData"); - Test.FacetPrx facet2 = Test.FacetPrxHelper.checkedCast(facet1, "facet2"); + FacetPrx facet2 = FacetPrxHelper.checkedCast(facet1, "facet2"); test(facet2 != null); facet2.setValue(100 * i); } @@ -485,11 +488,11 @@ public class Client { servants[i].ice_ping(); test(servants[i].getValue() == i); - Test.FacetPrx facet1 = Test.FacetPrxHelper.checkedCast(servants[i], "facet1"); + FacetPrx facet1 = FacetPrxHelper.checkedCast(servants[i], "facet1"); test(facet1 != null); test(facet1.getValue() == 10 * i); test(facet1.getData().equals("data")); - Test.FacetPrx facet2 = Test.FacetPrxHelper.checkedCast(facet1, "facet2"); + FacetPrx facet2 = FacetPrxHelper.checkedCast(facet1, "facet2"); test(facet2 != null); test(facet2.getData().equals("moreData")); } @@ -500,10 +503,10 @@ public class Client for(int i = 0; i < size; i++) { servants[i].setValue(i + 100); - Test.FacetPrx facet1 = Test.FacetPrxHelper.checkedCast(servants[i], "facet1"); + FacetPrx facet1 = FacetPrxHelper.checkedCast(servants[i], "facet1"); test(facet1 != null); facet1.setValue(10 * i + 100); - Test.FacetPrx facet2 = Test.FacetPrxHelper.checkedCast(facet1, "facet2"); + FacetPrx facet2 = FacetPrxHelper.checkedCast(facet1, "facet2"); test(facet2 != null); facet2.setValue(100 * i + 100); } @@ -511,10 +514,10 @@ public class Client for(int i = 0; i < size; i++) { test(servants[i].getValue() == i + 100); - Test.FacetPrx facet1 = Test.FacetPrxHelper.checkedCast(servants[i], "facet1"); + FacetPrx facet1 = FacetPrxHelper.checkedCast(servants[i], "facet1"); test(facet1 != null); test(facet1.getValue() == 10 * i + 100); - Test.FacetPrx facet2 = Test.FacetPrxHelper.checkedCast(facet1, "facet2"); + FacetPrx facet2 = FacetPrxHelper.checkedCast(facet1, "facet2"); test(facet2 != null); test(facet2.getValue() == 100 * i + 100); } @@ -527,10 +530,10 @@ public class Client for(int i = 0; i < size; i++) { test(servants[i].getValue() == i + 100); - Test.FacetPrx facet1 = Test.FacetPrxHelper.checkedCast(servants[i], "facet1"); + FacetPrx facet1 = FacetPrxHelper.checkedCast(servants[i], "facet1"); test(facet1 != null); test(facet1.getValue() == 10 * i + 100); - Test.FacetPrx facet2 = Test.FacetPrxHelper.checkedCast(facet1, "facet2"); + FacetPrx facet2 = FacetPrxHelper.checkedCast(facet1, "facet2"); test(facet2 != null); test(facet2.getValue() == 100 * i + 100); } @@ -575,7 +578,7 @@ public class Client servants[i].addFacet("facet1", "foobar"); test(false); } - catch(Test.AlreadyRegisteredException ex) + catch(AlreadyRegisteredException ex) { } } @@ -588,7 +591,7 @@ public class Client servants[0].removeFacet("facet3"); test(false); } - catch(Test.NotRegisteredException ex) + catch(NotRegisteredException ex) { } @@ -635,7 +638,7 @@ public class Client // // Allocate space for size servants. // - servants = new Test.ServantPrx[size]; + servants = new ServantPrx[size]; // // Recreate servants, set transient value @@ -727,7 +730,7 @@ public class Client servants[i].release(); test(false); } - catch(Test.NotRegisteredException e) + catch(NotRegisteredException e) { // Expected } @@ -739,7 +742,7 @@ public class Client int totalBalance = servants[0].getTotalBalance(); test(totalBalance == 0); - Test.AccountPrx[] accounts = servants[0].getAccounts(); + AccountPrx[] accounts = servants[0].getAccounts(); test(accounts.length > 0); totalBalance = servants[0].getTotalBalance(); @@ -875,7 +878,7 @@ public class Client // // Recreate servants. // - servants = new Test.ServantPrx[size]; + servants = new ServantPrx[size]; for(int i = 0; i < size; i++) { String id = "" + i; @@ -995,7 +998,7 @@ public class Client evictor.destroyAllServants(""); evictor.deactivate(); - System.out.println("ok"); + out.println("ok"); if(shutdown) { @@ -1005,54 +1008,49 @@ public class Client return 0; } - public static void - main(String[] args) + public int + run(String[] args) { + PrintWriter out = getWriter(); int status = 0; - Ice.Communicator communicator = null; - try { - communicator = Ice.Util.initialize(args); - status = run(args, communicator, false, false); + status = run(args, out, false, false); if(status == 0) { - status = run(args, communicator, true, true); + status = run(args, out, true, true); } } - catch(Test.AlreadyRegisteredException ex) - { - ex.printStackTrace(); - status = 1; - } - catch(Test.NotRegisteredException ex) + catch(AlreadyRegisteredException ex) { - ex.printStackTrace(); + ex.printStackTrace(out); status = 1; } - catch(Test.EvictorDeactivatedException ex) + catch(NotRegisteredException ex) { - ex.printStackTrace(); + ex.printStackTrace(out); status = 1; } - catch(Exception ex) + catch(EvictorDeactivatedException ex) { - ex.printStackTrace(); + ex.printStackTrace(out); status = 1; } + return status; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Freeze.evictor"); + return initData; + } + + public static void main(String[] args) + { + Client c = new Client(); + int status = c.main("Client", args); System.gc(); System.exit(status); diff --git a/java/test/Freeze/evictor/FacetI.java b/java/test/Freeze/evictor/FacetI.java index dbc87262a28..0f7cb7a245a 100644 --- a/java/test/Freeze/evictor/FacetI.java +++ b/java/test/Freeze/evictor/FacetI.java @@ -7,17 +7,20 @@ // // ********************************************************************** -public class FacetI extends ServantI implements Test._FacetOperations +package test.Freeze.evictor; +import test.Freeze.evictor.Test.*; + +public class FacetI extends ServantI implements _FacetOperations { - FacetI(Test.Facet tie) + FacetI(Facet tie) { super(tie); } - FacetI(Test.Servant tie, RemoteEvictorI remoteEvictor, Freeze.Evictor evictor, int value, String data) + FacetI(Servant tie, RemoteEvictorI remoteEvictor, Freeze.Evictor evictor, int value, String data) { super(tie, remoteEvictor, evictor, value); - ((Test.Facet)_tie).data = data; + ((Facet)_tie).data = data; } public String @@ -25,7 +28,7 @@ public class FacetI extends ServantI implements Test._FacetOperations { synchronized(_tie) { - return ((Test.Facet)_tie).data; + return ((Facet)_tie).data; } } @@ -34,7 +37,7 @@ public class FacetI extends ServantI implements Test._FacetOperations { synchronized(_tie) { - ((Test.Facet)_tie).data = data; + ((Facet)_tie).data = data; } } } diff --git a/java/test/Freeze/evictor/RemoteEvictorFactoryI.java b/java/test/Freeze/evictor/RemoteEvictorFactoryI.java index c9008bad700..4610a913724 100644 --- a/java/test/Freeze/evictor/RemoteEvictorFactoryI.java +++ b/java/test/Freeze/evictor/RemoteEvictorFactoryI.java @@ -7,7 +7,10 @@ // // ********************************************************************** -public final class RemoteEvictorFactoryI extends Test._RemoteEvictorFactoryDisp +package test.Freeze.evictor; +import test.Freeze.evictor.Test.*; + +public final class RemoteEvictorFactoryI extends _RemoteEvictorFactoryDisp { RemoteEvictorFactoryI(Ice.ObjectAdapter adapter, String envName) { @@ -16,11 +19,11 @@ public final class RemoteEvictorFactoryI extends Test._RemoteEvictorFactoryDisp } - public Test.RemoteEvictorPrx + public RemoteEvictorPrx createEvictor(String name, boolean transactional, Ice.Current current) { RemoteEvictorI remoteEvictor = new RemoteEvictorI(_adapter, _envName, name, transactional); - return Test.RemoteEvictorPrxHelper. + return RemoteEvictorPrxHelper. uncheckedCast(_adapter.add(remoteEvictor, _adapter.getCommunicator().stringToIdentity(name))); } diff --git a/java/test/Freeze/evictor/RemoteEvictorI.java b/java/test/Freeze/evictor/RemoteEvictorI.java index b0724342aa1..ed20ea03a99 100644 --- a/java/test/Freeze/evictor/RemoteEvictorI.java +++ b/java/test/Freeze/evictor/RemoteEvictorI.java @@ -7,7 +7,10 @@ // // ********************************************************************** -public final class RemoteEvictorI extends Test._RemoteEvictorDisp +package test.Freeze.evictor; +import test.Freeze.evictor.Test.*; + +public final class RemoteEvictorI extends _RemoteEvictorDisp { static class Initializer implements Freeze.ServantInitializer { @@ -21,12 +24,12 @@ public final class RemoteEvictorI extends Test._RemoteEvictorDisp } else if(facet.length() == 0) { - ServantI servantImpl = (ServantI) ((Test._ServantTie) servant).ice_delegate(); + ServantI servantImpl = (ServantI) ((_ServantTie) servant).ice_delegate(); servantImpl.init(_remoteEvictor, _evictor); } else { - ServantI servantImpl = (ServantI) ((Test._FacetTie) servant).ice_delegate(); + ServantI servantImpl = (ServantI) ((_FacetTie) servant).ice_delegate(); servantImpl.init(_remoteEvictor, _evictor); } } @@ -78,30 +81,30 @@ public final class RemoteEvictorI extends Test._RemoteEvictorDisp _evictor.setSize(size); } - public Test.ServantPrx + public ServantPrx createServant(String id, int value, Ice.Current current) - throws Test.AlreadyRegisteredException, Test.EvictorDeactivatedException + throws AlreadyRegisteredException, EvictorDeactivatedException { Ice.Identity ident = new Ice.Identity(); ident.category = _category; ident.name = id; - Test._ServantTie tie = new Test._ServantTie(); + _ServantTie tie = new _ServantTie(); tie.ice_delegate(new ServantI(tie, this, _evictor, value)); try { - return Test.ServantPrxHelper.uncheckedCast(_evictor.add(tie, ident)); + return ServantPrxHelper.uncheckedCast(_evictor.add(tie, ident)); } catch(Ice.AlreadyRegisteredException e) { - throw new Test.AlreadyRegisteredException(); + throw new AlreadyRegisteredException(); } catch(Ice.ObjectAdapterDeactivatedException e) { - throw new Test.EvictorDeactivatedException(); + throw new EvictorDeactivatedException(); } catch(Freeze.EvictorDeactivatedException e) { - throw new Test.EvictorDeactivatedException(); + throw new EvictorDeactivatedException(); } catch(Ice.LocalException e) { @@ -110,13 +113,13 @@ public final class RemoteEvictorI extends Test._RemoteEvictorDisp } } - public Test.ServantPrx + public ServantPrx getServant(String id, Ice.Current current) { Ice.Identity ident = new Ice.Identity(); ident.category = _category; ident.name = id; - return Test.ServantPrxHelper.uncheckedCast(_evictorAdapter.createProxy(ident)); + return ServantPrxHelper.uncheckedCast(_evictorAdapter.createProxy(ident)); } public void diff --git a/java/test/Freeze/evictor/ServantI.java b/java/test/Freeze/evictor/ServantI.java index b21afb4038d..43c7e371f61 100644 --- a/java/test/Freeze/evictor/ServantI.java +++ b/java/test/Freeze/evictor/ServantI.java @@ -7,7 +7,10 @@ // // ********************************************************************** -public class ServantI implements Test._ServantOperations +package test.Freeze.evictor; +import test.Freeze.evictor.Test.*; + +public class ServantI implements _ServantOperations { private static void test(boolean b) @@ -21,7 +24,7 @@ public class ServantI implements Test._ServantOperations static class DelayedResponse extends Thread { - DelayedResponse(Test.AMD_Servant_slowGetValue cb, int val) + DelayedResponse(AMD_Servant_slowGetValue cb, int val) { _cb = cb; _val = val; @@ -41,17 +44,17 @@ public class ServantI implements Test._ServantOperations _cb.ice_response(_val); } - private Test.AMD_Servant_slowGetValue _cb; + private AMD_Servant_slowGetValue _cb; private int _val; } - ServantI(Test.Servant tie) + ServantI(Servant tie) { _tie = tie; } - ServantI(Test.Servant tie, RemoteEvictorI remoteEvictor, Freeze.Evictor evictor, int value) + ServantI(Servant tie, RemoteEvictorI remoteEvictor, Freeze.Evictor evictor, int value) { _tie = tie; _remoteEvictor = remoteEvictor; @@ -93,7 +96,7 @@ public class ServantI implements Test._ServantOperations } public void - slowGetValue_async(Test.AMD_Servant_slowGetValue cb, Ice.Current current) + slowGetValue_async(AMD_Servant_slowGetValue cb, Ice.Current current) { synchronized(_tie) { @@ -113,7 +116,7 @@ public class ServantI implements Test._ServantOperations } public void - setValueAsync_async(Test.AMD_Servant_setValueAsync __cb, int value, Ice.Current current) + setValueAsync_async(AMD_Servant_setValueAsync __cb, int value, Ice.Current current) { synchronized(_tie) { @@ -148,9 +151,9 @@ public class ServantI implements Test._ServantOperations public void addFacet(String name, String data, Ice.Current current) - throws Test.AlreadyRegisteredException + throws AlreadyRegisteredException { - Test._FacetTie tie = new Test._FacetTie(); + _FacetTie tie = new _FacetTie(); tie.ice_delegate(new FacetI(tie, _remoteEvictor, _evictor, 0, data)); try @@ -159,13 +162,13 @@ public class ServantI implements Test._ServantOperations } catch(Ice.AlreadyRegisteredException ex) { - throw new Test.AlreadyRegisteredException(); + throw new AlreadyRegisteredException(); } } public void removeFacet(String name, Ice.Current current) - throws Test.NotRegisteredException + throws NotRegisteredException { try { @@ -173,7 +176,7 @@ public class ServantI implements Test._ServantOperations } catch(Ice.NotRegisteredException ex) { - throw new Test.NotRegisteredException(); + throw new NotRegisteredException(); } } @@ -199,7 +202,7 @@ public class ServantI implements Test._ServantOperations public void release(Ice.Current current) - throws Test.NotRegisteredException + throws NotRegisteredException { Freeze.BackgroundSaveEvictor bse = (Freeze.BackgroundSaveEvictor)_evictor; @@ -209,11 +212,11 @@ public class ServantI implements Test._ServantOperations } catch(Ice.NotRegisteredException e) { - throw new Test.NotRegisteredException(); + throw new NotRegisteredException(); } } - public Test.AccountPrx[] + public AccountPrx[] getAccounts(Ice.Current current) { Freeze.TransactionalEvictor te = (Freeze.TransactionalEvictor)_evictor; @@ -238,14 +241,14 @@ public class ServantI implements Test._ServantOperations if(_tie.accounts == null || _tie.accounts.length == 0) { - return new Test.AccountPrx[0]; + return new AccountPrx[0]; } - Test.AccountPrx[] result = new Test.AccountPrx[_tie.accounts.length]; + AccountPrx[] result = new AccountPrx[_tie.accounts.length]; for(int i = 0; i < _tie.accounts.length; ++i) { - result[i] = Test.AccountPrxHelper.uncheckedCast(current.adapter.createProxy(_tie.accounts[i])); + result[i] = AccountPrxHelper.uncheckedCast(current.adapter.createProxy(_tie.accounts[i])); } return result; } @@ -253,7 +256,7 @@ public class ServantI implements Test._ServantOperations public int getTotalBalance(Ice.Current current) { - Test.AccountPrx[] accounts = getAccounts(current); + AccountPrx[] accounts = getAccounts(current); // // Need to start a transaction to ensure a consistent result @@ -288,8 +291,8 @@ public class ServantI implements Test._ServantOperations protected RemoteEvictorI _remoteEvictor; protected Freeze.Evictor _evictor; - protected Test.AMD_Servant_setValueAsync _setValueAsyncCB; + protected AMD_Servant_setValueAsync _setValueAsyncCB; protected int _setValueAsyncValue; - protected Test.Servant _tie; + protected Servant _tie; private int _transientValue = -1; } diff --git a/java/test/Freeze/evictor/Server.java b/java/test/Freeze/evictor/Server.java index 4c020875b27..f2f94b49a56 100644 --- a/java/test/Freeze/evictor/Server.java +++ b/java/test/Freeze/evictor/Server.java @@ -7,7 +7,10 @@ // // ********************************************************************** -public class Server +package test.Freeze.evictor; +import test.Freeze.evictor.Test.*; + +public class Server extends test.Util.Application { static class AccountFactory implements Ice.ObjectFactory { @@ -30,7 +33,7 @@ public class Server create(String type) { assert(type.equals("::Test::Servant")); - Test._ServantTie tie = new Test._ServantTie(); + _ServantTie tie = new _ServantTie(); tie.ice_delegate(new ServantI(tie)); return tie; } @@ -47,7 +50,7 @@ public class Server create(String type) { assert(type.equals("::Test::Facet")); - Test._FacetTie tie = new Test._FacetTie(); + _FacetTie tie = new _FacetTie(); tie.ice_delegate(new FacetI(tie)); return tie; } @@ -58,18 +61,18 @@ public class Server } } - static int - run(String[] args, Ice.Communicator communicator, String envName) + public int + run(String[] args) { - communicator.getProperties().setProperty("Evictor.Endpoints", "default -p 12010"); + Ice.Communicator communicator = communicator(); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("Evictor"); - communicator.addObjectFactory(new AccountFactory(), "::Test::Account"); communicator.addObjectFactory(new ServantFactory(), "::Test::Servant"); communicator.addObjectFactory(new FacetFactory(), "::Test::Facet"); - RemoteEvictorFactoryI factory = new RemoteEvictorFactoryI(adapter, envName); + RemoteEvictorFactoryI factory = new RemoteEvictorFactoryI(adapter, "db"); adapter.add(factory, communicator.stringToIdentity("factory")); adapter.activate(); @@ -79,39 +82,19 @@ public class Server return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - String envName = "db"; - - try - { - Ice.StringSeqHolder holder = new Ice.StringSeqHolder(); - holder.value = args; - communicator = Ice.Util.initialize(holder); - args = holder.value; - status = run(args, communicator, envName); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Evictor.Endpoints", "default -p 12010"); + initData.properties.setProperty("Ice.Package.Test", "test.Freeze.evictor"); + return initData; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + public static void main(String[] args) + { + Server c = new Server(); + int status = c.main("Server", args); System.gc(); System.exit(status); diff --git a/java/test/Freeze/evictor/Test.ice b/java/test/Freeze/evictor/Test.ice index 2b72a5b70c9..db197423778 100644 --- a/java/test/Freeze/evictor/Test.ice +++ b/java/test/Freeze/evictor/Test.ice @@ -12,6 +12,7 @@ #include <Ice/Identity.ice> +[["java:package:test.Freeze.evictor"]] module Test { diff --git a/java/test/Freeze/evictor/build.xml b/java/test/Freeze/evictor/build.xml index 6a3c9920197..ccc2551dbe0 100644 --- a/java/test/Freeze/evictor/build.xml +++ b/java/test/Freeze/evictor/build.xml @@ -17,39 +17,9 @@ <!-- import common definitions --> <import file="${top.dir}/config/common.xml"/> - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java tie="yes" outputdir="${generated.dir}"> - <includepath> - <pathelement path="${slice.dir}" /> - </includepath> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - excludes="generated/**" debug="${debug}"> - <classpath> - <path refid="ice.classpath"/> - <path refid="db.classpath"/> - </classpath> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> + <target name="all"/> <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> <delete> <fileset dir="db" includes="log.*"/> <fileset dir="db" includes="__catalog*"/> diff --git a/java/test/Freeze/oldevictor/Client.java b/java/test/Freeze/oldevictor/Client.java index 2b083967c2d..ee5f42de0c4 100644 --- a/java/test/Freeze/oldevictor/Client.java +++ b/java/test/Freeze/oldevictor/Client.java @@ -7,7 +7,11 @@ // // ********************************************************************** -public class Client +package test.Freeze.oldevictor; +import test.Freeze.oldevictor.Test.*; +import java.io.PrintWriter; + +public class Client extends test.Util.Application { private static void test(boolean b) @@ -18,7 +22,7 @@ public class Client } } - private static class AMI_Servant_setValueAsyncI extends Test.AMI_Servant_setValueAsync + private static class AMI_Servant_setValueAsyncI extends AMI_Servant_setValueAsync { public void ice_response() @@ -33,7 +37,7 @@ public class Client static class ReadThread extends Thread { - ReadThread(Test.ServantPrx[] servants) + ReadThread(ServantPrx[] servants) { _servants = servants; } @@ -64,7 +68,7 @@ public class Client } } - private Test.ServantPrx[] _servants; + private ServantPrx[] _servants; } public static final int StateRunning = 0; @@ -73,7 +77,7 @@ public class Client static class ReadForeverThread extends Thread { - ReadForeverThread(Test.ServantPrx[] servants) + ReadForeverThread(ServantPrx[] servants) { _servants = servants; } @@ -140,14 +144,14 @@ public class Client _state = s; } - private Test.ServantPrx[] _servants; + private ServantPrx[] _servants; private int _state = StateRunning; } static class AddForeverThread extends Thread { - AddForeverThread(Test.RemoteEvictorPrx evictor, int prefix) + AddForeverThread(RemoteEvictorPrx evictor, int prefix) { _evictor = evictor; _prefix = "" + prefix; @@ -173,7 +177,7 @@ public class Client _evictor.createServant(id, 0); } } - catch(Test.EvictorDeactivatedException e) + catch(EvictorDeactivatedException e) { // // Expected @@ -189,7 +193,7 @@ public class Client test(validEx()); return; } - catch(Test.AlreadyRegisteredException e) + catch(AlreadyRegisteredException e) { System.err.println("Caught unexpected AlreadyRegistedException:" + e.toString()); System.err.println("index is " + index); @@ -230,7 +234,7 @@ public class Client _state = s; } - private Test.RemoteEvictorPrx _evictor; + private RemoteEvictorPrx _evictor; private String _prefix; private int _state = StateRunning; } @@ -238,7 +242,7 @@ public class Client static class CreateDestroyThread extends Thread { - CreateDestroyThread(Test.RemoteEvictorPrx evictor, int id, int size) + CreateDestroyThread(RemoteEvictorPrx evictor, int id, int size) { _evictor = evictor; _id = "" + id; @@ -264,7 +268,7 @@ public class Client if(loops % 2 == 0) { - Test.ServantPrx servant = _evictor.getServant(id); + ServantPrx servant = _evictor.getServant(id); servant.destroy(); // @@ -282,7 +286,7 @@ public class Client } else { - Test.ServantPrx servant = _evictor.createServant(id, i); + ServantPrx servant = _evictor.createServant(id, i); // // Twice @@ -292,7 +296,7 @@ public class Client servant = _evictor.createServant(id, 0); test(false); } - catch(Test.AlreadyRegisteredException e) + catch(AlreadyRegisteredException e) { // Expected } @@ -303,7 +307,7 @@ public class Client // // Just read/write the value // - Test.ServantPrx servant = _evictor.getServant(id); + ServantPrx servant = _evictor.getServant(id); try { int val = servant.getValue(); @@ -327,42 +331,40 @@ public class Client } } - private Test.RemoteEvictorPrx _evictor; + private RemoteEvictorPrx _evictor; private String _id; private int _size; } - - - private static int - run(String[] args, Ice.Communicator communicator) - throws Test.AlreadyRegisteredException, Test.NotRegisteredException, Test.EvictorDeactivatedException + private int + run(String[] args, PrintWriter out) + throws AlreadyRegisteredException, NotRegisteredException, EvictorDeactivatedException { String ref = "factory:default -p 12010 -t 30000"; - Ice.ObjectPrx base = communicator.stringToProxy(ref); + Ice.ObjectPrx base = communicator().stringToProxy(ref); test(base != null); - Test.RemoteEvictorFactoryPrx factory = Test.RemoteEvictorFactoryPrxHelper.checkedCast(base); + RemoteEvictorFactoryPrx factory = RemoteEvictorFactoryPrxHelper.checkedCast(base); - System.out.print("testing Freeze Evictor... "); - System.out.flush(); + out.print("testing Freeze Evictor... "); + out.flush(); final int size = 5; - Test.RemoteEvictorPrx evictor = factory.createEvictor("Test"); + RemoteEvictorPrx evictor = factory.createEvictor("Test"); evictor.setSize(size); // // Create some servants // - Test.ServantPrx[] servants = new Test.ServantPrx[size]; + ServantPrx[] servants = new ServantPrx[size]; for(int i = 0; i < size; i++) { String id = "" + i; servants[i] = evictor.createServant(id, i); servants[i].ice_ping(); - Test.FacetPrx facet1 = Test.FacetPrxHelper.uncheckedCast(servants[i], "facet1"); + FacetPrx facet1 = FacetPrxHelper.uncheckedCast(servants[i], "facet1"); try { facet1.ice_ping(); @@ -376,11 +378,11 @@ public class Client } servants[i].addFacet("facet1", "data"); facet1.ice_ping(); - facet1 = Test.FacetPrxHelper.checkedCast(servants[i], "facet1"); + facet1 = FacetPrxHelper.checkedCast(servants[i], "facet1"); test(facet1 != null); facet1.setValue(10 * i); facet1.addFacet("facet2", "moreData"); - Test.FacetPrx facet2 = Test.FacetPrxHelper.checkedCast(facet1, "facet2"); + FacetPrx facet2 = FacetPrxHelper.checkedCast(facet1, "facet2"); test(facet2 != null); facet2.setValue(100 * i); } @@ -394,11 +396,11 @@ public class Client { servants[i].ice_ping(); test(servants[i].getValue() == i); - Test.FacetPrx facet1 = Test.FacetPrxHelper.checkedCast(servants[i], "facet1"); + FacetPrx facet1 = FacetPrxHelper.checkedCast(servants[i], "facet1"); test(facet1 != null); test(facet1.getValue() == 10 * i); test(facet1.getData().equals("data")); - Test.FacetPrx facet2 = Test.FacetPrxHelper.checkedCast(facet1, "facet2"); + FacetPrx facet2 = FacetPrxHelper.checkedCast(facet1, "facet2"); test(facet2 != null); test(facet2.getData().equals("moreData")); } @@ -409,10 +411,10 @@ public class Client for(int i = 0; i < size; i++) { servants[i].setValue(i + 100); - Test.FacetPrx facet1 = Test.FacetPrxHelper.checkedCast(servants[i], "facet1"); + FacetPrx facet1 = FacetPrxHelper.checkedCast(servants[i], "facet1"); test(facet1 != null); facet1.setValue(10 * i + 100); - Test.FacetPrx facet2 = Test.FacetPrxHelper.checkedCast(facet1, "facet2"); + FacetPrx facet2 = FacetPrxHelper.checkedCast(facet1, "facet2"); test(facet2 != null); facet2.setValue(100 * i + 100); } @@ -420,10 +422,10 @@ public class Client for(int i = 0; i < size; i++) { test(servants[i].getValue() == i + 100); - Test.FacetPrx facet1 = Test.FacetPrxHelper.checkedCast(servants[i], "facet1"); + FacetPrx facet1 = FacetPrxHelper.checkedCast(servants[i], "facet1"); test(facet1 != null); test(facet1.getValue() == 10 * i + 100); - Test.FacetPrx facet2 = Test.FacetPrxHelper.checkedCast(facet1, "facet2"); + FacetPrx facet2 = FacetPrxHelper.checkedCast(facet1, "facet2"); test(facet2 != null); test(facet2.getValue() == 100 * i + 100); } @@ -436,10 +438,10 @@ public class Client for(int i = 0; i < size; i++) { test(servants[i].getValue() == i + 100); - Test.FacetPrx facet1 = Test.FacetPrxHelper.checkedCast(servants[i], "facet1"); + FacetPrx facet1 = FacetPrxHelper.checkedCast(servants[i], "facet1"); test(facet1 != null); test(facet1.getValue() == 10 * i + 100); - Test.FacetPrx facet2 = Test.FacetPrxHelper.checkedCast(facet1, "facet2"); + FacetPrx facet2 = FacetPrxHelper.checkedCast(facet1, "facet2"); test(facet2 != null); test(facet2.getValue() == 100 * i + 100); } @@ -482,7 +484,7 @@ public class Client servants[i].addFacet("facet1", "foobar"); test(false); } - catch(Test.AlreadyRegisteredException ex) + catch(AlreadyRegisteredException ex) { } } @@ -495,7 +497,7 @@ public class Client servants[0].removeFacet("facet3"); test(false); } - catch(Test.NotRegisteredException ex) + catch(NotRegisteredException ex) { } @@ -542,7 +544,7 @@ public class Client // // Allocate space for size servants. // - servants = new Test.ServantPrx[size]; + servants = new ServantPrx[size]; // // Recreate servants, set transient value @@ -631,7 +633,7 @@ public class Client servants[i].release(); test(false); } - catch(Test.NotRegisteredException e) + catch(NotRegisteredException e) { // Expected } @@ -740,7 +742,7 @@ public class Client // // Recreate servants. // - servants = new Test.ServantPrx[size]; + servants = new ServantPrx[size]; for(int i = 0; i < size; i++) { String id = "" + i; @@ -861,57 +863,52 @@ public class Client evictor.deactivate(); - System.out.println("ok"); + out.println("ok"); factory.shutdown(); return 0; } - public static void - main(String[] args) + public int + run(String[] args) { + PrintWriter out = getWriter(); int status = 0; - Ice.Communicator communicator = null; - try { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Test.AlreadyRegisteredException ex) - { - ex.printStackTrace(); - status = 1; + status = run(args, out); } - catch(Test.NotRegisteredException ex) + catch(AlreadyRegisteredException ex) { - ex.printStackTrace(); + ex.printStackTrace(out); status = 1; } - catch(Test.EvictorDeactivatedException ex) + catch(NotRegisteredException ex) { - ex.printStackTrace(); + ex.printStackTrace(out); status = 1; } - catch(Exception ex) + catch(EvictorDeactivatedException ex) { - ex.printStackTrace(); + ex.printStackTrace(out); status = 1; } + return status; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Freeze.oldevictor"); + return initData; + } + + public static void main(String[] args) + { + Client c = new Client(); + int status = c.main("Client", args); System.gc(); System.exit(status); diff --git a/java/test/Freeze/oldevictor/FacetI.java b/java/test/Freeze/oldevictor/FacetI.java index b2acd7214fd..deb857b3763 100644 --- a/java/test/Freeze/oldevictor/FacetI.java +++ b/java/test/Freeze/oldevictor/FacetI.java @@ -7,17 +7,20 @@ // // ********************************************************************** -public class FacetI extends ServantI implements Test._FacetOperations +package test.Freeze.oldevictor; +import test.Freeze.oldevictor.Test.*; + +public class FacetI extends ServantI implements _FacetOperations { - FacetI(Test.Facet tie) + FacetI(Facet tie) { super(tie); } - FacetI(Test.Servant tie, RemoteEvictorI remoteEvictor, Freeze.BackgroundSaveEvictor evictor, int value, String data) + FacetI(Servant tie, RemoteEvictorI remoteEvictor, Freeze.BackgroundSaveEvictor evictor, int value, String data) { super(tie, remoteEvictor, evictor, value); - ((Test.Facet)_tie).data = data; + ((Facet)_tie).data = data; } public String @@ -25,7 +28,7 @@ public class FacetI extends ServantI implements Test._FacetOperations { synchronized(_tie) { - return ((Test.Facet)_tie).data; + return ((Facet)_tie).data; } } @@ -34,7 +37,7 @@ public class FacetI extends ServantI implements Test._FacetOperations { synchronized(_tie) { - ((Test.Facet)_tie).data = data; + ((Facet)_tie).data = data; } } } diff --git a/java/test/Freeze/oldevictor/RemoteEvictorFactoryI.java b/java/test/Freeze/oldevictor/RemoteEvictorFactoryI.java index 75481d2bebb..fdbaee5b81a 100644 --- a/java/test/Freeze/oldevictor/RemoteEvictorFactoryI.java +++ b/java/test/Freeze/oldevictor/RemoteEvictorFactoryI.java @@ -7,7 +7,10 @@ // // ********************************************************************** -public final class RemoteEvictorFactoryI extends Test._RemoteEvictorFactoryDisp +package test.Freeze.oldevictor; +import test.Freeze.oldevictor.Test.*; + +public final class RemoteEvictorFactoryI extends _RemoteEvictorFactoryDisp { RemoteEvictorFactoryI(Ice.ObjectAdapter adapter, String envName) { @@ -16,11 +19,11 @@ public final class RemoteEvictorFactoryI extends Test._RemoteEvictorFactoryDisp } - public Test.RemoteEvictorPrx + public RemoteEvictorPrx createEvictor(String name, Ice.Current current) { RemoteEvictorI remoteEvictor = new RemoteEvictorI(_adapter, _envName, name); - return Test.RemoteEvictorPrxHelper. + return RemoteEvictorPrxHelper. uncheckedCast(_adapter.add(remoteEvictor, _adapter.getCommunicator().stringToIdentity(name))); } diff --git a/java/test/Freeze/oldevictor/RemoteEvictorI.java b/java/test/Freeze/oldevictor/RemoteEvictorI.java index 25dcb6d4581..e620627130b 100644 --- a/java/test/Freeze/oldevictor/RemoteEvictorI.java +++ b/java/test/Freeze/oldevictor/RemoteEvictorI.java @@ -7,7 +7,10 @@ // // ********************************************************************** -public final class RemoteEvictorI extends Test._RemoteEvictorDisp +package test.Freeze.oldevictor; +import test.Freeze.oldevictor.Test.*; + +public final class RemoteEvictorI extends _RemoteEvictorDisp { static class Initializer implements Freeze.ServantInitializer { @@ -16,12 +19,12 @@ public final class RemoteEvictorI extends Test._RemoteEvictorDisp { if(facet.length() == 0) { - ServantI servantImpl = (ServantI) ((Test._ServantTie) servant).ice_delegate(); + ServantI servantImpl = (ServantI) ((_ServantTie) servant).ice_delegate(); servantImpl.init(_remoteEvictor, _evictor); } else { - ServantI servantImpl = (ServantI) ((Test._FacetTie) servant).ice_delegate(); + ServantI servantImpl = (ServantI) ((_FacetTie) servant).ice_delegate(); servantImpl.init(_remoteEvictor, _evictor); } } @@ -63,30 +66,30 @@ public final class RemoteEvictorI extends Test._RemoteEvictorDisp _evictor.setSize(size); } - public Test.ServantPrx + public ServantPrx createServant(String id, int value, Ice.Current current) - throws Test.AlreadyRegisteredException, Test.EvictorDeactivatedException + throws AlreadyRegisteredException, EvictorDeactivatedException { Ice.Identity ident = new Ice.Identity(); ident.category = _category; ident.name = id; - Test._ServantTie tie = new Test._ServantTie(); + _ServantTie tie = new _ServantTie(); tie.ice_delegate(new ServantI(tie, this, _evictor, value)); try { - return Test.ServantPrxHelper.uncheckedCast(_evictor.add(tie, ident)); + return ServantPrxHelper.uncheckedCast(_evictor.add(tie, ident)); } catch(Ice.AlreadyRegisteredException e) { - throw new Test.AlreadyRegisteredException(); + throw new AlreadyRegisteredException(); } catch(Ice.ObjectAdapterDeactivatedException e) { - throw new Test.EvictorDeactivatedException(); + throw new EvictorDeactivatedException(); } catch(Freeze.EvictorDeactivatedException e) { - throw new Test.EvictorDeactivatedException(); + throw new EvictorDeactivatedException(); } catch(Ice.LocalException e) { @@ -95,13 +98,13 @@ public final class RemoteEvictorI extends Test._RemoteEvictorDisp } } - public Test.ServantPrx + public ServantPrx getServant(String id, Ice.Current current) { Ice.Identity ident = new Ice.Identity(); ident.category = _category; ident.name = id; - return Test.ServantPrxHelper.uncheckedCast(_evictorAdapter.createProxy(ident)); + return ServantPrxHelper.uncheckedCast(_evictorAdapter.createProxy(ident)); } public void diff --git a/java/test/Freeze/oldevictor/ServantI.java b/java/test/Freeze/oldevictor/ServantI.java index feeead8dcac..a4e58c34018 100644 --- a/java/test/Freeze/oldevictor/ServantI.java +++ b/java/test/Freeze/oldevictor/ServantI.java @@ -7,11 +7,14 @@ // // ********************************************************************** -public class ServantI implements Test._ServantOperations +package test.Freeze.oldevictor; +import test.Freeze.oldevictor.Test.*; + +public class ServantI implements _ServantOperations { static class DelayedResponse extends Thread { - DelayedResponse(Test.AMD_Servant_slowGetValue cb, int val) + DelayedResponse(AMD_Servant_slowGetValue cb, int val) { _cb = cb; _val = val; @@ -31,17 +34,17 @@ public class ServantI implements Test._ServantOperations _cb.ice_response(_val); } - private Test.AMD_Servant_slowGetValue _cb; + private AMD_Servant_slowGetValue _cb; private int _val; } - ServantI(Test.Servant tie) + ServantI(Servant tie) { _tie = tie; } - ServantI(Test.Servant tie, RemoteEvictorI remoteEvictor, Freeze.BackgroundSaveEvictor evictor, int value) + ServantI(Servant tie, RemoteEvictorI remoteEvictor, Freeze.BackgroundSaveEvictor evictor, int value) { _tie = tie; _remoteEvictor = remoteEvictor; @@ -72,7 +75,7 @@ public class ServantI implements Test._ServantOperations } public void - slowGetValue_async(Test.AMD_Servant_slowGetValue cb, Ice.Current current) + slowGetValue_async(AMD_Servant_slowGetValue cb, Ice.Current current) { synchronized(_tie) { @@ -92,7 +95,7 @@ public class ServantI implements Test._ServantOperations } public void - setValueAsync_async(Test.AMD_Servant_setValueAsync __cb, int value, Ice.Current current) + setValueAsync_async(AMD_Servant_setValueAsync __cb, int value, Ice.Current current) { synchronized(_tie) { @@ -127,9 +130,9 @@ public class ServantI implements Test._ServantOperations public void addFacet(String name, String data, Ice.Current current) - throws Test.AlreadyRegisteredException + throws AlreadyRegisteredException { - Test._FacetTie tie = new Test._FacetTie(); + _FacetTie tie = new _FacetTie(); tie.ice_delegate(new FacetI(tie, _remoteEvictor, _evictor, 0, data)); try @@ -138,13 +141,13 @@ public class ServantI implements Test._ServantOperations } catch(Ice.AlreadyRegisteredException ex) { - throw new Test.AlreadyRegisteredException(); + throw new AlreadyRegisteredException(); } } public void removeFacet(String name, Ice.Current current) - throws Test.NotRegisteredException + throws NotRegisteredException { try { @@ -152,7 +155,7 @@ public class ServantI implements Test._ServantOperations } catch(Ice.NotRegisteredException ex) { - throw new Test.NotRegisteredException(); + throw new NotRegisteredException(); } } @@ -177,7 +180,7 @@ public class ServantI implements Test._ServantOperations public void release(Ice.Current current) - throws Test.NotRegisteredException + throws NotRegisteredException { try { @@ -185,14 +188,14 @@ public class ServantI implements Test._ServantOperations } catch(Ice.NotRegisteredException e) { - throw new Test.NotRegisteredException(); + throw new NotRegisteredException(); } } protected RemoteEvictorI _remoteEvictor; protected Freeze.BackgroundSaveEvictor _evictor; - protected Test.AMD_Servant_setValueAsync _setValueAsyncCB; + protected AMD_Servant_setValueAsync _setValueAsyncCB; protected int _setValueAsyncValue; - protected Test.Servant _tie; + protected Servant _tie; private int _transientValue = -1; } diff --git a/java/test/Freeze/oldevictor/Server.java b/java/test/Freeze/oldevictor/Server.java index 02b52afb564..779d71c79db 100644 --- a/java/test/Freeze/oldevictor/Server.java +++ b/java/test/Freeze/oldevictor/Server.java @@ -7,7 +7,10 @@ // // ********************************************************************** -public class Server +package test.Freeze.oldevictor; +import test.Freeze.oldevictor.Test.*; + +public class Server extends test.Util.Application { static class ServantFactory implements Ice.ObjectFactory { @@ -15,7 +18,7 @@ public class Server create(String type) { assert(type.equals("::Test::Servant")); - Test._ServantTie tie = new Test._ServantTie(); + _ServantTie tie = new _ServantTie(); tie.ice_delegate(new ServantI(tie)); return tie; } @@ -32,7 +35,7 @@ public class Server create(String type) { assert(type.equals("::Test::Facet")); - Test._FacetTie tie = new Test._FacetTie(); + _FacetTie tie = new _FacetTie(); tie.ice_delegate(new FacetI(tie)); return tie; } @@ -43,13 +46,13 @@ public class Server } } - static int - run(String[] args, Ice.Communicator communicator, String envName) + public int + run(String[] args) { - communicator.getProperties().setProperty("Evictor.Endpoints", "default -p 12010"); + Ice.Communicator communicator = communicator(); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("Evictor"); - RemoteEvictorFactoryI factory = new RemoteEvictorFactoryI(adapter, envName); + RemoteEvictorFactoryI factory = new RemoteEvictorFactoryI(adapter, "db"); adapter.add(factory, communicator.stringToIdentity("factory")); Ice.ObjectFactory servantFactory = new ServantFactory(); @@ -65,39 +68,19 @@ public class Server return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - String envName = "db"; - - try - { - Ice.StringSeqHolder holder = new Ice.StringSeqHolder(); - holder.value = args; - communicator = Ice.Util.initialize(holder); - args = holder.value; - status = run(args, communicator, envName); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Evictor.Endpoints", "default -p 12010"); + initData.properties.setProperty("Ice.Package.Test", "test.Freeze.oldevictor"); + return initData; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + public static void main(String[] args) + { + Server c = new Server(); + int status = c.main("Server", args); System.gc(); System.exit(status); diff --git a/java/test/Freeze/oldevictor/Test.ice b/java/test/Freeze/oldevictor/Test.ice index 0c667d9b678..770058aba80 100644 --- a/java/test/Freeze/oldevictor/Test.ice +++ b/java/test/Freeze/oldevictor/Test.ice @@ -10,6 +10,7 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Freeze.oldevictor"]] module Test { diff --git a/java/test/Freeze/oldevictor/build.xml b/java/test/Freeze/oldevictor/build.xml index 8245ff30d17..53e3da828d6 100644 --- a/java/test/Freeze/oldevictor/build.xml +++ b/java/test/Freeze/oldevictor/build.xml @@ -17,36 +17,11 @@ <!-- import common definitions --> <import file="${top.dir}/config/common.xml"/> - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java tie="yes" outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - excludes="generated/**" debug="${debug}"> - <classpath> - <path refid="ice.classpath"/> - <path refid="db.classpath"/> - </classpath> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> + <target name="all"/> <target name="clean"> - <delete dir="${generated.dir}"/> <delete dir="${class.dir}"/> + <delete dir="${generated.dir}"/> <delete> <fileset dir="db" includes="log.*"/> <fileset dir="db" includes="__catalog*"/> diff --git a/java/test/Glacier2/build.xml b/java/test/Glacier2/build.xml deleted file mode 100644 index 907462c8d33..00000000000 --- a/java/test/Glacier2/build.xml +++ /dev/null @@ -1,22 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Glacier2" default="all" basedir="."> - - <target name="all"> - <ant dir="router"/> - </target> - - <target name="clean"> - <ant dir="router" target="clean"/> - </target> - -</project> diff --git a/java/test/Glacier2/router/Callback.ice b/java/test/Glacier2/router/Callback.ice index 8df703ebedc..5b9012f40fc 100644 --- a/java/test/Glacier2/router/Callback.ice +++ b/java/test/Glacier2/router/Callback.ice @@ -10,6 +10,7 @@ #ifndef CALLBACK_ICE #define CALLBACK_ICE +[["java:package:test.Glacier2.router"]] module Test { diff --git a/java/test/Glacier2/router/CallbackClient.java b/java/test/Glacier2/router/CallbackClient.java deleted file mode 100644 index 7f53891d986..00000000000 --- a/java/test/Glacier2/router/CallbackClient.java +++ /dev/null @@ -1,450 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -import Test.*; - -class CallbackClient extends Ice.Application -{ - public int - run(String[] args) - { - Ice.ObjectPrx routerBase; - - { - System.out.print("testing stringToProxy for router... "); - System.out.flush(); - routerBase = communicator().stringToProxy("Glacier2/router:default -p 12347 -t 30000"); - System.out.println("ok"); - } - - Glacier2.RouterPrx router; - - { - System.out.print("testing checked cast for router... "); - System.out.flush(); - router = Glacier2.RouterPrxHelper.checkedCast(routerBase); - test(router != null); - System.out.println("ok"); - } - - { - System.out.print("installing router with communicator... "); - System.out.flush(); - communicator().setDefaultRouter(router); - System.out.println("ok"); - } - - { - System.out.print("getting the session timeout... "); - System.out.flush(); - long timeout = router.getSessionTimeout(); - test(timeout == 30); - System.out.println("ok"); - } - - Ice.ObjectPrx base; - - { - System.out.print("testing stringToProxy for server object... "); - System.out.flush(); - base = communicator().stringToProxy("c1/callback:tcp -p 12010 -t 10000"); - System.out.println("ok"); - } - - { - System.out.print("trying to ping server before session creation... "); - System.out.flush(); - try - { - base.ice_ping(); - test(false); - } - catch(Ice.ConnectionLostException ex) - { - System.out.println("ok"); - } - catch(Ice.SocketException ex) - { - // - // The JSSE implementation in the AIX JDK appears to have a - // bug that causes a "bad certificate" exception to be raised - // when the connection is forcefully dropped and a retry occurs. - // - if(System.getProperty("os.name").equals("AIX")) - { - System.out.println("ok"); - } - else - { - test(false); - } - } - } - - Glacier2.SessionPrx session; - - { - System.out.print("trying to create session with wrong password... "); - System.out.flush(); - try - { - session = router.createSession("userid", "xxx"); - test(false); - } - catch(Glacier2.PermissionDeniedException ex) - { - System.out.println("ok"); - } - catch(Glacier2.CannotCreateSessionException ex) - { - test(false); - } - } - - { - System.out.print("trying to destroy non-existing session... "); - System.out.flush(); - try - { - router.destroySession(); - test(false); - } - catch(Glacier2.SessionNotExistException ex) - { - System.out.println("ok"); - } - } - - { - System.out.print("creating session with correct password... "); - System.out.flush(); - try - { - session = router.createSession("userid", "abc123"); - } - catch(Glacier2.PermissionDeniedException ex) - { - test(false); - } - catch(Glacier2.CannotCreateSessionException ex) - { - test(false); - } - System.out.println("ok"); - } - - { - System.out.print("trying to create a second session... "); - System.out.flush(); - try - { - router.createSession("userid", "abc123"); - test(false); - } - catch(Glacier2.PermissionDeniedException ex) - { - test(false); - } - catch(Glacier2.CannotCreateSessionException ex) - { - System.out.println("ok"); - } - } - - { - System.out.print("pinging server after session creation... "); - System.out.flush(); - base.ice_ping(); - System.out.println("ok"); - } - - CallbackPrx twoway; - - { - System.out.print("testing checked cast for server object... "); - System.out.flush(); - twoway = CallbackPrxHelper.checkedCast(base); - test(twoway != null); - System.out.println("ok"); - } - - Ice.ObjectAdapter adapter; - - { - System.out.print("creating and activating callback receiver adapter... "); - System.out.flush(); - communicator().getProperties().setProperty("Ice.PrintAdapterReady", "0"); - adapter = communicator().createObjectAdapterWithRouter("CallbackReceiverAdapter", router); - adapter.activate(); - System.out.println("ok"); - } - - String category; - - { - System.out.print("getting category from router... "); - System.out.flush(); - category = router.getCategoryForClient(); - System.out.println("ok"); - } - - CallbackReceiverI callbackReceiverImpl; - Ice.Object callbackReceiver; - CallbackReceiverPrx twowayR; - CallbackReceiverPrx fakeTwowayR; - - { - System.out.print("creating and adding callback receiver object... "); - System.out.flush(); - callbackReceiverImpl = new CallbackReceiverI(); - callbackReceiver = callbackReceiverImpl; - Ice.Identity callbackReceiverIdent = new Ice.Identity(); - callbackReceiverIdent.name = "callbackReceiver"; - callbackReceiverIdent.category = category; - twowayR = CallbackReceiverPrxHelper.uncheckedCast(adapter.add(callbackReceiver, callbackReceiverIdent)); - Ice.Identity fakeCallbackReceiverIdent = new Ice.Identity(); - fakeCallbackReceiverIdent.name = "callbackReceiver"; - fakeCallbackReceiverIdent.category = "dummy"; - fakeTwowayR = CallbackReceiverPrxHelper.uncheckedCast( - adapter.add(callbackReceiver, fakeCallbackReceiverIdent)); - System.out.println("ok"); - } - - { - System.out.print("testing oneway callback... "); - System.out.flush(); - CallbackPrx oneway = CallbackPrxHelper.uncheckedCast(twoway.ice_oneway()); - CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_oneway()); - java.util.Map<String, String> context = new java.util.HashMap<String, String>(); - context.put("_fwd", "o"); - oneway.initiateCallback(onewayR, context); - test(callbackReceiverImpl.callbackOK()); - System.out.println("ok"); - } - - { - System.out.print("testing twoway callback... "); - System.out.flush(); - java.util.Map<String, String> context = new java.util.HashMap<String, String>(); - context.put("_fwd", "t"); - twoway.initiateCallback(twowayR, context); - test(callbackReceiverImpl.callbackOK()); - System.out.println("ok"); - } - - { - System.out.print("ditto, but with user exception... "); - System.out.flush(); - java.util.Map<String, String> context = new java.util.HashMap<String, String>(); - context.put("_fwd", "t"); - try - { - twoway.initiateCallbackEx(twowayR, context); - test(false); - } - catch(CallbackException ex) - { - test(ex.someValue == 3.14); - test(ex.someString.equals("3.14")); - } - test(callbackReceiverImpl.callbackOK()); - System.out.println("ok"); - } - - { - System.out.print("trying twoway callback with fake category... "); - System.out.flush(); - java.util.Map<String, String> context = new java.util.HashMap<String, String>(); - context.put("_fwd", "t"); - try - { - twoway.initiateCallback(fakeTwowayR, context); - test(false); - } - catch(Ice.ObjectNotExistException ex) - { - System.out.println("ok"); - } - } - - { - System.out.print("testing whether other allowed category is accepted... "); - System.out.flush(); - java.util.Map<String, String> context = new java.util.HashMap<String, String>(); - context.put("_fwd", "t"); - CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( - twoway.ice_identity(communicator().stringToIdentity("c2/callback"))); - otherCategoryTwoway.initiateCallback(twowayR, context); - test(callbackReceiverImpl.callbackOK()); - System.out.println("ok"); - } - - { - System.out.print("testing whether disallowed category gets rejected... "); - System.out.flush(); - java.util.Map<String, String> context = new java.util.HashMap<String, String>(); - context.put("_fwd", "t"); - try - { - CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( - twoway.ice_identity(communicator().stringToIdentity("c3/callback"))); - otherCategoryTwoway.initiateCallback(twowayR, context); - test(false); - } - catch(Ice.ObjectNotExistException ex) - { - System.out.println("ok"); - } - } - - { - System.out.print("testing whether user-id as category is accepted... "); - System.out.flush(); - java.util.Map<String, String> context = new java.util.HashMap<String, String>(); - context.put("_fwd", "t"); - CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( - twoway.ice_identity(communicator().stringToIdentity("_userid/callback"))); - otherCategoryTwoway.initiateCallback(twowayR, context); - test(callbackReceiverImpl.callbackOK()); - System.out.println("ok"); - } - - { - System.out.print("testing server shutdown... "); - System.out.flush(); - twoway.shutdown(); - // No ping, otherwise the router prints a warning message if it's - // started with --Ice.Warn.Connections. - System.out.println("ok"); - /* - try - { - base.ice_ping(); - test(false); - } - // If we use the glacier router, the exact exception reason gets - // lost. - catch(Ice.UnknownLocalException ex) - { - System.out.println("ok"); - } - */ - } - - { - System.out.print("destroying session... "); - System.out.flush(); - try - { - router.destroySession(); - test(false); - } - catch(Glacier2.SessionNotExistException ex) - { - test(false); - } - catch(Ice.ConnectionLostException ex) - { - } - catch(Ice.LocalException ex) - { - test(false); - } - System.out.println("ok"); - } - - { - System.out.print("trying to ping server after session destruction... "); - System.out.flush(); - try - { - base.ice_ping(); - test(false); - } - catch(Ice.ConnectionLostException ex) - { - System.out.println("ok"); - } - catch(Ice.SocketException ex) - { - // - // The JSSE implementation in the AIX JDK appears to have a - // bug that causes a "bad certificate" exception to be raised - // when the connection is forcefully dropped and a retry occurs. - // - if(System.getProperty("os.name").equals("AIX")) - { - System.out.println("ok"); - } - else - { - test(false); - } - } - } - - if(args.length >= 1 && args[0].equals("--shutdown")) - { - { - System.out.print("uninstalling router with communicator... "); - System.out.flush(); - communicator().setDefaultRouter(null); - System.out.println("ok"); - } - - Ice.ObjectPrx processBase; - - { - System.out.print("testing stringToProxy for process object... "); - processBase = communicator().stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348 -t 10000"); - System.out.println("ok"); - } - -/* - { - System.out.print("uninstalling router with process object... "); - processBase.ice_router(null); - System.out.println("ok"); - } -*/ - - Ice.ProcessPrx process; - - { - System.out.print("testing checked cast for admin object... "); - process = Ice.ProcessPrxHelper.checkedCast(processBase); - test(process != null); - System.out.println("ok"); - } - - System.out.print("testing Glacier2 shutdown... "); - process.shutdown(); - try - { - process.ice_ping(); - test(false); - } - catch(Ice.LocalException ex) - { - System.out.println("ok"); - } - } - - return 0; - } - - private static void - test(boolean b) - { - if(!b) - { - throw new RuntimeException(); - } - } -} diff --git a/java/test/Glacier2/router/CallbackI.java b/java/test/Glacier2/router/CallbackI.java index 71709335553..37a3aacbe7e 100644 --- a/java/test/Glacier2/router/CallbackI.java +++ b/java/test/Glacier2/router/CallbackI.java @@ -7,7 +7,11 @@ // // ********************************************************************** -import Test.*; +package test.Glacier2.router; + +import test.Glacier2.router.Test.CallbackException; +import test.Glacier2.router.Test.CallbackReceiverPrx; +import test.Glacier2.router.Test._CallbackDisp; final class CallbackI extends _CallbackDisp { diff --git a/java/test/Glacier2/router/CallbackReceiverI.java b/java/test/Glacier2/router/CallbackReceiverI.java index 2948675d024..a73657de99d 100644 --- a/java/test/Glacier2/router/CallbackReceiverI.java +++ b/java/test/Glacier2/router/CallbackReceiverI.java @@ -7,7 +7,10 @@ // // ********************************************************************** -import Test.*; +package test.Glacier2.router; + +import test.Glacier2.router.Test.CallbackException; +import test.Glacier2.router.Test._CallbackReceiverDisp; final class CallbackReceiverI extends _CallbackReceiverDisp { diff --git a/java/test/Glacier2/router/CallbackServer.java b/java/test/Glacier2/router/CallbackServer.java deleted file mode 100644 index 01a077589e6..00000000000 --- a/java/test/Glacier2/router/CallbackServer.java +++ /dev/null @@ -1,31 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -import Test.*; - -class CallbackServer extends Ice.Application -{ - public int - run(String[] args) - { - communicator().getProperties().setProperty("CallbackAdapter.Endpoints", "tcp -p 12010 -t 10000"); - Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter"); - adapter.add(new CallbackI(), - communicator().stringToIdentity("c1/callback")); // The test allows "c1" as category. - adapter.add(new CallbackI(), - communicator().stringToIdentity("c2/callback")); // The test allows "c2" as category. - adapter.add(new CallbackI(), - communicator().stringToIdentity("c3/callback")); // The test rejects "c3" as category. - adapter.add(new CallbackI(), - communicator().stringToIdentity("_userid/callback")); // The test allows the prefixed userid. - adapter.activate(); - communicator().waitForShutdown(); - return 0; - } -} diff --git a/java/test/Glacier2/router/Client.java b/java/test/Glacier2/router/Client.java index f936057ffcd..19d0322968f 100644 --- a/java/test/Glacier2/router/Client.java +++ b/java/test/Glacier2/router/Client.java @@ -7,24 +7,474 @@ // // ********************************************************************** -public class Client +package test.Glacier2.router; + +import java.io.PrintWriter; + +import test.Glacier2.router.Test.CallbackException; +import test.Glacier2.router.Test.CallbackPrx; +import test.Glacier2.router.Test.CallbackPrxHelper; +import test.Glacier2.router.Test.CallbackReceiverPrx; +import test.Glacier2.router.Test.CallbackReceiverPrxHelper; + + +public class Client extends test.Util.Application { - public static void - main(String[] args) + private static void + test(boolean b) + { + if(!b) + { + throw new RuntimeException(); + } + } + + public int + run(String[] args) + { + Ice.ObjectPrx routerBase; + + PrintWriter out = getWriter(); + { + out.print("testing stringToProxy for router... "); + out.flush(); + routerBase = communicator().stringToProxy("Glacier2/router:default -p 12347 -t 30000"); + out.println("ok"); + } + + Glacier2.RouterPrx router; + + { + out.print("testing checked cast for router... "); + out.flush(); + router = Glacier2.RouterPrxHelper.checkedCast(routerBase); + test(router != null); + out.println("ok"); + } + + { + out.print("installing router with communicator... "); + out.flush(); + communicator().setDefaultRouter(router); + out.println("ok"); + } + + { + out.print("getting the session timeout... "); + out.flush(); + long timeout = router.getSessionTimeout(); + test(timeout == 30); + out.println("ok"); + } + + Ice.ObjectPrx base; + + { + out.print("testing stringToProxy for server object... "); + out.flush(); + base = communicator().stringToProxy("c1/callback:tcp -p 12010 -t 10000"); + out.println("ok"); + } + + { + out.print("trying to ping server before session creation... "); + out.flush(); + try + { + base.ice_ping(); + test(false); + } + catch(Ice.ConnectionLostException ex) + { + out.println("ok"); + } + catch(Ice.SocketException ex) + { + // + // The JSSE implementation in the AIX JDK appears to have a + // bug that causes a "bad certificate" exception to be raised + // when the connection is forcefully dropped and a retry occurs. + // + if(System.getProperty("os.name").equals("AIX")) + { + out.println("ok"); + } + else + { + test(false); + } + } + } + + Glacier2.SessionPrx session; + + { + out.print("trying to create session with wrong password... "); + out.flush(); + try + { + session = router.createSession("userid", "xxx"); + test(false); + } + catch(Glacier2.PermissionDeniedException ex) + { + out.println("ok"); + } + catch(Glacier2.CannotCreateSessionException ex) + { + test(false); + } + } + + { + out.print("trying to destroy non-existing session... "); + out.flush(); + try + { + router.destroySession(); + test(false); + } + catch(Glacier2.SessionNotExistException ex) + { + out.println("ok"); + } + } + + { + out.print("creating session with correct password... "); + out.flush(); + try + { + session = router.createSession("userid", "abc123"); + } + catch(Glacier2.PermissionDeniedException ex) + { + test(false); + } + catch(Glacier2.CannotCreateSessionException ex) + { + test(false); + } + out.println("ok"); + } + + { + out.print("trying to create a second session... "); + out.flush(); + try + { + router.createSession("userid", "abc123"); + test(false); + } + catch(Glacier2.PermissionDeniedException ex) + { + test(false); + } + catch(Glacier2.CannotCreateSessionException ex) + { + out.println("ok"); + } + } + + { + out.print("pinging server after session creation... "); + out.flush(); + base.ice_ping(); + out.println("ok"); + } + + CallbackPrx twoway; + + { + out.print("testing checked cast for server object... "); + out.flush(); + twoway = CallbackPrxHelper.checkedCast(base); + test(twoway != null); + out.println("ok"); + } + + Ice.ObjectAdapter adapter; + + { + out.print("creating and activating callback receiver adapter... "); + out.flush(); + communicator().getProperties().setProperty("Ice.PrintAdapterReady", "0"); + adapter = communicator().createObjectAdapterWithRouter("CallbackReceiverAdapter", router); + adapter.activate(); + out.println("ok"); + } + + String category; + + { + out.print("getting category from router... "); + out.flush(); + category = router.getCategoryForClient(); + out.println("ok"); + } + + CallbackReceiverI callbackReceiverImpl; + Ice.Object callbackReceiver; + CallbackReceiverPrx twowayR; + CallbackReceiverPrx fakeTwowayR; + + { + out.print("creating and adding callback receiver object... "); + out.flush(); + callbackReceiverImpl = new CallbackReceiverI(); + callbackReceiver = callbackReceiverImpl; + Ice.Identity callbackReceiverIdent = new Ice.Identity(); + callbackReceiverIdent.name = "callbackReceiver"; + callbackReceiverIdent.category = category; + twowayR = CallbackReceiverPrxHelper.uncheckedCast(adapter.add(callbackReceiver, callbackReceiverIdent)); + Ice.Identity fakeCallbackReceiverIdent = new Ice.Identity(); + fakeCallbackReceiverIdent.name = "callbackReceiver"; + fakeCallbackReceiverIdent.category = "dummy"; + fakeTwowayR = CallbackReceiverPrxHelper.uncheckedCast( + adapter.add(callbackReceiver, fakeCallbackReceiverIdent)); + out.println("ok"); + } + + { + out.print("testing oneway callback... "); + out.flush(); + CallbackPrx oneway = CallbackPrxHelper.uncheckedCast(twoway.ice_oneway()); + CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_oneway()); + java.util.Map<String, String> context = new java.util.HashMap<String, String>(); + context.put("_fwd", "o"); + oneway.initiateCallback(onewayR, context); + test(callbackReceiverImpl.callbackOK()); + out.println("ok"); + } + + { + out.print("testing twoway callback... "); + out.flush(); + java.util.Map<String, String> context = new java.util.HashMap<String, String>(); + context.put("_fwd", "t"); + twoway.initiateCallback(twowayR, context); + test(callbackReceiverImpl.callbackOK()); + out.println("ok"); + } + + { + out.print("ditto, but with user exception... "); + out.flush(); + java.util.Map<String, String> context = new java.util.HashMap<String, String>(); + context.put("_fwd", "t"); + try + { + twoway.initiateCallbackEx(twowayR, context); + test(false); + } + catch(CallbackException ex) + { + test(ex.someValue == 3.14); + test(ex.someString.equals("3.14")); + } + test(callbackReceiverImpl.callbackOK()); + out.println("ok"); + } + + { + out.print("trying twoway callback with fake category... "); + out.flush(); + java.util.Map<String, String> context = new java.util.HashMap<String, String>(); + context.put("_fwd", "t"); + try + { + twoway.initiateCallback(fakeTwowayR, context); + test(false); + } + catch(Ice.ObjectNotExistException ex) + { + out.println("ok"); + } + } + + { + out.print("testing whether other allowed category is accepted... "); + out.flush(); + java.util.Map<String, String> context = new java.util.HashMap<String, String>(); + context.put("_fwd", "t"); + CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( + twoway.ice_identity(communicator().stringToIdentity("c2/callback"))); + otherCategoryTwoway.initiateCallback(twowayR, context); + test(callbackReceiverImpl.callbackOK()); + out.println("ok"); + } + + { + out.print("testing whether disallowed category gets rejected... "); + out.flush(); + java.util.Map<String, String> context = new java.util.HashMap<String, String>(); + context.put("_fwd", "t"); + try + { + CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( + twoway.ice_identity(communicator().stringToIdentity("c3/callback"))); + otherCategoryTwoway.initiateCallback(twowayR, context); + test(false); + } + catch(Ice.ObjectNotExistException ex) + { + out.println("ok"); + } + } + + { + out.print("testing whether user-id as category is accepted... "); + out.flush(); + java.util.Map<String, String> context = new java.util.HashMap<String, String>(); + context.put("_fwd", "t"); + CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( + twoway.ice_identity(communicator().stringToIdentity("_userid/callback"))); + otherCategoryTwoway.initiateCallback(twowayR, context); + test(callbackReceiverImpl.callbackOK()); + out.println("ok"); + } + + { + out.print("testing server shutdown... "); + out.flush(); + twoway.shutdown(); + // No ping, otherwise the router prints a warning message if it's + // started with --Ice.Warn.Connections. + out.println("ok"); + /* + try + { + base.ice_ping(); + test(false); + } + // If we use the glacier router, the exact exception reason gets + // lost. + catch(Ice.UnknownLocalException ex) + { + System.out.println("ok"); + } + */ + } + + { + out.print("destroying session... "); + out.flush(); + try + { + router.destroySession(); + test(false); + } + catch(Glacier2.SessionNotExistException ex) + { + test(false); + } + catch(Ice.ConnectionLostException ex) + { + } + catch(Ice.LocalException ex) + { + test(false); + } + out.println("ok"); + } + + { + out.print("trying to ping server after session destruction... "); + out.flush(); + try + { + base.ice_ping(); + test(false); + } + catch(Ice.ConnectionLostException ex) + { + out.println("ok"); + } + catch(Ice.SocketException ex) + { + // + // The JSSE implementation in the AIX JDK appears to have a + // bug that causes a "bad certificate" exception to be raised + // when the connection is forcefully dropped and a retry occurs. + // + if(System.getProperty("os.name").equals("AIX")) + { + out.println("ok"); + } + else + { + test(false); + } + } + } + + if(args.length >= 1 && args[0].equals("--shutdown")) + { + { + out.print("uninstalling router with communicator... "); + out.flush(); + communicator().setDefaultRouter(null); + out.println("ok"); + } + + Ice.ObjectPrx processBase; + + { + out.print("testing stringToProxy for process object... "); + processBase = communicator().stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348 -t 10000"); + out.println("ok"); + } + +/* + { + out.print("uninstalling router with process object... "); + processBase.ice_router(null); + out.println("ok"); + } +*/ + + Ice.ProcessPrx process; + + { + out.print("testing checked cast for admin object... "); + process = Ice.ProcessPrxHelper.checkedCast(processBase); + test(process != null); + out.println("ok"); + } + + out.print("testing Glacier2 shutdown... "); + process.shutdown(); + try + { + process.ice_ping(); + test(false); + } + catch(Ice.LocalException ex) + { + out.println("ok"); + } + } + + return 0; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - // - // We must disable connection warnings, because we attempt to - // ping the router before session establishment, as well as - // after session destruction. Both will cause a - // ConnectionLostException. - // - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); Ice.InitializationData initData = new Ice.InitializationData(); initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); initData.properties.setProperty("Ice.Warn.Connections", "0"); + initData.properties.setProperty("Ice.Package.Test", "test.Glacier2.router"); - CallbackClient app = new CallbackClient(); - int status = app.main("Client", argsH.value, initData); + return initData; + } + + public static void + main(String[] args) + { + Client c = new Client(); + int status = c.main("Client", args); + System.gc(); System.exit(status); } diff --git a/java/test/Glacier2/router/Server.java b/java/test/Glacier2/router/Server.java index 67ac0e8ab32..21b2dd8b50e 100644 --- a/java/test/Glacier2/router/Server.java +++ b/java/test/Glacier2/router/Server.java @@ -7,13 +7,44 @@ // // ********************************************************************** -public class Server +package test.Glacier2.router; + +public class Server extends test.Util.Application { + public int + run(String[] args) + { + communicator().getProperties().setProperty("CallbackAdapter.Endpoints", "tcp -p 12010 -t 10000"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("CallbackAdapter"); + adapter.add(new CallbackI(), + communicator().stringToIdentity("c1/callback")); // The test allows "c1" as category. + adapter.add(new CallbackI(), + communicator().stringToIdentity("c2/callback")); // The test allows "c2" as category. + adapter.add(new CallbackI(), + communicator().stringToIdentity("c3/callback")); // The test rejects "c3" as category. + adapter.add(new CallbackI(), + communicator().stringToIdentity("_userid/callback")); // The test allows the prefixed userid. + adapter.activate(); + communicator().waitForShutdown(); + return 0; + } + + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Glacier2.router"); + + return initData; + } + public static void main(String[] args) { - CallbackServer app = new CallbackServer(); - int status = app.main("Server", args); + Server c = new Server(); + int status = c.main("Server", args); + System.gc(); System.exit(status); } diff --git a/java/test/Glacier2/router/build.xml b/java/test/Glacier2/router/build.xml deleted file mode 100644 index f343d4034dc..00000000000 --- a/java/test/Glacier2/router/build.xml +++ /dev/null @@ -1,48 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Glacier2_router" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Callback.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/adapterDeactivation/AllTests.java b/java/test/Ice/adapterDeactivation/AllTests.java index 1a4f0220731..ca5bc9160d4 100644 --- a/java/test/Ice/adapterDeactivation/AllTests.java +++ b/java/test/Ice/adapterDeactivation/AllTests.java @@ -7,7 +7,12 @@ // // ********************************************************************** -import Test.*; +package test.Ice.adapterDeactivation; + +import java.io.PrintStream; + +import test.Ice.adapterDeactivation.Test.TestIntfPrx; +import test.Ice.adapterDeactivation.Test.TestIntfPrxHelper; public class AllTests { @@ -21,25 +26,25 @@ public class AllTests } public static TestIntfPrx - allTests(Ice.Communicator communicator) + allTests(Ice.Communicator communicator, java.io.PrintWriter out) { - System.out.print("testing stringToProxy... "); - System.out.flush(); + out.print("testing stringToProxy... "); + out.flush(); String ref = "test:default -p 12010 -t 10000"; Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing checked cast... "); - System.out.flush(); + out.print("testing checked cast... "); + out.flush(); TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base); test(obj != null); test(obj.equals(base)); - System.out.println("ok"); + out.println("ok"); { - System.out.print("creating/destroying/recreating object adapter... "); - System.out.flush(); + out.print("creating/destroying/recreating object adapter... "); + out.flush(); Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default"); try @@ -56,21 +61,21 @@ public class AllTests // adapter = communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default"); adapter.destroy(); - System.out.println("ok"); + out.println("ok"); } - System.out.print("creating/activating/deactivating object adapter in one operation... "); - System.out.flush(); + out.print("creating/activating/deactivating object adapter in one operation... "); + out.flush(); obj._transient(); - System.out.println("ok"); + out.println("ok"); - System.out.print("deactivating object adapter in the server... "); - System.out.flush(); + out.print("deactivating object adapter in the server... "); + out.flush(); obj.deactivate(); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing whether server is gone... "); - System.out.flush(); + out.print("testing whether server is gone... "); + out.flush(); try { obj.ice_ping(); @@ -78,7 +83,7 @@ public class AllTests } catch(Ice.LocalException ex) { - System.out.println("ok"); + out.println("ok"); } return obj; diff --git a/java/test/Ice/adapterDeactivation/Client.java b/java/test/Ice/adapterDeactivation/Client.java index 6c24edce08c..c9a0f3712c9 100644 --- a/java/test/Ice/adapterDeactivation/Client.java +++ b/java/test/Ice/adapterDeactivation/Client.java @@ -7,22 +7,30 @@ // // ********************************************************************** -public class Client +package test.Ice.adapterDeactivation; + +public class Client extends test.Util.Application { - static class TestClient extends Ice.Application + public int + run(String[] args) { - public int - run(String[] args) - { - AllTests.allTests(communicator()); - return 0; - } + AllTests.allTests(communicator(), getWriter()); + return 0; } + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation"); + return initData; + } + + public static void main(String[] args) { - TestClient app = new TestClient(); + Client app = new Client(); int result = app.main("Client", args); System.gc(); System.exit(result); diff --git a/java/test/Ice/adapterDeactivation/Collocated.java b/java/test/Ice/adapterDeactivation/Collocated.java index fd621ee2f54..60e7399f0ef 100644 --- a/java/test/Ice/adapterDeactivation/Collocated.java +++ b/java/test/Ice/adapterDeactivation/Collocated.java @@ -7,29 +7,36 @@ // // ********************************************************************** -public class Collocated +package test.Ice.adapterDeactivation; + +public class Collocated extends test.Util.Application { - static class TestServer extends Ice.Application + public int + run(String[] args) { - public int - run(String[] args) - { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); - Ice.ServantLocator locator = new ServantLocatorI(); - adapter.addServantLocator(locator, ""); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + Ice.ServantLocator locator = new ServantLocatorI(); + adapter.addServantLocator(locator, ""); + + AllTests.allTests(communicator(), getWriter()); - AllTests.allTests(communicator()); + adapter.waitForDeactivate(); + return 0; + } - adapter.waitForDeactivate(); - return 0; - } + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + return initData; } public static void main(String[] args) { - TestServer app = new TestServer(); + Collocated app = new Collocated(); int result = app.main("Collocated", args); System.exit(result); } diff --git a/java/test/Ice/adapterDeactivation/CookieI.java b/java/test/Ice/adapterDeactivation/CookieI.java index 46b4fac6e28..c4fbc52296d 100644 --- a/java/test/Ice/adapterDeactivation/CookieI.java +++ b/java/test/Ice/adapterDeactivation/CookieI.java @@ -7,7 +7,9 @@ // // ********************************************************************** -import Test.*; +package test.Ice.adapterDeactivation; + +import test.Ice.adapterDeactivation.Test.Cookie; public final class CookieI extends Cookie { diff --git a/java/test/Ice/adapterDeactivation/ServantLocatorI.java b/java/test/Ice/adapterDeactivation/ServantLocatorI.java index 3cf53e6440c..6525f5730e6 100644 --- a/java/test/Ice/adapterDeactivation/ServantLocatorI.java +++ b/java/test/Ice/adapterDeactivation/ServantLocatorI.java @@ -7,7 +7,9 @@ // // ********************************************************************** -import Test.*; +package test.Ice.adapterDeactivation; + +import test.Ice.adapterDeactivation.Test.Cookie; public final class ServantLocatorI implements Ice.ServantLocator { diff --git a/java/test/Ice/adapterDeactivation/Server.java b/java/test/Ice/adapterDeactivation/Server.java index 95b06996897..36ed2b732bf 100644 --- a/java/test/Ice/adapterDeactivation/Server.java +++ b/java/test/Ice/adapterDeactivation/Server.java @@ -7,29 +7,38 @@ // // ********************************************************************** -public class Server +package test.Ice.adapterDeactivation; + +public class Server extends test.Util.Application { - static class TestServer extends Ice.Application + public int + run(String[] args) { - public int - run(String[] args) - { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000:udp"); - Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); - Ice.ServantLocator locator = new ServantLocatorI(); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + Ice.ServantLocator locator = new ServantLocatorI(); - adapter.addServantLocator(locator, ""); - adapter.activate(); - adapter.waitForDeactivate(); - return 0; - } + adapter.addServantLocator(locator, ""); + adapter.activate(); + serverReady(); + adapter.waitForDeactivate(); + return 0; } + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.adapterDeactivation"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000:udp"); + return initData; + } + public static void main(String[] args) { - TestServer app = new TestServer(); + Server app = new Server(); int result = app.main("Server", args); + System.gc(); System.exit(result); } diff --git a/java/test/Ice/adapterDeactivation/Test.ice b/java/test/Ice/adapterDeactivation/Test.ice index d8ad4c7f1f2..a932bb653ef 100644 --- a/java/test/Ice/adapterDeactivation/Test.ice +++ b/java/test/Ice/adapterDeactivation/Test.ice @@ -10,6 +10,7 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Ice.adapterDeactivation"]] module Test { diff --git a/java/test/Ice/adapterDeactivation/TestI.java b/java/test/Ice/adapterDeactivation/TestI.java index cb373ea5b44..f36d76cd15c 100644 --- a/java/test/Ice/adapterDeactivation/TestI.java +++ b/java/test/Ice/adapterDeactivation/TestI.java @@ -7,7 +7,9 @@ // // ********************************************************************** -import Test.*; +package test.Ice.adapterDeactivation; + +import test.Ice.adapterDeactivation.Test.*; public final class TestI extends _TestIntfDisp { diff --git a/java/test/Ice/adapterDeactivation/build.xml b/java/test/Ice/adapterDeactivation/build.xml deleted file mode 100644 index 0fe79983631..00000000000 --- a/java/test/Ice/adapterDeactivation/build.xml +++ /dev/null @@ -1,48 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_operations" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/background/Acceptor.java b/java/test/Ice/background/Acceptor.java index df6ddddd8e6..348602e72e4 100644 --- a/java/test/Ice/background/Acceptor.java +++ b/java/test/Ice/background/Acceptor.java @@ -7,6 +7,8 @@ // // ********************************************************************** +package test.Ice.background; + class Acceptor implements IceInternal.Acceptor { public java.nio.channels.ServerSocketChannel @@ -30,7 +32,7 @@ class Acceptor implements IceInternal.Acceptor public IceInternal.Transceiver accept() { - return new Transceiver(_acceptor.accept()); + return new Transceiver(_configuration, _acceptor.accept()); } public String @@ -39,8 +41,9 @@ class Acceptor implements IceInternal.Acceptor return _acceptor.toString(); } - Acceptor(IceInternal.Acceptor acceptor) + Acceptor(Configuration configuration, IceInternal.Acceptor acceptor) { + _configuration = configuration; _acceptor = acceptor; } @@ -52,4 +55,5 @@ class Acceptor implements IceInternal.Acceptor } final private IceInternal.Acceptor _acceptor; + private Configuration _configuration; } diff --git a/java/test/Ice/background/AllTests.java b/java/test/Ice/background/AllTests.java index 2c58e1a2ab6..3bead0cfa51 100644 --- a/java/test/Ice/background/AllTests.java +++ b/java/test/Ice/background/AllTests.java @@ -6,8 +6,17 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** +package test.Ice.background; -import Test.*; +import java.io.PrintStream; +import java.io.PrintWriter; + +import test.Ice.background.Test.AMI_Background_op; +import test.Ice.background.Test.AMI_Background_opWithPayload; +import test.Ice.background.Test.BackgroundControllerPrx; +import test.Ice.background.Test.BackgroundControllerPrxHelper; +import test.Ice.background.Test.BackgroundPrx; +import test.Ice.background.Test.BackgroundPrxHelper; public class AllTests { @@ -121,7 +130,7 @@ public class AllTests private BackgroundPrx _background = null; } - private static class OpAMICallback extends Test.AMI_Background_op implements Ice.AMISentCallback + private static class OpAMICallback extends AMI_Background_op implements Ice.AMISentCallback { public void ice_response() @@ -165,7 +174,7 @@ public class AllTests private Callback sent = new Callback(); } - private static class OpExAMICallback extends Test.AMI_Background_op implements Ice.AMISentCallback + private static class OpExAMICallback extends AMI_Background_op implements Ice.AMISentCallback { public void ice_response() @@ -201,7 +210,7 @@ public class AllTests private Callback sent = new Callback(); } - private static class OpWithPayloadOnewayAMICallback extends Test.AMI_Background_opWithPayload + private static class OpWithPayloadOnewayAMICallback extends AMI_Background_opWithPayload { public void ice_response() @@ -226,8 +235,8 @@ public class AllTests } }; - public static Test.BackgroundPrx - allTests(Ice.Communicator communicator, java.io.PrintStream out) + public static BackgroundPrx + allTests(Configuration configuration, Ice.Communicator communicator, PrintWriter out) { String sref = "background:default -p 12010 -t 20000"; Ice.ObjectPrx obj = communicator.stringToProxy(sref); @@ -241,38 +250,36 @@ public class AllTests BackgroundControllerPrx backgroundController = BackgroundControllerPrxHelper.uncheckedCast(obj); - Configuration configuration = Configuration.getInstance(); - - System.out.print("testing connect... "); - System.out.flush(); + out.print("testing connect... "); + out.flush(); { connectTests(configuration, background); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing initialization... "); - System.out.flush(); + out.print("testing initialization... "); + out.flush(); { initializeTests(configuration, background, backgroundController); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing connection validation... "); - System.out.flush(); + out.print("testing connection validation... "); + out.flush(); { validationTests(configuration, background, backgroundController); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing read/write... "); - System.out.flush(); + out.print("testing read/write... "); + out.flush(); { readWriteTests(configuration, background, backgroundController); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing locator... "); - System.out.flush(); + out.print("testing locator... "); + out.flush(); { Ice.LocatorPrx locator; obj = communicator.stringToProxy("locator:default -p 12010 -t 500"); @@ -289,7 +296,7 @@ public class AllTests } backgroundController.resumeCall("findAdapterById"); - obj = communicator.stringToProxy("locator:default -p 12010 -t 10000"); + obj = communicator.stringToProxy("locator:default -p 12010 -t 20000"); locator = Ice.LocatorPrxHelper.uncheckedCast(obj); obj = obj.ice_locator(locator); obj.ice_ping(); @@ -308,10 +315,10 @@ public class AllTests test(cb.response(true)); test(cb2.response(true)); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing router... "); - System.out.flush(); + out.print("testing router... "); + out.flush(); { Ice.RouterPrx router; @@ -329,7 +336,7 @@ public class AllTests } backgroundController.resumeCall("getClientProxy"); - obj = communicator.stringToProxy("router:default -p 12010 -t 10000"); + obj = communicator.stringToProxy("router:default -p 12010 -t 20000"); router = Ice.RouterPrxHelper.uncheckedCast(obj); obj = communicator.stringToProxy("background@Test").ice_router(router); BackgroundPrx bg = BackgroundPrxHelper.uncheckedCast(obj); @@ -346,13 +353,13 @@ public class AllTests test(cb.response(true)); test(cb2.response(true)); } - System.out.println("ok"); + out.println("ok"); return background; } private static void - connectTests(Configuration configuration, Test.BackgroundPrx background) + connectTests(Configuration configuration, BackgroundPrx background) { try { @@ -455,7 +462,7 @@ public class AllTests } private static void - initializeTests(Configuration configuration, Test.BackgroundPrx background, Test.BackgroundControllerPrx ctl) + initializeTests(Configuration configuration, BackgroundPrx background, BackgroundControllerPrx ctl) { try { @@ -690,7 +697,7 @@ public class AllTests } private static void - validationTests(Configuration configuration, Test.BackgroundPrx background, Test.BackgroundControllerPrx ctl) + validationTests(Configuration configuration, BackgroundPrx background, BackgroundControllerPrx ctl) { try { @@ -919,7 +926,7 @@ public class AllTests } private static void - readWriteTests(Configuration configuration, Test.BackgroundPrx background, Test.BackgroundControllerPrx ctl) + readWriteTests(Configuration configuration, BackgroundPrx background, BackgroundControllerPrx ctl) { try { diff --git a/java/test/Ice/background/BackgroundControllerI.java b/java/test/Ice/background/BackgroundControllerI.java index 1444b2e9849..74a535f608a 100644 --- a/java/test/Ice/background/BackgroundControllerI.java +++ b/java/test/Ice/background/BackgroundControllerI.java @@ -6,8 +6,9 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** +package test.Ice.background; -import Test.*; +import test.Ice.background.Test._BackgroundControllerDisp; class BackgroundControllerI extends _BackgroundControllerDisp { @@ -105,10 +106,10 @@ class BackgroundControllerI extends _BackgroundControllerDisp } public - BackgroundControllerI(Ice.ObjectAdapter adapter) + BackgroundControllerI(Configuration configuration, Ice.ObjectAdapter adapter) { _adapter = adapter; - _configuration = Configuration.getInstance(); + _configuration = configuration; } final private Ice.ObjectAdapter _adapter; diff --git a/java/test/Ice/background/BackgroundI.java b/java/test/Ice/background/BackgroundI.java index 6a4d4553b28..84743a664a2 100644 --- a/java/test/Ice/background/BackgroundI.java +++ b/java/test/Ice/background/BackgroundI.java @@ -6,8 +6,9 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** +package test.Ice.background; -import Test.*; +import test.Ice.background.Test._BackgroundDisp; class BackgroundI extends _BackgroundDisp { diff --git a/java/test/Ice/background/Client.java b/java/test/Ice/background/Client.java index 91a4be7dbe8..823af51fb5e 100644 --- a/java/test/Ice/background/Client.java +++ b/java/test/Ice/background/Client.java @@ -6,69 +6,61 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** +package test.Ice.background; -public class Client +import test.Ice.background.PluginFactory.PluginI; +import test.Ice.background.Test.BackgroundPrx; + +public class Client extends test.Util.Application { - public static int - run(String[] args, Ice.Communicator communicator, java.io.PrintStream out) + public int + run(String[] args) { - Test.BackgroundPrx background = AllTests.allTests(communicator, out); + Configuration configuration = new Configuration(); + PluginI plugin = (PluginI)communicator().getPluginManager().getPlugin("Test"); + plugin.setConfiguration(configuration); + communicator().getPluginManager().initializePlugins(); + + BackgroundPrx background = AllTests.allTests(configuration, communicator(), getWriter()); background.shutdown(); return 0; } - - public static void - main(String[] args) + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); - // - // For this test, we want to disable retries. - // - initData.properties.setProperty("Ice.RetryIntervals", "-1"); + // For this test, we want to disable retries. + // + initData.properties.setProperty("Ice.RetryIntervals", "-1"); - // - // This test kills connections, so we don't want warnings. - // - initData.properties.setProperty("Ice.Warn.Connections", "0"); + // + // This test kills connections, so we don't want warnings. + // + initData.properties.setProperty("Ice.Warn.Connections", "0"); - // - // Setup the test transport plug-in. - // - initData.properties.setProperty("Ice.Plugin.Test", "PluginFactory"); - String defaultProtocol = initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp"); - initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol); + // + // Setup the test transport plug-in. + // + initData.properties.setProperty("Ice.Plugin.Test", "test.Ice.background.PluginFactory"); + String defaultProtocol = initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp"); + initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol); + + initData.properties.setProperty("Ice.Package.Test", "test.Ice.background"); + + // Don't initialize the plugin until I've set the configuration. + initData.properties.setProperty("Ice.InitPlugins", "0"); - communicator = Ice.Util.initialize(argsH, initData); - status = run(argsH.value, communicator, System.out); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + return initData; + } + public static void + main(String[] args) + { + Client app = new Client(); + int result = app.main("Client", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/background/Collocated.java b/java/test/Ice/background/Collocated.java new file mode 100644 index 00000000000..ccb05bcde09 --- /dev/null +++ b/java/test/Ice/background/Collocated.java @@ -0,0 +1,82 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** +package test.Ice.background; + +public class Collocated +{ + static Thread _clientThread; + static int result; + + public static void + main(String[] args) + { + final Client client = new Client(); + final Server server = new Server(); + Thread t = new Thread(new Runnable() + { + public void run() + { + String[] args = + { + "--Ice.NullHandleAbort=1", + "--Ice.Warn.Connections=1", + "--Ice.ThreadPool.Server.Size=1", + "--Ice.ThreadPool.Server.SizeMax=3", + "--Ice.ThreadPool.Server.SizeWarn=0", + "--Ice.PrintAdapterReady=1", + "--Ice.ServerIdleTime=30", + "--Ice.Default.Host=127.0.0.1" + }; + server.setServerReadyListener(new test.Util.Application.ServerReadyListener() + { + public void serverReady() + { + _clientThread = new Thread(new Runnable() + { + public void run() + { + String[] args = + { + "--Ice.NullHandleAbort=1", "--Ice.Warn.Connections=1", "--Ice.Default.Host=127.0.0.1" + }; + client.main("Client", args); + } + }); + _clientThread.start(); + } + }); + + result = server.main("Server", args); + if(_clientThread != null) + { + while(_clientThread.isAlive()) + { + try + { + _clientThread.join(); + } + catch(InterruptedException e1) + { + } + } + } + } + }); + t.start(); + try + { + t.join(); + } + catch(InterruptedException ex) + { + } + System.gc(); + System.exit(result); + } +} diff --git a/java/test/Ice/background/Configuration.java b/java/test/Ice/background/Configuration.java index 97aeefa60c4..f6a74404c5b 100644 --- a/java/test/Ice/background/Configuration.java +++ b/java/test/Ice/background/Configuration.java @@ -6,6 +6,7 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** +package test.Ice.background; public final class Configuration { @@ -141,12 +142,6 @@ public final class Configuration } } - static public synchronized Configuration - getInstance() - { - return _instance; - } - private Ice.LocalException _connectorsException; private Ice.LocalException _connectException; private IceInternal.SocketStatus _initializeSocketStatus; @@ -156,6 +151,4 @@ public final class Configuration private Ice.LocalException _readException; private int _writeReadyCount; private Ice.LocalException _writeException; - - private final static Configuration _instance = new Configuration(); } diff --git a/java/test/Ice/background/Connector.java b/java/test/Ice/background/Connector.java index b737a1400ef..dccba9e1e6b 100644 --- a/java/test/Ice/background/Connector.java +++ b/java/test/Ice/background/Connector.java @@ -6,6 +6,7 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** +package test.Ice.background; final class Connector implements IceInternal.Connector { @@ -13,7 +14,7 @@ final class Connector implements IceInternal.Connector connect() { _configuration.checkConnectException(); - return new Transceiver(_connector.connect()); + return new Transceiver(_configuration, _connector.connect()); } public short @@ -37,9 +38,9 @@ final class Connector implements IceInternal.Connector // // Only for use by Endpoint // - Connector(IceInternal.Connector connector) + Connector(Configuration configuration, IceInternal.Connector connector) { - _configuration = Configuration.getInstance(); + _configuration = configuration; _connector = connector; } diff --git a/java/test/Ice/background/EndpointFactory.java b/java/test/Ice/background/EndpointFactory.java index 54ecd46023d..c5f799a3be7 100644 --- a/java/test/Ice/background/EndpointFactory.java +++ b/java/test/Ice/background/EndpointFactory.java @@ -6,11 +6,13 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** +package test.Ice.background; final class EndpointFactory implements IceInternal.EndpointFactory { - EndpointFactory(IceInternal.EndpointFactory factory) + EndpointFactory(Configuration configuration, IceInternal.EndpointFactory factory) { + _configuration = configuration; _factory = factory; } @@ -29,14 +31,14 @@ final class EndpointFactory implements IceInternal.EndpointFactory public IceInternal.EndpointI create(String str, boolean server) { - return new EndpointI(_factory.create(str, server)); + return new EndpointI(_configuration, _factory.create(str, server)); } public IceInternal.EndpointI read(IceInternal.BasicStream s) { s.readShort(); - return new EndpointI(_factory.read(s)); + return new EndpointI(_configuration, _factory.read(s)); } public void @@ -44,5 +46,6 @@ final class EndpointFactory implements IceInternal.EndpointFactory { } + private Configuration _configuration; private IceInternal.EndpointFactory _factory; } diff --git a/java/test/Ice/background/EndpointI.java b/java/test/Ice/background/EndpointI.java index 35147578498..ee650de73c6 100644 --- a/java/test/Ice/background/EndpointI.java +++ b/java/test/Ice/background/EndpointI.java @@ -6,16 +6,17 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** +package test.Ice.background; final class EndpointI extends IceInternal.EndpointI { final static short TYPE_BASE = 100; public - EndpointI(IceInternal.EndpointI endpoint) + EndpointI(Configuration configuration, IceInternal.EndpointI endpoint) { _endpoint = endpoint; - _configuration = Configuration.getInstance(); + _configuration = configuration; } // @@ -71,7 +72,7 @@ final class EndpointI extends IceInternal.EndpointI } else { - return new EndpointI(endpoint); + return new EndpointI(_configuration, endpoint); } } @@ -88,7 +89,7 @@ final class EndpointI extends IceInternal.EndpointI } else { - return new EndpointI(endpoint); + return new EndpointI(_configuration, endpoint); } } @@ -117,7 +118,7 @@ final class EndpointI extends IceInternal.EndpointI } else { - return new EndpointI(endpoint); + return new EndpointI(_configuration, endpoint); } } @@ -165,12 +166,12 @@ final class EndpointI extends IceInternal.EndpointI } else { - endpoint.value = new EndpointI(endpoint.value); + endpoint.value = new EndpointI(_configuration, endpoint.value); } if(transceiver != null) { - return new Transceiver(transceiver); + return new Transceiver(_configuration, transceiver); } else { @@ -190,7 +191,7 @@ final class EndpointI extends IceInternal.EndpointI java.util.Iterator<IceInternal.Connector> p = _endpoint.connectors().iterator(); while(p.hasNext()) { - connectors.add(new Connector(p.next())); + connectors.add(new Connector(_configuration, p.next())); } return connectors; } @@ -207,7 +208,7 @@ final class EndpointI extends IceInternal.EndpointI java.util.Iterator<IceInternal.Connector> p = cons.iterator(); while(p.hasNext()) { - connectors.add(new Connector(p.next())); + connectors.add(new Connector(_configuration, p.next())); } cb.connectors(connectors); } @@ -233,8 +234,8 @@ final class EndpointI extends IceInternal.EndpointI public IceInternal.Acceptor acceptor(IceInternal.EndpointIHolder endpoint, String adapterName) { - Acceptor p = new Acceptor(_endpoint.acceptor(endpoint, adapterName)); - endpoint.value = new EndpointI(endpoint.value); + Acceptor p = new Acceptor(_configuration, _endpoint.acceptor(endpoint, adapterName)); + endpoint.value = new EndpointI(_configuration, endpoint.value); return p; } @@ -246,7 +247,7 @@ final class EndpointI extends IceInternal.EndpointI while(iter.hasNext()) { IceInternal.EndpointI endpt = iter.next(); - endps.add(endpt == _endpoint ? this : new EndpointI(endpt)); + endps.add(endpt == _endpoint ? this : new EndpointI(_configuration, endpt)); } return endps; } diff --git a/java/test/Ice/background/PluginFactory.java b/java/test/Ice/background/PluginFactory.java index 67e954d5de5..1e8809b1e5f 100644 --- a/java/test/Ice/background/PluginFactory.java +++ b/java/test/Ice/background/PluginFactory.java @@ -6,10 +6,11 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** +package test.Ice.background; public class PluginFactory implements Ice.PluginFactory { - static class PluginI implements Ice.Plugin + static public class PluginI implements Ice.Plugin { public PluginI(Ice.Communicator communicator) @@ -20,13 +21,14 @@ public class PluginFactory implements Ice.PluginFactory public void initialize() { + assert _configuration != null; IceInternal.ProtocolPluginFacade facade = Ice.Util.getProtocolPluginFacade(_communicator); for(short s = 0; s < 100; ++s) { IceInternal.EndpointFactory factory = facade.getEndpointFactory(s); if(factory != null) { - facade.addEndpointFactory(new EndpointFactory(factory)); + facade.addEndpointFactory(new EndpointFactory(_configuration, factory)); } } } @@ -35,8 +37,15 @@ public class PluginFactory implements Ice.PluginFactory destroy() { } + + public void + setConfiguration(Configuration configuration) + { + _configuration = configuration; + } private final Ice.Communicator _communicator; + private Configuration _configuration; } public Ice.Plugin diff --git a/java/test/Ice/background/Server.java b/java/test/Ice/background/Server.java index 7e5cdb7d513..7d3e941a3f1 100644 --- a/java/test/Ice/background/Server.java +++ b/java/test/Ice/background/Server.java @@ -6,8 +6,11 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** +package test.Ice.background; -public class Server +import test.Ice.background.PluginFactory.PluginI; + +public class Server extends test.Util.Application { static public class LocatorI extends Ice._LocatorDisp { @@ -80,88 +83,65 @@ public class Server final private BackgroundControllerI _controller; } - public static int - run(String[] args, Ice.Communicator communicator, java.io.PrintStream out) + public int + run(String[] args) { - // - // When running as a MIDlet the properties for the server may be - // overridden by configuration. If it isn't then we assume - // defaults. - // - if(communicator.getProperties().getProperty("TestAdapter.Endpoints").length() == 0) - { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - } - if(communicator.getProperties().getProperty("ControllerAdapter.Endpoints").length() == 0) - { - communicator.getProperties().setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); - communicator.getProperties().setProperty("ControllerAdapter.ThreadPool.Size", "1"); - } - - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("ControllerAdapter"); + Configuration configuration = new Configuration(); + PluginI plugin = (PluginI)communicator().getPluginManager().getPlugin("Test"); + plugin.setConfiguration(configuration); + communicator().getPluginManager().initializePlugins(); + + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + Ice.ObjectAdapter adapter2 = communicator().createObjectAdapter("ControllerAdapter"); - BackgroundControllerI backgroundController = new BackgroundControllerI(adapter); + BackgroundControllerI backgroundController = new BackgroundControllerI(configuration, adapter); - adapter.add(new BackgroundI(backgroundController), communicator.stringToIdentity("background")); - adapter.add(new LocatorI(backgroundController), communicator.stringToIdentity("locator")); - adapter.add(new RouterI(backgroundController), communicator.stringToIdentity("router")); + adapter.add(new BackgroundI(backgroundController), communicator().stringToIdentity("background")); + adapter.add(new LocatorI(backgroundController), communicator().stringToIdentity("locator")); + adapter.add(new RouterI(backgroundController), communicator().stringToIdentity("router")); adapter.activate(); - adapter2.add(backgroundController, communicator.stringToIdentity("backgroundController")); + adapter2.add(backgroundController, communicator().stringToIdentity("backgroundController")); adapter2.activate(); - communicator.waitForShutdown(); - return 0; + return WAIT; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); - // - // This test kills connections, so we don't want warnings. - // - initData.properties.setProperty("Ice.Warn.Connections", "0"); - - // - // Setup the test transport plug-in. - // - initData.properties.setProperty("Ice.Plugin.Test", "PluginFactory"); - String defaultProtocol = initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp"); - initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol); - - communicator = Ice.Util.initialize(argsH, initData); - status = run(argsH.value, communicator, System.out); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } + // + // This test kills connections, so we don't want warnings. + // + initData.properties.setProperty("Ice.Warn.Connections", "0"); + + // + // Setup the test transport plug-in. + // + initData.properties.setProperty("Ice.Plugin.Test", "test.Ice.background.PluginFactory"); + String defaultProtocol = initData.properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp"); + initData.properties.setProperty("Ice.Default.Protocol", "test-" + defaultProtocol); + + initData.properties.setProperty("Ice.Package.Test", "test.Ice.background"); - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 20000"); + initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp -p 12011"); + initData.properties.setProperty("ControllerAdapter.ThreadPool.Size", "1"); + + // Don't initialize the plugin until I've set the configuration. + initData.properties.setProperty("Ice.InitPlugins", "0"); + + return initData; + } + public static void + main(String[] args) + { + Server app = new Server(); + int result = app.main("Server", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/background/Test.ice b/java/test/Ice/background/Test.ice index e4707ef2706..ed071059f39 100644 --- a/java/test/Ice/background/Test.ice +++ b/java/test/Ice/background/Test.ice @@ -12,6 +12,7 @@ #include <Ice/BuiltinSequences.ice> +[["java:package:test.Ice.background"]] module Test { diff --git a/java/test/Ice/background/Transceiver.java b/java/test/Ice/background/Transceiver.java index c1b869e3e8a..1dc8dd0ac05 100644 --- a/java/test/Ice/background/Transceiver.java +++ b/java/test/Ice/background/Transceiver.java @@ -6,7 +6,7 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** - +package test.Ice.background; final class Transceiver implements IceInternal.Transceiver { public java.nio.channels.SelectableChannel @@ -112,10 +112,10 @@ final class Transceiver implements IceInternal.Transceiver // // Only for use by Connector, Acceptor // - Transceiver(IceInternal.Transceiver transceiver) + Transceiver(Configuration configuration, IceInternal.Transceiver transceiver) { _transceiver = transceiver; - _configuration = Configuration.getInstance(); + _configuration = configuration; } protected synchronized void diff --git a/java/test/Ice/background/build.xml b/java/test/Ice/background/build.xml deleted file mode 100644 index 0655e6ae7a6..00000000000 --- a/java/test/Ice/background/build.xml +++ /dev/null @@ -1,51 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_background" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - <includepath> - <pathelement path="${slice.dir}" /> - </includepath> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/binding/AllTests.java b/java/test/Ice/binding/AllTests.java index 2c9db86d7c8..9e3c824c030 100644 --- a/java/test/Ice/binding/AllTests.java +++ b/java/test/Ice/binding/AllTests.java @@ -7,7 +7,16 @@ // // ********************************************************************** -import Test.*; +package test.Ice.binding; + +import java.io.PrintWriter; + +import test.Ice.binding.Test.AMI_TestIntf_getAdapterName; +import test.Ice.binding.Test.RemoteCommunicatorPrx; +import test.Ice.binding.Test.RemoteCommunicatorPrxHelper; +import test.Ice.binding.Test.RemoteObjectAdapterPrx; +import test.Ice.binding.Test.TestIntfPrx; +import test.Ice.binding.Test.TestIntfPrxHelper; public class AllTests { @@ -113,13 +122,13 @@ public class AllTests } public static void - allTests(Ice.Communicator communicator) + allTests(Ice.Communicator communicator, PrintWriter out) { String ref = "communicator:default -p 12010 -t 10000"; RemoteCommunicatorPrx com = RemoteCommunicatorPrxHelper.uncheckedCast(communicator.stringToProxy(ref)); - System.out.print("testing binding with single endpoint... "); - System.out.flush(); + out.print("testing binding with single endpoint... "); + out.flush(); { RemoteObjectAdapterPrx adapter = com.createObjectAdapter("Adapter", "default"); @@ -149,10 +158,10 @@ public class AllTests // } } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing binding with multiple endpoints... "); - System.out.flush(); + out.print("testing binding with multiple endpoints... "); + out.flush(); { java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>(); adapters.add(com.createObjectAdapter("Adapter11", "default")); @@ -245,10 +254,10 @@ public class AllTests deactivate(com, adapters); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing binding with multiple random endpoints... "); - System.out.flush(); + out.print("testing binding with multiple random endpoints... "); + out.flush(); { java.util.Random rand = new java.util.Random(); @@ -345,10 +354,10 @@ public class AllTests } } } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing binding with multiple endpoints and AMI... "); - System.out.flush(); + out.print("testing binding with multiple endpoints and AMI... "); + out.flush(); { java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>(); adapters.add(com.createObjectAdapter("AdapterAMI11", "default")); @@ -441,10 +450,10 @@ public class AllTests deactivate(com, adapters); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing random endpoint selection... "); - System.out.flush(); + out.print("testing random endpoint selection... "); + out.flush(); { java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>(); adapters.add(com.createObjectAdapter("Adapter21", "default")); @@ -478,10 +487,10 @@ public class AllTests deactivate(com, adapters); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing ordered endpoint selection... "); - System.out.flush(); + out.print("testing ordered endpoint selection... "); + out.flush(); { java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>(); adapters.add(com.createObjectAdapter("Adapter31", "default")); @@ -542,10 +551,10 @@ public class AllTests deactivate(com, adapters); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing per request binding with single endpoint... "); - System.out.flush(); + out.print("testing per request binding with single endpoint... "); + out.flush(); { RemoteObjectAdapterPrx adapter = com.createObjectAdapter("Adapter41", "default"); @@ -573,10 +582,10 @@ public class AllTests // } } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing per request binding with multiple endpoints... "); - System.out.flush(); + out.print("testing per request binding with multiple endpoints... "); + out.flush(); { java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>(); adapters.add(com.createObjectAdapter("Adapter51", "default")); @@ -610,10 +619,10 @@ public class AllTests deactivate(com, adapters); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing per request binding with multiple endpoints and AMI... "); - System.out.flush(); + out.print("testing per request binding with multiple endpoints and AMI... "); + out.flush(); { java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>(); adapters.add(com.createObjectAdapter("AdapterAMI51", "default")); @@ -647,10 +656,10 @@ public class AllTests deactivate(com, adapters); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing per request binding and ordered endpoint selection... "); - System.out.flush(); + out.print("testing per request binding and ordered endpoint selection... "); + out.flush(); { java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>(); adapters.add(com.createObjectAdapter("Adapter61", "default")); @@ -711,10 +720,10 @@ public class AllTests deactivate(com, adapters); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing per request binding and ordered endpoint selection and AMI... "); - System.out.flush(); + out.print("testing per request binding and ordered endpoint selection and AMI... "); + out.flush(); { java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>(); adapters.add(com.createObjectAdapter("AdapterAMI61", "default")); @@ -775,10 +784,10 @@ public class AllTests deactivate(com, adapters); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing endpoint mode filtering... "); - System.out.flush(); + out.print("testing endpoint mode filtering... "); + out.flush(); { java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>(); adapters.add(com.createObjectAdapter("Adapter71", "default")); @@ -797,12 +806,12 @@ public class AllTests { } } - System.out.println("ok"); + out.println("ok"); if(communicator.getProperties().getProperty("Ice.Plugin.IceSSL").length() > 0) { - System.out.print("testing unsecure vs. secure endpoints... "); - System.out.flush(); + out.print("testing unsecure vs. secure endpoints... "); + out.flush(); { java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>(); adapters.add(com.createObjectAdapter("Adapter81", "ssl")); @@ -856,7 +865,7 @@ public class AllTests deactivate(com, adapters); } - System.out.println("ok"); + out.println("ok"); } com.shutdown(); diff --git a/java/test/Ice/binding/Client.java b/java/test/Ice/binding/Client.java index da27b62dccd..51f3ad6c22b 100644 --- a/java/test/Ice/binding/Client.java +++ b/java/test/Ice/binding/Client.java @@ -7,46 +7,29 @@ // // ********************************************************************** -public class Client +package test.Ice.binding; + +public class Client extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { - AllTests.allTests(communicator); + AllTests.allTests(communicator(), getWriter()); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch (Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.binding"); + return initData; + } + public static void main(String[] args) + { + Client app = new Client(); + int result = app.main("Client", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/binding/RemoteCommunicatorI.java b/java/test/Ice/binding/RemoteCommunicatorI.java index 8b0bf22617f..34b2a6e6a79 100644 --- a/java/test/Ice/binding/RemoteCommunicatorI.java +++ b/java/test/Ice/binding/RemoteCommunicatorI.java @@ -6,8 +6,10 @@ // ICE_LICENSE file included in this distribution. // // ********************************************************************** - -import Test.*; +package test.Ice.binding; +import test.Ice.binding.Test.RemoteObjectAdapterPrx; +import test.Ice.binding.Test.RemoteObjectAdapterPrxHelper; +import test.Ice.binding.Test._RemoteCommunicatorDisp; public class RemoteCommunicatorI extends _RemoteCommunicatorDisp { diff --git a/java/test/Ice/binding/RemoteObjectAdapterI.java b/java/test/Ice/binding/RemoteObjectAdapterI.java index 7828efba913..998e721d435 100644 --- a/java/test/Ice/binding/RemoteObjectAdapterI.java +++ b/java/test/Ice/binding/RemoteObjectAdapterI.java @@ -7,7 +7,11 @@ // // ********************************************************************** -import Test.*; +package test.Ice.binding; + +import test.Ice.binding.Test.TestIntfPrx; +import test.Ice.binding.Test.TestIntfPrxHelper; +import test.Ice.binding.Test._RemoteObjectAdapterDisp; public class RemoteObjectAdapterI extends _RemoteObjectAdapterDisp { diff --git a/java/test/Ice/binding/Server.java b/java/test/Ice/binding/Server.java index ab5228fe620..29d7405c32e 100644 --- a/java/test/Ice/binding/Server.java +++ b/java/test/Ice/binding/Server.java @@ -7,52 +7,37 @@ // // ********************************************************************** -public class Server +package test.Ice.binding; + +public class Server extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int + run(String[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + Ice.Communicator communicator = communicator(); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Identity id = communicator.stringToIdentity("communicator"); adapter.add(new RemoteCommunicatorI(), id); adapter.activate(); - communicator.waitForShutdown(); - return 0; + return WAIT; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.binding"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + return initData; } public static void main(String[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - + Server app = new Server(); + int result = app.main("Server", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/binding/Test.ice b/java/test/Ice/binding/Test.ice index 40783e4535c..626729438a8 100644 --- a/java/test/Ice/binding/Test.ice +++ b/java/test/Ice/binding/Test.ice @@ -10,6 +10,7 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Ice.binding"]] module Test { diff --git a/java/test/Ice/binding/TestI.java b/java/test/Ice/binding/TestI.java index a403d501067..f7670718536 100644 --- a/java/test/Ice/binding/TestI.java +++ b/java/test/Ice/binding/TestI.java @@ -7,7 +7,8 @@ // // ********************************************************************** -import Test.*; +package test.Ice.binding; +import test.Ice.binding.Test._TestIntfDisp; public class TestI extends _TestIntfDisp { diff --git a/java/test/Ice/binding/build.xml b/java/test/Ice/binding/build.xml deleted file mode 100644 index 7038b5516c0..00000000000 --- a/java/test/Ice/binding/build.xml +++ /dev/null @@ -1,51 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_binding" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <includepath> - <pathelement path="${slice.dir}"/> - </includepath> - <fileset dir="." includes="Test.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/build.xml b/java/test/Ice/build.xml index 6d3c477d5af..1b6c9273a5f 100644 --- a/java/test/Ice/build.xml +++ b/java/test/Ice/build.xml @@ -12,69 +12,11 @@ <project name="test_Ice" default="all" basedir="."> <target name="all"> - <ant dir="adapterDeactivation"/> - <ant dir="background"/> - <ant dir="binding"/> - <ant dir="exceptions"/> - <ant dir="exceptionsAMD"/> - <ant dir="facets"/> - <ant dir="faultTolerance"/> - <ant dir="hold"/> - <ant dir="inheritance"/> - <ant dir="location"/> - <ant dir="objects"/> - <ant dir="proxy"/> - <ant dir="proxyAMD"/> - <ant dir="operations"/> - <ant dir="operationsAMD"/> - <ant dir="seqMapping"/> - <ant dir="seqMappingAMD"/> - <ant dir="slicing"/> - <ant dir="custom"/> - <ant dir="translator"/> - <ant dir="checksum"/> - <ant dir="package"/> - <ant dir="stream"/> - <ant dir="retry"/> - <ant dir="timeout"/> - <ant dir="servantLocator"/> - <ant dir="servantLocatorAMD"/> - <ant dir="interceptor"/> - <ant dir="udp"/> - <ant dir="serialize"/> + <ant dir="translator"/> </target> <target name="clean"> - <ant dir="adapterDeactivation" target="clean"/> - <ant dir="background" target="clean"/> - <ant dir="binding" target="clean"/> - <ant dir="exceptions" target="clean"/> - <ant dir="exceptionsAMD" target="clean"/> - <ant dir="facets" target="clean"/> - <ant dir="faultTolerance" target="clean"/> - <ant dir="hold" target="clean"/> - <ant dir="inheritance" target="clean"/> - <ant dir="location" target="clean"/> - <ant dir="objects" target="clean"/> - <ant dir="proxy" target="clean"/> - <ant dir="proxyAMD" target="clean"/> - <ant dir="operations" target="clean"/> - <ant dir="operationsAMD" target="clean"/> - <ant dir="seqMapping" target="clean"/> - <ant dir="seqMappingAMD" target="clean"/> - <ant dir="slicing" target="clean"/> - <ant dir="custom" target="clean"/> - <ant dir="translator" target="clean"/> - <ant dir="checksum" target="clean"/> - <ant dir="package" target="clean"/> - <ant dir="stream" target="clean"/> - <ant dir="retry" target="clean"/> - <ant dir="timeout" target="clean"/> - <ant dir="servantLocator" target="clean"/> - <ant dir="servantLocatorAMD" target="clean"/> - <ant dir="interceptor" target="clean"/> - <ant dir="udp" target="clean"/> - <ant dir="serialize" target="clean"/> + <ant dir="translator" target="clean"/> </target> </project> diff --git a/java/test/Ice/checksum/AllTests.java b/java/test/Ice/checksum/AllTests.java index 7d2497f26a4..b8910e8e445 100644 --- a/java/test/Ice/checksum/AllTests.java +++ b/java/test/Ice/checksum/AllTests.java @@ -7,6 +7,11 @@ // // ********************************************************************** +package test.Ice.checksum; + +import java.io.PrintWriter; +import test.Ice.checksum.Test.*; + public class AllTests { private static void @@ -18,21 +23,21 @@ public class AllTests } } - public static Test.ChecksumPrx - allTests(Ice.Communicator communicator, boolean collocated) + public static ChecksumPrx + allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out) { String ref = "test:default -p 12010 -t 10000"; Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); - Test.ChecksumPrx checksum = Test.ChecksumPrxHelper.checkedCast(base); + ChecksumPrx checksum = ChecksumPrxHelper.checkedCast(base); test(checksum != null); // // Verify that no checksums are present for local types. // - System.out.print("testing checksums... "); - System.out.flush(); + out.print("testing checksums... "); + out.flush(); java.util.Iterator<java.util.Map.Entry<String, String> > p = SliceChecksums.checksums.entrySet().iterator(); while(p.hasNext()) { @@ -84,7 +89,7 @@ public class AllTests test(!value.equals(entry.getValue())); } } - System.out.println("ok"); + out.println("ok"); return checksum; } diff --git a/java/test/Ice/checksum/server/ChecksumI.java b/java/test/Ice/checksum/ChecksumI.java index 61aa3f68036..8d68ddf8404 100644 --- a/java/test/Ice/checksum/server/ChecksumI.java +++ b/java/test/Ice/checksum/ChecksumI.java @@ -7,7 +7,11 @@ // // ********************************************************************** -public final class ChecksumI extends Test._ChecksumDisp +package test.Ice.checksum; + +import test.Ice.checksum.server.Test.*; + +public final class ChecksumI extends _ChecksumDisp { public ChecksumI(Ice.ObjectAdapter adapter) diff --git a/java/test/Ice/checksum/Client.java b/java/test/Ice/checksum/Client.java index b0bc9e0032f..3b7769d8783 100644 --- a/java/test/Ice/checksum/Client.java +++ b/java/test/Ice/checksum/Client.java @@ -7,46 +7,36 @@ // // ********************************************************************** -public class Client +package test.Ice.checksum; + +import test.Ice.checksum.Test.ChecksumPrx; + +public class Client extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int + run(String[] args) { - Test.ChecksumPrx checksum = AllTests.allTests(communicator, false); + Ice.Communicator communicator = communicator(); + ChecksumPrx checksum = AllTests.allTests(communicator, false, getWriter()); checksum.shutdown(); return 0; } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.checksum"); + return initData; + } + public static void main(String[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - + Client c = new Client(); + int status = c.main("Client", args); + System.gc(); System.exit(status); } diff --git a/java/test/Ice/checksum/server/Server.java b/java/test/Ice/checksum/Server.java index d59b05be36a..a28b5b0a2dd 100644 --- a/java/test/Ice/checksum/server/Server.java +++ b/java/test/Ice/checksum/Server.java @@ -7,50 +7,36 @@ // // ********************************************************************** -public class Server +package test.Ice.checksum; + +public class Server extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int + run(String[] args) { + Ice.Communicator communicator = communicator(); communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object object = new ChecksumI(adapter); adapter.add(object, communicator.stringToIdentity("test")); adapter.activate(); - communicator.waitForShutdown(); - return 0; + return WAIT; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.checksum.server"); + return initData; } public static void main(String[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - + Server c = new Server(); + int status = c.main("Server", args); + System.gc(); System.exit(status); } diff --git a/java/test/Ice/checksum/Test.ice b/java/test/Ice/checksum/Test.ice index cf9b2a4d554..61f32b89d79 100644 --- a/java/test/Ice/checksum/Test.ice +++ b/java/test/Ice/checksum/Test.ice @@ -12,6 +12,7 @@ #include <Ice/SliceChecksumDict.ice> +[["java:package:test.Ice.checksum"]] module Test { diff --git a/java/test/Ice/checksum/server/Test.ice b/java/test/Ice/checksum/TestServer.ice index cf9b2a4d554..5fe44e2005b 100644 --- a/java/test/Ice/checksum/server/Test.ice +++ b/java/test/Ice/checksum/TestServer.ice @@ -12,6 +12,7 @@ #include <Ice/SliceChecksumDict.ice> +[["java:package:test.Ice.checksum.server"]] module Test { diff --git a/java/test/Ice/checksum/Types.ice b/java/test/Ice/checksum/Types.ice index f9f05a43e4c..040a209a353 100644 --- a/java/test/Ice/checksum/Types.ice +++ b/java/test/Ice/checksum/Types.ice @@ -10,6 +10,7 @@ #ifndef CLASS_ICE #define CLASS_ICE +[["java:package:test.Ice.checksum"]] module Test { diff --git a/java/test/Ice/checksum/server/Types.ice b/java/test/Ice/checksum/TypesServer.ice index 27bac1ecdd4..301007a4ba2 100644 --- a/java/test/Ice/checksum/server/Types.ice +++ b/java/test/Ice/checksum/TypesServer.ice @@ -10,6 +10,7 @@ #ifndef CLASS_ICE #define CLASS_ICE +[["java:package:test.Ice.checksum.server"]] module Test { diff --git a/java/test/Ice/checksum/build.xml b/java/test/Ice/checksum/build.xml deleted file mode 100644 index 119d8879e5a..00000000000 --- a/java/test/Ice/checksum/build.xml +++ /dev/null @@ -1,54 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_checksum" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}" checksum="SliceChecksums"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice Types.ice"/> - <includepath> - <pathelement path="${slice.dir}" /> - </includepath> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" classpathref="ice.classpath" - debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**,server/**" - debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"> - <ant dir="server" inheritAll="false"/> - </target> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - <ant dir="server" target="clean" inheritAll="false"/> - </target> - -</project> diff --git a/java/test/Ice/checksum/run.py b/java/test/Ice/checksum/run.py index 6435164948b..bb34e7d35b7 100755 --- a/java/test/Ice/checksum/run.py +++ b/java/test/Ice/checksum/run.py @@ -20,8 +20,4 @@ if len(path) == 0: sys.path.append(os.path.join(path[0])) from scripts import * -import copy -serverenv = copy.deepcopy(os.environ) -TestUtil.addClasspath(os.path.join(os.getcwd(), "server", "classes"), serverenv) - -TestUtil.clientServerTest(serverenv = serverenv) +TestUtil.clientServerTest() diff --git a/java/test/Ice/checksum/server/build.xml b/java/test/Ice/checksum/server/build.xml deleted file mode 100644 index 65ac57ff9d4..00000000000 --- a/java/test/Ice/checksum/server/build.xml +++ /dev/null @@ -1,51 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_checksum_server" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}" checksum="SliceChecksums"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice Types.ice"/> - <includepath> - <pathelement path="${slice.dir}" /> - </includepath> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" classpathref="ice.classpath" - debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" - debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/custom/Client.java b/java/test/Ice/custom/Client.java deleted file mode 100644 index 6a42a5e43cb..00000000000 --- a/java/test/Ice/custom/Client.java +++ /dev/null @@ -1,55 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -import Test.*; - -public class Client -{ - private static int - run(String[] args, Ice.Communicator communicator) - { - TestIntfPrx test = AllTests.allTests(communicator); - test.shutdown(); - return 0; - } - - public static void - main(String[] args) - { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - - System.gc(); - System.exit(status); - } -} diff --git a/java/test/Ice/custom/Collocated.java b/java/test/Ice/custom/Collocated.java deleted file mode 100644 index 96d3ab4a245..00000000000 --- a/java/test/Ice/custom/Collocated.java +++ /dev/null @@ -1,57 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -public class Collocated -{ - private static int - run(String[] args, Ice.Communicator communicator) - { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.Object test = new TestI(communicator); - adapter.add(test, communicator.stringToIdentity("test")); - - AllTests.allTests(communicator); - - return 0; - } - - public static void - main(String[] args) - { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - - System.exit(status); - } -} diff --git a/java/test/Ice/custom/Server.java b/java/test/Ice/custom/Server.java deleted file mode 100644 index 7a19cfb1324..00000000000 --- a/java/test/Ice/custom/Server.java +++ /dev/null @@ -1,59 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -public class Server -{ - private static int - run(String[] args, Ice.Communicator communicator) - { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.Object test = new TestI(communicator); - adapter.add(test, communicator.stringToIdentity("test")); - - adapter.activate(); - communicator.waitForShutdown(); - - return 0; - } - - public static void - main(String[] args) - { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - - System.gc(); - System.exit(status); - } -} diff --git a/java/test/Ice/custom/build.xml b/java/test/Ice/custom/build.xml deleted file mode 100644 index 31513f17d6c..00000000000 --- a/java/test/Ice/custom/build.xml +++ /dev/null @@ -1,68 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_custom" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate4" depends="init" if="java2"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="jdk1.4" includes="Test.ice"/> - </slice2java> - </target> - - <target name="generate5" depends="init" unless="java2"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <fileset dir="jdk1.5" includes="Test.ice"/> - </slice2java> - </target> - - <target name="generate" depends="generate4, generate5"/> - - <target name="compile4" depends="generate" if="java2"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"/> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**,jdk1.5/**" debug="${debug}"/> - </target> - - <target name="compile5" depends="generate" unless="java2"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**,jdk1.4/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="compile" depends="compile4, compile5"/> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/custom/jdk1.4/AllTests.java b/java/test/Ice/custom14/AllTests.java index 7fdd7d88235..ae85324ca00 100644 --- a/java/test/Ice/custom/jdk1.4/AllTests.java +++ b/java/test/Ice/custom14/AllTests.java @@ -7,8 +7,35 @@ // // ********************************************************************** -import Test.*; -import java.util.*; +package test.Ice.custom14; + +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; + +import test.Ice.custom14.Test.BoolSeqHolder; +import test.Ice.custom14.Test.ByteSeqHolder; +import test.Ice.custom14.Test.C; +import test.Ice.custom14.Test.CArrayHolder; +import test.Ice.custom14.Test.CListHolder; +import test.Ice.custom14.Test.CSeqHolder; +import test.Ice.custom14.Test.DSeqHolder; +import test.Ice.custom14.Test.DoubleSeqHolder; +import test.Ice.custom14.Test.E; +import test.Ice.custom14.Test.ESeqHolder; +import test.Ice.custom14.Test.FloatSeqHolder; +import test.Ice.custom14.Test.IntSeqHolder; +import test.Ice.custom14.Test.LongSeqHolder; +import test.Ice.custom14.Test.S; +import test.Ice.custom14.Test.SSeqHolder; +import test.Ice.custom14.Test.ShortSeqHolder; +import test.Ice.custom14.Test.StringSeqHolder; +import test.Ice.custom14.Test.StringSeqSeqHolder; +import test.Ice.custom14.Test.TestIntfPrx; +import test.Ice.custom14.Test.TestIntfPrxHelper; public class AllTests { @@ -22,24 +49,24 @@ public class AllTests } public static TestIntfPrx - allTests(Ice.Communicator communicator) + allTests(Ice.Communicator communicator, PrintWriter out) { - System.out.print("testing stringToProxy... "); - System.out.flush(); + out.print("testing stringToProxy... "); + out.flush(); String ref = "test:default -p 12010 -t 10000"; Ice.ObjectPrx obj = communicator.stringToProxy(ref); test(obj != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing checked cast... "); - System.out.flush(); + out.print("testing checked cast... "); + out.flush(); TestIntfPrx t = TestIntfPrxHelper.checkedCast(obj); test(t != null); test(t.equals(obj)); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing custom sequences... "); - System.out.flush(); + out.print("testing custom sequences... "); + out.flush(); { // @@ -217,7 +244,7 @@ public class AllTests test(Arrays.equals(listH.value, seq)); } - System.out.println("ok"); + out.println("ok"); return t; } diff --git a/java/test/Ice/custom14/Client.java b/java/test/Ice/custom14/Client.java new file mode 100644 index 00000000000..17aa06713e7 --- /dev/null +++ b/java/test/Ice/custom14/Client.java @@ -0,0 +1,40 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.custom14; + +import test.Ice.custom14.Test.TestIntfPrx; + +public class Client extends test.Util.Application +{ + public int run(String[] args) + { + Ice.Communicator communicator = communicator(); + TestIntfPrx test = AllTests.allTests(communicator, getWriter()); + test.shutdown(); + return 0; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom14"); + return initData; + } + + public static void main(String[] args) + { + Client c = new Client(); + int status = c.main("Client", args); + + System.gc(); + System.exit(status); + } +} diff --git a/java/test/Ice/custom14/Collocated.java b/java/test/Ice/custom14/Collocated.java new file mode 100644 index 00000000000..18e72e1b84d --- /dev/null +++ b/java/test/Ice/custom14/Collocated.java @@ -0,0 +1,43 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.custom14; + +public class Collocated extends test.Util.Application +{ + public int run(String[] args) + { + Ice.Communicator communicator = communicator(); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.Object test = new TestI(communicator); + adapter.add(test, communicator.stringToIdentity("test")); + + AllTests.allTests(communicator, getWriter()); + + return 0; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom14"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + return initData; + } + + public static void main(String[] args) + { + Collocated c = new Collocated(); + int status = c.main("Collocated", args); + + System.gc(); + System.exit(status); + } +} diff --git a/java/test/Ice/custom14/Server.java b/java/test/Ice/custom14/Server.java new file mode 100644 index 00000000000..180e9fd2f68 --- /dev/null +++ b/java/test/Ice/custom14/Server.java @@ -0,0 +1,43 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.custom14; + +public class Server extends test.Util.Application +{ + public int run(String[] args) + { + Ice.Communicator communicator = communicator(); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.Object test = new TestI(communicator); + adapter.add(test, communicator.stringToIdentity("test")); + + adapter.activate(); + + return WAIT; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom14"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + return initData; + } + + public static void main(String[] args) + { + Server c = new Server(); + int status = c.main("Server", args); + + System.gc(); + System.exit(status); + } +} diff --git a/java/test/Ice/custom/jdk1.4/Test.ice b/java/test/Ice/custom14/Test.ice index 749aa594ae3..83700a24322 100644 --- a/java/test/Ice/custom/jdk1.4/Test.ice +++ b/java/test/Ice/custom14/Test.ice @@ -10,6 +10,7 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Ice.custom14"]] module Test { diff --git a/java/test/Ice/custom/jdk1.4/TestI.java b/java/test/Ice/custom14/TestI.java index 09c28f2acfc..4960c647036 100644 --- a/java/test/Ice/custom/jdk1.4/TestI.java +++ b/java/test/Ice/custom14/TestI.java @@ -7,8 +7,29 @@ // // ********************************************************************** -import Test.*; -import java.util.*; +package test.Ice.custom14; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import test.Ice.custom14.Test.BoolSeqHolder; +import test.Ice.custom14.Test.ByteSeqHolder; +import test.Ice.custom14.Test.C; +import test.Ice.custom14.Test.CArrayHolder; +import test.Ice.custom14.Test.CListHolder; +import test.Ice.custom14.Test.CSeqHolder; +import test.Ice.custom14.Test.DSeqHolder; +import test.Ice.custom14.Test.DoubleSeqHolder; +import test.Ice.custom14.Test.ESeqHolder; +import test.Ice.custom14.Test.FloatSeqHolder; +import test.Ice.custom14.Test.IntSeqHolder; +import test.Ice.custom14.Test.LongSeqHolder; +import test.Ice.custom14.Test.SSeqHolder; +import test.Ice.custom14.Test.ShortSeqHolder; +import test.Ice.custom14.Test.StringSeqHolder; +import test.Ice.custom14.Test.StringSeqSeqHolder; +import test.Ice.custom14.Test.TestIntf; public final class TestI extends TestIntf { diff --git a/java/test/Ice/custom/run.py b/java/test/Ice/custom14/run.py index 545214a74c7..545214a74c7 100755 --- a/java/test/Ice/custom/run.py +++ b/java/test/Ice/custom14/run.py diff --git a/java/test/Ice/custom/jdk1.5/AllTests.java b/java/test/Ice/custom15/AllTests.java index 9bf5d3bc79d..94aee414bcb 100644 --- a/java/test/Ice/custom/jdk1.5/AllTests.java +++ b/java/test/Ice/custom15/AllTests.java @@ -7,8 +7,36 @@ // // ********************************************************************** -import Test.*; -import java.util.*; +package test.Ice.custom15; + +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import test.Ice.custom15.Test.BoolSeqHolder; +import test.Ice.custom15.Test.ByteSeqHolder; +import test.Ice.custom15.Test.C; +import test.Ice.custom15.Test.CArrayHolder; +import test.Ice.custom15.Test.CListHolder; +import test.Ice.custom15.Test.CSeqHolder; +import test.Ice.custom15.Test.DSeqHolder; +import test.Ice.custom15.Test.DoubleSeqHolder; +import test.Ice.custom15.Test.E; +import test.Ice.custom15.Test.ESeqHolder; +import test.Ice.custom15.Test.FloatSeqHolder; +import test.Ice.custom15.Test.IntSeqHolder; +import test.Ice.custom15.Test.LongSeqHolder; +import test.Ice.custom15.Test.S; +import test.Ice.custom15.Test.SSeqHolder; +import test.Ice.custom15.Test.ShortSeqHolder; +import test.Ice.custom15.Test.StringSeqHolder; +import test.Ice.custom15.Test.StringSeqSeqHolder; +import test.Ice.custom15.Test.TestIntfPrx; +import test.Ice.custom15.Test.TestIntfPrxHelper; public class AllTests { @@ -22,24 +50,24 @@ public class AllTests } public static TestIntfPrx - allTests(Ice.Communicator communicator) + allTests(Ice.Communicator communicator, PrintWriter out) { - System.out.print("testing stringToProxy... "); - System.out.flush(); + out.print("testing stringToProxy... "); + out.flush(); String ref = "test:default -p 12010 -t 10000"; Ice.ObjectPrx obj = communicator.stringToProxy(ref); test(obj != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing checked cast... "); - System.out.flush(); + out.print("testing checked cast... "); + out.flush(); TestIntfPrx t = TestIntfPrxHelper.checkedCast(obj); test(t != null); test(t.equals(obj)); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing custom sequences... "); - System.out.flush(); + out.print("testing custom sequences... "); + out.flush(); { // @@ -217,7 +245,7 @@ public class AllTests test(listH.value.equals(seq)); } - System.out.println("ok"); + out.println("ok"); return t; } diff --git a/java/test/Ice/custom15/Client.java b/java/test/Ice/custom15/Client.java new file mode 100644 index 00000000000..3d0f16ce96b --- /dev/null +++ b/java/test/Ice/custom15/Client.java @@ -0,0 +1,40 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.custom15; + +import test.Ice.custom15.Test.TestIntfPrx; + +public class Client extends test.Util.Application +{ + public int run(String[] args) + { + Ice.Communicator communicator = communicator(); + TestIntfPrx test = AllTests.allTests(communicator, getWriter()); + test.shutdown(); + return 0; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom15"); + return initData; + } + + public static void main(String[] args) + { + Client c = new Client(); + int status = c.main("Client", args); + + System.gc(); + System.exit(status); + } +} diff --git a/java/test/Ice/custom15/Collocated.java b/java/test/Ice/custom15/Collocated.java new file mode 100644 index 00000000000..94c9480d328 --- /dev/null +++ b/java/test/Ice/custom15/Collocated.java @@ -0,0 +1,43 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.custom15; + +public class Collocated extends test.Util.Application +{ + public int run(String[] args) + { + Ice.Communicator communicator = communicator(); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.Object test = new TestI(communicator); + adapter.add(test, communicator.stringToIdentity("test")); + + AllTests.allTests(communicator, getWriter()); + + return 0; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom15"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + return initData; + } + + public static void main(String[] args) + { + Collocated c = new Collocated(); + int status = c.main("Collocated", args); + + System.gc(); + System.exit(status); + } +} diff --git a/java/test/Ice/custom15/Server.java b/java/test/Ice/custom15/Server.java new file mode 100644 index 00000000000..bc972cd07a1 --- /dev/null +++ b/java/test/Ice/custom15/Server.java @@ -0,0 +1,43 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.custom15; + +public class Server extends test.Util.Application +{ + public int run(String[] args) + { + Ice.Communicator communicator = communicator(); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.Object test = new TestI(communicator); + adapter.add(test, communicator.stringToIdentity("test")); + + adapter.activate(); + + return WAIT; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.custom15"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + return initData; + } + + public static void main(String[] args) + { + Server c = new Server(); + int status = c.main("Server", args); + + System.gc(); + System.exit(status); + } +} diff --git a/java/test/Ice/custom/jdk1.5/Test.ice b/java/test/Ice/custom15/Test.ice index 5f442a55200..42fd1d0e715 100644 --- a/java/test/Ice/custom/jdk1.5/Test.ice +++ b/java/test/Ice/custom15/Test.ice @@ -10,14 +10,15 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Ice.custom15"]] module Test { class C {}; sequence<C> CSeq; -["java:type:java.util.ArrayList<Test.C>"] sequence<C> CArray; -["java:type:java.util.LinkedList<Test.C>"] sequence<C> CList; +["java:type:java.util.ArrayList<C>"] sequence<C> CArray; +["java:type:java.util.LinkedList<C>"] sequence<C> CList; ["java:type:java.util.ArrayList<Boolean>"] sequence<bool> BoolSeq; ["java:type:java.util.ArrayList<Byte>"] sequence<byte> ByteSeq; @@ -29,13 +30,13 @@ sequence<C> CSeq; ["java:type:java.util.ArrayList<String>"] sequence<string> StringSeq; enum E { E1, E2, E3 }; -["java:type:java.util.ArrayList<Test.E>"] sequence<E> ESeq; +["java:type:java.util.ArrayList<E>"] sequence<E> ESeq; struct S { E en; }; -["java:type:java.util.ArrayList<Test.S>"] sequence<S> SSeq; +["java:type:java.util.ArrayList<S>"] sequence<S> SSeq; dictionary<int, string> D; ["java:type:java.util.ArrayList<java.util.Map<Integer,String>>"] sequence<D> DSeq; @@ -62,7 +63,7 @@ class TestIntf void shutdown(); - ["java:type:java.util.ArrayList<Test.C>"] CSeq seq; + ["java:type:java.util.ArrayList<C>"] CSeq seq; }; }; diff --git a/java/test/Ice/custom/jdk1.5/TestI.java b/java/test/Ice/custom15/TestI.java index 32920feee7b..d6498b91824 100644 --- a/java/test/Ice/custom/jdk1.5/TestI.java +++ b/java/test/Ice/custom15/TestI.java @@ -7,8 +7,32 @@ // // ********************************************************************** -import Test.*; -import java.util.*; +package test.Ice.custom15; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import test.Ice.custom15.Test.BoolSeqHolder; +import test.Ice.custom15.Test.ByteSeqHolder; +import test.Ice.custom15.Test.C; +import test.Ice.custom15.Test.CArrayHolder; +import test.Ice.custom15.Test.CListHolder; +import test.Ice.custom15.Test.CSeqHolder; +import test.Ice.custom15.Test.DSeqHolder; +import test.Ice.custom15.Test.DoubleSeqHolder; +import test.Ice.custom15.Test.E; +import test.Ice.custom15.Test.ESeqHolder; +import test.Ice.custom15.Test.FloatSeqHolder; +import test.Ice.custom15.Test.IntSeqHolder; +import test.Ice.custom15.Test.LongSeqHolder; +import test.Ice.custom15.Test.S; +import test.Ice.custom15.Test.SSeqHolder; +import test.Ice.custom15.Test.ShortSeqHolder; +import test.Ice.custom15.Test.StringSeqHolder; +import test.Ice.custom15.Test.StringSeqSeqHolder; +import test.Ice.custom15.Test.TestIntf; public final class TestI extends TestIntf { @@ -18,15 +42,15 @@ public final class TestI extends TestIntf _communicator = communicator; } - public List<Test.C> - opCArray(List<Test.C> inSeq, CArrayHolder outSeq, Ice.Current current) + public List<C> + opCArray(List<C> inSeq, CArrayHolder outSeq, Ice.Current current) { outSeq.value = inSeq; return inSeq; } - public List<Test.C> - opCList(List<Test.C> inSeq, CListHolder outSeq, Ice.Current current) + public List<C> + opCList(List<C> inSeq, CListHolder outSeq, Ice.Current current) { outSeq.value = inSeq; return inSeq; @@ -35,7 +59,7 @@ public final class TestI extends TestIntf public C[] opCSeq(C[] inSeq, CSeqHolder outSeq, Ice.Current current) { - seq = new ArrayList<Test.C>(Arrays.asList(inSeq)); + seq = new ArrayList<C>(Arrays.asList(inSeq)); outSeq.value = new C[seq.size()]; seq.toArray(outSeq.value); return outSeq.value; @@ -69,8 +93,8 @@ public final class TestI extends TestIntf return inSeq; } - public List<Test.E> - opESeq(List<Test.E> inSeq, ESeqHolder outSeq, Ice.Current current) + public List<E> + opESeq(List<E> inSeq, ESeqHolder outSeq, Ice.Current current) { outSeq.value = inSeq; return inSeq; @@ -97,8 +121,8 @@ public final class TestI extends TestIntf return inSeq; } - public List<Test.S> - opSSeq(List<Test.S> inSeq, SSeqHolder outSeq, Ice.Current current) + public List<S> + opSSeq(List<S> inSeq, SSeqHolder outSeq, Ice.Current current) { outSeq.value = inSeq; return inSeq; diff --git a/java/test/Ice/custom15/run.py b/java/test/Ice/custom15/run.py new file mode 100755 index 00000000000..545214a74c7 --- /dev/null +++ b/java/test/Ice/custom15/run.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +import os, sys + +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] +if len(path) == 0: + raise "can't find toplevel directory!" +sys.path.append(os.path.join(path[0])) +from scripts import * + +TestUtil.clientServerTest() +TestUtil.collocatedTest() diff --git a/java/test/Ice/exceptions/AMDServer.java b/java/test/Ice/exceptions/AMDServer.java new file mode 100644 index 00000000000..d77c94bc07b --- /dev/null +++ b/java/test/Ice/exceptions/AMDServer.java @@ -0,0 +1,50 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.exceptions; + +public class AMDServer extends test.Util.Application +{ + public int run(String[] args) + { + Ice.Communicator communicator = communicator(); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.Object object = new AMDThrowerI(adapter); + adapter.add(object, communicator.stringToIdentity("thrower")); + adapter.activate(); + return WAIT; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + // + // For this test, we need a dummy logger, otherwise the + // assertion test will print an error message. + // + initData.logger = new DummyLogger(); + + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptionsAMD"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000:udp"); + + // We don't need to disable warnings, because we have a dummy logger. + // properties.setProperty("Ice.Warn.Dispatch", "0"); + + return initData; + } + + public static void main(String[] args) + { + AMDServer app = new AMDServer(); + int result = app.main("AMDServer", args); + System.gc(); + System.exit(result); + } +} diff --git a/java/test/Ice/exceptionsAMD/ThrowerI.java b/java/test/Ice/exceptions/AMDThrowerI.java index 1d301cb6fa7..86c84ca78de 100644 --- a/java/test/Ice/exceptionsAMD/ThrowerI.java +++ b/java/test/Ice/exceptions/AMDThrowerI.java @@ -7,12 +7,34 @@ // // ********************************************************************** -import Test.*; - -public final class ThrowerI extends _ThrowerDisp +package test.Ice.exceptions; + +import test.Ice.exceptionsAMD.Test.A; +import test.Ice.exceptionsAMD.Test.AMD_Thrower_shutdown; +import test.Ice.exceptionsAMD.Test.AMD_Thrower_supportsAssertException; +import test.Ice.exceptionsAMD.Test.AMD_Thrower_supportsUndeclaredExceptions; +import test.Ice.exceptionsAMD.Test.AMD_Thrower_throwAasA; +import test.Ice.exceptionsAMD.Test.AMD_Thrower_throwAorDasAorD; +import test.Ice.exceptionsAMD.Test.AMD_Thrower_throwAssertException; +import test.Ice.exceptionsAMD.Test.AMD_Thrower_throwBasA; +import test.Ice.exceptionsAMD.Test.AMD_Thrower_throwBasB; +import test.Ice.exceptionsAMD.Test.AMD_Thrower_throwCasA; +import test.Ice.exceptionsAMD.Test.AMD_Thrower_throwCasB; +import test.Ice.exceptionsAMD.Test.AMD_Thrower_throwCasC; +import test.Ice.exceptionsAMD.Test.AMD_Thrower_throwLocalException; +import test.Ice.exceptionsAMD.Test.AMD_Thrower_throwNonIceException; +import test.Ice.exceptionsAMD.Test.AMD_Thrower_throwUndeclaredA; +import test.Ice.exceptionsAMD.Test.AMD_Thrower_throwUndeclaredB; +import test.Ice.exceptionsAMD.Test.AMD_Thrower_throwUndeclaredC; +import test.Ice.exceptionsAMD.Test.B; +import test.Ice.exceptionsAMD.Test.C; +import test.Ice.exceptionsAMD.Test.D; +import test.Ice.exceptionsAMD.Test._ThrowerDisp; + +public final class AMDThrowerI extends _ThrowerDisp { public - ThrowerI(Ice.ObjectAdapter adapter) + AMDThrowerI(Ice.ObjectAdapter adapter) { _adapter = adapter; } diff --git a/java/test/Ice/exceptions/AllTests.java b/java/test/Ice/exceptions/AllTests.java index bcce84b603f..cc8d7e1a104 100644 --- a/java/test/Ice/exceptions/AllTests.java +++ b/java/test/Ice/exceptions/AllTests.java @@ -7,7 +7,32 @@ // // ********************************************************************** -import Test.*; +package test.Ice.exceptions; + +import java.io.PrintWriter; + +import test.Ice.exceptions.Test.A; +import test.Ice.exceptions.Test.AMI_Thrower_throwAasA; +import test.Ice.exceptions.Test.AMI_Thrower_throwAorDasAorD; +import test.Ice.exceptions.Test.AMI_Thrower_throwAssertException; +import test.Ice.exceptions.Test.AMI_Thrower_throwBasA; +import test.Ice.exceptions.Test.AMI_Thrower_throwBasB; +import test.Ice.exceptions.Test.AMI_Thrower_throwCasA; +import test.Ice.exceptions.Test.AMI_Thrower_throwCasB; +import test.Ice.exceptions.Test.AMI_Thrower_throwCasC; +import test.Ice.exceptions.Test.AMI_Thrower_throwLocalException; +import test.Ice.exceptions.Test.AMI_Thrower_throwNonIceException; +import test.Ice.exceptions.Test.AMI_Thrower_throwUndeclaredA; +import test.Ice.exceptions.Test.AMI_Thrower_throwUndeclaredB; +import test.Ice.exceptions.Test.AMI_Thrower_throwUndeclaredC; +import test.Ice.exceptions.Test.AMI_WrongOperation_noSuchOperation; +import test.Ice.exceptions.Test.B; +import test.Ice.exceptions.Test.C; +import test.Ice.exceptions.Test.D; +import test.Ice.exceptions.Test.ThrowerPrx; +import test.Ice.exceptions.Test.ThrowerPrxHelper; +import test.Ice.exceptions.Test.WrongOperationPrx; +import test.Ice.exceptions.Test.WrongOperationPrxHelper; public class AllTests { @@ -715,10 +740,10 @@ public class AllTests } public static ThrowerPrx - allTests(Ice.Communicator communicator, boolean collocated) + allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out) { { - System.out.print("testing object adapter registration exceptions... "); + out.print("testing object adapter registration exceptions... "); Ice.ObjectAdapter first; try { @@ -753,11 +778,11 @@ public class AllTests } test(communicator.getProperties().getProperty("TestAdapter0.Endpoints").equals("default")); first.deactivate(); - System.out.println("ok"); + out.println("ok"); } { - System.out.print("testing servant registration exceptions... "); + out.print("testing servant registration exceptions... "); communicator.getProperties().setProperty("TestAdapter1.Endpoints", "default"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter1"); Ice.Object obj = new EmptyI(); @@ -781,11 +806,11 @@ public class AllTests { } adapter.deactivate(); - System.out.println("ok"); + out.println("ok"); } { - System.out.print("testing servant locator registration exceptions... "); + out.print("testing servant locator registration exceptions... "); communicator.getProperties().setProperty("TestAdapter2.Endpoints", "default"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter2"); Ice.ServantLocator loc = new ServantLocatorI(); @@ -800,11 +825,11 @@ public class AllTests } adapter.deactivate(); - System.out.println("ok"); + out.println("ok"); } { - System.out.print("testing object factory registration exception... "); + out.print("testing object factory registration exception... "); Ice.ObjectFactory of = new ObjectFactoryI(); communicator.addObjectFactory(of, "::x"); try @@ -815,25 +840,25 @@ public class AllTests catch(Ice.AlreadyRegisteredException ex) { } - System.out.println("ok"); + out.println("ok"); } - System.out.print("testing stringToProxy... "); - System.out.flush(); + out.print("testing stringToProxy... "); + out.flush(); String ref = "thrower:default -p 12010 -t 10000"; Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing checked cast... "); - System.out.flush(); + out.print("testing checked cast... "); + out.flush(); ThrowerPrx thrower = ThrowerPrxHelper.checkedCast(base); test(thrower != null); test(thrower.equals(base)); - System.out.println("ok"); + out.println("ok"); - System.out.print("catching exact types... "); - System.out.flush(); + out.print("catching exact types... "); + out.flush(); try { @@ -913,10 +938,10 @@ public class AllTests test(false); } - System.out.println("ok"); + out.println("ok"); - System.out.print("catching base types... "); - System.out.flush(); + out.print("catching base types... "); + out.flush(); try { @@ -949,10 +974,10 @@ public class AllTests test(false); } - System.out.println("ok"); + out.println("ok"); - System.out.print("catching derived types... "); - System.out.flush(); + out.print("catching derived types... "); + out.flush(); try { @@ -1004,14 +1029,14 @@ public class AllTests test(false); } - System.out.println("ok"); + out.println("ok"); if(thrower.supportsUndeclaredExceptions()) { test(!collocated); - System.out.print("catching unknown user exception... "); - System.out.flush(); + out.print("catching unknown user exception... "); + out.flush(); try { @@ -1055,13 +1080,13 @@ public class AllTests test(false); } - System.out.println("ok"); + out.println("ok"); } if(thrower.supportsAssertException()) { - System.out.print("testing assert in the server... "); - System.out.flush(); + out.print("testing assert in the server... "); + out.flush(); try { @@ -1082,11 +1107,11 @@ public class AllTests test(false); } - System.out.println("ok"); + out.println("ok"); } - System.out.print("catching object not exist exception... "); - System.out.flush(); + out.print("catching object not exist exception... "); + out.flush(); { Ice.Identity id = communicator.stringToIdentity("does not exist"); @@ -1107,10 +1132,10 @@ public class AllTests } } - System.out.println("ok"); + out.println("ok"); - System.out.print("catching facet not exist exception... "); - System.out.flush(); + out.print("catching facet not exist exception... "); + out.flush(); try { @@ -1131,10 +1156,10 @@ public class AllTests test(false); } - System.out.println("ok"); + out.println("ok"); - System.out.print("catching operation not exist exception... "); - System.out.flush(); + out.print("catching operation not exist exception... "); + out.flush(); try { @@ -1152,10 +1177,10 @@ public class AllTests test(false); } - System.out.println("ok"); + out.println("ok"); - System.out.print("catching unknown local exception... "); - System.out.flush(); + out.print("catching unknown local exception... "); + out.flush(); try { @@ -1171,10 +1196,10 @@ public class AllTests test(false); } - System.out.println("ok"); + out.println("ok"); - System.out.print("catching unknown non-Ice exception... "); - System.out.flush(); + out.print("catching unknown non-Ice exception... "); + out.flush(); try { @@ -1186,16 +1211,16 @@ public class AllTests } catch(Throwable ex) { - System.out.println(ex); + out.println(ex); test(false); } - System.out.println("ok"); + out.println("ok"); if(!collocated) { - System.out.print("catching exact types with AMI... "); - System.out.flush(); + out.print("catching exact types with AMI... "); + out.flush(); { AMI_Thrower_throwAasAI cb = new AMI_Thrower_throwAasAI(); @@ -1233,10 +1258,10 @@ public class AllTests test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("catching derived types with AMI... "); - System.out.flush(); + out.print("catching derived types with AMI... "); + out.flush(); { AMI_Thrower_throwBasAI cb = new AMI_Thrower_throwBasAI(); @@ -1256,12 +1281,12 @@ public class AllTests test(cb.check()); } - System.out.println("ok"); + out.println("ok"); if(thrower.supportsUndeclaredExceptions()) { - System.out.print("catching unknown user exception with AMI... "); - System.out.flush(); + out.print("catching unknown user exception with AMI... "); + out.flush(); { AMI_Thrower_throwUndeclaredAI cb = new AMI_Thrower_throwUndeclaredAI(); @@ -1281,23 +1306,23 @@ public class AllTests test(cb.check()); } - System.out.println("ok"); + out.println("ok"); } if(thrower.supportsAssertException()) { - System.out.print("testing assert in the server with AMI... "); - System.out.flush(); + out.print("testing assert in the server with AMI... "); + out.flush(); AMI_Thrower_throwAssertExceptionI cb = new AMI_Thrower_throwAssertExceptionI(); thrower.throwAssertException_async(cb); test(cb.check()); - System.out.println("ok"); + out.println("ok"); } - System.out.print("catching object not exist exception with AMI... "); - System.out.flush(); + out.print("catching object not exist exception with AMI... "); + out.flush(); { Ice.Identity id = communicator.stringToIdentity("does not exist"); @@ -1307,10 +1332,10 @@ public class AllTests test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("catching facet not exist exception with AMI... "); - System.out.flush(); + out.print("catching facet not exist exception with AMI... "); + out.flush(); try { @@ -1327,10 +1352,10 @@ public class AllTests test(false); } - System.out.println("ok"); + out.println("ok"); - System.out.print("catching operation not exist exception with AMI... "); - System.out.flush(); + out.print("catching operation not exist exception with AMI... "); + out.flush(); { AMI_WrongOperation_noSuchOperationI cb = new AMI_WrongOperation_noSuchOperationI(); @@ -1339,10 +1364,10 @@ public class AllTests test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("catching unknown local exception with AMI... "); - System.out.flush(); + out.print("catching unknown local exception with AMI... "); + out.flush(); { AMI_Thrower_throwLocalExceptionI cb = new AMI_Thrower_throwLocalExceptionI(); @@ -1350,16 +1375,16 @@ public class AllTests test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("catching unknown non-Ice exception with AMI... "); - System.out.flush(); + out.print("catching unknown non-Ice exception with AMI... "); + out.flush(); AMI_Thrower_throwNonIceExceptionI cb = new AMI_Thrower_throwNonIceExceptionI(); thrower.throwNonIceException_async(cb); test(cb.check()); - System.out.println("ok"); + out.println("ok"); } return thrower; diff --git a/java/test/Ice/exceptions/Client.java b/java/test/Ice/exceptions/Client.java index 1959d49711a..73e8bc7513e 100644 --- a/java/test/Ice/exceptions/Client.java +++ b/java/test/Ice/exceptions/Client.java @@ -7,54 +7,34 @@ // // ********************************************************************** -import Test.*; +package test.Ice.exceptions; -public class Client +import test.Ice.exceptions.Test.ThrowerPrx; + +public class Client extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { - ThrowerPrx thrower = AllTests.allTests(communicator, false); + Ice.Communicator communicator = communicator(); + ThrowerPrx thrower = AllTests.allTests(communicator, false, getWriter()); thrower.shutdown(); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); - initData.properties.setProperty("Ice.Warn.Connections", "0"); - - communicator = Ice.Util.initialize(argsH, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions"); + initData.properties.setProperty("Ice.Warn.Connections", "0"); + return initData; + } + public static void main(String[] args) + { + Client app = new Client(); + int result = app.main("Client", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/exceptions/Collocated.java b/java/test/Ice/exceptions/Collocated.java index cf4295f44b2..52222997412 100644 --- a/java/test/Ice/exceptions/Collocated.java +++ b/java/test/Ice/exceptions/Collocated.java @@ -7,51 +7,38 @@ // // ********************************************************************** -public class Collocated +package test.Ice.exceptions; + +public class Collocated extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int + run(String[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + Ice.Communicator communicator = communicator(); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object object = new ThrowerI(adapter); adapter.add(object, communicator.stringToIdentity("thrower")); - AllTests.allTests(communicator, true); + AllTests.allTests(communicator, true, getWriter()); return 0; } + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + return initData; + } + public static void main(String[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - - System.exit(status); + Collocated app = new Collocated(); + int result = app.main("Collocated", args); + System.gc(); + System.exit(result); } } diff --git a/java/test/Ice/exceptions/DummyLogger.java b/java/test/Ice/exceptions/DummyLogger.java index 520e304c0bd..6f2d32a5feb 100644 --- a/java/test/Ice/exceptions/DummyLogger.java +++ b/java/test/Ice/exceptions/DummyLogger.java @@ -7,6 +7,9 @@ // // ********************************************************************** +package test.Ice.exceptions; + + public final class DummyLogger implements Ice.Logger { public void diff --git a/java/test/Ice/exceptions/EmptyI.java b/java/test/Ice/exceptions/EmptyI.java index 9b218e6e3a6..6abea695426 100644 --- a/java/test/Ice/exceptions/EmptyI.java +++ b/java/test/Ice/exceptions/EmptyI.java @@ -7,7 +7,10 @@ // // ********************************************************************** -import Test.*; +package test.Ice.exceptions; + +import test.Ice.exceptions.Test._EmptyDisp; + public final class EmptyI extends _EmptyDisp { diff --git a/java/test/Ice/exceptions/ObjectFactoryI.java b/java/test/Ice/exceptions/ObjectFactoryI.java index 6fc0b0b3737..568678e6b15 100644 --- a/java/test/Ice/exceptions/ObjectFactoryI.java +++ b/java/test/Ice/exceptions/ObjectFactoryI.java @@ -7,6 +7,9 @@ // // ********************************************************************** +package test.Ice.exceptions; + + public final class ObjectFactoryI implements Ice.ObjectFactory { public Ice.Object create(String s) diff --git a/java/test/Ice/exceptions/ServantLocatorI.java b/java/test/Ice/exceptions/ServantLocatorI.java index 42721e4b39b..8b7d3656a05 100644 --- a/java/test/Ice/exceptions/ServantLocatorI.java +++ b/java/test/Ice/exceptions/ServantLocatorI.java @@ -7,6 +7,9 @@ // // ********************************************************************** +package test.Ice.exceptions; + + public final class ServantLocatorI implements Ice.ServantLocator { public Ice.Object locate(Ice.Current curr, Ice.LocalObjectHolder cookie) diff --git a/java/test/Ice/exceptions/Server.java b/java/test/Ice/exceptions/Server.java index 2f2d93e9561..ffbb1d690db 100644 --- a/java/test/Ice/exceptions/Server.java +++ b/java/test/Ice/exceptions/Server.java @@ -7,61 +7,39 @@ // // ********************************************************************** -public class Server +package test.Ice.exceptions; + +public class Server extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { - Ice.Properties properties = communicator.getProperties(); - // We don't need to disable warnings, because we have a dummy logger. - //properties.setProperty("Ice.Warn.Dispatch", "0"); - properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000:udp"); + Ice.Communicator communicator = communicator(); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object object = new ThrowerI(adapter); adapter.add(object, communicator.stringToIdentity("thrower")); adapter.activate(); - communicator.waitForShutdown(); - return 0; + return WAIT; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - // - // For this test, we need a dummy logger, otherwise the - // assertion test will print an error message. - // - Ice.InitializationData initData = new Ice.InitializationData(); - initData.logger = new DummyLogger(); + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.logger = new DummyLogger(); - communicator = Ice.Util.initialize(args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } + initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000:udp"); + // We don't need to disable warnings, because we have a dummy logger. + // properties.setProperty("Ice.Warn.Dispatch", "0"); - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + return initData; + } + public static void main(String[] args) + { + Server app = new Server(); + int result = app.main("Server", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/exceptions/Test.ice b/java/test/Ice/exceptions/Test.ice index 6009b2e6759..3b24cd1ca74 100644 --- a/java/test/Ice/exceptions/Test.ice +++ b/java/test/Ice/exceptions/Test.ice @@ -10,6 +10,7 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Ice.exceptions"]] module Test { diff --git a/java/test/Ice/exceptionsAMD/TestAMD.ice b/java/test/Ice/exceptions/TestAMD.ice index 4e09cd9702a..c689f36e8f1 100644 --- a/java/test/Ice/exceptionsAMD/TestAMD.ice +++ b/java/test/Ice/exceptions/TestAMD.ice @@ -10,6 +10,7 @@ #ifndef TEST_AMD_ICE #define TEST_AMD_ICE +[["java:package:test.Ice.exceptionsAMD"]] module Test { diff --git a/java/test/Ice/exceptions/ThrowerI.java b/java/test/Ice/exceptions/ThrowerI.java index 96c8b4dfb97..a2a94ab389c 100644 --- a/java/test/Ice/exceptions/ThrowerI.java +++ b/java/test/Ice/exceptions/ThrowerI.java @@ -7,7 +7,13 @@ // // ********************************************************************** -import Test.*; +package test.Ice.exceptions; + +import test.Ice.exceptions.Test.A; +import test.Ice.exceptions.Test.B; +import test.Ice.exceptions.Test.C; +import test.Ice.exceptions.Test.D; +import test.Ice.exceptions.Test._ThrowerDisp; public final class ThrowerI extends _ThrowerDisp { diff --git a/java/test/Ice/exceptions/build.xml b/java/test/Ice/exceptions/build.xml deleted file mode 100644 index a3395e33a0a..00000000000 --- a/java/test/Ice/exceptions/build.xml +++ /dev/null @@ -1,48 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_exceptions" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/exceptions/run.py b/java/test/Ice/exceptions/run.py index a4f6803f183..8266b166ff9 100755 --- a/java/test/Ice/exceptions/run.py +++ b/java/test/Ice/exceptions/run.py @@ -24,10 +24,7 @@ print "tests with regular server." TestUtil.clientServerTest() print "tests with AMD server." -import copy -amdenv = copy.deepcopy(os.environ) -TestUtil.addClasspath(os.path.join(os.getcwd(), "..", "exceptionsAMD", "classes"), amdenv) -TestUtil.clientServerTest(serverenv = amdenv) +TestUtil.clientServerTest(server="test.Ice.exceptions.AMDServer") print "tests with collocated server." TestUtil.collocatedTest() diff --git a/java/test/Ice/exceptionsAMD/DummyLogger.java b/java/test/Ice/exceptionsAMD/DummyLogger.java deleted file mode 100644 index 520e304c0bd..00000000000 --- a/java/test/Ice/exceptionsAMD/DummyLogger.java +++ /dev/null @@ -1,31 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -public final class DummyLogger implements Ice.Logger -{ - public void - print(String message) - { - } - - public void - trace(String category, String message) - { - } - - public void - warning(String message) - { - } - - public void - error(String message) - { - } -} diff --git a/java/test/Ice/exceptionsAMD/Server.java b/java/test/Ice/exceptionsAMD/Server.java deleted file mode 100644 index 2f2d93e9561..00000000000 --- a/java/test/Ice/exceptionsAMD/Server.java +++ /dev/null @@ -1,67 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -public class Server -{ - private static int - run(String[] args, Ice.Communicator communicator) - { - Ice.Properties properties = communicator.getProperties(); - // We don't need to disable warnings, because we have a dummy logger. - //properties.setProperty("Ice.Warn.Dispatch", "0"); - properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000:udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.Object object = new ThrowerI(adapter); - adapter.add(object, communicator.stringToIdentity("thrower")); - adapter.activate(); - communicator.waitForShutdown(); - return 0; - } - - public static void - main(String[] args) - { - int status = 0; - Ice.Communicator communicator = null; - - try - { - // - // For this test, we need a dummy logger, otherwise the - // assertion test will print an error message. - // - Ice.InitializationData initData = new Ice.InitializationData(); - initData.logger = new DummyLogger(); - - communicator = Ice.Util.initialize(args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - - System.gc(); - System.exit(status); - } -} diff --git a/java/test/Ice/facets/AI.java b/java/test/Ice/facets/AI.java index b2257b1f157..77c482df0ad 100644 --- a/java/test/Ice/facets/AI.java +++ b/java/test/Ice/facets/AI.java @@ -7,7 +7,9 @@ // // ********************************************************************** -import Test.*; +package test.Ice.facets; + +import test.Ice.facets.Test._ADisp; public final class AI extends _ADisp { diff --git a/java/test/Ice/facets/AllTests.java b/java/test/Ice/facets/AllTests.java index 8cbde31275c..21fa77be371 100644 --- a/java/test/Ice/facets/AllTests.java +++ b/java/test/Ice/facets/AllTests.java @@ -7,7 +7,19 @@ // // ********************************************************************** -import Test.*; +package test.Ice.facets; + +import java.io.PrintStream; +import java.io.PrintWriter; + +import test.Ice.facets.Test.DPrx; +import test.Ice.facets.Test.DPrxHelper; +import test.Ice.facets.Test.FPrx; +import test.Ice.facets.Test.FPrxHelper; +import test.Ice.facets.Test.GPrx; +import test.Ice.facets.Test.GPrxHelper; +import test.Ice.facets.Test.HPrx; +import test.Ice.facets.Test.HPrxHelper; public class AllTests { @@ -21,9 +33,9 @@ public class AllTests } public static GPrx - allTests(Ice.Communicator communicator) + allTests(Ice.Communicator communicator, PrintWriter out) { - System.out.print("testing Ice.Admin.Facets property... "); + out.print("testing Ice.Admin.Facets property... "); test(communicator.getProperties().getPropertyAsList("Ice.Admin.Facets").length == 0); communicator.getProperties().setProperty("Ice.Admin.Facets", "foobar"); String[] facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets"); @@ -42,9 +54,9 @@ public class AllTests // facetFilter = communicator.getProperties().getPropertyAsList("Ice.Admin.Facets"); // test(facetFilter.length == 0); communicator.getProperties().setProperty("Ice.Admin.Facets", ""); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing facet registration exceptions... "); + out.print("testing facet registration exceptions... "); communicator.getProperties().setProperty("FacetExceptionTestAdapter.Endpoints", "default"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("FacetExceptionTestAdapter"); Ice.Object obj = new EmptyI(); @@ -67,9 +79,9 @@ public class AllTests catch(Ice.NotRegisteredException ex) { } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing removeAllFacets... "); + out.print("testing removeAllFacets... "); Ice.Object obj1 = new EmptyI(); Ice.Object obj2 = new EmptyI(); adapter.addFacet(obj1, communicator.stringToIdentity("id1"), "f1"); @@ -95,19 +107,19 @@ public class AllTests test(fm.get("f1") == obj1); test(fm.get("f2") == obj2); test(fm.get("") == obj3); - System.out.println("ok"); + out.println("ok"); adapter.deactivate(); - System.out.print("testing stringToProxy... "); - System.out.flush(); + out.print("testing stringToProxy... "); + out.flush(); String ref = "d:default -p 12010 -t 10000"; Ice.ObjectPrx db = communicator.stringToProxy(ref); test(db != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing unchecked cast... "); - System.out.flush(); + out.print("testing unchecked cast... "); + out.flush(); Ice.ObjectPrx prx = Ice.ObjectPrxHelper.uncheckedCast(db); test(prx.ice_getFacet().length() == 0); prx = Ice.ObjectPrxHelper.uncheckedCast(db, "facetABCD"); @@ -116,18 +128,18 @@ public class AllTests test(prx2.ice_getFacet() == "facetABCD"); Ice.ObjectPrx prx3 = Ice.ObjectPrxHelper.uncheckedCast(prx, ""); test(prx3.ice_getFacet().length() == 0); - DPrx d = Test.DPrxHelper.uncheckedCast(db); + DPrx d = DPrxHelper.uncheckedCast(db); test(d.ice_getFacet().length() == 0); - DPrx df = Test.DPrxHelper.uncheckedCast(db, "facetABCD"); + DPrx df = DPrxHelper.uncheckedCast(db, "facetABCD"); test(df.ice_getFacet() == "facetABCD"); - DPrx df2 = Test.DPrxHelper.uncheckedCast(df); + DPrx df2 = DPrxHelper.uncheckedCast(df); test(df2.ice_getFacet() == "facetABCD"); - DPrx df3 = Test.DPrxHelper.uncheckedCast(df, ""); + DPrx df3 = DPrxHelper.uncheckedCast(df, ""); test(df3.ice_getFacet().length() == 0); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing checked cast... "); - System.out.flush(); + out.print("testing checked cast... "); + out.flush(); prx = Ice.ObjectPrxHelper.checkedCast(db); test(prx.ice_getFacet().length() == 0); prx = Ice.ObjectPrxHelper.checkedCast(db, "facetABCD"); @@ -136,18 +148,18 @@ public class AllTests test(prx2.ice_getFacet() == "facetABCD"); prx3 = Ice.ObjectPrxHelper.checkedCast(prx, ""); test(prx3.ice_getFacet().length() == 0); - d = Test.DPrxHelper.checkedCast(db); + d = DPrxHelper.checkedCast(db); test(d.ice_getFacet().length() == 0); - df = Test.DPrxHelper.checkedCast(db, "facetABCD"); + df = DPrxHelper.checkedCast(db, "facetABCD"); test(df.ice_getFacet() == "facetABCD"); - df2 = Test.DPrxHelper.checkedCast(df); + df2 = DPrxHelper.checkedCast(df); test(df2.ice_getFacet() == "facetABCD"); - df3 = Test.DPrxHelper.checkedCast(df, ""); + df3 = DPrxHelper.checkedCast(df, ""); test(df3.ice_getFacet().length() == 0); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing non-facets A, B, C, and D... "); - System.out.flush(); + out.print("testing non-facets A, B, C, and D... "); + out.flush(); d = DPrxHelper.checkedCast(db); test(d != null); test(d.equals(db)); @@ -155,40 +167,40 @@ public class AllTests test(d.callB().equals("B")); test(d.callC().equals("C")); test(d.callD().equals("D")); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing facets A, B, C, and D... "); - System.out.flush(); + out.print("testing facets A, B, C, and D... "); + out.flush(); df = DPrxHelper.checkedCast(d, "facetABCD"); test(df != null); test(df.callA().equals("A")); test(df.callB().equals("B")); test(df.callC().equals("C")); test(df.callD().equals("D")); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing facets E and F... "); - System.out.flush(); + out.print("testing facets E and F... "); + out.flush(); FPrx ff = FPrxHelper.checkedCast(d, "facetEF"); test(ff != null); test(ff.callE().equals("E")); test(ff.callF().equals("F")); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing facet G... "); - System.out.flush(); + out.print("testing facet G... "); + out.flush(); GPrx gf = GPrxHelper.checkedCast(ff, "facetGH"); test(gf != null); test(gf.callG().equals("G")); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing whether casting preserves the facet... "); - System.out.flush(); + out.print("testing whether casting preserves the facet... "); + out.flush(); HPrx hf = HPrxHelper.checkedCast(gf); test(hf != null); test(hf.callG().equals("G")); test(hf.callH().equals("H")); - System.out.println("ok"); + out.println("ok"); return gf; } diff --git a/java/test/Ice/facets/BI.java b/java/test/Ice/facets/BI.java index 8856d27b8a5..07600de3846 100644 --- a/java/test/Ice/facets/BI.java +++ b/java/test/Ice/facets/BI.java @@ -7,7 +7,9 @@ // // ********************************************************************** -import Test.*; +package test.Ice.facets; + +import test.Ice.facets.Test._BDisp; public final class BI extends _BDisp { diff --git a/java/test/Ice/facets/CI.java b/java/test/Ice/facets/CI.java index c3adef35457..88a2e8d48b1 100644 --- a/java/test/Ice/facets/CI.java +++ b/java/test/Ice/facets/CI.java @@ -7,7 +7,9 @@ // // ********************************************************************** -import Test.*; +package test.Ice.facets; + +import test.Ice.facets.Test._CDisp; public final class CI extends _CDisp { diff --git a/java/test/Ice/facets/Client.java b/java/test/Ice/facets/Client.java index 9d3aa8b0dbe..08cf20610d8 100644 --- a/java/test/Ice/facets/Client.java +++ b/java/test/Ice/facets/Client.java @@ -7,49 +7,33 @@ // // ********************************************************************** -import Test.*; +package test.Ice.facets; -public class Client +import test.Ice.facets.Test.GPrx; + +public class Client extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { - GPrx g = AllTests.allTests(communicator); + Ice.Communicator communicator = communicator(); + GPrx g = AllTests.allTests(communicator, getWriter()); g.shutdown(); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.binding"); + return initData; + } + public static void main(String[] args) + { + Client app = new Client(); + int result = app.main("Client", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/facets/Collocated.java b/java/test/Ice/facets/Collocated.java index e8c67da936b..302ef2b32a6 100644 --- a/java/test/Ice/facets/Collocated.java +++ b/java/test/Ice/facets/Collocated.java @@ -7,11 +7,13 @@ // // ********************************************************************** -public class Collocated +package test.Ice.facets; + +public class Collocated extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { + Ice.Communicator communicator = communicator(); communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object d = new DI(); @@ -21,42 +23,25 @@ public class Collocated adapter.addFacet(f, communicator.stringToIdentity("d"), "facetEF"); Ice.Object h = new HI(communicator); adapter.addFacet(h, communicator.stringToIdentity("d"), "facetGH"); - - AllTests.allTests(communicator); + + AllTests.allTests(communicator, getWriter()); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.facets"); + return initData; + } - System.exit(status); + public static void main(String[] args) + { + Collocated app = new Collocated(); + int result = app.main("Collocated", args); + System.gc(); + System.exit(result); } } diff --git a/java/test/Ice/facets/DI.java b/java/test/Ice/facets/DI.java index 023c5381e17..b7314261a39 100644 --- a/java/test/Ice/facets/DI.java +++ b/java/test/Ice/facets/DI.java @@ -7,7 +7,9 @@ // // ********************************************************************** -import Test.*; +package test.Ice.facets; + +import test.Ice.facets.Test._DDisp; public final class DI extends _DDisp { diff --git a/java/test/Ice/facets/EI.java b/java/test/Ice/facets/EI.java index 781f7e17e70..221f43f01b3 100644 --- a/java/test/Ice/facets/EI.java +++ b/java/test/Ice/facets/EI.java @@ -7,7 +7,9 @@ // // ********************************************************************** -import Test.*; +package test.Ice.facets; + +import test.Ice.facets.Test._EDisp; public final class EI extends _EDisp { diff --git a/java/test/Ice/facets/EmptyI.java b/java/test/Ice/facets/EmptyI.java index 9b218e6e3a6..06e824228df 100644 --- a/java/test/Ice/facets/EmptyI.java +++ b/java/test/Ice/facets/EmptyI.java @@ -7,7 +7,9 @@ // // ********************************************************************** -import Test.*; +package test.Ice.facets; + +import test.Ice.facets.Test._EmptyDisp; public final class EmptyI extends _EmptyDisp { diff --git a/java/test/Ice/facets/FI.java b/java/test/Ice/facets/FI.java index 75e76b62d32..2770351077b 100644 --- a/java/test/Ice/facets/FI.java +++ b/java/test/Ice/facets/FI.java @@ -7,7 +7,9 @@ // // ********************************************************************** -import Test.*; +package test.Ice.facets; + +import test.Ice.facets.Test._FDisp; public final class FI extends _FDisp { diff --git a/java/test/Ice/facets/GI.java b/java/test/Ice/facets/GI.java index 182a141e4f6..85b00bbb22d 100644 --- a/java/test/Ice/facets/GI.java +++ b/java/test/Ice/facets/GI.java @@ -7,7 +7,9 @@ // // ********************************************************************** -import Test.*; +package test.Ice.facets; + +import test.Ice.facets.Test._GDisp; public final class GI extends _GDisp { diff --git a/java/test/Ice/facets/HI.java b/java/test/Ice/facets/HI.java index 9aac3f47f98..76acd1f05eb 100644 --- a/java/test/Ice/facets/HI.java +++ b/java/test/Ice/facets/HI.java @@ -7,7 +7,9 @@ // // ********************************************************************** -import Test.*; +package test.Ice.facets; + +import test.Ice.facets.Test._HDisp; public final class HI extends _HDisp { diff --git a/java/test/Ice/facets/Server.java b/java/test/Ice/facets/Server.java index f4921b1ee5e..cf16c8fad62 100644 --- a/java/test/Ice/facets/Server.java +++ b/java/test/Ice/facets/Server.java @@ -7,12 +7,13 @@ // // ********************************************************************** -public class Server +package test.Ice.facets; + +public class Server extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + Ice.Communicator communicator = communicator(); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object d = new DI(); adapter.add(d, communicator.stringToIdentity("d")); @@ -23,42 +24,24 @@ public class Server adapter.addFacet(h, communicator.stringToIdentity("d"), "facetGH"); adapter.activate(); - communicator.waitForShutdown(); - return 0; + return WAIT; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.facets"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + return initData; + } + public static void main(String[] args) + { + Server app = new Server(); + int result = app.main("Server", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/facets/Test.ice b/java/test/Ice/facets/Test.ice index 8d3739dac91..65108dcc903 100644 --- a/java/test/Ice/facets/Test.ice +++ b/java/test/Ice/facets/Test.ice @@ -10,6 +10,7 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Ice.facets"]] module Test { diff --git a/java/test/Ice/facets/build.xml b/java/test/Ice/facets/build.xml deleted file mode 100644 index ae3dc75a67b..00000000000 --- a/java/test/Ice/facets/build.xml +++ /dev/null @@ -1,48 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_facets" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/faultTolerance/AllTests.java b/java/test/Ice/faultTolerance/AllTests.java index 164291eaa38..65df0a594f8 100644 --- a/java/test/Ice/faultTolerance/AllTests.java +++ b/java/test/Ice/faultTolerance/AllTests.java @@ -7,7 +7,17 @@ // // ********************************************************************** -import Test.*; +package test.Ice.faultTolerance; + +import java.io.PrintStream; +import java.io.PrintWriter; + +import test.Ice.faultTolerance.Test.AMI_TestIntf_abort; +import test.Ice.faultTolerance.Test.AMI_TestIntf_idempotentAbort; +import test.Ice.faultTolerance.Test.AMI_TestIntf_pid; +import test.Ice.faultTolerance.Test.AMI_TestIntf_shutdown; +import test.Ice.faultTolerance.Test.TestIntfPrx; +import test.Ice.faultTolerance.Test.TestIntfPrxHelper; public class AllTests { @@ -205,10 +215,10 @@ public class AllTests } public static void - allTests(Ice.Communicator communicator, int[] ports) + allTests(Ice.Communicator communicator, int[] ports, PrintWriter out) { - System.out.print("testing stringToProxy... "); - System.out.flush(); + out.print("testing stringToProxy... "); + out.flush(); String ref = "test"; for(int i = 0; i < ports.length; i++) { @@ -216,14 +226,14 @@ public class AllTests } Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing checked cast... "); - System.out.flush(); + out.print("testing checked cast... "); + out.flush(); TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base); test(obj != null); test(obj.equals(base)); - System.out.println("ok"); + out.println("ok"); int oldPid = 0; boolean ami = false; @@ -237,23 +247,23 @@ public class AllTests if(!ami) { - System.out.print("testing server #" + i + "... "); - System.out.flush(); + out.print("testing server #" + i + "... "); + out.flush(); int pid = obj.pid(); test(pid != oldPid); - System.out.println("ok"); + out.println("ok"); oldPid = pid; } else { - System.out.print("testing server #" + i + " with AMI... "); - System.out.flush(); + out.print("testing server #" + i + " with AMI... "); + out.flush(); AMI_Test_pidI cb = new AMI_Test_pidI(); obj.pid_async(cb); test(cb.check()); int pid = cb.pid(); test(pid != oldPid); - System.out.println("ok"); + out.println("ok"); oldPid = pid; } @@ -261,27 +271,27 @@ public class AllTests { if(!ami) { - System.out.print("shutting down server #" + i + "... "); - System.out.flush(); + out.print("shutting down server #" + i + "... "); + out.flush(); obj.shutdown(); - System.out.println("ok"); + out.println("ok"); } else { - System.out.print("shutting down server #" + i + " with AMI... "); - System.out.flush(); + out.print("shutting down server #" + i + " with AMI... "); + out.flush(); AMI_Test_shutdownI cb = new AMI_Test_shutdownI(); obj.shutdown_async(cb); test(cb.check()); - System.out.println("ok"); + out.println("ok"); } } else if(j == 1 || i + 1 > ports.length) { if(!ami) { - System.out.print("aborting server #" + i + "... "); - System.out.flush(); + out.print("aborting server #" + i + "... "); + out.flush(); try { obj.abort(); @@ -289,33 +299,33 @@ public class AllTests } catch(Ice.ConnectionLostException ex) { - System.out.println("ok"); + out.println("ok"); } catch(Ice.ConnectFailedException exc) { - System.out.println("ok"); + out.println("ok"); } catch(Ice.SocketException ex) { - System.out.println("ok"); + out.println("ok"); } } else { - System.out.print("aborting server #" + i + " with AMI... "); - System.out.flush(); + out.print("aborting server #" + i + " with AMI... "); + out.flush(); AMI_Test_abortI cb = new AMI_Test_abortI(); obj.abort_async(cb); test(cb.check()); - System.out.println("ok"); + out.println("ok"); } } else if(j == 2 || j == 3) { if(!ami) { - System.out.print("aborting server #" + i + " and #" + (i + 1) + " with idempotent call... "); - System.out.flush(); + out.print("aborting server #" + i + " and #" + (i + 1) + " with idempotent call... "); + out.flush(); try { obj.idempotentAbort(); @@ -323,25 +333,25 @@ public class AllTests } catch(Ice.ConnectionLostException ex) { - System.out.println("ok"); + out.println("ok"); } catch(Ice.ConnectFailedException exc) { - System.out.println("ok"); + out.println("ok"); } catch(Ice.SocketException ex) { - System.out.println("ok"); + out.println("ok"); } } else { - System.out.print("aborting server #" + i + " and #" + (i + 1) + " with idempotent AMI call... "); - System.out.flush(); + out.print("aborting server #" + i + " and #" + (i + 1) + " with idempotent AMI call... "); + out.flush(); AMI_Test_idempotentAbortI cb = new AMI_Test_idempotentAbortI(); obj.idempotentAbort_async(cb); test(cb.check()); - System.out.println("ok"); + out.println("ok"); } ++i; @@ -352,8 +362,8 @@ public class AllTests } } - System.out.print("testing whether all servers are gone... "); - System.out.flush(); + out.print("testing whether all servers are gone... "); + out.flush(); try { obj.ice_ping(); @@ -361,7 +371,7 @@ public class AllTests } catch(Ice.LocalException ex) { - System.out.println("ok"); + out.println("ok"); } } } diff --git a/java/test/Ice/faultTolerance/Client.java b/java/test/Ice/faultTolerance/Client.java index 1f23a773477..77db47ee934 100644 --- a/java/test/Ice/faultTolerance/Client.java +++ b/java/test/Ice/faultTolerance/Client.java @@ -7,7 +7,12 @@ // // ********************************************************************** -public class Client +package test.Ice.faultTolerance; + +import java.io.PrintWriter; + + +public class Client extends test.Util.Application { private static void usage() @@ -15,9 +20,12 @@ public class Client System.err.println("Usage: Client port..."); } - private static int - run(String[] args, Ice.Communicator communicator) + public int + run(String[] args) { + PrintWriter out = getWriter(); + + Ice.Communicator communicator = communicator(); java.util.List<Integer> ports = new java.util.ArrayList<Integer>(args.length); for(int i = 0; i < args.length; i++) { @@ -48,7 +56,7 @@ public class Client if(ports.isEmpty()) { - System.err.println("Client: no ports specified"); + out.println("Client: no ports specified"); usage(); return 1; } @@ -61,7 +69,7 @@ public class Client try { - AllTests.allTests(communicator, arr); + AllTests.allTests(communicator, arr, out); } catch(Ice.LocalException ex) { @@ -72,46 +80,24 @@ public class Client return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); - - // - // This test aborts servers, so we don't want warnings. - // - initData. properties.setProperty("Ice.Warn.Connections", "0"); - - communicator = Ice.Util.initialize(argsH, initData); - status = run(argsH.value, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.faultTolerance"); + // + // This test aborts servers, so we don't want warnings. + // + initData.properties.setProperty("Ice.Warn.Connections", "0"); - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + return initData; + } + public static void main(String[] args) + { + Client app = new Client(); + int result = app.main("Client", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/faultTolerance/Server.java b/java/test/Ice/faultTolerance/Server.java index 9c02303346c..e5d0e935be5 100644 --- a/java/test/Ice/faultTolerance/Server.java +++ b/java/test/Ice/faultTolerance/Server.java @@ -7,7 +7,11 @@ // // ********************************************************************** -public class Server +package test.Ice.faultTolerance; + +import java.io.PrintWriter; + +public class Server extends test.Util.Application { private static void usage() @@ -15,22 +19,24 @@ public class Server System.err.println("Usage: Server port"); } - private static int - run(String[] args, Ice.Communicator communicator) + public int + run(String[] args) { + Ice.Communicator communicator = communicator(); int port = 0; - for(int i = 0; i < args.length; i++) + PrintWriter out = getWriter(); + for(int i = 0; i < args.length; i++) { if(args[i].charAt(0) == '-') { - System.err.println("Server: unknown option `" + args[i] + "'"); + out.println("Server: unknown option `" + args[i] + "'"); usage(); return 1; } if(port > 0) { - System.err.println("Server: only one port can be specified"); + out.println("Server: only one port can be specified"); usage(); return 1; } @@ -41,7 +47,7 @@ public class Server } catch(NumberFormatException ex) { - System.err.println("Server: invalid port"); + out.println("Server: invalid port"); usage(); return 1; } @@ -49,62 +55,35 @@ public class Server if(port <= 0) { - System.err.println("Server: no port specified"); + out.println("Server: no port specified"); usage(); return 1; } + // Don't move this, it needs the port. communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p " + port + ":udp"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object object = new TestI(adapter, port); adapter.add(object, communicator.stringToIdentity("test")); adapter.activate(); - communicator.waitForShutdown(); - return 0; + return WAIT; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - // - // In this test, we need a longer server idle time, - // otherwise our test servers may time out before they are - // used in the test. - // - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); - - initData.properties.setProperty("Ice.ServerIdleTime", "120"); // Two minutes. - - communicator = Ice.Util.initialize(argsH, initData); - status = run(argsH.value, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.faultTolerance"); + // Two minutes. + initData.properties.setProperty("Ice.ServerIdleTime", "120"); + return initData; + } + public static void main(String[] args) + { + Server app = new Server(); + int result = app.main("Server", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/faultTolerance/Test.ice b/java/test/Ice/faultTolerance/Test.ice index fc1881aaf43..706db037249 100644 --- a/java/test/Ice/faultTolerance/Test.ice +++ b/java/test/Ice/faultTolerance/Test.ice @@ -10,6 +10,7 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Ice.faultTolerance"]] module Test { diff --git a/java/test/Ice/faultTolerance/TestI.java b/java/test/Ice/faultTolerance/TestI.java index 3c705235c49..576ab2a8c08 100644 --- a/java/test/Ice/faultTolerance/TestI.java +++ b/java/test/Ice/faultTolerance/TestI.java @@ -7,7 +7,9 @@ // // ********************************************************************** -import Test.*; +package test.Ice.faultTolerance; + +import test.Ice.faultTolerance.Test._TestIntfDisp; public final class TestI extends _TestIntfDisp { diff --git a/java/test/Ice/faultTolerance/build.xml b/java/test/Ice/faultTolerance/build.xml deleted file mode 100644 index 5c538d60212..00000000000 --- a/java/test/Ice/faultTolerance/build.xml +++ /dev/null @@ -1,48 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_faultTolerance" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/faultTolerance/run.py b/java/test/Ice/faultTolerance/run.py index f6938cbae86..6e6003bbeae 100755 --- a/java/test/Ice/faultTolerance/run.py +++ b/java/test/Ice/faultTolerance/run.py @@ -20,22 +20,20 @@ if len(path) == 0: sys.path.append(os.path.join(path[0])) from scripts import * -TestUtil.addClasspath(os.path.join(os.getcwd(), "classes")) - num = 12 base = 12340 serverProc = [] for i in range(0, num): print "starting server #%d..." % (i + 1), - serverProc.append(TestUtil.startServer("Server", " %d" % (base + i))) + serverProc.append(TestUtil.startServer("test.Ice.faultTolerance.Server", " %d" % (base + i))) print "ok" ports = "" for i in range(0, num): ports = "%s %d" % (ports, base + i) print "starting client...", -clientProc = TestUtil.startClient("Client", ports, startReader = False) +clientProc = TestUtil.startClient("test.Ice.faultTolerance.Client", ports, startReader=False) print "ok" clientProc.startReader() diff --git a/java/test/Ice/hold/AllTests.java b/java/test/Ice/hold/AllTests.java index cf13c6d2899..e2603cca3d7 100644 --- a/java/test/Ice/hold/AllTests.java +++ b/java/test/Ice/hold/AllTests.java @@ -7,7 +7,14 @@ // // ********************************************************************** -import Test.*; +package test.Ice.hold; + +import java.io.PrintStream; +import java.io.PrintWriter; + +import test.Ice.hold.Test.AMI_Hold_set; +import test.Ice.hold.Test.HoldPrx; +import test.Ice.hold.Test.HoldPrxHelper; public class AllTests { @@ -93,20 +100,20 @@ public class AllTests }; public static void - allTests(Ice.Communicator communicator) + allTests(Ice.Communicator communicator, PrintWriter out) { - System.out.print("testing stringToProxy... "); - System.out.flush(); - String ref = "hold:default -p 12010 -t 30000"; + out.print("testing stringToProxy... "); + out.flush(); + String ref = "hold:default -p 12010 -t 60000"; Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); - String refSerialized = "hold:default -p 12011 -t 30000"; + String refSerialized = "hold:default -p 12011 -t 60000"; Ice.ObjectPrx baseSerialized = communicator.stringToProxy(refSerialized); test(baseSerialized != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing checked cast... "); - System.out.flush(); + out.print("testing checked cast... "); + out.flush(); HoldPrx hold = HoldPrxHelper.checkedCast(base); HoldPrx holdOneway = HoldPrxHelper.uncheckedCast(base.ice_oneway()); test(hold != null); @@ -115,10 +122,10 @@ public class AllTests HoldPrx holdSerializedOneway = HoldPrxHelper.uncheckedCast(baseSerialized.ice_oneway()); test(holdSerialized != null); test(holdSerialized.equals(baseSerialized)); - System.out.println("ok"); + out.println("ok"); - System.out.print("changing state between active and hold rapidly... "); - System.out.flush(); + out.print("changing state between active and hold rapidly... "); + out.flush(); for(int i = 0; i < 100; ++i) { hold.putOnHold(0); @@ -135,10 +142,10 @@ public class AllTests { holdSerializedOneway.putOnHold(0); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing without serialize mode... "); - System.out.flush(); + out.print("testing without serialize mode... "); + out.flush(); java.util.Random random = new java.util.Random(); { Condition cond = new Condition(true); @@ -166,10 +173,10 @@ public class AllTests cb = null; } } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing with serialize mode... "); - System.out.flush(); + out.print("testing with serialize mode... "); + out.flush(); { Condition cond = new Condition(true); int value = 0; @@ -207,12 +214,12 @@ public class AllTests } } } - System.out.println("ok"); + out.println("ok"); - System.out.print("changing state to hold and shutting down server... "); - System.out.flush(); + out.print("changing state to hold and shutting down server... "); + out.flush(); hold.shutdown(); - System.out.println("ok"); + out.println("ok"); } } diff --git a/java/test/Ice/hold/Client.java b/java/test/Ice/hold/Client.java index d3d83f8fe8c..d5577e25a16 100644 --- a/java/test/Ice/hold/Client.java +++ b/java/test/Ice/hold/Client.java @@ -7,46 +7,30 @@ // // ********************************************************************** -public class Client +package test.Ice.hold; + +public class Client extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { - AllTests.allTests(communicator); + Ice.Communicator communicator = communicator(); + AllTests.allTests(communicator, getWriter()); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.hold"); + return initData; + } + public static void main(String[] args) + { + Client app = new Client(); + int result = app.main("Client", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/hold/HoldI.java b/java/test/Ice/hold/HoldI.java index 2e60e309c5c..06236d11bb9 100644 --- a/java/test/Ice/hold/HoldI.java +++ b/java/test/Ice/hold/HoldI.java @@ -7,7 +7,9 @@ // // ********************************************************************** -import Test.*; +package test.Ice.hold; + +import test.Ice.hold.Test._HoldDisp; public final class HoldI extends _HoldDisp { @@ -78,6 +80,7 @@ public final class HoldI extends _HoldDisp { if(_last != expected) { + System.err.println("_last = " + _last + " expected = " + expected); _adapter.getCommunicator().shutdown(); test(false); } diff --git a/java/test/Ice/hold/Server.java b/java/test/Ice/hold/Server.java index 650321b68ae..ae0a3a5939c 100644 --- a/java/test/Ice/hold/Server.java +++ b/java/test/Ice/hold/Server.java @@ -7,32 +7,25 @@ // // ********************************************************************** -public class Server +package test.Ice.hold; + +public class Server extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { + Ice.Communicator communicator = communicator(); java.util.Timer timer = new java.util.Timer(); - communicator.getProperties().setProperty("TestAdapter1.Endpoints", "default -p 12010 -t 10000:udp"); - communicator.getProperties().setProperty("TestAdapter1.ThreadPool.Size", "5"); - communicator.getProperties().setProperty("TestAdapter1.ThreadPool.SizeMax", "5"); - communicator.getProperties().setProperty("TestAdapter1.ThreadPool.SizeWarn", "0"); - communicator.getProperties().setProperty("TestAdapter1.ThreadPool.Serialize", "0"); Ice.ObjectAdapter adapter1 = communicator.createObjectAdapter("TestAdapter1"); adapter1.add(new HoldI(timer, adapter1), communicator.stringToIdentity("hold")); - communicator.getProperties().setProperty("TestAdapter2.Endpoints", "default -p 12011 -t 10000:udp"); - communicator.getProperties().setProperty("TestAdapter2.ThreadPool.Size", "5"); - communicator.getProperties().setProperty("TestAdapter2.ThreadPool.SizeMax", "5"); - communicator.getProperties().setProperty("TestAdapter2.ThreadPool.SizeWarn", "0"); - communicator.getProperties().setProperty("TestAdapter2.ThreadPool.Serialize", "1"); Ice.ObjectAdapter adapter2 = communicator.createObjectAdapter("TestAdapter2"); adapter2.add(new HoldI(timer, adapter2), communicator.stringToIdentity("hold")); adapter1.activate(); adapter2.activate(); + serverReady(); communicator.waitForShutdown(); timer.cancel(); @@ -40,37 +33,30 @@ public class Server return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.hold"); + initData.properties.setProperty("TestAdapter1.Endpoints", "default -p 12010 -t 10000:udp"); + initData.properties.setProperty("TestAdapter1.ThreadPool.Size", "5"); + initData.properties.setProperty("TestAdapter1.ThreadPool.SizeMax", "5"); + initData.properties.setProperty("TestAdapter1.ThreadPool.SizeWarn", "0"); + initData.properties.setProperty("TestAdapter1.ThreadPool.Serialize", "0"); + + initData.properties.setProperty("TestAdapter2.Endpoints", "default -p 12011 -t 10000:udp"); + initData.properties.setProperty("TestAdapter2.ThreadPool.Size", "5"); + initData.properties.setProperty("TestAdapter2.ThreadPool.SizeMax", "5"); + initData.properties.setProperty("TestAdapter2.ThreadPool.SizeWarn", "0"); + initData.properties.setProperty("TestAdapter2.ThreadPool.Serialize", "1"); + return initData; + } + public static void main(String[] args) + { + Server app = new Server(); + int result = app.main("Server", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/hold/Test.ice b/java/test/Ice/hold/Test.ice index 153c5c6d0e8..da92d1d1103 100644 --- a/java/test/Ice/hold/Test.ice +++ b/java/test/Ice/hold/Test.ice @@ -10,6 +10,7 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Ice.hold"]] module Test { diff --git a/java/test/Ice/hold/build.xml b/java/test/Ice/hold/build.xml deleted file mode 100644 index 44d27afd443..00000000000 --- a/java/test/Ice/hold/build.xml +++ /dev/null @@ -1,48 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_hold" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/inheritance/AllTests.java b/java/test/Ice/inheritance/AllTests.java index fac185f4919..4e200a31d3f 100644 --- a/java/test/Ice/inheritance/AllTests.java +++ b/java/test/Ice/inheritance/AllTests.java @@ -7,6 +7,22 @@ // // ********************************************************************** +package test.Ice.inheritance; + +import java.io.PrintStream; +import java.io.PrintWriter; + +import test.Ice.inheritance.Test.InitialPrx; +import test.Ice.inheritance.Test.InitialPrxHelper; +import test.Ice.inheritance.Test.MA.CAPrx; +import test.Ice.inheritance.Test.MA.CCPrx; +import test.Ice.inheritance.Test.MA.CDPrx; +import test.Ice.inheritance.Test.MA.IAPrx; +import test.Ice.inheritance.Test.MA.ICPrx; +import test.Ice.inheritance.Test.MB.CBPrx; +import test.Ice.inheritance.Test.MB.IB1Prx; +import test.Ice.inheritance.Test.MB.IB2Prx; + public class AllTests { private static void @@ -18,55 +34,55 @@ public class AllTests } } - public static Test.InitialPrx - allTests(Ice.Communicator communicator) + public static InitialPrx + allTests(Ice.Communicator communicator, PrintWriter out) { - System.out.print("testing stringToProxy... "); - System.out.flush(); + out.print("testing stringToProxy... "); + out.flush(); String ref = "initial:default -p 12010 -t 10000"; Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing checked cast... "); - System.out.flush(); - Test.InitialPrx initial = Test.InitialPrxHelper.checkedCast(base); + out.print("testing checked cast... "); + out.flush(); + InitialPrx initial = InitialPrxHelper.checkedCast(base); test(initial != null); test(initial.equals(base)); - System.out.println("ok"); - - System.out.print("getting proxies for class hierarchy... "); - System.out.flush(); - Test.MA.CAPrx ca = initial.caop(); - Test.MB.CBPrx cb = initial.cbop(); - Test.MA.CCPrx cc = initial.ccop(); - Test.MA.CDPrx cd = initial.cdop(); + out.println("ok"); + + out.print("getting proxies for class hierarchy... "); + out.flush(); + CAPrx ca = initial.caop(); + CBPrx cb = initial.cbop(); + CCPrx cc = initial.ccop(); + CDPrx cd = initial.cdop(); test(ca != cb); test(ca != cc); test(ca != cd); test(cb != cc); test(cb != cd); test(cc != cd); - System.out.println("ok"); - - System.out.print("getting proxies for interface hierarchy... "); - System.out.flush(); - Test.MA.IAPrx ia = initial.iaop(); - Test.MB.IB1Prx ib1 = initial.ib1op(); - Test.MB.IB2Prx ib2 = initial.ib2op(); - Test.MA.ICPrx ic = initial.icop(); + out.println("ok"); + + out.print("getting proxies for interface hierarchy... "); + out.flush(); + IAPrx ia = initial.iaop(); + IB1Prx ib1 = initial.ib1op(); + IB2Prx ib2 = initial.ib2op(); + ICPrx ic = initial.icop(); test(ia != ib1); test(ia != ib2); test(ia != ic); test(ib1 != ic); test(ib2 != ic); - System.out.println("ok"); + out.println("ok"); - System.out.print("invoking proxy operations on class hierarchy... "); - System.out.flush(); - Test.MA.CAPrx cao; - Test.MB.CBPrx cbo; - Test.MA.CCPrx cco; + out.print("invoking proxy operations on class hierarchy... "); + out.flush(); + CAPrx cao; + CBPrx cbo; + CCPrx cco; cao = ca.caop(ca); test(cao.equals(ca)); @@ -110,14 +126,14 @@ public class AllTests test(cbo.equals(cc)); cco = cc.ccop(cc); test(cco.equals(cc)); - System.out.println("ok"); + out.println("ok"); - System.out.print("ditto, but for interface hierarchy... "); - System.out.flush(); - Test.MA.IAPrx iao; - Test.MB.IB1Prx ib1o; - Test.MB.IB2Prx ib2o; - Test.MA.ICPrx ico; + out.print("ditto, but for interface hierarchy... "); + out.flush(); + IAPrx iao; + IB1Prx ib1o; + IB2Prx ib2o; + ICPrx ico; iao = ia.iaop(ia); test(iao.equals(ia)); @@ -194,11 +210,11 @@ public class AllTests test(ib2o.equals(ic)); ico = ic.icop(ic); test(ico.equals(ic)); - System.out.println("ok"); + out.println("ok"); - System.out.print("ditto, but for class implementing interfaces... "); - System.out.flush(); - Test.MA.CDPrx cdo; + out.print("ditto, but for class implementing interfaces... "); + out.flush(); + CDPrx cdo; cao = cd.caop(cd); test(cao.equals(cd)); @@ -227,7 +243,7 @@ public class AllTests test(ib1o.equals(cd)); ib2o = cd.cdop(cd); test(ib2o.equals(cd)); - System.out.println("ok"); + out.println("ok"); return initial; } diff --git a/java/test/Ice/inheritance/CAI.java b/java/test/Ice/inheritance/CAI.java index 0015cceb632..859a7d01918 100644 --- a/java/test/Ice/inheritance/CAI.java +++ b/java/test/Ice/inheritance/CAI.java @@ -7,15 +7,20 @@ // // ********************************************************************** -public final class CAI extends Test.MA.CA +package test.Ice.inheritance; + +import test.Ice.inheritance.Test.MA.CA; +import test.Ice.inheritance.Test.MA.CAPrx; + +public final class CAI extends CA { public CAI() { } - public Test.MA.CAPrx - caop(Test.MA.CAPrx p, Ice.Current current) + public CAPrx + caop(CAPrx p, Ice.Current current) { return p; } diff --git a/java/test/Ice/inheritance/CBI.java b/java/test/Ice/inheritance/CBI.java index aad89291609..dc68704c3e9 100644 --- a/java/test/Ice/inheritance/CBI.java +++ b/java/test/Ice/inheritance/CBI.java @@ -7,21 +7,27 @@ // // ********************************************************************** -public final class CBI extends Test.MB.CB +package test.Ice.inheritance; + +import test.Ice.inheritance.Test.MA.CAPrx; +import test.Ice.inheritance.Test.MB.CB; +import test.Ice.inheritance.Test.MB.CBPrx; + +public final class CBI extends CB { public CBI() { } - public Test.MA.CAPrx - caop(Test.MA.CAPrx p, Ice.Current current) + public CAPrx + caop(CAPrx p, Ice.Current current) { return p; } - public Test.MB.CBPrx - cbop(Test.MB.CBPrx p, Ice.Current current) + public CBPrx + cbop(CBPrx p, Ice.Current current) { return p; } diff --git a/java/test/Ice/inheritance/CCI.java b/java/test/Ice/inheritance/CCI.java index 6845f844095..a09969228f6 100644 --- a/java/test/Ice/inheritance/CCI.java +++ b/java/test/Ice/inheritance/CCI.java @@ -7,27 +7,34 @@ // // ********************************************************************** -public final class CCI extends Test.MA.CC +package test.Ice.inheritance; + +import test.Ice.inheritance.Test.MA.CAPrx; +import test.Ice.inheritance.Test.MA.CC; +import test.Ice.inheritance.Test.MA.CCPrx; +import test.Ice.inheritance.Test.MB.CBPrx; + +public final class CCI extends CC { public CCI() { } - public Test.MA.CAPrx - caop(Test.MA.CAPrx p, Ice.Current current) + public CAPrx + caop(CAPrx p, Ice.Current current) { return p; } - public Test.MA.CCPrx - ccop(Test.MA.CCPrx p, Ice.Current current) + public CCPrx + ccop(CCPrx p, Ice.Current current) { return p; } - public Test.MB.CBPrx - cbop(Test.MB.CBPrx p, Ice.Current current) + public CBPrx + cbop(CBPrx p, Ice.Current current) { return p; } diff --git a/java/test/Ice/inheritance/CDI.java b/java/test/Ice/inheritance/CDI.java index e3280bc6676..7af364672c8 100644 --- a/java/test/Ice/inheritance/CDI.java +++ b/java/test/Ice/inheritance/CDI.java @@ -7,51 +7,62 @@ // // ********************************************************************** -public final class CDI extends Test.MA.CD +package test.Ice.inheritance; + +import test.Ice.inheritance.Test.MA.CAPrx; +import test.Ice.inheritance.Test.MA.CCPrx; +import test.Ice.inheritance.Test.MA.CD; +import test.Ice.inheritance.Test.MA.CDPrx; +import test.Ice.inheritance.Test.MA.IAPrx; +import test.Ice.inheritance.Test.MB.CBPrx; +import test.Ice.inheritance.Test.MB.IB1Prx; +import test.Ice.inheritance.Test.MB.IB2Prx; + +public final class CDI extends CD { public CDI() { } - public Test.MA.CAPrx - caop(Test.MA.CAPrx p, Ice.Current current) + public CAPrx + caop(CAPrx p, Ice.Current current) { return p; } - public Test.MA.CCPrx - ccop(Test.MA.CCPrx p, Ice.Current current) + public CCPrx + ccop(CCPrx p, Ice.Current current) { return p; } - public Test.MA.CDPrx - cdop(Test.MA.CDPrx p, Ice.Current current) + public CDPrx + cdop(CDPrx p, Ice.Current current) { return p; } - public Test.MA.IAPrx - iaop(Test.MA.IAPrx p, Ice.Current current) + public IAPrx + iaop(IAPrx p, Ice.Current current) { return p; } - public Test.MB.CBPrx - cbop(Test.MB.CBPrx p, Ice.Current current) + public CBPrx + cbop(CBPrx p, Ice.Current current) { return p; } - public Test.MB.IB1Prx - ib1op(Test.MB.IB1Prx p, Ice.Current current) + public IB1Prx + ib1op(IB1Prx p, Ice.Current current) { return p; } - public Test.MB.IB2Prx - ib2op(Test.MB.IB2Prx p, Ice.Current current) + public IB2Prx + ib2op(IB2Prx p, Ice.Current current) { return p; } diff --git a/java/test/Ice/inheritance/Client.java b/java/test/Ice/inheritance/Client.java index 533d9bf673d..9af0442a18e 100644 --- a/java/test/Ice/inheritance/Client.java +++ b/java/test/Ice/inheritance/Client.java @@ -7,47 +7,32 @@ // // ********************************************************************** -import Test.*; +package test.Ice.inheritance; -public class Client +import test.Ice.inheritance.Test.InitialPrx; + +public class Client extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { - InitialPrx initial = AllTests.allTests(communicator); + Ice.Communicator communicator = communicator(); + InitialPrx initial = AllTests.allTests(communicator, getWriter()); initial.shutdown(); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance"); + return initData; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + public static void main(String[] args) + { + Client c = new Client(); + int status = c.main("Client", args); System.gc(); System.exit(status); diff --git a/java/test/Ice/inheritance/Collocated.java b/java/test/Ice/inheritance/Collocated.java index 83dffe112d3..2081c9bfc7a 100644 --- a/java/test/Ice/inheritance/Collocated.java +++ b/java/test/Ice/inheritance/Collocated.java @@ -7,51 +7,38 @@ // // ********************************************************************** -public class Collocated +package test.Ice.inheritance; + +public class Collocated extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + Ice.Communicator communicator = communicator(); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object object = new InitialI(adapter); adapter.add(object, communicator.stringToIdentity("initial")); - AllTests.allTests(communicator); + AllTests.allTests(communicator, getWriter()); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + return initData; + } + public static void main(String[] args) + { + Collocated c = new Collocated(); + int status = c.main("Collocated", args); + + System.gc(); System.exit(status); } + } diff --git a/java/test/Ice/inheritance/IAI.java b/java/test/Ice/inheritance/IAI.java index 328b0340a60..e65eb141a31 100644 --- a/java/test/Ice/inheritance/IAI.java +++ b/java/test/Ice/inheritance/IAI.java @@ -7,15 +7,20 @@ // // ********************************************************************** -public final class IAI extends Test.MA._IADisp +package test.Ice.inheritance; + +import test.Ice.inheritance.Test.MA.IAPrx; +import test.Ice.inheritance.Test.MA._IADisp; + +public final class IAI extends _IADisp { public IAI() { } - public Test.MA.IAPrx - iaop(Test.MA.IAPrx p, Ice.Current current) + public IAPrx + iaop(IAPrx p, Ice.Current current) { return p; } diff --git a/java/test/Ice/inheritance/IB1I.java b/java/test/Ice/inheritance/IB1I.java index 40c5bbe1074..442d335fae4 100644 --- a/java/test/Ice/inheritance/IB1I.java +++ b/java/test/Ice/inheritance/IB1I.java @@ -7,21 +7,27 @@ // // ********************************************************************** -public final class IB1I extends Test.MB._IB1Disp +package test.Ice.inheritance; + +import test.Ice.inheritance.Test.MA.IAPrx; +import test.Ice.inheritance.Test.MB.IB1Prx; +import test.Ice.inheritance.Test.MB._IB1Disp; + +public final class IB1I extends _IB1Disp { public IB1I() { } - public Test.MA.IAPrx - iaop(Test.MA.IAPrx p, Ice.Current current) + public IAPrx + iaop(IAPrx p, Ice.Current current) { return p; } - public Test.MB.IB1Prx - ib1op(Test.MB.IB1Prx p, Ice.Current current) + public IB1Prx + ib1op(IB1Prx p, Ice.Current current) { return p; } diff --git a/java/test/Ice/inheritance/IB2I.java b/java/test/Ice/inheritance/IB2I.java index 88b0aa89291..da3c2b304e9 100644 --- a/java/test/Ice/inheritance/IB2I.java +++ b/java/test/Ice/inheritance/IB2I.java @@ -7,21 +7,27 @@ // // ********************************************************************** -public final class IB2I extends Test.MB._IB2Disp +package test.Ice.inheritance; + +import test.Ice.inheritance.Test.MA.IAPrx; +import test.Ice.inheritance.Test.MB.IB2Prx; +import test.Ice.inheritance.Test.MB._IB2Disp; + +public final class IB2I extends _IB2Disp { public IB2I() { } - public Test.MA.IAPrx - iaop(Test.MA.IAPrx p, Ice.Current current) + public IAPrx + iaop(IAPrx p, Ice.Current current) { return p; } - public Test.MB.IB2Prx - ib2op(Test.MB.IB2Prx p, Ice.Current current) + public IB2Prx + ib2op(IB2Prx p, Ice.Current current) { return p; } diff --git a/java/test/Ice/inheritance/ICI.java b/java/test/Ice/inheritance/ICI.java index b940ee6719b..caa183f60b0 100644 --- a/java/test/Ice/inheritance/ICI.java +++ b/java/test/Ice/inheritance/ICI.java @@ -7,33 +7,41 @@ // // ********************************************************************** -public final class ICI extends Test.MA._ICDisp +package test.Ice.inheritance; + +import test.Ice.inheritance.Test.MA.IAPrx; +import test.Ice.inheritance.Test.MA.ICPrx; +import test.Ice.inheritance.Test.MA._ICDisp; +import test.Ice.inheritance.Test.MB.IB1Prx; +import test.Ice.inheritance.Test.MB.IB2Prx; + +public final class ICI extends _ICDisp { public ICI() { } - public Test.MA.IAPrx - iaop(Test.MA.IAPrx p, Ice.Current current) + public IAPrx + iaop(IAPrx p, Ice.Current current) { return p; } - public Test.MA.ICPrx - icop(Test.MA.ICPrx p, Ice.Current current) + public ICPrx + icop(ICPrx p, Ice.Current current) { return p; } - public Test.MB.IB1Prx - ib1op(Test.MB.IB1Prx p, Ice.Current current) + public IB1Prx + ib1op(IB1Prx p, Ice.Current current) { return p; } - public Test.MB.IB2Prx - ib2op(Test.MB.IB2Prx p, Ice.Current current) + public IB2Prx + ib2op(IB2Prx p, Ice.Current current) { return p; } diff --git a/java/test/Ice/inheritance/InitialI.java b/java/test/Ice/inheritance/InitialI.java index 5a64df870af..b9ca6d9cd37 100644 --- a/java/test/Ice/inheritance/InitialI.java +++ b/java/test/Ice/inheritance/InitialI.java @@ -7,73 +7,93 @@ // // ********************************************************************** -public final class InitialI extends Test._InitialDisp +package test.Ice.inheritance; + +import test.Ice.inheritance.Test._InitialDisp; +import test.Ice.inheritance.Test.MA.CAPrx; +import test.Ice.inheritance.Test.MA.CAPrxHelper; +import test.Ice.inheritance.Test.MA.CCPrx; +import test.Ice.inheritance.Test.MA.CCPrxHelper; +import test.Ice.inheritance.Test.MA.CDPrx; +import test.Ice.inheritance.Test.MA.CDPrxHelper; +import test.Ice.inheritance.Test.MA.IAPrx; +import test.Ice.inheritance.Test.MA.IAPrxHelper; +import test.Ice.inheritance.Test.MA.ICPrx; +import test.Ice.inheritance.Test.MA.ICPrxHelper; +import test.Ice.inheritance.Test.MB.CBPrx; +import test.Ice.inheritance.Test.MB.CBPrxHelper; +import test.Ice.inheritance.Test.MB.IB1Prx; +import test.Ice.inheritance.Test.MB.IB1PrxHelper; +import test.Ice.inheritance.Test.MB.IB2Prx; +import test.Ice.inheritance.Test.MB.IB2PrxHelper; + +public final class InitialI extends _InitialDisp { public InitialI(Ice.ObjectAdapter adapter) { _adapter = adapter; - _ca = Test.MA.CAPrxHelper.uncheckedCast( + _ca = CAPrxHelper.uncheckedCast( _adapter.addWithUUID(new CAI())); - _cb = Test.MB.CBPrxHelper.uncheckedCast( + _cb = CBPrxHelper.uncheckedCast( _adapter.addWithUUID(new CBI())); - _cc = Test.MA.CCPrxHelper.uncheckedCast( + _cc = CCPrxHelper.uncheckedCast( _adapter.addWithUUID(new CCI())); - _cd = Test.MA.CDPrxHelper.uncheckedCast( + _cd = CDPrxHelper.uncheckedCast( _adapter.addWithUUID(new CDI())); - _ia = Test.MA.IAPrxHelper.uncheckedCast( + _ia = IAPrxHelper.uncheckedCast( _adapter.addWithUUID(new IAI())); - _ib1 = Test.MB.IB1PrxHelper.uncheckedCast( + _ib1 = IB1PrxHelper.uncheckedCast( _adapter.addWithUUID(new IB1I())); - _ib2 = Test.MB.IB2PrxHelper.uncheckedCast( + _ib2 = IB2PrxHelper.uncheckedCast( _adapter.addWithUUID(new IB2I())); - _ic = Test.MA.ICPrxHelper.uncheckedCast( + _ic = ICPrxHelper.uncheckedCast( _adapter.addWithUUID(new ICI())); } - public Test.MA.CAPrx + public CAPrx caop(Ice.Current current) { return _ca; } - public Test.MB.CBPrx + public CBPrx cbop(Ice.Current current) { return _cb; } - public Test.MA.CCPrx + public CCPrx ccop(Ice.Current current) { return _cc; } - public Test.MA.CDPrx + public CDPrx cdop(Ice.Current current) { return _cd; } - public Test.MA.IAPrx + public IAPrx iaop(Ice.Current current) { return _ia; } - public Test.MB.IB1Prx + public IB1Prx ib1op(Ice.Current current) { return _ib1; } - public Test.MB.IB2Prx + public IB2Prx ib2op(Ice.Current current) { return _ib2; } - public Test.MA.ICPrx + public ICPrx icop(Ice.Current current) { return _ic; @@ -86,12 +106,12 @@ public final class InitialI extends Test._InitialDisp } private Ice.ObjectAdapter _adapter; - private Test.MA.CAPrx _ca; - private Test.MB.CBPrx _cb; - private Test.MA.CCPrx _cc; - private Test.MA.CDPrx _cd; - private Test.MA.IAPrx _ia; - private Test.MB.IB1Prx _ib1; - private Test.MB.IB2Prx _ib2; - private Test.MA.ICPrx _ic; + private CAPrx _ca; + private CBPrx _cb; + private CCPrx _cc; + private CDPrx _cd; + private IAPrx _ia; + private IB1Prx _ib1; + private IB2Prx _ib2; + private ICPrx _ic; } diff --git a/java/test/Ice/inheritance/Server.java b/java/test/Ice/inheritance/Server.java index dddf46b6296..252e9ef26fe 100644 --- a/java/test/Ice/inheritance/Server.java +++ b/java/test/Ice/inheritance/Server.java @@ -7,49 +7,33 @@ // // ********************************************************************** -public class Server +package test.Ice.inheritance; + +public class Server extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + Ice.Communicator communicator = communicator(); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object object = new InitialI(adapter); adapter.add(object, communicator.stringToIdentity("initial")); adapter.activate(); - communicator.waitForShutdown(); - return 0; + return WAIT; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.inheritance"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + return initData; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + public static void main(String[] args) + { + Server c = new Server(); + int status = c.main("Server", args); System.gc(); System.exit(status); diff --git a/java/test/Ice/inheritance/Test.ice b/java/test/Ice/inheritance/Test.ice index a93a2bfb330..723723babb0 100644 --- a/java/test/Ice/inheritance/Test.ice +++ b/java/test/Ice/inheritance/Test.ice @@ -10,6 +10,7 @@ #ifndef TESTICE #define TESTICE +[["java:package:test.Ice.inheritance"]] module Test { diff --git a/java/test/Ice/inheritance/build.xml b/java/test/Ice/inheritance/build.xml deleted file mode 100644 index a21fb17af29..00000000000 --- a/java/test/Ice/inheritance/build.xml +++ /dev/null @@ -1,48 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_inheritance" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/interceptor/AMDInterceptorI.java b/java/test/Ice/interceptor/AMDInterceptorI.java index 1a084088a0e..7cdf3e09f97 100644 --- a/java/test/Ice/interceptor/AMDInterceptorI.java +++ b/java/test/Ice/interceptor/AMDInterceptorI.java @@ -7,6 +7,10 @@ // // ********************************************************************** +package test.Ice.interceptor; + +import test.Ice.interceptor.Test.RetryException; + // // A dispatch interceptor with special handling for AMD requests // @@ -38,7 +42,7 @@ class AMDInterceptorI extends InterceptorI implements Ice.DispatchInterceptorAsy public boolean exception(java.lang.Exception ex) { - test(ex instanceof Test.RetryException); + test(ex instanceof RetryException); return false; } }; diff --git a/java/test/Ice/interceptor/Client.java b/java/test/Ice/interceptor/Client.java index c8147e586f5..8e92fc6380d 100644 --- a/java/test/Ice/interceptor/Client.java +++ b/java/test/Ice/interceptor/Client.java @@ -7,7 +7,15 @@ // // ********************************************************************** -public class Client extends Ice.Application +package test.Ice.interceptor; + +import java.io.PrintWriter; + +import test.Ice.interceptor.Test.InvalidInputException; +import test.Ice.interceptor.Test.MyObjectPrx; +import test.Ice.interceptor.Test.MyObjectPrxHelper; + +public class Client extends test.Util.Application { private static void test(boolean b) @@ -19,10 +27,11 @@ public class Client extends Ice.Application } private int - run(Test.MyObjectPrx prx, InterceptorI interceptor) + run(MyObjectPrx prx, InterceptorI interceptor) { - System.out.print("testing simple interceptor... "); - System.out.flush(); + PrintWriter out = getWriter(); + out.print("testing simple interceptor... "); + out.flush(); test(interceptor.getLastOperation() == null); test(interceptor.getLastStatus() == null); prx.ice_ping(); @@ -37,29 +46,29 @@ public class Client extends Ice.Application test(prx.add(33, 12) == 45); test(interceptor.getLastOperation().equals("add")); test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchOK)); - System.out.println("ok"); - System.out.print("testing retry... "); - System.out.flush(); + out.println("ok"); + out.print("testing retry... "); + out.flush(); test(prx.addWithRetry(33, 12) == 45); test(interceptor.getLastOperation().equals("addWithRetry")); test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchOK)); - System.out.println("ok"); - System.out.print("testing user exception... "); - System.out.flush(); + out.println("ok"); + out.print("testing user exception... "); + out.flush(); try { prx.badAdd(33, 12); test(false); } - catch(Test.InvalidInputException e) + catch(InvalidInputException e) { // expected } test(interceptor.getLastOperation().equals("badAdd")); test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchUserException)); - System.out.println("ok"); - System.out.print("testing ONE... "); - System.out.flush(); + out.println("ok"); + out.print("testing ONE... "); + out.flush(); interceptor.clear(); try { @@ -72,9 +81,9 @@ public class Client extends Ice.Application } test(interceptor.getLastOperation().equals("notExistAdd")); test(interceptor.getLastStatus() == null); - System.out.println("ok"); - System.out.print("testing system exception... "); - System.out.flush(); + out.println("ok"); + out.print("testing system exception... "); + out.flush(); interceptor.clear(); try { @@ -90,55 +99,55 @@ public class Client extends Ice.Application } test(interceptor.getLastOperation().equals("badSystemAdd")); test(interceptor.getLastStatus() == null); - System.out.println("ok"); + out.println("ok"); if(!prx.ice_isCollocationOptimized()) { - System.out.print("testing simple AMD... "); - System.out.flush(); + out.print("testing simple AMD... "); + out.flush(); test(prx.amdAdd(33, 12) == 45); test(interceptor.getLastOperation().equals("amdAdd")); test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchAsync)); - System.out.println("ok"); + out.println("ok"); } return 0; } private int - runAmd(Test.MyObjectPrx prx, AMDInterceptorI interceptor) + runAmd(MyObjectPrx prx, AMDInterceptorI interceptor, PrintWriter out) { - System.out.print("testing simple interceptor... "); - System.out.flush(); + out.print("testing simple interceptor... "); + out.flush(); test(interceptor.getLastOperation() == null); test(interceptor.getLastStatus() == null); test(prx.amdAdd(33, 12) == 45); test(interceptor.getLastOperation().equals("amdAdd")); test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchAsync)); test(interceptor.getActualStatus().equals(Ice.DispatchStatus.DispatchOK)); - System.out.println("ok"); - System.out.print("testing retry... "); - System.out.flush(); + out.println("ok"); + out.print("testing retry... "); + out.flush(); test(prx.amdAddWithRetry(33, 12) == 45); test(interceptor.getLastOperation().equals("amdAddWithRetry")); test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchAsync)); test(interceptor.getActualStatus().equals(Ice.DispatchStatus.DispatchOK)); - System.out.println("ok"); - System.out.print("testing user exception... "); - System.out.flush(); + out.println("ok"); + out.print("testing user exception... "); + out.flush(); try { prx.amdBadAdd(33, 12); test(false); } - catch(Test.InvalidInputException e) + catch(InvalidInputException e) { // expected } test(interceptor.getLastOperation().equals("amdBadAdd")); test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchAsync)); test(interceptor.getActualStatus().equals(Ice.DispatchStatus.DispatchUserException)); - System.out.println("ok"); - System.out.print("testing ONE... "); - System.out.flush(); + out.println("ok"); + out.print("testing ONE... "); + out.flush(); interceptor.clear(); try { @@ -153,9 +162,9 @@ public class Client extends Ice.Application test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchAsync)); test(interceptor.getActualStatus() == null); test(interceptor.getException() instanceof Ice.ObjectNotExistException); - System.out.println("ok"); - System.out.print("testing system exception... "); - System.out.flush(); + out.println("ok"); + out.print("testing system exception... "); + out.flush(); interceptor.clear(); try { @@ -170,19 +179,16 @@ public class Client extends Ice.Application test(interceptor.getLastStatus().equals(Ice.DispatchStatus.DispatchAsync)); test(interceptor.getActualStatus() == null); test(interceptor.getException() instanceof Ice.InitializationException); - System.out.println("ok"); + out.println("ok"); return 0; } - - public int run(String[] args) { // // Create OA and servants // - communicator().getProperties().setProperty("MyOA.AdapterId", "myOA"); Ice.ObjectAdapter oa = communicator().createObjectAdapterWithEndpoints("MyOA2", "tcp -h localhost"); @@ -190,38 +196,47 @@ public class Client extends Ice.Application Ice.Object servant = new MyObjectI(); InterceptorI interceptor = new InterceptorI(servant); - Test.MyObjectPrx prx = Test.MyObjectPrxHelper.uncheckedCast(oa.addWithUUID(interceptor)); + MyObjectPrx prx = MyObjectPrxHelper.uncheckedCast(oa.addWithUUID(interceptor)); oa.activate(); - System.out.println("Collocation optimization on"); + PrintWriter out = getWriter(); + out.println("Collocation optimization on"); int rs = run(prx, interceptor); if(rs == 0) { - System.out.println("Collocation optimization off"); + out.println("Collocation optimization off"); interceptor.clear(); - prx = Test.MyObjectPrxHelper.uncheckedCast(prx.ice_collocationOptimized(false)); + prx = MyObjectPrxHelper.uncheckedCast(prx.ice_collocationOptimized(false)); rs = run(prx, interceptor); if(rs == 0) { - System.out.println("Now with AMD"); + out.println("Now with AMD"); AMDInterceptorI amdInterceptor = new AMDInterceptorI(servant); - prx = Test.MyObjectPrxHelper.uncheckedCast(oa.addWithUUID(amdInterceptor)); - prx = Test.MyObjectPrxHelper.uncheckedCast(prx.ice_collocationOptimized(false)); + prx = MyObjectPrxHelper.uncheckedCast(oa.addWithUUID(amdInterceptor)); + prx = MyObjectPrxHelper.uncheckedCast(prx.ice_collocationOptimized(false)); - rs = runAmd(prx, amdInterceptor); + rs = runAmd(prx, amdInterceptor, out); } } return rs; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.interceptor"); + return initData; + } + + public static void main(String[] args) { Client app = new Client(); int status = app.main("Interceptor", args); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/interceptor/InterceptorI.java b/java/test/Ice/interceptor/InterceptorI.java index 4485c176f41..da337a5af21 100644 --- a/java/test/Ice/interceptor/InterceptorI.java +++ b/java/test/Ice/interceptor/InterceptorI.java @@ -7,6 +7,10 @@ // // ********************************************************************** +package test.Ice.interceptor; + +import test.Ice.interceptor.Test.RetryException; + class InterceptorI extends Ice.DispatchInterceptor { InterceptorI(Ice.Object servant) @@ -39,7 +43,7 @@ class InterceptorI extends Ice.DispatchInterceptor _servant.ice_dispatch(request, null); test(false); } - catch(Test.RetryException re) + catch(RetryException re) { // // Expected, retry diff --git a/java/test/Ice/interceptor/MyObjectI.java b/java/test/Ice/interceptor/MyObjectI.java index 5423e0837fd..9d90288cf6e 100644 --- a/java/test/Ice/interceptor/MyObjectI.java +++ b/java/test/Ice/interceptor/MyObjectI.java @@ -7,7 +7,18 @@ // // ********************************************************************** -class MyObjectI extends Test._MyObjectDisp +package test.Ice.interceptor; + +import test.Ice.interceptor.Test.AMD_MyObject_amdAdd; +import test.Ice.interceptor.Test.AMD_MyObject_amdAddWithRetry; +import test.Ice.interceptor.Test.AMD_MyObject_amdBadAdd; +import test.Ice.interceptor.Test.AMD_MyObject_amdBadSystemAdd; +import test.Ice.interceptor.Test.AMD_MyObject_amdNotExistAdd; +import test.Ice.interceptor.Test.InvalidInputException; +import test.Ice.interceptor.Test.RetryException; +import test.Ice.interceptor.Test._MyObjectDisp; + +class MyObjectI extends _MyObjectDisp { public int @@ -23,15 +34,15 @@ class MyObjectI extends Test._MyObjectDisp if(val == null || !val.equals("no")) { - throw new Test.RetryException(); + throw new RetryException(); } return x + y; } public int - badAdd(int x, int y, Ice.Current current) throws Test.InvalidInputException + badAdd(int x, int y, Ice.Current current) throws InvalidInputException { - throw new Test.InvalidInputException(); + throw new InvalidInputException(); } public int @@ -52,7 +63,7 @@ class MyObjectI extends Test._MyObjectDisp // public void - amdAdd_async(final Test.AMD_MyObject_amdAdd cb, final int x, final int y, Ice.Current current) + amdAdd_async(final AMD_MyObject_amdAdd cb, final int x, final int y, Ice.Current current) { Thread thread = new Thread() { @@ -75,7 +86,7 @@ class MyObjectI extends Test._MyObjectDisp } public void - amdAddWithRetry_async(final Test.AMD_MyObject_amdAddWithRetry cb, final int x, final int y, Ice.Current current) + amdAddWithRetry_async(final AMD_MyObject_amdAddWithRetry cb, final int x, final int y, Ice.Current current) { Thread thread = new Thread() { @@ -100,12 +111,12 @@ class MyObjectI extends Test._MyObjectDisp if(val == null || !val.equals("no")) { - throw new Test.RetryException(); + throw new RetryException(); } } public void - amdBadAdd_async(final Test.AMD_MyObject_amdBadAdd cb, int x, int y, Ice.Current current) + amdBadAdd_async(final AMD_MyObject_amdBadAdd cb, int x, int y, Ice.Current current) { Thread thread = new Thread() { @@ -119,7 +130,7 @@ class MyObjectI extends Test._MyObjectDisp catch(InterruptedException e) { } - cb.ice_exception(new Test.InvalidInputException()); + cb.ice_exception(new InvalidInputException()); } }; @@ -128,7 +139,7 @@ class MyObjectI extends Test._MyObjectDisp } public void - amdNotExistAdd_async(final Test.AMD_MyObject_amdNotExistAdd cb, int x, int y, Ice.Current current) + amdNotExistAdd_async(final AMD_MyObject_amdNotExistAdd cb, int x, int y, Ice.Current current) { Thread thread = new Thread() { @@ -151,7 +162,7 @@ class MyObjectI extends Test._MyObjectDisp } public void - amdBadSystemAdd_async(final Test.AMD_MyObject_amdBadSystemAdd cb, int x, int y, Ice.Current current) + amdBadSystemAdd_async(final AMD_MyObject_amdBadSystemAdd cb, int x, int y, Ice.Current current) { Thread thread = new Thread() { diff --git a/java/test/Ice/interceptor/Test.ice b/java/test/Ice/interceptor/Test.ice index 6d6873a9df4..903f51a64c1 100644 --- a/java/test/Ice/interceptor/Test.ice +++ b/java/test/Ice/interceptor/Test.ice @@ -10,6 +10,7 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Ice.interceptor"]] module Test { diff --git a/java/test/Ice/interceptor/build.xml b/java/test/Ice/interceptor/build.xml deleted file mode 100644 index a59357586d0..00000000000 --- a/java/test/Ice/interceptor/build.xml +++ /dev/null @@ -1,51 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_interceptor" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - <includepath> - <pathelement path="${slice.dir}" /> - </includepath> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/interceptor/run.py b/java/test/Ice/interceptor/run.py index e47acfdef1e..d91769dbe44 100755 --- a/java/test/Ice/interceptor/run.py +++ b/java/test/Ice/interceptor/run.py @@ -20,10 +20,8 @@ if len(path) == 0: sys.path.append(os.path.join(path[0])) from scripts import * -TestUtil.addClasspath(os.path.join(os.getcwd(), "classes")) - print "starting client...", -clientProc = TestUtil.startClient("Client", "--Ice.Warn.Dispatch=0", startReader = False) +clientProc = TestUtil.startClient("test.Ice.interceptor.Client", "--Ice.Warn.Dispatch=0",startReader=False) print "ok" clientProc.startReader() diff --git a/java/test/Ice/location/AllTests.java b/java/test/Ice/location/AllTests.java index 74082fe0a85..17c32a8a598 100644 --- a/java/test/Ice/location/AllTests.java +++ b/java/test/Ice/location/AllTests.java @@ -7,7 +7,21 @@ // // ********************************************************************** -import Test.*; +package test.Ice.location; + +import java.io.PrintWriter; + +import test.Ice.location.Test.AMI_Hello_sayHello; +import test.Ice.location.Test.HelloPrx; +import test.Ice.location.Test.HelloPrxHelper; +import test.Ice.location.Test.ServerManagerPrx; +import test.Ice.location.Test.ServerManagerPrxHelper; +import test.Ice.location.Test.TestIntfPrx; +import test.Ice.location.Test.TestIntfPrxHelper; +import test.Ice.location.Test.TestLocatorPrx; +import test.Ice.location.Test.TestLocatorPrxHelper; +import test.Ice.location.Test.TestLocatorRegistryPrx; +import test.Ice.location.Test.TestLocatorRegistryPrxHelper; public class AllTests { @@ -21,7 +35,7 @@ public class AllTests } public static void - allTests(Ice.Communicator communicator) + allTests(Ice.Communicator communicator, PrintWriter out) { ServerManagerPrx manager = ServerManagerPrxHelper.checkedCast( communicator.stringToProxy("ServerManager :default -t 10000 -p 12010")); @@ -32,18 +46,18 @@ public class AllTests TestLocatorRegistryPrx registry = TestLocatorRegistryPrxHelper.checkedCast(locator.getRegistry()); test(registry != null); + out.print("testing stringToProxy... "); + out.flush(); - System.out.print("testing stringToProxy... "); - System.out.flush(); Ice.ObjectPrx base = communicator.stringToProxy("test @ TestAdapter"); Ice.ObjectPrx base2 = communicator.stringToProxy("test @ TestAdapter"); Ice.ObjectPrx base3 = communicator.stringToProxy("test"); Ice.ObjectPrx base4 = communicator.stringToProxy("ServerManager"); Ice.ObjectPrx base5 = communicator.stringToProxy("test2"); Ice.ObjectPrx base6 = communicator.stringToProxy("test @ ReplicatedAdapter"); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing ice_locator and ice_getLocator... "); + out.print("testing ice_locator and ice_getLocator... "); test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), communicator.getDefaultLocator()) == 0); Ice.LocatorPrx anotherLocator = Ice.LocatorPrxHelper.uncheckedCast(communicator.stringToProxy("anotherLocator")); @@ -73,20 +87,20 @@ public class AllTests communicator.setDefaultRouter(null); base = communicator.stringToProxy("test @ TestAdapter"); test(base.ice_getRouter() == null); - System.out.println("ok"); + out.println("ok"); // // Start a server, get the port of the adapter it's listening on, // and add it to the configuration so that the client can locate // the TestAdapter adapter. // - System.out.print("starting server... "); - System.out.flush(); + out.print("starting server... "); + out.flush(); manager.startServer(); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing checked cast... "); - System.out.flush(); + out.print("testing checked cast... "); + out.flush(); TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base); test(obj != null); TestIntfPrx obj2 = TestIntfPrxHelper.checkedCast(base2); @@ -99,10 +113,10 @@ public class AllTests test(obj5 != null); TestIntfPrx obj6 = TestIntfPrxHelper.checkedCast(base6); test(obj6 != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing id@AdapterId indirect proxy... "); - System.out.flush(); + out.print("testing id@AdapterId indirect proxy... "); + out.flush(); obj.shutdown(); manager.startServer(); try @@ -114,10 +128,10 @@ public class AllTests ex.printStackTrace(); test(false); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing id@ReplicaGroupId indirect proxy... "); - System.out.flush(); + out.print("testing id@ReplicaGroupId indirect proxy... "); + out.flush(); obj.shutdown(); manager.startServer(); try @@ -130,10 +144,10 @@ public class AllTests ex.printStackTrace(); test(false); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing identity indirect proxy... "); - System.out.flush(); + out.print("testing identity indirect proxy... "); + out.flush(); obj.shutdown(); manager.startServer(); try @@ -215,10 +229,10 @@ public class AllTests test(false); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing proxy with unknown identity... "); - System.out.flush(); + out.print("testing proxy with unknown identity... "); + out.flush(); try { base = communicator.stringToProxy("unknown/unknown"); @@ -230,10 +244,10 @@ public class AllTests test(ex.kindOfObject.equals("object")); test(ex.id.equals("unknown/unknown")); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing proxy with unknown adapter... "); - System.out.flush(); + out.print("testing proxy with unknown adapter... "); + out.flush(); try { base = communicator.stringToProxy("test @ TestAdapterUnknown"); @@ -245,10 +259,10 @@ public class AllTests test(ex.kindOfObject.equals("object adapter")); test(ex.id.equals("TestAdapterUnknown")); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing locator cache timeout... "); - System.out.flush(); + out.print("testing locator cache timeout... "); + out.flush(); int count = locator.getRequestCount(); communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. @@ -294,27 +308,27 @@ public class AllTests test(communicator.stringToProxy("test").ice_locatorCacheTimeout(99).ice_getLocatorCacheTimeout() == 99); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing proxy from server... "); - System.out.flush(); + out.print("testing proxy from server... "); + out.flush(); obj = TestIntfPrxHelper.checkedCast(communicator.stringToProxy("test@TestAdapter")); HelloPrx hello = obj.getHello(); test(hello.ice_getAdapterId().equals("TestAdapter")); hello = obj.getReplicatedHello(); test(hello.ice_getAdapterId().equals("ReplicatedAdapter")); hello.sayHello(); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing locator request queuing... "); - System.out.flush(); + out.print("testing locator request queuing... "); + out.flush(); hello = (HelloPrx)obj.getReplicatedHello().ice_locatorCacheTimeout(0).ice_connectionCached(false); count = locator.getRequestCount(); hello.ice_ping(); test(++count == locator.getRequestCount()); for(int i = 0; i < 1000; i++) { - class AMICallback extends Test.AMI_Hello_sayHello + class AMICallback extends AMI_Hello_sayHello { public void ice_exception(Ice.LocalException ex) @@ -334,13 +348,13 @@ public class AllTests test(locator.getRequestCount() > count && locator.getRequestCount() < count + 999); if(locator.getRequestCount() > count + 800) { - System.out.print("queuing = " + (locator.getRequestCount() - count)); + out.print("queuing = " + (locator.getRequestCount() - count)); } count = locator.getRequestCount(); hello = (HelloPrx)hello.ice_adapterId("unknown"); for(int i = 0; i < 1000; i++) { - class AMICallback extends Test.AMI_Hello_sayHello + class AMICallback extends AMI_Hello_sayHello { public void ice_exception(Ice.LocalException ex) @@ -368,12 +382,12 @@ public class AllTests test(locator.getRequestCount() > count && locator.getRequestCount() < count + 1999); if(locator.getRequestCount() > count + 800) { - System.out.print("queuing = " + (locator.getRequestCount() - count)); + out.print("queuing = " + (locator.getRequestCount() - count)); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing adapter locator cache... "); - System.out.flush(); + out.print("testing adapter locator cache... "); + out.flush(); try { communicator.stringToProxy("test@TestAdapter3").ice_ping(); @@ -450,10 +464,10 @@ public class AllTests ex.printStackTrace(); test(false); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing well-known object locator cache... "); - System.out.flush(); + out.print("testing well-known object locator cache... "); + out.flush(); registry.addObject(communicator.stringToProxy("test3@TestUnknown")); try { @@ -568,10 +582,10 @@ public class AllTests catch(Ice.NoEndpointException ex) { } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing locator cache background updates... "); - System.out.flush(); + out.print("testing locator cache background updates... "); + out.flush(); { Ice.InitializationData initData = new Ice.InitializationData(); initData.properties = communicator.getProperties()._clone(); @@ -660,18 +674,18 @@ public class AllTests } ic.destroy(); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing proxy from server after shutdown... "); - System.out.flush(); + out.print("testing proxy from server after shutdown... "); + out.flush(); hello = obj.getReplicatedHello(); obj.shutdown(); manager.startServer(); hello.sayHello(); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing object migration..."); - System.out.flush(); + out.print("testing object migration..."); + out.flush(); hello = HelloPrxHelper.checkedCast(communicator.stringToProxy("hello")); obj.migrateHello(); hello.sayHello(); @@ -679,10 +693,10 @@ public class AllTests hello.sayHello(); obj.migrateHello(); hello.sayHello(); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing whether server is gone... "); - System.out.flush(); + out.print("testing whether server is gone... "); + out.flush(); obj.shutdown(); try { @@ -691,10 +705,10 @@ public class AllTests } catch(Ice.LocalException ex) { - System.out.println("ok"); + out.println("ok"); } - System.out.print("testing indirect proxies to collocated objects... "); + out.print("testing indirect proxies to collocated objects... "); Ice.Properties properties = communicator.getProperties(); properties.setProperty("Ice.PrintAdapterReady", "0"); Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithEndpoints("Hello", "default"); @@ -714,13 +728,13 @@ public class AllTests } catch(Ice.CollocationOptimizationException ex) { - System.out.println("ok"); + out.println("ok"); } - adapter.deactivate(); + adapter.destroy(); - System.out.print("shutdown server manager... "); - System.out.flush(); + out.print("shutdown server manager... "); + out.flush(); manager.shutdown(); - System.out.println("ok"); + out.println("ok"); } } diff --git a/java/test/Ice/location/Client.java b/java/test/Ice/location/Client.java index 48bfac8df5a..8f32d31cbd1 100644 --- a/java/test/Ice/location/Client.java +++ b/java/test/Ice/location/Client.java @@ -7,49 +7,31 @@ // // ********************************************************************** -public class Client +package test.Ice.location; + +public class Client extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { - AllTests.allTests(communicator); + Ice.Communicator communicator = communicator(); + AllTests.allTests(communicator, getWriter()); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(args); - initData.properties.setProperty("Ice.Default.Locator", "locator:default -p 12010"); - communicator = Ice.Util.initialize(args, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch (Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.location"); + initData.properties.setProperty("Ice.Default.Locator", "locator:default -p 12010"); + return initData; + } + public static void main(String[] args) + { + Client app = new Client(); + int result = app.main("Client", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/location/HelloI.java b/java/test/Ice/location/HelloI.java index e0609bee468..7d26ded3418 100644 --- a/java/test/Ice/location/HelloI.java +++ b/java/test/Ice/location/HelloI.java @@ -7,7 +7,10 @@ // // ********************************************************************** -import Test.*; +package test.Ice.location; + +import test.Ice.location.Test._HelloDisp; + public class HelloI extends _HelloDisp { diff --git a/java/test/Ice/location/Server.java b/java/test/Ice/location/Server.java index 125bb514487..ee857be383b 100644 --- a/java/test/Ice/location/Server.java +++ b/java/test/Ice/location/Server.java @@ -7,21 +7,21 @@ // // ********************************************************************** -public class Server +package test.Ice.location; + +public class Server extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator, Ice.InitializationData initData) + private Ice.InitializationData _initData; + + public int run(String[] args) { + Ice.Communicator communicator = communicator(); + // // Register the server manager. The server manager creates a new // 'server' (a server isn't a different process, it's just a new // communicator and object adapter). // - Ice.Properties properties = communicator.getProperties(); - properties.setProperty("Ice.ThreadPool.Server.Size", "2"); - properties.setProperty("Ice.ThreadPool.Server.SizeWarn", "0"); - properties.setProperty("ServerManagerAdapter.Endpoints", "default -p 12010 -t 30000:udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ServerManagerAdapter"); // @@ -31,55 +31,38 @@ public class Server // ServerLocatorRegistry registry = new ServerLocatorRegistry(); registry.addObject(adapter.createProxy(communicator.stringToIdentity("ServerManager"))); - Ice.Object object = new ServerManagerI(adapter, registry, initData); + Ice.Object object = new ServerManagerI(adapter, registry, _initData, this); adapter.add(object, communicator.stringToIdentity("ServerManager")); - Ice.LocatorRegistryPrx registryPrx = - Ice.LocatorRegistryPrxHelper.uncheckedCast(adapter.add(registry, communicator.stringToIdentity("registry"))); - + Ice.LocatorRegistryPrx registryPrx = Ice.LocatorRegistryPrxHelper.uncheckedCast(adapter.add(registry, + communicator.stringToIdentity("registry"))); + ServerLocator locator = new ServerLocator(registry, registryPrx); adapter.add(locator, communicator.stringToIdentity("locator")); - + adapter.activate(); - communicator.waitForShutdown(); - - return 0; + + return WAIT; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.location"); + initData.properties.setProperty("Ice.ThreadPool.Server.Size", "2"); + initData.properties.setProperty("Ice.ThreadPool.Server.SizeWarn", "0"); + initData.properties.setProperty("ServerManagerAdapter.Endpoints", "default -p 12010 -t 30000:udp"); - try - { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); - communicator = Ice.Util.initialize(argsH, initData); - status = run(argsH.value, communicator, initData); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + _initData = initData; + return initData; + } + public static void main(String[] args) + { + Server app = new Server(); + int result = app.main("Server", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/location/ServerLocator.java b/java/test/Ice/location/ServerLocator.java index edea41c35f6..d64b8039b5b 100644 --- a/java/test/Ice/location/ServerLocator.java +++ b/java/test/Ice/location/ServerLocator.java @@ -7,7 +7,11 @@ // // ********************************************************************** -public class ServerLocator extends Test._TestLocatorDisp +package test.Ice.location; + +import test.Ice.location.Test._TestLocatorDisp; + +public class ServerLocator extends _TestLocatorDisp { public ServerLocator(ServerLocatorRegistry registry, Ice.LocatorRegistryPrx registryPrx) diff --git a/java/test/Ice/location/ServerLocatorRegistry.java b/java/test/Ice/location/ServerLocatorRegistry.java index 7430c319a76..3afa789d075 100644 --- a/java/test/Ice/location/ServerLocatorRegistry.java +++ b/java/test/Ice/location/ServerLocatorRegistry.java @@ -7,7 +7,11 @@ // // ********************************************************************** -public class ServerLocatorRegistry extends Test._TestLocatorRegistryDisp +package test.Ice.location; + +import test.Ice.location.Test._TestLocatorRegistryDisp; + +public class ServerLocatorRegistry extends _TestLocatorRegistryDisp { public void setAdapterDirectProxy_async(Ice.AMD_LocatorRegistry_setAdapterDirectProxy cb, String adapter, diff --git a/java/test/Ice/location/ServerManagerI.java b/java/test/Ice/location/ServerManagerI.java index f1936dfe3be..df5075fcf4a 100644 --- a/java/test/Ice/location/ServerManagerI.java +++ b/java/test/Ice/location/ServerManagerI.java @@ -8,15 +8,20 @@ // // ********************************************************************** -import Test.*; +package test.Ice.location; + +import test.Ice.location.Test._ServerManagerDisp; + public class ServerManagerI extends _ServerManagerDisp { - ServerManagerI(Ice.ObjectAdapter adapter, ServerLocatorRegistry registry, Ice.InitializationData initData) + ServerManagerI(Ice.ObjectAdapter adapter, ServerLocatorRegistry registry, Ice.InitializationData initData, test.Util.Application app) { _adapter = adapter; _registry = registry; _communicators = new java.util.ArrayList<Ice.Communicator>(); + + _app = app; _initData = initData; _initData.properties.setProperty("TestAdapter.AdapterId", "TestAdapter"); @@ -44,7 +49,7 @@ public class ServerManagerI extends _ServerManagerDisp // its endpoints with the locator and create references containing // the adapter id instead of the endpoints. // - Ice.Communicator serverCommunicator = Ice.Util.initialize(_initData); + Ice.Communicator serverCommunicator = _app.initialize(_initData); _communicators.add(serverCommunicator); // @@ -85,5 +90,6 @@ public class ServerManagerI extends _ServerManagerDisp private ServerLocatorRegistry _registry; private java.util.List<Ice.Communicator> _communicators; private Ice.InitializationData _initData; + private test.Util.Application _app; private int _nextPort = 12011; } diff --git a/java/test/Ice/location/Test.ice b/java/test/Ice/location/Test.ice index 4291d0a7f81..2f62c659214 100644 --- a/java/test/Ice/location/Test.ice +++ b/java/test/Ice/location/Test.ice @@ -12,6 +12,7 @@ #include <Ice/Locator.ice> +[["java:package:test.Ice.location"]] module Test { diff --git a/java/test/Ice/location/TestI.java b/java/test/Ice/location/TestI.java index 7b3580627d3..71f10b84ca8 100644 --- a/java/test/Ice/location/TestI.java +++ b/java/test/Ice/location/TestI.java @@ -7,7 +7,12 @@ // // ********************************************************************** -import Test.*; +package test.Ice.location; + +import test.Ice.location.Test.HelloPrx; +import test.Ice.location.Test.HelloPrxHelper; +import test.Ice.location.Test._TestIntfDisp; + public class TestI extends _TestIntfDisp { diff --git a/java/test/Ice/location/build.xml b/java/test/Ice/location/build.xml deleted file mode 100644 index c69bd3da1ec..00000000000 --- a/java/test/Ice/location/build.xml +++ /dev/null @@ -1,51 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_location" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <includepath> - <pathelement path="${slice.dir}"/> - </includepath> - <fileset dir="." includes="Test.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/objects/AllTests.java b/java/test/Ice/objects/AllTests.java index 57adfb6358a..c67efa5f7a0 100644 --- a/java/test/Ice/objects/AllTests.java +++ b/java/test/Ice/objects/AllTests.java @@ -7,7 +7,25 @@ // // ********************************************************************** -import Test.*; +package test.Ice.objects; + +import java.io.PrintWriter; + +import test.Ice.objects.Test.B; +import test.Ice.objects.Test.BHolder; +import test.Ice.objects.Test.C; +import test.Ice.objects.Test.CHolder; +import test.Ice.objects.Test.D; +import test.Ice.objects.Test.DHolder; +import test.Ice.objects.Test.E; +import test.Ice.objects.Test.F; +import test.Ice.objects.Test.H; +import test.Ice.objects.Test.I; +import test.Ice.objects.Test.InitialPrx; +import test.Ice.objects.Test.InitialPrxHelper; +import test.Ice.objects.Test.J; +import test.Ice.objects.Test.UnexpectedObjectExceptionTestPrx; +import test.Ice.objects.Test.UnexpectedObjectExceptionTestPrxHelper; public class AllTests { @@ -21,48 +39,48 @@ public class AllTests } public static InitialPrx - allTests(Ice.Communicator communicator, boolean collocated) + allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out) { - System.out.print("testing stringToProxy... "); - System.out.flush(); + out.print("testing stringToProxy... "); + out.flush(); String ref = "initial:default -p 12010 -t 10000"; Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing checked cast... "); - System.out.flush(); + out.print("testing checked cast... "); + out.flush(); InitialPrx initial = InitialPrxHelper.checkedCast(base); test(initial != null); test(initial.equals(base)); - System.out.println("ok"); + out.println("ok"); - System.out.print("getting B1... "); - System.out.flush(); + out.print("getting B1... "); + out.flush(); B b1 = initial.getB1(); test(b1 != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("getting B2... "); - System.out.flush(); + out.print("getting B2... "); + out.flush(); B b2 = initial.getB2(); test(b2 != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("getting C... "); - System.out.flush(); + out.print("getting C... "); + out.flush(); C c = initial.getC(); test(c != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("getting D... "); - System.out.flush(); + out.print("getting D... "); + out.flush(); D d = initial.getD(); test(d != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("checking consistency... "); - System.out.flush(); + out.print("checking consistency... "); + out.flush(); test(b1 != b2); //test(b1 != c); //test(b1 != d); @@ -89,10 +107,10 @@ public class AllTests // sufficient. test(b2.theA == b2); test(d.theC == null); - System.out.println("ok"); + out.println("ok"); - System.out.print("getting B1, B2, C, and D all at once... "); - System.out.flush(); + out.print("getting B1, B2, C, and D all at once... "); + out.flush(); BHolder b1H = new BHolder(); BHolder b2H = new BHolder(); CHolder cH = new CHolder(); @@ -106,10 +124,10 @@ public class AllTests test(b2 != null); test(c != null); test(d != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("checking consistency... "); - System.out.flush(); + out.print("checking consistency... "); + out.flush(); test(b1 != b2); //test(b1 != c); //test(b1 != d); @@ -137,10 +155,10 @@ public class AllTests test(d.theB.theC.preMarshalInvoked); test(d.theB.theC.postUnmarshalInvoked(null)); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing protected members... "); - System.out.flush(); + out.print("testing protected members... "); + out.flush(); E e = initial.getE(); test(e.checkValues()); try @@ -164,29 +182,29 @@ public class AllTests { test(false); } - System.out.println("ok"); + out.println("ok"); - System.out.print("getting I, J and H... "); - System.out.flush(); + out.print("getting I, J and H... "); + out.flush(); I i = initial.getI(); test(i != null); I j = initial.getJ(); test(j != null && ((J)j) != null); I h = initial.getH(); test(h != null && ((H)h) != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("setting I... "); - System.out.flush(); + out.print("setting I... "); + out.flush(); initial.setI(i); initial.setI(j); initial.setI(h); - System.out.println("ok"); + out.println("ok"); if(!collocated) { - System.out.print("testing UnexpectedObjectException..."); - System.out.flush(); + out.print("testing UnexpectedObjectException..."); + out.flush(); ref = "uoet:default -p 12010 -t 10000"; base = communicator.stringToProxy(ref); test(base != null); @@ -204,10 +222,10 @@ public class AllTests } catch(java.lang.Exception ex) { - System.out.println(ex); + out.println(ex); test(false); } - System.out.println("ok"); + out.println("ok"); } return initial; diff --git a/java/test/Ice/objects/BI.java b/java/test/Ice/objects/BI.java index b436cb27022..573985f6204 100644 --- a/java/test/Ice/objects/BI.java +++ b/java/test/Ice/objects/BI.java @@ -7,7 +7,9 @@ // // ********************************************************************** -import Test.*; +package test.Ice.objects; + +import test.Ice.objects.Test.B; public final class BI extends B { diff --git a/java/test/Ice/objects/CI.java b/java/test/Ice/objects/CI.java index f97aed7a5d6..0b2051a6fd1 100644 --- a/java/test/Ice/objects/CI.java +++ b/java/test/Ice/objects/CI.java @@ -7,7 +7,10 @@ // // ********************************************************************** -import Test.*; +package test.Ice.objects; + +import test.Ice.objects.Test.C; + public final class CI extends C { diff --git a/java/test/Ice/objects/Client.java b/java/test/Ice/objects/Client.java index 3c7bc1cd9f8..dc5898a57cf 100644 --- a/java/test/Ice/objects/Client.java +++ b/java/test/Ice/objects/Client.java @@ -7,14 +7,15 @@ // // ********************************************************************** -import Test.*; +package test.Ice.objects; -public class Client +import test.Ice.objects.Test.InitialPrx; + +public class Client extends test.Util.Application { private static class MyObjectFactory implements Ice.ObjectFactory { - public Ice.Object - create(String type) + public Ice.Object create(String type) { if(type.equals("::Test::B")) { @@ -49,20 +50,19 @@ public class Client return new HI(); } - assert(false); // Should never be reached + assert (false); // Should never be reached return null; } - public void - destroy() + public void destroy() { // Nothing to do } } - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { + Ice.Communicator communicator = communicator(); Ice.ObjectFactory factory = new MyObjectFactory(); communicator.addObjectFactory(factory, "::Test::B"); communicator.addObjectFactory(factory, "::Test::C"); @@ -73,42 +73,24 @@ public class Client communicator.addObjectFactory(factory, "::Test::J"); communicator.addObjectFactory(factory, "::Test::H"); - InitialPrx initial = AllTests.allTests(communicator, false); + InitialPrx initial = AllTests.allTests(communicator, false, getWriter()); initial.shutdown(); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects"); + return initData; + } + public static void main(String[] args) + { + Client app = new Client(); + int result = app.main("Client", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/objects/Collocated.java b/java/test/Ice/objects/Collocated.java index 2a9180c20b8..15725ec1cb5 100644 --- a/java/test/Ice/objects/Collocated.java +++ b/java/test/Ice/objects/Collocated.java @@ -7,53 +7,39 @@ // // ********************************************************************** -import Test.*; +package test.Ice.objects; -public class Collocated +import test.Ice.objects.Test.Initial; + +public class Collocated extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { + Ice.Communicator communicator = communicator(); communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Initial initial = new InitialI(adapter); adapter.add(initial, communicator.stringToIdentity("initial")); - AllTests.allTests(communicator, true); - // We must call shutdown even in the collocated case for cyclic dependency cleanup + AllTests.allTests(communicator, true, getWriter()); + // We must call shutdown even in the collocated case for cyclic + // dependency cleanup initial.shutdown(); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects"); + return initData; + } - System.exit(status); + public static void main(String[] args) + { + Collocated app = new Collocated(); + int result = app.main("Collocated", args); + System.gc(); + System.exit(result); } } diff --git a/java/test/Ice/objects/DI.java b/java/test/Ice/objects/DI.java index 0baa4a1cb41..30fca95a40f 100644 --- a/java/test/Ice/objects/DI.java +++ b/java/test/Ice/objects/DI.java @@ -7,7 +7,10 @@ // // ********************************************************************** -import Test.*; +package test.Ice.objects; + +import test.Ice.objects.Test.D; + public final class DI extends D { diff --git a/java/test/Ice/objects/EI.java b/java/test/Ice/objects/EI.java index 909db53275b..453f44cde4c 100644 --- a/java/test/Ice/objects/EI.java +++ b/java/test/Ice/objects/EI.java @@ -7,7 +7,10 @@ // // ********************************************************************** -import Test.*; +package test.Ice.objects; + +import test.Ice.objects.Test.E; + public final class EI extends E { diff --git a/java/test/Ice/objects/FI.java b/java/test/Ice/objects/FI.java index 9e9a8cd8ecc..8f324e660db 100644 --- a/java/test/Ice/objects/FI.java +++ b/java/test/Ice/objects/FI.java @@ -7,7 +7,11 @@ // // ********************************************************************** -import Test.*; +package test.Ice.objects; + +import test.Ice.objects.Test.E; +import test.Ice.objects.Test.F; + public final class FI extends F { diff --git a/java/test/Ice/objects/HI.java b/java/test/Ice/objects/HI.java index 489245ba105..af878850775 100644 --- a/java/test/Ice/objects/HI.java +++ b/java/test/Ice/objects/HI.java @@ -7,7 +7,10 @@ // // ********************************************************************** -import Test.*; +package test.Ice.objects; + +import test.Ice.objects.Test.H; + public final class HI extends H { diff --git a/java/test/Ice/objects/II.java b/java/test/Ice/objects/II.java index c1f51a857a7..62de5e96e77 100644 --- a/java/test/Ice/objects/II.java +++ b/java/test/Ice/objects/II.java @@ -7,7 +7,9 @@ // // ********************************************************************** -import Test.*; +package test.Ice.objects; + +import test.Ice.objects.Test._IDisp; public final class II extends _IDisp { diff --git a/java/test/Ice/objects/InitialI.java b/java/test/Ice/objects/InitialI.java index 212eaa8ba12..8bb93b0587c 100644 --- a/java/test/Ice/objects/InitialI.java +++ b/java/test/Ice/objects/InitialI.java @@ -7,7 +7,19 @@ // // ********************************************************************** -import Test.*; +package test.Ice.objects; + +import test.Ice.objects.Test.B; +import test.Ice.objects.Test.BHolder; +import test.Ice.objects.Test.C; +import test.Ice.objects.Test.CHolder; +import test.Ice.objects.Test.D; +import test.Ice.objects.Test.DHolder; +import test.Ice.objects.Test.E; +import test.Ice.objects.Test.F; +import test.Ice.objects.Test.I; +import test.Ice.objects.Test.Initial; + public final class InitialI extends Initial { diff --git a/java/test/Ice/objects/JI.java b/java/test/Ice/objects/JI.java index 58226b30812..17a88ed6ac7 100644 --- a/java/test/Ice/objects/JI.java +++ b/java/test/Ice/objects/JI.java @@ -7,7 +7,10 @@ // // ********************************************************************** -import Test.*; +package test.Ice.objects; + +import test.Ice.objects.Test._JDisp; + public final class JI extends _JDisp { diff --git a/java/test/Ice/objects/Server.java b/java/test/Ice/objects/Server.java index 9cd53d0bf12..1d16d6330af 100644 --- a/java/test/Ice/objects/Server.java +++ b/java/test/Ice/objects/Server.java @@ -7,12 +7,13 @@ // // ********************************************************************** -public class Server +package test.Ice.objects; + +public class Server extends test.Util.Application { private static class MyObjectFactory implements Ice.ObjectFactory { - public Ice.Object - create(String type) + public Ice.Object create(String type) { if(type.equals("::Test::I")) { @@ -27,67 +28,48 @@ public class Server return new HI(); } - assert(false); // Should never be reached + assert (false); // Should never be reached return null; } - public void - destroy() + public void destroy() { // Nothing to do } } - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { + Ice.Communicator communicator = communicator(); Ice.ObjectFactory factory = new MyObjectFactory(); communicator.addObjectFactory(factory, "::Test::I"); communicator.addObjectFactory(factory, "::Test::J"); communicator.addObjectFactory(factory, "::Test::H"); - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Object object = new InitialI(adapter); adapter.add(object, communicator.stringToIdentity("initial")); object = new UnexpectedObjectExceptionTestI(); adapter.add(object, communicator.stringToIdentity("uoet")); adapter.activate(); - communicator.waitForShutdown(); - return 0; + + return WAIT; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.objects"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + return initData; + } + public static void main(String[] args) + { + Server app = new Server(); + int result = app.main("Server", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/objects/Test.ice b/java/test/Ice/objects/Test.ice index 8c31358574c..3e1f2196e19 100644 --- a/java/test/Ice/objects/Test.ice +++ b/java/test/Ice/objects/Test.ice @@ -10,6 +10,7 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Ice.objects"]] module Test { diff --git a/java/test/Ice/objects/UnexpectedObjectExceptionTestI.java b/java/test/Ice/objects/UnexpectedObjectExceptionTestI.java index bdb54b6867e..9446c9ca484 100644 --- a/java/test/Ice/objects/UnexpectedObjectExceptionTestI.java +++ b/java/test/Ice/objects/UnexpectedObjectExceptionTestI.java @@ -7,7 +7,11 @@ // // ********************************************************************** -import Test.*; +package test.Ice.objects; + +import test.Ice.objects.Test.AlsoEmpty; +import test.Ice.objects.Test.AlsoEmptyHelper; + public final class UnexpectedObjectExceptionTestI extends Ice.Blobject { @@ -17,7 +21,7 @@ public final class UnexpectedObjectExceptionTestI extends Ice.Blobject Ice.Communicator communicator = current.adapter.getCommunicator(); Ice.OutputStream out = Ice.Util.createOutputStream(communicator); AlsoEmpty ae = new AlsoEmpty(); - Test.AlsoEmptyHelper.write(out, ae); + AlsoEmptyHelper.write(out, ae); out.writePendingObjects(); outParams.value = out.finished(); return true; diff --git a/java/test/Ice/objects/build.xml b/java/test/Ice/objects/build.xml deleted file mode 100644 index 1e4d16935c6..00000000000 --- a/java/test/Ice/objects/build.xml +++ /dev/null @@ -1,48 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_objects" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java stream="on" outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/operationsAMD/MyDerivedClassI.java b/java/test/Ice/operations/AMDMyDerivedClassI.java index d787e41965f..ca679e22779 100644 --- a/java/test/Ice/operationsAMD/MyDerivedClassI.java +++ b/java/test/Ice/operations/AMDMyDerivedClassI.java @@ -7,7 +7,48 @@ // // ********************************************************************** -public final class MyDerivedClassI extends Test.MyDerivedClass +package test.Ice.operations; + +import test.Ice.operationsAMD.Test.AMD_MyClass_opBool; +import test.Ice.operationsAMD.Test.AMD_MyClass_opBoolS; +import test.Ice.operationsAMD.Test.AMD_MyClass_opBoolSS; +import test.Ice.operationsAMD.Test.AMD_MyClass_opByte; +import test.Ice.operationsAMD.Test.AMD_MyClass_opByteBoolD; +import test.Ice.operationsAMD.Test.AMD_MyClass_opByteS; +import test.Ice.operationsAMD.Test.AMD_MyClass_opByteSOneway; +import test.Ice.operationsAMD.Test.AMD_MyClass_opByteSS; +import test.Ice.operationsAMD.Test.AMD_MyClass_opContext; +import test.Ice.operationsAMD.Test.AMD_MyClass_opDoubleMarshaling; +import test.Ice.operationsAMD.Test.AMD_MyClass_opFloatDouble; +import test.Ice.operationsAMD.Test.AMD_MyClass_opFloatDoubleS; +import test.Ice.operationsAMD.Test.AMD_MyClass_opFloatDoubleSS; +import test.Ice.operationsAMD.Test.AMD_MyClass_opIntS; +import test.Ice.operationsAMD.Test.AMD_MyClass_opLongFloatD; +import test.Ice.operationsAMD.Test.AMD_MyClass_opMyClass; +import test.Ice.operationsAMD.Test.AMD_MyClass_opMyEnum; +import test.Ice.operationsAMD.Test.AMD_MyClass_opMyStructMyEnumD; +import test.Ice.operationsAMD.Test.AMD_MyClass_opShortIntD; +import test.Ice.operationsAMD.Test.AMD_MyClass_opShortIntLong; +import test.Ice.operationsAMD.Test.AMD_MyClass_opShortIntLongS; +import test.Ice.operationsAMD.Test.AMD_MyClass_opShortIntLongSS; +import test.Ice.operationsAMD.Test.AMD_MyClass_opString; +import test.Ice.operationsAMD.Test.AMD_MyClass_opStringMyEnumD; +import test.Ice.operationsAMD.Test.AMD_MyClass_opStringS; +import test.Ice.operationsAMD.Test.AMD_MyClass_opStringSS; +import test.Ice.operationsAMD.Test.AMD_MyClass_opStringSSS; +import test.Ice.operationsAMD.Test.AMD_MyClass_opStringStringD; +import test.Ice.operationsAMD.Test.AMD_MyClass_opStruct; +import test.Ice.operationsAMD.Test.AMD_MyClass_opVoid; +import test.Ice.operationsAMD.Test.AMD_MyClass_shutdown; +import test.Ice.operationsAMD.Test.AMD_MyDerivedClass_opDerived; +import test.Ice.operationsAMD.Test.MyClassPrx; +import test.Ice.operationsAMD.Test.MyClassPrxHelper; +import test.Ice.operationsAMD.Test.MyDerivedClass; +import test.Ice.operationsAMD.Test.MyEnum; +import test.Ice.operationsAMD.Test.MyStruct; +import test.Ice.operationsAMD.Test.Structure; + +public final class AMDMyDerivedClassI extends MyDerivedClass { private static void test(boolean b) @@ -21,7 +62,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass static class Thread_opVoid extends Thread { public - Thread_opVoid(Test.AMD_MyClass_opVoid cb) + Thread_opVoid(AMD_MyClass_opVoid cb) { _cb = cb; } @@ -32,11 +73,11 @@ public final class MyDerivedClassI extends Test.MyDerivedClass _cb.ice_response(); } - private Test.AMD_MyClass_opVoid _cb; + private AMD_MyClass_opVoid _cb; } public void - shutdown_async(Test.AMD_MyClass_shutdown cb, + shutdown_async(AMD_MyClass_shutdown cb, Ice.Current current) { while(_opVoidThread != null) @@ -56,7 +97,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opVoid_async(Test.AMD_MyClass_opVoid cb, + opVoid_async(AMD_MyClass_opVoid cb, Ice.Current current) { while(_opVoidThread != null) @@ -76,7 +117,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opBool_async(Test.AMD_MyClass_opBool cb, + opBool_async(AMD_MyClass_opBool cb, boolean p1, boolean p2, Ice.Current current) { @@ -84,7 +125,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opBoolS_async(Test.AMD_MyClass_opBoolS cb, + opBoolS_async(AMD_MyClass_opBoolS cb, boolean[] p1, boolean[] p2, Ice.Current current) { @@ -101,7 +142,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opBoolSS_async(Test.AMD_MyClass_opBoolSS cb, + opBoolSS_async(AMD_MyClass_opBoolSS cb, boolean[][] p1, boolean[][] p2, Ice.Current current) { @@ -118,7 +159,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opByte_async(Test.AMD_MyClass_opByte cb, + opByte_async(AMD_MyClass_opByte cb, byte p1, byte p2, Ice.Current current) { @@ -126,7 +167,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opByteBoolD_async(Test.AMD_MyClass_opByteBoolD cb, + opByteBoolD_async(AMD_MyClass_opByteBoolD cb, java.util.Map p1, java.util.Map p2, Ice.Current current) { @@ -138,7 +179,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opByteS_async(Test.AMD_MyClass_opByteS cb, + opByteS_async(AMD_MyClass_opByteS cb, byte[] p1, byte[] p2, Ice.Current current) { @@ -155,7 +196,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opByteSS_async(Test.AMD_MyClass_opByteSS cb, + opByteSS_async(AMD_MyClass_opByteSS cb, byte[][] p1, byte[][] p2, Ice.Current current) { @@ -172,7 +213,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opFloatDouble_async(Test.AMD_MyClass_opFloatDouble cb, + opFloatDouble_async(AMD_MyClass_opFloatDouble cb, float p1, double p2, Ice.Current current) { @@ -180,7 +221,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opFloatDoubleS_async(Test.AMD_MyClass_opFloatDoubleS cb, + opFloatDoubleS_async(AMD_MyClass_opFloatDoubleS cb, float[] p1, double[] p2, Ice.Current current) { @@ -200,7 +241,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opFloatDoubleSS_async(Test.AMD_MyClass_opFloatDoubleSS cb, + opFloatDoubleSS_async(AMD_MyClass_opFloatDoubleSS cb, float[][] p1, double[][] p2, Ice.Current current) { @@ -217,7 +258,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opLongFloatD_async(Test.AMD_MyClass_opLongFloatD cb, + opLongFloatD_async(AMD_MyClass_opLongFloatD cb, java.util.Map p1, java.util.Map p2, Ice.Current current) { @@ -229,26 +270,26 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opMyClass_async(Test.AMD_MyClass_opMyClass cb, - Test.MyClassPrx p1, + opMyClass_async(AMD_MyClass_opMyClass cb, + MyClassPrx p1, Ice.Current current) { - Test.MyClassPrx p2 = p1; - Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast( + MyClassPrx p2 = p1; + MyClassPrx p3 = MyClassPrxHelper.uncheckedCast( current.adapter.createProxy(current.adapter.getCommunicator().stringToIdentity("noSuchIdentity"))); - cb.ice_response(Test.MyClassPrxHelper.uncheckedCast(current.adapter.createProxy(current.id)), p2, p3); + cb.ice_response(MyClassPrxHelper.uncheckedCast(current.adapter.createProxy(current.id)), p2, p3); } public void - opMyEnum_async(Test.AMD_MyClass_opMyEnum cb, - Test.MyEnum p1, + opMyEnum_async(AMD_MyClass_opMyEnum cb, + MyEnum p1, Ice.Current current) { - cb.ice_response(Test.MyEnum.enum3, p1); + cb.ice_response(MyEnum.enum3, p1); } public void - opShortIntD_async(Test.AMD_MyClass_opShortIntD cb, + opShortIntD_async(AMD_MyClass_opShortIntD cb, java.util.Map p1, java.util.Map p2, Ice.Current current) { @@ -260,7 +301,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opShortIntLong_async(Test.AMD_MyClass_opShortIntLong cb, + opShortIntLong_async(AMD_MyClass_opShortIntLong cb, short p1, int p2, long p3, Ice.Current current) { @@ -268,7 +309,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opShortIntLongS_async(Test.AMD_MyClass_opShortIntLongS cb, + opShortIntLongS_async(AMD_MyClass_opShortIntLongS cb, short[] p1, int[] p2, long[] p3, Ice.Current current) { @@ -285,7 +326,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opShortIntLongSS_async(Test.AMD_MyClass_opShortIntLongSS cb, + opShortIntLongSS_async(AMD_MyClass_opShortIntLongSS cb, short[][] p1, int[][] p2, long[][] p3, Ice.Current current) { @@ -302,7 +343,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opString_async(Test.AMD_MyClass_opString cb, + opString_async(AMD_MyClass_opString cb, String p1, String p2, Ice.Current current) { @@ -310,31 +351,31 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opStringMyEnumD_async(Test.AMD_MyClass_opStringMyEnumD cb, + opStringMyEnumD_async(AMD_MyClass_opStringMyEnumD cb, java.util.Map p1, java.util.Map p2, Ice.Current current) { - java.util.Map<String, Test.MyEnum> p3 = p1; - java.util.Map<String, Test.MyEnum> r = new java.util.HashMap<String, Test.MyEnum>(); + java.util.Map<String, MyEnum> p3 = p1; + java.util.Map<String, MyEnum> r = new java.util.HashMap<String, MyEnum>(); r.putAll(p1); r.putAll(p2); cb.ice_response(r, p3); } public void - opMyStructMyEnumD_async(Test.AMD_MyClass_opMyStructMyEnumD cb, + opMyStructMyEnumD_async(AMD_MyClass_opMyStructMyEnumD cb, java.util.Map p1, java.util.Map p2, Ice.Current current) { - java.util.Map<Test.MyStruct, Test.MyEnum> p3 = p1; - java.util.Map<Test.MyStruct, Test.MyEnum> r = new java.util.HashMap<Test.MyStruct, Test.MyEnum>(); + java.util.Map<MyStruct, MyEnum> p3 = p1; + java.util.Map<MyStruct, MyEnum> r = new java.util.HashMap<MyStruct, MyEnum>(); r.putAll(p1); r.putAll(p2); cb.ice_response(r, p3); } public void - opIntS_async(Test.AMD_MyClass_opIntS cb, int[] s, Ice.Current current) + opIntS_async(AMD_MyClass_opIntS cb, int[] s, Ice.Current current) { int[] r = new int[s.length]; for(int i = 0; i < r.length; ++i) @@ -345,19 +386,19 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opByteSOneway_async(Test.AMD_MyClass_opByteSOneway cb, byte[] s, Ice.Current current) + opByteSOneway_async(AMD_MyClass_opByteSOneway cb, byte[] s, Ice.Current current) { cb.ice_response(); } public void - opContext_async(Test.AMD_MyClass_opContext cb, Ice.Current current) + opContext_async(AMD_MyClass_opContext cb, Ice.Current current) { cb.ice_response(current.ctx); } public void - opDoubleMarshaling_async(Test.AMD_MyClass_opDoubleMarshaling cb, double p1, double[] p2, Ice.Current current) + opDoubleMarshaling_async(AMD_MyClass_opDoubleMarshaling cb, double p1, double[] p2, Ice.Current current) { double d = 1278312346.0 / 13.0; test(p1 == d); @@ -369,7 +410,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opStringS_async(Test.AMD_MyClass_opStringS cb, + opStringS_async(AMD_MyClass_opStringS cb, String[] p1, String[] p2, Ice.Current current) { @@ -386,7 +427,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opStringSS_async(Test.AMD_MyClass_opStringSS cb, + opStringSS_async(AMD_MyClass_opStringSS cb, String[][] p1, String[][] p2, Ice.Current current) { @@ -403,7 +444,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opStringSSS_async(Test.AMD_MyClass_opStringSSS cb, + opStringSSS_async(AMD_MyClass_opStringSSS cb, String[][][] p1, String[][][] p2, Ice.Current current) { @@ -420,7 +461,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opStringStringD_async(Test.AMD_MyClass_opStringStringD cb, + opStringStringD_async(AMD_MyClass_opStringStringD cb, java.util.Map p1, java.util.Map p2, Ice.Current current) { @@ -432,17 +473,17 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - opStruct_async(Test.AMD_MyClass_opStruct cb, - Test.Structure p1, Test.Structure p2, + opStruct_async(AMD_MyClass_opStruct cb, + Structure p1, Structure p2, Ice.Current current) { - Test.Structure p3 = p1; + Structure p3 = p1; p3.s.s = "a new string"; cb.ice_response(p2, p3); } public void - opDerived_async(Test.AMD_MyDerivedClass_opDerived cb, + opDerived_async(AMD_MyDerivedClass_opDerived cb, Ice.Current current) { cb.ice_response(); diff --git a/java/test/Ice/operations/AMDServer.java b/java/test/Ice/operations/AMDServer.java new file mode 100644 index 00000000000..a58adbfb0a3 --- /dev/null +++ b/java/test/Ice/operations/AMDServer.java @@ -0,0 +1,47 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.operations; + +public class AMDServer extends test.Util.Application +{ + public int run(String[] args) + { + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + adapter.add(new AMDMyDerivedClassI(), communicator().stringToIdentity("test")); + adapter.activate(); + + return WAIT; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + // + // Its possible to have batch oneway requests dispatched + // after the adapter is deactivated due to thread + // scheduling so we supress this warning. + // + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.operationsAMD"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 20000:udp"); + + return initData; + } + + public static void main(String[] args) + { + AMDServer c = new AMDServer(); + int status = c.main("AMDServer", args); + + System.gc(); + System.exit(status); + } +} diff --git a/java/test/Ice/operations/AllTests.java b/java/test/Ice/operations/AllTests.java index 8cc57b7f92b..e2a24b65ec4 100644 --- a/java/test/Ice/operations/AllTests.java +++ b/java/test/Ice/operations/AllTests.java @@ -7,46 +7,55 @@ // // ********************************************************************** +package test.Ice.operations; +import java.io.PrintWriter; + +import test.Ice.operations.Test.MyClassPrx; +import test.Ice.operations.Test.MyClassPrxHelper; +import test.Ice.operations.Test.MyDerivedClassPrx; +import test.Ice.operations.Test.MyDerivedClassPrxHelper; + public class AllTests { - public static Test.MyClassPrx - allTests(Ice.Communicator communicator, boolean collocated) + public static MyClassPrx + allTests(test.Util.Application app, boolean collocated, PrintWriter out) { - String ref = "test:default -p 12010 -t 10000"; + Ice.Communicator communicator = app.communicator(); + String ref = "test:default -p 12010 -t 20000"; Ice.ObjectPrx base = communicator.stringToProxy(ref); - Test.MyClassPrx cl = Test.MyClassPrxHelper.checkedCast(base); - Test.MyDerivedClassPrx derived = Test.MyDerivedClassPrxHelper.checkedCast(cl); + MyClassPrx cl = MyClassPrxHelper.checkedCast(base); + MyDerivedClassPrx derived = MyDerivedClassPrxHelper.checkedCast(cl); - System.out.print("testing twoway operations... "); - System.out.flush(); - Twoways.twoways(communicator, cl); - Twoways.twoways(communicator, derived); + out.print("testing twoway operations... "); + out.flush(); + Twoways.twoways(app, cl); + Twoways.twoways(app, derived); derived.opDerived(); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing oneway operations... "); - System.out.flush(); - Oneways.oneways(communicator, cl); - System.out.println("ok"); + out.print("testing oneway operations... "); + out.flush(); + Oneways.oneways(app, cl); + out.println("ok"); if(!collocated) { - System.out.print("testing twoway operations with AMI... "); - System.out.flush(); - TwowaysAMI.twowaysAMI(communicator, cl); - TwowaysAMI.twowaysAMI(communicator, derived); - System.out.println("ok"); - - System.out.print("testing oneway operations with AMI... "); - System.out.flush(); - OnewaysAMI.onewaysAMI(communicator, cl); - System.out.println("ok"); - - System.out.print("testing batch oneway operations... "); - System.out.flush(); - BatchOneways.batchOneways(cl); - BatchOneways.batchOneways(derived); - System.out.println("ok"); + out.print("testing twoway operations with AMI... "); + out.flush(); + TwowaysAMI.twowaysAMI(app, cl); + TwowaysAMI.twowaysAMI(app, derived); + out.println("ok"); + + out.print("testing oneway operations with AMI... "); + out.flush(); + OnewaysAMI.onewaysAMI(app, cl); + out.println("ok"); + + out.print("testing batch oneway operations... "); + out.flush(); + BatchOneways.batchOneways(cl, out); + BatchOneways.batchOneways(derived, out); + out.println("ok"); } return cl; diff --git a/java/test/Ice/operations/BatchOneways.java b/java/test/Ice/operations/BatchOneways.java index cd36c0df159..ccf0caac74c 100644 --- a/java/test/Ice/operations/BatchOneways.java +++ b/java/test/Ice/operations/BatchOneways.java @@ -7,6 +7,13 @@ // // ********************************************************************** +package test.Ice.operations; + +import java.io.PrintWriter; + +import test.Ice.operations.Test.MyClassPrx; +import test.Ice.operations.Test.MyClassPrxHelper; + class BatchOneways { private static void @@ -19,7 +26,7 @@ class BatchOneways } static void - batchOneways(Test.MyClassPrx p) + batchOneways(MyClassPrx p, PrintWriter out) { final byte[] bs1 = new byte[10 * 1024]; final byte[] bs2 = new byte[99 * 1024]; @@ -52,7 +59,7 @@ class BatchOneways { } - Test.MyClassPrx batch = Test.MyClassPrxHelper.uncheckedCast(p.ice_batchOneway()); + MyClassPrx batch = MyClassPrxHelper.uncheckedCast(p.ice_batchOneway()); for(int i = 0 ; i < 30 ; ++i) { diff --git a/java/test/Ice/operations/Client.java b/java/test/Ice/operations/Client.java index 8b57a5c4189..5c55b5e7a6a 100644 --- a/java/test/Ice/operations/Client.java +++ b/java/test/Ice/operations/Client.java @@ -7,15 +7,19 @@ // // ********************************************************************** -public class Client +package test.Ice.operations; + +import test.Ice.operations.Test.MyClassPrx; + +public class Client extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { - Test.MyClassPrx myClass = AllTests.allTests(communicator, false); + java.io.PrintWriter out = getWriter(); + MyClassPrx myClass = AllTests.allTests(this, false, out); - System.out.print("testing server shutdown... "); - System.out.flush(); + out.print("testing server shutdown... "); + out.flush(); myClass.shutdown(); try { @@ -24,58 +28,32 @@ public class Client } catch(Ice.LocalException ex) { - System.out.println("ok"); + out.println("ok"); } return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - // - // In this test, we need at least two threads in the - // client side thread pool for nested AMI. - // - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); - initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); - initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0"); - - // - // We must set MessageSizeMax to an explicit values, - // because we run tests to check whether - // Ice.MemoryLimitException is raised as expected. - // - initData.properties.setProperty("Ice.MessageSizeMax", "100"); - - communicator = Ice.Util.initialize(argsH, initData); - status = run(argsH.value, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); + initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0"); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.operations"); + // + // We must set MessageSizeMax to an explicit values, + // because we run tests to check whether + // Ice.MemoryLimitException is raised as expected. + // + initData.properties.setProperty("Ice.MessageSizeMax", "100"); + return initData; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + public static void main(String[] args) + { + Client c = new Client(); + int status = c.main("Client", args); System.gc(); System.exit(status); diff --git a/java/test/Ice/operations/Collocated.java b/java/test/Ice/operations/Collocated.java index 66738685f25..84fbfeb1910 100644 --- a/java/test/Ice/operations/Collocated.java +++ b/java/test/Ice/operations/Collocated.java @@ -7,54 +7,37 @@ // // ********************************************************************** -public class Collocated +package test.Ice.operations; + +public class Collocated extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - adapter.add(new MyDerivedClassI(), communicator.stringToIdentity("test")); + java.io.PrintWriter out = getWriter(); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + adapter.add(new MyDerivedClassI(), communicator().stringToIdentity("test")); adapter.activate(); - AllTests.allTests(communicator, true); + AllTests.allTests(this, true, out); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); - communicator = Ice.Util.initialize(argsH, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.operations"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 20000"); + return initData; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + public static void main(String[] args) + { + Collocated c = new Collocated(); + int status = c.main("Collocated", args); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/operations/MyDerivedClassI.java b/java/test/Ice/operations/MyDerivedClassI.java index 025b466dd58..7e7cdd60b4a 100644 --- a/java/test/Ice/operations/MyDerivedClassI.java +++ b/java/test/Ice/operations/MyDerivedClassI.java @@ -7,7 +7,41 @@ // // ********************************************************************** -public final class MyDerivedClassI extends Test.MyDerivedClass +package test.Ice.operations; +import test.Ice.operations.Test.BoolSHolder; +import test.Ice.operations.Test.BoolSSHolder; +import test.Ice.operations.Test.ByteBoolDHolder; +import test.Ice.operations.Test.ByteSHolder; +import test.Ice.operations.Test.ByteSSHolder; +import test.Ice.operations.Test.DoubleSHolder; +import test.Ice.operations.Test.DoubleSSHolder; +import test.Ice.operations.Test.FloatSHolder; +import test.Ice.operations.Test.FloatSSHolder; +import test.Ice.operations.Test.IntSHolder; +import test.Ice.operations.Test.IntSSHolder; +import test.Ice.operations.Test.LongFloatDHolder; +import test.Ice.operations.Test.LongSHolder; +import test.Ice.operations.Test.LongSSHolder; +import test.Ice.operations.Test.MyClassPrx; +import test.Ice.operations.Test.MyClassPrxHelper; +import test.Ice.operations.Test.MyClassPrxHolder; +import test.Ice.operations.Test.MyDerivedClass; +import test.Ice.operations.Test.MyEnum; +import test.Ice.operations.Test.MyEnumHolder; +import test.Ice.operations.Test.MyStruct; +import test.Ice.operations.Test.MyStructMyEnumDHolder; +import test.Ice.operations.Test.ShortIntDHolder; +import test.Ice.operations.Test.ShortSHolder; +import test.Ice.operations.Test.ShortSSHolder; +import test.Ice.operations.Test.StringMyEnumDHolder; +import test.Ice.operations.Test.StringSHolder; +import test.Ice.operations.Test.StringSSHolder; +import test.Ice.operations.Test.StringSSSHolder; +import test.Ice.operations.Test.StringStringDHolder; +import test.Ice.operations.Test.Structure; +import test.Ice.operations.Test.StructureHolder; + +public final class MyDerivedClassI extends MyDerivedClass { private static void test(boolean b) @@ -40,7 +74,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public boolean[] opBoolS(boolean[] p1, boolean[] p2, - Test.BoolSHolder p3, + BoolSHolder p3, Ice.Current current) { p3.value = new boolean[p1.length + p2.length]; @@ -57,7 +91,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public boolean[][] opBoolSS(boolean[][] p1, boolean[][] p2, - Test.BoolSSHolder p3, + BoolSSHolder p3, Ice.Current current) { p3.value = new boolean[p1.length + p2.length][]; @@ -83,7 +117,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public java.util.Map<Byte, Boolean> opByteBoolD(java.util.Map p1, java.util.Map p2, - Test.ByteBoolDHolder p3, + ByteBoolDHolder p3, Ice.Current current) { p3.value = p1; @@ -95,7 +129,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public byte[] opByteS(byte[] p1, byte[] p2, - Test.ByteSHolder p3, + ByteSHolder p3, Ice.Current current) { p3.value = new byte[p1.length]; @@ -112,7 +146,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public byte[][] opByteSS(byte[][] p1, byte[][] p2, - Test.ByteSSHolder p3, + ByteSSHolder p3, Ice.Current current) { p3.value = new byte[p1.length][]; @@ -139,7 +173,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public double[] opFloatDoubleS(float[] p1, double[] p2, - Test.FloatSHolder p3, Test.DoubleSHolder p4, + FloatSHolder p3, DoubleSHolder p4, Ice.Current current) { p3.value = p1; @@ -159,7 +193,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public double[][] opFloatDoubleSS(float[][] p1, double[][] p2, - Test.FloatSSHolder p3, Test.DoubleSSHolder p4, + FloatSSHolder p3, DoubleSSHolder p4, Ice.Current current) { p3.value = p1; @@ -176,7 +210,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public java.util.Map<Long, Float> opLongFloatD(java.util.Map p1, java.util.Map p2, - Test.LongFloatDHolder p3, + LongFloatDHolder p3, Ice.Current current) { p3.value = p1; @@ -186,29 +220,29 @@ public final class MyDerivedClassI extends Test.MyDerivedClass return r; } - public Test.MyClassPrx - opMyClass(Test.MyClassPrx p1, - Test.MyClassPrxHolder p2, Test.MyClassPrxHolder p3, + public MyClassPrx + opMyClass(MyClassPrx p1, + MyClassPrxHolder p2, MyClassPrxHolder p3, Ice.Current current) { p2.value = p1; - p3.value = Test.MyClassPrxHelper.uncheckedCast( + p3.value = MyClassPrxHelper.uncheckedCast( current.adapter.createProxy(current.adapter.getCommunicator().stringToIdentity("noSuchIdentity"))); - return Test.MyClassPrxHelper.uncheckedCast(current.adapter.createProxy(current.id)); + return MyClassPrxHelper.uncheckedCast(current.adapter.createProxy(current.id)); } - public Test.MyEnum - opMyEnum(Test.MyEnum p1, - Test.MyEnumHolder p2, + public MyEnum + opMyEnum(MyEnum p1, + MyEnumHolder p2, Ice.Current current) { p2.value = p1; - return Test.MyEnum.enum3; + return MyEnum.enum3; } public java.util.Map<Short, Integer> opShortIntD(java.util.Map p1, java.util.Map p2, - Test.ShortIntDHolder p3, + ShortIntDHolder p3, Ice.Current current) { p3.value = p1; @@ -231,7 +265,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public long[] opShortIntLongS(short[] p1, int[] p2, long[] p3, - Test.ShortSHolder p4, Test.IntSHolder p5, Test.LongSHolder p6, + ShortSHolder p4, IntSHolder p5, LongSHolder p6, Ice.Current current) { p4.value = p1; @@ -248,7 +282,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public long[][] opShortIntLongSS(short[][] p1, int[][] p2, long[][] p3, - Test.ShortSSHolder p4, Test.IntSSHolder p5, Test.LongSSHolder p6, + ShortSSHolder p4, IntSSHolder p5, LongSSHolder p6, Ice.Current current) { p4.value = p1; @@ -272,25 +306,25 @@ public final class MyDerivedClassI extends Test.MyDerivedClass return p1 + " " + p2; } - public java.util.Map<String, Test.MyEnum> + public java.util.Map<String, MyEnum> opStringMyEnumD(java.util.Map p1, java.util.Map p2, - Test.StringMyEnumDHolder p3, + StringMyEnumDHolder p3, Ice.Current current) { p3.value = p1; - java.util.Map<String, Test.MyEnum> r = new java.util.HashMap<String, Test.MyEnum>(); + java.util.Map<String, MyEnum> r = new java.util.HashMap<String, MyEnum>(); r.putAll(p1); r.putAll(p2); return r; } - public java.util.Map<Test.MyStruct, Test.MyEnum> + public java.util.Map<MyStruct, MyEnum> opMyStructMyEnumD(java.util.Map p1, java.util.Map p2, - Test.MyStructMyEnumDHolder p3, + MyStructMyEnumDHolder p3, Ice.Current current) { p3.value = p1; - java.util.Map<Test.MyStruct, Test.MyEnum> r = new java.util.HashMap<Test.MyStruct, Test.MyEnum>(); + java.util.Map<MyStruct, MyEnum> r = new java.util.HashMap<MyStruct, MyEnum>(); r.putAll(p1); r.putAll(p2); return r; @@ -331,7 +365,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public String[] opStringS(String[] p1, String[] p2, - Test.StringSHolder p3, + StringSHolder p3, Ice.Current current) { p3.value = new String[p1.length + p2.length]; @@ -348,7 +382,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public String[][] opStringSS(String[][] p1, String[][] p2, - Test.StringSSHolder p3, + StringSSHolder p3, Ice.Current current) { p3.value = new String[p1.length + p2.length][]; @@ -365,7 +399,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public String[][][] opStringSSS(String[][][] p1, String[][][] p2, - Test.StringSSSHolder p3, + StringSSSHolder p3, Ice.Current current) { p3.value = new String[p1.length + p2.length][][]; @@ -382,7 +416,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public java.util.Map<String, String> opStringStringD(java.util.Map p1, java.util.Map p2, - Test.StringStringDHolder p3, + StringStringDHolder p3, Ice.Current current) { p3.value = p1; @@ -392,9 +426,9 @@ public final class MyDerivedClassI extends Test.MyDerivedClass return r; } - public Test.Structure - opStruct(Test.Structure p1, Test.Structure p2, - Test.StructureHolder p3, + public Structure + opStruct(Structure p1, Structure p2, + StructureHolder p3, Ice.Current current) { p3.value = p1; diff --git a/java/test/Ice/operations/Oneways.java b/java/test/Ice/operations/Oneways.java index 47a6ecc37dc..77613d31cf6 100644 --- a/java/test/Ice/operations/Oneways.java +++ b/java/test/Ice/operations/Oneways.java @@ -7,6 +7,11 @@ // // ********************************************************************** +package test.Ice.operations; + +import test.Ice.operations.Test.MyClassPrx; +import test.Ice.operations.Test.MyClassPrxHelper; + class Oneways { private static void @@ -19,9 +24,10 @@ class Oneways } static void - oneways(Ice.Communicator communicator, Test.MyClassPrx p) + oneways(test.Util.Application app, MyClassPrx p) { - p = Test.MyClassPrxHelper.uncheckedCast(p.ice_oneway()); + Ice.Communicator communicator = app.communicator(); + p = MyClassPrxHelper.uncheckedCast(p.ice_oneway()); { p.opVoid(); @@ -41,4 +47,4 @@ class Oneways } } } -}
\ No newline at end of file +} diff --git a/java/test/Ice/operations/OnewaysAMI.java b/java/test/Ice/operations/OnewaysAMI.java index 3cc3cc8f1e7..d1a0f51d9d5 100644 --- a/java/test/Ice/operations/OnewaysAMI.java +++ b/java/test/Ice/operations/OnewaysAMI.java @@ -7,6 +7,13 @@ // // ********************************************************************** +package test.Ice.operations; + +import test.Ice.operations.Test.AMI_MyClass_opByte; +import test.Ice.operations.Test.AMI_MyClass_opVoid; +import test.Ice.operations.Test.MyClassPrx; +import test.Ice.operations.Test.MyClassPrxHelper; + class OnewaysAMI { private static void @@ -60,7 +67,7 @@ class OnewaysAMI private boolean _called; } - private static class AMI_MyClass_opVoidI extends Test.AMI_MyClass_opVoid + private static class AMI_MyClass_opVoidI extends AMI_MyClass_opVoid { public void ice_response() @@ -75,7 +82,7 @@ class OnewaysAMI } } - private static class AMI_MyClass_opVoidExI extends Test.AMI_MyClass_opVoid + private static class AMI_MyClass_opVoidExI extends AMI_MyClass_opVoid { public void ice_response() @@ -99,7 +106,7 @@ class OnewaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opByteExI extends Test.AMI_MyClass_opByte + private static class AMI_MyClass_opByteExI extends AMI_MyClass_opByte { public void ice_response(byte r, byte b) @@ -124,9 +131,10 @@ class OnewaysAMI } static void - onewaysAMI(Ice.Communicator communicator, Test.MyClassPrx p) + onewaysAMI(test.Util.Application app, MyClassPrx p) { - p = Test.MyClassPrxHelper.uncheckedCast(p.ice_oneway()); + Ice.Communicator communicator = app.communicator(); + p = MyClassPrxHelper.uncheckedCast(p.ice_oneway()); { AMI_MyClass_opVoidI cb = new AMI_MyClass_opVoidI(); @@ -138,7 +146,7 @@ class OnewaysAMI { // Check that a call to a void operation raises NoEndpointException // in the ice_exception() callback instead of at the point of call. - Test.MyClassPrx indirect = Test.MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); + MyClassPrx indirect = MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); AMI_MyClass_opVoidExI cb = new AMI_MyClass_opVoidExI(); try { @@ -158,4 +166,4 @@ class OnewaysAMI } } -}
\ No newline at end of file +} diff --git a/java/test/Ice/operations/Server.java b/java/test/Ice/operations/Server.java index 676ab7a47e4..babada1d50a 100644 --- a/java/test/Ice/operations/Server.java +++ b/java/test/Ice/operations/Server.java @@ -7,59 +7,39 @@ // // ********************************************************************** -public class Server +package test.Ice.operations; + +public class Server extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - adapter.add(new MyDerivedClassI(), communicator.stringToIdentity("test")); + communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + adapter.add(new MyDerivedClassI(), communicator().stringToIdentity("test")); adapter.activate(); - communicator.waitForShutdown(); - return 0; + return WAIT; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); - // - // Its possible to have batch oneway requests dispatched - // after the adapter is deactivated due to thread - // scheduling so we supress this warning. - // - initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - - communicator = Ice.Util.initialize(argsH, initData); - status = run(argsH.value, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + // + // Its possible to have batch oneway requests dispatched + // after the adapter is deactivated due to thread + // scheduling so we supress this warning. + // + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.operations"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + return initData; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + public static void main(String[] args) + { + Server c = new Server(); + int status = c.main("Server", args); System.gc(); System.exit(status); diff --git a/java/test/Ice/operations/Test.ice b/java/test/Ice/operations/Test.ice index ea771c12ff3..8730169f5a2 100644 --- a/java/test/Ice/operations/Test.ice +++ b/java/test/Ice/operations/Test.ice @@ -12,6 +12,7 @@ #include <Ice/Current.ice> +[["java:package:test.Ice.operations"]] module Test { diff --git a/java/test/Ice/operationsAMD/TestAMD.ice b/java/test/Ice/operations/TestAMD.ice index ae666e15480..bec8c048457 100644 --- a/java/test/Ice/operationsAMD/TestAMD.ice +++ b/java/test/Ice/operations/TestAMD.ice @@ -12,6 +12,7 @@ #include<Ice/Current.ice> +[["java:package:test.Ice.operationsAMD"]] module Test { diff --git a/java/test/Ice/operations/Twoways.java b/java/test/Ice/operations/Twoways.java index dff64d1eabd..588b9355ff4 100644 --- a/java/test/Ice/operations/Twoways.java +++ b/java/test/Ice/operations/Twoways.java @@ -7,6 +7,37 @@ // // ********************************************************************** +package test.Ice.operations; + +import test.Ice.operations.Test.AnotherStruct; +import test.Ice.operations.Test.BoolSHolder; +import test.Ice.operations.Test.ByteBoolDHolder; +import test.Ice.operations.Test.ByteSHolder; +import test.Ice.operations.Test.ByteSSHolder; +import test.Ice.operations.Test.DoubleSHolder; +import test.Ice.operations.Test.DoubleSSHolder; +import test.Ice.operations.Test.FloatSHolder; +import test.Ice.operations.Test.FloatSSHolder; +import test.Ice.operations.Test.IntSHolder; +import test.Ice.operations.Test.LongFloatDHolder; +import test.Ice.operations.Test.LongSHolder; +import test.Ice.operations.Test.MyClassPrx; +import test.Ice.operations.Test.MyClassPrxHelper; +import test.Ice.operations.Test.MyClassPrxHolder; +import test.Ice.operations.Test.MyEnum; +import test.Ice.operations.Test.MyStruct; +import test.Ice.operations.Test.MyEnumHolder; +import test.Ice.operations.Test.MyStructMyEnumDHolder; +import test.Ice.operations.Test.ShortIntDHolder; +import test.Ice.operations.Test.ShortSHolder; +import test.Ice.operations.Test.StringMyEnumDHolder; +import test.Ice.operations.Test.StringSHolder; +import test.Ice.operations.Test.StringSSHolder; +import test.Ice.operations.Test.StringSSSHolder; +import test.Ice.operations.Test.StringStringDHolder; +import test.Ice.operations.Test.Structure; +import test.Ice.operations.Test.StructureHolder; + class Twoways { private static void @@ -20,7 +51,7 @@ class Twoways static class PerThreadContextInvokeThread extends Thread { - public PerThreadContextInvokeThread(Test.MyClassPrx proxy) + public PerThreadContextInvokeThread(MyClassPrx proxy) { _proxy = proxy; } @@ -35,12 +66,13 @@ class Twoways test(_proxy.opContext().equals(ctx)); } - final private Test.MyClassPrx _proxy; + final private MyClassPrx _proxy; } static void - twoways(Ice.Communicator communicator, Test.MyClassPrx p) + twoways(test.Util.Application app, MyClassPrx p) { + Ice.Communicator communicator = app.communicator(); { p.opVoid(); } @@ -121,18 +153,18 @@ class Twoways } { - Test.MyEnumHolder e = new Test.MyEnumHolder(); - Test.MyEnum r; + MyEnumHolder e = new MyEnumHolder(); + MyEnum r; - r = p.opMyEnum(Test.MyEnum.enum2, e); - test(e.value == Test.MyEnum.enum2); - test(r == Test.MyEnum.enum3); + r = p.opMyEnum(MyEnum.enum2, e); + test(e.value == MyEnum.enum2); + test(r == MyEnum.enum3); } { - Test.MyClassPrxHolder c1 = new Test.MyClassPrxHolder(); - Test.MyClassPrxHolder c2 = new Test.MyClassPrxHolder(); - Test.MyClassPrx r; + MyClassPrxHolder c1 = new MyClassPrxHolder(); + MyClassPrxHolder c2 = new MyClassPrxHolder(); + MyClassPrx r; r = p.opMyClass(p, c1, c2); test(Ice.Util.proxyIdentityAndFacetCompare(c1.value, p) == 0); @@ -160,24 +192,24 @@ class Twoways } { - Test.Structure si1 = new Test.Structure(); + Structure si1 = new Structure(); si1.p = p; - si1.e = Test.MyEnum.enum3; - si1.s = new Test.AnotherStruct(); + si1.e = MyEnum.enum3; + si1.s = new AnotherStruct(); si1.s.s = "abc"; - Test.Structure si2 = new Test.Structure(); + Structure si2 = new Structure(); si2.p = null; - si2.e = Test.MyEnum.enum2; - si2.s = new Test.AnotherStruct(); + si2.e = MyEnum.enum2; + si2.s = new AnotherStruct(); si2.s.s = "def"; - Test.StructureHolder so = new Test.StructureHolder(); - Test.Structure rso = p.opStruct(si1, si2, so); + StructureHolder so = new StructureHolder(); + Structure rso = p.opStruct(si1, si2, so); test(rso.p == null); - test(rso.e == Test.MyEnum.enum2); + test(rso.e == MyEnum.enum2); test(rso.s.s.equals("def")); test(so.value.p.equals(p)); - test(so.value.e == Test.MyEnum.enum3); + test(so.value.e == MyEnum.enum3); test(so.value.s.s.equals("a new string")); so.value.p.opVoid(); } @@ -198,7 +230,7 @@ class Twoways (byte)0xf4 }; - Test.ByteSHolder bso = new Test.ByteSHolder(); + ByteSHolder bso = new ByteSHolder(); byte[] rso; rso = p.opByteS(bsi1, bsi2, bso); @@ -222,7 +254,7 @@ class Twoways final boolean[] bsi1 = { true, true, false }; final boolean[] bsi2 = { false }; - Test.BoolSHolder bso = new Test.BoolSHolder(); + BoolSHolder bso = new BoolSHolder(); boolean[] rso; rso = p.opBoolS(bsi1, bsi2, bso); @@ -242,9 +274,9 @@ class Twoways final int[] isi = { 5, 6, 7, 8 }; final long[] lsi = { 10, 30, 20 }; - Test.ShortSHolder sso = new Test.ShortSHolder(); - Test.IntSHolder iso = new Test.IntSHolder(); - Test.LongSHolder lso = new Test.LongSHolder(); + ShortSHolder sso = new ShortSHolder(); + IntSHolder iso = new IntSHolder(); + LongSHolder lso = new LongSHolder(); long[] rso; rso = p.opShortIntLongS(ssi, isi, lsi, sso, iso, lso); @@ -274,8 +306,8 @@ class Twoways final float[] fsi = { 3.14f, 1.11f }; final double[] dsi = { 1.1E10, 1.2E10, 1.3E10 }; - Test.FloatSHolder fso = new Test.FloatSHolder(); - Test.DoubleSHolder dso = new Test.DoubleSHolder(); + FloatSHolder fso = new FloatSHolder(); + DoubleSHolder dso = new DoubleSHolder(); double[] rso; rso = p.opFloatDoubleS(fsi, dsi, fso, dso); @@ -298,7 +330,7 @@ class Twoways final String[] ssi1 = { "abc", "de", "fghi" }; final String[] ssi2 = { "xyz" }; - Test.StringSHolder sso = new Test.StringSHolder(); + StringSHolder sso = new StringSHolder(); String[] rso; rso = p.opStringS(ssi1, ssi2, sso); @@ -325,7 +357,7 @@ class Twoways { (byte)0xf2, (byte)0xf1 } }; - Test.ByteSSHolder bso = new Test.ByteSSHolder(); + ByteSSHolder bso = new ByteSSHolder(); byte[][] rso; rso = p.opByteSS(bsi1, bsi2, bso); @@ -362,8 +394,8 @@ class Twoways { 1.1E10, 1.2E10, 1.3E10 } }; - Test.FloatSSHolder fso = new Test.FloatSSHolder(); - Test.DoubleSSHolder dso = new Test.DoubleSSHolder(); + FloatSSHolder fso = new FloatSSHolder(); + DoubleSSHolder dso = new DoubleSSHolder(); double[][] rso; rso = p.opFloatDoubleSS(fsi, dsi, fso, dso); @@ -402,7 +434,7 @@ class Twoways { "xyz" } }; - Test.StringSSHolder sso = new Test.StringSSHolder(); + StringSSHolder sso = new StringSSHolder(); String[][] rso; rso = p.opStringSS(ssi1, ssi2, sso); @@ -460,7 +492,7 @@ class Twoways } }; - Test.StringSSSHolder ssso = new Test.StringSSSHolder(); + StringSSSHolder ssso = new StringSSSHolder(); String rsso[][][]; rsso = p.opStringSSS(sssi1, sssi2, ssso); @@ -507,7 +539,7 @@ class Twoways di2.put((byte)11, Boolean.FALSE); di2.put((byte)101, Boolean.TRUE); - Test.ByteBoolDHolder _do = new Test.ByteBoolDHolder(); + ByteBoolDHolder _do = new ByteBoolDHolder(); java.util.Map<Byte, Boolean> ro = p.opByteBoolD(di1, di2, _do); test(_do.value.equals(di1)); @@ -527,7 +559,7 @@ class Twoways di2.put((short)111, -100); di2.put((short)1101, 0); - Test.ShortIntDHolder _do = new Test.ShortIntDHolder(); + ShortIntDHolder _do = new ShortIntDHolder(); java.util.Map<Short, Integer> ro = p.opShortIntD(di1, di2, _do); test(_do.value.equals(di1)); @@ -547,7 +579,7 @@ class Twoways di2.put(999999120L, new Float(-100.4f)); di2.put(999999130L, new Float(0.5f)); - Test.LongFloatDHolder _do = new Test.LongFloatDHolder(); + LongFloatDHolder _do = new LongFloatDHolder(); java.util.Map<Long, Float> ro = p.opLongFloatD(di1, di2, _do); test(_do.value.equals(di1)); @@ -567,7 +599,7 @@ class Twoways di2.put("FOO", "abc -100.4"); di2.put("BAR", "abc 0.5"); - Test.StringStringDHolder _do = new Test.StringStringDHolder(); + StringStringDHolder _do = new StringStringDHolder(); java.util.Map<String, String> ro = p.opStringStringD(di1, di2, _do); test(_do.value.equals(di1)); @@ -579,48 +611,48 @@ class Twoways } { - java.util.Map<String, Test.MyEnum> di1 = new java.util.HashMap<String, Test.MyEnum>(); - di1.put("abc", Test.MyEnum.enum1); - di1.put("", Test.MyEnum.enum2); - java.util.Map<String, Test.MyEnum> di2 = new java.util.HashMap<String, Test.MyEnum>(); - di2.put("abc", Test.MyEnum.enum1); - di2.put("qwerty", Test.MyEnum.enum3); - di2.put("Hello!!", Test.MyEnum.enum2); + java.util.Map<String, MyEnum> di1 = new java.util.HashMap<String, MyEnum>(); + di1.put("abc", MyEnum.enum1); + di1.put("", MyEnum.enum2); + java.util.Map<String, MyEnum> di2 = new java.util.HashMap<String, MyEnum>(); + di2.put("abc", MyEnum.enum1); + di2.put("qwerty", MyEnum.enum3); + di2.put("Hello!!", MyEnum.enum2); - Test.StringMyEnumDHolder _do = new Test.StringMyEnumDHolder(); - java.util.Map<String, Test.MyEnum> ro = p.opStringMyEnumD(di1, di2, _do); + StringMyEnumDHolder _do = new StringMyEnumDHolder(); + java.util.Map<String, MyEnum> ro = p.opStringMyEnumD(di1, di2, _do); test(_do.value.equals(di1)); test(ro.size() == 4); - test(ro.get("abc") == Test.MyEnum.enum1); - test(ro.get("qwerty") == Test.MyEnum.enum3); - test(ro.get("") == Test.MyEnum.enum2); - test(ro.get("Hello!!") == Test.MyEnum.enum2); + test(ro.get("abc") == MyEnum.enum1); + test(ro.get("qwerty") == MyEnum.enum3); + test(ro.get("") == MyEnum.enum2); + test(ro.get("Hello!!") == MyEnum.enum2); } { - Test.MyStruct s11 = new Test.MyStruct(1, 1); - Test.MyStruct s12 = new Test.MyStruct(1, 2); - java.util.Map<Test.MyStruct, Test.MyEnum> di1 = new java.util.HashMap<Test.MyStruct, Test.MyEnum>(); - di1.put(s11, Test.MyEnum.enum1); - di1.put(s12, Test.MyEnum.enum2); - - Test.MyStruct s22 = new Test.MyStruct(2, 2); - Test.MyStruct s23 = new Test.MyStruct(2, 3); - java.util.Map<Test.MyStruct, Test.MyEnum> di2 = new java.util.HashMap<Test.MyStruct, Test.MyEnum>(); - di2.put(s11, Test.MyEnum.enum1); - di2.put(s22, Test.MyEnum.enum3); - di2.put(s23, Test.MyEnum.enum2); - - Test.MyStructMyEnumDHolder _do = new Test.MyStructMyEnumDHolder(); - java.util.Map<Test.MyStruct, Test.MyEnum> ro = p.opMyStructMyEnumD(di1, di2, _do); + MyStruct s11 = new MyStruct(1, 1); + MyStruct s12 = new MyStruct(1, 2); + java.util.Map<MyStruct, MyEnum> di1 = new java.util.HashMap<MyStruct, MyEnum>(); + di1.put(s11, MyEnum.enum1); + di1.put(s12, MyEnum.enum2); + + MyStruct s22 = new MyStruct(2, 2); + MyStruct s23 = new MyStruct(2, 3); + java.util.Map<MyStruct, MyEnum> di2 = new java.util.HashMap<MyStruct, MyEnum>(); + di2.put(s11, MyEnum.enum1); + di2.put(s22, MyEnum.enum3); + di2.put(s23, MyEnum.enum2); + + MyStructMyEnumDHolder _do = new MyStructMyEnumDHolder(); + java.util.Map<MyStruct, MyEnum> ro = p.opMyStructMyEnumD(di1, di2, _do); test(_do.value.equals(di1)); test(ro.size() == 4); - test(ro.get(s11) == Test.MyEnum.enum1); - test(ro.get(s12) == Test.MyEnum.enum2); - test(ro.get(s22) == Test.MyEnum.enum3); - test(ro.get(s23) == Test.MyEnum.enum2); + test(ro.get(s11) == MyEnum.enum1); + test(ro.get(s12) == MyEnum.enum2); + test(ro.get(s22) == MyEnum.enum3); + test(ro.get(s23) == MyEnum.enum2); } { @@ -658,7 +690,7 @@ class Twoways test(r.equals(ctx)); } { - Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx)); + MyClassPrx p2 = MyClassPrxHelper.checkedCast(p.ice_context(ctx)); test(p2.ice_getContext().equals(ctx)); java.util.Map<String, String> r = p2.opContext(); test(r.equals(ctx)); @@ -675,35 +707,35 @@ class Twoways communicator.setDefaultContext(dflt); test(!p.opContext().equals(dflt)); - Test.MyClassPrx p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_context(new java.util.HashMap())); + MyClassPrx p2 = MyClassPrxHelper.uncheckedCast(p.ice_context(new java.util.HashMap())); test(p2.opContext().isEmpty()); - p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_defaultContext()); + p2 = MyClassPrxHelper.uncheckedCast(p.ice_defaultContext()); test(p2.opContext().equals(dflt)); communicator.setDefaultContext(new java.util.HashMap()); test(!p2.opContext().isEmpty()); communicator.setDefaultContext(dflt); - Test.MyClassPrx c = Test.MyClassPrxHelper.checkedCast( - communicator.stringToProxy("test:default -p 12010 -t 10000")); + MyClassPrx c = MyClassPrxHelper.checkedCast( + communicator.stringToProxy("test:default -p 12010 -t 20000")); test(c.opContext().equals(dflt)); dflt.put("a", "c"); - Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_context(dflt)); + MyClassPrx c2 = MyClassPrxHelper.uncheckedCast(c.ice_context(dflt)); test(c2.opContext().get("a").equals("c")); dflt.clear(); - Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_context(dflt)); + MyClassPrx c3 = MyClassPrxHelper.uncheckedCast(c2.ice_context(dflt)); test(c3.opContext().get("a") == null); - Test.MyClassPrx c4 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_defaultContext()); + MyClassPrx c4 = MyClassPrxHelper.uncheckedCast(c2.ice_defaultContext()); test(c4.opContext().get("a").equals("b")); dflt.put("a", "d"); communicator.setDefaultContext(dflt); - Test.MyClassPrx c5 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_defaultContext()); + MyClassPrx c5 = MyClassPrxHelper.uncheckedCast(c2.ice_defaultContext()); test(c5.opContext().get("a").equals("d")); communicator.setDefaultContext(new java.util.HashMap()); @@ -722,15 +754,15 @@ class Twoways initData.properties = communicator.getProperties()._clone(); initData.properties.setProperty("Ice.ImplicitContext", impls[i]); - Ice.Communicator ic = Ice.Util.initialize(initData); + Ice.Communicator ic = app.initialize(initData); java.util.Map<String, String> ctx = new java.util.HashMap<String, String>(); ctx.put("one", "ONE"); ctx.put("two", "TWO"); ctx.put("three", "THREE"); - Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast( - ic.stringToProxy("test:default -p 12010 -t 10000")); + MyClassPrx p3 = MyClassPrxHelper.uncheckedCast( + ic.stringToProxy("test:default -p 12010 -t 20000")); ic.getImplicitContext().setContext(ctx); test(ic.getImplicitContext().getContext().equals(ctx)); @@ -753,7 +785,7 @@ class Twoways combined.putAll(prxContext); test(combined.get("one").equals("UN")); - p3 = Test.MyClassPrxHelper.uncheckedCast(p3.ice_context(prxContext)); + p3 = MyClassPrxHelper.uncheckedCast(p3.ice_context(prxContext)); ic.getImplicitContext().setContext(null); test(p3.opContext().equals(prxContext)); @@ -766,7 +798,7 @@ class Twoways if(impls[i].equals("PerThread")) { Thread thread = new PerThreadContextInvokeThread( - Test.MyClassPrxHelper.uncheckedCast(p3.ice_context(null))); + MyClassPrxHelper.uncheckedCast(p3.ice_context(null))); thread.start(); try { diff --git a/java/test/Ice/operations/TwowaysAMI.java b/java/test/Ice/operations/TwowaysAMI.java index 600f7a31242..cf942a3a473 100644 --- a/java/test/Ice/operations/TwowaysAMI.java +++ b/java/test/Ice/operations/TwowaysAMI.java @@ -7,6 +7,46 @@ // // ********************************************************************** +package test.Ice.operations; +import test.Ice.operations.Test.AMI_MyClass_opBool; +import test.Ice.operations.Test.AMI_MyClass_opBoolS; +import test.Ice.operations.Test.AMI_MyClass_opBoolSS; +import test.Ice.operations.Test.AMI_MyClass_opByte; +import test.Ice.operations.Test.AMI_MyClass_opByteBoolD; +import test.Ice.operations.Test.AMI_MyClass_opByteS; +import test.Ice.operations.Test.AMI_MyClass_opByteSS; +import test.Ice.operations.Test.AMI_MyClass_opContext; +import test.Ice.operations.Test.AMI_MyClass_opDoubleMarshaling; +import test.Ice.operations.Test.AMI_MyClass_opFloatDouble; +import test.Ice.operations.Test.AMI_MyClass_opFloatDoubleS; +import test.Ice.operations.Test.AMI_MyClass_opFloatDoubleSS; +import test.Ice.operations.Test.AMI_MyClass_opIntS; +import test.Ice.operations.Test.AMI_MyClass_opLongFloatD; +import test.Ice.operations.Test.AMI_MyClass_opMyClass; +import test.Ice.operations.Test.AMI_MyClass_opMyEnum; +import test.Ice.operations.Test.AMI_MyClass_opShortIntD; +import test.Ice.operations.Test.AMI_MyClass_opShortIntLong; +import test.Ice.operations.Test.AMI_MyClass_opShortIntLongS; +import test.Ice.operations.Test.AMI_MyClass_opShortIntLongSS; +import test.Ice.operations.Test.AMI_MyClass_opString; +import test.Ice.operations.Test.AMI_MyClass_opStringMyEnumD; +import test.Ice.operations.Test.AMI_MyClass_opStringS; +import test.Ice.operations.Test.AMI_MyClass_opStringSS; +import test.Ice.operations.Test.AMI_MyClass_opStringSSS; +import test.Ice.operations.Test.AMI_MyClass_opStringStringD; +import test.Ice.operations.Test.AMI_MyClass_opStruct; +import test.Ice.operations.Test.AMI_MyClass_opVoid; +import test.Ice.operations.Test.AMI_MyDerivedClass_opDerived; +import test.Ice.operations.Test.AMI_MyClass_opMyStructMyEnumD; +import test.Ice.operations.Test.AnotherStruct; +import test.Ice.operations.Test.MyClassPrx; +import test.Ice.operations.Test.MyClassPrxHelper; +import test.Ice.operations.Test.MyDerivedClassPrx; +import test.Ice.operations.Test.MyDerivedClassPrxHelper; +import test.Ice.operations.Test.MyEnum; +import test.Ice.operations.Test.Structure; +import test.Ice.operations.Test.MyStruct; + class TwowaysAMI { private static void @@ -60,7 +100,7 @@ class TwowaysAMI private boolean _called; } - private static class AMI_MyClass_opVoidI extends Test.AMI_MyClass_opVoid + private static class AMI_MyClass_opVoidI extends AMI_MyClass_opVoid { public void ice_response() @@ -83,7 +123,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opVoidExI extends Test.AMI_MyClass_opVoid + private static class AMI_MyClass_opVoidExI extends AMI_MyClass_opVoid { public void ice_response() @@ -107,7 +147,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opByteI extends Test.AMI_MyClass_opByte + private static class AMI_MyClass_opByteI extends AMI_MyClass_opByte { public void ice_response(byte r, byte b) @@ -132,7 +172,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opByteExI extends Test.AMI_MyClass_opByte + private static class AMI_MyClass_opByteExI extends AMI_MyClass_opByte { public void ice_response(byte r, byte b) @@ -156,7 +196,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opBoolI extends Test.AMI_MyClass_opBool + private static class AMI_MyClass_opBoolI extends AMI_MyClass_opBool { public void ice_response(boolean r, boolean b) @@ -181,7 +221,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opShortIntLongI extends Test.AMI_MyClass_opShortIntLong + private static class AMI_MyClass_opShortIntLongI extends AMI_MyClass_opShortIntLong { public void ice_response(long r, short s, int i, long l) @@ -208,7 +248,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opFloatDoubleI extends Test.AMI_MyClass_opFloatDouble + private static class AMI_MyClass_opFloatDoubleI extends AMI_MyClass_opFloatDouble { public void ice_response(double r, float f, double d) @@ -234,7 +274,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opStringI extends Test.AMI_MyClass_opString + private static class AMI_MyClass_opStringI extends AMI_MyClass_opString { public void ice_response(String r, String s) @@ -259,13 +299,13 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opMyEnumI extends Test.AMI_MyClass_opMyEnum + private static class AMI_MyClass_opMyEnumI extends AMI_MyClass_opMyEnum { public void - ice_response(Test.MyEnum r, Test.MyEnum e) + ice_response(MyEnum r, MyEnum e) { - test(e == Test.MyEnum.enum2); - test(r == Test.MyEnum.enum3); + test(e == MyEnum.enum2); + test(r == MyEnum.enum3); callback.called(); } @@ -284,7 +324,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opMyClassI extends Test.AMI_MyClass_opMyClass + private static class AMI_MyClass_opMyClassI extends AMI_MyClass_opMyClass { AMI_MyClass_opMyClassI(Ice.Communicator communicator) { @@ -292,7 +332,7 @@ class TwowaysAMI } public void - ice_response(Test.MyClassPrx r, Test.MyClassPrx c1, Test.MyClassPrx c2) + ice_response(MyClassPrx r, MyClassPrx c1, MyClassPrx c2) { test(c1.ice_getIdentity().equals(_communicator.stringToIdentity("test"))); test(c2.ice_getIdentity().equals(_communicator.stringToIdentity("noSuchIdentity"))); @@ -330,7 +370,7 @@ class TwowaysAMI private Ice.Communicator _communicator; } - private static class AMI_MyClass_opStructI extends Test.AMI_MyClass_opStruct + private static class AMI_MyClass_opStructI extends AMI_MyClass_opStruct { AMI_MyClass_opStructI(Ice.Communicator communicator) { @@ -338,12 +378,12 @@ class TwowaysAMI } public void - ice_response(Test.Structure rso, Test.Structure so) + ice_response(Structure rso, Structure so) { test(rso.p == null); - test(rso.e == Test.MyEnum.enum2); + test(rso.e == MyEnum.enum2); test(rso.s.s.equals("def")); - test(so.e == Test.MyEnum.enum3); + test(so.e == MyEnum.enum3); test(so.s.s.equals("a new string")); // We can't do the callbacks below in connection serialization mode. if(_communicator.getProperties().getPropertyAsInt("Ice.ThreadPool.Client.Serialize") == 0) @@ -369,7 +409,7 @@ class TwowaysAMI private Ice.Communicator _communicator; } - private static class AMI_MyClass_opByteSI extends Test.AMI_MyClass_opByteS + private static class AMI_MyClass_opByteSI extends AMI_MyClass_opByteS { public void ice_response(byte[] rso, byte[] bso) @@ -406,7 +446,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opBoolSI extends Test.AMI_MyClass_opBoolS + private static class AMI_MyClass_opBoolSI extends AMI_MyClass_opBoolS { public void ice_response(boolean[] rso, boolean[] bso) @@ -438,7 +478,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opShortIntLongSI extends Test.AMI_MyClass_opShortIntLongS + private static class AMI_MyClass_opShortIntLongSI extends AMI_MyClass_opShortIntLongS { public void ice_response(long[] rso, short[] sso, int[] iso, @@ -482,7 +522,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opFloatDoubleSI extends Test.AMI_MyClass_opFloatDoubleS + private static class AMI_MyClass_opFloatDoubleSI extends AMI_MyClass_opFloatDoubleS { public void ice_response(double[] rso, float[] fso, double[] dso) @@ -518,7 +558,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opStringSI extends Test.AMI_MyClass_opStringS + private static class AMI_MyClass_opStringSI extends AMI_MyClass_opStringS { public void ice_response(String[] rso, String[] sso) @@ -550,7 +590,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opByteSSI extends Test.AMI_MyClass_opByteSS + private static class AMI_MyClass_opByteSSI extends AMI_MyClass_opByteSS { public void ice_response(byte[][] rso, byte[][] bso) @@ -592,7 +632,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opBoolSSI extends Test.AMI_MyClass_opBoolSS + private static class AMI_MyClass_opBoolSSI extends AMI_MyClass_opBoolSS { public void ice_response(boolean[][] rso, boolean[][] bso) @@ -615,7 +655,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opShortIntLongSSI extends Test.AMI_MyClass_opShortIntLongSS + private static class AMI_MyClass_opShortIntLongSSI extends AMI_MyClass_opShortIntLongSS { public void ice_response(long[][] rso, short[][] sso, int[][] iso, long[][] lso) @@ -638,7 +678,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opFloatDoubleSSI extends Test.AMI_MyClass_opFloatDoubleSS + private static class AMI_MyClass_opFloatDoubleSSI extends AMI_MyClass_opFloatDoubleSS { public void ice_response(double[][] rso, float[][] fso, double[][] dso) @@ -681,7 +721,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opStringSSI extends Test.AMI_MyClass_opStringSS + private static class AMI_MyClass_opStringSSI extends AMI_MyClass_opStringSS { public void ice_response(String[][] rso, String[][] sso) @@ -719,7 +759,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opStringSSSI extends Test.AMI_MyClass_opStringSSS + private static class AMI_MyClass_opStringSSSI extends AMI_MyClass_opStringSSS { public void ice_response(String[][][] rsso, String[][][] ssso) @@ -774,7 +814,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opByteBoolDI extends Test.AMI_MyClass_opByteBoolD + private static class AMI_MyClass_opByteBoolDI extends AMI_MyClass_opByteBoolD { public void ice_response(java.util.Map _ro, java.util.Map __do) @@ -809,7 +849,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opShortIntDI extends Test.AMI_MyClass_opShortIntD + private static class AMI_MyClass_opShortIntDI extends AMI_MyClass_opShortIntD { public void ice_response(java.util.Map _ro, java.util.Map __do) @@ -844,7 +884,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opLongFloatDI extends Test.AMI_MyClass_opLongFloatD + private static class AMI_MyClass_opLongFloatDI extends AMI_MyClass_opLongFloatD { public void ice_response(java.util.Map _ro, java.util.Map __do) @@ -879,7 +919,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opStringStringDI extends Test.AMI_MyClass_opStringStringD + private static class AMI_MyClass_opStringStringDI extends AMI_MyClass_opStringStringD { public void ice_response(java.util.Map _ro, java.util.Map __do) @@ -914,23 +954,23 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opStringMyEnumDI extends Test.AMI_MyClass_opStringMyEnumD + private static class AMI_MyClass_opStringMyEnumDI extends AMI_MyClass_opStringMyEnumD { public void ice_response(java.util.Map _ro, java.util.Map __do) { // TODO: Fix the parameters and remove the casts below when the Java2 mapping is removed. - java.util.Map<String, Test.MyEnum> ro = (java.util.Map<String, Test.MyEnum>)_ro; - java.util.Map<String, Test.MyEnum> _do = (java.util.Map<String, Test.MyEnum>)__do; - java.util.Map<String, Test.MyEnum> di1 = new java.util.HashMap<String, Test.MyEnum>(); - di1.put("abc", Test.MyEnum.enum1); - di1.put("", Test.MyEnum.enum2); + java.util.Map<String, MyEnum> ro = (java.util.Map<String, MyEnum>)_ro; + java.util.Map<String, MyEnum> _do = (java.util.Map<String, MyEnum>)__do; + java.util.Map<String, MyEnum> di1 = new java.util.HashMap<String, MyEnum>(); + di1.put("abc", MyEnum.enum1); + di1.put("", MyEnum.enum2); test(_do.equals(di1)); test(ro.size() == 4); - test(ro.get("abc") == Test.MyEnum.enum1); - test(ro.get("qwerty") == Test.MyEnum.enum3); - test(ro.get("") == Test.MyEnum.enum2); - test(ro.get("Hello!!") == Test.MyEnum.enum2); + test(ro.get("abc") == MyEnum.enum1); + test(ro.get("qwerty") == MyEnum.enum3); + test(ro.get("") == MyEnum.enum2); + test(ro.get("Hello!!") == MyEnum.enum2); callback.called(); } @@ -949,27 +989,27 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opMyStructMyEnumDI extends Test.AMI_MyClass_opMyStructMyEnumD + private static class AMI_MyClass_opMyStructMyEnumDI extends AMI_MyClass_opMyStructMyEnumD { public void ice_response(java.util.Map _ro, java.util.Map __do) { // TODO: Fix the parameters and remove the casts below when the Java2 mapping is removed. - Test.MyStruct s11 = new Test.MyStruct(1, 1); - Test.MyStruct s12 = new Test.MyStruct(1, 2); - java.util.Map<Test.MyStruct, Test.MyEnum> ro = (java.util.Map<Test.MyStruct, Test.MyEnum>)_ro; - java.util.Map<Test.MyStruct, Test.MyEnum> _do = (java.util.Map<Test.MyStruct, Test.MyEnum>)__do; - java.util.Map<Test.MyStruct, Test.MyEnum> di1 = new java.util.HashMap<Test.MyStruct, Test.MyEnum>(); - di1.put(s11, Test.MyEnum.enum1); - di1.put(s12, Test.MyEnum.enum2); + MyStruct s11 = new MyStruct(1, 1); + MyStruct s12 = new MyStruct(1, 2); + java.util.Map<MyStruct, MyEnum> ro = (java.util.Map<MyStruct, MyEnum>)_ro; + java.util.Map<MyStruct, MyEnum> _do = (java.util.Map<MyStruct, MyEnum>)__do; + java.util.Map<MyStruct, MyEnum> di1 = new java.util.HashMap<MyStruct, MyEnum>(); + di1.put(s11, MyEnum.enum1); + di1.put(s12, MyEnum.enum2); test(_do.equals(di1)); - Test.MyStruct s22 = new Test.MyStruct(2, 2); - Test.MyStruct s23 = new Test.MyStruct(2, 3); + MyStruct s22 = new MyStruct(2, 2); + MyStruct s23 = new MyStruct(2, 3); test(ro.size() == 4); - test(ro.get(s11) == Test.MyEnum.enum1); - test(ro.get(s12) == Test.MyEnum.enum2); - test(ro.get(s22) == Test.MyEnum.enum3); - test(ro.get(s23) == Test.MyEnum.enum2); + test(ro.get(s11) == MyEnum.enum1); + test(ro.get(s12) == MyEnum.enum2); + test(ro.get(s22) == MyEnum.enum3); + test(ro.get(s23) == MyEnum.enum2); callback.called(); } @@ -988,7 +1028,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opIntSI extends Test.AMI_MyClass_opIntS + private static class AMI_MyClass_opIntSI extends AMI_MyClass_opIntS { AMI_MyClass_opIntSI(int l) { @@ -1022,7 +1062,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opContextEqualI extends Test.AMI_MyClass_opContext + private static class AMI_MyClass_opContextEqualI extends AMI_MyClass_opContext { AMI_MyClass_opContextEqualI(java.util.Map<String, String> d) { @@ -1052,7 +1092,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opContextNotEqualI extends Test.AMI_MyClass_opContext + private static class AMI_MyClass_opContextNotEqualI extends AMI_MyClass_opContext { AMI_MyClass_opContextNotEqualI(java.util.Map<String, String> d) { @@ -1082,7 +1122,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyDerivedClass_opDerivedI extends Test.AMI_MyDerivedClass_opDerived + private static class AMI_MyDerivedClass_opDerivedI extends AMI_MyDerivedClass_opDerived { public void ice_response() @@ -1105,7 +1145,7 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opDoubleMarshalingI extends Test.AMI_MyClass_opDoubleMarshaling + private static class AMI_MyClass_opDoubleMarshalingI extends AMI_MyClass_opDoubleMarshaling { public void ice_response() @@ -1129,12 +1169,14 @@ class TwowaysAMI } static void - twowaysAMI(Ice.Communicator communicator, Test.MyClassPrx p) + twowaysAMI(test.Util.Application app, MyClassPrx p) { + Ice.Communicator communicator = app.communicator(); + { // Check that a call to a void operation raises NoEndpointException // in the ice_exception() callback instead of at the point of call. - Test.MyClassPrx indirect = Test.MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); + MyClassPrx indirect = MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); AMI_MyClass_opVoidExI cb = new AMI_MyClass_opVoidExI(); try { @@ -1150,7 +1192,7 @@ class TwowaysAMI { // Check that a call to a twoway operation raises NoEndpointException // in the ice_exception() callback instead of at the point of call. - Test.MyClassPrx indirect = Test.MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); + MyClassPrx indirect = MyClassPrxHelper.uncheckedCast(p.ice_adapterId("dummy")); AMI_MyClass_opByteExI cb = new AMI_MyClass_opByteExI(); try { @@ -1176,9 +1218,9 @@ class TwowaysAMI // Check that CommunicatorDestroyedException is raised directly. Ice.InitializationData initData = new Ice.InitializationData(); initData.properties = communicator.getProperties()._clone(); - Ice.Communicator ic = Ice.Util.initialize(initData); + Ice.Communicator ic = app.initialize(initData); Ice.ObjectPrx obj = ic.stringToProxy(p.ice_toString()); - Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(obj); + MyClassPrx p2 = MyClassPrxHelper.checkedCast(obj); ic.destroy(); @@ -1230,7 +1272,7 @@ class TwowaysAMI { AMI_MyClass_opMyEnumI cb = new AMI_MyClass_opMyEnumI(); - p.opMyEnum_async(cb, Test.MyEnum.enum2); + p.opMyEnum_async(cb, MyEnum.enum2); test(cb.check()); } @@ -1241,15 +1283,15 @@ class TwowaysAMI } { - Test.Structure si1 = new Test.Structure(); + Structure si1 = new Structure(); si1.p = p; - si1.e = Test.MyEnum.enum3; - si1.s = new Test.AnotherStruct(); + si1.e = MyEnum.enum3; + si1.s = new AnotherStruct(); si1.s.s = "abc"; - Test.Structure si2 = new Test.Structure(); + Structure si2 = new Structure(); si2.p = null; - si2.e = Test.MyEnum.enum2; - si2.s = new Test.AnotherStruct(); + si2.e = MyEnum.enum2; + si2.s = new AnotherStruct(); si2.s.s = "def"; AMI_MyClass_opStructI cb = new AMI_MyClass_opStructI(communicator); @@ -1466,13 +1508,13 @@ class TwowaysAMI } { - java.util.Map<String, Test.MyEnum> di1 = new java.util.HashMap<String, Test.MyEnum>(); - di1.put("abc", Test.MyEnum.enum1); - di1.put("", Test.MyEnum.enum2); - java.util.Map<String, Test.MyEnum> di2 = new java.util.HashMap<String, Test.MyEnum>(); - di2.put("abc", Test.MyEnum.enum1); - di2.put("qwerty", Test.MyEnum.enum3); - di2.put("Hello!!", Test.MyEnum.enum2); + java.util.Map<String, MyEnum> di1 = new java.util.HashMap<String, MyEnum>(); + di1.put("abc", MyEnum.enum1); + di1.put("", MyEnum.enum2); + java.util.Map<String, MyEnum> di2 = new java.util.HashMap<String, MyEnum>(); + di2.put("abc", MyEnum.enum1); + di2.put("qwerty", MyEnum.enum3); + di2.put("Hello!!", MyEnum.enum2); AMI_MyClass_opStringMyEnumDI cb = new AMI_MyClass_opStringMyEnumDI(); p.opStringMyEnumD_async(cb, di1, di2); @@ -1480,17 +1522,17 @@ class TwowaysAMI } { - Test.MyStruct s11 = new Test.MyStruct(1, 1); - Test.MyStruct s12 = new Test.MyStruct(1, 2); - java.util.Map<Test.MyStruct, Test.MyEnum> di1 = new java.util.HashMap<Test.MyStruct, Test.MyEnum>(); - di1.put(s11, Test.MyEnum.enum1); - di1.put(s12, Test.MyEnum.enum2); - Test.MyStruct s22 = new Test.MyStruct(2, 2); - Test.MyStruct s23 = new Test.MyStruct(2, 3); - java.util.Map<Test.MyStruct, Test.MyEnum> di2 = new java.util.HashMap<Test.MyStruct, Test.MyEnum>(); - di2.put(s11, Test.MyEnum.enum1); - di2.put(s22, Test.MyEnum.enum3); - di2.put(s23, Test.MyEnum.enum2); + MyStruct s11 = new MyStruct(1, 1); + MyStruct s12 = new MyStruct(1, 2); + java.util.Map<MyStruct, MyEnum> di1 = new java.util.HashMap<MyStruct, MyEnum>(); + di1.put(s11, MyEnum.enum1); + di1.put(s12, MyEnum.enum2); + MyStruct s22 = new MyStruct(2, 2); + MyStruct s23 = new MyStruct(2, 3); + java.util.Map<MyStruct, MyEnum> di2 = new java.util.HashMap<MyStruct, MyEnum>(); + di2.put(s11, MyEnum.enum1); + di2.put(s22, MyEnum.enum3); + di2.put(s23, MyEnum.enum2); AMI_MyClass_opMyStructMyEnumDI cb = new AMI_MyClass_opMyStructMyEnumDI(); p.opMyStructMyEnumD_async(cb, di1, di2); @@ -1530,7 +1572,7 @@ class TwowaysAMI p.opContext_async(cb, ctx); test(cb.check()); } - Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx)); + MyClassPrx p2 = MyClassPrxHelper.checkedCast(p.ice_context(ctx)); test(p2.ice_getContext().equals(ctx)); { AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); @@ -1557,7 +1599,7 @@ class TwowaysAMI test(cb.check()); } - p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_context(new java.util.HashMap<String, String>())); + p2 = MyClassPrxHelper.uncheckedCast(p.ice_context(new java.util.HashMap<String, String>())); { AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(new java.util.HashMap<String, String>()); @@ -1565,7 +1607,7 @@ class TwowaysAMI test(cb.check()); } - p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_defaultContext()); + p2 = MyClassPrxHelper.uncheckedCast(p.ice_defaultContext()); { AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(dflt); p2.opContext_async(cb); @@ -1581,7 +1623,7 @@ class TwowaysAMI } communicator.setDefaultContext(dflt); - Test.MyClassPrx c = Test.MyClassPrxHelper.checkedCast( + MyClassPrx c = MyClassPrxHelper.checkedCast( communicator.stringToProxy("test:default -p 12010 -t 10000")); { java.util.HashMap<String, String> tmp = new java.util.HashMap<String, String>(); @@ -1592,7 +1634,7 @@ class TwowaysAMI } dflt.put("a", "c"); - Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_context(dflt)); + MyClassPrx c2 = MyClassPrxHelper.uncheckedCast(c.ice_context(dflt)); { java.util.HashMap<String, String> tmp = new java.util.HashMap<String, String>(); tmp.put("a", "c"); @@ -1602,7 +1644,7 @@ class TwowaysAMI } dflt.clear(); - Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_context(dflt)); + MyClassPrx c3 = MyClassPrxHelper.uncheckedCast(c2.ice_context(dflt)); { java.util.HashMap<String, String> tmp = new java.util.HashMap<String, String>(); AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); @@ -1610,7 +1652,7 @@ class TwowaysAMI test(cb.check()); } - Test.MyClassPrx c4 = Test.MyClassPrxHelper.uncheckedCast(c.ice_defaultContext()); + MyClassPrx c4 = MyClassPrxHelper.uncheckedCast(c.ice_defaultContext()); { java.util.HashMap<String, String> tmp = new java.util.HashMap<String, String>(); tmp.put("a", "b"); @@ -1622,7 +1664,7 @@ class TwowaysAMI dflt.put("a", "d"); communicator.setDefaultContext(dflt); - Test.MyClassPrx c5 = Test.MyClassPrxHelper.uncheckedCast(c.ice_defaultContext()); + MyClassPrx c5 = MyClassPrxHelper.uncheckedCast(c.ice_defaultContext()); { java.util.HashMap<String, String> tmp = new java.util.HashMap<String, String>(); tmp.put("a", "d"); @@ -1648,15 +1690,15 @@ class TwowaysAMI initData.properties = communicator.getProperties()._clone(); initData.properties.setProperty("Ice.ImplicitContext", impls[i]); - Ice.Communicator ic = Ice.Util.initialize(initData); + Ice.Communicator ic = app.initialize(initData); java.util.Map<String, String> ctx = new java.util.HashMap<String, String>(); ctx.put("one", "ONE"); ctx.put("two", "TWO"); ctx.put("three", "THREE"); - Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast( - ic.stringToProxy("test:default -p 12010 -t 10000")); + MyClassPrx p3 = MyClassPrxHelper.uncheckedCast( + ic.stringToProxy("test:default -p 12010 -t 20000")); ic.getImplicitContext().setContext(ctx); test(ic.getImplicitContext().getContext().equals(ctx)); @@ -1683,7 +1725,7 @@ class TwowaysAMI combined.putAll(prxContext); test(combined.get("one").equals("UN")); - p3 = Test.MyClassPrxHelper.uncheckedCast(p3.ice_context(prxContext)); + p3 = MyClassPrxHelper.uncheckedCast(p3.ice_context(prxContext)); ic.getImplicitContext().setContext(null); { @@ -1716,7 +1758,7 @@ class TwowaysAMI } { - Test.MyDerivedClassPrx derived = Test.MyDerivedClassPrxHelper.checkedCast(p); + MyDerivedClassPrx derived = MyDerivedClassPrxHelper.checkedCast(p); test(derived != null); AMI_MyDerivedClass_opDerivedI cb = new AMI_MyDerivedClass_opDerivedI(); derived.opDerived_async(cb); diff --git a/java/test/Ice/operations/build.xml b/java/test/Ice/operations/build.xml deleted file mode 100644 index 48ad1c5562e..00000000000 --- a/java/test/Ice/operations/build.xml +++ /dev/null @@ -1,51 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_operations" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - <includepath> - <pathelement path="${slice.dir}" /> - </includepath> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/operations/run.py b/java/test/Ice/operations/run.py index 6fee41d3e94..07f6b811416 100755 --- a/java/test/Ice/operations/run.py +++ b/java/test/Ice/operations/run.py @@ -24,10 +24,7 @@ print "tests with regular server." TestUtil.clientServerTest() print "tests with AMD server." -import copy -amdenv = copy.deepcopy(os.environ) -TestUtil.addClasspath(os.path.join(os.getcwd(), "..", "operationsAMD", "classes"), amdenv) -TestUtil.clientServerTest(serverenv = amdenv) +TestUtil.clientServerTest(server="test.Ice.operations.AMDServer") print "tests with collocated server." TestUtil.collocatedTest() diff --git a/java/test/Ice/operationsAMD/Server.java b/java/test/Ice/operationsAMD/Server.java deleted file mode 100644 index 14189454f1d..00000000000 --- a/java/test/Ice/operationsAMD/Server.java +++ /dev/null @@ -1,63 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -public class Server -{ - private static int - run(String[] args, Ice.Communicator communicator) - { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000:udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - adapter.add(new MyDerivedClassI(), communicator.stringToIdentity("test")); - adapter.activate(); - - communicator.waitForShutdown(); - return 0; - } - - public static void - main(String[] args) - { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); - - initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - - communicator = Ice.Util.initialize(argsH, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - - System.gc(); - System.exit(status); - } -} diff --git a/java/test/Ice/operationsAMD/build.xml b/java/test/Ice/operationsAMD/build.xml deleted file mode 100644 index f85428c5854..00000000000 --- a/java/test/Ice/operationsAMD/build.xml +++ /dev/null @@ -1,51 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_operationsAMD" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="TestAMD.ice"/> - <includepath> - <pathelement path="${slice.dir}" /> - </includepath> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/package/Client.java b/java/test/Ice/package/Client.java deleted file mode 100644 index d126c6f4fe5..00000000000 --- a/java/test/Ice/package/Client.java +++ /dev/null @@ -1,53 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -public class Client -{ - private static int - run(String[] args, Ice.Communicator communicator) - { - Test.InitialPrx initial = AllTests.allTests(communicator); - initial.shutdown(); - return 0; - } - - public static void - main(String[] args) - { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - - System.gc(); - System.exit(status); - } -} diff --git a/java/test/Ice/package/Server.java b/java/test/Ice/package/Server.java deleted file mode 100644 index 8b14a4d713a..00000000000 --- a/java/test/Ice/package/Server.java +++ /dev/null @@ -1,57 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -public class Server -{ - private static int - run(String[] args, Ice.Communicator communicator) - { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.Object object = new InitialI(); - adapter.add(object, communicator.stringToIdentity("initial")); - adapter.activate(); - communicator.waitForShutdown(); - return 0; - } - - public static void - main(String[] args) - { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - - System.gc(); - System.exit(status); - } -} diff --git a/java/test/Ice/package/build.xml b/java/test/Ice/package/build.xml deleted file mode 100644 index e037ff089b8..00000000000 --- a/java/test/Ice/package/build.xml +++ /dev/null @@ -1,51 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_package" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="NoPackage.ice Package.ice Test.ice"/> - <includepath> - <pathelement path="." /> - </includepath> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/package/AllTests.java b/java/test/Ice/packagemd/AllTests.java index 97352227889..d9d89374de5 100644 --- a/java/test/Ice/package/AllTests.java +++ b/java/test/Ice/packagemd/AllTests.java @@ -7,6 +7,18 @@ // // ********************************************************************** +package test.Ice.packagemd; + +import java.io.PrintWriter; + +import test.Ice.packagemd.Test.InitialPrx; +import test.Ice.packagemd.Test.InitialPrxHelper; +import test.Ice.packagemd.Test1.C1; +import test.Ice.packagemd.Test1.C2; +import test.Ice.packagemd.Test1.E1; +import test.Ice.packagemd.Test1.E2; +import test.Ice.packagemd.Test1._notify; + public class AllTests { private static void @@ -18,72 +30,46 @@ public class AllTests } } - private static class TestFactory implements Ice.ObjectFactory - { - public Ice.Object - create(String type) - { - _invoked = true; - return null; - } - - public void - destroy() - { - // Nothing to do - } - - boolean - invoked() - { - boolean r = _invoked; - _invoked = false; - return r; - } - - private boolean _invoked = false; - } - - public static Test.InitialPrx - allTests(Ice.Communicator communicator) + public static InitialPrx + allTests(Ice.Communicator communicator, PrintWriter out) { - System.out.print("testing stringToProxy... "); - System.out.flush(); + out.print("testing stringToProxy... "); + out.flush(); String ref = "initial:default -p 12010 -t 10000"; Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing checked cast... "); - System.out.flush(); - Test.InitialPrx initial = Test.InitialPrxHelper.checkedCast(base); + out.print("testing checked cast... "); + out.flush(); + InitialPrx initial = InitialPrxHelper.checkedCast(base); test(initial != null); test(initial.equals(base)); - System.out.println("ok"); + out.println("ok"); { - System.out.print("testing types without package... "); - System.out.flush(); - Test1.C1 c1 = initial.getTest1C2AsC1(); + out.print("testing types without package... "); + out.flush(); + C1 c1 = initial.getTest1C2AsC1(); test(c1 != null); - test(c1 instanceof Test1.C2); - Test1.C2 c2 = initial.getTest1C2AsC2(); + test(c1 instanceof C2); + C2 c2 = initial.getTest1C2AsC2(); test(c2 != null); try { initial.throwTest1E2AsE1(); test(false); } - catch(Test1.E1 ex) + catch(E1 ex) { - test(ex instanceof Test1.E2); + test(ex instanceof E2); } try { initial.throwTest1E2AsE2(); test(false); } - catch(Test1.E2 ex) + catch(E2 ex) { // Expected } @@ -92,16 +78,16 @@ public class AllTests initial.throwTest1Notify(); test(false); } - catch(Test1._notify ex) + catch(_notify ex) { // Expected } - System.out.println("ok"); + out.println("ok"); } { - System.out.print("testing types with package... "); - System.out.flush(); + out.print("testing types with package... "); + out.flush(); { try @@ -113,7 +99,7 @@ public class AllTests { // Expected } - catch(testpkg.Test2.E1 ex) + catch(test.Ice.packagemd.testpkg.Test2.E1 ex) { test(false); } @@ -126,7 +112,7 @@ public class AllTests { // Expected } - catch(testpkg.Test2.E1 ex) + catch(test.Ice.packagemd.testpkg.Test2.E1 ex) { test(false); } @@ -136,27 +122,27 @@ public class AllTests // // Define Ice.Package.Test2=testpkg and try again. // - communicator.getProperties().setProperty("Ice.Package.Test2", "testpkg"); - testpkg.Test2.C1 c1 = initial.getTest2C2AsC1(); + communicator.getProperties().setProperty("Ice.Package.Test2", "test.Ice.packagemd.testpkg"); + test.Ice.packagemd.testpkg.Test2.C1 c1 = initial.getTest2C2AsC1(); test(c1 != null); - test(c1 instanceof testpkg.Test2.C2); - testpkg.Test2.C2 c2 = initial.getTest2C2AsC2(); + test(c1 instanceof test.Ice.packagemd.testpkg.Test2.C2); + test.Ice.packagemd.testpkg.Test2.C2 c2 = initial.getTest2C2AsC2(); test(c2 != null); try { initial.throwTest2E2AsE1(); test(false); } - catch(testpkg.Test2.E1 ex) + catch(test.Ice.packagemd.testpkg.Test2.E1 ex) { - test(ex instanceof testpkg.Test2.E2); + test(ex instanceof test.Ice.packagemd.testpkg.Test2.E2); } try { initial.throwTest2E2AsE2(); test(false); } - catch(testpkg.Test2.E2 ex) + catch(test.Ice.packagemd.testpkg.Test2.E2 ex) { // Expected } @@ -168,33 +154,33 @@ public class AllTests // the Test2.* types again (with this communicator) because factories // have already been cached for them, so now we use the Test3.* types. // - communicator.getProperties().setProperty("Ice.Default.Package", "testpkg"); - testpkg.Test3.C1 c1 = initial.getTest3C2AsC1(); + communicator.getProperties().setProperty("Ice.Default.Package", "test.Ice.packagemd.testpkg"); + test.Ice.packagemd.testpkg.Test3.C1 c1 = initial.getTest3C2AsC1(); test(c1 != null); - test(c1 instanceof testpkg.Test3.C2); - testpkg.Test3.C2 c2 = initial.getTest3C2AsC2(); + test(c1 instanceof test.Ice.packagemd.testpkg.Test3.C2); + test.Ice.packagemd.testpkg.Test3.C2 c2 = initial.getTest3C2AsC2(); test(c2 != null); try { initial.throwTest3E2AsE1(); test(false); } - catch(testpkg.Test3.E1 ex) + catch(test.Ice.packagemd.testpkg.Test3.E1 ex) { - test(ex instanceof testpkg.Test3.E2); + test(ex instanceof test.Ice.packagemd.testpkg.Test3.E2); } try { initial.throwTest3E2AsE2(); test(false); } - catch(testpkg.Test3.E2 ex) + catch(test.Ice.packagemd.testpkg.Test3.E2 ex) { // Expected } } - System.out.println("ok"); + out.println("ok"); } return initial; diff --git a/java/test/Ice/packagemd/Client.java b/java/test/Ice/packagemd/Client.java new file mode 100644 index 00000000000..b58fc968da4 --- /dev/null +++ b/java/test/Ice/packagemd/Client.java @@ -0,0 +1,41 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.packagemd; + +import test.Ice.packagemd.Test.InitialPrx; + +public class Client extends test.Util.Application +{ + public int run(String[] args) + { + InitialPrx initial = AllTests.allTests(communicator(), getWriter()); + initial.shutdown(); + return 0; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.packagemd"); + initData.properties.setProperty("Ice.Package.Test1", "test.Ice.packagemd"); + return initData; + } + + public static void main(String[] args) + { + Client c = new Client(); + int status = c.main("Client", args); + + System.gc(); + System.exit(status); + } +} diff --git a/java/test/Ice/package/InitialI.java b/java/test/Ice/packagemd/InitialI.java index f7d51e629bb..5296066418d 100644 --- a/java/test/Ice/package/InitialI.java +++ b/java/test/Ice/packagemd/InitialI.java @@ -7,109 +7,118 @@ // // ********************************************************************** -public final class InitialI extends Test._InitialDisp +package test.Ice.packagemd; + +import test.Ice.packagemd.Test._InitialDisp; +import test.Ice.packagemd.Test1.C1; +import test.Ice.packagemd.Test1.C2; +import test.Ice.packagemd.Test1.E1; +import test.Ice.packagemd.Test1.E2; +import test.Ice.packagemd.Test1._notify; + +public final class InitialI extends _InitialDisp { public Ice.Object getTest1C2AsObject(Ice.Current __current) { - return new Test1.C2(); + return new C2(); } - public Test1.C1 + public C1 getTest1C2AsC1(Ice.Current __current) { - return new Test1.C2(); + return new C2(); } - public Test1.C2 + public C2 getTest1C2AsC2(Ice.Current __current) { - return new Test1.C2(); + return new C2(); } public void throwTest1E2AsE1(Ice.Current __current) - throws Test1.E1 + throws E1 { - throw new Test1.E2(); + throw new E2(); } public void throwTest1E2AsE2(Ice.Current __current) - throws Test1.E2 + throws E2 { - throw new Test1.E2(); + throw new E2(); } public void throwTest1Notify(Ice.Current __current) - throws Test1._notify + throws _notify { - throw new Test1._notify(); + throw new _notify(); } public Ice.Object getTest2C2AsObject(Ice.Current __current) { - return new testpkg.Test2.C2(); + return new test.Ice.packagemd.testpkg.Test2.C2(); } - public testpkg.Test2.C1 + public test.Ice.packagemd.testpkg.Test2.C1 getTest2C2AsC1(Ice.Current __current) { - return new testpkg.Test2.C2(); + return new test.Ice.packagemd.testpkg.Test2.C2(); } - public testpkg.Test2.C2 + public test.Ice.packagemd.testpkg.Test2.C2 getTest2C2AsC2(Ice.Current __current) { - return new testpkg.Test2.C2(); + return new test.Ice.packagemd.testpkg.Test2.C2(); } public void throwTest2E2AsE1(Ice.Current __current) - throws testpkg.Test2.E1 + throws test.Ice.packagemd.testpkg.Test2.E1 { - throw new testpkg.Test2.E2(); + throw new test.Ice.packagemd.testpkg.Test2.E2(); } public void throwTest2E2AsE2(Ice.Current __current) - throws testpkg.Test2.E2 + throws test.Ice.packagemd.testpkg.Test2.E2 { - throw new testpkg.Test2.E2(); + throw new test.Ice.packagemd.testpkg.Test2.E2(); } public Ice.Object getTest3C2AsObject(Ice.Current __current) { - return new testpkg.Test3.C2(); + return new test.Ice.packagemd.testpkg.Test3.C2(); } - public testpkg.Test3.C1 + public test.Ice.packagemd.testpkg.Test3.C1 getTest3C2AsC1(Ice.Current __current) { - return new testpkg.Test3.C2(); + return new test.Ice.packagemd.testpkg.Test3.C2(); } - public testpkg.Test3.C2 + public test.Ice.packagemd.testpkg.Test3.C2 getTest3C2AsC2(Ice.Current __current) { - return new testpkg.Test3.C2(); + return new test.Ice.packagemd.testpkg.Test3.C2(); } public void throwTest3E2AsE1(Ice.Current __current) - throws testpkg.Test3.E1 + throws test.Ice.packagemd.testpkg.Test3.E1 { - throw new testpkg.Test3.E2(); + throw new test.Ice.packagemd.testpkg.Test3.E2(); } public void throwTest3E2AsE2(Ice.Current __current) - throws testpkg.Test3.E2 + throws test.Ice.packagemd.testpkg.Test3.E2 { - throw new testpkg.Test3.E2(); + throw new test.Ice.packagemd.testpkg.Test3.E2(); } public void diff --git a/java/test/Ice/package/NoPackage.ice b/java/test/Ice/packagemd/NoPackage.ice index 73e9ad175b6..3292fed5ffd 100644 --- a/java/test/Ice/package/NoPackage.ice +++ b/java/test/Ice/packagemd/NoPackage.ice @@ -7,6 +7,7 @@ // // ********************************************************************** +[["java:package:test.Ice.packagemd"]] module Test1 { class C1 diff --git a/java/test/Ice/package/Package.ice b/java/test/Ice/packagemd/Package.ice index bc9c0b83361..828334d9a9e 100644 --- a/java/test/Ice/package/Package.ice +++ b/java/test/Ice/packagemd/Package.ice @@ -7,8 +7,7 @@ // // ********************************************************************** -[["java:package:testpkg"]] - +[["java:package:test.Ice.packagemd.testpkg"]] module Test2 { class C1 diff --git a/java/test/Ice/packagemd/Server.java b/java/test/Ice/packagemd/Server.java new file mode 100644 index 00000000000..541aa3c512a --- /dev/null +++ b/java/test/Ice/packagemd/Server.java @@ -0,0 +1,42 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.packagemd; + +public class Server extends test.Util.Application +{ + public int run(String[] args) + { + Ice.Communicator communicator = communicator(); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.Object object = new InitialI(); + adapter.add(object, communicator.stringToIdentity("initial")); + adapter.activate(); + return WAIT; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.packagemd"); + initData.properties.setProperty("Ice.Package.Test1", "test.Ice.packagemd"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + return initData; + } + + public static void main(String[] args) + { + Server c = new Server(); + int status = c.main("Server", args); + + System.gc(); + System.exit(status); + } +} diff --git a/java/test/Ice/package/Test.ice b/java/test/Ice/packagemd/Test.ice index 8069b3083a2..d8c16f843e6 100644 --- a/java/test/Ice/package/Test.ice +++ b/java/test/Ice/packagemd/Test.ice @@ -10,8 +10,10 @@ #include <Package.ice> #include <NoPackage.ice> +[["java:package:test.Ice.packagemd"]] module Test { + interface Initial { Test1::C1 getTest1C2AsC1(); @@ -32,4 +34,5 @@ interface Initial void shutdown(); }; + }; diff --git a/java/test/Ice/package/run.py b/java/test/Ice/packagemd/run.py index bb34e7d35b7..bb34e7d35b7 100755 --- a/java/test/Ice/package/run.py +++ b/java/test/Ice/packagemd/run.py diff --git a/java/test/Ice/proxyAMD/MyDerivedClassI.java b/java/test/Ice/proxy/AMDMyDerivedClassI.java index 75ff8d685f4..3e5cff990b5 100644 --- a/java/test/Ice/proxyAMD/MyDerivedClassI.java +++ b/java/test/Ice/proxy/AMDMyDerivedClassI.java @@ -7,15 +7,21 @@ // // ********************************************************************** -public final class MyDerivedClassI extends Test.MyDerivedClass +package test.Ice.proxy; +import test.Ice.proxyAMD.Test.AMD_MyClass_getContext; +import test.Ice.proxyAMD.Test.AMD_MyClass_shutdown; +import test.Ice.proxyAMD.Test.AMD_MyDerivedClass_echo; +import test.Ice.proxyAMD.Test.MyDerivedClass; + +public final class AMDMyDerivedClassI extends MyDerivedClass { public - MyDerivedClassI() + AMDMyDerivedClassI() { } public void - echo_async(Test.AMD_MyDerivedClass_echo cb, + echo_async(AMD_MyDerivedClass_echo cb, Ice.ObjectPrx obj, Ice.Current c) { @@ -23,7 +29,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - shutdown_async(Test.AMD_MyClass_shutdown cb, + shutdown_async(AMD_MyClass_shutdown cb, Ice.Current c) { c.adapter.getCommunicator().shutdown(); @@ -31,7 +37,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass } public void - getContext_async(Test.AMD_MyClass_getContext cb, Ice.Current current) + getContext_async(AMD_MyClass_getContext cb, Ice.Current current) { cb.ice_response(_ctx); } diff --git a/java/test/Ice/proxy/AMDServer.java b/java/test/Ice/proxy/AMDServer.java new file mode 100644 index 00000000000..3520fc171f2 --- /dev/null +++ b/java/test/Ice/proxy/AMDServer.java @@ -0,0 +1,40 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.proxy; + +public class AMDServer extends test.Util.Application +{ + public int run(String[] args) + { + Ice.Communicator communicator = communicator(); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + adapter.add(new AMDMyDerivedClassI(), communicator.stringToIdentity("test")); + adapter.activate(); + + return WAIT; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000:udp"); + return initData; + } + + public static void main(String[] args) + { + AMDServer app = new AMDServer(); + int result = app.main("AMDServer", args); + System.gc(); + System.exit(result); + } +} diff --git a/java/test/Ice/proxy/AllTests.java b/java/test/Ice/proxy/AllTests.java index 50862f47e1c..a2b54a1c01e 100644 --- a/java/test/Ice/proxy/AllTests.java +++ b/java/test/Ice/proxy/AllTests.java @@ -7,6 +7,14 @@ // // ********************************************************************** +package test.Ice.proxy; +import java.io.PrintWriter; + +import test.Ice.proxy.Test.MyClassPrx; +import test.Ice.proxy.Test.MyClassPrxHelper; +import test.Ice.proxy.Test.MyDerivedClassPrx; +import test.Ice.proxy.Test.MyDerivedClassPrxHelper; + public class AllTests { private static void @@ -18,11 +26,11 @@ public class AllTests } } - public static Test.MyClassPrx - allTests(Ice.Communicator communicator) + public static MyClassPrx + allTests(Ice.Communicator communicator, PrintWriter out) { - System.out.print("testing stringToProxy... "); - System.out.flush(); + out.print("testing stringToProxy... "); + out.flush(); String ref = "test:default -p 12010 -t 10000"; Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); @@ -221,10 +229,10 @@ public class AllTests catch(Ice.EndpointParseException ex) { } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing propertyToProxy... "); - System.out.flush(); + out.print("testing propertyToProxy... "); + out.flush(); Ice.Properties prop = communicator.getProperties(); String propertyPrefix = "Foo.Proxy"; prop.setProperty(propertyPrefix, "test:default -p 12010 -t 10000"); @@ -311,15 +319,15 @@ public class AllTests test(!b1.ice_isCollocationOptimized()); prop.setProperty(property, ""); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing ice_getCommunicator... "); - System.out.flush(); + out.print("testing ice_getCommunicator... "); + out.flush(); test(base.ice_getCommunicator() == communicator); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing proxy methods... "); - System.out.flush(); + out.print("testing proxy methods... "); + out.flush(); test(communicator.identityToString( base.ice_identity(communicator.stringToIdentity("other")).ice_getIdentity()).equals("other")); test(base.ice_facet("facet").ice_getFacet().equals("facet")); @@ -335,10 +343,10 @@ public class AllTests test(!base.ice_collocationOptimized(false).ice_isCollocationOptimized()); test(base.ice_preferSecure(true).ice_isPreferSecure()); test(!base.ice_preferSecure(false).ice_isPreferSecure()); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing proxy comparison... "); - System.out.flush(); + out.print("testing proxy comparison... "); + out.flush(); test(communicator.stringToProxy("foo").equals(communicator.stringToProxy("foo"))); test(!communicator.stringToProxy("foo").equals(communicator.stringToProxy("foo2"))); @@ -421,21 +429,21 @@ public class AllTests // // TODO: Ideally we should also test comparison of fixed proxies. // - System.out.println("ok"); + out.println("ok"); - System.out.print("testing checked cast... "); - System.out.flush(); - Test.MyClassPrx cl = Test.MyClassPrxHelper.checkedCast(base); + out.print("testing checked cast... "); + out.flush(); + MyClassPrx cl = MyClassPrxHelper.checkedCast(base); test(cl != null); - Test.MyDerivedClassPrx derived = Test.MyDerivedClassPrxHelper.checkedCast(cl); + MyDerivedClassPrx derived = MyDerivedClassPrxHelper.checkedCast(cl); test(derived != null); test(cl.equals(base)); test(derived.equals(base)); test(cl.equals(derived)); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing checked cast with context... "); - System.out.flush(); + out.print("testing checked cast with context... "); + out.flush(); java.util.Map<String, String> c = cl.getContext(); test(c == null || c.size() == 0); @@ -443,13 +451,13 @@ public class AllTests c = new java.util.HashMap<String, String>(); c.put("one", "hello"); c.put("two", "world"); - cl = Test.MyClassPrxHelper.checkedCast(base, c); + cl = MyClassPrxHelper.checkedCast(base, c); java.util.Map<String, String> c2 = cl.getContext(); test(c.equals(c2)); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing opaque endpoints... "); - System.out.flush(); + out.print("testing opaque endpoints... "); + out.flush(); try { @@ -632,7 +640,7 @@ public class AllTests } } - System.out.println("ok"); + out.println("ok"); return cl; } diff --git a/java/test/Ice/proxy/Client.java b/java/test/Ice/proxy/Client.java index 62e11df5601..4c4e73cbe08 100644 --- a/java/test/Ice/proxy/Client.java +++ b/java/test/Ice/proxy/Client.java @@ -7,51 +7,33 @@ // // ********************************************************************** -public class Client +package test.Ice.proxy; + +import test.Ice.proxy.Test.MyClassPrx; + +public class Client extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { - Test.MyClassPrx myClass = AllTests.allTests(communicator); + Ice.Communicator communicator = communicator(); + MyClassPrx myClass = AllTests.allTests(communicator, getWriter()); myClass.shutdown(); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); - - communicator = Ice.Util.initialize(argsH, initData); - status = run(argsH.value, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy"); + return initData; + } + public static void main(String[] args) + { + Client app = new Client(); + int result = app.main("Client", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/proxy/Collocated.java b/java/test/Ice/proxy/Collocated.java index 11dc99c01e8..14b2f385879 100644 --- a/java/test/Ice/proxy/Collocated.java +++ b/java/test/Ice/proxy/Collocated.java @@ -7,54 +7,36 @@ // // ********************************************************************** -public class Collocated +package test.Ice.proxy; + +public class Collocated extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { + Ice.Communicator communicator = communicator(); communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new MyDerivedClassI(), communicator.stringToIdentity("test")); adapter.activate(); - AllTests.allTests(communicator); + AllTests.allTests(communicator, getWriter()); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); - communicator = Ice.Util.initialize(argsH, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy"); + return initData; + } - System.exit(status); + public static void main(String[] args) + { + Collocated app = new Collocated(); + int result = app.main(" extends", args); + System.gc(); + System.exit(result); } } diff --git a/java/test/Ice/proxy/MyDerivedClassI.java b/java/test/Ice/proxy/MyDerivedClassI.java index 64fb542d69b..2ca1b15a755 100644 --- a/java/test/Ice/proxy/MyDerivedClassI.java +++ b/java/test/Ice/proxy/MyDerivedClassI.java @@ -7,7 +7,10 @@ // // ********************************************************************** -public final class MyDerivedClassI extends Test.MyDerivedClass +package test.Ice.proxy; +import test.Ice.proxy.Test.MyDerivedClass; + +public final class MyDerivedClassI extends MyDerivedClass { public MyDerivedClassI() diff --git a/java/test/Ice/proxy/Server.java b/java/test/Ice/proxy/Server.java index 807bd7f6363..3842b98103b 100644 --- a/java/test/Ice/proxy/Server.java +++ b/java/test/Ice/proxy/Server.java @@ -7,54 +7,33 @@ // // ********************************************************************** -public class Server +package test.Ice.proxy; + +public class Server extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + Ice.Communicator communicator = communicator(); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new MyDerivedClassI(), communicator.stringToIdentity("test")); adapter.activate(); - - communicator.waitForShutdown(); - return 0; + return WAIT; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); - communicator = Ice.Util.initialize(argsH, initData); - status = run(argsH.value, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.proxy"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + return initData; + } + public static void main(String[] args) + { + Server app = new Server(); + int result = app.main("Server", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/proxy/Test.ice b/java/test/Ice/proxy/Test.ice index 90db7303858..64b4b6cad11 100644 --- a/java/test/Ice/proxy/Test.ice +++ b/java/test/Ice/proxy/Test.ice @@ -12,6 +12,7 @@ #include <Ice/Current.ice> +[["java:package:test.Ice.proxy"]] module Test { diff --git a/java/test/Ice/proxyAMD/TestAMD.ice b/java/test/Ice/proxy/TestAMD.ice index 0b88c93de99..330b2bce087 100644 --- a/java/test/Ice/proxyAMD/TestAMD.ice +++ b/java/test/Ice/proxy/TestAMD.ice @@ -12,6 +12,7 @@ #include<Ice/Current.ice> +[["java:package:test.Ice.proxyAMD"]] module Test { diff --git a/java/test/Ice/proxy/build.xml b/java/test/Ice/proxy/build.xml deleted file mode 100644 index 48ad1c5562e..00000000000 --- a/java/test/Ice/proxy/build.xml +++ /dev/null @@ -1,51 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_operations" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - <includepath> - <pathelement path="${slice.dir}" /> - </includepath> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/proxy/run.py b/java/test/Ice/proxy/run.py index 739d5ae9903..4b6874e1f37 100755 --- a/java/test/Ice/proxy/run.py +++ b/java/test/Ice/proxy/run.py @@ -24,10 +24,7 @@ print "tests with regular server." TestUtil.clientServerTest() print "tests with AMD server." -import copy -amdenv = copy.deepcopy(os.environ) -TestUtil.addClasspath(os.path.join(os.getcwd(), "..", "proxyAMD", "classes"), amdenv) -TestUtil.clientServerTest(serverenv = amdenv) +TestUtil.clientServerTest(server="test.Ice.proxy.AMDServer") print "tests with collocated server." TestUtil.collocatedTest() diff --git a/java/test/Ice/proxyAMD/Server.java b/java/test/Ice/proxyAMD/Server.java deleted file mode 100644 index 7564f506231..00000000000 --- a/java/test/Ice/proxyAMD/Server.java +++ /dev/null @@ -1,63 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -public class Server -{ - private static int - run(String[] args, Ice.Communicator communicator) - { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000:udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - adapter.add(new MyDerivedClassI(), communicator.stringToIdentity("test")); - adapter.activate(); - - communicator.waitForShutdown(); - return 0; - } - - public static void - main(String[] args) - { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); - - initData.properties.setProperty("Ice.Warn.Connections", "0"); - - communicator = Ice.Util.initialize(argsH, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - - System.gc(); - System.exit(status); - } -} diff --git a/java/test/Ice/proxyAMD/build.xml b/java/test/Ice/proxyAMD/build.xml deleted file mode 100644 index f85428c5854..00000000000 --- a/java/test/Ice/proxyAMD/build.xml +++ /dev/null @@ -1,51 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_operationsAMD" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="TestAMD.ice"/> - <includepath> - <pathelement path="${slice.dir}" /> - </includepath> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/retry/AllTests.java b/java/test/Ice/retry/AllTests.java index c1c3532132c..a151a88e768 100644 --- a/java/test/Ice/retry/AllTests.java +++ b/java/test/Ice/retry/AllTests.java @@ -7,6 +7,14 @@ // // ********************************************************************** +package test.Ice.retry; + +import java.io.PrintWriter; + +import test.Ice.retry.Test.AMI_Retry_op; +import test.Ice.retry.Test.RetryPrx; +import test.Ice.retry.Test.RetryPrxHelper; + public class AllTests { private static void @@ -60,7 +68,7 @@ public class AllTests private boolean _called; } - private static class AMIRegular extends Test.AMI_Retry_op + private static class AMIRegular extends AMI_Retry_op { public void ice_response() @@ -83,7 +91,7 @@ public class AllTests private Callback callback = new Callback(); } - private static class AMIException extends Test.AMI_Retry_op + private static class AMIException extends AMI_Retry_op { public void ice_response() @@ -107,8 +115,8 @@ public class AllTests private Callback callback = new Callback(); } - public static Test.RetryPrx - allTests(Ice.Communicator communicator, java.io.PrintStream out) + public static RetryPrx + allTests(Ice.Communicator communicator, PrintWriter out) { out.print("testing stringToProxy... "); out.flush(); @@ -121,10 +129,10 @@ public class AllTests out.print("testing checked cast... "); out.flush(); - Test.RetryPrx retry1 = Test.RetryPrxHelper.checkedCast(base1); + RetryPrx retry1 = RetryPrxHelper.checkedCast(base1); test(retry1 != null); test(retry1.equals(base1)); - Test.RetryPrx retry2 = Test.RetryPrxHelper.checkedCast(base2); + RetryPrx retry2 = RetryPrxHelper.checkedCast(base2); test(retry2 != null); test(retry2.equals(base2)); out.println("ok"); diff --git a/java/test/Ice/retry/Client.java b/java/test/Ice/retry/Client.java index 0a2fad21024..52150ba5b75 100644 --- a/java/test/Ice/retry/Client.java +++ b/java/test/Ice/retry/Client.java @@ -7,61 +7,43 @@ // // ********************************************************************** -public class Client +package test.Ice.retry; + +import test.Ice.retry.Test.RetryPrx; + +public class Client extends test.Util.Application { - public static int - run(String[] args, Ice.Communicator communicator, java.io.PrintStream out) + public int run(String[] args) { - Test.RetryPrx retry = AllTests.allTests(communicator, out); + Ice.Communicator communicator = communicator(); + RetryPrx retry = AllTests.allTests(communicator, getWriter()); retry.shutdown(); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); - - // - // For this test, we want to disable retries. - // - initData.properties.setProperty("Ice.RetryIntervals", "-1"); - - // - // We don't want connection warnings because of the timeout test. - // - initData.properties.setProperty("Ice.Warn.Connections", "0"); - - communicator = Ice.Util.initialize(argsH, initData); - status = run(argsH.value, communicator, System.out); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry"); + // + // For this test, we want to disable retries. + // + initData.properties.setProperty("Ice.RetryIntervals", "-1"); + + // + // We don't want connection warnings because of the timeout + // + initData.properties.setProperty("Ice.Warn.Connections", "0"); + + return initData; + } + public static void main(String[] args) + { + Client app = new Client(); + int result = app.main("Client", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/retry/RetryI.java b/java/test/Ice/retry/RetryI.java index 1f5a2f92c99..b5ea317bea5 100644 --- a/java/test/Ice/retry/RetryI.java +++ b/java/test/Ice/retry/RetryI.java @@ -7,7 +7,8 @@ // // ********************************************************************** -import Test.*; +package test.Ice.retry; +import test.Ice.retry.Test._RetryDisp; public final class RetryI extends _RetryDisp { diff --git a/java/test/Ice/retry/Server.java b/java/test/Ice/retry/Server.java index d7c66ff182a..95243590107 100644 --- a/java/test/Ice/retry/Server.java +++ b/java/test/Ice/retry/Server.java @@ -7,60 +7,33 @@ // // ********************************************************************** -public class Server +package test.Ice.retry; + +public class Server extends test.Util.Application { - public static int - run(String[] args, Ice.Communicator communicator, java.io.PrintStream out) + public int run(String[] args) { - // - // When running as a MIDlet the properties for the server may be - // overridden by configuration. If it isn't then we assume - // defaults. - // - if(communicator.getProperties().getProperty("TestAdapter.Endpoints").length() == 0) - { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - } - + Ice.Communicator communicator = communicator(); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new RetryI(), communicator.stringToIdentity("retry")); adapter.activate(); - - communicator.waitForShutdown(); - return 0; + return WAIT; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator, System.out); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.retry"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + return initData; + } + public static void main(String[] args) + { + Server app = new Server(); + int result = app.main("Server", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/retry/Test.ice b/java/test/Ice/retry/Test.ice index 6a48fa388a3..ce1ac277675 100644 --- a/java/test/Ice/retry/Test.ice +++ b/java/test/Ice/retry/Test.ice @@ -10,6 +10,7 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Ice.retry"]] module Test { diff --git a/java/test/Ice/retry/build.xml b/java/test/Ice/retry/build.xml deleted file mode 100644 index bba491f0941..00000000000 --- a/java/test/Ice/retry/build.xml +++ /dev/null @@ -1,51 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_retry" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - <includepath> - <pathelement path="${slice.dir}" /> - </includepath> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/seqMapping/AMDMyClassI.java b/java/test/Ice/seqMapping/AMDMyClassI.java new file mode 100644 index 00000000000..0866e4d113a --- /dev/null +++ b/java/test/Ice/seqMapping/AMDMyClassI.java @@ -0,0 +1,40 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.seqMapping; + +import test.Ice.seqMappingAMD.Test.*; +import test.Ice.seqMapping.Serialize.*; + +public final class AMDMyClassI extends MyClass +{ + public void + shutdown_async(AMD_MyClass_shutdown cb, Ice.Current current) + { + current.adapter.getCommunicator().shutdown(); + cb.ice_response(); + } + + public void + opSerialSmallJava_async(AMD_MyClass_opSerialSmallJava cb, Small i, Ice.Current current) + { + cb.ice_response(i, i); + } + + public void + opSerialLargeJava_async(AMD_MyClass_opSerialLargeJava cb, Large i, Ice.Current current) + { + cb.ice_response(i, i); + } + + public void opSerialStructJava_async(AMD_MyClass_opSerialStructJava cb, Struct i, Ice.Current current) + { + cb.ice_response(i, i); + } +} diff --git a/java/test/Ice/seqMapping/AMDServer.java b/java/test/Ice/seqMapping/AMDServer.java new file mode 100644 index 00000000000..f6d7ada57c9 --- /dev/null +++ b/java/test/Ice/seqMapping/AMDServer.java @@ -0,0 +1,41 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.seqMapping; + +public class AMDServer extends test.Util.Application +{ + public int + run(String[] args) + { + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + adapter.add(new AMDMyClassI(), communicator().stringToIdentity("test")); + adapter.activate(); + + return WAIT; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMappingAMD"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + return initData; + } + + public static void main(String[] args) + { + AMDServer c = new AMDServer(); + int status = c.main("AMDServer", args); + + System.gc(); + System.exit(status); + } +} diff --git a/java/test/Ice/seqMapping/AllTests.java b/java/test/Ice/seqMapping/AllTests.java index e95f38943cc..f966d195c81 100644 --- a/java/test/Ice/seqMapping/AllTests.java +++ b/java/test/Ice/seqMapping/AllTests.java @@ -7,26 +7,32 @@ // // ********************************************************************** +package test.Ice.seqMapping; + +import java.io.PrintWriter; + +import test.Ice.seqMapping.Test.*; + public class AllTests { - public static Test.MyClassPrx - allTests(Ice.Communicator communicator, boolean collocated) + public static MyClassPrx + allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out) { String ref = "test:default -p 12010 -t 10000"; Ice.ObjectPrx baseProxy = communicator.stringToProxy(ref); - Test.MyClassPrx cl = Test.MyClassPrxHelper.checkedCast(baseProxy); + MyClassPrx cl = MyClassPrxHelper.checkedCast(baseProxy); - System.out.print("testing twoway operations... "); - System.out.flush(); - Twoways.twoways(communicator, cl); - System.out.println("ok"); + out.print("testing twoway operations... "); + out.flush(); + Twoways.twoways(cl); + out.println("ok"); if(!collocated) { - System.out.print("testing twoway operations with AMI... "); - System.out.flush(); - TwowaysAMI.twowaysAMI(communicator, cl); - System.out.println("ok"); + out.print("testing twoway operations with AMI... "); + out.flush(); + TwowaysAMI.twowaysAMI(cl); + out.println("ok"); } return cl; diff --git a/java/test/Ice/seqMapping/Client.java b/java/test/Ice/seqMapping/Client.java index dff52ec6dd6..50f10b56976 100644 --- a/java/test/Ice/seqMapping/Client.java +++ b/java/test/Ice/seqMapping/Client.java @@ -7,50 +7,39 @@ // // ********************************************************************** -public class Client +package test.Ice.seqMapping; + +import test.Ice.seqMapping.Test.*; + +public class Client extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int + run(String[] args) { - Test.MyClassPrx myClass = AllTests.allTests(communicator, false); + java.io.PrintWriter out = getWriter(); + + MyClassPrx myClass = AllTests.allTests(communicator(), false, out); - System.out.print("shutting down server... "); - System.out.flush(); + out.print("shutting down server... "); + out.flush(); myClass.shutdown(); - System.out.println("ok"); + out.println("ok"); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping"); + return initData; + } + + public static void main(String[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Client c = new Client(); + int status = c.main("Client", args); System.gc(); System.exit(status); diff --git a/java/test/Ice/seqMapping/Collocated.java b/java/test/Ice/seqMapping/Collocated.java index 64843c27243..ecf8050ab8c 100644 --- a/java/test/Ice/seqMapping/Collocated.java +++ b/java/test/Ice/seqMapping/Collocated.java @@ -7,51 +7,40 @@ // // ********************************************************************** -public class Collocated +package test.Ice.seqMapping; + +import test.Ice.seqMapping.Test.*; + +public class Collocated extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int + run(String[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - adapter.add(new MyClassI(), communicator.stringToIdentity("test")); + java.io.PrintWriter out = getWriter(); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + adapter.add(new MyClassI(), communicator().stringToIdentity("test")); adapter.activate(); - AllTests.allTests(communicator, true); + AllTests.allTests(communicator(), true, out); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + return initData; + } + + public static void main(String[] args) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Collocated c = new Collocated(); + int status = c.main("Collocated", args); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/seqMapping/MyClassI.java b/java/test/Ice/seqMapping/MyClassI.java index 5622e7415d2..bbd0724b838 100644 --- a/java/test/Ice/seqMapping/MyClassI.java +++ b/java/test/Ice/seqMapping/MyClassI.java @@ -7,7 +7,12 @@ // // ********************************************************************** -public final class MyClassI extends Test.MyClass +package test.Ice.seqMapping; + +import test.Ice.seqMapping.Test.*; +import test.Ice.seqMapping.Serialize.*; + +public final class MyClassI extends MyClass { private static void test(boolean b) @@ -24,19 +29,19 @@ public final class MyClassI extends Test.MyClass current.adapter.getCommunicator().shutdown(); } - public Serialize.Small opSerialSmallJava(Serialize.Small i, Ice.Holder<Serialize.Small> o, Ice.Current current) + public Small opSerialSmallJava(Small i, Ice.Holder<Small> o, Ice.Current current) { o.value = i; return i; } - public Serialize.Large opSerialLargeJava(Serialize.Large i, Ice.Holder<Serialize.Large> o, Ice.Current current) + public Large opSerialLargeJava(Large i, Ice.Holder<Large> o, Ice.Current current) { o.value = i; return i; } - public Serialize.Struct opSerialStructJava(Serialize.Struct i, Ice.Holder<Serialize.Struct> o, Ice.Current current) + public Struct opSerialStructJava(Struct i, Ice.Holder<Struct> o, Ice.Current current) { o.value = i; return i; diff --git a/java/test/Ice/seqMapping/Serialize/Large.java b/java/test/Ice/seqMapping/Serialize/Large.java index 188bbe59fac..2d4c96331ba 100644 --- a/java/test/Ice/seqMapping/Serialize/Large.java +++ b/java/test/Ice/seqMapping/Serialize/Large.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Serialize; +package test.Ice.seqMapping.Serialize; public class Large implements java.io.Serializable // More than 254 bytes when serialized. { diff --git a/java/test/Ice/seqMapping/Serialize/Small.java b/java/test/Ice/seqMapping/Serialize/Small.java index be92e68edea..a4a539538d9 100644 --- a/java/test/Ice/seqMapping/Serialize/Small.java +++ b/java/test/Ice/seqMapping/Serialize/Small.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Serialize; +package test.Ice.seqMapping.Serialize; public class Small implements java.io.Serializable // Fewer than 254 bytes when serialized. { diff --git a/java/test/Ice/seqMappingAMD/Serialize/SmallHolder.java b/java/test/Ice/seqMapping/Serialize/SmallHolder.java index 66776ade146..23268a36624 100644 --- a/java/test/Ice/seqMappingAMD/Serialize/SmallHolder.java +++ b/java/test/Ice/seqMapping/Serialize/SmallHolder.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Serialize; +package test.Ice.seqMapping.Serialize; public class SmallHolder { diff --git a/java/test/Ice/seqMapping/Serialize/Struct.java b/java/test/Ice/seqMapping/Serialize/Struct.java index c40d95b3c75..05aac11c81c 100644 --- a/java/test/Ice/seqMapping/Serialize/Struct.java +++ b/java/test/Ice/seqMapping/Serialize/Struct.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Serialize; +package test.Ice.seqMapping.Serialize; public class Struct implements java.io.Serializable // Used to test that null members marshal correctly. { diff --git a/java/test/Ice/seqMappingAMD/Serialize/StructHolder.java b/java/test/Ice/seqMapping/Serialize/StructHolder.java index 8bf50b75215..f2df361778a 100644 --- a/java/test/Ice/seqMappingAMD/Serialize/StructHolder.java +++ b/java/test/Ice/seqMapping/Serialize/StructHolder.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Serialize; +package test.Ice.seqMapping.Serialize; public class StructHolder { diff --git a/java/test/Ice/seqMapping/Server.java b/java/test/Ice/seqMapping/Server.java index e77a401ddca..f8fc5ea2460 100644 --- a/java/test/Ice/seqMapping/Server.java +++ b/java/test/Ice/seqMapping/Server.java @@ -7,49 +7,35 @@ // // ********************************************************************** -public class Server +package test.Ice.seqMapping; + +import test.Ice.seqMapping.Test.*; + +public class Server extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int + run(String[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - adapter.add(new MyClassI(), communicator.stringToIdentity("test")); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + adapter.add(new MyClassI(), communicator().stringToIdentity("test")); adapter.activate(); - communicator.waitForShutdown(); - return 0; + return WAIT; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.seqMapping"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); + return initData; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + public static void main(String[] args) + { + Server c = new Server(); + int status = c.main("Server", args); System.gc(); System.exit(status); diff --git a/java/test/Ice/seqMapping/Test.ice b/java/test/Ice/seqMapping/Test.ice index 3ffe3a4140b..ded8f55d5c4 100644 --- a/java/test/Ice/seqMapping/Test.ice +++ b/java/test/Ice/seqMapping/Test.ice @@ -10,12 +10,13 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Ice.seqMapping"]] module Test { -["java:serializable:Serialize.Small"] sequence<byte> SerialSmall; -["java:serializable:Serialize.Large"] sequence<byte> SerialLarge; -["java:serializable:Serialize.Struct"] sequence<byte> SerialStruct; +["java:serializable:test.Ice.seqMapping.Serialize.Small"] sequence<byte> SerialSmall; +["java:serializable:test.Ice.seqMapping.Serialize.Large"] sequence<byte> SerialLarge; +["java:serializable:test.Ice.seqMapping.Serialize.Struct"] sequence<byte> SerialStruct; ["ami"] class MyClass { diff --git a/java/test/Ice/seqMappingAMD/TestAMD.ice b/java/test/Ice/seqMapping/TestAMD.ice index 88a987c9eec..ec95bdf2c7a 100644 --- a/java/test/Ice/seqMappingAMD/TestAMD.ice +++ b/java/test/Ice/seqMapping/TestAMD.ice @@ -10,12 +10,13 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Ice.seqMappingAMD"]] module Test { -["java:serializable:Serialize.Small"] sequence<byte> SerialSmall; -["java:serializable:Serialize.Large"] sequence<byte> SerialLarge; -["java:serializable:Serialize.Struct"] sequence<byte> SerialStruct; +["java:serializable:test.Ice.seqMapping.Serialize.Small"] sequence<byte> SerialSmall; +["java:serializable:test.Ice.seqMapping.Serialize.Large"] sequence<byte> SerialLarge; +["java:serializable:test.Ice.seqMapping.Serialize.Struct"] sequence<byte> SerialStruct; ["ami", "amd"] class MyClass { diff --git a/java/test/Ice/seqMapping/Twoways.java b/java/test/Ice/seqMapping/Twoways.java index 4e88edaa74d..73a94b316c3 100644 --- a/java/test/Ice/seqMapping/Twoways.java +++ b/java/test/Ice/seqMapping/Twoways.java @@ -7,6 +7,11 @@ // // ********************************************************************** +package test.Ice.seqMapping; + +import test.Ice.seqMapping.Test.*; +import test.Ice.seqMapping.Serialize.*; + class Twoways { private static void @@ -19,12 +24,12 @@ class Twoways } static void - twoways(Ice.Communicator communicator, Test.MyClassPrx p) + twoways(MyClassPrx p) { { - Serialize.Small i = null; - Ice.Holder<Serialize.Small> o = new Ice.Holder<Serialize.Small>(); - Serialize.Small r; + Small i = null; + Ice.Holder<Small> o = new Ice.Holder<Small>(); + Small r; r = p.opSerialSmallJava(i, o); @@ -33,10 +38,10 @@ class Twoways } { - Serialize.Small i = new Serialize.Small(); + Small i = new Small(); i.i = 99; - Ice.Holder<Serialize.Small> o = new Ice.Holder<Serialize.Small>(); - Serialize.Small r; + Ice.Holder<Small> o = new Ice.Holder<Small>(); + Small r; try { @@ -52,7 +57,7 @@ class Twoways } { - Serialize.Large i = new Serialize.Large(); + Large i = new Large(); i.d1 = 1.0; i.d2 = 2.0; i.d3 = 3.0; @@ -63,8 +68,8 @@ class Twoways i.d8 = 8.0; i.d9 = 9.0; i.d10 = 10.0; - Ice.Holder<Serialize.Large> o = new Ice.Holder<Serialize.Large>(); - Serialize.Large r; + Ice.Holder<Large> o = new Ice.Holder<Large>(); + Large r; try { @@ -98,13 +103,13 @@ class Twoways } { - Serialize.Struct i = new Serialize.Struct(); + Struct i = new Struct(); i.o = null; i.o2 = i; i.s = null; i.s2 = "Hello"; - Ice.Holder<Serialize.Struct> o = new Ice.Holder<Serialize.Struct>(); - Serialize.Struct r; + Ice.Holder<Struct> o = new Ice.Holder<Struct>(); + Struct r; try { @@ -112,14 +117,14 @@ class Twoways test(o.value.o == null); test(o.value.o2 != null); - test(((Serialize.Struct)(o.value.o2)).o == null); - test(((Serialize.Struct)(o.value.o2)).o2 == o.value.o2); + test(((Struct)(o.value.o2)).o == null); + test(((Struct)(o.value.o2)).o2 == o.value.o2); test(o.value.s == null); test(o.value.s2.equals("Hello")); test(r.o == null); test(r.o2 != null); - test(((Serialize.Struct)(r.o2)).o == null); - test(((Serialize.Struct)(r.o2)).o2 == r.o2); + test(((Struct)(r.o2)).o == null); + test(((Struct)(r.o2)).o2 == r.o2); test(r.s == null); test(r.s2.equals("Hello")); } diff --git a/java/test/Ice/seqMapping/TwowaysAMI.java b/java/test/Ice/seqMapping/TwowaysAMI.java index ca3af245cb5..f47ed59951e 100644 --- a/java/test/Ice/seqMapping/TwowaysAMI.java +++ b/java/test/Ice/seqMapping/TwowaysAMI.java @@ -7,6 +7,11 @@ // // ********************************************************************** +package test.Ice.seqMapping; + +import test.Ice.seqMapping.Test.*; +import test.Ice.seqMapping.Serialize.*; + class TwowaysAMI { private static void @@ -60,10 +65,10 @@ class TwowaysAMI private boolean _called; } - private static class AMI_MyClass_opSerialSmallJavaNull extends Test.AMI_MyClass_opSerialSmallJava + private static class AMI_MyClass_opSerialSmallJavaNull extends AMI_MyClass_opSerialSmallJava { public void - ice_response(Serialize.Small r, Serialize.Small o) + ice_response(Small r, Small o) { test(o == null); test(r == null); @@ -85,10 +90,10 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opSerialSmallJava extends Test.AMI_MyClass_opSerialSmallJava + private static class AMI_MyClass_opSerialSmallJavaI extends AMI_MyClass_opSerialSmallJava { public void - ice_response(Serialize.Small r, Serialize.Small o) + ice_response(Small r, Small o) { test(o.i == 99); test(r.i == 99); @@ -110,10 +115,10 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opSerialLargeJava extends Test.AMI_MyClass_opSerialLargeJava + private static class AMI_MyClass_opSerialLargeJavaI extends AMI_MyClass_opSerialLargeJava { public void - ice_response(Serialize.Large r, Serialize.Large o) + ice_response(Large r, Large o) { test(o.d1 == 1.0); test(o.d2 == 2.0); @@ -153,21 +158,21 @@ class TwowaysAMI private Callback callback = new Callback(); } - private static class AMI_MyClass_opSerialStructJava extends Test.AMI_MyClass_opSerialStructJava + private static class AMI_MyClass_opSerialStructJavaI extends AMI_MyClass_opSerialStructJava { public void - ice_response(Serialize.Struct r, Serialize.Struct o) + ice_response(Struct r, Struct o) { test(o.o == null); test(o.o2 != null); - test(((Serialize.Struct)(o.o2)).o == null); - test(((Serialize.Struct)(o.o2)).o2 == o.o2); + test(((Struct)(o.o2)).o == null); + test(((Struct)(o.o2)).o2 == o.o2); test(o.s == null); test(o.s2.equals("Hello")); test(r.o == null); test(r.o2 != null); - test(((Serialize.Struct)(r.o2)).o == null); - test(((Serialize.Struct)(r.o2)).o2 == r.o2); + test(((Struct)(r.o2)).o == null); + test(((Struct)(r.o2)).o2 == r.o2); test(r.s == null); test(r.s2.equals("Hello")); callback.called(); @@ -189,10 +194,10 @@ class TwowaysAMI } static void - twowaysAMI(Ice.Communicator communicator, Test.MyClassPrx p) + twowaysAMI(MyClassPrx p) { { - Serialize.Small i = null; + Small i = null; AMI_MyClass_opSerialSmallJavaNull cb = new AMI_MyClass_opSerialSmallJavaNull(); p.opSerialSmallJava_async(cb, i); @@ -200,16 +205,16 @@ class TwowaysAMI } { - Serialize.Small i = new Serialize.Small(); + Small i = new Small(); i.i = 99; - AMI_MyClass_opSerialSmallJava cb = new AMI_MyClass_opSerialSmallJava(); + AMI_MyClass_opSerialSmallJavaI cb = new AMI_MyClass_opSerialSmallJavaI(); p.opSerialSmallJava_async(cb, i); test(cb.check()); } { - Serialize.Large i = new Serialize.Large(); + Large i = new Large(); i.d1 = 1.0; i.d2 = 2.0; i.d3 = 3.0; @@ -221,19 +226,19 @@ class TwowaysAMI i.d9 = 9.0; i.d10 = 10.0; - AMI_MyClass_opSerialLargeJava cb = new AMI_MyClass_opSerialLargeJava(); + AMI_MyClass_opSerialLargeJavaI cb = new AMI_MyClass_opSerialLargeJavaI(); p.opSerialLargeJava_async(cb, i); test(cb.check()); } { - Serialize.Struct i = new Serialize.Struct(); + Struct i = new Struct(); i.o = null; i.o2 = i; i.s = null; i.s2 = "Hello"; - AMI_MyClass_opSerialStructJava cb = new AMI_MyClass_opSerialStructJava(); + AMI_MyClass_opSerialStructJavaI cb = new AMI_MyClass_opSerialStructJavaI(); p.opSerialStructJava_async(cb, i); test(cb.check()); } diff --git a/java/test/Ice/seqMapping/run.py b/java/test/Ice/seqMapping/run.py index 09d700b9f48..b361826c48f 100755 --- a/java/test/Ice/seqMapping/run.py +++ b/java/test/Ice/seqMapping/run.py @@ -24,10 +24,7 @@ print "tests with regular server." TestUtil.clientServerTest() print "tests with AMD server." -import copy -amdenv = copy.deepcopy(os.environ) -TestUtil.addClasspath(os.path.join(os.getcwd(), "..", "seqMappingAMD", "classes"), amdenv) -TestUtil.clientServerTest(serverenv = amdenv) +TestUtil.clientServerTest(server="test.Ice.seqMapping.AMDServer") print "tests with collocated server." TestUtil.collocatedTest() diff --git a/java/test/Ice/seqMappingAMD/MyClassI.java b/java/test/Ice/seqMappingAMD/MyClassI.java deleted file mode 100644 index 61bbde13d70..00000000000 --- a/java/test/Ice/seqMappingAMD/MyClassI.java +++ /dev/null @@ -1,42 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -public final class MyClassI extends Test.MyClass -{ - public void - shutdown_async(Test.AMD_MyClass_shutdown cb, - Ice.Current current) - { - current.adapter.getCommunicator().shutdown(); - cb.ice_response(); - } - - public void - opSerialSmallJava_async(Test.AMD_MyClass_opSerialSmallJava cb, - Serialize.Small i, - Ice.Current current) - { - cb.ice_response(i, i); - } - - public void - opSerialLargeJava_async(Test.AMD_MyClass_opSerialLargeJava cb, - Serialize.Large i, - Ice.Current current) - { - cb.ice_response(i, i); - } - - public void opSerialStructJava_async(Test.AMD_MyClass_opSerialStructJava cb, - Serialize.Struct i, - Ice.Current current) - { - cb.ice_response(i, i); - } -} diff --git a/java/test/Ice/seqMappingAMD/Serialize/Large.java b/java/test/Ice/seqMappingAMD/Serialize/Large.java deleted file mode 100644 index 188bbe59fac..00000000000 --- a/java/test/Ice/seqMappingAMD/Serialize/Large.java +++ /dev/null @@ -1,24 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Serialize; - -public class Large implements java.io.Serializable // More than 254 bytes when serialized. -{ - public double d1; - public double d2; - public double d3; - public double d4; - public double d5; - public double d6; - public double d7; - public double d8; - public double d9; - public double d10; -} diff --git a/java/test/Ice/seqMappingAMD/Serialize/Small.java b/java/test/Ice/seqMappingAMD/Serialize/Small.java deleted file mode 100644 index be92e68edea..00000000000 --- a/java/test/Ice/seqMappingAMD/Serialize/Small.java +++ /dev/null @@ -1,15 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Serialize; - -public class Small implements java.io.Serializable // Fewer than 254 bytes when serialized. -{ - public int i; -} diff --git a/java/test/Ice/seqMappingAMD/Serialize/Struct.java b/java/test/Ice/seqMappingAMD/Serialize/Struct.java deleted file mode 100644 index c40d95b3c75..00000000000 --- a/java/test/Ice/seqMappingAMD/Serialize/Struct.java +++ /dev/null @@ -1,18 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package Serialize; - -public class Struct implements java.io.Serializable // Used to test that null members marshal correctly. -{ - public Object o; - public Object o2; - public String s; - public String s2; -} diff --git a/java/test/Ice/seqMappingAMD/Server.java b/java/test/Ice/seqMappingAMD/Server.java deleted file mode 100644 index ab531a55a60..00000000000 --- a/java/test/Ice/seqMappingAMD/Server.java +++ /dev/null @@ -1,57 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -public class Server -{ - private static int - run(String[] args, Ice.Communicator communicator) - { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000:udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - adapter.add(new MyClassI(), communicator.stringToIdentity("test")); - adapter.activate(); - - communicator.waitForShutdown(); - return 0; - } - - public static void - main(String[] args) - { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - - System.gc(); - System.exit(status); - } -} diff --git a/java/test/Ice/seqMappingAMD/build.xml b/java/test/Ice/seqMappingAMD/build.xml deleted file mode 100644 index e98924112fc..00000000000 --- a/java/test/Ice/seqMappingAMD/build.xml +++ /dev/null @@ -1,55 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_seqMappingAMD" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="TestAMD.ice"/> - <includepath> - <pathelement path="${slice.dir}" /> - </includepath> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="." destdir="${class.dir}" includes="Serialize/**" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**,Serialize/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/serialize/AllTests.java b/java/test/Ice/serialize/AllTests.java index 2a540d546df..ea69059e355 100644 --- a/java/test/Ice/serialize/AllTests.java +++ b/java/test/Ice/serialize/AllTests.java @@ -7,7 +7,8 @@ // // ********************************************************************** -import Test.*; +package test.Ice.serialize; +import test.Ice.serialize.Test.*; import java.io.*; public class AllTests @@ -22,14 +23,14 @@ public class AllTests } public static InitialPrx - allTests(Ice.Communicator communicator, boolean collocated) + allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out) { String ref = "initial:default -p 12010 -t 10000"; Ice.ObjectPrx base = communicator.stringToProxy(ref); InitialPrx initial = InitialPrxHelper.checkedCast(base); - System.out.print("testing serialization... "); - System.out.flush(); + out.print("testing serialization... "); + out.flush(); // // Call getStruct1 and force an error. @@ -105,7 +106,7 @@ public class AllTests test(false); } - System.out.println("ok"); + out.println("ok"); return initial; } diff --git a/java/test/Ice/serialize/Client.java b/java/test/Ice/serialize/Client.java index 74ab7531339..e09f126e984 100644 --- a/java/test/Ice/serialize/Client.java +++ b/java/test/Ice/serialize/Client.java @@ -7,47 +7,32 @@ // // ********************************************************************** -import Test.*; +package test.Ice.serialize; +import test.Ice.serialize.Test.*; -public class Client +public class Client extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int + run(String[] args) { - InitialPrx initial = AllTests.allTests(communicator, false); + java.io.PrintWriter out = getWriter(); + InitialPrx initial = AllTests.allTests(communicator(), false, out); initial.shutdown(); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.serialize"); + return initData; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + public static void main(String[] args) + { + Client c = new Client(); + int status = c.main("Client", args); System.gc(); System.exit(status); diff --git a/java/test/Ice/serialize/InitialI.java b/java/test/Ice/serialize/InitialI.java index 7973076b65e..8e217e892b6 100644 --- a/java/test/Ice/serialize/InitialI.java +++ b/java/test/Ice/serialize/InitialI.java @@ -7,7 +7,8 @@ // // ********************************************************************** -import Test.*; +package test.Ice.serialize; +import test.Ice.serialize.Test.*; import java.io.*; public final class InitialI extends _InitialDisp @@ -23,8 +24,8 @@ public final class InitialI extends _InitialDisp _s.f = (float)5.0; _s.d = 6.0; _s.str = "7"; - _s.e = Test.MyEnum.enum2; - _s.p = Test.InitialPrxHelper.uncheckedCast(adapter.createProxy(ident)); + _s.e = MyEnum.enum2; + _s.p = InitialPrxHelper.uncheckedCast(adapter.createProxy(ident)); _d = new Derived(); _d.b = _d; diff --git a/java/test/Ice/serialize/Server.java b/java/test/Ice/serialize/Server.java index 23e27a80f7d..93355a90da5 100644 --- a/java/test/Ice/serialize/Server.java +++ b/java/test/Ice/serialize/Server.java @@ -7,50 +7,36 @@ // // ********************************************************************** -public class Server +package test.Ice.serialize; +import test.Ice.serialize.Test.*; + +public class Server extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int + run(String[] args) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.Identity ident = communicator.stringToIdentity("initial"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + Ice.Identity ident = communicator().stringToIdentity("initial"); Ice.Object object = new InitialI(adapter, ident); adapter.add(object, ident); adapter.activate(); - communicator.waitForShutdown(); - return 0; + + return WAIT; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.serialize"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + return initData; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + public static void main(String[] args) + { + Server c = new Server(); + int status = c.main("Server", args); System.gc(); System.exit(status); diff --git a/java/test/Ice/serialize/Test.ice b/java/test/Ice/serialize/Test.ice index bb64105b0cd..3ca843878a3 100644 --- a/java/test/Ice/serialize/Test.ice +++ b/java/test/Ice/serialize/Test.ice @@ -10,6 +10,7 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Ice.serialize"]] module Test { diff --git a/java/test/Ice/serialize/build.xml b/java/test/Ice/serialize/build.xml deleted file mode 100644 index 1e4d16935c6..00000000000 --- a/java/test/Ice/serialize/build.xml +++ /dev/null @@ -1,48 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_objects" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java stream="on" outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/servantLocatorAMD/CookieI.java b/java/test/Ice/servantLocator/AMDCookieI.java index 46b4fac6e28..f3c1313fac8 100644 --- a/java/test/Ice/servantLocatorAMD/CookieI.java +++ b/java/test/Ice/servantLocator/AMDCookieI.java @@ -7,9 +7,11 @@ // // ********************************************************************** -import Test.*; +package test.Ice.servantLocator; -public final class CookieI extends Cookie +import test.Ice.servantLocatorAMD.Test.Cookie; + +public final class AMDCookieI extends Cookie { public String message() diff --git a/java/test/Ice/servantLocatorAMD/ServantLocatorI.java b/java/test/Ice/servantLocator/AMDServantLocatorI.java index aa24bcf5058..020989c5fca 100644 --- a/java/test/Ice/servantLocatorAMD/ServantLocatorI.java +++ b/java/test/Ice/servantLocator/AMDServantLocatorI.java @@ -7,13 +7,21 @@ // // ********************************************************************** -import Test.*; -import Ice.*; +package test.Ice.servantLocator; -public final class ServantLocatorI implements Ice.ServantLocator +import test.Ice.servantLocatorAMD.Test.Cookie; +import test.Ice.servantLocatorAMD.Test.TestImpossibleException; +import test.Ice.servantLocatorAMD.Test.TestIntfUserException; +import Ice.ObjectNotExistException; +import Ice.SocketException; +import Ice.UnknownException; +import Ice.UnknownLocalException; +import Ice.UnknownUserException; + +public final class AMDServantLocatorI implements Ice.ServantLocator { public - ServantLocatorI(String category) + AMDServantLocatorI(String category) { _category = category; _deactivated = false; @@ -56,9 +64,9 @@ public final class ServantLocatorI implements Ice.ServantLocator exception(current); } - cookie.value = new CookieI(); + cookie.value = new AMDCookieI(); - return new TestI(); + return new AMDTestI(); } public void @@ -97,7 +105,7 @@ public final class ServantLocatorI implements Ice.ServantLocator { if(current.operation.equals("ice_ids")) { - throw new Test.TestIntfUserException(); + throw new TestIntfUserException(); } else if(current.operation.equals("requestFailedException")) { diff --git a/java/test/Ice/servantLocator/AMDServer.java b/java/test/Ice/servantLocator/AMDServer.java new file mode 100644 index 00000000000..32168d24aab --- /dev/null +++ b/java/test/Ice/servantLocator/AMDServer.java @@ -0,0 +1,43 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.servantLocator; + +public class AMDServer extends test.Util.Application +{ + public int run(String[] args) + { + + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + adapter.addServantLocator(new AMDServantLocatorI("category"), "category"); + adapter.addServantLocator(new AMDServantLocatorI(""), ""); + adapter.add(new AMDTestI(), communicator().stringToIdentity("asm")); + adapter.activate(); + return WAIT; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); + + return initData; + } + + public static void main(String[] args) + { + AMDServer app = new AMDServer(); + int result = app.main("AMDServer", args); + System.gc(); + System.exit(result); + } +} diff --git a/java/test/Ice/servantLocatorAMD/TestI.java b/java/test/Ice/servantLocator/AMDTestI.java index 0441b9b3f68..df3bd63a89b 100644 --- a/java/test/Ice/servantLocatorAMD/TestI.java +++ b/java/test/Ice/servantLocator/AMDTestI.java @@ -7,9 +7,22 @@ // // ********************************************************************** -import Test.*; +package test.Ice.servantLocator; -public final class TestI extends _TestIntfDisp +import test.Ice.servantLocatorAMD.Test.AMD_TestIntf_impossibleException; +import test.Ice.servantLocatorAMD.Test.AMD_TestIntf_intfUserException; +import test.Ice.servantLocatorAMD.Test.AMD_TestIntf_javaException; +import test.Ice.servantLocatorAMD.Test.AMD_TestIntf_localException; +import test.Ice.servantLocatorAMD.Test.AMD_TestIntf_requestFailedException; +import test.Ice.servantLocatorAMD.Test.AMD_TestIntf_shutdown; +import test.Ice.servantLocatorAMD.Test.AMD_TestIntf_unknownException; +import test.Ice.servantLocatorAMD.Test.AMD_TestIntf_unknownLocalException; +import test.Ice.servantLocatorAMD.Test.AMD_TestIntf_unknownUserException; +import test.Ice.servantLocatorAMD.Test.TestImpossibleException; +import test.Ice.servantLocatorAMD.Test.TestIntfUserException; +import test.Ice.servantLocatorAMD.Test._TestIntfDisp; + +public final class AMDTestI extends _TestIntfDisp { public void requestFailedException_async(AMD_TestIntf_requestFailedException cb, Ice.Current current) @@ -90,7 +103,7 @@ public final class TestI extends _TestIntfDisp public void shutdown_async(AMD_TestIntf_shutdown cb, Ice.Current current) { - current.adapter.deactivate(); + current.adapter.getCommunicator().shutdown(); cb.ice_response(); } } diff --git a/java/test/Ice/servantLocator/AllTests.java b/java/test/Ice/servantLocator/AllTests.java index 5e56853980d..58d4c8b8e3e 100644 --- a/java/test/Ice/servantLocator/AllTests.java +++ b/java/test/Ice/servantLocator/AllTests.java @@ -7,8 +7,18 @@ // // ********************************************************************** -import Test.*; -import Ice.*; +package test.Ice.servantLocator; + +import java.io.PrintWriter; + +import test.Ice.servantLocator.Test.TestImpossibleException; +import test.Ice.servantLocator.Test.TestIntfPrx; +import test.Ice.servantLocator.Test.TestIntfPrxHelper; +import Ice.ObjectNotExistException; +import Ice.ObjectPrx; +import Ice.UnknownException; +import Ice.UnknownLocalException; +import Ice.UnknownUserException; public class AllTests { @@ -178,24 +188,24 @@ public class AllTests } public static TestIntfPrx - allTests(Ice.Communicator communicator, boolean collocated) + allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out) { - System.out.print("testing stringToProxy... "); - System.out.flush(); + out.print("testing stringToProxy... "); + out.flush(); String ref = "asm:default -p 12010 -t 10000"; Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing checked cast... "); - System.out.flush(); + out.print("testing checked cast... "); + out.flush(); TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base); test(obj != null); test(obj.equals(base)); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing ice_ids... "); - System.out.flush(); + out.print("testing ice_ids... "); + out.flush(); try { ObjectPrx o = communicator.stringToProxy("category/locate:default -p 12010 -t 10000"); @@ -225,10 +235,10 @@ public class AllTests { test(false); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing servant locator... "); - System.out.flush(); + out.print("testing servant locator... "); + out.flush(); base = communicator.stringToProxy("category/locate:default -p 12010 -t 10000"); obj = TestIntfPrxHelper.checkedCast(base); try @@ -238,10 +248,10 @@ public class AllTests catch(ObjectNotExistException ex) { } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing default servant locator... "); - System.out.flush(); + out.print("testing default servant locator... "); + out.flush(); base = communicator.stringToProxy("anothercat/locate:default -p 12010 -t 10000"); obj = TestIntfPrxHelper.checkedCast(base); base = communicator.stringToProxy("locate:default -p 12010 -t 10000"); @@ -260,21 +270,21 @@ public class AllTests catch(ObjectNotExistException ex) { } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing locate exceptions... "); - System.out.flush(); + out.print("testing locate exceptions... "); + out.flush(); base = communicator.stringToProxy("category/locate:default -p 12010 -t 10000"); obj = TestIntfPrxHelper.checkedCast(base); testExceptions(obj, collocated); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing finished exceptions... "); - System.out.flush(); + out.print("testing finished exceptions... "); + out.flush(); base = communicator.stringToProxy("category/finished:default -p 12010 -t 10000"); obj = TestIntfPrxHelper.checkedCast(base); testExceptions(obj, collocated); - System.out.println("ok"); + out.println("ok"); return obj; } diff --git a/java/test/Ice/servantLocator/Client.java b/java/test/Ice/servantLocator/Client.java index 963c404b88d..5ef68d327e9 100644 --- a/java/test/Ice/servantLocator/Client.java +++ b/java/test/Ice/servantLocator/Client.java @@ -7,25 +7,30 @@ // // ********************************************************************** -import Test.*; +package test.Ice.servantLocator; -public class Client +import test.Ice.servantLocator.Test.TestIntfPrx; + +public class Client extends test.Util.Application { - static class TestClient extends Ice.Application + public int run(String[] args) + { + TestIntfPrx obj = AllTests.allTests(communicator(), false, getWriter()); + obj.shutdown(); + return 0; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - public int - run(String[] args) - { - TestIntfPrx obj = AllTests.allTests(communicator(), false); - obj.shutdown(); - return 0; - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator"); + return initData; } - public static void - main(String[] args) + public static void main(String[] args) { - TestClient app = new TestClient(); + Client app = new Client(); int result = app.main("Client", args); System.gc(); System.exit(result); diff --git a/java/test/Ice/servantLocator/Collocated.java b/java/test/Ice/servantLocator/Collocated.java index 3a6f7815e6f..d8f8e383ba0 100644 --- a/java/test/Ice/servantLocator/Collocated.java +++ b/java/test/Ice/servantLocator/Collocated.java @@ -7,32 +7,38 @@ // // ********************************************************************** -public class Collocated +package test.Ice.servantLocator; + +public class Collocated extends test.Util.Application { - static class TestServer extends Ice.Application + public int run(String[] args) { - public int - run(String[] args) - { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - communicator().getProperties().setProperty("Ice.Warn.Dispatch", "0"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + adapter.addServantLocator(new ServantLocatorI("category"), "category"); + adapter.addServantLocator(new ServantLocatorI(""), ""); + adapter.add(new TestI(), communicator().stringToIdentity("asm")); + + AllTests.allTests(communicator(), true, getWriter()); - Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); - adapter.addServantLocator(new ServantLocatorI("category"), "category"); - adapter.addServantLocator(new ServantLocatorI(""), ""); - adapter.add(new TestI(), communicator().stringToIdentity("asm")); + return 0; + } - AllTests.allTests(communicator(), true); + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - return 0; - } + return initData; } - public static void - main(String[] args) + public static void main(String[] args) { - TestServer app = new TestServer(); + Collocated app = new Collocated(); int result = app.main("Collocated", args); + System.gc(); System.exit(result); } } diff --git a/java/test/Ice/servantLocator/CookieI.java b/java/test/Ice/servantLocator/CookieI.java index 46b4fac6e28..eb2f8c86e95 100644 --- a/java/test/Ice/servantLocator/CookieI.java +++ b/java/test/Ice/servantLocator/CookieI.java @@ -7,7 +7,9 @@ // // ********************************************************************** -import Test.*; +package test.Ice.servantLocator; + +import test.Ice.servantLocator.Test.Cookie; public final class CookieI extends Cookie { diff --git a/java/test/Ice/servantLocator/ServantLocatorI.java b/java/test/Ice/servantLocator/ServantLocatorI.java index aa24bcf5058..a31d009bf95 100644 --- a/java/test/Ice/servantLocator/ServantLocatorI.java +++ b/java/test/Ice/servantLocator/ServantLocatorI.java @@ -7,8 +7,16 @@ // // ********************************************************************** -import Test.*; -import Ice.*; +package test.Ice.servantLocator; + +import test.Ice.servantLocator.Test.Cookie; +import test.Ice.servantLocator.Test.TestImpossibleException; +import test.Ice.servantLocator.Test.TestIntfUserException; +import Ice.ObjectNotExistException; +import Ice.SocketException; +import Ice.UnknownException; +import Ice.UnknownLocalException; +import Ice.UnknownUserException; public final class ServantLocatorI implements Ice.ServantLocator { @@ -97,7 +105,7 @@ public final class ServantLocatorI implements Ice.ServantLocator { if(current.operation.equals("ice_ids")) { - throw new Test.TestIntfUserException(); + throw new TestIntfUserException(); } else if(current.operation.equals("requestFailedException")) { diff --git a/java/test/Ice/servantLocator/Server.java b/java/test/Ice/servantLocator/Server.java index 14cddc3ef54..26ee4fa9769 100644 --- a/java/test/Ice/servantLocator/Server.java +++ b/java/test/Ice/servantLocator/Server.java @@ -7,31 +7,34 @@ // // ********************************************************************** -public class Server +package test.Ice.servantLocator; + +public class Server extends test.Util.Application { - static class TestServer extends Ice.Application + public int run(String[] args) { - public int - run(String[] args) - { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - communicator().getProperties().setProperty("Ice.Warn.Dispatch", "0"); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + adapter.addServantLocator(new ServantLocatorI("category"), "category"); + adapter.addServantLocator(new ServantLocatorI(""), ""); + adapter.add(new TestI(), communicator().stringToIdentity("asm")); + adapter.activate(); + return WAIT; + } - Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); - adapter.addServantLocator(new ServantLocatorI("category"), "category"); - adapter.addServantLocator(new ServantLocatorI(""), ""); - adapter.add(new TestI(), communicator().stringToIdentity("asm")); + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.servantLocator"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - adapter.activate(); - adapter.waitForDeactivate(); - return 0; - } + return initData; } - public static void - main(String[] args) + public static void main(String[] args) { - TestServer app = new TestServer(); + Server app = new Server(); int result = app.main("Server", args); System.gc(); System.exit(result); diff --git a/java/test/Ice/servantLocator/Test.ice b/java/test/Ice/servantLocator/Test.ice index 5225d2c4331..9acfa468f51 100644 --- a/java/test/Ice/servantLocator/Test.ice +++ b/java/test/Ice/servantLocator/Test.ice @@ -10,6 +10,7 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Ice.servantLocator"]] module Test { diff --git a/java/test/Ice/servantLocatorAMD/TestAMD.ice b/java/test/Ice/servantLocator/TestAMD.ice index b9b23d1173d..4b8ef93414c 100644 --- a/java/test/Ice/servantLocatorAMD/TestAMD.ice +++ b/java/test/Ice/servantLocator/TestAMD.ice @@ -10,6 +10,7 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Ice.servantLocatorAMD"]] module Test { diff --git a/java/test/Ice/servantLocator/TestI.java b/java/test/Ice/servantLocator/TestI.java index eacc1c2e61e..8357a4f1757 100644 --- a/java/test/Ice/servantLocator/TestI.java +++ b/java/test/Ice/servantLocator/TestI.java @@ -7,7 +7,11 @@ // // ********************************************************************** -import Test.*; +package test.Ice.servantLocator; + +import test.Ice.servantLocator.Test.TestImpossibleException; +import test.Ice.servantLocator.Test.TestIntfUserException; +import test.Ice.servantLocator.Test._TestIntfDisp; public final class TestI extends _TestIntfDisp { @@ -79,6 +83,6 @@ public final class TestI extends _TestIntfDisp public void shutdown(Ice.Current current) { - current.adapter.deactivate(); + current.adapter.getCommunicator().shutdown(); } } diff --git a/java/test/Ice/servantLocator/build.xml b/java/test/Ice/servantLocator/build.xml deleted file mode 100644 index 27ed596c9b5..00000000000 --- a/java/test/Ice/servantLocator/build.xml +++ /dev/null @@ -1,48 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_servantLocator" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/servantLocator/run.py b/java/test/Ice/servantLocator/run.py index 08229481f20..829444ed8a2 100755 --- a/java/test/Ice/servantLocator/run.py +++ b/java/test/Ice/servantLocator/run.py @@ -24,10 +24,7 @@ print "tests with regular server." TestUtil.clientServerTest() print "tests with AMD server." -import copy -amdenv = copy.deepcopy(os.environ) -TestUtil.addClasspath(os.path.join(os.getcwd(), "..", "servantLocatorAMD", "classes"), amdenv) -TestUtil.clientServerTest(serverenv = amdenv) +TestUtil.clientServerTest(server="test.Ice.servantLocator.AMDServer") print "tests with collocated server." TestUtil.collocatedTest() diff --git a/java/test/Ice/servantLocatorAMD/Server.java b/java/test/Ice/servantLocatorAMD/Server.java deleted file mode 100644 index 14cddc3ef54..00000000000 --- a/java/test/Ice/servantLocatorAMD/Server.java +++ /dev/null @@ -1,39 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -public class Server -{ - static class TestServer extends Ice.Application - { - public int - run(String[] args) - { - communicator().getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - communicator().getProperties().setProperty("Ice.Warn.Dispatch", "0"); - - Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); - adapter.addServantLocator(new ServantLocatorI("category"), "category"); - adapter.addServantLocator(new ServantLocatorI(""), ""); - adapter.add(new TestI(), communicator().stringToIdentity("asm")); - - adapter.activate(); - adapter.waitForDeactivate(); - return 0; - } - } - - public static void - main(String[] args) - { - TestServer app = new TestServer(); - int result = app.main("Server", args); - System.gc(); - System.exit(result); - } -} diff --git a/java/test/Ice/servantLocatorAMD/build.xml b/java/test/Ice/servantLocatorAMD/build.xml deleted file mode 100644 index 787833f89e6..00000000000 --- a/java/test/Ice/servantLocatorAMD/build.xml +++ /dev/null @@ -1,48 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_servantLocatorAMD" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="TestAMD.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/slicing/build.xml b/java/test/Ice/slicing/build.xml deleted file mode 100644 index 3f0ee6e0ca0..00000000000 --- a/java/test/Ice/slicing/build.xml +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_slicing" default="all" basedir="."> - - <target name="all"> - <ant dir="exceptions"/> - <ant dir="exceptionsAMD"/> - <ant dir="objects"/> - <ant dir="objectsAMD"/> - </target> - - <target name="clean"> - <ant dir="exceptions" target="clean"/> - <ant dir="exceptionsAMD" target="clean"/> - <ant dir="objects" target="clean"/> - <ant dir="objectsAMD" target="clean"/> - </target> - -</project> diff --git a/java/test/Ice/slicing/exceptions/AMDServer.java b/java/test/Ice/slicing/exceptions/AMDServer.java new file mode 100644 index 00000000000..c8f7592f9ee --- /dev/null +++ b/java/test/Ice/slicing/exceptions/AMDServer.java @@ -0,0 +1,41 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.slicing.exceptions; + +public class AMDServer extends test.Util.Application +{ + public int run(String[] args) + { + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + Ice.Object object = new AMDTestI(adapter); + adapter.add(object, communicator().stringToIdentity("Test")); + adapter.activate(); + return WAIT; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.serverAMD"); + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); + return initData; + } + + public static void main(String[] args) + { + AMDServer c = new AMDServer(); + int status = c.main("AMDServer", args); + + System.gc(); + System.exit(status); + } +} diff --git a/java/test/Ice/slicing/exceptionsAMD/TestI.java b/java/test/Ice/slicing/exceptions/AMDTestI.java index b6ef7eb5c6f..7050650994b 100644 --- a/java/test/Ice/slicing/exceptionsAMD/TestI.java +++ b/java/test/Ice/slicing/exceptions/AMDTestI.java @@ -7,12 +7,36 @@ // // ********************************************************************** -import Test.*; - -public final class TestI extends _TestIntfDisp +package test.Ice.slicing.exceptions; + +import test.Ice.slicing.exceptions.serverAMD.Test.AMD_TestIntf_baseAsBase; +import test.Ice.slicing.exceptions.serverAMD.Test.AMD_TestIntf_knownDerivedAsBase; +import test.Ice.slicing.exceptions.serverAMD.Test.AMD_TestIntf_knownDerivedAsKnownDerived; +import test.Ice.slicing.exceptions.serverAMD.Test.AMD_TestIntf_knownIntermediateAsBase; +import test.Ice.slicing.exceptions.serverAMD.Test.AMD_TestIntf_knownIntermediateAsKnownIntermediate; +import test.Ice.slicing.exceptions.serverAMD.Test.AMD_TestIntf_knownMostDerivedAsBase; +import test.Ice.slicing.exceptions.serverAMD.Test.AMD_TestIntf_knownMostDerivedAsKnownIntermediate; +import test.Ice.slicing.exceptions.serverAMD.Test.AMD_TestIntf_knownMostDerivedAsKnownMostDerived; +import test.Ice.slicing.exceptions.serverAMD.Test.AMD_TestIntf_shutdown; +import test.Ice.slicing.exceptions.serverAMD.Test.AMD_TestIntf_unknownDerivedAsBase; +import test.Ice.slicing.exceptions.serverAMD.Test.AMD_TestIntf_unknownIntermediateAsBase; +import test.Ice.slicing.exceptions.serverAMD.Test.AMD_TestIntf_unknownMostDerived1AsBase; +import test.Ice.slicing.exceptions.serverAMD.Test.AMD_TestIntf_unknownMostDerived1AsKnownIntermediate; +import test.Ice.slicing.exceptions.serverAMD.Test.AMD_TestIntf_unknownMostDerived2AsBase; +import test.Ice.slicing.exceptions.serverAMD.Test.Base; +import test.Ice.slicing.exceptions.serverAMD.Test.KnownDerived; +import test.Ice.slicing.exceptions.serverAMD.Test.KnownIntermediate; +import test.Ice.slicing.exceptions.serverAMD.Test.KnownMostDerived; +import test.Ice.slicing.exceptions.serverAMD.Test.UnknownDerived; +import test.Ice.slicing.exceptions.serverAMD.Test.UnknownIntermediate; +import test.Ice.slicing.exceptions.serverAMD.Test.UnknownMostDerived1; +import test.Ice.slicing.exceptions.serverAMD.Test.UnknownMostDerived2; +import test.Ice.slicing.exceptions.serverAMD.Test._TestIntfDisp; + +public final class AMDTestI extends _TestIntfDisp { public - TestI(Ice.ObjectAdapter adapter) + AMDTestI(Ice.ObjectAdapter adapter) { _adapter = adapter; } diff --git a/java/test/Ice/slicing/exceptions/csrc/AllTests.java b/java/test/Ice/slicing/exceptions/AllTests.java index 97fc9a0c9e4..b50234fd72e 100644 --- a/java/test/Ice/slicing/exceptions/csrc/AllTests.java +++ b/java/test/Ice/slicing/exceptions/AllTests.java @@ -7,7 +7,27 @@ // // ********************************************************************** -import Test.*; +package test.Ice.slicing.exceptions; + +import test.Ice.slicing.exceptions.Test.AMI_TestIntf_baseAsBase; +import test.Ice.slicing.exceptions.Test.AMI_TestIntf_knownDerivedAsBase; +import test.Ice.slicing.exceptions.Test.AMI_TestIntf_knownDerivedAsKnownDerived; +import test.Ice.slicing.exceptions.Test.AMI_TestIntf_knownIntermediateAsBase; +import test.Ice.slicing.exceptions.Test.AMI_TestIntf_knownIntermediateAsKnownIntermediate; +import test.Ice.slicing.exceptions.Test.AMI_TestIntf_knownMostDerivedAsBase; +import test.Ice.slicing.exceptions.Test.AMI_TestIntf_knownMostDerivedAsKnownIntermediate; +import test.Ice.slicing.exceptions.Test.AMI_TestIntf_knownMostDerivedAsKnownMostDerived; +import test.Ice.slicing.exceptions.Test.AMI_TestIntf_unknownDerivedAsBase; +import test.Ice.slicing.exceptions.Test.AMI_TestIntf_unknownIntermediateAsBase; +import test.Ice.slicing.exceptions.Test.AMI_TestIntf_unknownMostDerived1AsBase; +import test.Ice.slicing.exceptions.Test.AMI_TestIntf_unknownMostDerived1AsKnownIntermediate; +import test.Ice.slicing.exceptions.Test.AMI_TestIntf_unknownMostDerived2AsBase; +import test.Ice.slicing.exceptions.Test.Base; +import test.Ice.slicing.exceptions.Test.KnownDerived; +import test.Ice.slicing.exceptions.Test.KnownIntermediate; +import test.Ice.slicing.exceptions.Test.KnownMostDerived; +import test.Ice.slicing.exceptions.Test.TestIntfPrx; +import test.Ice.slicing.exceptions.Test.TestIntfPrxHelper; public class AllTests { @@ -625,24 +645,24 @@ public class AllTests } public static TestIntfPrx - allTests(Ice.Communicator communicator, boolean collocated) + allTests(Ice.Communicator communicator, boolean collocated, java.io.PrintWriter out) { - System.out.print("testing stringToProxy... "); - System.out.flush(); + out.print("testing stringToProxy... "); + out.flush(); String ref = "Test:default -p 12010 -t 10000"; Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing checked cast... "); - System.out.flush(); + out.print("testing checked cast... "); + out.flush(); TestIntfPrx test = TestIntfPrxHelper.checkedCast(base); test(test != null); test(test.equals(base)); - System.out.println("ok"); + out.println("ok"); - System.out.print("base... "); - System.out.flush(); + out.print("base... "); + out.flush(); { try { @@ -659,19 +679,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("base (AMI)... "); - System.out.flush(); + out.print("base (AMI)... "); + out.flush(); { AMI_Test_baseAsBaseI cb = new AMI_Test_baseAsBaseI(); test.baseAsBase_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("slicing of unknown derived... "); - System.out.flush(); + out.print("slicing of unknown derived... "); + out.flush(); { try { @@ -688,19 +708,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("slicing of unknown derived (AMI)... "); - System.out.flush(); + out.print("slicing of unknown derived (AMI)... "); + out.flush(); { AMI_Test_unknownDerivedAsBaseI cb = new AMI_Test_unknownDerivedAsBaseI(); test.unknownDerivedAsBase_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("non-slicing of known derived as base... "); - System.out.flush(); + out.print("non-slicing of known derived as base... "); + out.flush(); { try { @@ -718,19 +738,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("non-slicing of known derived as base (AMI)... "); - System.out.flush(); + out.print("non-slicing of known derived as base (AMI)... "); + out.flush(); { AMI_Test_knownDerivedAsBaseI cb = new AMI_Test_knownDerivedAsBaseI(); test.knownDerivedAsBase_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("non-slicing of known derived as derived... "); - System.out.flush(); + out.print("non-slicing of known derived as derived... "); + out.flush(); { try { @@ -748,19 +768,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("non-slicing of known derived as derived (AMI)... "); - System.out.flush(); + out.print("non-slicing of known derived as derived (AMI)... "); + out.flush(); { AMI_Test_knownDerivedAsKnownDerivedI cb = new AMI_Test_knownDerivedAsKnownDerivedI(); test.knownDerivedAsKnownDerived_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("slicing of unknown intermediate as base... "); - System.out.flush(); + out.print("slicing of unknown intermediate as base... "); + out.flush(); { try { @@ -777,19 +797,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("slicing of unknown intermediate as base (AMI)... "); - System.out.flush(); + out.print("slicing of unknown intermediate as base (AMI)... "); + out.flush(); { AMI_Test_unknownIntermediateAsBaseI cb = new AMI_Test_unknownIntermediateAsBaseI(); test.unknownIntermediateAsBase_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("slicing of known intermediate as base... "); - System.out.flush(); + out.print("slicing of known intermediate as base... "); + out.flush(); { try { @@ -807,19 +827,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("slicing of known intermediate as base (AMI)... "); - System.out.flush(); + out.print("slicing of known intermediate as base (AMI)... "); + out.flush(); { AMI_Test_knownIntermediateAsBaseI cb = new AMI_Test_knownIntermediateAsBaseI(); test.knownIntermediateAsBase_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("slicing of known most derived as base... "); - System.out.flush(); + out.print("slicing of known most derived as base... "); + out.flush(); { try { @@ -838,19 +858,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("slicing of known most derived as base (AMI)... "); - System.out.flush(); + out.print("slicing of known most derived as base (AMI)... "); + out.flush(); { AMI_Test_knownMostDerivedAsBaseI cb = new AMI_Test_knownMostDerivedAsBaseI(); test.knownMostDerivedAsBase_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("non-slicing of known intermediate as intermediate... "); - System.out.flush(); + out.print("non-slicing of known intermediate as intermediate... "); + out.flush(); { try { @@ -868,19 +888,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("non-slicing of known intermediate as intermediate (AMI)... "); - System.out.flush(); + out.print("non-slicing of known intermediate as intermediate (AMI)... "); + out.flush(); { AMI_Test_knownIntermediateAsKnownIntermediateI cb = new AMI_Test_knownIntermediateAsKnownIntermediateI(); test.knownIntermediateAsKnownIntermediate_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("non-slicing of known most derived as intermediate... "); - System.out.flush(); + out.print("non-slicing of known most derived as intermediate... "); + out.flush(); { try { @@ -899,19 +919,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("non-slicing of known most derived as intermediate (AMI)... "); - System.out.flush(); + out.print("non-slicing of known most derived as intermediate (AMI)... "); + out.flush(); { AMI_Test_knownMostDerivedAsKnownIntermediateI cb = new AMI_Test_knownMostDerivedAsKnownIntermediateI(); test.knownMostDerivedAsKnownIntermediate_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("non-slicing of known most derived as most derived... "); - System.out.flush(); + out.print("non-slicing of known most derived as most derived... "); + out.flush(); { try { @@ -930,19 +950,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("non-slicing of known most derived as most derived (AMI)... "); - System.out.flush(); + out.print("non-slicing of known most derived as most derived (AMI)... "); + out.flush(); { AMI_Test_knownMostDerivedAsKnownMostDerivedI cb = new AMI_Test_knownMostDerivedAsKnownMostDerivedI(); test.knownMostDerivedAsKnownMostDerived_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("slicing of unknown most derived, known intermediate as base... "); - System.out.flush(); + out.print("slicing of unknown most derived, known intermediate as base... "); + out.flush(); { try { @@ -960,19 +980,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("slicing of unknown most derived, known intermediate as base (AMI)... "); - System.out.flush(); + out.print("slicing of unknown most derived, known intermediate as base (AMI)... "); + out.flush(); { AMI_Test_unknownMostDerived1AsBaseI cb = new AMI_Test_unknownMostDerived1AsBaseI(); test.unknownMostDerived1AsBase_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("slicing of unknown most derived, known intermediate as intermediate... "); - System.out.flush(); + out.print("slicing of unknown most derived, known intermediate as intermediate... "); + out.flush(); { try { @@ -990,20 +1010,20 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("slicing of unknown most derived, known intermediate as intermediate (AMI)... "); - System.out.flush(); + out.print("slicing of unknown most derived, known intermediate as intermediate (AMI)... "); + out.flush(); { AMI_Test_unknownMostDerived1AsKnownIntermediateI cb = new AMI_Test_unknownMostDerived1AsKnownIntermediateI(); test.unknownMostDerived1AsKnownIntermediate_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("slicing of unknown most derived, unknown intermediate thrown as base... "); - System.out.flush(); + out.print("slicing of unknown most derived, unknown intermediate thrown as base... "); + out.flush(); { try { @@ -1020,16 +1040,16 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("slicing of unknown most derived, unknown intermediate thrown as base (AMI)... "); - System.out.flush(); + out.print("slicing of unknown most derived, unknown intermediate thrown as base (AMI)... "); + out.flush(); { AMI_Test_unknownMostDerived2AsBaseI cb = new AMI_Test_unknownMostDerived2AsBaseI(); test.unknownMostDerived2AsBase_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); return test; } diff --git a/java/test/Ice/slicing/exceptions/Client.java b/java/test/Ice/slicing/exceptions/Client.java new file mode 100644 index 00000000000..3bed53afa0f --- /dev/null +++ b/java/test/Ice/slicing/exceptions/Client.java @@ -0,0 +1,40 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.slicing.exceptions; + +import test.Ice.slicing.exceptions.Test.TestIntfPrx; + +public class Client extends test.Util.Application +{ + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions"); + return initData; + } + + @Override + public int run(String[] args) + { + TestIntfPrx test = AllTests.allTests(communicator(), false, getWriter()); + test.shutdown(); + return 0; + } + + public static void main(String[] args) + { + Client c = new Client(); + int status = c.main("Client", args); + + System.gc(); + System.exit(status); + } +} diff --git a/java/test/Ice/slicing/exceptions/Server.java b/java/test/Ice/slicing/exceptions/Server.java new file mode 100644 index 00000000000..cb4fbce8fba --- /dev/null +++ b/java/test/Ice/slicing/exceptions/Server.java @@ -0,0 +1,42 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.slicing.exceptions; + +public class Server extends test.Util.Application +{ + @Override + public int run(String[] args) + { + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + Ice.Object object = new TestI(adapter); + adapter.add(object, Ice.Util.stringToIdentity("Test")); + adapter.activate(); + return WAIT; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.exceptions.server"); + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); + return initData; + } + + public static void main(String[] args) + { + Server c = new Server(); + int status = c.main("Server", args); + + System.gc(); + System.exit(status); + } +} diff --git a/java/test/Ice/slicing/exceptions/ServerPrivate.ice b/java/test/Ice/slicing/exceptions/ServerPrivate.ice new file mode 100644 index 00000000000..e9babdae10a --- /dev/null +++ b/java/test/Ice/slicing/exceptions/ServerPrivate.ice @@ -0,0 +1,84 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef SERVERPRIVATE_ICE +#define SERVERPRIVATE_ICE + +[["java:package:test.Ice.slicing.exceptions.server"]] +module Test +{ + +// Duplicate types from Test.ice. We cannot use #include since +// that will use the types from the same prefix. +exception Base +{ + string b; +}; + +exception KnownDerived extends Base +{ + string kd; +}; + +exception KnownIntermediate extends Base +{ + string ki; +}; + +exception KnownMostDerived extends KnownIntermediate +{ + string kmd; +}; + +["ami"] interface TestIntf +{ + void baseAsBase() throws Base; + void unknownDerivedAsBase() throws Base; + void knownDerivedAsBase() throws Base; + void knownDerivedAsKnownDerived() throws KnownDerived; + + void unknownIntermediateAsBase() throws Base; + void knownIntermediateAsBase() throws Base; + void knownMostDerivedAsBase() throws Base; + void knownIntermediateAsKnownIntermediate() throws KnownIntermediate; + void knownMostDerivedAsKnownIntermediate() throws KnownIntermediate; + void knownMostDerivedAsKnownMostDerived() throws KnownMostDerived; + + void unknownMostDerived1AsBase() throws Base; + void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate; + void unknownMostDerived2AsBase() throws Base; + + void shutdown(); +}; + +// Additional server specific types (used for testing slicing). + +exception UnknownDerived extends Base +{ + string ud; +}; + +exception UnknownIntermediate extends Base +{ + string ui; +}; + +exception UnknownMostDerived1 extends KnownIntermediate +{ + string umd1; +}; + +exception UnknownMostDerived2 extends UnknownIntermediate +{ + string umd2; +}; + +}; + +#endif diff --git a/java/test/Ice/slicing/exceptionsAMD/TestAMD.ice b/java/test/Ice/slicing/exceptions/ServerPrivateAMD.ice index f878338c995..72a97a6e9e5 100644 --- a/java/test/Ice/slicing/exceptionsAMD/TestAMD.ice +++ b/java/test/Ice/slicing/exceptions/ServerPrivateAMD.ice @@ -7,12 +7,15 @@ // // ********************************************************************** -#ifndef TEST_AMD_ICE -#define TEST_AMD_ICE +#ifndef SERVERPRIVATE_AMD_ICE +#define SERVERPRIVATE_AMD_ICE +[["java:package:test.Ice.slicing.exceptions.serverAMD"]] module Test { +// Duplicate types from Test.ice. We cannot use #include since +// that will use the types from the same prefix. exception Base { string b; @@ -54,6 +57,28 @@ exception KnownMostDerived extends KnownIntermediate void shutdown(); }; +// Additional server specific types (used for testing slicing). + +exception UnknownDerived extends Base +{ + string ud; +}; + +exception UnknownIntermediate extends Base +{ + string ui; +}; + +exception UnknownMostDerived1 extends KnownIntermediate +{ + string umd1; +}; + +exception UnknownMostDerived2 extends UnknownIntermediate +{ + string umd2; +}; + }; #endif diff --git a/java/test/Ice/slicing/exceptions/Test.ice b/java/test/Ice/slicing/exceptions/Test.ice index a5918458a6c..c59a42e472f 100644 --- a/java/test/Ice/slicing/exceptions/Test.ice +++ b/java/test/Ice/slicing/exceptions/Test.ice @@ -10,6 +10,7 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Ice.slicing.exceptions"]] module Test { diff --git a/java/test/Ice/slicing/exceptions/ssrc/TestI.java b/java/test/Ice/slicing/exceptions/TestI.java index 01647a1708b..cd26ea02403 100644 --- a/java/test/Ice/slicing/exceptions/ssrc/TestI.java +++ b/java/test/Ice/slicing/exceptions/TestI.java @@ -7,7 +7,17 @@ // // ********************************************************************** -import Test.*; +package test.Ice.slicing.exceptions; + +import test.Ice.slicing.exceptions.server.Test.Base; +import test.Ice.slicing.exceptions.server.Test.KnownDerived; +import test.Ice.slicing.exceptions.server.Test.KnownIntermediate; +import test.Ice.slicing.exceptions.server.Test.KnownMostDerived; +import test.Ice.slicing.exceptions.server.Test.UnknownDerived; +import test.Ice.slicing.exceptions.server.Test.UnknownIntermediate; +import test.Ice.slicing.exceptions.server.Test.UnknownMostDerived1; +import test.Ice.slicing.exceptions.server.Test.UnknownMostDerived2; +import test.Ice.slicing.exceptions.server.Test._TestIntfDisp; public final class TestI extends _TestIntfDisp { diff --git a/java/test/Ice/slicing/exceptions/build.xml b/java/test/Ice/slicing/exceptions/build.xml deleted file mode 100644 index f2fd285b42b..00000000000 --- a/java/test/Ice/slicing/exceptions/build.xml +++ /dev/null @@ -1,85 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_slicing_exceptions" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <property name="cclass.dir" value="classes"/> - <property name="sclass.dir" value="sclasses"/> - <property name="cgen.dir" value="generated"/> - <property name="sgen.dir" value="sgenerated"/> - <property name="csrc.dir" value="csrc"/> - <property name="ssrc.dir" value="ssrc"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${cgen.dir}"/> - <slice2java outputdir="${cgen.dir}"> - <meta value="${java2metadata}"/> - <includepath> - <pathelement path="."/> - </includepath> - <fileset dir="." includes="Test.ice"/> - </slice2java> - <mkdir dir="${sgen.dir}"/> - <slice2java outputdir="${sgen.dir}"> - <meta value="${java2metadata}"/> - <includepath> - <pathelement path="."/> - </includepath> - <fileset dir="." includes="Test.ice"/> - </slice2java> - <mkdir dir="${sgen.dir}"/> - <slice2java outputdir="${sgen.dir}"> - <meta value="${java2metadata}"/> - <includepath> - <pathelement path="."/> - </includepath> - <fileset dir="${ssrc.dir}" includes="ServerPrivate.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${cclass.dir}"/> - <javac srcdir="${cgen.dir}" destdir="${cclass.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="${csrc.dir}" destdir="${cclass.dir}" - classpathref="ice.classpath" excludes="${cgen.dir}/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <mkdir dir="${sclass.dir}"/> - <javac srcdir="${sgen.dir}" destdir="${sclass.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="${ssrc.dir}" destdir="${sclass.dir}" - classpathref="ice.classpath" excludes="${sgen.dir}/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${cgen.dir}"/> - <delete dir="${sgen.dir}"/> - <delete dir="${cclass.dir}"/> - <delete dir="${sclass.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/slicing/exceptions/csrc/Client.java b/java/test/Ice/slicing/exceptions/csrc/Client.java deleted file mode 100644 index a6bd5eb1c17..00000000000 --- a/java/test/Ice/slicing/exceptions/csrc/Client.java +++ /dev/null @@ -1,55 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -import Test.*; - -public class Client -{ - private static int - run(String[] args, Ice.Communicator communicator) - { - TestIntfPrx test = AllTests.allTests(communicator, false); - test.shutdown(); - return 0; - } - - public static void - main(String[] args) - { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - - System.gc(); - System.exit(status); - } -} diff --git a/java/test/Ice/slicing/exceptions/run.py b/java/test/Ice/slicing/exceptions/run.py index 392a127aa5d..ed56aea4e71 100755 --- a/java/test/Ice/slicing/exceptions/run.py +++ b/java/test/Ice/slicing/exceptions/run.py @@ -21,10 +21,7 @@ sys.path.append(os.path.join(path[0])) from scripts import * print "tests with regular server." -import copy -serverenv = copy.deepcopy(os.environ) -TestUtil.addClasspath(os.path.join(os.getcwd(), "sclasses"), serverenv) -TestUtil.clientServerTest(serverenv = serverenv) +TestUtil.clientServerTest() print "tests with AMD server." import copy diff --git a/java/test/Ice/slicing/exceptions/ssrc/Server.java b/java/test/Ice/slicing/exceptions/ssrc/Server.java deleted file mode 100644 index 6b7c1b84ffa..00000000000 --- a/java/test/Ice/slicing/exceptions/ssrc/Server.java +++ /dev/null @@ -1,59 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -public class Server -{ - private static int - run(String[] args, Ice.Communicator communicator) - { - Ice.Properties properties = communicator.getProperties(); - properties.setProperty("Ice.Warn.Dispatch", "0"); - properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.Object object = new TestI(adapter); - adapter.add(object, Ice.Util.stringToIdentity("Test")); - adapter.activate(); - communicator.waitForShutdown(); - return 0; - } - - public static void - main(String[] args) - { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - - System.gc(); - System.exit(status); - } -} diff --git a/java/test/Ice/slicing/exceptions/ssrc/ServerPrivate.ice b/java/test/Ice/slicing/exceptions/ssrc/ServerPrivate.ice deleted file mode 100644 index e2ae8cb3696..00000000000 --- a/java/test/Ice/slicing/exceptions/ssrc/ServerPrivate.ice +++ /dev/null @@ -1,40 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef SERVERPRIVATE_ICE -#define SERVERPRIVATE_ICE - -#include <Test.ice> - -module Test -{ - -exception UnknownDerived extends Base -{ - string ud; -}; - -exception UnknownIntermediate extends Base -{ - string ui; -}; - -exception UnknownMostDerived1 extends KnownIntermediate -{ - string umd1; -}; - -exception UnknownMostDerived2 extends UnknownIntermediate -{ - string umd2; -}; - -}; - -#endif diff --git a/java/test/Ice/slicing/exceptionsAMD/Server.java b/java/test/Ice/slicing/exceptionsAMD/Server.java deleted file mode 100644 index 028930fc8c1..00000000000 --- a/java/test/Ice/slicing/exceptionsAMD/Server.java +++ /dev/null @@ -1,59 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -public class Server -{ - private static int - run(String[] args, Ice.Communicator communicator) - { - Ice.Properties properties = communicator.getProperties(); - properties.setProperty("Ice.Warn.Dispatch", "0"); - properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.Object object = new TestI(adapter); - adapter.add(object, communicator.stringToIdentity("Test")); - adapter.activate(); - communicator.waitForShutdown(); - return 0; - } - - public static void - main(String[] args) - { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - - System.gc(); - System.exit(status); - } -} diff --git a/java/test/Ice/slicing/exceptionsAMD/ServerPrivateAMD.ice b/java/test/Ice/slicing/exceptionsAMD/ServerPrivateAMD.ice deleted file mode 100644 index 76f139c79c2..00000000000 --- a/java/test/Ice/slicing/exceptionsAMD/ServerPrivateAMD.ice +++ /dev/null @@ -1,40 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef SERVERPRIVATE_AMD_ICE -#define SERVERPRIVATE_AMD_ICE - -#include <TestAMD.ice> - -module Test -{ - -exception UnknownDerived extends Base -{ - string ud; -}; - -exception UnknownIntermediate extends Base -{ - string ui; -}; - -exception UnknownMostDerived1 extends KnownIntermediate -{ - string umd1; -}; - -exception UnknownMostDerived2 extends UnknownIntermediate -{ - string umd2; -}; - -}; - -#endif diff --git a/java/test/Ice/slicing/exceptionsAMD/build.xml b/java/test/Ice/slicing/exceptionsAMD/build.xml deleted file mode 100644 index 26bb8d5e6bb..00000000000 --- a/java/test/Ice/slicing/exceptionsAMD/build.xml +++ /dev/null @@ -1,52 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_slicing_exceptionsAMD" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <includepath> - <pathelement path="."/> - </includepath> - <fileset dir="." includes="TestAMD.ice"/> - <fileset dir="." includes="ServerPrivateAMD.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/slicing/objects/AMDServer.java b/java/test/Ice/slicing/objects/AMDServer.java new file mode 100644 index 00000000000..90820d2fd7b --- /dev/null +++ b/java/test/Ice/slicing/objects/AMDServer.java @@ -0,0 +1,40 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.slicing.objects; + +public class AMDServer extends test.Util.Application +{ + public int run(String[] args) + { + Ice.Communicator communicator = communicator(); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.Object object = new AMDTestI(adapter); + adapter.add(object, communicator.stringToIdentity("Test")); + return WAIT; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.serverAMD"); + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); + return initData; + } + + public static void main(String[] args) + { + AMDServer app = new AMDServer(); + int result = app.main("AMDServer", args); + System.gc(); + System.exit(result); + } +} diff --git a/java/test/Ice/slicing/objectsAMD/TestI.java b/java/test/Ice/slicing/objects/AMDTestI.java index 429126886cc..b339f57eb0a 100644 --- a/java/test/Ice/slicing/objectsAMD/TestI.java +++ b/java/test/Ice/slicing/objects/AMDTestI.java @@ -7,12 +7,56 @@ // // ********************************************************************** -import Test.*; - -public final class TestI extends _TestIntfDisp +package test.Ice.slicing.objects; + +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_D1AsB; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_D1AsD1; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_D2AsB; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_SBSKnownDerivedAsSBSKnownDerived; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_SBSKnownDerivedAsSBase; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_SBSUnknownDerivedAsSBase; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_SBaseAsObject; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_SBaseAsSBase; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_SUnknownAsObject; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_dictionaryTest; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_oneElementCycle; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_paramTest1; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_paramTest2; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_paramTest3; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_paramTest4; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_returnTest1; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_returnTest2; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_returnTest3; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_sequenceTest; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_shutdown; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_throwBaseAsBase; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_throwDerivedAsBase; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_throwDerivedAsDerived; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_throwUnknownDerivedAsBase; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_twoElementCycle; +import test.Ice.slicing.objects.serverAMD.Test.AMD_TestIntf_useForward; +import test.Ice.slicing.objects.serverAMD.Test.B; +import test.Ice.slicing.objects.serverAMD.Test.BaseException; +import test.Ice.slicing.objects.serverAMD.Test.D1; +import test.Ice.slicing.objects.serverAMD.Test.D2; +import test.Ice.slicing.objects.serverAMD.Test.D4; +import test.Ice.slicing.objects.serverAMD.Test.DerivedException; +import test.Ice.slicing.objects.serverAMD.Test.Forward; +import test.Ice.slicing.objects.serverAMD.Test.Hidden; +import test.Ice.slicing.objects.serverAMD.Test.SBSKnownDerived; +import test.Ice.slicing.objects.serverAMD.Test.SBSUnknownDerived; +import test.Ice.slicing.objects.serverAMD.Test.SBase; +import test.Ice.slicing.objects.serverAMD.Test.SS; +import test.Ice.slicing.objects.serverAMD.Test.SS1; +import test.Ice.slicing.objects.serverAMD.Test.SS2; +import test.Ice.slicing.objects.serverAMD.Test.SUnknown; +import test.Ice.slicing.objects.serverAMD.Test.UnknownDerivedException; +import test.Ice.slicing.objects.serverAMD.Test._TestIntfDisp; + +public final class AMDTestI extends _TestIntfDisp { public - TestI(Ice.ObjectAdapter adapter) + AMDTestI(Ice.ObjectAdapter adapter) { _adapter = adapter; } diff --git a/java/test/Ice/slicing/objects/csrc/AllTests.java b/java/test/Ice/slicing/objects/AllTests.java index ab0c45dc5d2..d5b6659a5d1 100644 --- a/java/test/Ice/slicing/objects/csrc/AllTests.java +++ b/java/test/Ice/slicing/objects/AllTests.java @@ -7,7 +7,52 @@ // // ********************************************************************** -import Test.*; +package test.Ice.slicing.objects; + +import java.io.PrintStream; +import java.io.PrintWriter; + +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_D1AsB; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_D1AsD1; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_D2AsB; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_SBSKnownDerivedAsSBSKnownDerived; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_SBSKnownDerivedAsSBase; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_SBSUnknownDerivedAsSBase; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_SBaseAsObject; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_SBaseAsSBase; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_SUnknownAsObject; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_dictionaryTest; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_oneElementCycle; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_paramTest1; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_paramTest2; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_paramTest3; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_paramTest4; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_returnTest1; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_returnTest2; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_returnTest3; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_sequenceTest; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_throwBaseAsBase; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_throwDerivedAsBase; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_throwDerivedAsDerived; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_throwUnknownDerivedAsBase; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_twoElementCycle; +import test.Ice.slicing.objects.client.Test.AMI_TestIntf_useForward; +import test.Ice.slicing.objects.client.Test.B; +import test.Ice.slicing.objects.client.Test.BDictHolder; +import test.Ice.slicing.objects.client.Test.BHolder; +import test.Ice.slicing.objects.client.Test.BaseException; +import test.Ice.slicing.objects.client.Test.D1; +import test.Ice.slicing.objects.client.Test.D3; +import test.Ice.slicing.objects.client.Test.DerivedException; +import test.Ice.slicing.objects.client.Test.SBSKnownDerived; +import test.Ice.slicing.objects.client.Test.SBase; +import test.Ice.slicing.objects.client.Test.SS; +import test.Ice.slicing.objects.client.Test.SS1; +import test.Ice.slicing.objects.client.Test.SS2; +import test.Ice.slicing.objects.client.Test.TestIntfPrx; +import test.Ice.slicing.objects.client.Test.TestIntfPrxHelper; +import test.Ice.slicing.objects.client.Test.Forward; +import test.Ice.slicing.objects.client.Test.ForwardHolder; public class AllTests { @@ -986,24 +1031,24 @@ public class AllTests } public static TestIntfPrx - allTests(Ice.Communicator communicator, boolean collocated) + allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out) { - System.out.print("testing stringToProxy... "); - System.out.flush(); + out.print("testing stringToProxy... "); + out.flush(); String ref = "Test:default -p 12010 -t 10000"; Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing checked cast... "); - System.out.flush(); + out.print("testing checked cast... "); + out.flush(); TestIntfPrx test = TestIntfPrxHelper.checkedCast(base); test(test != null); test(test.equals(base)); - System.out.println("ok"); + out.println("ok"); - System.out.print("base as Object... "); - System.out.flush(); + out.print("base as Object... "); + out.flush(); { Ice.Object o; SBase sb = null; @@ -1021,19 +1066,19 @@ public class AllTests test(sb != null); test(sb.sb.equals("SBase.sb")); } - System.out.println("ok"); + out.println("ok"); - System.out.print("base as Object (AMI)... "); - System.out.flush(); + out.print("base as Object (AMI)... "); + out.flush(); { AMI_Test_SBaseAsObjectI cb = new AMI_Test_SBaseAsObjectI(); test.SBaseAsObject_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("base as base... "); - System.out.flush(); + out.print("base as base... "); + out.flush(); { SBase sb; try @@ -1046,19 +1091,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("base as base (AMI)... "); - System.out.flush(); + out.print("base as base (AMI)... "); + out.flush(); { AMI_Test_SBaseAsSBaseI cb = new AMI_Test_SBaseAsSBaseI(); test.SBaseAsSBase_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("base with known derived as base... "); - System.out.flush(); + out.print("base with known derived as base... "); + out.flush(); { SBase sb; SBSKnownDerived sbskd = null; @@ -1075,19 +1120,19 @@ public class AllTests test(sbskd != null); test(sbskd.sbskd.equals("SBSKnownDerived.sbskd")); } - System.out.println("ok"); + out.println("ok"); - System.out.print("base with known derived as base (AMI)... "); - System.out.flush(); + out.print("base with known derived as base (AMI)... "); + out.flush(); { AMI_Test_SBSKnownDerivedAsSBaseI cb = new AMI_Test_SBSKnownDerivedAsSBaseI(); test.SBSKnownDerivedAsSBase_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("base with known derived as known derived... "); - System.out.flush(); + out.print("base with known derived as known derived... "); + out.flush(); { SBSKnownDerived sbskd; try @@ -1100,19 +1145,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("base with known derived as known derived (AMI)... "); - System.out.flush(); + out.print("base with known derived as known derived (AMI)... "); + out.flush(); { AMI_Test_SBSKnownDerivedAsSBSKnownDerivedI cb = new AMI_Test_SBSKnownDerivedAsSBSKnownDerivedI(); test.SBSKnownDerivedAsSBSKnownDerived_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("base with unknown derived as base... "); - System.out.flush(); + out.print("base with unknown derived as base... "); + out.flush(); { SBase sb; try @@ -1125,19 +1170,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("base with unknown derived as base (AMI)... "); - System.out.flush(); + out.print("base with unknown derived as base (AMI)... "); + out.flush(); { AMI_Test_SBSUnknownDerivedAsSBaseI cb = new AMI_Test_SBSUnknownDerivedAsSBaseI(); test.SBSUnknownDerivedAsSBase_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("unknown with Object as Object... "); - System.out.flush(); + out.print("unknown with Object as Object... "); + out.flush(); { Ice.Object o; try @@ -1153,19 +1198,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("unknown with Object as Object (AMI)... "); - System.out.flush(); + out.print("unknown with Object as Object (AMI)... "); + out.flush(); { AMI_Test_SUnknownAsObjectI cb = new AMI_Test_SUnknownAsObjectI(); test.SUnknownAsObject_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("one-element cycle... "); - System.out.flush(); + out.print("one-element cycle... "); + out.flush(); { try { @@ -1180,19 +1225,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("one-element cycle (AMI)... "); - System.out.flush(); + out.print("one-element cycle (AMI)... "); + out.flush(); { AMI_Test_oneElementCycleI cb = new AMI_Test_oneElementCycleI(); test.oneElementCycle_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("two-element cycle... "); - System.out.flush(); + out.print("two-element cycle... "); + out.flush(); { try { @@ -1212,19 +1257,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("two-element cycle (AMI)... "); - System.out.flush(); + out.print("two-element cycle (AMI)... "); + out.flush(); { AMI_Test_twoElementCycleI cb = new AMI_Test_twoElementCycleI(); test.twoElementCycle_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("known derived pointer slicing as base... "); - System.out.flush(); + out.print("known derived pointer slicing as base... "); + out.flush(); { try { @@ -1253,19 +1298,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("known derived pointer slicing as base (AMI)... "); - System.out.flush(); + out.print("known derived pointer slicing as base (AMI)... "); + out.flush(); { AMI_Test_D1AsBI cb = new AMI_Test_D1AsBI(); test.D1AsB_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("known derived pointer slicing as derived... "); - System.out.flush(); + out.print("known derived pointer slicing as derived... "); + out.flush(); { try { @@ -1288,19 +1333,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("known derived pointer slicing as derived (AMI)... "); - System.out.flush(); + out.print("known derived pointer slicing as derived (AMI)... "); + out.flush(); { AMI_Test_D1AsD1I cb = new AMI_Test_D1AsD1I(); test.D1AsD1_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("unknown derived pointer slicing as base... "); - System.out.flush(); + out.print("unknown derived pointer slicing as base... "); + out.flush(); { try { @@ -1327,19 +1372,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("unknown derived pointer slicing as base (AMI)... "); - System.out.flush(); + out.print("unknown derived pointer slicing as base (AMI)... "); + out.flush(); { AMI_Test_D2AsBI cb = new AMI_Test_D2AsBI(); test.D2AsB_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("param ptr slicing with known first... "); - System.out.flush(); + out.print("param ptr slicing with known first... "); + out.flush(); { try { @@ -1366,19 +1411,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("param ptr slicing with known first (AMI)... "); - System.out.flush(); + out.print("param ptr slicing with known first (AMI)... "); + out.flush(); { AMI_Test_paramTest1I cb = new AMI_Test_paramTest1I(); test.paramTest1_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("param ptr slicing with unknown first... "); - System.out.flush(); + out.print("param ptr slicing with unknown first... "); + out.flush(); { try { @@ -1405,19 +1450,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("param ptr slicing with unknown first (AMI)... "); - System.out.flush(); + out.print("param ptr slicing with unknown first (AMI)... "); + out.flush(); { AMI_Test_paramTest2I cb = new AMI_Test_paramTest2I(); test.paramTest2_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("return value identity with known first... "); - System.out.flush(); + out.print("return value identity with known first... "); + out.flush(); { try { @@ -1431,19 +1476,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("return value identity with known first (AMI)... "); - System.out.flush(); + out.print("return value identity with known first (AMI)... "); + out.flush(); { AMI_Test_returnTest1I cb = new AMI_Test_returnTest1I(); test.returnTest1_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("return value identity with unknown first... "); - System.out.flush(); + out.print("return value identity with unknown first... "); + out.flush(); { try { @@ -1457,19 +1502,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("return value identity with unknown first (AMI)... "); - System.out.flush(); + out.print("return value identity with unknown first (AMI)... "); + out.flush(); { AMI_Test_returnTest2I cb = new AMI_Test_returnTest2I(); test.returnTest2_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("return value identity for input params known first... "); - System.out.flush(); + out.print("return value identity for input params known first... "); + out.flush(); { //try //{ @@ -1518,10 +1563,10 @@ public class AllTests //test(false); //} } - System.out.println("ok"); + out.println("ok"); - System.out.print("return value identity for input params known first (AMI)... "); - System.out.flush(); + out.print("return value identity for input params known first (AMI)... "); + out.flush(); { D1 d1 = new D1(); d1.sb = "D1.sb"; @@ -1566,10 +1611,10 @@ public class AllTests test(b2 != d1); test(b2 != d3); } - System.out.println("ok"); + out.println("ok"); - System.out.print("return value identity for input params unknown first... "); - System.out.flush(); + out.print("return value identity for input params unknown first... "); + out.flush(); { try { @@ -1619,10 +1664,10 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("return value identity for input params unknown first (AMI)... "); - System.out.flush(); + out.print("return value identity for input params unknown first (AMI)... "); + out.flush(); { D1 d1 = new D1(); d1.sb = "D1.sb"; @@ -1668,10 +1713,10 @@ public class AllTests test(b2 != d1); test(b2 != d3); } - System.out.println("ok"); + out.println("ok"); - System.out.print("remainder unmarshaling (3 instances)... "); - System.out.flush(); + out.print("remainder unmarshaling (3 instances)... "); + out.flush(); { try { @@ -1699,19 +1744,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("remainder unmarshaling (3 instances) (AMI)... "); - System.out.flush(); + out.print("remainder unmarshaling (3 instances) (AMI)... "); + out.flush(); { AMI_Test_paramTest3I cb = new AMI_Test_paramTest3I(); test.paramTest3_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("remainder unmarshaling (4 instances)... "); - System.out.flush(); + out.print("remainder unmarshaling (4 instances)... "); + out.flush(); { try { @@ -1733,19 +1778,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("remainder unmarshaling (4 instances) (AMI)... "); - System.out.flush(); + out.print("remainder unmarshaling (4 instances) (AMI)... "); + out.flush(); { AMI_Test_paramTest4I cb = new AMI_Test_paramTest4I(); test.paramTest4_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("param ptr slicing, instance marshaled in unknown derived as base... "); - System.out.flush(); + out.print("param ptr slicing, instance marshaled in unknown derived as base... "); + out.flush(); { try { @@ -1775,10 +1820,10 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("param ptr slicing, instance marshaled in unknown derived as base (AMI)... "); - System.out.flush(); + out.print("param ptr slicing, instance marshaled in unknown derived as base (AMI)... "); + out.flush(); { B b1 = new B(); b1.sb = "B.sb(1)"; @@ -1804,10 +1849,10 @@ public class AllTests test(r.sb.equals("D3.sb")); test(r.pb == r); } - System.out.println("ok"); + out.println("ok"); - System.out.print("param ptr slicing, instance marshaled in unknown derived as derived... "); - System.out.flush(); + out.print("param ptr slicing, instance marshaled in unknown derived as derived... "); + out.flush(); { try { @@ -1839,10 +1884,10 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("param ptr slicing, instance marshaled in unknown derived as derived (AMI)... "); - System.out.flush(); + out.print("param ptr slicing, instance marshaled in unknown derived as derived (AMI)... "); + out.flush(); { D1 d11 = new D1(); d11.sb = "D1.sb(1)"; @@ -1871,10 +1916,10 @@ public class AllTests test(r.sb.equals("D3.sb")); test(r.pb == r); } - System.out.println("ok"); + out.println("ok"); - System.out.print("sequence slicing... "); - System.out.flush(); + out.print("sequence slicing... "); + out.flush(); { try { @@ -1961,10 +2006,10 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("sequence slicing (AMI)... "); - System.out.flush(); + out.print("sequence slicing (AMI)... "); + out.flush(); { SS ss; { @@ -2046,10 +2091,10 @@ public class AllTests test(ss2d1.ice_id().equals("::Test::D1")); test(ss2d3.ice_id().equals("::Test::B")); } - System.out.println("ok"); + out.println("ok"); - System.out.print("dictionary slicing... "); - System.out.flush(); + out.print("dictionary slicing... "); + out.flush(); { try { @@ -2103,10 +2148,10 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("dictionary slicing (AMI)... "); - System.out.flush(); + out.print("dictionary slicing (AMI)... "); + out.flush(); { java.util.Map<Integer, B> bin = new java.util.HashMap<Integer, B>(); java.util.Map<Integer, B> bout; @@ -2155,10 +2200,10 @@ public class AllTests test(d1.pd1 == d1); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("base exception thrown as base exception... "); - System.out.flush(); + out.print("base exception thrown as base exception... "); + out.flush(); { try { @@ -2178,19 +2223,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("base exception thrown as base exception (AMI)... "); - System.out.flush(); + out.print("base exception thrown as base exception (AMI)... "); + out.flush(); { AMI_Test_throwBaseAsBaseI cb = new AMI_Test_throwBaseAsBaseI(); test.throwBaseAsBase_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("derived exception thrown as base exception... "); - System.out.flush(); + out.print("derived exception thrown as base exception... "); + out.flush(); { try { @@ -2216,19 +2261,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("derived exception thrown as base exception (AMI)... "); - System.out.flush(); + out.print("derived exception thrown as base exception (AMI)... "); + out.flush(); { AMI_Test_throwDerivedAsBaseI cb = new AMI_Test_throwDerivedAsBaseI(); test.throwDerivedAsBase_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("derived exception thrown as derived exception... "); - System.out.flush(); + out.print("derived exception thrown as derived exception... "); + out.flush(); { try { @@ -2254,19 +2299,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("derived exception thrown as derived exception (AMI)... "); - System.out.flush(); + out.print("derived exception thrown as derived exception (AMI)... "); + out.flush(); { AMI_Test_throwDerivedAsDerivedI cb = new AMI_Test_throwDerivedAsDerivedI(); test.throwDerivedAsDerived_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("unknown derived exception thrown as base exception... "); - System.out.flush(); + out.print("unknown derived exception thrown as base exception... "); + out.flush(); { try { @@ -2286,19 +2331,19 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("unknown derived exception thrown as base exception (AMI)... "); - System.out.flush(); + out.print("unknown derived exception thrown as base exception (AMI)... "); + out.flush(); { AMI_Test_throwUnknownDerivedAsBaseI cb = new AMI_Test_throwUnknownDerivedAsBaseI(); test.throwUnknownDerivedAsBase_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); - System.out.print("forward-declared class... "); - System.out.flush(); + out.print("forward-declared class... "); + out.flush(); { try { @@ -2311,16 +2356,16 @@ public class AllTests test(false); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("forward-declared class (AMI)... "); - System.out.flush(); + out.print("forward-declared class (AMI)... "); + out.flush(); { AMI_Test_useForwardI cb = new AMI_Test_useForwardI(); test.useForward_async(cb); test(cb.check()); } - System.out.println("ok"); + out.println("ok"); return test; } diff --git a/java/test/Ice/slicing/objects/Client.java b/java/test/Ice/slicing/objects/Client.java new file mode 100644 index 00000000000..9da5e157e9b --- /dev/null +++ b/java/test/Ice/slicing/objects/Client.java @@ -0,0 +1,39 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.slicing.objects; + +import test.Ice.slicing.objects.client.Test.TestIntfPrx; + +public class Client extends test.Util.Application +{ + public int run(String[] args) + { + Ice.Communicator communicator = communicator(); + TestIntfPrx test = AllTests.allTests(communicator, false, getWriter()); + test.shutdown(); + return 0; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.client"); + return initData; + } + + public static void main(String[] args) + { + Client app = new Client(); + int result = app.main("Client", args); + System.gc(); + System.exit(result); + } +} diff --git a/java/test/Ice/slicing/objects/Test.ice b/java/test/Ice/slicing/objects/ClientPrivate.ice index 2fa79937f53..7b24f96e17d 100644 --- a/java/test/Ice/slicing/objects/Test.ice +++ b/java/test/Ice/slicing/objects/ClientPrivate.ice @@ -7,12 +7,15 @@ // // ********************************************************************** -#ifndef TEST_ICE -#define TEST_ICE +#ifndef CLIENTPRIVATE_ICE +#define CLIENTPRIVATE_ICE +[["java:package:test.Ice.slicing.objects.client"]] module Test { +// Duplicate types from Test.ice. We cannot use #include since +// that will use the types from the same prefix. class SBase { string sb; @@ -109,6 +112,25 @@ class Forward; // Forward-declared class defined in another compilation void shutdown(); }; +// Types private to the client. +class D3 extends B +{ + string sd3; + B pd3; +}; + +class Forward; + +class Hidden +{ + Forward f; +}; + +class Forward +{ + Hidden h; +}; + }; #endif diff --git a/java/test/Ice/slicing/objects/Server.java b/java/test/Ice/slicing/objects/Server.java new file mode 100644 index 00000000000..03531fd03d2 --- /dev/null +++ b/java/test/Ice/slicing/objects/Server.java @@ -0,0 +1,41 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.slicing.objects; + +public class Server extends test.Util.Application +{ + public int run(String[] args) + { + Ice.Communicator communicator = communicator(); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + Ice.Object object = new TestI(adapter); + adapter.add(object, Ice.Util.stringToIdentity("Test")); + adapter.activate(); + return WAIT; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.slicing.objects.server"); + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); + return initData; + } + + public static void main(String[] args) + { + Server app = new Server(); + int result = app.main("Server", args); + System.gc(); + System.exit(result); + } +} diff --git a/java/test/Ice/slicing/objects/ServerPrivate.ice b/java/test/Ice/slicing/objects/ServerPrivate.ice new file mode 100644 index 00000000000..f9c897b5d34 --- /dev/null +++ b/java/test/Ice/slicing/objects/ServerPrivate.ice @@ -0,0 +1,158 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef SERVERPRIVATE_ICE +#define SERVERPRIVATE_ICE + +[["java:package:test.Ice.slicing.objects.server"]] +module Test +{ + +// Duplicate types from Test.ice. We cannot use #include since +// that will use the types from the same prefix. +class SBase +{ + string sb; +}; + +class SBSKnownDerived extends SBase +{ + string sbskd; +}; + +class B +{ + string sb; + B pb; +}; + +class D1 extends B +{ + string sd1; + B pd1; +}; + +sequence<B> BSeq; + +class SS1 +{ + BSeq s; +}; + +class SS2 +{ + BSeq s; +}; + +struct SS +{ + SS1 c1; + SS2 c2; +}; + +dictionary<int, B> BDict; + +exception BaseException +{ + string sbe; + B pb; +}; + +exception DerivedException extends BaseException +{ + string sde; + D1 pd1; +}; + +class Forward; // Forward-declared class defined in another compilation unit + +["ami"] interface TestIntf +{ + Object SBaseAsObject(); + SBase SBaseAsSBase(); + SBase SBSKnownDerivedAsSBase(); + SBSKnownDerived SBSKnownDerivedAsSBSKnownDerived(); + + SBase SBSUnknownDerivedAsSBase(); + + Object SUnknownAsObject(); + + B oneElementCycle(); + B twoElementCycle(); + B D1AsB(); + D1 D1AsD1(); + B D2AsB(); + + void paramTest1(out B p1, out B p2); + void paramTest2(out B p2, out B p1); + B paramTest3(out B p1, out B p2); + B paramTest4(out B p); + + B returnTest1(out B p1, out B p2); + B returnTest2(out B p2, out B p1); + B returnTest3(B p1, B p2); + + SS sequenceTest(SS1 p1, SS2 p2); + + BDict dictionaryTest(BDict bin, out BDict bout); + + void throwBaseAsBase() throws BaseException; + void throwDerivedAsBase() throws BaseException; + void throwDerivedAsDerived() throws DerivedException; + void throwUnknownDerivedAsBase() throws BaseException; + + void useForward(out Forward f); // Use of forward-declared class to verify that code is generated correctly. + + void shutdown(); +}; + +// Types private to the server. +class SBSUnknownDerived extends SBase +{ + string sbsud; +}; + +class SUnknown +{ + string su; +}; + +class D2 extends B +{ + string sd2; + B pd2; +}; + +class D4 extends B +{ + B p1; + B p2; +}; + +exception UnknownDerivedException extends BaseException +{ + string sude; + D2 pd2; +}; + +class Forward; + +class Hidden +{ + Forward f; +}; + +class Forward +{ + Hidden h; +}; + +}; + +#endif diff --git a/java/test/Ice/slicing/objectsAMD/TestAMD.ice b/java/test/Ice/slicing/objects/ServerPrivateAMD.ice index f9d187d345b..46a7dc86eda 100644 --- a/java/test/Ice/slicing/objectsAMD/TestAMD.ice +++ b/java/test/Ice/slicing/objects/ServerPrivateAMD.ice @@ -7,12 +7,15 @@ // // ********************************************************************** -#ifndef TEST_AMD_ICE -#define TEST_AMD_ICE +#ifndef SERVERPRIVATE_ICE +#define SERVERPRIVATE_ICE +[["java:package:test.Ice.slicing.objects.serverAMD"]] module Test { +// Duplicate types from Test.ice. We cannot use #include since +// that will use the types from the same prefix. class SBase { string sb; @@ -109,6 +112,47 @@ class Forward; // Forward-declared class defined in another compilation void shutdown(); }; +// Types private to the server. +class SBSUnknownDerived extends SBase +{ + string sbsud; +}; + +class SUnknown +{ + string su; +}; + +class D2 extends B +{ + string sd2; + B pd2; +}; + +class D4 extends B +{ + B p1; + B p2; +}; + +exception UnknownDerivedException extends BaseException +{ + string sude; + D2 pd2; +}; + +class Forward; + +class Hidden +{ + Forward f; +}; + +class Forward +{ + Hidden h; +}; + }; #endif diff --git a/java/test/Ice/slicing/objects/ssrc/TestI.java b/java/test/Ice/slicing/objects/TestI.java index 94b313cdcac..d7f53bf5f15 100644 --- a/java/test/Ice/slicing/objects/ssrc/TestI.java +++ b/java/test/Ice/slicing/objects/TestI.java @@ -7,7 +7,28 @@ // // ********************************************************************** -import Test.*; +package test.Ice.slicing.objects; + +import test.Ice.slicing.objects.server.Test.B; +import test.Ice.slicing.objects.server.Test.BDictHolder; +import test.Ice.slicing.objects.server.Test.BHolder; +import test.Ice.slicing.objects.server.Test.BaseException; +import test.Ice.slicing.objects.server.Test.D1; +import test.Ice.slicing.objects.server.Test.D2; +import test.Ice.slicing.objects.server.Test.D4; +import test.Ice.slicing.objects.server.Test.DerivedException; +import test.Ice.slicing.objects.server.Test.Forward; +import test.Ice.slicing.objects.server.Test.ForwardHolder; +import test.Ice.slicing.objects.server.Test.Hidden; +import test.Ice.slicing.objects.server.Test.SBSKnownDerived; +import test.Ice.slicing.objects.server.Test.SBSUnknownDerived; +import test.Ice.slicing.objects.server.Test.SBase; +import test.Ice.slicing.objects.server.Test.SS; +import test.Ice.slicing.objects.server.Test.SS1; +import test.Ice.slicing.objects.server.Test.SS2; +import test.Ice.slicing.objects.server.Test.SUnknown; +import test.Ice.slicing.objects.server.Test.UnknownDerivedException; +import test.Ice.slicing.objects.server.Test._TestIntfDisp; public final class TestI extends _TestIntfDisp { diff --git a/java/test/Ice/slicing/objects/build.xml b/java/test/Ice/slicing/objects/build.xml deleted file mode 100644 index 2dc899785f0..00000000000 --- a/java/test/Ice/slicing/objects/build.xml +++ /dev/null @@ -1,91 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_slicing_objects" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <property name="cclass.dir" value="classes"/> - <property name="sclass.dir" value="sclasses"/> - <property name="cgen.dir" value="generated"/> - <property name="sgen.dir" value="sgenerated"/> - <property name="csrc.dir" value="csrc"/> - <property name="ssrc.dir" value="ssrc"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${cgen.dir}"/> - <slice2java outputdir="${cgen.dir}"> - <meta value="${java2metadata}"/> - <includepath> - <pathelement path="."/> - </includepath> - <fileset dir="." includes="Test.ice Forward.ice"/> - </slice2java> - <slice2java outputdir="${cgen.dir}"> - <meta value="${java2metadata}"/> - <includepath> - <pathelement path="."/> - </includepath> - <fileset dir="${csrc.dir}" includes="ClientPrivate.ice"/> - </slice2java> - <mkdir dir="${sgen.dir}"/> - <slice2java outputdir="${sgen.dir}"> - <meta value="${java2metadata}"/> - <includepath> - <pathelement path="."/> - </includepath> - <fileset dir="." includes="Test.ice Forward.ice"/> - </slice2java> - <slice2java outputdir="${sgen.dir}"> - <meta value="${java2metadata}"/> - <includepath> - <pathelement path="."/> - </includepath> - <fileset dir="${ssrc.dir}" includes="ServerPrivate.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${cclass.dir}"/> - <javac srcdir="${cgen.dir}" destdir="${cclass.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="${csrc.dir}" destdir="${cclass.dir}" - classpathref="ice.classpath" excludes="${cgen.dir}/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <mkdir dir="${sclass.dir}"/> - <javac srcdir="${sgen.dir}" destdir="${sclass.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="${ssrc.dir}" destdir="${sclass.dir}" - classpathref="ice.classpath" excludes="${sgen.dir}/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${cgen.dir}"/> - <delete dir="${sgen.dir}"/> - <delete dir="${cclass.dir}"/> - <delete dir="${sclass.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/slicing/objects/csrc/Client.java b/java/test/Ice/slicing/objects/csrc/Client.java deleted file mode 100644 index a6bd5eb1c17..00000000000 --- a/java/test/Ice/slicing/objects/csrc/Client.java +++ /dev/null @@ -1,55 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -import Test.*; - -public class Client -{ - private static int - run(String[] args, Ice.Communicator communicator) - { - TestIntfPrx test = AllTests.allTests(communicator, false); - test.shutdown(); - return 0; - } - - public static void - main(String[] args) - { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - - System.gc(); - System.exit(status); - } -} diff --git a/java/test/Ice/slicing/objects/csrc/ClientPrivate.ice b/java/test/Ice/slicing/objects/csrc/ClientPrivate.ice deleted file mode 100644 index aaadf4bb9a2..00000000000 --- a/java/test/Ice/slicing/objects/csrc/ClientPrivate.ice +++ /dev/null @@ -1,26 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef CLIENTPRIVATE_ICE -#define CLIENTPRIVATE_ICE - -#include <Test.ice> - -module Test -{ - -class D3 extends B -{ - string sd3; - B pd3; -}; - -}; - -#endif diff --git a/java/test/Ice/slicing/objects/ssrc/Server.java b/java/test/Ice/slicing/objects/ssrc/Server.java deleted file mode 100644 index 6b7c1b84ffa..00000000000 --- a/java/test/Ice/slicing/objects/ssrc/Server.java +++ /dev/null @@ -1,59 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -public class Server -{ - private static int - run(String[] args, Ice.Communicator communicator) - { - Ice.Properties properties = communicator.getProperties(); - properties.setProperty("Ice.Warn.Dispatch", "0"); - properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.Object object = new TestI(adapter); - adapter.add(object, Ice.Util.stringToIdentity("Test")); - adapter.activate(); - communicator.waitForShutdown(); - return 0; - } - - public static void - main(String[] args) - { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - - System.gc(); - System.exit(status); - } -} diff --git a/java/test/Ice/slicing/objects/ssrc/ServerPrivate.ice b/java/test/Ice/slicing/objects/ssrc/ServerPrivate.ice deleted file mode 100644 index 2f4189919c4..00000000000 --- a/java/test/Ice/slicing/objects/ssrc/ServerPrivate.ice +++ /dev/null @@ -1,48 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef SERVERPRIVATE_ICE -#define SERVERPRIVATE_ICE - -#include <Test.ice> - -module Test -{ - -class SBSUnknownDerived extends SBase -{ - string sbsud; -}; - -class SUnknown -{ - string su; -}; - -class D2 extends B -{ - string sd2; - B pd2; -}; - -class D4 extends B -{ - B p1; - B p2; -}; - -exception UnknownDerivedException extends BaseException -{ - string sude; - D2 pd2; -}; - -}; - -#endif diff --git a/java/test/Ice/slicing/objectsAMD/Forward.ice b/java/test/Ice/slicing/objectsAMD/Forward.ice deleted file mode 100644 index 1c48e3ff480..00000000000 --- a/java/test/Ice/slicing/objectsAMD/Forward.ice +++ /dev/null @@ -1,30 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef FORWARD_ICE -#define FORWARD_ICE - -module Test -{ - -class Forward; - -class Hidden -{ - Forward f; -}; - -class Forward -{ - Hidden h; -}; - -}; - -#endif diff --git a/java/test/Ice/slicing/objectsAMD/Server.java b/java/test/Ice/slicing/objectsAMD/Server.java deleted file mode 100644 index 028930fc8c1..00000000000 --- a/java/test/Ice/slicing/objectsAMD/Server.java +++ /dev/null @@ -1,59 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -public class Server -{ - private static int - run(String[] args, Ice.Communicator communicator) - { - Ice.Properties properties = communicator.getProperties(); - properties.setProperty("Ice.Warn.Dispatch", "0"); - properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.Object object = new TestI(adapter); - adapter.add(object, communicator.stringToIdentity("Test")); - adapter.activate(); - communicator.waitForShutdown(); - return 0; - } - - public static void - main(String[] args) - { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - - System.gc(); - System.exit(status); - } -} diff --git a/java/test/Ice/slicing/objectsAMD/ServerPrivateAMD.ice b/java/test/Ice/slicing/objectsAMD/ServerPrivateAMD.ice deleted file mode 100644 index 18265cf711c..00000000000 --- a/java/test/Ice/slicing/objectsAMD/ServerPrivateAMD.ice +++ /dev/null @@ -1,48 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#ifndef SERVERPRIVATE_AMD_ICE -#define SERVERPRIVATE_AMD_ICE - -#include <TestAMD.ice> - -module Test -{ - -class SBSUnknownDerived extends SBase -{ - string sbsud; -}; - -class SUnknown -{ - string su; -}; - -class D2 extends B -{ - string sd2; - B pd2; -}; - -class D4 extends B -{ - B p1; - B p2; -}; - -exception UnknownDerivedException extends BaseException -{ - string sude; - D2 pd2; -}; - -}; - -#endif diff --git a/java/test/Ice/slicing/objectsAMD/build.xml b/java/test/Ice/slicing/objectsAMD/build.xml deleted file mode 100644 index aaaacfe8ec9..00000000000 --- a/java/test/Ice/slicing/objectsAMD/build.xml +++ /dev/null @@ -1,53 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_slicing_exceptionsAMD" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <includepath> - <pathelement path="."/> - </includepath> - <fileset dir="." includes="TestAMD.ice"/> - <fileset dir="." includes="ServerPrivateAMD.ice"/> - <fileset dir="." includes="Forward.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/stream/Client.java b/java/test/Ice/stream/Client.java index ebeb12378df..0b2db115625 100644 --- a/java/test/Ice/stream/Client.java +++ b/java/test/Ice/stream/Client.java @@ -7,7 +7,32 @@ // // ********************************************************************** -public class Client +package test.Ice.stream; + +import java.io.PrintWriter; + +import test.Ice.stream.Test.BoolSHelper; +import test.Ice.stream.Test.ByteSHelper; +import test.Ice.stream.Test.DoubleSHelper; +import test.Ice.stream.Test.FloatSHelper; +import test.Ice.stream.Test.IntSHelper; +import test.Ice.stream.Test.LongSHelper; +import test.Ice.stream.Test.MyClass; +import test.Ice.stream.Test.MyClassPrxHelper; +import test.Ice.stream.Test.MyClassSHelper; +import test.Ice.stream.Test.MyEnum; +import test.Ice.stream.Test.MyEnumSHelper; +import test.Ice.stream.Test.MyInterface; +import test.Ice.stream.Test.MyInterfaceHelper; +import test.Ice.stream.Test.MyInterfaceHolder; +import test.Ice.stream.Test.ShortSHelper; +import test.Ice.stream.Test.SmallStruct; +import test.Ice.stream.Test.StringSHelper; +import test.Ice.stream.Test._MyInterfaceDisp; + +import java.io.PrintWriter; + +public class Client extends test.Util.Application { private static void test(boolean b) @@ -20,7 +45,7 @@ public class Client private static class TestObjectWriter extends Ice.ObjectWriter { - TestObjectWriter(Test.MyClass obj) + TestObjectWriter(MyClass obj) { this.obj = obj; } @@ -32,7 +57,7 @@ public class Client called = true; } - Test.MyClass obj; + MyClass obj; boolean called = false; } @@ -41,12 +66,12 @@ public class Client public void read(Ice.InputStream in, boolean rid) { - obj = new Test.MyClass(); + obj = new MyClass(); obj.__read(in, rid); called = true; } - Test.MyClass obj; + MyClass obj; boolean called = false; } @@ -55,7 +80,7 @@ public class Client public Ice.Object create(String type) { - assert(type.equals(Test.MyClass.ice_staticId())); + assert(type.equals(MyClass.ice_staticId())); return new TestObjectReader(); } @@ -65,7 +90,7 @@ public class Client } } - private static class MyInterfaceI extends Test._MyInterfaceDisp + private static class MyInterfaceI extends _MyInterfaceDisp { }; @@ -74,7 +99,7 @@ public class Client public Ice.Object create(String type) { - assert(type.equals(Test._MyInterfaceDisp.ice_staticId())); + assert(type.equals(_MyInterfaceDisp.ice_staticId())); return new MyInterfaceI(); } @@ -99,7 +124,7 @@ public class Client { MyClassFactoryWrapper() { - _factory = Test.MyClass.ice_factory(); + _factory = MyClass.ice_factory(); } public Ice.Object @@ -122,34 +147,36 @@ public class Client private Ice.ObjectFactory _factory; } - private static int - run(String[] args, Ice.Communicator communicator) + public int + run(String[] args) { + Ice.Communicator comm = communicator(); MyClassFactoryWrapper factoryWrapper = new MyClassFactoryWrapper(); - communicator.addObjectFactory(factoryWrapper, Test.MyClass.ice_staticId()); - communicator.addObjectFactory(new MyInterfaceFactory(), Test._MyInterfaceDisp.ice_staticId()); + comm.addObjectFactory(factoryWrapper, MyClass.ice_staticId()); + comm.addObjectFactory(new MyInterfaceFactory(), _MyInterfaceDisp.ice_staticId()); Ice.InputStream in; Ice.OutputStream out; - System.out.print("testing primitive types... "); - System.out.flush(); + PrintWriter printWriter = getWriter(); + printWriter.print("testing primitive types... "); + printWriter.flush(); { byte[] data = new byte[0]; - in = Ice.Util.createInputStream(communicator, data); + in = Ice.Util.createInputStream(comm, data); in.destroy(); } { - out = Ice.Util.createOutputStream(communicator); + out = Ice.Util.createOutputStream(comm); out.startEncapsulation(); out.writeBool(true); out.endEncapsulation(); byte[] data = out.finished(); out.destroy(); - in = Ice.Util.createInputStream(communicator, data); + in = Ice.Util.createInputStream(comm, data); in.startEncapsulation(); test(in.readBool()); in.endEncapsulation(); @@ -158,7 +185,7 @@ public class Client { byte[] data = new byte[0]; - in = Ice.Util.createInputStream(communicator, data); + in = Ice.Util.createInputStream(comm, data); try { in.readBool(); @@ -171,103 +198,103 @@ public class Client } { - out = Ice.Util.createOutputStream(communicator); + out = Ice.Util.createOutputStream(comm); out.writeBool(true); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); + in = Ice.Util.createInputStream(comm, data); test(in.readBool()); out.destroy(); in.destroy(); } { - out = Ice.Util.createOutputStream(communicator); + out = Ice.Util.createOutputStream(comm); out.writeByte((byte)1); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); + in = Ice.Util.createInputStream(comm, data); test(in.readByte() == (byte)1); out.destroy(); in.destroy(); } { - out = Ice.Util.createOutputStream(communicator); + out = Ice.Util.createOutputStream(comm); out.writeShort((short)2); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); + in = Ice.Util.createInputStream(comm, data); test(in.readShort() == (short)2); out.destroy(); in.destroy(); } { - out = Ice.Util.createOutputStream(communicator); + out = Ice.Util.createOutputStream(comm); out.writeInt(3); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); + in = Ice.Util.createInputStream(comm, data); test(in.readInt() == 3); out.destroy(); in.destroy(); } { - out = Ice.Util.createOutputStream(communicator); + out = Ice.Util.createOutputStream(comm); out.writeLong(4); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); + in = Ice.Util.createInputStream(comm, data); test(in.readLong() == 4); out.destroy(); in.destroy(); } { - out = Ice.Util.createOutputStream(communicator); + out = Ice.Util.createOutputStream(comm); out.writeFloat((float)5.0); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); + in = Ice.Util.createInputStream(comm, data); test(in.readFloat() == (float)5.0); out.destroy(); in.destroy(); } { - out = Ice.Util.createOutputStream(communicator); + out = Ice.Util.createOutputStream(comm); out.writeDouble(6.0); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); + in = Ice.Util.createInputStream(comm, data); test(in.readDouble() == 6.0); out.destroy(); in.destroy(); } { - out = Ice.Util.createOutputStream(communicator); + out = Ice.Util.createOutputStream(comm); out.writeString("hello world"); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); + in = Ice.Util.createInputStream(comm, data); test(in.readString().equals("hello world")); out.destroy(); in.destroy(); } - System.out.println("ok"); + printWriter.println("ok"); - System.out.print("testing constructed types... "); - System.out.flush(); + printWriter.print("testing constructed types... "); + printWriter.flush(); { - out = Ice.Util.createOutputStream(communicator); - Test.MyEnum.enum3.ice_write(out); + out = Ice.Util.createOutputStream(comm); + MyEnum.enum3.ice_write(out); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); - test(Test.MyEnum.ice_read(in) == Test.MyEnum.enum3); + in = Ice.Util.createInputStream(comm, data); + test(MyEnum.ice_read(in) == MyEnum.enum3); out.destroy(); in.destroy(); } { - out = Ice.Util.createOutputStream(communicator); - Test.SmallStruct s = new Test.SmallStruct(); + out = Ice.Util.createOutputStream(comm); + SmallStruct s = new SmallStruct(); s.bo = true; s.by = (byte)1; s.sh = (short)2; @@ -276,12 +303,12 @@ public class Client s.f = (float)5.0; s.d = 6.0; s.str = "7"; - s.e = Test.MyEnum.enum2; - s.p = Test.MyClassPrxHelper.uncheckedCast(communicator.stringToProxy("test:default")); + s.e = MyEnum.enum2; + s.p = MyClassPrxHelper.uncheckedCast(comm.stringToProxy("test:default")); s.ice_write(out); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); - Test.SmallStruct s2 = new Test.SmallStruct(); + in = Ice.Util.createInputStream(comm, data); + SmallStruct s2 = new SmallStruct(); s2.ice_read(in); test(s2.equals(s)); out.destroy(); @@ -296,11 +323,11 @@ public class Client true, false }; - out = Ice.Util.createOutputStream(communicator); - Test.BoolSHelper.write(out, arr); + out = Ice.Util.createOutputStream(comm); + BoolSHelper.write(out, arr); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); - boolean[] arr2 = Test.BoolSHelper.read(in); + in = Ice.Util.createInputStream(comm, data); + boolean[] arr2 = BoolSHelper.read(in); test(java.util.Arrays.equals(arr2, arr)); out.destroy(); in.destroy(); @@ -314,24 +341,24 @@ public class Client (byte)0x12, (byte)0x22 }; - out = Ice.Util.createOutputStream(communicator); - Test.ByteSHelper.write(out, arr); + out = Ice.Util.createOutputStream(comm); + ByteSHelper.write(out, arr); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); - byte[] arr2 = Test.ByteSHelper.read(in); + in = Ice.Util.createInputStream(comm, data); + byte[] arr2 = ByteSHelper.read(in); test(java.util.Arrays.equals(arr2, arr)); out.destroy(); in.destroy(); } { - Serialize.Small small = new Serialize.Small(); + test.Ice.stream.Serialize.Small small = new test.Ice.stream.Serialize.Small(); small.i = 99; - out = Ice.Util.createOutputStream(communicator); + out = Ice.Util.createOutputStream(comm); out.writeSerializable(small); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); - Serialize.Small small2 = (Serialize.Small)in.readSerializable(); + in = Ice.Util.createInputStream(comm, data); + test.Ice.stream.Serialize.Small small2 = (test.Ice.stream.Serialize.Small)in.readSerializable(); test(small2.i == 99); out.destroy(); in.destroy(); @@ -345,11 +372,11 @@ public class Client (short)0x12, (short)0x22 }; - out = Ice.Util.createOutputStream(communicator); - Test.ShortSHelper.write(out, arr); + out = Ice.Util.createOutputStream(comm); + ShortSHelper.write(out, arr); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); - short[] arr2 = Test.ShortSHelper.read(in); + in = Ice.Util.createInputStream(comm, data); + short[] arr2 = ShortSHelper.read(in); test(java.util.Arrays.equals(arr2, arr)); out.destroy(); in.destroy(); @@ -363,11 +390,11 @@ public class Client 0x12, 0x22 }; - out = Ice.Util.createOutputStream(communicator); - Test.IntSHelper.write(out, arr); + out = Ice.Util.createOutputStream(comm); + IntSHelper.write(out, arr); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); - int[] arr2 = Test.IntSHelper.read(in); + in = Ice.Util.createInputStream(comm, data); + int[] arr2 = IntSHelper.read(in); test(java.util.Arrays.equals(arr2, arr)); out.destroy(); in.destroy(); @@ -381,11 +408,11 @@ public class Client 0x12, 0x22 }; - out = Ice.Util.createOutputStream(communicator); - Test.LongSHelper.write(out, arr); + out = Ice.Util.createOutputStream(comm); + LongSHelper.write(out, arr); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); - long[] arr2 = Test.LongSHelper.read(in); + in = Ice.Util.createInputStream(comm, data); + long[] arr2 = LongSHelper.read(in); test(java.util.Arrays.equals(arr2, arr)); out.destroy(); in.destroy(); @@ -399,11 +426,11 @@ public class Client (float)3, (float)4 }; - out = Ice.Util.createOutputStream(communicator); - Test.FloatSHelper.write(out, arr); + out = Ice.Util.createOutputStream(comm); + FloatSHelper.write(out, arr); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); - float[] arr2 = Test.FloatSHelper.read(in); + in = Ice.Util.createInputStream(comm, data); + float[] arr2 = FloatSHelper.read(in); test(java.util.Arrays.equals(arr2, arr)); out.destroy(); in.destroy(); @@ -417,11 +444,11 @@ public class Client (double)3, (double)4 }; - out = Ice.Util.createOutputStream(communicator); - Test.DoubleSHelper.write(out, arr); + out = Ice.Util.createOutputStream(comm); + DoubleSHelper.write(out, arr); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); - double[] arr2 = Test.DoubleSHelper.read(in); + in = Ice.Util.createInputStream(comm, data); + double[] arr2 = DoubleSHelper.read(in); test(java.util.Arrays.equals(arr2, arr)); out.destroy(); in.destroy(); @@ -435,43 +462,43 @@ public class Client "string3", "string4" }; - out = Ice.Util.createOutputStream(communicator); - Test.StringSHelper.write(out, arr); + out = Ice.Util.createOutputStream(comm); + StringSHelper.write(out, arr); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); - String[] arr2 = Test.StringSHelper.read(in); + in = Ice.Util.createInputStream(comm, data); + String[] arr2 = StringSHelper.read(in); test(java.util.Arrays.equals(arr2, arr)); out.destroy(); in.destroy(); } { - final Test.MyEnum[] arr = + final MyEnum[] arr = { - Test.MyEnum.enum3, - Test.MyEnum.enum2, - Test.MyEnum.enum1, - Test.MyEnum.enum2 + MyEnum.enum3, + MyEnum.enum2, + MyEnum.enum1, + MyEnum.enum2 }; - out = Ice.Util.createOutputStream(communicator); - Test.MyEnumSHelper.write(out, arr); + out = Ice.Util.createOutputStream(comm); + MyEnumSHelper.write(out, arr); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); - Test.MyEnum[] arr2 = Test.MyEnumSHelper.read(in); + in = Ice.Util.createInputStream(comm, data); + MyEnum[] arr2 = MyEnumSHelper.read(in); test(java.util.Arrays.equals(arr2, arr)); out.destroy(); in.destroy(); } { - Test.MyClass[] arr = new Test.MyClass[4]; + MyClass[] arr = new MyClass[4]; for(int i = 0; i < arr.length; ++i) { - arr[i] = new Test.MyClass(); + arr[i] = new MyClass(); arr[i].c = arr[i]; arr[i].o = arr[i]; - arr[i].s = new Test.SmallStruct(); - arr[i].s.e = Test.MyEnum.enum2; + arr[i].s = new SmallStruct(); + arr[i].s.e = MyEnum.enum2; arr[i].seq1 = new boolean[] { true, false, true, false }; arr[i].seq2 = new byte[] { (byte)1, (byte)2, (byte)3, (byte)4 }; arr[i].seq3 = new short[] { (short)1, (short)2, (short)3, (short)4 }; @@ -480,17 +507,17 @@ public class Client arr[i].seq6 = new float[] { (float)1, (float)2, (float)3, (float)4 }; arr[i].seq7 = new double[] { (double)1, (double)2, (double)3, (double)4 }; arr[i].seq8 = new String[] { "string1", "string2", "string3", "string4" }; - arr[i].seq9 = new Test.MyEnum[] { Test.MyEnum.enum3, Test.MyEnum.enum2, Test.MyEnum.enum1 }; - arr[i].seq10 = new Test.MyClass[4]; // null elements. - arr[i].d = new java.util.HashMap<String, Test.MyClass>(); + arr[i].seq9 = new MyEnum[] { MyEnum.enum3, MyEnum.enum2, MyEnum.enum1 }; + arr[i].seq10 = new MyClass[4]; // null elements. + arr[i].d = new java.util.HashMap<String, MyClass>(); arr[i].d.put("hi", arr[i]); } - out = Ice.Util.createOutputStream(communicator); - Test.MyClassSHelper.write(out, arr); + out = Ice.Util.createOutputStream(comm); + MyClassSHelper.write(out, arr); out.writePendingObjects(); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); - Test.MyClass[] arr2 = Test.MyClassSHelper.read(in); + in = Ice.Util.createInputStream(comm, data); + MyClass[] arr2 = MyClassSHelper.read(in); in.readPendingObjects(); test(arr2.length == arr.length); for(int i = 0; i < arr2.length; ++i) @@ -498,7 +525,7 @@ public class Client test(arr2[i] != null); test(arr2[i].c == arr2[i]); test(arr2[i].o == arr2[i]); - test(arr2[i].s.e == Test.MyEnum.enum2); + test(arr2[i].s.e == MyEnum.enum2); test(java.util.Arrays.equals(arr2[i].seq1, arr[i].seq1)); test(java.util.Arrays.equals(arr2[i].seq2, arr[i].seq2)); test(java.util.Arrays.equals(arr2[i].seq3, arr[i].seq3)); @@ -515,30 +542,30 @@ public class Client } { - Test.MyInterface i = new MyInterfaceI(); - out = Ice.Util.createOutputStream(communicator); - Test.MyInterfaceHelper.write(out, i); + MyInterface i = new MyInterfaceI(); + out = Ice.Util.createOutputStream(comm); + MyInterfaceHelper.write(out, i); out.writePendingObjects(); byte[] data = out.finished(); - in = Ice.Util.createInputStream(communicator, data); - Test.MyInterfaceHolder j = new Test.MyInterfaceHolder(); - Test.MyInterfaceHelper.read(in, j); + in = Ice.Util.createInputStream(comm, data); + MyInterfaceHolder j = new MyInterfaceHolder(); + MyInterfaceHelper.read(in, j); in.readPendingObjects(); test(j.value != null); } { - out = Ice.Util.createOutputStream(communicator); - Test.MyClass obj = new Test.MyClass(); - obj.s = new Test.SmallStruct(); - obj.s.e = Test.MyEnum.enum2; + out = Ice.Util.createOutputStream(comm); + MyClass obj = new MyClass(); + obj.s = new SmallStruct(); + obj.s.e = MyEnum.enum2; TestObjectWriter writer = new TestObjectWriter(obj); out.writeObject(writer); out.writePendingObjects(); byte[] data = out.finished(); test(writer.called); factoryWrapper.setFactory(new TestObjectFactory()); - in = Ice.Util.createInputStream(communicator, data); + in = Ice.Util.createInputStream(comm, data); TestReadObjectCallback cb = new TestReadObjectCallback(); in.readObject(cb); in.readPendingObjects(); @@ -547,47 +574,29 @@ public class Client TestObjectReader reader = (TestObjectReader)cb.obj; test(reader.called); test(reader.obj != null); - test(reader.obj.s.e == Test.MyEnum.enum2); + test(reader.obj.s.e == MyEnum.enum2); out.destroy(); in.destroy(); } - System.out.println("ok"); + printWriter.println("ok"); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.stream"); + return initData; + } + public static void main(String[] args) + { + Client app = new Client(); + int result = app.main("Client", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/stream/Serialize/Small.java b/java/test/Ice/stream/Serialize/Small.java index be92e68edea..e06d6b587ed 100644 --- a/java/test/Ice/stream/Serialize/Small.java +++ b/java/test/Ice/stream/Serialize/Small.java @@ -7,7 +7,7 @@ // // ********************************************************************** -package Serialize; +package test.Ice.stream.Serialize; public class Small implements java.io.Serializable // Fewer than 254 bytes when serialized. { diff --git a/java/test/Ice/stream/Test.ice b/java/test/Ice/stream/Test.ice index 03ac2d92dc3..364624f35c7 100644 --- a/java/test/Ice/stream/Test.ice +++ b/java/test/Ice/stream/Test.ice @@ -10,6 +10,7 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Ice.stream"]] module Test { @@ -22,7 +23,7 @@ enum MyEnum class MyClass; -["java:serializable:Serialize.Small"] sequence<byte> SerialSmall; +["java:serializable:test.Ice.stream.Serialize.Small"] sequence<byte> SerialSmall; struct SmallStruct { diff --git a/java/test/Ice/stream/build.xml b/java/test/Ice/stream/build.xml deleted file mode 100644 index e719c890777..00000000000 --- a/java/test/Ice/stream/build.xml +++ /dev/null @@ -1,52 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_stream" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java stream="on" outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="." destdir="${class.dir}" includes="Serialize/**" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" excludes="${generated.dir}/** Serialize/**" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/stream/run.py b/java/test/Ice/stream/run.py index 47e0b8dafab..4e8769e647c 100755 --- a/java/test/Ice/stream/run.py +++ b/java/test/Ice/stream/run.py @@ -20,10 +20,8 @@ if len(path) == 0: sys.path.append(os.path.join(path[0])) from scripts import * -TestUtil.addClasspath(os.path.join(os.getcwd(), "classes")) - print "starting test...", -clientProc = TestUtil.startClient("Client", startReader = False) +clientProc = TestUtil.startClient("test.Ice.stream.Client",startReader=False) print "ok" clientProc.startReader() diff --git a/java/test/Ice/throughput/Client.java b/java/test/Ice/throughput/Client.java new file mode 100644 index 00000000000..3b2fc70d977 --- /dev/null +++ b/java/test/Ice/throughput/Client.java @@ -0,0 +1,500 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.throughput; + +import java.io.PrintWriter; + +import test.Ice.throughput.Demo.ByteSeqSize; +import test.Ice.throughput.Demo.Fixed; +import test.Ice.throughput.Demo.FixedSeqSize; +import test.Ice.throughput.Demo.StringDouble; +import test.Ice.throughput.Demo.StringDoubleSeqSize; +import test.Ice.throughput.Demo.StringSeqSize; +import test.Ice.throughput.Demo.ThroughputPrx; +import test.Ice.throughput.Demo.ThroughputPrxHelper; + +public class Client extends test.Util.Application +{ + class ShutdownHook extends Thread + { + public void + run() + { + try + { + communicator().destroy(); + } + catch(Ice.LocalException ex) + { + ex.printStackTrace(); + } + } + } + + private static void + menu() + { + System.out.println( + "usage:\n" + + "\n" + + "toggle type of data to send:\n" + + "1: sequence of bytes (default)\n" + + "2: sequence of strings (\"hello\")\n" + + "3: sequence of structs with a string (\"hello\") and a double\n" + + "4: sequence of structs with two ints and a double\n" + + "\n" + + "select test to run:\n" + + "t: Send sequence as twoway\n" + + "o: Send sequence as oneway\n" + + "r: Receive sequence\n" + + "e: Echo (send and receive) sequence\n" + + "\n" + + "other commands:\n" + + "s: shutdown server\n" + + "x: exit\n" + + "?: help\n"); + } + + public int + run(String[] args) + { + PrintWriter out = getWriter(); + PrintWriter err = out; + if(args.length > 0) + { + err.println(appName() + ": too many arguments"); + return 1; + } + + // + // Since this is an interactive demo we want to clear the + // Application installed interrupt callback and install our + // own shutdown hook. + // + ThroughputPrx throughput = ThroughputPrxHelper.checkedCast(communicator().propertyToProxy("Throughput.Proxy")); + if(throughput == null) + { + err.println("invalid proxy"); + return 1; + } + ThroughputPrx throughputOneway = ThroughputPrxHelper.uncheckedCast(throughput.ice_oneway()); + + byte[] byteSeq = new byte[ByteSeqSize.value]; + + String[] stringSeq = new String[StringSeqSize.value]; + for(int i = 0; i < StringSeqSize.value; ++i) + { + stringSeq[i] = "hello"; + } + + StringDouble[] structSeq = new StringDouble[StringDoubleSeqSize.value]; + for(int i = 0; i < StringDoubleSeqSize.value; ++i) + { + structSeq[i] = new StringDouble(); + structSeq[i].s = "hello"; + structSeq[i].d = 3.14; + } + + Fixed[] fixedSeq = new Fixed[FixedSeqSize.value]; + for(int i = 0; i < FixedSeqSize.value; ++i) + { + fixedSeq[i] = new Fixed(); + fixedSeq[i].i = 0; + fixedSeq[i].j = 0; + fixedSeq[i].d = 0; + } + + // + // A method needs to be invoked thousands of times before the + // JIT compiler will convert it to native code. To ensure an + // accurate throughput measurement, we need to "warm up" the + // JIT compiler. + // + +/* + { + byte[] emptyBytes= new byte[1]; + String[] emptyStrings = new String[1]; + StringDouble[] emptyStructs = new StringDouble[1]; + emptyStructs[0] = new StringDouble(); + Fixed[] emptyFixed = new Fixed[1]; + emptyFixed[0] = new Fixed(); + + throughput.startWarmup(); + + out.print("warming up the client/server..."); + out.flush(); + for(int i = 0; i < 10000; i++) + { + throughput.sendByteSeq(emptyBytes); + throughput.sendStringSeq(emptyStrings); + throughput.sendStructSeq(emptyStructs); + throughput.sendFixedSeq(emptyFixed); + + throughput.recvByteSeq(); + throughput.recvStringSeq(); + throughput.recvStructSeq(); + throughput.recvFixedSeq(); + + throughput.echoByteSeq(emptyBytes); + throughput.echoStringSeq(emptyStrings); + throughput.echoStructSeq(emptyStructs); + throughput.echoFixedSeq(emptyFixed); + } + throughput.endWarmup(); + + out.println(" ok"); + } +*/ + + menu(); + + java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in)); + + char currentType = '1'; + int seqSize = ByteSeqSize.value; + + // Initial ping to setup the connection. + throughput.ice_ping(); + + String[] input = { "t", "o", "r", "e", "s", "x", null }; + int inputIndex = 0; + String line = null; + do + { + try + { + //out.print("==> "); + //out.flush(); + //line = in.readLine(); + //if(line == null) + //{ + // break; + //} + line = input[inputIndex++]; + + long tmsec = System.currentTimeMillis(); + final int repetitions = 100; + + if(line.equals("1") || line.equals("2") || line.equals("3") || line.equals("4")) + { + currentType = line.charAt(0); + + switch(currentType) + { + case '1': + { + out.println("using byte sequences"); + seqSize = ByteSeqSize.value; + break; + } + + case '2': + { + out.println("using string sequences"); + seqSize = StringSeqSize.value; + break; + } + + case '3': + { + out.println("using variable-length struct sequences"); + seqSize = StringDoubleSeqSize.value; + break; + } + + case '4': + { + out.println("using fixed-length struct sequences"); + seqSize = FixedSeqSize.value; + break; + } + } + } + else if(line.equals("t") || line.equals("o") || line.equals("r") || line.equals("e")) + { + char c = line.charAt(0); + + switch(c) + { + case 't': + case 'o': + { + out.print("sending"); + break; + } + + case 'r': + { + out.print("receiving"); + break; + } + + case 'e': + { + out.print("sending and receiving"); + break; + } + } + + out.print(" " + repetitions); + switch(currentType) + { + case '1': + { + out.print(" byte"); + break; + } + + case '2': + { + out.print(" string"); + break; + } + + case '3': + { + out.print(" variable-length struct"); + break; + } + + case '4': + { + out.print(" fixed-length struct"); + break; + } + } + + out.print(" sequences of size " + seqSize); + + if(c == 'o') + { + out.print(" as oneway"); + } + + out.println("..."); + out.flush(); + + for(int i = 0; i < repetitions; ++i) + { + switch(currentType) + { + case '1': + { + switch(c) + { + case 't': + { + throughput.sendByteSeq(byteSeq); + break; + } + + case 'o': + { + throughputOneway.sendByteSeq(byteSeq); + break; + } + + case 'r': + { + throughput.recvByteSeq(); + break; + } + + case 'e': + { + throughput.echoByteSeq(byteSeq); + break; + } + } + break; + } + + case '2': + { + switch(c) + { + case 't': + { + throughput.sendStringSeq(stringSeq); + break; + } + + case 'o': + { + throughputOneway.sendStringSeq(stringSeq); + break; + } + + case 'r': + { + throughput.recvStringSeq(); + break; + } + + case 'e': + { + throughput.echoStringSeq(stringSeq); + break; + } + } + break; + } + + case '3': + { + switch(c) + { + case 't': + { + throughput.sendStructSeq(structSeq); + break; + } + + case 'o': + { + throughputOneway.sendStructSeq(structSeq); + break; + } + + case 'r': + { + throughput.recvStructSeq(); + break; + } + + case 'e': + { + throughput.echoStructSeq(structSeq); + break; + } + } + break; + } + + case '4': + { + switch(c) + { + case 't': + { + throughput.sendFixedSeq(fixedSeq); + break; + } + + case 'o': + { + throughputOneway.sendFixedSeq(fixedSeq); + break; + } + + case 'r': + { + throughput.recvFixedSeq(); + break; + } + + case 'e': + { + throughput.echoFixedSeq(fixedSeq); + break; + } + } + break; + } + } + } + + double dmsec = System.currentTimeMillis() - tmsec; + out.println("time for " + repetitions + " sequences: " + dmsec + "ms"); + out.println("time per sequence: " + dmsec / repetitions + "ms"); + out.flush(); + int wireSize = 0; + switch(currentType) + { + case '1': + { + wireSize = 1; + break; + } + + case '2': + { + wireSize = stringSeq[0].length(); + break; + } + + case '3': + { + wireSize = structSeq[0].s.length(); + wireSize += 8; // Size of double on the wire. + break; + } + + case '4': + { + wireSize = 16; // Size of two ints and a double on the wire. + break; + } + } + double mbit = repetitions * seqSize * wireSize * 8.0 / dmsec / 1000.0; + if(c == 'e') + { + mbit *= 2; + } + out.println("throughput: " + new java.text.DecimalFormat("#.##").format(mbit) + "Mbps"); + out.flush(); + } + else if(line.equals("s")) + { + throughput.shutdown(); + } + else if(line.equals("x")) + { + // Nothing to do + } + else if(line.equals("?")) + { + menu(); + } + else + { + out.println("unknown command `" + line + "'"); + menu(); + } + } + catch(Ice.LocalException ex) + { + ex.printStackTrace(); + } + } + while(!line.equals("x")); + + return 0; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Demo", "test.Ice.throughput"); + initData.properties.setProperty("Throughput.Proxy", "throughput:default -p 10000 -h 127.0.0.1"); + initData.properties.setProperty("Ice.ACM.Client", "0"); + return initData; + } + + public static void main(String[] args) + { + Client app = new Client(); + int result = app.main("Client", args); + System.gc(); + System.exit(result); + } +} diff --git a/java/test/Ice/throughput/README b/java/test/Ice/throughput/README new file mode 100644 index 00000000000..5dc47deceaa --- /dev/null +++ b/java/test/Ice/throughput/README @@ -0,0 +1,11 @@ +A simple throughput demo that allows you to send sequences of various +types between client and server and to measure the maximum bandwidth +that can be achieved using serialized synchronous requests. + +To run the demo, first start the server: + +$ java Server + +In a separate window, start the client: + +$ java Client diff --git a/java/test/Ice/throughput/Server.java b/java/test/Ice/throughput/Server.java new file mode 100644 index 00000000000..2e8b49d6bc1 --- /dev/null +++ b/java/test/Ice/throughput/Server.java @@ -0,0 +1,39 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.throughput; + +public class Server extends test.Util.Application +{ + public int + run(String[] args) + { + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Throughput"); + adapter.add(new ThroughputI(), communicator().stringToIdentity("throughput")); + adapter.activate(); + return WAIT; + } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Demo", "test.Ice.throughput"); + initData.properties.setProperty("Throughput.Endpoints", "default -p 10000 -h 127.0.0.1"); + return initData; + } + + public static void main(String[] args) + { + Server app = new Server(); + int result = app.main("Server", args); + System.gc(); + System.exit(result); + } +} diff --git a/java/test/Ice/throughput/Throughput.ice b/java/test/Ice/throughput/Throughput.ice new file mode 100644 index 00000000000..2c2c0f5cf45 --- /dev/null +++ b/java/test/Ice/throughput/Throughput.ice @@ -0,0 +1,68 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef THROUGHPUT_ICE +#define THROUGHPUT_ICE + +[["java:package:test.Ice.throughput"]] +module Demo +{ + +sequence<byte> ByteSeq; +//const int ByteSeqSize = 500000; +const int ByteSeqSize = 250000; + +sequence<string> StringSeq; +const int StringSeqSize = 50000; + +struct StringDouble +{ + string s; + double d; +}; +sequence<StringDouble> StringDoubleSeq; +const int StringDoubleSeqSize = 50000; + +struct Fixed +{ + int i; + int j; + double d; +}; +sequence<Fixed> FixedSeq; +const int FixedSeqSize = 50000; + +interface Throughput +{ + bool needsWarmup(); + void startWarmup(); + void endWarmup(); + + void sendByteSeq(ByteSeq seq); + ByteSeq recvByteSeq(); + ByteSeq echoByteSeq(ByteSeq seq); + + void sendStringSeq(StringSeq seq); + StringSeq recvStringSeq(); + StringSeq echoStringSeq(StringSeq seq); + + void sendStructSeq(StringDoubleSeq seq); + StringDoubleSeq recvStructSeq(); + StringDoubleSeq echoStructSeq(StringDoubleSeq seq); + + void sendFixedSeq(FixedSeq seq); + FixedSeq recvFixedSeq(); + FixedSeq echoFixedSeq(FixedSeq seq); + + void shutdown(); +}; + +}; + +#endif diff --git a/java/test/Ice/throughput/ThroughputI.java b/java/test/Ice/throughput/ThroughputI.java new file mode 100644 index 00000000000..ce550441ec5 --- /dev/null +++ b/java/test/Ice/throughput/ThroughputI.java @@ -0,0 +1,185 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Ice.throughput; + +import test.Ice.throughput.Demo.ByteSeqSize; +import test.Ice.throughput.Demo.Fixed; +import test.Ice.throughput.Demo.FixedSeqSize; +import test.Ice.throughput.Demo.StringDouble; +import test.Ice.throughput.Demo.StringDoubleSeqSize; +import test.Ice.throughput.Demo.StringSeqSize; +import test.Ice.throughput.Demo._ThroughputDisp; + +public final class ThroughputI extends _ThroughputDisp +{ + public + ThroughputI() + { + _byteSeq = new byte[ByteSeqSize.value]; + + _stringSeq = new String[StringSeqSize.value]; + for(int i = 0; i < StringSeqSize.value; ++i) + { + _stringSeq[i] = "hello"; + } + + _structSeq = new StringDouble[StringDoubleSeqSize.value]; + for(int i = 0; i < StringDoubleSeqSize.value; ++i) + { + _structSeq[i] = new StringDouble(); + _structSeq[i].s = "hello"; + _structSeq[i].d = 3.14; + } + + _fixedSeq = new Fixed[FixedSeqSize.value]; + for(int i = 0; i < FixedSeqSize.value; ++i) + { + _fixedSeq[i] = new Fixed(); + _fixedSeq[i].i = 0; + _fixedSeq[i].j = 0; + _fixedSeq[i].d = 0; + } + } + + public boolean + needsWarmup(Ice.Current current) + { + _warmup = false; + return _needsWarmup; + } + + public void + startWarmup(Ice.Current current) + { + _warmup = true; + } + + public void + endWarmup(Ice.Current current) + { + _warmup = false; + _needsWarmup = false; + } + + public void + sendByteSeq(byte[] seq, Ice.Current current) + { + } + + public byte[] + recvByteSeq(Ice.Current current) + { + if(_warmup) + { + return _emptyByteSeq; + } + else + { + return _byteSeq; + } + } + + public byte[] + echoByteSeq(byte[] seq, Ice.Current current) + { + return seq; + } + + public void + sendStringSeq(String[] seq, Ice.Current current) + { + } + + public String[] + recvStringSeq(Ice.Current current) + { + if(_warmup) + { + return _emptyStringSeq; + } + else + { + return _stringSeq; + } + } + + public String[] + echoStringSeq(String[] seq, Ice.Current current) + { + return seq; + } + + public void + sendStructSeq(StringDouble[] seq, Ice.Current current) + { + } + + public StringDouble[] + recvStructSeq(Ice.Current current) + { + if(_warmup) + { + return _emptyStructSeq; + } + else + { + return _structSeq; + } + } + + public StringDouble[] + echoStructSeq(StringDouble[] seq, Ice.Current current) + { + return seq; + } + + public void + sendFixedSeq(Fixed[] seq, Ice.Current current) + { + } + + public Fixed[] + recvFixedSeq(Ice.Current current) + { + if(_warmup) + { + return _emptyFixedSeq; + } + else + { + return _fixedSeq; + } + } + + public Fixed[] + echoFixedSeq(Fixed[] seq, Ice.Current current) + { + return seq; + } + + public void + shutdown(Ice.Current current) + { + current.adapter.getCommunicator().shutdown(); + } + + private byte[] _byteSeq; + private String[] _stringSeq; + private StringDouble[] _structSeq; + private Fixed[] _fixedSeq; + + private byte[] _emptyByteSeq = new byte[0]; + private String[] _emptyStringSeq = new String[0]; + private StringDouble[] _emptyStructSeq = new StringDouble[0]; + private Fixed[] _emptyFixedSeq = new Fixed[0]; + + private boolean _needsWarmup = true; + private boolean _warmup = false; +} diff --git a/java/test/Ice/exceptionsAMD/build.xml b/java/test/Ice/throughput/build.xml index 0ef6ec18d95..c6f86fdf086 100644 --- a/java/test/Ice/exceptionsAMD/build.xml +++ b/java/test/Ice/throughput/build.xml @@ -9,7 +9,7 @@ ********************************************************************** --> -<project name="test_Ice_exceptions" default="all" basedir="."> +<project name="demo_Ice_throughput" default="all" basedir="."> <!-- set global properties for this build --> <property name="top.dir" value="../../.."/> @@ -22,22 +22,24 @@ <mkdir dir="${generated.dir}"/> <slice2java outputdir="${generated.dir}"> <meta value="${java2metadata}"/> - <fileset dir="." includes="TestAMD.ice"/> + <fileset dir="." includes="Throughput.ice"/> </slice2java> </target> <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> + debug="${debug}"> + <classpath refid="ice.classpath"/> <compilerarg value="${javac.lint}"/> - </javac> + </javac> <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> + excludes="generated/**" debug="${debug}"> + <classpath refid="ice.classpath"/> <compilerarg value="${javac.lint}"/> - </javac> + </javac> </target> - + <target name="all" depends="compile"/> <target name="clean"> diff --git a/java/test/Ice/throughput/config.client b/java/test/Ice/throughput/config.client new file mode 100644 index 00000000000..0f763b09d20 --- /dev/null +++ b/java/test/Ice/throughput/config.client @@ -0,0 +1,10 @@ +# +# The client reads this property to create the reference to the +# "Throughput" object in the server. +# +Throughput.Proxy=throughput:default -p 10000 -h 127.0.0.1 + +# +# Disable client-side ACM. +# +Ice.ACM.Client=0 diff --git a/java/test/Ice/throughput/config.server b/java/test/Ice/throughput/config.server new file mode 100644 index 00000000000..1a301bb3ed6 --- /dev/null +++ b/java/test/Ice/throughput/config.server @@ -0,0 +1,11 @@ +# +# The server creates one single object adapter with the name +# "Throughput". The following line sets the endpoints for this +# adapter. +# +Throughput.Endpoints=default -p 10000 -h 127.0.0.1 + +# +# Warn about connection exceptions +# +Ice.Warn.Connections=1 diff --git a/java/test/Ice/throughput/expect.py b/java/test/Ice/throughput/expect.py new file mode 100755 index 00000000000..fd4dfe1205d --- /dev/null +++ b/java/test/Ice/throughput/expect.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# ********************************************************************** +# +# Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +import sys, os + +path = [ ".", "..", "../..", "../../..", "../../../.." ] +head = os.path.dirname(sys.argv[0]) +if len(head) > 0: + path = [os.path.join(head, p) for p in path] +path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "demoscript")) ] +if len(path) == 0: + raise "can't find toplevel directory!" +sys.path.append(path[0]) + +from demoscript import * +from demoscript.Ice import throughput + +server = Util.spawn('java Server --Ice.PrintAdapterReady') +server.expect('.* ready') +client = Util.spawn('java Client') + +throughput.run(client, server) diff --git a/java/test/Ice/timeout/AllTests.java b/java/test/Ice/timeout/AllTests.java index 1f827eb9e47..aa431bb4947 100644 --- a/java/test/Ice/timeout/AllTests.java +++ b/java/test/Ice/timeout/AllTests.java @@ -7,7 +7,14 @@ // // ********************************************************************** -import Test.*; +package test.Ice.timeout; + +import java.io.PrintWriter; + +import test.Ice.timeout.Test.AMI_Timeout_sendData; +import test.Ice.timeout.Test.AMI_Timeout_sleep; +import test.Ice.timeout.Test.TimeoutPrx; +import test.Ice.timeout.Test.TimeoutPrxHelper; public class AllTests { @@ -62,7 +69,7 @@ public class AllTests private boolean _called; } - private static class AMISendData extends Test.AMI_Timeout_sendData + private static class AMISendData extends AMI_Timeout_sendData { public void ice_response() @@ -85,7 +92,7 @@ public class AllTests private Callback callback = new Callback(); } - private static class AMISendDataEx extends Test.AMI_Timeout_sendData + private static class AMISendDataEx extends AMI_Timeout_sendData { public void ice_response() @@ -109,7 +116,7 @@ public class AllTests private Callback callback = new Callback(); } - private static class AMISleep extends Test.AMI_Timeout_sleep + private static class AMISleep extends AMI_Timeout_sleep { public void ice_response() @@ -132,7 +139,7 @@ public class AllTests private Callback callback = new Callback(); } - private static class AMISleepEx extends Test.AMI_Timeout_sleep + private static class AMISleepEx extends AMI_Timeout_sleep { public void ice_response() @@ -156,13 +163,21 @@ public class AllTests private Callback callback = new Callback(); } - public static Test.TimeoutPrx - allTests(Ice.Communicator communicator, java.io.PrintStream out) + public static TimeoutPrx + allTests(test.Util.Application app, PrintWriter out) { + Ice.Communicator communicator = app.communicator(); + String sref = "timeout:default -p 12010 -t 10000"; Ice.ObjectPrx obj = communicator.stringToProxy(sref); test(obj != null); + int mult = 1; + if(communicator.getProperties().getPropertyWithDefault("Ice.Default.Protocol", "tcp").equals("ssl")) + { + mult = 4; + } + TimeoutPrx timeout = TimeoutPrxHelper.checkedCast(obj); test(timeout != null); @@ -172,8 +187,8 @@ public class AllTests // // Expect ConnectTimeoutException. // - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); - to.holdAdapter(2000); + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500 * mult)); + to.holdAdapter(2000 * mult); to.ice_getConnection().close(true); // Force a reconnect. try { @@ -190,8 +205,8 @@ public class AllTests // Expect success. // timeout.op(); // Ensure adapter is active. - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(2000)); - to.holdAdapter(500); + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(2000 * mult)); + to.holdAdapter(500 * mult); to.ice_getConnection().close(true); // Force a reconnect. try { @@ -210,10 +225,10 @@ public class AllTests // // Expect TimeoutException. // - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500 * mult)); try { - to.sleep(750); + to.sleep(750 * mult); test(false); } catch(Ice.TimeoutException ex) @@ -226,10 +241,10 @@ public class AllTests // Expect success. // timeout.op(); // Ensure adapter is active. - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1500)); + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1500 * mult)); try { - to.sleep(500); + to.sleep(500 * mult); } catch(Ice.TimeoutException ex) { @@ -244,8 +259,8 @@ public class AllTests // // Expect TimeoutException. // - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); - to.holdAdapter(2000); + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500 * mult)); + to.holdAdapter(2000 * mult); try { byte[] seq = new byte[100000]; @@ -262,11 +277,19 @@ public class AllTests // Expect success. // timeout.op(); // Ensure adapter is active. - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1500)); - to.holdAdapter(500); + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1500 * mult)); + to.holdAdapter(500 * mult); try { - byte[] seq = new byte[512 * 1024]; + byte[] seq; + if(mult == 1) + { + seq = new byte[512 * 1024]; + } + else + { + seq = new byte[5 * 1024]; + } to.sendData(seq); } catch(Ice.TimeoutException ex) @@ -282,9 +305,9 @@ public class AllTests // // Expect TimeoutException. // - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500 * mult)); AMISleepEx cb = new AMISleepEx(); - to.sleep_async(cb, 2000); + to.sleep_async(cb, 2000 * mult); test(cb.check()); } { @@ -292,9 +315,9 @@ public class AllTests // Expect success. // timeout.op(); // Ensure adapter is active. - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1500)); + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1500 * mult)); AMISleep cb = new AMISleep(); - to.sleep_async(cb, 500); + to.sleep_async(cb, 500 * mult); test(cb.check()); } out.println("ok"); @@ -305,9 +328,17 @@ public class AllTests // // Expect TimeoutException. // - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); - to.holdAdapter(2000); - byte[] seq = new byte[512 * 1024]; + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500 * mult)); + to.holdAdapter(2000 * mult); + byte[] seq; + if(mult == 1) + { + seq = new byte[512 * 1024]; + } + else + { + seq = new byte[5 * 1024]; + } AMISendDataEx cb = new AMISendDataEx(); to.sendData_async(cb, seq); test(cb.check()); @@ -317,9 +348,17 @@ public class AllTests // Expect success. // timeout.op(); // Ensure adapter is active. - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1500)); - to.holdAdapter(500); - byte[] seq = new byte[512 * 1024]; + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1500 * mult)); + to.holdAdapter(500 * mult); + byte[] seq; + if(mult == 1) + { + seq = new byte[512 * 1024]; + } + else + { + seq = new byte[5 * 1024]; + } AMISendData cb = new AMISendData(); to.sendData_async(cb, seq); test(cb.check()); @@ -336,12 +375,19 @@ public class AllTests String[] args = new String[0]; Ice.InitializationData initData = new Ice.InitializationData(); initData.properties = communicator.getProperties()._clone(); - initData.properties.setProperty("Ice.Override.Timeout", "500"); - Ice.Communicator comm = Ice.Util.initialize(args, initData); + if(mult == 1) + { + initData.properties.setProperty("Ice.Override.Timeout", "500"); + } + else + { + initData.properties.setProperty("Ice.Override.Timeout", "2000"); + } + Ice.Communicator comm = app.initialize(initData); TimeoutPrx to = TimeoutPrxHelper.checkedCast(comm.stringToProxy(sref)); try { - to.sleep(750); + to.sleep(750 * mult); test(false); } catch(Ice.TimeoutException ex) @@ -352,10 +398,10 @@ public class AllTests // Calling ice_timeout() should have no effect. // timeout.op(); // Ensure adapter is active. - to = TimeoutPrxHelper.checkedCast(to.ice_timeout(1000)); + to = TimeoutPrxHelper.checkedCast(to.ice_timeout(1000 * mult)); try { - to.sleep(750); + to.sleep(750 * mult); test(false); } catch(Ice.TimeoutException ex) @@ -371,10 +417,18 @@ public class AllTests String[] args = new String[0]; Ice.InitializationData initData = new Ice.InitializationData(); initData.properties = communicator.getProperties()._clone(); - initData.properties.setProperty("Ice.Override.ConnectTimeout", "1000"); - Ice.Communicator comm = Ice.Util.initialize(args, initData); + if(mult == 1) + { + initData.properties.setProperty("Ice.Override.ConnectTimeout", "1000"); + } + else + { + initData.properties.setProperty("Ice.Override.ConnectTimeout", "4000"); + } + + Ice.Communicator comm = app.initialize(initData); TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(comm.stringToProxy(sref)); - timeout.holdAdapter(3000); + timeout.holdAdapter(3000 * mult); try { to.op(); @@ -388,8 +442,8 @@ public class AllTests // Calling ice_timeout() should have no effect on the connect timeout. // timeout.op(); // Ensure adapter is active. - timeout.holdAdapter(3000); - to = TimeoutPrxHelper.uncheckedCast(to.ice_timeout(3500)); + timeout.holdAdapter(3000 * mult); + to = TimeoutPrxHelper.uncheckedCast(to.ice_timeout(3500 * mult)); try { to.op(); @@ -406,7 +460,7 @@ public class AllTests to.op(); // Force connection. try { - to.sleep(4000); + to.sleep(4000 * mult); test(false); } catch(Ice.TimeoutException ex) diff --git a/java/test/Ice/timeout/Client.java b/java/test/Ice/timeout/Client.java index ef685123ac0..4c4b378d423 100644 --- a/java/test/Ice/timeout/Client.java +++ b/java/test/Ice/timeout/Client.java @@ -7,61 +7,43 @@ // // ********************************************************************** -public class Client +package test.Ice.timeout; + +import test.Ice.timeout.Test.TimeoutPrx; + +public class Client extends test.Util.Application { - public static int - run(String[] args, Ice.Communicator communicator, java.io.PrintStream out) + public int run(String[] args) { - Test.TimeoutPrx timeout = AllTests.allTests(communicator, out); + Ice.Communicator communicator = communicator(); + TimeoutPrx timeout = AllTests.allTests(this, getWriter()); timeout.shutdown(); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.timeout"); - // - // For this test, we want to disable retries. - // - initData.properties.setProperty("Ice.RetryIntervals", "-1"); + // For this test, we want to disable retries. + // + initData.properties.setProperty("Ice.RetryIntervals", "-1"); - // - // This test kills connections, so we don't want warnings. - // - initData.properties.setProperty("Ice.Warn.Connections", "0"); + // + // This test kills connections, so we don't want warnings. + // + initData.properties.setProperty("Ice.Warn.Connections", "0"); - communicator = Ice.Util.initialize(argsH, initData); - status = run(argsH.value, communicator, System.out); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + return initData; + } + public static void main(String[] args) + { + Client app = new Client(); + int result = app.main("Client", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/timeout/Server.java b/java/test/Ice/timeout/Server.java index 503094829f8..d111ebf008a 100644 --- a/java/test/Ice/timeout/Server.java +++ b/java/test/Ice/timeout/Server.java @@ -7,69 +7,38 @@ // // ********************************************************************** -public class Server +package test.Ice.timeout; + +public class Server extends test.Util.Application { - public static int - run(String[] args, Ice.Communicator communicator, java.io.PrintStream out) + public int run(String[] args) { - // - // When running as a MIDlet the properties for the server may be - // overridden by configuration. If it isn't then we assume - // defaults. - // - if(communicator.getProperties().getProperty("TestAdapter.Endpoints").length() == 0) - { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - } - + Ice.Communicator communicator = communicator(); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new TimeoutI(), communicator.stringToIdentity("timeout")); adapter.activate(); - - communicator.waitForShutdown(); - return 0; + return WAIT; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); - - // - // This test kills connections, so we don't want warnings. - // - initData.properties.setProperty("Ice.Warn.Connections", "0"); + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.timeout"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000"); - communicator = Ice.Util.initialize(argsH, initData); - status = run(argsH.value, communicator, System.out); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + // + // This test kills connections, so we don't want warnings. + // + initData.properties.setProperty("Ice.Warn.Connections", "0"); + return initData; + } + public static void main(String[] args) + { + Server app = new Server(); + int result = app.main("Server", args); System.gc(); - System.exit(status); + System.exit(result); } } diff --git a/java/test/Ice/timeout/Test.ice b/java/test/Ice/timeout/Test.ice index 4ba0c07ab71..baebe60f3a9 100644 --- a/java/test/Ice/timeout/Test.ice +++ b/java/test/Ice/timeout/Test.ice @@ -10,6 +10,7 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Ice.timeout"]] module Test { diff --git a/java/test/Ice/timeout/TimeoutI.java b/java/test/Ice/timeout/TimeoutI.java index 90ce2283c81..92545d3e60d 100644 --- a/java/test/Ice/timeout/TimeoutI.java +++ b/java/test/Ice/timeout/TimeoutI.java @@ -7,7 +7,9 @@ // // ********************************************************************** -import Test.*; +package test.Ice.timeout; +import test.Ice.timeout.Test._TimeoutDisp; + class TimeoutI extends _TimeoutDisp { diff --git a/java/test/Ice/timeout/build.xml b/java/test/Ice/timeout/build.xml deleted file mode 100644 index 56880b609e8..00000000000 --- a/java/test/Ice/timeout/build.xml +++ /dev/null @@ -1,51 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_timeout" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - <includepath> - <pathelement path="${slice.dir}" /> - </includepath> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/timeout/timeout.jar b/java/test/Ice/timeout/timeout.jar Binary files differnew file mode 100644 index 00000000000..81d74d85812 --- /dev/null +++ b/java/test/Ice/timeout/timeout.jar diff --git a/java/test/Ice/udp/AllTests.java b/java/test/Ice/udp/AllTests.java index 53f10f5a633..725003dbe31 100644 --- a/java/test/Ice/udp/AllTests.java +++ b/java/test/Ice/udp/AllTests.java @@ -7,6 +7,10 @@ // // ********************************************************************** +package test.Ice.udp; + +import test.Ice.udp.Test.*; + public class AllTests { private static void @@ -18,7 +22,7 @@ public class AllTests } } - public static class PingReplyI extends Test._PingReplyDisp + public static class PingReplyI extends _PingReplyDisp { public synchronized void reply(Ice.Current current) @@ -61,20 +65,21 @@ public class AllTests private int _replies; } - public static Test.TestIntfPrx + public static TestIntfPrx allTests(Ice.Communicator communicator) { communicator.getProperties().setProperty("ReplyAdapter.Endpoints", "udp -p 12030"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ReplyAdapter"); PingReplyI replyI = new PingReplyI(); - Test.PingReplyPrx reply = - (Test.PingReplyPrx)Test.PingReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram(); + + PingReplyPrx reply = + (PingReplyPrx)PingReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram(); adapter.activate(); System.out.print("testing udp... "); System.out.flush(); Ice.ObjectPrx base = communicator.stringToProxy("test:udp -p 12010").ice_datagram(); - Test.TestIntfPrx obj = Test.TestIntfPrxHelper.uncheckedCast(base); + TestIntfPrx obj = TestIntfPrxHelper.uncheckedCast(base); int nRetry = 5; boolean ret = false; @@ -93,7 +98,7 @@ public class AllTests // If the 3 datagrams were not received within the 2 seconds, we try again to // receive 3 new datagrams using a new object. We give up after 5 retries. replyI = new PingReplyI(); - reply =(Test.PingReplyPrx)Test.PingReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram(); + reply = (PingReplyPrx)PingReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram(); } test(ret == true); @@ -149,7 +154,7 @@ public class AllTests host = "239.255.1.1"; } base = communicator.stringToProxy("test:udp -h " + host + " -p 12020").ice_datagram(); - obj = Test.TestIntfPrxHelper.uncheckedCast(base); + obj = TestIntfPrxHelper.uncheckedCast(base); replyI.reset(); obj.ping(reply); diff --git a/java/test/Ice/udp/Client.java b/java/test/Ice/udp/Client.java index 321f89d3ecf..3cab9099e6e 100644 --- a/java/test/Ice/udp/Client.java +++ b/java/test/Ice/udp/Client.java @@ -7,54 +7,33 @@ // // ********************************************************************** -import Test.*; +package test.Ice.udp; -public class Client +import test.Ice.udp.Test.*; + +public class Client extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { - TestIntfPrx obj = AllTests.allTests(communicator); + TestIntfPrx obj = AllTests.allTests(communicator()); obj.shutdown(); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.StringSeqHolder argHolder = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argHolder); - - initData.properties.setProperty("Ice.Warn.Connections", "0"); - initData.properties.setProperty("Ice.UDP.SndSize", "16384"); - - communicator = Ice.Util.initialize(argHolder, initData); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.udp"); + initData.properties.setProperty("Ice.Warn.Connections", "0"); + initData.properties.setProperty("Ice.UDP.SndSize", "16384"); + return initData; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + public static void main(String[] args) + { + Client c = new Client(); + int status = c.main("Client", args); System.gc(); System.exit(status); diff --git a/java/test/Ice/udp/Server.java b/java/test/Ice/udp/Server.java index bedd63218bb..9ce5a7869c8 100644 --- a/java/test/Ice/udp/Server.java +++ b/java/test/Ice/udp/Server.java @@ -7,74 +7,53 @@ // // ********************************************************************** -public class Server +package test.Ice.udp; + +public class Server extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { - Ice.Properties properties = communicator.getProperties(); + Ice.Properties properties = communicator().getProperties(); if(args.length == 1 && args[0].equals("1")) { properties.setProperty("TestAdapter.Endpoints", "udp -p 12010"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - adapter.add(new TestIntfI(), communicator.stringToIdentity("test")); + Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); + adapter.add(new TestIntfI(), communicator().stringToIdentity("test")); adapter.activate(); } - String host; - if(properties.getProperty("Ice.IPv6") == "1") - { - host = "\"ff01::1:1\""; - } - else - { - host = "239.255.1.1"; - } - properties.setProperty("McastTestAdapter.Endpoints", "udp -h " + host + " -p 12020"); - Ice.ObjectAdapter mcastAdapter = communicator.createObjectAdapter("McastTestAdapter"); - mcastAdapter.add(new TestIntfI(), communicator.stringToIdentity("test")); + Ice.ObjectAdapter mcastAdapter = communicator().createObjectAdapter("McastTestAdapter"); + mcastAdapter.add(new TestIntfI(), communicator().stringToIdentity("test")); mcastAdapter.activate(); - communicator.waitForShutdown(); - return 0; + return WAIT; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.Ice.udp"); + initData.properties.setProperty("Ice.Warn.Connections", "0"); + initData.properties.setProperty("Ice.UDP.RcvSize", "16384"); - try + String host; + if(initData.properties.getProperty("Ice.IPv6") == "1") { - Ice.StringSeqHolder argHolder = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argHolder); - - initData.properties.setProperty("Ice.Warn.Connections", "0"); - initData.properties.setProperty("Ice.UDP.RcvSize", "16384"); - - communicator = Ice.Util.initialize(argHolder, initData); - status = run(argHolder.value, communicator); + host = "\"ff01::1:1\""; } - catch(Exception ex) + else { - ex.printStackTrace(); - status = 1; + host = "239.255.1.1"; } + initData.properties.setProperty("McastTestAdapter.Endpoints", "udp -h " + host + " -p 12020"); + return initData; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + public static void main(String[] args) + { + Server c = new Server(); + int status = c.main("Server", args); System.gc(); System.exit(status); diff --git a/java/test/Ice/udp/Test.ice b/java/test/Ice/udp/Test.ice index 0d4af4d441a..4db62e371c3 100644 --- a/java/test/Ice/udp/Test.ice +++ b/java/test/Ice/udp/Test.ice @@ -10,6 +10,7 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.Ice.udp"]] module Test { diff --git a/java/test/Ice/udp/TestIntfI.java b/java/test/Ice/udp/TestIntfI.java index 585d00be077..7865321300b 100644 --- a/java/test/Ice/udp/TestIntfI.java +++ b/java/test/Ice/udp/TestIntfI.java @@ -7,9 +7,13 @@ // // ********************************************************************** -public final class TestIntfI extends Test._TestIntfDisp +package test.Ice.udp; + +import test.Ice.udp.Test.*; + +public final class TestIntfI extends _TestIntfDisp { - public void ping(Test.PingReplyPrx reply, Ice.Current current) + public void ping(PingReplyPrx reply, Ice.Current current) { try { @@ -21,7 +25,7 @@ public final class TestIntfI extends Test._TestIntfDisp } } - public void sendByteSeq(byte[] seq, Test.PingReplyPrx reply, Ice.Current current) + public void sendByteSeq(byte[] seq, PingReplyPrx reply, Ice.Current current) { try { diff --git a/java/test/Ice/udp/build.xml b/java/test/Ice/udp/build.xml deleted file mode 100644 index daebad93de6..00000000000 --- a/java/test/Ice/udp/build.xml +++ /dev/null @@ -1,48 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_Ice_udp" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/Ice/udp/run.py b/java/test/Ice/udp/run.py index 108318b7896..ed8fbcc4ccf 100755 --- a/java/test/Ice/udp/run.py +++ b/java/test/Ice/udp/run.py @@ -27,11 +27,11 @@ num = 5 serverProc = [] for i in range(0, num): print "starting server #%d..." % (i + 1), - serverProc.append(TestUtil.startServer("Server", "%d" % (i + 1) , adapter="McastTestAdapter")) + serverProc.append(TestUtil.startServer("test.Ice.udp.Server", "%d" % (i + 1) , adapter="McastTestAdapter")) print "ok" print "starting client...", -clientProc = TestUtil.startClient("Client", startReader = False) +clientProc = TestUtil.startClient("test.Ice.udp.Client",startReader=False) print "ok" clientProc.startReader() diff --git a/java/test/IceBox/configuration/AllTests.java b/java/test/IceBox/configuration/AllTests.java index 7c71df16120..3f78413a201 100644 --- a/java/test/IceBox/configuration/AllTests.java +++ b/java/test/IceBox/configuration/AllTests.java @@ -7,7 +7,12 @@ // // ********************************************************************** -import Test.*; +package test.IceBox.configuration; + +import java.io.PrintWriter; + +import test.IceBox.configuration.Test.TestIntfPrx; +import test.IceBox.configuration.Test.TestIntfPrxHelper; public class AllTests { @@ -21,7 +26,7 @@ public class AllTests } public static void - allTests(Ice.Communicator communicator) + allTests(Ice.Communicator communicator, PrintWriter out) { TestIntfPrx service1 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12010")); TestIntfPrx service2 = TestIntfPrxHelper.uncheckedCast(communicator.stringToProxy("test:tcp -p 12011")); @@ -30,8 +35,8 @@ public class AllTests if(service1.getProperty("IceBox.InheritProperties").equals("")) { - System.out.print("testing service properties... "); - System.out.flush(); + out.print("testing service properties... "); + out.flush(); test(service1.getProperty("Ice.ProgramName").equals("IceBox-Service1")); test(service1.getProperty("Service").equals("1")); @@ -50,10 +55,10 @@ public class AllTests String[] args2 = {"--Service1.ArgProp=1"}; test(java.util.Arrays.equals(service2.getArgs(), args2)); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing with shared communicator... "); - System.out.flush(); + out.print("testing with shared communicator... "); + out.flush(); test(service3.getProperty("Ice.ProgramName").equals("IceBox-SharedCommunicator")); test(service3.getProperty("Service").equals("4")); @@ -70,12 +75,12 @@ public class AllTests String[] args4 = {"--Service3.Prop=2"}; test(java.util.Arrays.equals(service4.getArgs(), args4)); - System.out.println("ok"); + out.println("ok"); } else { - System.out.print("testing property inheritance... "); - System.out.flush(); + out.print("testing property inheritance... "); + out.flush(); test(service1.getProperty("Ice.ProgramName").equals("IceBox2-Service1")); test(service1.getProperty("ServerProp").equals("1")); @@ -90,7 +95,7 @@ public class AllTests test(service2.getProperty("UnsetMe").equals("")); test(service2.getProperty("Service2.Prop").equals("1")); - System.out.println("ok"); + out.println("ok"); } } } diff --git a/java/test/IceBox/configuration/Client.java b/java/test/IceBox/configuration/Client.java index dfb55d630db..2e5a3f771cf 100644 --- a/java/test/IceBox/configuration/Client.java +++ b/java/test/IceBox/configuration/Client.java @@ -7,52 +7,35 @@ // // ********************************************************************** -import Test.*; +package test.IceBox.configuration; -public class Client +public class Client extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { - AllTests.allTests(communicator); - + Ice.Communicator communicator = communicator(); + AllTests.allTests(communicator, getWriter()); + // - // Shutdown the IceBox server. + // Shutdown the IceBox server. // - Ice.ProcessPrxHelper.uncheckedCast( - communicator.stringToProxy("DemoIceBox/admin -f Process:default -p 9996")).shutdown(); + Ice.ProcessPrxHelper.uncheckedCast(communicator.stringToProxy("DemoIceBox/admin -f Process:default -p 9996")) + .shutdown(); return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.IceBox.configuration"); + return initData; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch (Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + public static void main(String[] args) + { + Client c = new Client(); + int status = c.main("Client", args); System.gc(); System.exit(status); diff --git a/java/test/IceBox/configuration/Test.ice b/java/test/IceBox/configuration/Test.ice index 5300aa44bb0..a192631a5b7 100644 --- a/java/test/IceBox/configuration/Test.ice +++ b/java/test/IceBox/configuration/Test.ice @@ -12,6 +12,7 @@ #include <Ice/BuiltinSequences.ice> +[["java:package:test.IceBox.configuration"]] module Test { diff --git a/java/test/IceBox/configuration/TestI.java b/java/test/IceBox/configuration/TestI.java index f508705abe4..6704e0c5aea 100644 --- a/java/test/IceBox/configuration/TestI.java +++ b/java/test/IceBox/configuration/TestI.java @@ -7,7 +7,10 @@ // // ********************************************************************** -import Test.*; +package test.IceBox.configuration; + +import test.IceBox.configuration.Test._TestIntfDisp; + public class TestI extends _TestIntfDisp { diff --git a/java/test/IceBox/configuration/TestServiceI.java b/java/test/IceBox/configuration/TestServiceI.java index 485d8435c89..3332823e911 100644 --- a/java/test/IceBox/configuration/TestServiceI.java +++ b/java/test/IceBox/configuration/TestServiceI.java @@ -7,11 +7,15 @@ // // ********************************************************************** +package test.IceBox.configuration; + public class TestServiceI implements IceBox.Service { public void start(String name, Ice.Communicator communicator, String[] args) { + communicator.getProperties().setProperty("Ice.Package.Test", "test.IceBox.configuration"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter(name + "OA"); adapter.add(new TestI(args), communicator.stringToIdentity("test")); adapter.activate(); diff --git a/java/test/IceBox/configuration/build.xml b/java/test/IceBox/configuration/build.xml deleted file mode 100644 index e874d67da56..00000000000 --- a/java/test/IceBox/configuration/build.xml +++ /dev/null @@ -1,51 +0,0 @@ -<!-- - ********************************************************************** - - Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. - - This copy of Ice is licensed to you under the terms described in the - ICE_LICENSE file included in this distribution. - - ********************************************************************** ---> - -<project name="test_IceBox_configuration" default="all" basedir="."> - - <!-- set global properties for this build --> - <property name="top.dir" value="../../.."/> - - <!-- import common definitions --> - <import file="${top.dir}/config/common.xml"/> - - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <includepath> - <pathelement path="${slice.dir}" /> - </includepath> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> - - <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> - </target> - -</project> diff --git a/java/test/IceBox/configuration/config.icebox b/java/test/IceBox/configuration/config.icebox index fc46a5c60e3..1dd4b90957c 100644 --- a/java/test/IceBox/configuration/config.icebox +++ b/java/test/IceBox/configuration/config.icebox @@ -2,12 +2,12 @@ Ice.Admin.InstanceName=DemoIceBox Ice.Admin.Endpoints=default -p 9996 -h 127.0.0.1 Ice.ProgramName=IceBox -IceBox.Service.Service1=TestServiceI --Ice.Config=config.service1 --Service1.ArgProp=1 --Service1.Ovrd=2 --Service1.Unset= -a --Arg=2 -IceBox.Service.Service2=TestServiceI --Ice.Config=config.service2 --Service1.ArgProp=1 --IceBox.InheritProperties +IceBox.Service.Service1=test.IceBox.configuration.TestServiceI --Ice.Config=config.service1 --Service1.ArgProp=1 --Service1.Ovrd=2 --Service1.Unset= -a --Arg=2 +IceBox.Service.Service2=test.IceBox.configuration.TestServiceI --Ice.Config=config.service2 --Service1.ArgProp=1 --IceBox.InheritProperties IceBox.UseSharedCommunicator.Service3=1 -IceBox.Service.Service3=TestServiceI --Ice.Config=config.service3 +IceBox.Service.Service3=test.IceBox.configuration.TestServiceI --Ice.Config=config.service3 IceBox.UseSharedCommunicator.Service4=1 -IceBox.Service.Service4=TestServiceI --Ice.Config=config.service4 --Service3.Prop=2 --Ice.Trace.Slicing=3 +IceBox.Service.Service4=test.IceBox.configuration.TestServiceI --Ice.Config=config.service4 --Service3.Prop=2 --Ice.Trace.Slicing=3 IceBox.LoadOrder=Service1 Service2 Service3 Service4 diff --git a/java/test/IceBox/configuration/config.icebox2 b/java/test/IceBox/configuration/config.icebox2 index b94a1152b65..2866764f19f 100644 --- a/java/test/IceBox/configuration/config.icebox2 +++ b/java/test/IceBox/configuration/config.icebox2 @@ -8,9 +8,9 @@ ServerProp=1 OverrideMe=1 UnsetMe=1 -IceBox.Service.Service1=TestServiceI --Ice.Config=config.service1-2 --Service1.ArgProp=2 +IceBox.Service.Service1=test.IceBox.configuration.TestServiceI --Ice.Config=config.service1-2 --Service1.ArgProp=2 IceBox.UseSharedCommunicator.Service2=1 -IceBox.Service.Service2=TestServiceI --Ice.Config=config.service2-2 +IceBox.Service.Service2=test.IceBox.configuration.TestServiceI --Ice.Config=config.service2-2 -IceBox.LoadOrder=Service1 Service2
\ No newline at end of file +IceBox.LoadOrder=Service1 Service2 diff --git a/java/test/IceGrid/simple/AllTests.java b/java/test/IceGrid/simple/AllTests.java index 7df041ec955..716ba020131 100644 --- a/java/test/IceGrid/simple/AllTests.java +++ b/java/test/IceGrid/simple/AllTests.java @@ -7,7 +7,11 @@ // // ********************************************************************** -import Test.*; +package test.IceGrid.simple; +import java.io.PrintWriter; + +import test.IceGrid.simple.Test.TestIntfPrx; +import test.IceGrid.simple.Test.TestIntfPrxHelper; public class AllTests { @@ -69,67 +73,67 @@ public class AllTests } public static void - allTests(Ice.Communicator communicator) + allTests(Ice.Communicator communicator, PrintWriter out) { - System.out.print("testing stringToProxy... "); - System.out.flush(); + out.print("testing stringToProxy... "); + out.flush(); String ref = "test @ TestAdapter"; Ice.ObjectPrx base = communicator.stringToProxy(ref); test(base != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing IceGrid.Locator is present... "); + out.print("testing IceGrid.Locator is present... "); IceGrid.LocatorPrx locator = IceGrid.LocatorPrxHelper.uncheckedCast(base); test(locator != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing checked cast... "); - System.out.flush(); + out.print("testing checked cast... "); + out.flush(); TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base); test(obj != null); test(obj.equals(base)); - System.out.println("ok"); + out.println("ok"); - System.out.print("pinging server... "); - System.out.flush(); + out.print("pinging server... "); + out.flush(); obj.ice_ping(); - System.out.println("ok"); + out.println("ok"); - System.out.print("shutting down server... "); - System.out.flush(); + out.print("shutting down server... "); + out.flush(); obj.shutdown(); - System.out.println("ok"); + out.println("ok"); } public static void - allTestsWithDeploy(Ice.Communicator communicator) + allTestsWithDeploy(Ice.Communicator communicator, PrintWriter out) { - System.out.print("testing stringToProxy... "); - System.out.flush(); + out.print("testing stringToProxy... "); + out.flush(); Ice.ObjectPrx base = communicator.stringToProxy("test @ TestAdapter"); test(base != null); Ice.ObjectPrx base2 = communicator.stringToProxy("test"); test(base2 != null); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing checked cast... "); - System.out.flush(); + out.print("testing checked cast... "); + out.flush(); TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base); test(obj != null); test(obj.equals(base)); TestIntfPrx obj2 = TestIntfPrxHelper.checkedCast(base2); test(obj2 != null); test(obj2.equals(base2)); - System.out.println("ok"); + out.println("ok"); - System.out.print("pinging server... "); - System.out.flush(); + out.print("pinging server... "); + out.flush(); obj.ice_ping(); obj2.ice_ping(); - System.out.println("ok"); + out.println("ok"); - System.out.print("testing reference with unknown identity... "); - System.out.flush(); + out.print("testing reference with unknown identity... "); + out.flush(); try { communicator.stringToProxy("unknown/unknown").ice_ping(); @@ -140,10 +144,10 @@ public class AllTests test(ex.kindOfObject.equals("object")); test(ex.id.equals("unknown/unknown")); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing reference with unknown adapter... "); - System.out.flush(); + out.print("testing reference with unknown adapter... "); + out.flush(); try { communicator.stringToProxy("test @ TestAdapterUnknown").ice_ping(); @@ -154,7 +158,7 @@ public class AllTests test(ex.kindOfObject.equals("object adapter")); test(ex.id.equals("TestAdapterUnknown")); } - System.out.println("ok"); + out.println("ok"); IceGrid.RegistryPrx registry = IceGrid.RegistryPrxHelper.checkedCast( communicator.stringToProxy("IceGrid/Registry")); @@ -197,8 +201,8 @@ public class AllTests test(false); } - System.out.print("testing whether server is still reachable... "); - System.out.flush(); + out.print("testing whether server is still reachable... "); + out.flush(); try { obj = TestIntfPrxHelper.checkedCast(base); @@ -249,7 +253,7 @@ public class AllTests { test(false); } - System.out.println("ok"); + out.println("ok"); try { diff --git a/java/test/IceGrid/simple/Client.java b/java/test/IceGrid/simple/Client.java index 9920cce434d..8fc65043618 100644 --- a/java/test/IceGrid/simple/Client.java +++ b/java/test/IceGrid/simple/Client.java @@ -7,13 +7,13 @@ // // ********************************************************************** -import Test.*; +package test.IceGrid.simple; -public class Client +public class Client extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { + Ice.Communicator communicator = communicator(); boolean withDeploy = false; for(int i = 1; i < args.length; i++) { @@ -26,45 +26,28 @@ public class Client if(!withDeploy) { - AllTests.allTests(communicator); + AllTests.allTests(communicator, getWriter()); } else { - AllTests.allTestsWithDeploy(communicator); - } + AllTests.allTestsWithDeploy(communicator, getWriter()); + } return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - communicator = Ice.Util.initialize(args); - status = run(args, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.IceGrid.simple"); + return initData; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch (Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + public static void main(String[] args) + { + Client c = new Client(); + int status = c.main("Client", args); System.gc(); System.exit(status); diff --git a/java/test/IceGrid/simple/Server.java b/java/test/IceGrid/simple/Server.java index 7a5e11f8cba..12ab71e1c70 100644 --- a/java/test/IceGrid/simple/Server.java +++ b/java/test/IceGrid/simple/Server.java @@ -7,7 +7,9 @@ // // ********************************************************************** -public class Server extends Ice.Application +package test.IceGrid.simple; + +public class Server extends test.Util.Application { public int run(String[] args) @@ -18,7 +20,7 @@ public class Server extends Ice.Application Ice.ObjectAdapter adapter = communicator().createObjectAdapter("TestAdapter"); Ice.Object object = new TestI(adapter); adapter.add(object, communicator().stringToIdentity("test")); - shutdownOnInterrupt(); + //shutdownOnInterrupt(); try { adapter.activate(); @@ -27,15 +29,30 @@ public class Server extends Ice.Application { } communicator().waitForShutdown(); - defaultInterrupt(); + //defaultInterrupt(); return 0; } + + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + // + // Its possible to have batch oneway requests dispatched + // after the adapter is deactivated due to thread + // scheduling so we supress this warning. + // + initData.properties.setProperty("Ice.Warn.Dispatch", "0"); + initData.properties.setProperty("Ice.Package.Test", "test.IceGrid.simple"); + return initData; + } public static void main(String[] args) { - Server server = new Server(); - int status = server.main("test.IceGrid.simple.Server", args); + Server c = new Server(); + int status = c.main("test.IceGrid.simple.Server", args); + System.gc(); System.exit(status); } diff --git a/java/test/IceGrid/simple/Test.ice b/java/test/IceGrid/simple/Test.ice index 4e0f2a6a2b9..5f894c4ca2d 100644 --- a/java/test/IceGrid/simple/Test.ice +++ b/java/test/IceGrid/simple/Test.ice @@ -10,6 +10,7 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.IceGrid.simple"]] module Test { diff --git a/java/test/IceGrid/simple/TestI.java b/java/test/IceGrid/simple/TestI.java index f8954675591..7f673eec367 100644 --- a/java/test/IceGrid/simple/TestI.java +++ b/java/test/IceGrid/simple/TestI.java @@ -7,7 +7,9 @@ // // ********************************************************************** -import Test.*; +package test.IceGrid.simple; + +import test.IceGrid.simple.Test._TestIntfDisp; public class TestI extends _TestIntfDisp { diff --git a/java/test/IceGrid/simple/build.xml b/java/test/IceGrid/simple/build.xml index 04f0df0f7cd..3bd3a2e03ec 100644 --- a/java/test/IceGrid/simple/build.xml +++ b/java/test/IceGrid/simple/build.xml @@ -17,32 +17,9 @@ <!-- import common definitions --> <import file="${top.dir}/config/common.xml"/> - <target name="generate" depends="init"> - <!-- Create the output directory for generated code --> - <mkdir dir="${generated.dir}"/> - <slice2java outputdir="${generated.dir}"> - <meta value="${java2metadata}"/> - <fileset dir="." includes="Test.ice"/> - </slice2java> - </target> - - <target name="compile" depends="generate"> - <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" - classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - <javac srcdir="." destdir="${class.dir}" - classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}"/> - </javac> - </target> - - <target name="all" depends="compile"/> + <target name="all"/> <target name="clean"> - <delete dir="${generated.dir}"/> - <delete dir="${class.dir}"/> <delete quiet="true" includeEmptyDirs="true"> <fileset dir="db/node"/> <fileset dir="db/registry"/> diff --git a/java/test/IceGrid/simple/simple_server.xml b/java/test/IceGrid/simple/simple_server.xml index 4e6504a5536..bdf9f0f43d9 100644 --- a/java/test/IceGrid/simple/simple_server.xml +++ b/java/test/IceGrid/simple/simple_server.xml @@ -3,7 +3,7 @@ <node name="localnode"> <server id="server" exe="java" pwd="." activation="on-demand"> <option>-Djava.security.egd=file:/dev/urandom</option> - <option>Server</option> + <option>test.IceGrid.simple.Server</option> <adapter name="TestAdapter" id="TestAdapter" endpoints="default"> <object identity="test" type="Test"/> </adapter> diff --git a/java/test/IceSSL/configuration/AllTests.java b/java/test/IceSSL/configuration/AllTests.java index 2012b877641..962e287c929 100644 --- a/java/test/IceSSL/configuration/AllTests.java +++ b/java/test/IceSSL/configuration/AllTests.java @@ -7,6 +7,13 @@ // // ********************************************************************** +package test.IceSSL.configuration; +import java.io.PrintWriter; + +import test.IceSSL.configuration.Test.ServerFactoryPrx; +import test.IceSSL.configuration.Test.ServerFactoryPrxHelper; +import test.IceSSL.configuration.Test.ServerPrx; + // // NOTE: This test is not interoperable with other language mappings. // @@ -60,21 +67,22 @@ public class AllTests return result; } - public static Test.ServerFactoryPrx - allTests(Ice.Communicator communicator, String testDir) + public static ServerFactoryPrx + allTests(test.Util.Application app, String testDir, PrintWriter out) { + Ice.Communicator communicator = app.communicator(); final String factoryRef = "factory:tcp -p 12010 -t 10000"; Ice.ObjectPrx b = communicator.stringToProxy(factoryRef); test(b != null); - Test.ServerFactoryPrx factory = Test.ServerFactoryPrxHelper.checkedCast(b); + ServerFactoryPrx factory = ServerFactoryPrxHelper.checkedCast(b); final String defaultHost = communicator.getProperties().getProperty("Ice.Default.Host"); final String defaultDir = testDir + "/../certs"; final Ice.Properties defaultProperties = communicator.getProperties(); final String[] args = new String[0]; - System.out.print("testing manual initialization... "); - System.out.flush(); + out.print("testing manual initialization... "); + out.flush(); { Ice.InitializationData initData = createClientProps(defaultProperties, defaultDir, defaultHost); initData.properties.setProperty("Ice.InitPlugins", "0"); @@ -105,11 +113,11 @@ public class AllTests pm.initializePlugins(); Ice.ObjectPrx obj = comm.stringToProxy(factoryRef); test(obj != null); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(obj); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(obj); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Ciphers", "NONE (.*DH_anon.*)"); d.put("IceSSL.VerifyPeer", "0"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -121,10 +129,10 @@ public class AllTests fact.destroyServer(server); comm.destroy(); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing certificate verification... "); - System.out.flush(); + out.print("testing certificate verification... "); + out.flush(); { // // Test IceSSL.VerifyPeer=0. Client does not have a certificate, @@ -133,14 +141,14 @@ public class AllTests Ice.InitializationData initData = createClientProps(defaultProperties, defaultDir, defaultHost); initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); d.put("IceSSL.VerifyPeer", "0"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.noCert(); @@ -169,7 +177,7 @@ public class AllTests initData = createClientProps(defaultProperties, defaultDir, defaultHost); initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); comm = Ice.Util.initialize(args, initData); - fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca1.jks"); @@ -226,7 +234,7 @@ public class AllTests initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DH_anon.*)"); initData.properties.setProperty("IceSSL.VerifyPeer", "1"); comm = Ice.Util.initialize(args, initData); - fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Ciphers", "NONE (.*DH_anon.*)"); @@ -256,7 +264,7 @@ public class AllTests initData.properties.setProperty("IceSSL.Password", "password"); initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); comm = Ice.Util.initialize(args, initData); - fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca1.jks"); @@ -333,7 +341,7 @@ public class AllTests initData.properties.setProperty("IceSSL.Password", "password"); initData.properties.setProperty("IceSSL.Truststore", "cacert2.jks"); comm = Ice.Util.initialize(args, initData); - fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca1.jks"); @@ -369,7 +377,7 @@ public class AllTests initData.properties.setProperty("IceSSL.Password", "password"); initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); comm = Ice.Util.initialize(args, initData); - fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca1.jks"); @@ -406,7 +414,7 @@ public class AllTests initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); comm = Ice.Util.initialize(args, initData); - fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca1.jks"); @@ -439,7 +447,7 @@ public class AllTests initData.properties.setProperty("IceSSL.CheckCertName", "1"); comm = Ice.Util.initialize(args, initData); - fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca1.jks"); @@ -458,10 +466,10 @@ public class AllTests comm.destroy(); } } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing custom certificate verifier... "); - System.out.flush(); + out.print("testing custom certificate verifier... "); + out.flush(); { // // ADH is allowed but will not have a certificate. @@ -475,12 +483,12 @@ public class AllTests CertificateVerifierI verifier = new CertificateVerifierI(); plugin.setCertificateVerifier(verifier); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Ciphers", "NONE (.*DH_anon.*)"); d.put("IceSSL.VerifyPeer", "0"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { String cipherSub = "DH_anon"; @@ -535,14 +543,14 @@ public class AllTests CertificateVerifierI verifier = new CertificateVerifierI(); plugin.setCertificateVerifier(verifier); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); d.put("IceSSL.VerifyPeer", "2"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -564,17 +572,17 @@ public class AllTests initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks"); initData.properties.setProperty("IceSSL.Password", "password"); initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); - initData.properties.setProperty("IceSSL.CertVerifier", "CertificateVerifierI"); + initData.properties.setProperty("IceSSL.CertVerifier", "test.IceSSL.configuration.CertificateVerifierI"); Ice.Communicator comm = Ice.Util.initialize(args, initData); IceSSL.Plugin plugin = (IceSSL.Plugin)comm.getPluginManager().getPlugin("IceSSL"); test(plugin != null); test(plugin.getCertificateVerifier() != null); comm.destroy(); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing protocols... "); - System.out.flush(); + out.print("testing protocols... "); + out.flush(); { // // This should fail because the client and server have no protocol @@ -586,7 +594,7 @@ public class AllTests initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); initData.properties.setProperty("IceSSL.Protocols", "ssl3"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca1.jks"); @@ -594,7 +602,7 @@ public class AllTests d.put("IceSSL.Truststore", "cacert1.jks"); d.put("IceSSL.VerifyPeer", "2"); d.put("IceSSL.Protocols", "tls1"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -619,7 +627,7 @@ public class AllTests // This should succeed. // comm = Ice.Util.initialize(args, initData); - fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca1.jks"); @@ -639,10 +647,10 @@ public class AllTests fact.destroyServer(server); comm.destroy(); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing expired certificates... "); - System.out.flush(); + out.print("testing expired certificates... "); + out.flush(); { // // This should fail because the server's certificate is expired. @@ -652,14 +660,14 @@ public class AllTests initData.properties.setProperty("IceSSL.Password", "password"); initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca1_exp.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); d.put("IceSSL.VerifyPeer", "2"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -683,7 +691,7 @@ public class AllTests initData.properties.setProperty("IceSSL.Password", "password"); initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); comm = Ice.Util.initialize(args, initData); - fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca1.jks"); @@ -711,24 +719,24 @@ public class AllTests fact.destroyServer(server); comm.destroy(); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing multiple CA certificates... "); - System.out.flush(); + out.print("testing multiple CA certificates... "); + out.flush(); { Ice.InitializationData initData = createClientProps(defaultProperties, defaultDir, defaultHost); initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks"); initData.properties.setProperty("IceSSL.Password", "password"); initData.properties.setProperty("IceSSL.Truststore", "cacerts.jks"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca2.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacerts.jks"); d.put("IceSSL.VerifyPeer", "2"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -740,10 +748,10 @@ public class AllTests fact.destroyServer(server); comm.destroy(); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing passwords... "); - System.out.flush(); + out.print("testing passwords... "); + out.flush(); { // // Test password failure. @@ -824,7 +832,7 @@ public class AllTests // Ice.InitializationData initData = createClientProps(defaultProperties, defaultDir, defaultHost); initData.properties.setProperty("IceSSL.Keystore", "c_rsa_ca1.jks"); - initData.properties.setProperty("IceSSL.PasswordCallback", "PasswordCallbackI"); + initData.properties.setProperty("IceSSL.PasswordCallback", "test.IceSSL.configuration.PasswordCallbackI"); Ice.Communicator comm = Ice.Util.initialize(args, initData); Ice.PluginManager pm = comm.getPluginManager(); IceSSL.Plugin plugin = (IceSSL.Plugin)pm.getPlugin("IceSSL"); @@ -832,10 +840,10 @@ public class AllTests test(plugin.getPasswordCallback() != null); comm.destroy(); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing ciphers... "); - System.out.flush(); + out.print("testing ciphers... "); + out.flush(); { // // The server has a certificate but the client doesn't. They should @@ -845,7 +853,7 @@ public class AllTests initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DH_anon.*)"); initData.properties.setProperty("IceSSL.VerifyPeer", "0"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca1.jks"); @@ -853,7 +861,7 @@ public class AllTests d.put("IceSSL.Truststore", "cacert1.jks"); d.put("IceSSL.Ciphers", "ALL"); d.put("IceSSL.VerifyPeer", "1"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -876,14 +884,14 @@ public class AllTests initData.properties.setProperty("IceSSL.Password", "password"); initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); d.put("IceSSL.VerifyPeer", "1"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -903,7 +911,7 @@ public class AllTests initData.properties.setProperty("IceSSL.Password", "password"); initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); comm = Ice.Util.initialize(args, initData); - fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); @@ -928,7 +936,7 @@ public class AllTests initData = createClientProps(defaultProperties, defaultDir, defaultHost); initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DH_anon.*)"); comm = Ice.Util.initialize(args, initData); - fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); @@ -966,14 +974,14 @@ public class AllTests initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DSS.*)"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); d.put("IceSSL.VerifyPeer", "2"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -1005,7 +1013,7 @@ public class AllTests initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DSS.*)"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); @@ -1013,7 +1021,7 @@ public class AllTests d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); d.put("IceSSL.VerifyPeer", "2"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -1034,10 +1042,10 @@ public class AllTests fact.destroyServer(server); comm.destroy(); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing IceSSL.TrustOnly... "); - System.out.flush(); + out.print("testing IceSSL.TrustOnly... "); + out.flush(); { Ice.InitializationData initData = createClientProps(defaultProperties, defaultDir, defaultHost); initData = createClientProps(defaultProperties, defaultDir, defaultHost); @@ -1047,13 +1055,13 @@ public class AllTests initData.properties.setProperty("IceSSL.TrustOnly", "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Server"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -1072,7 +1080,7 @@ public class AllTests initData.properties.setProperty("IceSSL.Password", "password"); initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); @@ -1080,7 +1088,7 @@ public class AllTests d.put("IceSSL.Truststore", "cacert1.jks"); d.put("IceSSL.TrustOnly", "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Client"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -1100,13 +1108,13 @@ public class AllTests initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); initData.properties.setProperty("IceSSL.TrustOnly", "CN=Server"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -1125,14 +1133,14 @@ public class AllTests initData.properties.setProperty("IceSSL.Password", "password"); initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); d.put("IceSSL.TrustOnly", "CN=Client"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -1152,13 +1160,13 @@ public class AllTests initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); initData.properties.setProperty("IceSSL.TrustOnly", "CN=Client"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -1177,14 +1185,14 @@ public class AllTests initData.properties.setProperty("IceSSL.Password", "password"); initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); d.put("IceSSL.TrustOnly", "CN=Server"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -1204,13 +1212,13 @@ public class AllTests initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); initData.properties.setProperty("IceSSL.TrustOnly", "C=Canada,CN=Server"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -1230,13 +1238,13 @@ public class AllTests initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); initData.properties.setProperty("IceSSL.TrustOnly", "C=Canada;CN=Server"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -1257,14 +1265,14 @@ public class AllTests initData.properties.setProperty("IceSSL.Ciphers", "NONE (.*DH_anon.*)"); initData.properties.setProperty("IceSSL.VerifyPeer", "0"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.TrustOnly", "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Client"); d.put("IceSSL.Ciphers", "NONE (.*DH_anon.*)"); d.put("IceSSL.VerifyPeer", "0"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -1276,10 +1284,10 @@ public class AllTests fact.destroyServer(server); comm.destroy(); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing IceSSL.TrustOnly.Client... "); - System.out.flush(); + out.print("testing IceSSL.TrustOnly.Client... "); + out.flush(); { Ice.InitializationData initData = createClientProps(defaultProperties, defaultDir, defaultHost); initData = createClientProps(defaultProperties, defaultDir, defaultHost); @@ -1289,7 +1297,7 @@ public class AllTests initData.properties.setProperty("IceSSL.TrustOnly.Client", "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Server"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); @@ -1298,7 +1306,7 @@ public class AllTests // Should have no effect. d.put("IceSSL.TrustOnly.Client", "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Server"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -1318,13 +1326,13 @@ public class AllTests initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); initData.properties.setProperty("IceSSL.TrustOnly.Client", "CN=Client"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -1336,10 +1344,10 @@ public class AllTests fact.destroyServer(server); comm.destroy(); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing IceSSL.TrustOnly.Server... "); - System.out.flush(); + out.print("testing IceSSL.TrustOnly.Server... "); + out.flush(); { Ice.InitializationData initData = createClientProps(defaultProperties, defaultDir, defaultHost); initData = createClientProps(defaultProperties, defaultDir, defaultHost); @@ -1350,7 +1358,7 @@ public class AllTests initData.properties.setProperty("IceSSL.TrustOnly.Server", "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Client"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); @@ -1358,7 +1366,7 @@ public class AllTests d.put("IceSSL.Truststore", "cacert1.jks"); d.put("IceSSL.TrustOnly.Server", "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Client"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -1377,14 +1385,14 @@ public class AllTests initData.properties.setProperty("IceSSL.Password", "password"); initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); d.put("IceSSL.TrustOnly.Server", "CN=Server"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -1396,10 +1404,10 @@ public class AllTests fact.destroyServer(server); comm.destroy(); } - System.out.println("ok"); + out.println("ok"); - System.out.print("testing IceSSL.TrustOnly.Server.<AdapterName>... "); - System.out.flush(); + out.print("testing IceSSL.TrustOnly.Server.<AdapterName>... "); + out.flush(); { Ice.InitializationData initData = createClientProps(defaultProperties, defaultDir, defaultHost); initData = createClientProps(defaultProperties, defaultDir, defaultHost); @@ -1407,7 +1415,7 @@ public class AllTests initData.properties.setProperty("IceSSL.Password", "password"); initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); @@ -1416,7 +1424,7 @@ public class AllTests d.put("IceSSL.TrustOnly.Server", "CN=bogus"); d.put("IceSSL.TrustOnly.Server.ServerAdapter", "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Client"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -1435,14 +1443,14 @@ public class AllTests initData.properties.setProperty("IceSSL.Password", "password"); initData.properties.setProperty("IceSSL.Truststore", "cacert1.jks"); Ice.Communicator comm = Ice.Util.initialize(args, initData); - Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); + ServerFactoryPrx fact = ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); d.put("IceSSL.TrustOnly.Server.ServerAdapter", "CN=bogus"); - Test.ServerPrx server = fact.createServer(d); + ServerPrx server = fact.createServer(d); try { server.ice_ping(); @@ -1454,7 +1462,7 @@ public class AllTests fact.destroyServer(server); comm.destroy(); } - System.out.println("ok"); + out.println("ok"); return factory; } diff --git a/java/test/IceSSL/configuration/CertificateVerifierI.java b/java/test/IceSSL/configuration/CertificateVerifierI.java index 547acc4c4f9..f7ef6b06f8e 100644 --- a/java/test/IceSSL/configuration/CertificateVerifierI.java +++ b/java/test/IceSSL/configuration/CertificateVerifierI.java @@ -7,6 +7,9 @@ // // ********************************************************************** +package test.IceSSL.configuration; +import test.IceSSL.configuration.Test.*; + public class CertificateVerifierI implements IceSSL.CertificateVerifier { public diff --git a/java/test/IceSSL/configuration/Client.java b/java/test/IceSSL/configuration/Client.java index 18a942f22df..6e33aecf467 100644 --- a/java/test/IceSSL/configuration/Client.java +++ b/java/test/IceSSL/configuration/Client.java @@ -7,55 +7,41 @@ // // ********************************************************************** -public class Client +package test.IceSSL.configuration; + +import java.io.PrintWriter; + +import test.IceSSL.configuration.Test.ServerFactoryPrx; + +public class Client extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { + PrintWriter out = getWriter(); if(args.length < 1) { - System.out.println("Usage: client testdir"); + out.println("Usage: client testdir"); return 1; } - Test.ServerFactoryPrx factory; - - factory = AllTests.allTests(communicator, args[0]); - + ServerFactoryPrx factory = AllTests.allTests(this, args[0], out); factory.shutdown(); return 0; } - public static void main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) { - int status = 0; - Ice.Communicator communicator = null; - - try - { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - communicator = Ice.Util.initialize(argsH); - status = run(argsH.value, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.IceSSL.configuration"); + return initData; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } + public static void main(String[] args) + { + Client c = new Client(); + int status = c.main("Client", args); System.gc(); System.exit(status); diff --git a/java/test/IceSSL/configuration/PasswordCallbackI.java b/java/test/IceSSL/configuration/PasswordCallbackI.java index 786170671a0..f0ec9c8ff14 100644 --- a/java/test/IceSSL/configuration/PasswordCallbackI.java +++ b/java/test/IceSSL/configuration/PasswordCallbackI.java @@ -7,6 +7,9 @@ // // ********************************************************************** +package test.IceSSL.configuration; +import test.IceSSL.configuration.Test.*; + public class PasswordCallbackI implements IceSSL.PasswordCallback { public diff --git a/java/test/IceSSL/configuration/Server.java b/java/test/IceSSL/configuration/Server.java index c1b7b5e9976..cf5f2710f5c 100644 --- a/java/test/IceSSL/configuration/Server.java +++ b/java/test/IceSSL/configuration/Server.java @@ -7,11 +7,14 @@ // // ********************************************************************** -public class Server +package test.IceSSL.configuration; + + +public class Server extends test.Util.Application { - private static int - run(String[] args, Ice.Communicator communicator) + public int run(String[] args) { + Ice.Communicator communicator = communicator(); communicator.getProperties().setProperty("TestAdapter.Endpoints", "tcp -p 12010"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.Identity id = communicator.stringToIdentity("factory"); @@ -22,37 +25,20 @@ public class Server return 0; } - public static void - main(String[] args) + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package.Test", "test.IceSSL.configuration"); + return initData; + } + + public static void main(String[] args) { - int status = 0; - Ice.Communicator communicator = null; + Server c = new Server(); + int status = c.main("Server", args); - try - { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - communicator = Ice.Util.initialize(argsH); - status = run(argsH.value, communicator); - } - catch(Exception ex) - { - ex.printStackTrace(); - status = 1; - } - - if(communicator != null) - { - try - { - communicator.destroy(); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } - } - + System.gc(); System.exit(status); } } diff --git a/java/test/IceSSL/configuration/ServerFactoryI.java b/java/test/IceSSL/configuration/ServerFactoryI.java index 6fc001550d9..1e65013c89f 100644 --- a/java/test/IceSSL/configuration/ServerFactoryI.java +++ b/java/test/IceSSL/configuration/ServerFactoryI.java @@ -7,7 +7,12 @@ // // ********************************************************************** -class ServerFactoryI extends Test._ServerFactoryDisp +package test.IceSSL.configuration; +import test.IceSSL.configuration.Test.ServerPrx; +import test.IceSSL.configuration.Test.ServerPrxHelper; +import test.IceSSL.configuration.Test._ServerFactoryDisp; + +class ServerFactoryI extends _ServerFactoryDisp { private static void test(boolean b) @@ -18,7 +23,7 @@ class ServerFactoryI extends Test._ServerFactoryDisp } } - public Test.ServerPrx + public ServerPrx createServer(java.util.Map _props, Ice.Current current) { // TODO: Fix the parameters and remove the cast below when the Java2 mapping is removed. @@ -40,11 +45,11 @@ class ServerFactoryI extends Test._ServerFactoryDisp _servers.put(obj.ice_getIdentity(), server); adapter.activate(); - return Test.ServerPrxHelper.uncheckedCast(obj); + return ServerPrxHelper.uncheckedCast(obj); } public void - destroyServer(Test.ServerPrx srv, Ice.Current current) + destroyServer(ServerPrx srv, Ice.Current current) { Ice.Identity key = srv.ice_getIdentity(); if(_servers.containsKey(key)) diff --git a/java/test/IceSSL/configuration/ServerI.java b/java/test/IceSSL/configuration/ServerI.java index 15d446a7480..8a6f5ce3816 100644 --- a/java/test/IceSSL/configuration/ServerI.java +++ b/java/test/IceSSL/configuration/ServerI.java @@ -7,7 +7,10 @@ // // ********************************************************************** -class ServerI extends Test._ServerDisp +package test.IceSSL.configuration; +import test.IceSSL.configuration.Test._ServerDisp; + +class ServerI extends _ServerDisp { ServerI(Ice.Communicator communicator) { diff --git a/java/test/IceSSL/configuration/Test.ice b/java/test/IceSSL/configuration/Test.ice index 335a7cbe344..f6691f043ad 100644 --- a/java/test/IceSSL/configuration/Test.ice +++ b/java/test/IceSSL/configuration/Test.ice @@ -10,6 +10,7 @@ #ifndef TEST_ICE #define TEST_ICE +[["java:package:test.IceSSL.configuration"]] module Test { diff --git a/java/test/IceUtil/inputUtil/Client.java b/java/test/IceUtil/inputUtil/Client.java index 63ebd67811d..24af63cda39 100644 --- a/java/test/IceUtil/inputUtil/Client.java +++ b/java/test/IceUtil/inputUtil/Client.java @@ -7,6 +7,8 @@ // // ********************************************************************** +package test.IceUtil.inputUtil; + public class Client { private static void diff --git a/java/test/IceUtil/inputUtil/run.py b/java/test/IceUtil/inputUtil/run.py index 71b051bbc73..cc4d1e94df2 100755 --- a/java/test/IceUtil/inputUtil/run.py +++ b/java/test/IceUtil/inputUtil/run.py @@ -20,10 +20,8 @@ if len(path) == 0: sys.path.append(os.path.join(path[0])) from scripts import * -TestUtil.addClasspath(os.path.join(os.getcwd(), "classes")) - print "starting client...", -clientProc = TestUtil.startClient("Client", startReader = False) +clientProc = TestUtil.startClient("test.IceUtil.inputUtil.Client",startReader=False) print "ok" clientProc.startReader() clientProc.waitTestSuccess() diff --git a/java/test/Slice/keyword/Client.java b/java/test/Slice/keyword/Client.java index afb93aa1bda..7ccd39c652c 100644 --- a/java/test/Slice/keyword/Client.java +++ b/java/test/Slice/keyword/Client.java @@ -7,9 +7,31 @@ // // ********************************************************************** +package test.Slice.keyword; +import test.Slice.keyword._abstract.AMD_catch_checkedCast; +import test.Slice.keyword._abstract._assert; +import test.Slice.keyword._abstract._break; +import test.Slice.keyword._abstract._catch; +import test.Slice.keyword._abstract._catchDisp; +import test.Slice.keyword._abstract._default; +import test.Slice.keyword._abstract._defaultDisp; +import test.Slice.keyword._abstract._else; +import test.Slice.keyword._abstract._finalize; +import test.Slice.keyword._abstract._hashCode; +import test.Slice.keyword._abstract._import; +import test.Slice.keyword._abstract._new; +import test.Slice.keyword._abstract._switch; +import test.Slice.keyword._abstract.catchPrx; +import test.Slice.keyword._abstract.defaultPrx; +import test.Slice.keyword._abstract.defaultPrxHelper; +import test.Slice.keyword._abstract.elsePrx; +import test.Slice.keyword._abstract.finalizePrx; +import test.Slice.keyword._abstract.forHolder; +import test.Slice.keyword._abstract.gotoHolder; + public class Client { - static public class catchI extends _abstract._catchDisp + static public class catchI extends _catchDisp { public catchI() @@ -17,14 +39,14 @@ public class Client } public void - checkedCast_async(_abstract.AMD_catch_checkedCast __cb, int _clone, Ice.Current __current) + checkedCast_async(AMD_catch_checkedCast __cb, int _clone, Ice.Current __current) { int _continue = 0; __cb.ice_response(_continue); } } - static public class defaultI extends _abstract._defaultDisp + static public class defaultI extends _defaultDisp { public defaultI() @@ -38,7 +60,7 @@ public class Client } } - static public class elseI extends _abstract._else + static public class elseI extends _else { public elseI() @@ -46,29 +68,29 @@ public class Client } public void - foo(_abstract.defaultPrx _equals, Ice.IntHolder _final, Ice.Current __current) + foo(defaultPrx _equals, Ice.IntHolder _final, Ice.Current __current) { } } - static public class newI implements _abstract._new + static public class newI implements _new { public newI() { } - public _abstract._assert - _notify(_abstract._break _notifyAll, _abstract._else _null, _abstract._finalize _package, - _abstract.elsePrx _private, _abstract.finalizePrx _protected, - _abstract.catchPrx _public, _abstract.defaultPrx _return, int _static, int _strictfp, int _super) - throws _abstract._hashCode, _abstract._import + public _assert + _notify(_break _notifyAll, _else _null, _finalize _package, + elsePrx _private, finalizePrx _protected, + catchPrx _public, defaultPrx _return, int _static, int _strictfp, int _super) + throws _hashCode, _import { return null; } } - static public class finalizeI extends _abstract._finalize + static public class finalizeI extends _finalize { public finalizeI() @@ -76,7 +98,7 @@ public class Client } public void - checkedCast_async(_abstract.AMD_catch_checkedCast __cb, int _clone, Ice.Current __current) + checkedCast_async(AMD_catch_checkedCast __cb, int _clone, Ice.Current __current) { int _continue = 0; __cb.ice_response(_continue); @@ -88,7 +110,7 @@ public class Client } public void - foo(_abstract.defaultPrx _equals, Ice.IntHolder _final, Ice.Current __current) + foo(defaultPrx _equals, Ice.IntHolder _final, Ice.Current __current) { } } @@ -100,44 +122,43 @@ public class Client private static void testtypes() { - _abstract._assert v = _abstract._assert._boolean; - _abstract._break b = new _abstract._break(); + _assert v = _assert._boolean; + _break b = new _break(); b._case = 0; - _abstract.catchPrx c = null; + catchPrx c = null; c._checkedCast(0, new Ice.IntHolder()); - _abstract._catch c1 = new catchI(); - _abstract.defaultPrx d = null; + _catch c1 = new catchI(); + defaultPrx d = null; d._do(); - _abstract._default d1 = new defaultI(); - _abstract.elsePrx e; - _abstract._else e1 = new elseI(); - _abstract.finalizePrx f = null; + _default d1 = new defaultI(); + elsePrx e; + _else e1 = new elseI(); + finalizePrx f = null; f._checkedCast(0, new Ice.IntHolder()); f._do(); - _abstract._finalize f1 = new finalizeI(); - _abstract.forHolder g; - _abstract.gotoHolder h; - _abstract._hashCode i = new _abstract._hashCode(); + _finalize f1 = new finalizeI(); + forHolder g; + gotoHolder h; + _hashCode i = new _hashCode(); i._if = 0; - _abstract._import j = new _abstract._import(); + _import j = new _import(); j._if = 0; j._instanceof = 1; j._native = 2; - _abstract._new k = new newI(); - assert _abstract._switch.value == 0; + _new k = new newI(); + assert _switch.value == 0; } private static int run(String[] args, Ice.Communicator communicator) { - communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new defaultI(), communicator.stringToIdentity("test")); adapter.activate(); System.out.print("Testing operation name... "); System.out.flush(); - _abstract.defaultPrx p = _abstract.defaultPrxHelper.uncheckedCast( + defaultPrx p = defaultPrxHelper.uncheckedCast( adapter.createProxy(communicator.stringToIdentity("test"))); p._do(); System.out.println("ok"); @@ -160,8 +181,10 @@ public class Client Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); Ice.InitializationData initData = new Ice.InitializationData(); initData.properties = Ice.Util.createProperties(argsH); + initData.properties.setProperty("Ice.Package._abstract", "test.Slice.keyword"); initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0"); + initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); // // We must set MessageSizeMax to an explicit values, diff --git a/java/test/Slice/keyword/Key.ice b/java/test/Slice/keyword/Key.ice index 173b28832e6..8bf53601fb9 100644 --- a/java/test/Slice/keyword/Key.ice +++ b/java/test/Slice/keyword/Key.ice @@ -7,6 +7,7 @@ // // ********************************************************************** +[["java:package:test.Slice.keyword"]] module abstract { diff --git a/java/test/Slice/keyword/run.py b/java/test/Slice/keyword/run.py index 71b051bbc73..4feb349fa01 100755 --- a/java/test/Slice/keyword/run.py +++ b/java/test/Slice/keyword/run.py @@ -20,10 +20,8 @@ if len(path) == 0: sys.path.append(os.path.join(path[0])) from scripts import * -TestUtil.addClasspath(os.path.join(os.getcwd(), "classes")) - print "starting client...", -clientProc = TestUtil.startClient("Client", startReader = False) +clientProc = TestUtil.startClient("test.Slice.keyword.Client",startReader=False) print "ok" clientProc.startReader() clientProc.waitTestSuccess() diff --git a/java/test/Util/Application.java b/java/test/Util/Application.java new file mode 100644 index 00000000000..e91a545d958 --- /dev/null +++ b/java/test/Util/Application.java @@ -0,0 +1,239 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +package test.Util; + +import Ice.Communicator; +import Ice.InitializationData; +import Ice.LocalException; +import Ice.LoggerI; +import Ice.StringSeqHolder; +import Ice.Util; + +public abstract class Application +{ + public final int WAIT = 2; + + public interface ServerReadyListener + { + void serverReady(); + }; + + public interface CommunicatorListener + { + void communicatorInitialized(Communicator c); + }; + + public + Application() + { + } + + // + // This main() must be called by the global main(). main() + // initializes the Communicator, calls run(), and destroys + // the Communicator upon return from run(). It thereby handles + // all exceptions properly, i.e., error messages are printed + // if exceptions propagate to main(), and the Communicator is + // always destroyed, regardless of exceptions. + // + public final int + main(String appName, String[] args) + { + Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); + Ice.InitializationData initData = getInitData(argsH); + return main(appName, argsH.value, initData); + } + + public final int + main(String appName, String[] args, InitializationData initializationData) + { + java.io.PrintWriter writer = getWriter(); + if(_communicator != null) + { + writer.println(appName + ": only one instance of the Application class can be used"); + return 1; + } + + _testName = appName; + + // + // We parse the properties here to extract Ice.ProgramName. + // + StringSeqHolder argHolder = new StringSeqHolder(args); + if(initializationData == null) + { + initializationData = getInitData(argHolder); + } + + InitializationData initData; + if(initializationData != null) + { + initData = (InitializationData)initializationData.clone(); + } + else + { + initData = new InitializationData(); + } + initData.properties = Util.createProperties(argHolder, initData.properties); + + // + // If the process logger is the default logger, we replace it with a + // a logger which is using the program name for the prefix. + // + if(Util.getProcessLogger() instanceof LoggerI) + { + Util.setProcessLogger(new LoggerI(initData.properties.getProperty("Ice.ProgramName"))); + } + + int status = 0; + + try + { + _communicator = Util.initialize(argHolder, initData); + if(_communicatorListener != null) + { + _communicatorListener.communicatorInitialized(_communicator); + } + status = run(argHolder.value); + if(status == WAIT) + { + if(_cb != null) + { + _cb.serverReady(); + } + _communicator.waitForShutdown(); + status = 0; + } + } + catch(LocalException ex) + { + writer.println(_testName + ": " + ex); + ex.printStackTrace(); + status = 1; + } + catch(java.lang.Exception ex) + { + writer.println(_testName + ": unknown exception"); + ex.printStackTrace(writer); + status = 1; + } + catch(java.lang.Error err) + { + // + // We catch Error to avoid hangs in some non-fatal situations + // + writer.println(_testName + ": Java error"); + err.printStackTrace(writer); + status = 1; + } + + if(_communicator != null) + { + try + { + _communicator.destroy(); + } + catch(LocalException ex) + { + writer.println(_testName + ": " + ex); + ex.printStackTrace(writer); + status = 1; + } + catch(java.lang.Exception ex) + { + writer.println(_testName + ": unknown exception"); + ex.printStackTrace(writer); + status = 1; + } + _communicator = null; + } + writer.flush(); + + return status; + } + + public void stop() + { + if(_communicator != null) + { + _communicator.shutdown(); + } + } + + // Initialize a new communicator. + public Ice.Communicator initialize(InitializationData initData) + { + Ice.Communicator communicator = Util.initialize(initData); + if(_communicatorListener != null) + { + _communicatorListener.communicatorInitialized(communicator); + } + return communicator; + } + + public abstract int run(String[] args); + + // Hook to override the initialization data. This hook is + // necessary because some properties must be set prior to + // communicator initialization. + protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) + { + return null; + } + + public java.io.PrintWriter getWriter() + { + return _printWriter; + } + + public void setWriter(java.io.Writer writer) + { + _printWriter = new java.io.PrintWriter(writer); + } + + public void setServerReadyListener(ServerReadyListener cb) + { + _cb = cb; + } + + public void setCommunicatorListener(CommunicatorListener listener) + { + _communicatorListener = listener; + } + + public void serverReady() + { + if(_cb != null) + { + _cb.serverReady(); + } + } + + // + // Return the application name, i.e., argv[0]. + // + public String + appName() + { + return _testName; + } + + public Communicator + communicator() + { + return _communicator; + } + + private String _testName; + private Communicator _communicator; + private java.io.PrintWriter _printWriter = new java.io.PrintWriter(new java.io.OutputStreamWriter(System.out)); + private ServerReadyListener _cb = null; + private CommunicatorListener _communicatorListener = null; +} diff --git a/java/test/build.xml b/java/test/build.xml index b8534e5a76c..b652f9f2fe3 100644 --- a/java/test/build.xml +++ b/java/test/build.xml @@ -12,25 +12,15 @@ <project name="test" default="all" basedir="."> <target name="all"> - <ant dir="Slice"/> - <ant dir="IceUtil"/> <ant dir="Ice"/> <ant dir="Freeze"/> - <ant dir="IceBox"/> - <ant dir="Glacier2"/> <ant dir="IceGrid"/> - <ant dir="IceSSL"/> </target> <target name="clean"> - <ant dir="Slice" target="clean"/> - <ant dir="IceUtil" target="clean"/> <ant dir="Ice" target="clean"/> <ant dir="Freeze" target="clean"/> - <ant dir="IceBox" target="clean"/> - <ant dir="Glacier2" target="clean"/> <ant dir="IceGrid" target="clean"/> - <ant dir="IceSSL" target="clean"/> </target> </project> |