diff options
author | Benoit Foucher <benoit@zeroc.com> | 2006-02-14 12:06:57 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2006-02-14 12:06:57 +0000 |
commit | 770b66fc97582743bf045f709feac5c468c9d06d (patch) | |
tree | de6f5b22ed6c5a22d072337a647c9d3ac626eaa1 | |
parent | Fixed another race condition in the activator test suite. (diff) | |
download | ice-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.
-rwxr-xr-x | java/allTests.py | 1 | ||||
-rw-r--r-- | java/src/Ice/ConnectionI.java | 1 | ||||
-rw-r--r-- | java/src/Ice/ObjectPrx.java | 6 | ||||
-rw-r--r-- | java/src/Ice/ObjectPrxHelperBase.java | 145 | ||||
-rw-r--r-- | java/src/IceInternal/DirectReference.java | 11 | ||||
-rw-r--r-- | java/src/IceInternal/FixedReference.java | 104 | ||||
-rw-r--r-- | java/src/IceInternal/IndirectReference.java | 14 | ||||
-rw-r--r-- | java/src/IceInternal/OutgoingConnectionFactory.java | 4 | ||||
-rw-r--r-- | java/src/IceInternal/Reference.java | 272 | ||||
-rw-r--r-- | java/src/IceInternal/RoutableReference.java | 175 | ||||
-rw-r--r-- | java/test/Ice/binding/AllTests.java | 442 | ||||
-rw-r--r-- | java/test/Ice/binding/Client.java | 52 | ||||
-rw-r--r-- | java/test/Ice/binding/RemoteCommunicatorI.java | 35 | ||||
-rw-r--r-- | java/test/Ice/binding/RemoteObjectAdapterI.java | 43 | ||||
-rw-r--r-- | java/test/Ice/binding/Server.java | 58 | ||||
-rw-r--r-- | java/test/Ice/binding/Test.ice | 39 | ||||
-rw-r--r-- | java/test/Ice/binding/TestI.java | 23 | ||||
-rw-r--r-- | java/test/Ice/binding/build.xml | 65 | ||||
-rwxr-xr-x | java/test/Ice/binding/run.py | 28 | ||||
-rw-r--r-- | java/test/Ice/build.xml | 1 |
20 files changed, 1231 insertions, 288 deletions
diff --git a/java/allTests.py b/java/allTests.py index 2031d388109..9f580b6c661 100755 --- a/java/allTests.py +++ b/java/allTests.py @@ -58,6 +58,7 @@ tests = [ \ "Ice/inheritance", \ "Ice/facets", \ "Ice/objects", \ + "Ice/binding", \ "Ice/faultTolerance", \ "Ice/location", \ "Ice/adapterDeactivation", \ diff --git a/java/src/Ice/ConnectionI.java b/java/src/Ice/ConnectionI.java index d478eba4750..a398fb5db1b 100644 --- a/java/src/Ice/ConnectionI.java +++ b/java/src/Ice/ConnectionI.java @@ -1419,6 +1419,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne // Don't warn about certain expected exceptions. // if(!(_exception instanceof CloseConnectionException || + _exception instanceof ForcedCloseConnectionException || _exception instanceof ConnectionTimeoutException || _exception instanceof CommunicatorDestroyedException || _exception instanceof ObjectAdapterDeactivatedException || diff --git a/java/src/Ice/ObjectPrx.java b/java/src/Ice/ObjectPrx.java index 5c534f3dfb6..07a6954d633 100644 --- a/java/src/Ice/ObjectPrx.java +++ b/java/src/Ice/ObjectPrx.java @@ -57,6 +57,12 @@ public interface ObjectPrx int ice_getLocatorCacheTimeout(); ObjectPrx ice_locatorCacheTimeout(int newTimeout); + boolean ice_getCacheConnection(); + ObjectPrx ice_cacheConnection(boolean newCache); + + EndpointSelectionType ice_getEndpointSelection(); + ObjectPrx ice_endpointSelection(EndpointSelectionType newType); + ObjectPrx ice_twoway(); boolean ice_isTwoway(); ObjectPrx ice_oneway(); diff --git a/java/src/Ice/ObjectPrxHelperBase.java b/java/src/Ice/ObjectPrxHelperBase.java index ea1c40ad67e..125e227438e 100644 --- a/java/src/Ice/ObjectPrxHelperBase.java +++ b/java/src/Ice/ObjectPrxHelperBase.java @@ -310,8 +310,10 @@ public class ObjectPrxHelperBase implements ObjectPrx } else { + IceInternal.EndpointI[] edpts = new IceInternal.EndpointI[newEndpoints.length]; + edpts = (IceInternal.EndpointI[])java.util.Arrays.asList(newEndpoints).toArray(edpts); ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); - proxy.setup(_reference.changeEndpoints((IceInternal.EndpointI[])newEndpoints)); + proxy.setup(_reference.changeEndpoints(edpts)); return proxy; } } @@ -337,6 +339,48 @@ public class ObjectPrxHelperBase implements ObjectPrx } } + public final boolean + ice_getCacheConnection() + { + return _reference.getCacheConnection(); + } + + public final ObjectPrx + ice_cacheConnection(boolean newCache) + { + if(newCache == _reference.getCacheConnection()) + { + return this; + } + else + { + ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); + proxy.setup(_reference.changeCacheConnection(newCache)); + return proxy; + } + } + + public final Ice.EndpointSelectionType + ice_getEndpointSelection() + { + return _reference.getEndpointSelection(); + } + + public final ObjectPrx + ice_endpointSelection(Ice.EndpointSelectionType newType) + { + if(newType == _reference.getEndpointSelection()) + { + return this; + } + else + { + ObjectPrxHelperBase proxy = new ObjectPrxHelperBase(); + proxy.setup(_reference.changeEndpointSelection(newType)); + return proxy; + } + } + public final ObjectPrx ice_twoway() { @@ -636,18 +680,21 @@ public class ObjectPrxHelperBase implements ObjectPrx _reference = ref; - if(delegateD != null) - { - _ObjectDelD delegate = __createDelegateD(); - delegate.__copyFrom(delegateD); - _delegate = delegate; - } - else if(delegateM != null) - { - _ObjectDelM delegate = __createDelegateM(); - delegate.__copyFrom(delegateM); - _delegate = delegate; - } + if(_reference.getCacheConnection()) + { + if(delegateD != null) + { + _ObjectDelD delegate = __createDelegateD(); + delegate.__copyFrom(delegateD); + _delegate = delegate; + } + else if(delegateM != null) + { + _ObjectDelM delegate = __createDelegateM(); + delegate.__copyFrom(delegateM); + _delegate = delegate; + } + } } public final int @@ -702,45 +749,53 @@ public class ObjectPrxHelperBase implements ObjectPrx public final synchronized _ObjectDel __getDelegate() { - if(_delegate == null) + if(_delegate != null) { - if(_reference.getCollocationOptimization()) + return _delegate; + } + + _ObjectDel delegate = null; + if(_reference.getCollocationOptimization()) + { + ObjectAdapter adapter = _reference.getInstance().objectAdapterFactory().findObjectAdapter(this); + if(adapter != null) { - ObjectAdapter adapter = _reference.getInstance().objectAdapterFactory().findObjectAdapter(this); - if(adapter != null) - { - _ObjectDelD delegate = __createDelegateD(); - delegate.setup(_reference, adapter); - _delegate = delegate; - } + _ObjectDelD d = __createDelegateD(); + d.setup(_reference, adapter); + delegate = d; } + } - if(_delegate == null) - { - _ObjectDelM delegate = __createDelegateM(); - delegate.setup(_reference); - _delegate = delegate; - - // - // If this proxy is for a non-local object, and we are - // using a router, then add this proxy to the router info - // object. - // - try - { - IceInternal.RoutableReference rr = (IceInternal.RoutableReference)_reference; - if(rr != null && rr.getRouterInfo() != null) - { - rr.getRouterInfo().addProxy(this); - } - } - catch(ClassCastException e) + if(delegate == null) + { + _ObjectDelM d = __createDelegateM(); + d.setup(_reference); + delegate = d; + + // + // If this proxy is for a non-local object, and we are + // using a router, then add this proxy to the router info + // object. + // + try + { + IceInternal.RoutableReference rr = (IceInternal.RoutableReference)_reference; + if(rr != null && rr.getRouterInfo() != null) { + rr.getRouterInfo().addProxy(this); } - } - } + } + catch(ClassCastException e) + { + } + } + + if(_reference.getCacheConnection()) + { + _delegate = delegate; + } - return _delegate; + return delegate; } protected _ObjectDelM diff --git a/java/src/IceInternal/DirectReference.java b/java/src/IceInternal/DirectReference.java index fcee0d693b0..e5ac9fa6262 100644 --- a/java/src/IceInternal/DirectReference.java +++ b/java/src/IceInternal/DirectReference.java @@ -122,6 +122,7 @@ public class DirectReference extends RoutableReference { return this; } + DirectReference r = (DirectReference)getInstance().referenceFactory().copy(this); r._endpoints = newEndpoints; return r; @@ -179,16 +180,8 @@ public class DirectReference extends RoutableReference { endpts = _endpoints; } - EndpointI[] filteredEndpoints = filterEndpoints(endpts); - if(filteredEndpoints.length == 0) - { - Ice.NoEndpointException ex = new Ice.NoEndpointException(); - ex.proxy = toString(); - throw ex; - } - OutgoingConnectionFactory factory = getInstance().outgoingConnectionFactory(); - Ice.ConnectionI connection = factory.create(filteredEndpoints, comp); + Ice.ConnectionI connection = createConnection(endpts, comp); // // If we have a router, set the object adapter for this router diff --git a/java/src/IceInternal/FixedReference.java b/java/src/IceInternal/FixedReference.java index 4dd59e8d116..026aae68d68 100644 --- a/java/src/IceInternal/FixedReference.java +++ b/java/src/IceInternal/FixedReference.java @@ -174,5 +174,109 @@ public class FixedReference extends Reference return java.util.Arrays.equals(_fixedConnections, rhs._fixedConnections); } + // + // Filter connections based on criteria from this reference. + // + private Ice.ConnectionI[] + filterConnections(Ice.ConnectionI[] allConnections) + { + java.util.ArrayList connections = new java.util.ArrayList(allConnections.length); + + switch(getMode()) + { + case Reference.ModeTwoway: + case Reference.ModeOneway: + case Reference.ModeBatchOneway: + { + // + // Filter out datagram connections. + // + for(int i = 0; i < allConnections.length; ++i) + { + if(!allConnections[i].endpoint().datagram()) + { + connections.add(allConnections[i]); + } + } + + break; + } + + case Reference.ModeDatagram: + case Reference.ModeBatchDatagram: + { + // + // Filter out non-datagram connections. + // + for(int i = 0; i < allConnections.length; i++) + { + if(allConnections[i].endpoint().datagram()) + { + connections.add(allConnections[i]); + } + } + + break; + } + } + + // + // Randomize the order of connections. + // + java.util.Collections.shuffle(connections); + + // + // If a secure connection is requested, remove all non-secure + // endpoints. Otherwise make non-secure endpoints preferred over + // secure endpoints by partitioning the endpoint vector, so that + // non-secure endpoints come first. + // + if(getSecure()) + { + java.util.Iterator i = connections.iterator(); + while(i.hasNext()) + { + Ice.ConnectionI connection = (Ice.ConnectionI)i.next(); + if(!connection.endpoint().secure()) + { + i.remove(); + } + } + } + else + { + java.util.Collections.sort(connections, _connectionComparator); + } + + Ice.ConnectionI[] arr = new Ice.ConnectionI[connections.size()]; + connections.toArray(arr); + return arr; + } + + static class ConnectionComparator implements java.util.Comparator + { + public int + compare(java.lang.Object l, java.lang.Object r) + { + Ice.ConnectionI lc = (Ice.ConnectionI)l; + Ice.ConnectionI rc = (Ice.ConnectionI)r; + boolean ls = lc.endpoint().secure(); + boolean rs = rc.endpoint().secure(); + if((ls && rs) || (!ls && !rs)) + { + return 0; + } + else if(!ls && rs) + { + return -1; + } + else + { + return 1; + } + } + } + + private static ConnectionComparator _connectionComparator = new ConnectionComparator(); private Ice.ConnectionI _fixedConnections[]; } diff --git a/java/src/IceInternal/IndirectReference.java b/java/src/IceInternal/IndirectReference.java index d0c56776594..a1a563240cb 100644 --- a/java/src/IceInternal/IndirectReference.java +++ b/java/src/IceInternal/IndirectReference.java @@ -220,20 +220,16 @@ public class IndirectReference extends RoutableReference { endpts[i] = endpts[i].connectionId(_connectionId); } - EndpointI[] filteredEndpoints = filterEndpoints(endpts); - if(filteredEndpoints.length == 0) - { - Ice.NoEndpointException ex = new Ice.NoEndpointException(); - ex.proxy = toString(); - throw ex; - } try { - OutgoingConnectionFactory factory = getInstance().outgoingConnectionFactory(); - connection = factory.create(filteredEndpoints, comp); + connection = createConnection(endpts, comp); assert(connection != null); } + catch(Ice.NoEndpointException ex) + { + throw ex; // No need to retry if there's no endpoints. + } catch(Ice.LocalException ex) { if(getRouterInfo() == null) diff --git a/java/src/IceInternal/OutgoingConnectionFactory.java b/java/src/IceInternal/OutgoingConnectionFactory.java index 0ec64faa614..d5e4c47fefa 100644 --- a/java/src/IceInternal/OutgoingConnectionFactory.java +++ b/java/src/IceInternal/OutgoingConnectionFactory.java @@ -91,7 +91,7 @@ public final class OutgoingConnectionFactory } public Ice.ConnectionI - create(EndpointI[] endpts, Ice.BooleanHolder compress) + create(EndpointI[] endpts, boolean hasMore, Ice.BooleanHolder compress) { assert(endpts.length > 0); EndpointI[] endpoints = new EndpointI[endpts.length]; @@ -341,7 +341,7 @@ public final class OutgoingConnectionFactory { StringBuffer s = new StringBuffer(); s.append("connection to endpoint failed"); - if(i < endpoints.length - 1) + if(hasMore || i < endpoints.length - 1) { s.append(", trying next endpoint\n"); } diff --git a/java/src/IceInternal/Reference.java b/java/src/IceInternal/Reference.java index b225a0ab97b..7c81088d05d 100644 --- a/java/src/IceInternal/Reference.java +++ b/java/src/IceInternal/Reference.java @@ -48,6 +48,18 @@ public abstract class Reference implements Cloneable return _context; } + public final boolean + getCacheConnection() + { + return _cacheConnection; + } + + public final Ice.EndpointSelectionType + getEndpointSelection() + { + return _endpointSelection; + } + public final Reference defaultContext() { @@ -128,6 +140,29 @@ public abstract class Reference implements Cloneable return r; } + public final Reference + changeCacheConnection(boolean newCache) + { + if(newCache == _cacheConnection) + { + return this; + } + Reference r = _instance.referenceFactory().copy(this); + r._cacheConnection = newCache; + return r; + } + + public final Reference + changeEndpointSelection(Ice.EndpointSelectionType newType) + { + if(newType == _endpointSelection) + { + return this; + } + Reference r = _instance.referenceFactory().copy(this); + r._endpointSelection = newType; + return r; + } public abstract Reference changeSecure(boolean newSecure); public abstract Reference changeRouter(Ice.RouterPrx newRouter); @@ -329,6 +364,16 @@ public abstract class Reference implements Cloneable return false; } + if(_cacheConnection != r._cacheConnection) + { + return false; + } + + if(_endpointSelection != r._endpointSelection) + { + return false; + } + return true; } @@ -356,6 +401,8 @@ public abstract class Reference implements Cloneable private java.util.Map _context; private static java.util.HashMap _emptyContext = new java.util.HashMap(); private String _facet; + private boolean _cacheConnection; + private Ice.EndpointSelectionType _endpointSelection; private int _hashValue; private boolean _hashInitialized; @@ -381,229 +428,8 @@ public abstract class Reference implements Cloneable _identity = ident; _context = ctx == null ? _emptyContext : ctx; _facet = fac; + _cacheConnection = true; + _endpointSelection = Ice.EndpointSelectionType.Random; _hashInitialized = false; } - - // - // Filter endpoints based on criteria from this reference. - // - protected EndpointI[] - filterEndpoints(EndpointI[] allEndpoints) - { - java.util.ArrayList endpoints = new java.util.ArrayList(); - - // - // Filter out unknown endpoints. - // - for(int i = 0; i < allEndpoints.length; i++) - { - if(!allEndpoints[i].unknown()) - { - endpoints.add(allEndpoints[i]); - } - } - - switch(_mode) - { - case Reference.ModeTwoway: - case Reference.ModeOneway: - case Reference.ModeBatchOneway: - { - // - // Filter out datagram endpoints. - // - java.util.Iterator i = endpoints.iterator(); - while(i.hasNext()) - { - EndpointI endpoint = (EndpointI)i.next(); - if(endpoint.datagram()) - { - i.remove(); - } - } - break; - } - - case Reference.ModeDatagram: - case Reference.ModeBatchDatagram: - { - // - // Filter out non-datagram endpoints. - // - java.util.Iterator i = endpoints.iterator(); - while(i.hasNext()) - { - EndpointI endpoint = (EndpointI)i.next(); - if(!endpoint.datagram()) - { - i.remove(); - } - } - break; - } - } - - // - // Randomize the order of endpoints. - // - java.util.Collections.shuffle(endpoints); - - // - // If a secure connection is requested, remove all non-secure - // endpoints. Otherwise make non-secure endpoints preferred over - // secure endpoints by partitioning the endpoint vector, so that - // non-secure endpoints come first. - // - if(getSecure()) - { - java.util.Iterator i = endpoints.iterator(); - while(i.hasNext()) - { - EndpointI endpoint = (EndpointI)i.next(); - if(!endpoint.secure()) - { - i.remove(); - } - } - } - else - { - java.util.Collections.sort(endpoints, _endpointComparator); - } - - EndpointI[] arr = new EndpointI[endpoints.size()]; - endpoints.toArray(arr); - return arr; - } - - static class EndpointComparator implements java.util.Comparator - { - public int - compare(java.lang.Object l, java.lang.Object r) - { - IceInternal.EndpointI le = (IceInternal.EndpointI)l; - IceInternal.EndpointI re = (IceInternal.EndpointI)r; - boolean ls = le.secure(); - boolean rs = re.secure(); - if((ls && rs) || (!ls && !rs)) - { - return 0; - } - else if(!ls && rs) - { - return -1; - } - else - { - return 1; - } - } - } - - private static EndpointComparator _endpointComparator = new EndpointComparator(); - - // - // Filter connections based on criteria from this reference. - // - public Ice.ConnectionI[] - filterConnections(Ice.ConnectionI[] allConnections) - { - java.util.ArrayList connections = new java.util.ArrayList(allConnections.length); - - switch(_mode) - { - case Reference.ModeTwoway: - case Reference.ModeOneway: - case Reference.ModeBatchOneway: - { - // - // Filter out datagram connections. - // - for(int i = 0; i < allConnections.length; ++i) - { - if(!allConnections[i].endpoint().datagram()) - { - connections.add(allConnections[i]); - } - } - - break; - } - - case Reference.ModeDatagram: - case Reference.ModeBatchDatagram: - { - // - // Filter out non-datagram connections. - // - for(int i = 0; i < allConnections.length; i++) - { - if(allConnections[i].endpoint().datagram()) - { - connections.add(allConnections[i]); - } - } - - break; - } - } - - // - // Randomize the order of connections. - // - java.util.Collections.shuffle(connections); - - // - // If a secure connection is requested, remove all non-secure - // endpoints. Otherwise make non-secure endpoints preferred over - // secure endpoints by partitioning the endpoint vector, so that - // non-secure endpoints come first. - // - if(getSecure()) - { - java.util.Iterator i = connections.iterator(); - while(i.hasNext()) - { - Ice.ConnectionI connection = (Ice.ConnectionI)i.next(); - if(!connection.endpoint().secure()) - { - i.remove(); - } - } - } - else - { - java.util.Collections.sort(connections, _connectionComparator); - } - - Ice.ConnectionI[] arr = new Ice.ConnectionI[connections.size()]; - connections.toArray(arr); - return arr; - } - - static class ConnectionComparator implements java.util.Comparator - { - public int - compare(java.lang.Object l, java.lang.Object r) - { - Ice.ConnectionI lc = (Ice.ConnectionI)l; - Ice.ConnectionI rc = (Ice.ConnectionI)r; - boolean ls = lc.endpoint().secure(); - boolean rs = rc.endpoint().secure(); - if((ls && rs) || (!ls && !rs)) - { - return 0; - } - else if(!ls && rs) - { - return -1; - } - else - { - return 1; - } - } - } - - private static ConnectionComparator _connectionComparator = new ConnectionComparator(); } diff --git a/java/src/IceInternal/RoutableReference.java b/java/src/IceInternal/RoutableReference.java index 00dbec6508a..f515adaeb7b 100644 --- a/java/src/IceInternal/RoutableReference.java +++ b/java/src/IceInternal/RoutableReference.java @@ -121,6 +121,181 @@ public abstract class RoutableReference extends Reference _collocationOptimization = collocationOpt; } + protected Ice.ConnectionI + createConnection(EndpointI[] allEndpoints, Ice.BooleanHolder compress) + { + java.util.ArrayList endpoints = new java.util.ArrayList(); + + // + // Filter out unknown endpoints. + // + for(int i = 0; i < allEndpoints.length; i++) + { + if(!allEndpoints[i].unknown()) + { + endpoints.add(allEndpoints[i]); + } + } + + // + // Filter out endpoints according to the mode of the reference. + // + switch(getMode()) + { + case Reference.ModeTwoway: + case Reference.ModeOneway: + case Reference.ModeBatchOneway: + { + // + // Filter out datagram endpoints. + // + java.util.Iterator i = endpoints.iterator(); + while(i.hasNext()) + { + EndpointI endpoint = (EndpointI)i.next(); + if(endpoint.datagram()) + { + i.remove(); + } + } + break; + } + + case Reference.ModeDatagram: + case Reference.ModeBatchDatagram: + { + // + // Filter out non-datagram endpoints. + // + java.util.Iterator i = endpoints.iterator(); + while(i.hasNext()) + { + EndpointI endpoint = (EndpointI)i.next(); + if(!endpoint.datagram()) + { + i.remove(); + } + } + break; + } + } + + // + // Sort the endpoints according to the endpoint selection type. + // + switch(getEndpointSelection().value()) + { + case Ice.EndpointSelectionType._Random: + java.util.Collections.shuffle(endpoints); + break; + case Ice.EndpointSelectionType._Ordered: + // Nothing to do. + break; + default: + assert(false); + break; + } + + // + // If a secure connection is requested, remove all non-secure + // endpoints. Otherwise make non-secure endpoints preferred over + // secure endpoints by partitioning the endpoint vector, so that + // non-secure endpoints come first. + // + if(getSecure()) + { + java.util.Iterator i = endpoints.iterator(); + while(i.hasNext()) + { + EndpointI endpoint = (EndpointI)i.next(); + if(!endpoint.secure()) + { + i.remove(); + } + } + } + else + { + java.util.Collections.sort(endpoints, _endpointComparator); + } + + if(endpoints.size() == 0) + { + Ice.NoEndpointException ex = new Ice.NoEndpointException(); + ex.proxy = toString(); + throw ex; + } + + // + // Finally, create the connection. + // + OutgoingConnectionFactory factory = getInstance().outgoingConnectionFactory(); + if(getCacheConnection() || endpoints.size() == 1) + { + // + // Get an existing connection or create one if there's no + // existing connection to one of the given endpoints. + // + return factory.create((EndpointI[])endpoints.toArray(new EndpointI[endpoints.size()]), false, compress); + } + else + { + // + // Go through the list of endpoints and try to create the + // connection until it succeeds. This is different from just + // calling create() with the given endpoints since this might + // create a new connection even if there's an existing + // connection for one of the endpoints. + // + + Ice.LocalException exception = null; + EndpointI[] endpoint = new EndpointI[1]; + + java.util.Iterator i = endpoints.iterator(); + while(i.hasNext()) + { + try + { + endpoint[0] = (EndpointI)i.next(); + return factory.create(endpoint, i.hasNext(), compress); + } + catch(Ice.LocalException ex) + { + exception = ex; + } + } + + assert(exception != null); + throw exception; + } + } + + static class EndpointComparator implements java.util.Comparator + { + public int + compare(java.lang.Object l, java.lang.Object r) + { + IceInternal.EndpointI le = (IceInternal.EndpointI)l; + IceInternal.EndpointI re = (IceInternal.EndpointI)r; + boolean ls = le.secure(); + boolean rs = re.secure(); + if((ls && rs) || (!ls && !rs)) + { + return 0; + } + else if(!ls && rs) + { + return -1; + } + else + { + return 1; + } + } + } + + private static EndpointComparator _endpointComparator = new EndpointComparator(); + private boolean _secure; private RouterInfo _routerInfo; // Null if no router is used. private boolean _collocationOptimization; 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"/> |