summaryrefslogtreecommitdiff
path: root/java/test
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2006-02-14 12:06:57 +0000
committerBenoit Foucher <benoit@zeroc.com>2006-02-14 12:06:57 +0000
commit770b66fc97582743bf045f709feac5c468c9d06d (patch)
treede6f5b22ed6c5a22d072337a647c9d3ac626eaa1 /java/test
parentFixed another race condition in the activator test suite. (diff)
downloadice-770b66fc97582743bf045f709feac5c468c9d06d.tar.bz2
ice-770b66fc97582743bf045f709feac5c468c9d06d.tar.xz
ice-770b66fc97582743bf045f709feac5c468c9d06d.zip
- Added ice_cacheConnection, ice_endpointSelection
- Fixed a bug where connection.close(true) would print a connection warning. - Fixed a bug where ice_newEndpoints would throw a ClassCastException - Added test/Ice/binding test suite.
Diffstat (limited to 'java/test')
-rw-r--r--java/test/Ice/binding/AllTests.java442
-rw-r--r--java/test/Ice/binding/Client.java52
-rw-r--r--java/test/Ice/binding/RemoteCommunicatorI.java35
-rw-r--r--java/test/Ice/binding/RemoteObjectAdapterI.java43
-rw-r--r--java/test/Ice/binding/Server.java58
-rw-r--r--java/test/Ice/binding/Test.ice39
-rw-r--r--java/test/Ice/binding/TestI.java23
-rw-r--r--java/test/Ice/binding/build.xml65
-rwxr-xr-xjava/test/Ice/binding/run.py28
-rw-r--r--java/test/Ice/build.xml1
10 files changed, 786 insertions, 0 deletions
diff --git a/java/test/Ice/binding/AllTests.java b/java/test/Ice/binding/AllTests.java
new file mode 100644
index 00000000000..e9c054d8227
--- /dev/null
+++ b/java/test/Ice/binding/AllTests.java
@@ -0,0 +1,442 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 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 AllTests
+{
+ private static void
+ test(boolean b)
+ {
+ if(!b)
+ {
+ throw new RuntimeException();
+ }
+ }
+
+ private static TestIntfPrx
+ createTestIntfPrx(java.util.List adapters)
+ {
+ java.util.List endpoints = new java.util.ArrayList();
+ TestIntfPrx test = null;
+ java.util.Iterator p = adapters.iterator();
+ while(p.hasNext())
+ {
+ test = ((RemoteObjectAdapterPrx)p.next()).getTestIntf();
+ Ice.Endpoint[] edpts = test.ice_getEndpoints();
+ endpoints.addAll(java.util.Arrays.asList(edpts));
+ }
+ return TestIntfPrxHelper.uncheckedCast(
+ test.ice_newEndpoints((Ice.Endpoint[])endpoints.toArray(new Ice.Endpoint[endpoints.size()])));
+ }
+
+ private static void
+ deactivate(RemoteCommunicatorPrx communicator, java.util.List adapters)
+ {
+ java.util.Iterator p = adapters.iterator();
+ while(p.hasNext())
+ {
+ communicator.deactivateObjectAdapter((RemoteObjectAdapterPrx)p.next());
+ }
+ }
+
+ public static void
+ allTests(Ice.Communicator communicator)
+ {
+ String ref = "communicator:default -p 12345 -t 10000";
+ RemoteCommunicatorPrx com = RemoteCommunicatorPrxHelper.uncheckedCast(communicator.stringToProxy(ref));
+
+ System.out.print("testing binding with single endpoint... ");
+ System.out.flush();
+ {
+ RemoteObjectAdapterPrx adapter = com.createObjectAdapter("Adapter", "default");
+
+ TestIntfPrx test1 = adapter.getTestIntf();
+ TestIntfPrx test2 = adapter.getTestIntf();
+ test(test1.ice_connection() == test2.ice_connection());
+
+ test1.ice_ping();
+ test2.ice_ping();
+
+ com.deactivateObjectAdapter(adapter);
+
+ TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1);
+ test(test3.ice_connection() == test1.ice_connection());
+ test(test3.ice_connection() == test2.ice_connection());
+
+ try
+ {
+ test3.ice_ping();
+ test(false);
+ }
+ catch(Ice.ConnectionRefusedException ex)
+ {
+ }
+ }
+ System.out.println("ok");
+
+ System.out.print("testing binding with multiple endpoints... ");
+ System.out.flush();
+ {
+ java.util.List adapters = new java.util.ArrayList();
+ adapters.add(com.createObjectAdapter("Adapter11", "default"));
+ adapters.add(com.createObjectAdapter("Adapter12", "default"));
+ adapters.add(com.createObjectAdapter("Adapter13", "default"));
+
+ java.util.Set names = new java.util.HashSet();
+ names.add("Adapter11");
+ names.add("Adapter12");
+ names.add("Adapter13");
+ while(!names.isEmpty())
+ {
+ java.util.List adpts = new java.util.ArrayList(adapters);
+
+ TestIntfPrx test1 = createTestIntfPrx(adpts);
+ java.util.Collections.shuffle(adpts);
+ TestIntfPrx test2 = createTestIntfPrx(adpts);
+ java.util.Collections.shuffle(adpts);
+ TestIntfPrx test3 = createTestIntfPrx(adpts);
+
+ test(test1.ice_connection() == test2.ice_connection());
+ test(test2.ice_connection() == test3.ice_connection());
+
+ names.remove(test1.getAdapterName());
+ test1.ice_connection().close(false);
+ }
+
+ com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(0));
+
+ names.add("Adapter12");
+ names.add("Adapter13");
+ while(!names.isEmpty())
+ {
+ java.util.List adpts = new java.util.ArrayList(adapters);
+
+ TestIntfPrx test1 = createTestIntfPrx(adpts);
+ java.util.Collections.shuffle(adpts);
+ TestIntfPrx test2 = createTestIntfPrx(adpts);
+ java.util.Collections.shuffle(adpts);
+ TestIntfPrx test3 = createTestIntfPrx(adpts);
+
+ test(test1.ice_connection() == test2.ice_connection());
+ test(test2.ice_connection() == test3.ice_connection());
+
+ names.remove(test1.getAdapterName());
+ test1.ice_connection().close(false);
+ }
+
+ com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(2));
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ test(test.getAdapterName().equals("Adapter12"));
+
+ deactivate(com, adapters);
+ }
+ System.out.println("ok");
+
+ System.out.print("testing random endpoint selection... ");
+ System.out.flush();
+ {
+ java.util.List adapters = new java.util.ArrayList();
+ adapters.add(com.createObjectAdapter("Adapter21", "default"));
+ adapters.add(com.createObjectAdapter("Adapter22", "default"));
+ adapters.add(com.createObjectAdapter("Adapter23", "default"));
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ test(test.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random);
+
+ java.util.Set names = new java.util.HashSet();
+ names.add("Adapter21");
+ names.add("Adapter22");
+ names.add("Adapter23");
+ while(!names.isEmpty())
+ {
+ names.remove(test.getAdapterName());
+ test.ice_connection().close(false);
+ }
+
+ test = TestIntfPrxHelper.uncheckedCast(test.ice_endpointSelection(Ice.EndpointSelectionType.Random));
+ test(test.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random);
+
+ names.add("Adapter21");
+ names.add("Adapter22");
+ names.add("Adapter23");
+ while(!names.isEmpty())
+ {
+ names.remove(test.getAdapterName());
+ test.ice_connection().close(false);
+ }
+
+ deactivate(com, adapters);
+ }
+ System.out.println("ok");
+
+ System.out.print("testing ordered endpoint selection... ");
+ System.out.flush();
+ {
+ java.util.List adapters = new java.util.ArrayList();
+ adapters.add(com.createObjectAdapter("Adapter31", "default"));
+ adapters.add(com.createObjectAdapter("Adapter32", "default"));
+ adapters.add(com.createObjectAdapter("Adapter33", "default"));
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ test = TestIntfPrxHelper.uncheckedCast(test.ice_endpointSelection(Ice.EndpointSelectionType.Ordered));
+ test(test.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered);
+ int nRetry = 5;
+ int i;
+
+ //
+ // Ensure that endpoints are tried in order by deactiving the adapters
+ // one after the other.
+ //
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter31"); i++);
+ test(i == nRetry);
+ com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(0));
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter32"); i++);
+ test(i == nRetry);
+ com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(1));
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter33"); i++);
+ test(i == nRetry);
+ com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(2));
+
+ try
+ {
+ test.getAdapterName();
+ }
+ catch(Ice.ConnectionRefusedException ex)
+ {
+ }
+
+ Ice.Endpoint[] endpoints = test.ice_getEndpoints();
+
+ adapters.clear();
+
+ //
+ // Now, re-activate the adapters with the same endpoints in the opposite
+ // order.
+ //
+ adapters.add(com.createObjectAdapter("Adapter36", endpoints[2].toString()));
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter36"); i++);
+ test(i == nRetry);
+ test.ice_connection().close(false);
+ adapters.add(com.createObjectAdapter("Adapter35", endpoints[1].toString()));
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter35"); i++);
+ test(i == nRetry);
+ test.ice_connection().close(false);
+ adapters.add(com.createObjectAdapter("Adapter34", endpoints[0].toString()));
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter34"); i++);
+ test(i == nRetry);
+
+ deactivate(com, adapters);
+ }
+ System.out.println("ok");
+
+ System.out.print("testing per request binding with single endpoint... ");
+ System.out.flush();
+ {
+ RemoteObjectAdapterPrx adapter = com.createObjectAdapter("Adapter41", "default");
+
+ TestIntfPrx test1 = TestIntfPrxHelper.uncheckedCast(adapter.getTestIntf().ice_cacheConnection(false));
+ TestIntfPrx test2 = TestIntfPrxHelper.uncheckedCast(adapter.getTestIntf().ice_cacheConnection(false));
+ test(!test1.ice_getCacheConnection());
+ test(!test2.ice_getCacheConnection());
+ test(test1.ice_connection() == test2.ice_connection());
+
+ test1.ice_ping();
+
+ com.deactivateObjectAdapter(adapter);
+
+ TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1);
+ try
+ {
+ test(test3.ice_connection() == test1.ice_connection());
+ test(false);
+ }
+ catch(Ice.ConnectionRefusedException ex)
+ {
+ }
+ }
+ System.out.println("ok");
+
+ System.out.print("testing per request binding with multiple endpoints... ");
+ System.out.flush();
+ {
+ java.util.List adapters = new java.util.ArrayList();
+ adapters.add(com.createObjectAdapter("Adapter51", "default"));
+ adapters.add(com.createObjectAdapter("Adapter52", "default"));
+ adapters.add(com.createObjectAdapter("Adapter53", "default"));
+
+ TestIntfPrx test = TestIntfPrxHelper.uncheckedCast(createTestIntfPrx(adapters).ice_cacheConnection(false));
+ test(!test.ice_getCacheConnection());
+
+ java.util.Set names = new java.util.HashSet();
+ names.add("Adapter51");
+ names.add("Adapter52");
+ names.add("Adapter53");
+ while(!names.isEmpty())
+ {
+ names.remove(test.getAdapterName());
+ }
+
+ com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(0));
+
+ names.add("Adapter52");
+ names.add("Adapter53");
+ while(!names.isEmpty())
+ {
+ names.remove(test.getAdapterName());
+ }
+
+ com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(2));
+
+
+ test(test.getAdapterName().equals("Adapter52"));
+
+ deactivate(com, adapters);
+ }
+ System.out.println("ok");
+
+ System.out.print("testing per request binding and ordered endpoint selection... ");
+ System.out.flush();
+ {
+ java.util.List adapters = new java.util.ArrayList();
+ adapters.add(com.createObjectAdapter("Adapter61", "default"));
+ adapters.add(com.createObjectAdapter("Adapter62", "default"));
+ adapters.add(com.createObjectAdapter("Adapter63", "default"));
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ test = TestIntfPrxHelper.uncheckedCast(test.ice_endpointSelection(Ice.EndpointSelectionType.Ordered));
+ test(test.ice_getEndpointSelection() == Ice.EndpointSelectionType.Ordered);
+ test = TestIntfPrxHelper.uncheckedCast(test.ice_cacheConnection(false));
+ test(!test.ice_getCacheConnection());
+ int nRetry = 5;
+ int i;
+
+ //
+ // Ensure that endpoints are tried in order by deactiving the adapters
+ // one after the other.
+ //
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter61"); i++);
+ test(i == nRetry);
+ com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(0));
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter62"); i++);
+ test(i == nRetry);
+ com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(1));
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter63"); i++);
+ test(i == nRetry);
+ com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(2));
+
+ try
+ {
+ test.getAdapterName();
+ }
+ catch(Ice.ConnectionRefusedException ex)
+ {
+ }
+
+ Ice.Endpoint[] endpoints = test.ice_getEndpoints();
+
+ adapters.clear();
+
+ //
+ // Now, re-activate the adapters with the same endpoints in the opposite
+ // order.
+ //
+ adapters.add(com.createObjectAdapter("Adapter66", endpoints[2].toString()));
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter66"); i++);
+ test(i == nRetry);
+ adapters.add(com.createObjectAdapter("Adapter65", endpoints[1].toString()));
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter65"); i++);
+ test(i == nRetry);
+ adapters.add(com.createObjectAdapter("Adapter64", endpoints[0].toString()));
+ for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter64"); i++);
+ test(i == nRetry);
+
+ deactivate(com, adapters);
+ }
+ System.out.println("ok");
+
+ System.out.print("testing endpoint mode filtering... ");
+ System.out.flush();
+ {
+ java.util.List adapters = new java.util.ArrayList();
+ adapters.add(com.createObjectAdapter("Adapter71", "default"));
+ adapters.add(com.createObjectAdapter("Adapter72", "udp"));
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ test(test.getAdapterName().equals("Adapter71"));
+
+ TestIntfPrx testUDP = TestIntfPrxHelper.uncheckedCast(test.ice_datagram());
+ test(test.ice_connection() != testUDP.ice_connection());
+ try
+ {
+ testUDP.getAdapterName();
+ }
+ catch(Ice.TwowayOnlyException ex)
+ {
+ }
+ }
+ System.out.println("ok");
+
+ if(communicator.getProperties().getProperty("Ice.Plugin.IceSSL").length() > 0)
+ {
+ System.out.print("testing unsecure vs. secure endpoints... ");
+ System.out.flush();
+ {
+ java.util.List adapters = new java.util.ArrayList();
+ adapters.add(com.createObjectAdapter("Adapter81", "ssl"));
+ adapters.add(com.createObjectAdapter("Adapter82", "tcp"));
+
+ TestIntfPrx test = createTestIntfPrx(adapters);
+ int i;
+ for(i = 0; i < 5; i++)
+ {
+ test(test.getAdapterName().equals("Adapter82"));
+ test.ice_connection().close(false);
+ }
+
+ TestIntfPrx testSecure = TestIntfPrxHelper.uncheckedCast(test.ice_secure(true));
+ //test(testSecure.ice_getSecure());
+ test(test.ice_connection() != testSecure.ice_connection());
+
+ com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(1));
+
+ for(i = 0; i < 5; i++)
+ {
+ test(test.getAdapterName().equals("Adapter81"));
+ test.ice_connection().close(false);
+ }
+
+ com.createObjectAdapter("Adapter83", (test.ice_getEndpoints()[1]).toString()); // Reactive tcp OA.
+
+ for(i = 0; i < 5; i++)
+ {
+ test(test.getAdapterName().equals("Adapter83"));
+ test.ice_connection().close(false);
+ }
+
+ com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(0));
+ try
+ {
+ testSecure.ice_ping();
+ test(false);
+ }
+ catch(Ice.ConnectionRefusedException ex)
+ {
+ }
+
+ deactivate(com, adapters);
+ }
+ System.out.println("ok");
+ }
+
+ com.shutdown();
+
+ }
+}
diff --git a/java/test/Ice/binding/Client.java b/java/test/Ice/binding/Client.java
new file mode 100644
index 00000000000..1a397b9af52
--- /dev/null
+++ b/java/test/Ice/binding/Client.java
@@ -0,0 +1,52 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 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)
+ {
+ 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 (Ice.LocalException 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/binding/RemoteCommunicatorI.java b/java/test/Ice/binding/RemoteCommunicatorI.java
new file mode 100644
index 00000000000..2d6596f2032
--- /dev/null
+++ b/java/test/Ice/binding/RemoteCommunicatorI.java
@@ -0,0 +1,35 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 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 RemoteCommunicatorI extends _RemoteCommunicatorDisp
+{
+ public RemoteObjectAdapterPrx
+ createObjectAdapter(String name, String endpoints, Ice.Current current)
+ {
+ Ice.Communicator com = current.adapter.getCommunicator();
+ com.getProperties().setProperty(name + ".ThreadPool.Size", "1");
+ Ice.ObjectAdapter adapter = com.createObjectAdapterWithEndpoints(name, endpoints);
+ return RemoteObjectAdapterPrxHelper.uncheckedCast(
+ current.adapter.addWithUUID(new RemoteObjectAdapterI(adapter)));
+ }
+
+ public void
+ deactivateObjectAdapter(RemoteObjectAdapterPrx adapter, Ice.Current current)
+ {
+ adapter.deactivate(); // Collocated call.
+ }
+
+ public void
+ shutdown(Ice.Current current)
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+};
diff --git a/java/test/Ice/binding/RemoteObjectAdapterI.java b/java/test/Ice/binding/RemoteObjectAdapterI.java
new file mode 100644
index 00000000000..3485cf3c8fb
--- /dev/null
+++ b/java/test/Ice/binding/RemoteObjectAdapterI.java
@@ -0,0 +1,43 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 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 RemoteObjectAdapterI extends _RemoteObjectAdapterDisp
+{
+ public
+ RemoteObjectAdapterI(Ice.ObjectAdapter adapter)
+ {
+ _adapter = adapter;
+ _testIntf = TestIntfPrxHelper.uncheckedCast(_adapter.add(new TestI(), Ice.Util.stringToIdentity("test")));
+ _adapter.activate();
+ }
+
+ public TestIntfPrx
+ getTestIntf(Ice.Current current)
+ {
+ return _testIntf;
+ }
+
+ public void
+ deactivate(Ice.Current current)
+ {
+ try
+ {
+ _adapter.deactivate();
+ _adapter.waitForDeactivate();
+ }
+ catch(Ice.ObjectAdapterDeactivatedException ex)
+ {
+ }
+ }
+
+ final Ice.ObjectAdapter _adapter;
+ final TestIntfPrx _testIntf;
+};
diff --git a/java/test/Ice/binding/Server.java b/java/test/Ice/binding/Server.java
new file mode 100644
index 00000000000..f7119a97305
--- /dev/null
+++ b/java/test/Ice/binding/Server.java
@@ -0,0 +1,58 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 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 12345:udp");
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.Identity id = Ice.Util.stringToIdentity("communicator");
+ adapter.add(new RemoteCommunicatorI(), id);
+ 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.gc();
+ System.exit(status);
+ }
+}
diff --git a/java/test/Ice/binding/Test.ice b/java/test/Ice/binding/Test.ice
new file mode 100644
index 00000000000..5400b2e607c
--- /dev/null
+++ b/java/test/Ice/binding/Test.ice
@@ -0,0 +1,39 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 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 TEST_ICE
+#define TEST_ICE
+
+module Test
+{
+
+interface TestIntf
+{
+ string getAdapterName();
+};
+
+interface RemoteObjectAdapter
+{
+ TestIntf* getTestIntf();
+
+ void deactivate();
+};
+
+interface RemoteCommunicator
+{
+ RemoteObjectAdapter* createObjectAdapter(string name, string endpoints);
+
+ void deactivateObjectAdapter(RemoteObjectAdapter* adapter);
+
+ void shutdown();
+};
+
+};
+
+#endif
diff --git a/java/test/Ice/binding/TestI.java b/java/test/Ice/binding/TestI.java
new file mode 100644
index 00000000000..18f41349dbc
--- /dev/null
+++ b/java/test/Ice/binding/TestI.java
@@ -0,0 +1,23 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 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 TestI extends _TestIntfDisp
+{
+ TestI()
+ {
+ }
+
+ public String
+ getAdapterName(Ice.Current current)
+ {
+ return current.adapter.getName();
+ }
+}
diff --git a/java/test/Ice/binding/build.xml b/java/test/Ice/binding/build.xml
new file mode 100644
index 00000000000..670213f0efc
--- /dev/null
+++ b/java/test/Ice/binding/build.xml
@@ -0,0 +1,65 @@
+<!--
+ **********************************************************************
+
+ Copyright (c) 2003-2005 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.
+
+ **********************************************************************
+-->
+
+<!DOCTYPE project [
+<!ENTITY common SYSTEM "file:../../../config/common.xml">
+]>
+
+<project name="test_Ice_binding" default="all" basedir=".">
+
+ <!-- set global properties for this build -->
+ <property name="top.dir" value="../../.."/>
+
+ &common;
+
+ <property name="lib.dir" value="${top.dir}/lib"/>
+ <property name="class.dir" value="classes"/>
+ <property name="generated.dir" value="generated"/>
+
+ <!-- set common build properties for this build -->
+ <property file="${top.dir}/config/build.properties"/>
+
+ <!-- install slice2java task -->
+ <taskdef name="slice2java" classpath="${top.dir}/ant"
+ classname="Slice2JavaTask" />
+
+ <target name="init" depends="config-init">
+ <!-- Create the time stamp -->
+ <tstamp/>
+ </target>
+
+ <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>
+ <fileset dir="." includes="Test.ice"/>
+ </slice2java>
+ </target>
+
+ <target name="compile" depends="generate">
+ <mkdir dir="${class.dir}"/>
+ <javac srcdir="${generated.dir}" destdir="${class.dir}"
+ source="1.4" classpath="${lib.dir}" debug="${debug}"/>
+ <javac srcdir="." destdir="${class.dir}" source="1.4"
+ classpath="${lib.dir}" excludes="generated/**" debug="${debug}"/>
+ </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/run.py b/java/test/Ice/binding/run.py
new file mode 100755
index 00000000000..6b7be4ecbb6
--- /dev/null
+++ b/java/test/Ice/binding/run.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2005 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
+
+for toplevel in [".", "..", "../..", "../../..", "../../../.."]:
+ toplevel = os.path.normpath(toplevel)
+ if os.path.exists(os.path.join(toplevel, "config", "TestUtil.py")):
+ break
+else:
+ raise "can't find toplevel directory!"
+
+sys.path.append(os.path.join(toplevel, "config"))
+import TestUtil
+
+name = os.path.join("Ice", "binding")
+testdir = os.path.join(toplevel, "test", name)
+os.environ["CLASSPATH"] = os.path.join(testdir, "classes") + TestUtil.sep + os.getenv("CLASSPATH", "")
+
+TestUtil.clientServerTest()
+sys.exit(0)
diff --git a/java/test/Ice/build.xml b/java/test/Ice/build.xml
index 24bf0c54a29..e4a2a76728e 100644
--- a/java/test/Ice/build.xml
+++ b/java/test/Ice/build.xml
@@ -13,6 +13,7 @@
<target name="all">
<ant dir="adapterDeactivation"/>
+ <ant dir="binding"/>
<ant dir="exceptions"/>
<ant dir="exceptionsAMD"/>
<ant dir="facets"/>