diff options
-rw-r--r-- | java/test/Ice/facets/AI.java | 25 | ||||
-rw-r--r-- | java/test/Ice/facets/BI.java | 31 | ||||
-rw-r--r-- | java/test/Ice/facets/CI.java | 31 | ||||
-rw-r--r-- | java/test/Ice/facets/DI.java | 43 | ||||
-rw-r--r-- | java/test/Ice/facets/EI.java | 25 | ||||
-rw-r--r-- | java/test/Ice/facets/FI.java | 31 | ||||
-rw-r--r-- | java/test/Ice/facets/GI.java | 34 | ||||
-rw-r--r-- | java/test/Ice/facets/Server.java | 65 | ||||
-rw-r--r-- | java/test/Ice/faultTolerance/Server.java | 101 | ||||
-rw-r--r-- | java/test/Ice/faultTolerance/TestI.java | 46 |
10 files changed, 432 insertions, 0 deletions
diff --git a/java/test/Ice/facets/AI.java b/java/test/Ice/facets/AI.java new file mode 100644 index 00000000000..9526f036826 --- /dev/null +++ b/java/test/Ice/facets/AI.java @@ -0,0 +1,25 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +// Ice version 0.0.1 + +public final class AI extends _ADisp +{ + public + AI() + { + } + + public String + callA(Ice.Current current) + { + return "A"; + } +} diff --git a/java/test/Ice/facets/BI.java b/java/test/Ice/facets/BI.java new file mode 100644 index 00000000000..c465327a5da --- /dev/null +++ b/java/test/Ice/facets/BI.java @@ -0,0 +1,31 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +// Ice version 0.0.1 + +public final class BI extends _BDisp +{ + public + BI() + { + } + + public String + callA(Ice.Current current) + { + return "A"; + } + + public String + callB(Ice.Current current) + { + return "B"; + } +} diff --git a/java/test/Ice/facets/CI.java b/java/test/Ice/facets/CI.java new file mode 100644 index 00000000000..d5c3b10f4f3 --- /dev/null +++ b/java/test/Ice/facets/CI.java @@ -0,0 +1,31 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +// Ice version 0.0.1 + +public final class CI extends _CDisp +{ + public + CI() + { + } + + public String + callA(Ice.Current current) + { + return "A"; + } + + public String + callC(Ice.Current current) + { + return "C"; + } +} diff --git a/java/test/Ice/facets/DI.java b/java/test/Ice/facets/DI.java new file mode 100644 index 00000000000..7508e73004d --- /dev/null +++ b/java/test/Ice/facets/DI.java @@ -0,0 +1,43 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +// Ice version 0.0.1 + +public final class DI extends _DDisp +{ + public + DI() + { + } + + public String + callA(Ice.Current current) + { + return "A"; + } + + public String + callB(Ice.Current current) + { + return "B"; + } + + public String + callC(Ice.Current current) + { + return "C"; + } + + public String + callD(Ice.Current current) + { + return "D"; + } +} diff --git a/java/test/Ice/facets/EI.java b/java/test/Ice/facets/EI.java new file mode 100644 index 00000000000..00546983124 --- /dev/null +++ b/java/test/Ice/facets/EI.java @@ -0,0 +1,25 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +// Ice version 0.0.1 + +public final class EI extends _EDisp +{ + public + EI() + { + } + + public String + callE(Ice.Current current) + { + return "E"; + } +} diff --git a/java/test/Ice/facets/FI.java b/java/test/Ice/facets/FI.java new file mode 100644 index 00000000000..1fc053234a9 --- /dev/null +++ b/java/test/Ice/facets/FI.java @@ -0,0 +1,31 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +// Ice version 0.0.1 + +public final class FI extends _FDisp +{ + public + FI() + { + } + + public String + callE(Ice.Current current) + { + return "E"; + } + + public String + callF(Ice.Current current) + { + return "F"; + } +} diff --git a/java/test/Ice/facets/GI.java b/java/test/Ice/facets/GI.java new file mode 100644 index 00000000000..40a90efcf03 --- /dev/null +++ b/java/test/Ice/facets/GI.java @@ -0,0 +1,34 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +// Ice version 0.0.1 + +public final class GI extends _GDisp +{ + public + GI(Ice.Communicator communicator) + { + _communicator = communicator; + } + + public String + callG(Ice.Current current) + { + return "G"; + } + + public void + shutdown(Ice.Current current) + { + _communicator.shutdown(); + } + + private Ice.Communicator _communicator; +} diff --git a/java/test/Ice/facets/Server.java b/java/test/Ice/facets/Server.java new file mode 100644 index 00000000000..d111c4340b6 --- /dev/null +++ b/java/test/Ice/facets/Server.java @@ -0,0 +1,65 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +public class Server +{ + private static int + run(String[] args, Ice.Communicator communicator) + { + String endpts = "default -p 12345 -t 2000"; + Ice.ObjectAdapter adapter = + communicator.createObjectAdapterWithEndpoints("TestAdapter", + endpts); + Ice.Object d = new DI(); + adapter.add(d, Ice.Util.stringToIdentity("d")); + d.ice_addFacet(d, "facetABCD"); + d.ice_addFacet(new FI(), "facetEF"); + d.ice_addFacet(new GI(communicator), "facetG"); + + adapter.activate(); + communicator.waitForShutdown(); + + d.ice_removeAllFacets(); // Break cyclic dependencies + 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(Ice.LocalException 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/faultTolerance/Server.java b/java/test/Ice/faultTolerance/Server.java new file mode 100644 index 00000000000..51d9b8c5c8b --- /dev/null +++ b/java/test/Ice/faultTolerance/Server.java @@ -0,0 +1,101 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +public class Server +{ + private static void + usage() + { + System.err.println("Usage: Server port"); + } + + private static int + run(String[] args, Ice.Communicator communicator) + { + int port = 0; + for (int i = 0; i < args.length; i++) + { + if (args[i].charAt(0) == '-') + { + System.err.println("Server: unknown option `" + args[i] + "'"); + usage(); + return 1; + } + + if (port > 0) + { + System.err.println("Server: only one port can be specified"); + usage(); + return 1; + } + + try + { + port = Integer.parseInt(args[i]); + } + catch (NumberFormatException ex) + { + System.err.println("Server: invalid port"); + usage(); + return 1; + } + } + + if (port <= 0) + { + System.err.println("Server: no port specified"); + usage(); + return 1; + } + + String endpts = "default -p " + port; + Ice.ObjectAdapter adapter = + communicator.createObjectAdapterWithEndpoints("TestAdapter", + endpts); + 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(Ice.LocalException 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/faultTolerance/TestI.java b/java/test/Ice/faultTolerance/TestI.java new file mode 100644 index 00000000000..af2b85a07f9 --- /dev/null +++ b/java/test/Ice/faultTolerance/TestI.java @@ -0,0 +1,46 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +// Ice version 0.0.1 + +public final class TestI extends _TestDisp +{ + public + TestI(Ice.ObjectAdapter adapter) + { + _adapter = adapter; + } + + public void + abort(Ice.Current current) + { + System.exit(1); + } + + public void + nonmutatingAbort(Ice.Current current) + { + System.exit(1); + } + + public int + pid(Ice.Current current) + { + return (int)(System.currentTimeMillis() % 65535); + } + + public void + shutdown(Ice.Current current) + { + _adapter.getCommunicator().shutdown(); + } + + private Ice.ObjectAdapter _adapter; +} |