diff options
Diffstat (limited to 'java/test/Ice')
90 files changed, 9266 insertions, 9266 deletions
diff --git a/java/test/Ice/adapterDeactivation/AllTests.java b/java/test/Ice/adapterDeactivation/AllTests.java index 0fde580d033..50db73e1b3f 100644 --- a/java/test/Ice/adapterDeactivation/AllTests.java +++ b/java/test/Ice/adapterDeactivation/AllTests.java @@ -37,27 +37,27 @@ public class AllTests test(obj.equals(base)); System.out.println("ok"); - { + { System.out.print("creating/destroying/recreating object adapter... "); System.out.flush(); - Ice.ObjectAdapter adapter = - communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999"); - try - { - communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9998"); - test(false); - } - catch(Ice.AlreadyRegisteredException ex) - { - } - adapter.destroy(); - // - // Use a different port than the first adapter to avoid an "address already in use" error. - // - adapter = communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9998"); - adapter.destroy(); + Ice.ObjectAdapter adapter = + communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999"); + try + { + communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9998"); + test(false); + } + catch(Ice.AlreadyRegisteredException ex) + { + } + adapter.destroy(); + // + // Use a different port than the first adapter to avoid an "address already in use" error. + // + adapter = communicator.createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9998"); + adapter.destroy(); System.out.println("ok"); - } + } System.out.print("creating/activating/deactivating object adapter in one operation... "); System.out.flush(); diff --git a/java/test/Ice/adapterDeactivation/ServantLocatorI.java b/java/test/Ice/adapterDeactivation/ServantLocatorI.java index 639a493f149..80e2241a214 100644 --- a/java/test/Ice/adapterDeactivation/ServantLocatorI.java +++ b/java/test/Ice/adapterDeactivation/ServantLocatorI.java @@ -37,9 +37,9 @@ public final class ServantLocatorI extends Ice.LocalObjectImpl implements Ice.Se locate(Ice.Current current, Ice.LocalObjectHolder cookie) { synchronized(this) - { - test(!_deactivated); - } + { + test(!_deactivated); + } test(current.id.category.length() == 0); test(current.id.name.equals("test")); @@ -52,10 +52,10 @@ public final class ServantLocatorI extends Ice.LocalObjectImpl implements Ice.Se public void finished(Ice.Current current, Ice.Object servant, Ice.LocalObject cookie) { - synchronized(this) - { - test(!_deactivated); - } + synchronized(this) + { + test(!_deactivated); + } Cookie co = (Cookie)cookie; test(co.message().equals("blahblah")); @@ -64,12 +64,12 @@ public final class ServantLocatorI extends Ice.LocalObjectImpl implements Ice.Se public synchronized void deactivate(String category) { - synchronized(this) - { - test(!_deactivated); + synchronized(this) + { + test(!_deactivated); - _deactivated = true; - } + _deactivated = true; + } } private boolean _deactivated; diff --git a/java/test/Ice/adapterDeactivation/Server.java b/java/test/Ice/adapterDeactivation/Server.java index e46e369c98a..5055ded0cb1 100644 --- a/java/test/Ice/adapterDeactivation/Server.java +++ b/java/test/Ice/adapterDeactivation/Server.java @@ -30,7 +30,7 @@ public class Server { TestServer app = new TestServer(); int result = app.main("Server", args); - System.gc(); + System.gc(); System.exit(result); } } diff --git a/java/test/Ice/binding/AllTests.java b/java/test/Ice/binding/AllTests.java index 3feb1c2eb9c..c1422f1f2ba 100644 --- a/java/test/Ice/binding/AllTests.java +++ b/java/test/Ice/binding/AllTests.java @@ -22,700 +22,700 @@ public class AllTests static class GetAdapterNameCB extends AMI_TestIntf_getAdapterName { - synchronized public void - ice_response(String adapterName) - { - _name = adapterName; - notify(); - } - - public void - ice_exception(Ice.LocalException ex) + synchronized public void + ice_response(String adapterName) { - test(false); - } + _name = adapterName; + notify(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } - public void - ice_exception(Ice.UserException ex) + public void + ice_exception(Ice.UserException ex) { - test(false); - } + test(false); + } - synchronized public String - getResult() + synchronized public String + getResult() { - while(_name == null) - { - try - { - wait(); - } - catch(java.lang.InterruptedException ex) - { - } - } - return _name; - } - - private String _name = null; + while(_name == null) + { + try + { + wait(); + } + catch(java.lang.InterruptedException ex) + { + } + } + return _name; + } + + private String _name = null; }; private static String getAdapterNameWithAMI(TestIntfPrx test) { - GetAdapterNameCB cb = new GetAdapterNameCB(); - test.getAdapterName_async(cb); - return cb.getResult(); + GetAdapterNameCB cb = new GetAdapterNameCB(); + test.getAdapterName_async(cb); + return cb.getResult(); } 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_endpoints((Ice.Endpoint[])endpoints.toArray(new Ice.Endpoint[endpoints.size()]))); + 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_endpoints((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()); - } + 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 12010 -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_getConnection() == test2.ice_getConnection()); - - test1.ice_ping(); - test2.ice_ping(); - - com.deactivateObjectAdapter(adapter); - - TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1); - test(test3.ice_getConnection() == test1.ice_getConnection()); - test(test3.ice_getConnection() == test2.ice_getConnection()); - - 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")); - - // - // Ensure that when a connection is opened it's reused for new - // proxies and that all endpoints are eventually tried. - // - 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_getConnection() == test2.ice_getConnection()); - test(test2.ice_getConnection() == test3.ice_getConnection()); - - names.remove(test1.getAdapterName()); - test1.ice_getConnection().close(false); - } - - // - // Ensure that the proxy correctly caches the connection (we - // always send the request over the same connection.) - // - { - java.util.Iterator p = adapters.iterator(); - while(p.hasNext()) - { - ((RemoteObjectAdapterPrx)p.next()).getTestIntf().ice_ping(); - } - - TestIntfPrx test = createTestIntfPrx(adapters); - String name = test.getAdapterName(); - final int nRetry = 10; - int i; - for(i = 0; i < nRetry && test.getAdapterName().equals(name); i++); - test(i == nRetry); - - p = adapters.iterator(); - while(p.hasNext()) - { - ((RemoteObjectAdapterPrx)p.next()).getTestIntf().ice_getConnection().close(false); - } - } - - // - // Deactivate an adapter and ensure that we can still - // establish the connection to the remaining adapters. - // - 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_getConnection() == test2.ice_getConnection()); - test(test2.ice_getConnection() == test3.ice_getConnection()); - - names.remove(test1.getAdapterName()); - test1.ice_getConnection().close(false); - } - - // - // Deactivate an adapter and ensure that we can still - // establish the connection to the remaining adapter. - // - 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 binding with multiple endpoints and AMI... "); - System.out.flush(); - { - java.util.List adapters = new java.util.ArrayList(); - adapters.add(com.createObjectAdapter("AdapterAMI11", "default")); - adapters.add(com.createObjectAdapter("AdapterAMI12", "default")); - adapters.add(com.createObjectAdapter("AdapterAMI13", "default")); - - // - // Ensure that when a connection is opened it's reused for new - // proxies and that all endpoints are eventually tried. - // - java.util.Set names = new java.util.HashSet(); - names.add("AdapterAMI11"); - names.add("AdapterAMI12"); - names.add("AdapterAMI13"); - 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_getConnection() == test2.ice_getConnection()); - test(test2.ice_getConnection() == test3.ice_getConnection()); - - names.remove(getAdapterNameWithAMI(test1)); - test1.ice_getConnection().close(false); - } - - // - // Ensure that the proxy correctly caches the connection (we - // always send the request over the same connection.) - // - { - java.util.Iterator p = adapters.iterator(); - while(p.hasNext()) - { - ((RemoteObjectAdapterPrx)p.next()).getTestIntf().ice_ping(); - } - - TestIntfPrx test = createTestIntfPrx(adapters); - String name = getAdapterNameWithAMI(test); - final int nRetry = 10; - int i; - for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals(name); i++); - test(i == nRetry); - - p = adapters.iterator(); - while(p.hasNext()) - { - ((RemoteObjectAdapterPrx)p.next()).getTestIntf().ice_getConnection().close(false); - } - } - - // - // Deactivate an adapter and ensure that we can still - // establish the connection to the remaining adapters. - // - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(0)); - names.add("AdapterAMI12"); - names.add("AdapterAMI13"); - 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_getConnection() == test2.ice_getConnection()); - test(test2.ice_getConnection() == test3.ice_getConnection()); - - names.remove(getAdapterNameWithAMI(test1)); - test1.ice_getConnection().close(false); - } - - // - // Deactivate an adapter and ensure that we can still - // establish the connection to the remaining adapter. - // - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(2)); - TestIntfPrx test = createTestIntfPrx(adapters); - test(getAdapterNameWithAMI(test).equals("AdapterAMI12")); - - 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_getConnection().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_getConnection().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_getConnection().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_getConnection().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_connectionCached(false)); - TestIntfPrx test2 = TestIntfPrxHelper.uncheckedCast(adapter.getTestIntf().ice_connectionCached(false)); - test(!test1.ice_isConnectionCached()); - test(!test2.ice_isConnectionCached()); - test(test1.ice_getConnection() == test2.ice_getConnection()); - - test1.ice_ping(); - - com.deactivateObjectAdapter(adapter); - - TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1); - try - { - test(test3.ice_getConnection() == test1.ice_getConnection()); - 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_connectionCached(false)); - test(!test.ice_isConnectionCached()); - - 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 with multiple endpoints and AMI... "); - System.out.flush(); - { - java.util.List adapters = new java.util.ArrayList(); - adapters.add(com.createObjectAdapter("AdapterAMI51", "default")); - adapters.add(com.createObjectAdapter("AdapterAMI52", "default")); - adapters.add(com.createObjectAdapter("AdapterAMI53", "default")); - - TestIntfPrx test = TestIntfPrxHelper.uncheckedCast(createTestIntfPrx(adapters).ice_connectionCached(false)); - test(!test.ice_isConnectionCached()); - - java.util.Set names = new java.util.HashSet(); - names.add("AdapterAMI51"); - names.add("AdapterAMI52"); - names.add("AdapterAMI53"); - while(!names.isEmpty()) - { - names.remove(getAdapterNameWithAMI(test)); - } - - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(0)); - - names.add("AdapterAMI52"); - names.add("AdapterAMI53"); - while(!names.isEmpty()) - { - names.remove(getAdapterNameWithAMI(test)); - } - - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(2)); - - - test(getAdapterNameWithAMI(test).equals("AdapterAMI52")); - - 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_connectionCached(false)); - test(!test.ice_isConnectionCached()); - 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 per request binding and ordered endpoint selection and AMI... "); - System.out.flush(); - { - java.util.List adapters = new java.util.ArrayList(); - adapters.add(com.createObjectAdapter("AdapterAMI61", "default")); - adapters.add(com.createObjectAdapter("AdapterAMI62", "default")); - adapters.add(com.createObjectAdapter("AdapterAMI63", "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_connectionCached(false)); - test(!test.ice_isConnectionCached()); - 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 && getAdapterNameWithAMI(test).equals("AdapterAMI61"); i++); - test(i == nRetry); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(0)); - for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI62"); i++); - test(i == nRetry); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(1)); - for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI63"); 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("AdapterAMI66", endpoints[2].toString())); - for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI66"); i++); - test(i == nRetry); - adapters.add(com.createObjectAdapter("AdapterAMI65", endpoints[1].toString())); - for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI65"); i++); - test(i == nRetry); - adapters.add(com.createObjectAdapter("AdapterAMI64", endpoints[0].toString())); - for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI64"); 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_getConnection() != testUDP.ice_getConnection()); - 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_getConnection().close(false); - } - - TestIntfPrx testSecure = TestIntfPrxHelper.uncheckedCast(test.ice_secure(true)); - test(testSecure.ice_isSecure()); - testSecure = TestIntfPrxHelper.uncheckedCast(test.ice_secure(false)); - test(!testSecure.ice_isSecure()); - testSecure = TestIntfPrxHelper.uncheckedCast(test.ice_secure(true)); - test(testSecure.ice_isSecure()); - test(test.ice_getConnection() != testSecure.ice_getConnection()); - - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(1)); - - for(i = 0; i < 5; i++) - { - test(test.getAdapterName().equals("Adapter81")); - test.ice_getConnection().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_getConnection().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(); - + 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(); + { + RemoteObjectAdapterPrx adapter = com.createObjectAdapter("Adapter", "default"); + + TestIntfPrx test1 = adapter.getTestIntf(); + TestIntfPrx test2 = adapter.getTestIntf(); + test(test1.ice_getConnection() == test2.ice_getConnection()); + + test1.ice_ping(); + test2.ice_ping(); + + com.deactivateObjectAdapter(adapter); + + TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1); + test(test3.ice_getConnection() == test1.ice_getConnection()); + test(test3.ice_getConnection() == test2.ice_getConnection()); + + 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")); + + // + // Ensure that when a connection is opened it's reused for new + // proxies and that all endpoints are eventually tried. + // + 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_getConnection() == test2.ice_getConnection()); + test(test2.ice_getConnection() == test3.ice_getConnection()); + + names.remove(test1.getAdapterName()); + test1.ice_getConnection().close(false); + } + + // + // Ensure that the proxy correctly caches the connection (we + // always send the request over the same connection.) + // + { + java.util.Iterator p = adapters.iterator(); + while(p.hasNext()) + { + ((RemoteObjectAdapterPrx)p.next()).getTestIntf().ice_ping(); + } + + TestIntfPrx test = createTestIntfPrx(adapters); + String name = test.getAdapterName(); + final int nRetry = 10; + int i; + for(i = 0; i < nRetry && test.getAdapterName().equals(name); i++); + test(i == nRetry); + + p = adapters.iterator(); + while(p.hasNext()) + { + ((RemoteObjectAdapterPrx)p.next()).getTestIntf().ice_getConnection().close(false); + } + } + + // + // Deactivate an adapter and ensure that we can still + // establish the connection to the remaining adapters. + // + 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_getConnection() == test2.ice_getConnection()); + test(test2.ice_getConnection() == test3.ice_getConnection()); + + names.remove(test1.getAdapterName()); + test1.ice_getConnection().close(false); + } + + // + // Deactivate an adapter and ensure that we can still + // establish the connection to the remaining adapter. + // + 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 binding with multiple endpoints and AMI... "); + System.out.flush(); + { + java.util.List adapters = new java.util.ArrayList(); + adapters.add(com.createObjectAdapter("AdapterAMI11", "default")); + adapters.add(com.createObjectAdapter("AdapterAMI12", "default")); + adapters.add(com.createObjectAdapter("AdapterAMI13", "default")); + + // + // Ensure that when a connection is opened it's reused for new + // proxies and that all endpoints are eventually tried. + // + java.util.Set names = new java.util.HashSet(); + names.add("AdapterAMI11"); + names.add("AdapterAMI12"); + names.add("AdapterAMI13"); + 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_getConnection() == test2.ice_getConnection()); + test(test2.ice_getConnection() == test3.ice_getConnection()); + + names.remove(getAdapterNameWithAMI(test1)); + test1.ice_getConnection().close(false); + } + + // + // Ensure that the proxy correctly caches the connection (we + // always send the request over the same connection.) + // + { + java.util.Iterator p = adapters.iterator(); + while(p.hasNext()) + { + ((RemoteObjectAdapterPrx)p.next()).getTestIntf().ice_ping(); + } + + TestIntfPrx test = createTestIntfPrx(adapters); + String name = getAdapterNameWithAMI(test); + final int nRetry = 10; + int i; + for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals(name); i++); + test(i == nRetry); + + p = adapters.iterator(); + while(p.hasNext()) + { + ((RemoteObjectAdapterPrx)p.next()).getTestIntf().ice_getConnection().close(false); + } + } + + // + // Deactivate an adapter and ensure that we can still + // establish the connection to the remaining adapters. + // + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(0)); + names.add("AdapterAMI12"); + names.add("AdapterAMI13"); + 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_getConnection() == test2.ice_getConnection()); + test(test2.ice_getConnection() == test3.ice_getConnection()); + + names.remove(getAdapterNameWithAMI(test1)); + test1.ice_getConnection().close(false); + } + + // + // Deactivate an adapter and ensure that we can still + // establish the connection to the remaining adapter. + // + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(2)); + TestIntfPrx test = createTestIntfPrx(adapters); + test(getAdapterNameWithAMI(test).equals("AdapterAMI12")); + + 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_getConnection().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_getConnection().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_getConnection().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_getConnection().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_connectionCached(false)); + TestIntfPrx test2 = TestIntfPrxHelper.uncheckedCast(adapter.getTestIntf().ice_connectionCached(false)); + test(!test1.ice_isConnectionCached()); + test(!test2.ice_isConnectionCached()); + test(test1.ice_getConnection() == test2.ice_getConnection()); + + test1.ice_ping(); + + com.deactivateObjectAdapter(adapter); + + TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1); + try + { + test(test3.ice_getConnection() == test1.ice_getConnection()); + 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_connectionCached(false)); + test(!test.ice_isConnectionCached()); + + 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 with multiple endpoints and AMI... "); + System.out.flush(); + { + java.util.List adapters = new java.util.ArrayList(); + adapters.add(com.createObjectAdapter("AdapterAMI51", "default")); + adapters.add(com.createObjectAdapter("AdapterAMI52", "default")); + adapters.add(com.createObjectAdapter("AdapterAMI53", "default")); + + TestIntfPrx test = TestIntfPrxHelper.uncheckedCast(createTestIntfPrx(adapters).ice_connectionCached(false)); + test(!test.ice_isConnectionCached()); + + java.util.Set names = new java.util.HashSet(); + names.add("AdapterAMI51"); + names.add("AdapterAMI52"); + names.add("AdapterAMI53"); + while(!names.isEmpty()) + { + names.remove(getAdapterNameWithAMI(test)); + } + + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(0)); + + names.add("AdapterAMI52"); + names.add("AdapterAMI53"); + while(!names.isEmpty()) + { + names.remove(getAdapterNameWithAMI(test)); + } + + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(2)); + + + test(getAdapterNameWithAMI(test).equals("AdapterAMI52")); + + 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_connectionCached(false)); + test(!test.ice_isConnectionCached()); + 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 per request binding and ordered endpoint selection and AMI... "); + System.out.flush(); + { + java.util.List adapters = new java.util.ArrayList(); + adapters.add(com.createObjectAdapter("AdapterAMI61", "default")); + adapters.add(com.createObjectAdapter("AdapterAMI62", "default")); + adapters.add(com.createObjectAdapter("AdapterAMI63", "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_connectionCached(false)); + test(!test.ice_isConnectionCached()); + 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 && getAdapterNameWithAMI(test).equals("AdapterAMI61"); i++); + test(i == nRetry); + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(0)); + for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI62"); i++); + test(i == nRetry); + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(1)); + for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI63"); 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("AdapterAMI66", endpoints[2].toString())); + for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI66"); i++); + test(i == nRetry); + adapters.add(com.createObjectAdapter("AdapterAMI65", endpoints[1].toString())); + for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI65"); i++); + test(i == nRetry); + adapters.add(com.createObjectAdapter("AdapterAMI64", endpoints[0].toString())); + for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI64"); 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_getConnection() != testUDP.ice_getConnection()); + 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_getConnection().close(false); + } + + TestIntfPrx testSecure = TestIntfPrxHelper.uncheckedCast(test.ice_secure(true)); + test(testSecure.ice_isSecure()); + testSecure = TestIntfPrxHelper.uncheckedCast(test.ice_secure(false)); + test(!testSecure.ice_isSecure()); + testSecure = TestIntfPrxHelper.uncheckedCast(test.ice_secure(true)); + test(testSecure.ice_isSecure()); + test(test.ice_getConnection() != testSecure.ice_getConnection()); + + com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(1)); + + for(i = 0; i < 5; i++) + { + test(test.getAdapterName().equals("Adapter81")); + test.ice_getConnection().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_getConnection().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 index 4399d5ae044..aa5e5100f06 100644 --- a/java/test/Ice/binding/Client.java +++ b/java/test/Ice/binding/Client.java @@ -12,7 +12,7 @@ public class Client private static int run(String[] args, Ice.Communicator communicator) { - AllTests.allTests(communicator); + AllTests.allTests(communicator); return 0; } @@ -46,7 +46,7 @@ public class Client } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/binding/RemoteCommunicatorI.java b/java/test/Ice/binding/RemoteCommunicatorI.java index ada63c2abb2..a2143ff920f 100644 --- a/java/test/Ice/binding/RemoteCommunicatorI.java +++ b/java/test/Ice/binding/RemoteCommunicatorI.java @@ -14,25 +14,25 @@ public class RemoteCommunicatorI extends _RemoteCommunicatorDisp public RemoteObjectAdapterPrx createObjectAdapter(String name, String endpoints, Ice.Current current) { - Ice.Communicator com = current.adapter.getCommunicator(); + Ice.Communicator com = current.adapter.getCommunicator(); if(com.getProperties().getPropertyAsIntWithDefault("Ice.ThreadPerConnection", 0) == 0) { com.getProperties().setProperty("Ice.OA." + name + ".ThreadPool.Size", "1"); } - Ice.ObjectAdapter adapter = com.createObjectAdapterWithEndpoints(name, endpoints); - return RemoteObjectAdapterPrxHelper.uncheckedCast( - current.adapter.addWithUUID(new RemoteObjectAdapterI(adapter))); + 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. + adapter.deactivate(); // Collocated call. } public void shutdown(Ice.Current current) { - current.adapter.getCommunicator().shutdown(); + current.adapter.getCommunicator().shutdown(); } } diff --git a/java/test/Ice/binding/RemoteObjectAdapterI.java b/java/test/Ice/binding/RemoteObjectAdapterI.java index 15e79b18295..65f067278aa 100644 --- a/java/test/Ice/binding/RemoteObjectAdapterI.java +++ b/java/test/Ice/binding/RemoteObjectAdapterI.java @@ -14,28 +14,28 @@ public class RemoteObjectAdapterI extends _RemoteObjectAdapterDisp public RemoteObjectAdapterI(Ice.ObjectAdapter adapter) { - _adapter = adapter; - _testIntf = TestIntfPrxHelper.uncheckedCast(_adapter.add(new TestI(), - _adapter.getCommunicator().stringToIdentity("test"))); - _adapter.activate(); + _adapter = adapter; + _testIntf = TestIntfPrxHelper.uncheckedCast(_adapter.add(new TestI(), + _adapter.getCommunicator().stringToIdentity("test"))); + _adapter.activate(); } public TestIntfPrx getTestIntf(Ice.Current current) { - return _testIntf; + return _testIntf; } public void deactivate(Ice.Current current) { - try - { - _adapter.destroy(); - } - catch(Ice.ObjectAdapterDeactivatedException ex) - { - } + try + { + _adapter.destroy(); + } + catch(Ice.ObjectAdapterDeactivatedException ex) + { + } } final Ice.ObjectAdapter _adapter; diff --git a/java/test/Ice/binding/TestI.java b/java/test/Ice/binding/TestI.java index 65074e61fa5..51b0e7b60f0 100644 --- a/java/test/Ice/binding/TestI.java +++ b/java/test/Ice/binding/TestI.java @@ -18,6 +18,6 @@ public class TestI extends _TestIntfDisp public String getAdapterName(Ice.Current current) { - return current.adapter.getName(); + return current.adapter.getName(); } } diff --git a/java/test/Ice/checksum/client/Client.java b/java/test/Ice/checksum/client/Client.java index a4bd153e20e..1ebcec8f727 100644 --- a/java/test/Ice/checksum/client/Client.java +++ b/java/test/Ice/checksum/client/Client.java @@ -47,7 +47,7 @@ public class Client } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/checksum/server/Server.java b/java/test/Ice/checksum/server/Server.java index a14c6b4d5be..00c1ca2ae14 100644 --- a/java/test/Ice/checksum/server/Server.java +++ b/java/test/Ice/checksum/server/Server.java @@ -51,7 +51,7 @@ public class Server } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/custom/Client.java b/java/test/Ice/custom/Client.java index 1a3a806249c..cc6d8fe4fe1 100644 --- a/java/test/Ice/custom/Client.java +++ b/java/test/Ice/custom/Client.java @@ -49,7 +49,7 @@ public class Client } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/custom/Server.java b/java/test/Ice/custom/Server.java index 0d069a21d57..56145be745c 100644 --- a/java/test/Ice/custom/Server.java +++ b/java/test/Ice/custom/Server.java @@ -53,7 +53,7 @@ public class Server } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/custom/jdk1.5/AllTests.java b/java/test/Ice/custom/jdk1.5/AllTests.java index f8913ecac73..e726c376ac0 100644 --- a/java/test/Ice/custom/jdk1.5/AllTests.java +++ b/java/test/Ice/custom/jdk1.5/AllTests.java @@ -15,210 +15,210 @@ public class AllTests private static void test(boolean b) { - if(!b) - { - throw new RuntimeException(); - } + if(!b) + { + throw new RuntimeException(); + } } public static TestIntfPrx allTests(Ice.Communicator communicator) { - System.out.print("testing stringToProxy... "); - System.out.flush(); - String ref = "test:default -p 12010 -t 10000"; - Ice.ObjectPrx obj = communicator.stringToProxy(ref); - test(obj != null); - System.out.println("ok"); - - System.out.print("testing checked cast... "); - System.out.flush(); - TestIntfPrx t = TestIntfPrxHelper.checkedCast(obj); - test(t != null); - test(t.equals(obj)); - System.out.println("ok"); - - System.out.print("testing custom sequences... "); - System.out.flush(); - - { - // - // Create a sequence of C instances, where elements 1..n simply point to element 0. - // - C[] seq = new C[5]; - seq[0] = new C(); - for(int i = 1; i < seq.length; i++) - { - seq[i] = seq[0]; - } - - // - // Invoke each operation and verify that the returned sequences have the same - // structure as the original. - // - CSeqHolder seqH = new CSeqHolder(); - C[] seqR = t.opCSeq(seq, seqH); - test(seqR.length == seq.length); - test(seqH.value.length == seq.length); - for(int i = 1; i < seq.length; i++) - { - test(seqR[i] != null); - test(seqR[i] == seqR[0]); - test(seqR[i] == seqH.value[i]); - } - - ArrayList<C> arr = new ArrayList<C>(Arrays.asList(seq)); - CArrayHolder arrH = new CArrayHolder(); - List<C> arrR = t.opCArray(arr, arrH); - test(arrR.size() == arr.size()); - test(arrH.value.size() == arr.size()); - for(int i = 1; i < arr.size(); i++) - { - test(arrR.get(i) != null); - test(arrR.get(i) == arrR.get(0)); - test(arrR.get(i) == arrH.value.get(i)); - } - - LinkedList<C> list = new LinkedList<C>(Arrays.asList(seq)); - CListHolder listH = new CListHolder(); - List<C> listR = t.opCList(list, listH); - test(listR.size() == list.size()); - test(listH.value.size() == list.size()); - for(int i = 1; i < list.size(); i++) - { - test(listR.get(i) != null); - test(listR.get(i) == listR.get(0)); - test(listR.get(i) == listH.value.get(i)); - } - } - - { - final Boolean[] seq = { Boolean.TRUE, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, Boolean.TRUE }; - ArrayList<Boolean> list = new ArrayList<Boolean>(Arrays.asList(seq)); - BoolSeqHolder listH = new BoolSeqHolder(); - List<Boolean> listR = t.opBoolSeq(list, listH); - test(listH.value.equals(listR)); - test(listH.value.equals(list)); - } - - { - final Byte[] seq = { new Byte((byte)0), new Byte((byte)1), new Byte((byte)2), new Byte((byte)3) }; - ArrayList<Byte> list = new ArrayList<Byte>(Arrays.asList(seq)); - ByteSeqHolder listH = new ByteSeqHolder(); - List<Byte> listR = t.opByteSeq(list, listH); - test(listH.value.equals(listR)); - test(listH.value.equals(list)); - } - - { - final Short[] seq = { new Short((short)0), new Short((short)1), new Short((short)2), new Short((short)3) }; - ArrayList<Short> list = new ArrayList<Short>(Arrays.asList(seq)); - ShortSeqHolder listH = new ShortSeqHolder(); - List<Short> listR = t.opShortSeq(list, listH); - test(listH.value.equals(listR)); - test(listH.value.equals(list)); - } - - { - final Integer[] seq = { new Integer(0), new Integer(1), new Integer(2), new Integer(3) }; - ArrayList<Integer> list = new ArrayList<Integer>(Arrays.asList(seq)); - IntSeqHolder listH = new IntSeqHolder(); - List<Integer> listR = t.opIntSeq(list, listH); - test(listH.value.equals(listR)); - test(listH.value.equals(list)); - } - - { - final Long[] seq = { new Long(0), new Long(1), new Long(2), new Long(3) }; - ArrayList<Long> list = new ArrayList<Long>(Arrays.asList(seq)); - LongSeqHolder listH = new LongSeqHolder(); - List<Long> listR = t.opLongSeq(list, listH); - test(listH.value.equals(listR)); - test(listH.value.equals(list)); - } - - { - final Float[] seq = { new Float(0), new Float(1), new Float(2), new Float(3) }; - ArrayList<Float> list = new ArrayList<Float>(Arrays.asList(seq)); - FloatSeqHolder listH = new FloatSeqHolder(); - List<Float> listR = t.opFloatSeq(list, listH); - test(listH.value.equals(listR)); - test(listH.value.equals(list)); - } - - { - final Double[] seq = { new Double(0), new Double(1), new Double(2), new Double(3) }; - ArrayList<Double> list = new ArrayList<Double>(Arrays.asList(seq)); - DoubleSeqHolder listH = new DoubleSeqHolder(); - List<Double> listR = t.opDoubleSeq(list, listH); - test(listH.value.equals(listR)); - test(listH.value.equals(list)); - } - - { - final String[] seq = { "0", "1", "2", "3", "4" }; - ArrayList<String> list = new ArrayList<String>(Arrays.asList(seq)); - StringSeqHolder listH = new StringSeqHolder(); - List<String> listR = t.opStringSeq(list, listH); - test(listH.value.equals(listR)); - test(listH.value.equals(list)); - } - - { - final E[] seq = { E.E1, E.E2, E.E3 }; - ArrayList<E> list = new ArrayList<E>(Arrays.asList(seq)); - ESeqHolder listH = new ESeqHolder(); - List<E> listR = t.opESeq(list, listH); - test(listH.value.equals(listR)); - test(listH.value.equals(list)); - } - - { - S[] seq = new S[5]; - for(int i = 0; i < seq.length; i++) - { - seq[i] = new S(); - seq[i].en = E.convert(i % 3); - } - ArrayList<S> list = new ArrayList<S>(Arrays.asList(seq)); - SSeqHolder listH = new SSeqHolder(); - List<S> listR = t.opSSeq(list, listH); - test(listH.value.equals(listR)); - test(listH.value.equals(list)); - } - - { - ArrayList<Map<Integer, String>> list = new ArrayList<Map<Integer, String>>(); - for(int i = 0; i < 5; i++) - { - Map<Integer, String> m = new HashMap<Integer, String>(); - for(int j = 0; j < 4; j++) - { - m.put(j, "" + j); - } - list.add(m); - } - DSeqHolder listH = new DSeqHolder(); - List<Map<Integer, String>> listR = t.opDSeq(list, listH); - test(listH.value.equals(listR)); - test(listH.value.equals(list)); - } - - { - List<List<String>> seq = new LinkedList<List<String>>(); - for(int i = 0; i < 5; i++) - { - final String[] arr = { "0", "1", "2", "3", "4" }; - seq.add(new ArrayList<String>(Arrays.asList(arr))); - } - StringSeqSeqHolder listH = new StringSeqSeqHolder(); - List<List<String>> listR = t.opStringSeqSeq(seq, listH); - test(listH.value.equals(listR)); - test(listH.value.equals(seq)); - } - - System.out.println("ok"); - - return t; + System.out.print("testing stringToProxy... "); + System.out.flush(); + String ref = "test:default -p 12010 -t 10000"; + Ice.ObjectPrx obj = communicator.stringToProxy(ref); + test(obj != null); + System.out.println("ok"); + + System.out.print("testing checked cast... "); + System.out.flush(); + TestIntfPrx t = TestIntfPrxHelper.checkedCast(obj); + test(t != null); + test(t.equals(obj)); + System.out.println("ok"); + + System.out.print("testing custom sequences... "); + System.out.flush(); + + { + // + // Create a sequence of C instances, where elements 1..n simply point to element 0. + // + C[] seq = new C[5]; + seq[0] = new C(); + for(int i = 1; i < seq.length; i++) + { + seq[i] = seq[0]; + } + + // + // Invoke each operation and verify that the returned sequences have the same + // structure as the original. + // + CSeqHolder seqH = new CSeqHolder(); + C[] seqR = t.opCSeq(seq, seqH); + test(seqR.length == seq.length); + test(seqH.value.length == seq.length); + for(int i = 1; i < seq.length; i++) + { + test(seqR[i] != null); + test(seqR[i] == seqR[0]); + test(seqR[i] == seqH.value[i]); + } + + ArrayList<C> arr = new ArrayList<C>(Arrays.asList(seq)); + CArrayHolder arrH = new CArrayHolder(); + List<C> arrR = t.opCArray(arr, arrH); + test(arrR.size() == arr.size()); + test(arrH.value.size() == arr.size()); + for(int i = 1; i < arr.size(); i++) + { + test(arrR.get(i) != null); + test(arrR.get(i) == arrR.get(0)); + test(arrR.get(i) == arrH.value.get(i)); + } + + LinkedList<C> list = new LinkedList<C>(Arrays.asList(seq)); + CListHolder listH = new CListHolder(); + List<C> listR = t.opCList(list, listH); + test(listR.size() == list.size()); + test(listH.value.size() == list.size()); + for(int i = 1; i < list.size(); i++) + { + test(listR.get(i) != null); + test(listR.get(i) == listR.get(0)); + test(listR.get(i) == listH.value.get(i)); + } + } + + { + final Boolean[] seq = { Boolean.TRUE, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, Boolean.TRUE }; + ArrayList<Boolean> list = new ArrayList<Boolean>(Arrays.asList(seq)); + BoolSeqHolder listH = new BoolSeqHolder(); + List<Boolean> listR = t.opBoolSeq(list, listH); + test(listH.value.equals(listR)); + test(listH.value.equals(list)); + } + + { + final Byte[] seq = { new Byte((byte)0), new Byte((byte)1), new Byte((byte)2), new Byte((byte)3) }; + ArrayList<Byte> list = new ArrayList<Byte>(Arrays.asList(seq)); + ByteSeqHolder listH = new ByteSeqHolder(); + List<Byte> listR = t.opByteSeq(list, listH); + test(listH.value.equals(listR)); + test(listH.value.equals(list)); + } + + { + final Short[] seq = { new Short((short)0), new Short((short)1), new Short((short)2), new Short((short)3) }; + ArrayList<Short> list = new ArrayList<Short>(Arrays.asList(seq)); + ShortSeqHolder listH = new ShortSeqHolder(); + List<Short> listR = t.opShortSeq(list, listH); + test(listH.value.equals(listR)); + test(listH.value.equals(list)); + } + + { + final Integer[] seq = { new Integer(0), new Integer(1), new Integer(2), new Integer(3) }; + ArrayList<Integer> list = new ArrayList<Integer>(Arrays.asList(seq)); + IntSeqHolder listH = new IntSeqHolder(); + List<Integer> listR = t.opIntSeq(list, listH); + test(listH.value.equals(listR)); + test(listH.value.equals(list)); + } + + { + final Long[] seq = { new Long(0), new Long(1), new Long(2), new Long(3) }; + ArrayList<Long> list = new ArrayList<Long>(Arrays.asList(seq)); + LongSeqHolder listH = new LongSeqHolder(); + List<Long> listR = t.opLongSeq(list, listH); + test(listH.value.equals(listR)); + test(listH.value.equals(list)); + } + + { + final Float[] seq = { new Float(0), new Float(1), new Float(2), new Float(3) }; + ArrayList<Float> list = new ArrayList<Float>(Arrays.asList(seq)); + FloatSeqHolder listH = new FloatSeqHolder(); + List<Float> listR = t.opFloatSeq(list, listH); + test(listH.value.equals(listR)); + test(listH.value.equals(list)); + } + + { + final Double[] seq = { new Double(0), new Double(1), new Double(2), new Double(3) }; + ArrayList<Double> list = new ArrayList<Double>(Arrays.asList(seq)); + DoubleSeqHolder listH = new DoubleSeqHolder(); + List<Double> listR = t.opDoubleSeq(list, listH); + test(listH.value.equals(listR)); + test(listH.value.equals(list)); + } + + { + final String[] seq = { "0", "1", "2", "3", "4" }; + ArrayList<String> list = new ArrayList<String>(Arrays.asList(seq)); + StringSeqHolder listH = new StringSeqHolder(); + List<String> listR = t.opStringSeq(list, listH); + test(listH.value.equals(listR)); + test(listH.value.equals(list)); + } + + { + final E[] seq = { E.E1, E.E2, E.E3 }; + ArrayList<E> list = new ArrayList<E>(Arrays.asList(seq)); + ESeqHolder listH = new ESeqHolder(); + List<E> listR = t.opESeq(list, listH); + test(listH.value.equals(listR)); + test(listH.value.equals(list)); + } + + { + S[] seq = new S[5]; + for(int i = 0; i < seq.length; i++) + { + seq[i] = new S(); + seq[i].en = E.convert(i % 3); + } + ArrayList<S> list = new ArrayList<S>(Arrays.asList(seq)); + SSeqHolder listH = new SSeqHolder(); + List<S> listR = t.opSSeq(list, listH); + test(listH.value.equals(listR)); + test(listH.value.equals(list)); + } + + { + ArrayList<Map<Integer, String>> list = new ArrayList<Map<Integer, String>>(); + for(int i = 0; i < 5; i++) + { + Map<Integer, String> m = new HashMap<Integer, String>(); + for(int j = 0; j < 4; j++) + { + m.put(j, "" + j); + } + list.add(m); + } + DSeqHolder listH = new DSeqHolder(); + List<Map<Integer, String>> listR = t.opDSeq(list, listH); + test(listH.value.equals(listR)); + test(listH.value.equals(list)); + } + + { + List<List<String>> seq = new LinkedList<List<String>>(); + for(int i = 0; i < 5; i++) + { + final String[] arr = { "0", "1", "2", "3", "4" }; + seq.add(new ArrayList<String>(Arrays.asList(arr))); + } + StringSeqSeqHolder listH = new StringSeqSeqHolder(); + List<List<String>> listR = t.opStringSeqSeq(seq, listH); + test(listH.value.equals(listR)); + test(listH.value.equals(seq)); + } + + System.out.println("ok"); + + return t; } } diff --git a/java/test/Ice/exceptions/AllTests.java b/java/test/Ice/exceptions/AllTests.java index b463836d80a..60a2e2a8652 100644 --- a/java/test/Ice/exceptions/AllTests.java +++ b/java/test/Ice/exceptions/AllTests.java @@ -22,801 +22,801 @@ public class AllTests private static class Callback { - Callback() - { - _called = false; - } - - public synchronized boolean - check() - { - while(!_called) - { - try - { - wait(5000); - } - catch(InterruptedException ex) - { - continue; - } - - if(!_called) - { - return false; // Must be timeout. - } - } - - _called = false; - return true; - } - - public synchronized void - called() - { - assert(!_called); - _called = true; - notify(); - } - - private boolean _called; + Callback() + { + _called = false; + } + + public synchronized boolean + check() + { + while(!_called) + { + try + { + wait(5000); + } + catch(InterruptedException ex) + { + continue; + } + + if(!_called) + { + return false; // Must be timeout. + } + } + + _called = false; + return true; + } + + public synchronized void + called() + { + assert(!_called); + _called = true; + notify(); + } + + private boolean _called; } private static class AMI_Thrower_throwAasAI extends AMI_Thrower_throwAasA { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(A ex) - { - test(ex.aMem == 1); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + exc.printStackTrace(); + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(A ex) + { + test(ex.aMem == 1); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwAasAObjectNotExistI extends AMI_Thrower_throwAasA { AMI_Thrower_throwAasAObjectNotExistI(Ice.Communicator communicator) - { - _communicator = communicator; - } - - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.ObjectNotExistException ex) - { - Ice.Identity id = _communicator.stringToIdentity("does not exist"); - test(ex.id.equals(id)); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public void - ice_exception(Ice.UserException exc) - { - exc.printStackTrace(); - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - private Ice.Communicator _communicator; + { + _communicator = communicator; + } + + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + try + { + throw exc; + } + catch(Ice.ObjectNotExistException ex) + { + Ice.Identity id = _communicator.stringToIdentity("does not exist"); + test(ex.id.equals(id)); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public void + ice_exception(Ice.UserException exc) + { + exc.printStackTrace(); + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); + private Ice.Communicator _communicator; } private static class AMI_Thrower_throwAasAFacetNotExistI extends AMI_Thrower_throwAasA { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.FacetNotExistException ex) - { - test(ex.facet.equals("no such facet")); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public void - ice_exception(Ice.UserException exc) - { - exc.printStackTrace(); - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + try + { + throw exc; + } + catch(Ice.FacetNotExistException ex) + { + test(ex.facet.equals("no such facet")); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public void + ice_exception(Ice.UserException exc) + { + exc.printStackTrace(); + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwAorDasAorDI extends AMI_Thrower_throwAorDasAorD { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(A ex) - { - test(ex.aMem == 1); - } - catch(D ex) - { - test(ex.dMem == -1); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + exc.printStackTrace(); + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(A ex) + { + test(ex.aMem == 1); + } + catch(D ex) + { + test(ex.dMem == -1); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwBasAI extends AMI_Thrower_throwBasA { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(B ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + exc.printStackTrace(); + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(B ex) + { + test(ex.aMem == 1); + test(ex.bMem == 2); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwCasAI extends AMI_Thrower_throwCasA { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(C ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - test(ex.cMem == 3); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + exc.printStackTrace(); + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(C ex) + { + test(ex.aMem == 1); + test(ex.bMem == 2); + test(ex.cMem == 3); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwBasBI extends AMI_Thrower_throwBasB { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(B ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + exc.printStackTrace(); + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(B ex) + { + test(ex.aMem == 1); + test(ex.bMem == 2); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwCasBI extends AMI_Thrower_throwCasB { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(C ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - test(ex.cMem == 3); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + exc.printStackTrace(); + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(C ex) + { + test(ex.aMem == 1); + test(ex.bMem == 2); + test(ex.cMem == 3); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwCasCI extends AMI_Thrower_throwCasC { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(C ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - test(ex.cMem == 3); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + exc.printStackTrace(); + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(C ex) + { + test(ex.aMem == 1); + test(ex.bMem == 2); + test(ex.cMem == 3); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwUndeclaredAI extends AMI_Thrower_throwUndeclaredA { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.UnknownUserException ex) - { - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + try + { + throw exc; + } + catch(Ice.UnknownUserException ex) + { + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwUndeclaredBI extends AMI_Thrower_throwUndeclaredB { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.UnknownUserException ex) - { - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + try + { + throw exc; + } + catch(Ice.UnknownUserException ex) + { + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwUndeclaredCI extends AMI_Thrower_throwUndeclaredC { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.UnknownUserException ex) - { - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + try + { + throw exc; + } + catch(Ice.UnknownUserException ex) + { + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwLocalExceptionI extends AMI_Thrower_throwLocalException { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.UnknownLocalException ex) - { - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + try + { + throw exc; + } + catch(Ice.UnknownLocalException ex) + { + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwNonIceExceptionI extends AMI_Thrower_throwNonIceException { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.UnknownException ex) - { - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + try + { + throw exc; + } + catch(Ice.UnknownException ex) + { + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Thrower_throwAssertExceptionI extends AMI_Thrower_throwAssertException { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.ConnectionLostException ex) - { - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + try + { + throw exc; + } + catch(Ice.ConnectionLostException ex) + { + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_WrongOperation_noSuchOperationI extends AMI_WrongOperation_noSuchOperation { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.OperationNotExistException ex) - { - test(ex.operation.equals("noSuchOperation")); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + try + { + throw exc; + } + catch(Ice.OperationNotExistException ex) + { + test(ex.operation.equals("noSuchOperation")); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } public static ThrowerPrx allTests(Ice.Communicator communicator, boolean collocated) { - { - System.out.print("testing object adapter registration exceptions... "); - Ice.ObjectAdapter first; - try - { - first = communicator.createObjectAdapter("TestAdapter0"); - } - catch(Ice.InitializationException ex) - { - // Expected - } - - communicator.getProperties().setProperty("Ice.OA.TestAdapter0.Endpoints", "default"); - first = communicator.createObjectAdapter("TestAdapter0"); - try - { - Ice.ObjectAdapter second = communicator.createObjectAdapter("TestAdapter0"); - test(false); - } - catch(Ice.AlreadyRegisteredException ex) - { - // Expected - } - - try - { - Ice.ObjectAdapter second = - communicator.createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12011 -t 10000"); - test(false); - } - catch(Ice.AlreadyRegisteredException ex) - { - // Expected - } - test(communicator.getProperties().getProperty("Ice.OA.TestAdapter0.Endpoints").equals("default")); - first.deactivate(); - System.out.println("ok"); - } - - { - System.out.print("testing servant registration exceptions... "); - communicator.getProperties().setProperty("Ice.OA.TestAdapter1.Endpoints", "default"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter1"); - Ice.Object obj = new EmptyI(); - adapter.add(obj, communicator.stringToIdentity("x")); - try - { - adapter.add(obj, communicator.stringToIdentity("x")); - test(false); - } - catch(Ice.AlreadyRegisteredException ex) - { - } - - adapter.remove(communicator.stringToIdentity("x")); - try - { - adapter.remove(communicator.stringToIdentity("x")); - test(false); - } - catch(Ice.NotRegisteredException ex) - { - } - adapter.deactivate(); - System.out.println("ok"); - } - - { - System.out.print("testing servant locator registration exceptions... "); - communicator.getProperties().setProperty("Ice.OA.TestAdapter2.Endpoints", "default"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter2"); - Ice.ServantLocator loc = new ServantLocatorI(); - adapter.addServantLocator(loc, "x"); - try - { - adapter.addServantLocator(loc, "x"); - test(false); - } - catch(Ice.AlreadyRegisteredException ex) - { - } - - adapter.deactivate(); - System.out.println("ok"); - } - - { - System.out.print("testing object factory registration exception... "); - Ice.ObjectFactory of = new ObjectFactoryI(); - communicator.addObjectFactory(of, "::x"); - try - { - communicator.addObjectFactory(of, "::x"); - test(false); - } - catch(Ice.AlreadyRegisteredException ex) - { - } - System.out.println("ok"); - } + { + System.out.print("testing object adapter registration exceptions... "); + Ice.ObjectAdapter first; + try + { + first = communicator.createObjectAdapter("TestAdapter0"); + } + catch(Ice.InitializationException ex) + { + // Expected + } + + communicator.getProperties().setProperty("Ice.OA.TestAdapter0.Endpoints", "default"); + first = communicator.createObjectAdapter("TestAdapter0"); + try + { + Ice.ObjectAdapter second = communicator.createObjectAdapter("TestAdapter0"); + test(false); + } + catch(Ice.AlreadyRegisteredException ex) + { + // Expected + } + + try + { + Ice.ObjectAdapter second = + communicator.createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12011 -t 10000"); + test(false); + } + catch(Ice.AlreadyRegisteredException ex) + { + // Expected + } + test(communicator.getProperties().getProperty("Ice.OA.TestAdapter0.Endpoints").equals("default")); + first.deactivate(); + System.out.println("ok"); + } + + { + System.out.print("testing servant registration exceptions... "); + communicator.getProperties().setProperty("Ice.OA.TestAdapter1.Endpoints", "default"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter1"); + Ice.Object obj = new EmptyI(); + adapter.add(obj, communicator.stringToIdentity("x")); + try + { + adapter.add(obj, communicator.stringToIdentity("x")); + test(false); + } + catch(Ice.AlreadyRegisteredException ex) + { + } + + adapter.remove(communicator.stringToIdentity("x")); + try + { + adapter.remove(communicator.stringToIdentity("x")); + test(false); + } + catch(Ice.NotRegisteredException ex) + { + } + adapter.deactivate(); + System.out.println("ok"); + } + + { + System.out.print("testing servant locator registration exceptions... "); + communicator.getProperties().setProperty("Ice.OA.TestAdapter2.Endpoints", "default"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter2"); + Ice.ServantLocator loc = new ServantLocatorI(); + adapter.addServantLocator(loc, "x"); + try + { + adapter.addServantLocator(loc, "x"); + test(false); + } + catch(Ice.AlreadyRegisteredException ex) + { + } + + adapter.deactivate(); + System.out.println("ok"); + } + + { + System.out.print("testing object factory registration exception... "); + Ice.ObjectFactory of = new ObjectFactoryI(); + communicator.addObjectFactory(of, "::x"); + try + { + communicator.addObjectFactory(of, "::x"); + test(false); + } + catch(Ice.AlreadyRegisteredException ex) + { + } + System.out.println("ok"); + } System.out.print("testing stringToProxy... "); System.out.flush(); @@ -846,7 +846,7 @@ public class AllTests } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -861,7 +861,7 @@ public class AllTests } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -876,7 +876,7 @@ public class AllTests } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -892,7 +892,7 @@ public class AllTests } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -909,7 +909,7 @@ public class AllTests } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -929,7 +929,7 @@ public class AllTests } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -945,14 +945,14 @@ public class AllTests } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } System.out.println("ok"); - System.out.print("catching derived types... "); - System.out.flush(); + System.out.print("catching derived types... "); + System.out.flush(); try { @@ -966,7 +966,7 @@ public class AllTests } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -983,7 +983,7 @@ public class AllTests } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -1000,134 +1000,134 @@ public class AllTests } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } System.out.println("ok"); - if(thrower.supportsUndeclaredExceptions()) - { - test(!collocated); - - System.out.print("catching unknown user exception... "); - System.out.flush(); - - try - { - thrower.throwUndeclaredA(1); - test(false); - } - catch(Ice.UnknownUserException ex) - { - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - - try - { - thrower.throwUndeclaredB(1, 2); - test(false); - } - catch(Ice.UnknownUserException ex) - { - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - - try - { - thrower.throwUndeclaredC(1, 2, 3); - test(false); - } - catch(Ice.UnknownUserException ex) - { - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - - System.out.println("ok"); - } - - if(thrower.supportsAssertException()) - { - System.out.print("testing assert in the server... "); - System.out.flush(); - - try - { - thrower.throwAssertException(); - test(false); - } - catch(java.lang.AssertionError ex) - { - assert(collocated); - } - catch(Ice.ConnectionLostException ex) - { - assert(!collocated); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - - System.out.println("ok"); - } - - System.out.print("catching object not exist exception... "); - System.out.flush(); - - { - Ice.Identity id = communicator.stringToIdentity("does not exist"); - try - { - ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id)); - thrower2.ice_ping(); - test(false); - } - catch(Ice.ObjectNotExistException ex) - { - test(ex.id.equals(id)); - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - } + if(thrower.supportsUndeclaredExceptions()) + { + test(!collocated); + + System.out.print("catching unknown user exception... "); + System.out.flush(); + + try + { + thrower.throwUndeclaredA(1); + test(false); + } + catch(Ice.UnknownUserException ex) + { + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + + try + { + thrower.throwUndeclaredB(1, 2); + test(false); + } + catch(Ice.UnknownUserException ex) + { + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + + try + { + thrower.throwUndeclaredC(1, 2, 3); + test(false); + } + catch(Ice.UnknownUserException ex) + { + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + + System.out.println("ok"); + } + + if(thrower.supportsAssertException()) + { + System.out.print("testing assert in the server... "); + System.out.flush(); + + try + { + thrower.throwAssertException(); + test(false); + } + catch(java.lang.AssertionError ex) + { + assert(collocated); + } + catch(Ice.ConnectionLostException ex) + { + assert(!collocated); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + + System.out.println("ok"); + } + + System.out.print("catching object not exist exception... "); + System.out.flush(); + + { + Ice.Identity id = communicator.stringToIdentity("does not exist"); + try + { + ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id)); + thrower2.ice_ping(); + test(false); + } + catch(Ice.ObjectNotExistException ex) + { + test(ex.id.equals(id)); + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + } System.out.println("ok"); System.out.print("catching facet not exist exception... "); System.out.flush(); - try - { - ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower, "no such facet"); - try - { - thrower2.ice_ping(); - test(false); - } - catch(Ice.FacetNotExistException ex) - { - test(ex.facet.equals("no such facet")); - } - } + try + { + ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower, "no such facet"); + try + { + thrower2.ice_ping(); + test(false); + } + catch(Ice.FacetNotExistException ex) + { + test(ex.facet.equals("no such facet")); + } + } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -1138,17 +1138,17 @@ public class AllTests try { - WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower); - thrower2.noSuchOperation(); - test(false); + WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower); + thrower2.noSuchOperation(); + test(false); } catch(Ice.OperationNotExistException ex) { - test(ex.operation.equals("noSuchOperation")); + test(ex.operation.equals("noSuchOperation")); } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -1164,23 +1164,23 @@ public class AllTests } catch(Ice.TimeoutException ex) { - // - // We get the original exception with collocation - // optimization. - // - test(collocated); - } + // + // We get the original exception with collocation + // optimization. + // + test(collocated); + } catch(Ice.UnknownLocalException ex) { - // - // We get an unknown local exception without collocation - // optimization. - // - test(!collocated); - } + // + // We get an unknown local exception without collocation + // optimization. + // + test(!collocated); + } catch(Exception ex) { - ex.printStackTrace(); + ex.printStackTrace(); test(false); } @@ -1196,192 +1196,192 @@ public class AllTests } catch(Ice.UnknownException ex) { - // - // We get the an unknown exception without collocation - // optimization. - // - test(!collocated); + // + // We get the an unknown exception without collocation + // optimization. + // + test(!collocated); } catch(RuntimeException ex) { - // - // We get the original exception with collocation - // optimization. - // - test(collocated); + // + // We get the original exception with collocation + // optimization. + // + test(collocated); } System.out.println("ok"); - if(!collocated) - { - System.out.print("catching exact types with AMI... "); - System.out.flush(); - - { - AMI_Thrower_throwAasAI cb = new AMI_Thrower_throwAasAI(); - thrower.throwAasA_async(cb, 1); - test(cb.check()); - // Let's check if we can reuse the same callback object for another call. - thrower.throwAasA_async(cb, 1); - test(cb.check()); - } - - { - AMI_Thrower_throwAorDasAorDI cb = new AMI_Thrower_throwAorDasAorDI(); - thrower.throwAorDasAorD_async(cb, 1); - test(cb.check()); - } - - { - AMI_Thrower_throwAorDasAorDI cb = new AMI_Thrower_throwAorDasAorDI(); - thrower.throwAorDasAorD_async(cb, -1); - test(cb.check()); - } - - { - AMI_Thrower_throwBasBI cb = new AMI_Thrower_throwBasBI(); - thrower.throwBasB_async(cb, 1, 2); - test(cb.check()); - } - - { - AMI_Thrower_throwCasCI cb = new AMI_Thrower_throwCasCI(); - thrower.throwCasC_async(cb, 1, 2, 3); - test(cb.check()); - // Let's check if we can reuse the same callback object for another call. - thrower.throwCasC_async(cb, 1, 2, 3); - test(cb.check()); - } - - System.out.println("ok"); - + if(!collocated) + { + System.out.print("catching exact types with AMI... "); + System.out.flush(); + + { + AMI_Thrower_throwAasAI cb = new AMI_Thrower_throwAasAI(); + thrower.throwAasA_async(cb, 1); + test(cb.check()); + // Let's check if we can reuse the same callback object for another call. + thrower.throwAasA_async(cb, 1); + test(cb.check()); + } + + { + AMI_Thrower_throwAorDasAorDI cb = new AMI_Thrower_throwAorDasAorDI(); + thrower.throwAorDasAorD_async(cb, 1); + test(cb.check()); + } + + { + AMI_Thrower_throwAorDasAorDI cb = new AMI_Thrower_throwAorDasAorDI(); + thrower.throwAorDasAorD_async(cb, -1); + test(cb.check()); + } + + { + AMI_Thrower_throwBasBI cb = new AMI_Thrower_throwBasBI(); + thrower.throwBasB_async(cb, 1, 2); + test(cb.check()); + } + + { + AMI_Thrower_throwCasCI cb = new AMI_Thrower_throwCasCI(); + thrower.throwCasC_async(cb, 1, 2, 3); + test(cb.check()); + // Let's check if we can reuse the same callback object for another call. + thrower.throwCasC_async(cb, 1, 2, 3); + test(cb.check()); + } + + System.out.println("ok"); + System.out.print("catching derived types with AMI... "); System.out.flush(); - - { - AMI_Thrower_throwBasAI cb = new AMI_Thrower_throwBasAI(); - thrower.throwBasA_async(cb, 1, 2); - test(cb.check()); - } - - { - AMI_Thrower_throwCasAI cb = new AMI_Thrower_throwCasAI(); - thrower.throwCasA_async(cb, 1, 2, 3); - test(cb.check()); - } - - { - AMI_Thrower_throwCasBI cb = new AMI_Thrower_throwCasBI(); - thrower.throwCasB_async(cb, 1, 2, 3); - test(cb.check()); - } - - System.out.println("ok"); - - if(thrower.supportsUndeclaredExceptions()) - { - System.out.print("catching unknown user exception with AMI... "); - System.out.flush(); - - { - AMI_Thrower_throwUndeclaredAI cb = new AMI_Thrower_throwUndeclaredAI(); - thrower.throwUndeclaredA_async(cb, 1); - test(cb.check()); - } - - { - AMI_Thrower_throwUndeclaredBI cb = new AMI_Thrower_throwUndeclaredBI(); - thrower.throwUndeclaredB_async(cb, 1, 2); - test(cb.check()); - } - - { - AMI_Thrower_throwUndeclaredCI cb = new AMI_Thrower_throwUndeclaredCI(); - thrower.throwUndeclaredC_async(cb, 1, 2, 3); - test(cb.check()); - } - - System.out.println("ok"); - } - - if(thrower.supportsAssertException()) - { - System.out.print("testing assert in the server with AMI... "); - System.out.flush(); - - AMI_Thrower_throwAssertExceptionI cb = new AMI_Thrower_throwAssertExceptionI(); - thrower.throwAssertException_async(cb); - test(cb.check()); - - System.out.println("ok"); - } - - System.out.print("catching object not exist exception with AMI... "); - System.out.flush(); - - { - Ice.Identity id = communicator.stringToIdentity("does not exist"); - ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id)); - AMI_Thrower_throwAasAObjectNotExistI cb = new AMI_Thrower_throwAasAObjectNotExistI(communicator); - thrower2.throwAasA_async(cb, 1); - test(cb.check()); - } - - System.out.println("ok"); - - System.out.print("catching facet not exist exception with AMI... "); - System.out.flush(); - - try - { - ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower, "no such facet"); - { - AMI_Thrower_throwAasAFacetNotExistI cb = new AMI_Thrower_throwAasAFacetNotExistI(); - thrower2.throwAasA_async(cb, 1); - test(cb.check()); - } - } - catch(Exception ex) - { - ex.printStackTrace(); - test(false); - } - - System.out.println("ok"); - - System.out.print("catching operation not exist exception with AMI... "); - System.out.flush(); - - { - AMI_WrongOperation_noSuchOperationI cb = new AMI_WrongOperation_noSuchOperationI(); - WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower); - thrower2.noSuchOperation_async(cb); - test(cb.check()); - } - - System.out.println("ok"); + + { + AMI_Thrower_throwBasAI cb = new AMI_Thrower_throwBasAI(); + thrower.throwBasA_async(cb, 1, 2); + test(cb.check()); + } + + { + AMI_Thrower_throwCasAI cb = new AMI_Thrower_throwCasAI(); + thrower.throwCasA_async(cb, 1, 2, 3); + test(cb.check()); + } + + { + AMI_Thrower_throwCasBI cb = new AMI_Thrower_throwCasBI(); + thrower.throwCasB_async(cb, 1, 2, 3); + test(cb.check()); + } + + System.out.println("ok"); + + if(thrower.supportsUndeclaredExceptions()) + { + System.out.print("catching unknown user exception with AMI... "); + System.out.flush(); + + { + AMI_Thrower_throwUndeclaredAI cb = new AMI_Thrower_throwUndeclaredAI(); + thrower.throwUndeclaredA_async(cb, 1); + test(cb.check()); + } + + { + AMI_Thrower_throwUndeclaredBI cb = new AMI_Thrower_throwUndeclaredBI(); + thrower.throwUndeclaredB_async(cb, 1, 2); + test(cb.check()); + } + + { + AMI_Thrower_throwUndeclaredCI cb = new AMI_Thrower_throwUndeclaredCI(); + thrower.throwUndeclaredC_async(cb, 1, 2, 3); + test(cb.check()); + } + + System.out.println("ok"); + } + + if(thrower.supportsAssertException()) + { + System.out.print("testing assert in the server with AMI... "); + System.out.flush(); + + AMI_Thrower_throwAssertExceptionI cb = new AMI_Thrower_throwAssertExceptionI(); + thrower.throwAssertException_async(cb); + test(cb.check()); + + System.out.println("ok"); + } + + System.out.print("catching object not exist exception with AMI... "); + System.out.flush(); + + { + Ice.Identity id = communicator.stringToIdentity("does not exist"); + ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id)); + AMI_Thrower_throwAasAObjectNotExistI cb = new AMI_Thrower_throwAasAObjectNotExistI(communicator); + thrower2.throwAasA_async(cb, 1); + test(cb.check()); + } + + System.out.println("ok"); + + System.out.print("catching facet not exist exception with AMI... "); + System.out.flush(); + + try + { + ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower, "no such facet"); + { + AMI_Thrower_throwAasAFacetNotExistI cb = new AMI_Thrower_throwAasAFacetNotExistI(); + thrower2.throwAasA_async(cb, 1); + test(cb.check()); + } + } + catch(Exception ex) + { + ex.printStackTrace(); + test(false); + } + + System.out.println("ok"); + + System.out.print("catching operation not exist exception with AMI... "); + System.out.flush(); + + { + AMI_WrongOperation_noSuchOperationI cb = new AMI_WrongOperation_noSuchOperationI(); + WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower); + thrower2.noSuchOperation_async(cb); + test(cb.check()); + } + + System.out.println("ok"); - System.out.print("catching unknown local exception with AMI... "); - System.out.flush(); - - { - AMI_Thrower_throwLocalExceptionI cb = new AMI_Thrower_throwLocalExceptionI(); - thrower.throwLocalException_async(cb); - test(cb.check()); - } - - System.out.println("ok"); - - System.out.print("catching unknown non-Ice exception with AMI... "); - System.out.flush(); - - AMI_Thrower_throwNonIceExceptionI cb = new AMI_Thrower_throwNonIceExceptionI(); - thrower.throwNonIceException_async(cb); - test(cb.check()); - - System.out.println("ok"); - } + System.out.print("catching unknown local exception with AMI... "); + System.out.flush(); + + { + AMI_Thrower_throwLocalExceptionI cb = new AMI_Thrower_throwLocalExceptionI(); + thrower.throwLocalException_async(cb); + test(cb.check()); + } + + System.out.println("ok"); + + System.out.print("catching unknown non-Ice exception with AMI... "); + System.out.flush(); + + AMI_Thrower_throwNonIceExceptionI cb = new AMI_Thrower_throwNonIceExceptionI(); + thrower.throwNonIceException_async(cb); + test(cb.check()); + + System.out.println("ok"); + } return thrower; } diff --git a/java/test/Ice/exceptions/Client.java b/java/test/Ice/exceptions/Client.java index 323b6652c40..8f97b2e19c1 100644 --- a/java/test/Ice/exceptions/Client.java +++ b/java/test/Ice/exceptions/Client.java @@ -27,10 +27,10 @@ public class Client 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"); + 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); @@ -54,7 +54,7 @@ public class Client } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/exceptions/Server.java b/java/test/Ice/exceptions/Server.java index 9035ff41b9f..4c97c5e6582 100644 --- a/java/test/Ice/exceptions/Server.java +++ b/java/test/Ice/exceptions/Server.java @@ -13,7 +13,7 @@ public class Server run(String[] args, Ice.Communicator communicator) { Ice.Properties properties = communicator.getProperties(); - // We don't need to disable warnings, because we have a dummy logger. + // We don't need to disable warnings, because we have a dummy logger. //properties.setProperty("Ice.Warn.Dispatch", "0"); properties.setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000:udp"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); @@ -32,12 +32,12 @@ public class Server try { - // - // For this test, we need a dummy logger, otherwise the - // assertion test will print an error message. - // + // + // 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(); + initData.logger = new DummyLogger(); communicator = Ice.Util.initialize(args, initData); status = run(args, communicator); diff --git a/java/test/Ice/exceptionsAMD/Server.java b/java/test/Ice/exceptionsAMD/Server.java index 9aec3e28a6a..4c97c5e6582 100644 --- a/java/test/Ice/exceptionsAMD/Server.java +++ b/java/test/Ice/exceptionsAMD/Server.java @@ -13,7 +13,7 @@ public class Server run(String[] args, Ice.Communicator communicator) { Ice.Properties properties = communicator.getProperties(); - // We don't need to disable warnings, because we have a dummy logger. + // We don't need to disable warnings, because we have a dummy logger. //properties.setProperty("Ice.Warn.Dispatch", "0"); properties.setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000:udp"); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); @@ -32,12 +32,12 @@ public class Server 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(); + // + // 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); diff --git a/java/test/Ice/exceptionsAMD/ThrowerI.java b/java/test/Ice/exceptionsAMD/ThrowerI.java index 5c3bc854824..37d305179b0 100644 --- a/java/test/Ice/exceptionsAMD/ThrowerI.java +++ b/java/test/Ice/exceptionsAMD/ThrowerI.java @@ -21,7 +21,7 @@ public final class ThrowerI extends _ThrowerDisp shutdown_async(AMD_Thrower_shutdown cb, Ice.Current current) { _adapter.getCommunicator().shutdown(); - cb.ice_response(); + cb.ice_response(); } public void @@ -54,13 +54,13 @@ public final class ThrowerI extends _ThrowerDisp { A ex = new A(); ex.aMem = a; - cb.ice_exception(ex); + cb.ice_exception(ex); } else { D ex = new D(); ex.dMem = a; - cb.ice_exception(ex); + cb.ice_exception(ex); } } @@ -68,11 +68,11 @@ public final class ThrowerI extends _ThrowerDisp throwBasA_async(AMD_Thrower_throwBasA cb, int a, int b, Ice.Current current) throws A { - B ex = new B(); - ex.aMem = a; - ex.bMem = b; - throw ex; - //cb.ice_exception(ex); + B ex = new B(); + ex.aMem = a; + ex.bMem = b; + throw ex; + //cb.ice_exception(ex); } public void @@ -83,29 +83,29 @@ public final class ThrowerI extends _ThrowerDisp ex.aMem = a; ex.bMem = b; throw ex; - //cb.ice_exception(ex); + //cb.ice_exception(ex); } public void throwCasA_async(AMD_Thrower_throwCasA cb, int a, int b, int c, Ice.Current current) throws A { - C ex = new C(); - ex.aMem = a; - ex.bMem = b; - ex.cMem = c; - cb.ice_exception(ex); + C ex = new C(); + ex.aMem = a; + ex.bMem = b; + ex.cMem = c; + cb.ice_exception(ex); } public void throwCasB_async(AMD_Thrower_throwCasB cb, int a, int b, int c, Ice.Current current) throws B { - C ex = new C(); - ex.aMem = a; - ex.bMem = b; - ex.cMem = c; - cb.ice_exception(ex); + C ex = new C(); + ex.aMem = a; + ex.bMem = b; + ex.cMem = c; + cb.ice_exception(ex); } public void @@ -116,7 +116,7 @@ public final class ThrowerI extends _ThrowerDisp ex.aMem = a; ex.bMem = b; ex.cMem = c; - cb.ice_exception(ex); + cb.ice_exception(ex); } public void @@ -130,10 +130,10 @@ public final class ThrowerI extends _ThrowerDisp public void throwUndeclaredB_async(AMD_Thrower_throwUndeclaredB cb, int a, int b, Ice.Current current) { - B ex = new B(); - ex.aMem = a; - ex.bMem = b; - cb.ice_exception(ex); + B ex = new B(); + ex.aMem = a; + ex.bMem = b; + cb.ice_exception(ex); } public void diff --git a/java/test/Ice/facets/AllTests.java b/java/test/Ice/facets/AllTests.java index 4b6dda90a5c..9dc5167f89d 100644 --- a/java/test/Ice/facets/AllTests.java +++ b/java/test/Ice/facets/AllTests.java @@ -24,56 +24,56 @@ public class AllTests allTests(Ice.Communicator communicator) { System.out.print("testing facet registration exceptions... "); - communicator.getProperties().setProperty("Ice.OA.FacetExceptionTestAdapter.Endpoints", "default"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("FacetExceptionTestAdapter"); - Ice.Object obj = new EmptyI(); + communicator.getProperties().setProperty("Ice.OA.FacetExceptionTestAdapter.Endpoints", "default"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("FacetExceptionTestAdapter"); + Ice.Object obj = new EmptyI(); adapter.add(obj, communicator.stringToIdentity("d")); - adapter.addFacet(obj, communicator.stringToIdentity("d"), "facetABCD"); - try - { + adapter.addFacet(obj, communicator.stringToIdentity("d"), "facetABCD"); + try + { adapter.addFacet(obj, communicator.stringToIdentity("d"), "facetABCD"); - test(false); - } - catch(Ice.AlreadyRegisteredException ex) - { - } - adapter.removeFacet(communicator.stringToIdentity("d"), "facetABCD"); - try - { + test(false); + } + catch(Ice.AlreadyRegisteredException ex) + { + } + adapter.removeFacet(communicator.stringToIdentity("d"), "facetABCD"); + try + { adapter.removeFacet(communicator.stringToIdentity("d"), "facetABCD"); - test(false); - } - catch(Ice.NotRegisteredException ex) - { - } + test(false); + } + catch(Ice.NotRegisteredException ex) + { + } System.out.println("ok"); System.out.print("testing removeAllFacets... "); - Ice.Object obj1 = new EmptyI(); - Ice.Object obj2 = new EmptyI(); - adapter.addFacet(obj1, communicator.stringToIdentity("id1"), "f1"); - adapter.addFacet(obj2, communicator.stringToIdentity("id1"), "f2"); - Ice.Object obj3 = new EmptyI(); - adapter.addFacet(obj1, communicator.stringToIdentity("id2"), "f1"); - adapter.addFacet(obj2, communicator.stringToIdentity("id2"), "f2"); - adapter.addFacet(obj3, communicator.stringToIdentity("id2"), ""); - java.util.Map fm = adapter.removeAllFacets(communicator.stringToIdentity("id1")); - test(fm.size() == 2); - test(fm.get("f1") == obj1); - test(fm.get("f2") == obj2); - try - { + Ice.Object obj1 = new EmptyI(); + Ice.Object obj2 = new EmptyI(); + adapter.addFacet(obj1, communicator.stringToIdentity("id1"), "f1"); + adapter.addFacet(obj2, communicator.stringToIdentity("id1"), "f2"); + Ice.Object obj3 = new EmptyI(); + adapter.addFacet(obj1, communicator.stringToIdentity("id2"), "f1"); + adapter.addFacet(obj2, communicator.stringToIdentity("id2"), "f2"); + adapter.addFacet(obj3, communicator.stringToIdentity("id2"), ""); + java.util.Map fm = adapter.removeAllFacets(communicator.stringToIdentity("id1")); + test(fm.size() == 2); + test(fm.get("f1") == obj1); + test(fm.get("f2") == obj2); + try + { adapter.removeAllFacets(communicator.stringToIdentity("id1")); - test(false); - } - catch(Ice.NotRegisteredException ex) - { - } - fm = adapter.removeAllFacets(communicator.stringToIdentity("id2")); - test(fm.size() == 3); - test(fm.get("f1") == obj1); - test(fm.get("f2") == obj2); - test(fm.get("") == obj3); + test(false); + } + catch(Ice.NotRegisteredException ex) + { + } + fm = adapter.removeAllFacets(communicator.stringToIdentity("id2")); + test(fm.size() == 3); + test(fm.get("f1") == obj1); + test(fm.get("f2") == obj2); + test(fm.get("") == obj3); System.out.println("ok"); adapter.deactivate(); diff --git a/java/test/Ice/facets/Client.java b/java/test/Ice/facets/Client.java index cfce4f44101..15260b9f6b3 100644 --- a/java/test/Ice/facets/Client.java +++ b/java/test/Ice/facets/Client.java @@ -49,7 +49,7 @@ public class Client } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/facets/Collocated.java b/java/test/Ice/facets/Collocated.java index 6167eb6e412..6f5d19733b2 100644 --- a/java/test/Ice/facets/Collocated.java +++ b/java/test/Ice/facets/Collocated.java @@ -17,9 +17,9 @@ public class Collocated Ice.Object d = new DI(); adapter.add(d, communicator.stringToIdentity("d")); adapter.addFacet(d, communicator.stringToIdentity("d"), "facetABCD"); - Ice.Object f = new FI(); + Ice.Object f = new FI(); adapter.addFacet(f, communicator.stringToIdentity("d"), "facetEF"); - Ice.Object h = new HI(communicator); + Ice.Object h = new HI(communicator); adapter.addFacet(h, communicator.stringToIdentity("d"), "facetGH"); AllTests.allTests(communicator); diff --git a/java/test/Ice/facets/Server.java b/java/test/Ice/facets/Server.java index 417b196ef02..059eafcff94 100644 --- a/java/test/Ice/facets/Server.java +++ b/java/test/Ice/facets/Server.java @@ -17,9 +17,9 @@ public class Server Ice.Object d = new DI(); adapter.add(d, communicator.stringToIdentity("d")); adapter.addFacet(d, communicator.stringToIdentity("d"), "facetABCD"); - Ice.Object f = new FI(); + Ice.Object f = new FI(); adapter.addFacet(f, communicator.stringToIdentity("d"), "facetEF"); - Ice.Object h = new HI(communicator); + Ice.Object h = new HI(communicator); adapter.addFacet(h, communicator.stringToIdentity("d"), "facetGH"); adapter.activate(); @@ -58,7 +58,7 @@ public class Server } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/faultTolerance/AllTests.java b/java/test/Ice/faultTolerance/AllTests.java index 4f3eb09b2ea..937fb4aa99e 100644 --- a/java/test/Ice/faultTolerance/AllTests.java +++ b/java/test/Ice/faultTolerance/AllTests.java @@ -22,186 +22,186 @@ public class AllTests private static class Callback { - Callback() - { - _called = false; - } + Callback() + { + _called = false; + } - public synchronized boolean - check() - { - while(!_called) - { - try - { - wait(30000); - } - catch(InterruptedException ex) - { - continue; - } + public synchronized boolean + check() + { + while(!_called) + { + try + { + wait(30000); + } + catch(InterruptedException ex) + { + continue; + } - if(!_called) - { - return false; // Must be timeout. - } - } - - _called = false; - return true; - } - - public synchronized void - called() - { - assert(!_called); - _called = true; - notify(); - } + if(!_called) + { + return false; // Must be timeout. + } + } + + _called = false; + return true; + } + + public synchronized void + called() + { + assert(!_called); + _called = true; + notify(); + } - private boolean _called; + private boolean _called; } private static class AMI_Test_pidI extends AMI_TestIntf_pid { - public void - ice_response(int pid) - { - _pid = pid; - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public void - ice_exception(Ice.UserException ex) - { - test(false); - } - - public int - pid() - { - return _pid; - } - - public boolean - check() - { - return callback.check(); - } + public void + ice_response(int pid) + { + _pid = pid; + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public void + ice_exception(Ice.UserException ex) + { + test(false); + } + + public int + pid() + { + return _pid; + } + + public boolean + check() + { + return callback.check(); + } - private int _pid; - - private Callback callback = new Callback(); + private int _pid; + + private Callback callback = new Callback(); } private static class AMI_Test_shutdownI extends AMI_TestIntf_shutdown { - public void - ice_response() - { - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public void - ice_exception(Ice.UserException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } + public void + ice_response() + { + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public void + ice_exception(Ice.UserException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } - private Callback callback = new Callback(); + private Callback callback = new Callback(); } private static class AMI_Test_abortI extends AMI_TestIntf_abort { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException ex) - { - try - { - throw ex; - } - catch(Ice.ConnectionLostException exc) - { - } - catch(Ice.ConnectFailedException exc) - { - } - catch(Ice.SocketException exc) - { - } - catch(Exception exc) - { - test(false); - } - callback.called(); - } - - public void - ice_exception(Ice.UserException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException ex) + { + try + { + throw ex; + } + catch(Ice.ConnectionLostException exc) + { + } + catch(Ice.ConnectFailedException exc) + { + } + catch(Ice.SocketException exc) + { + } + catch(Exception exc) + { + test(false); + } + callback.called(); + } + + public void + ice_exception(Ice.UserException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } - private Callback callback = new Callback(); + private Callback callback = new Callback(); } private static class AMI_Test_idempotentAbortI extends AMI_TestIntf_idempotentAbort { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException ex) - { - delegate.ice_exception(ex); - } - - public void - ice_exception(Ice.UserException ex) - { - delegate.ice_exception(ex); - } - - public boolean - check() - { - return delegate.check(); - } + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException ex) + { + delegate.ice_exception(ex); + } + + public void + ice_exception(Ice.UserException ex) + { + delegate.ice_exception(ex); + } + + public boolean + check() + { + return delegate.check(); + } - private AMI_Test_abortI delegate = new AMI_Test_abortI(); + private AMI_Test_abortI delegate = new AMI_Test_abortI(); } public static void @@ -226,123 +226,123 @@ public class AllTests System.out.println("ok"); int oldPid = 0; - boolean ami = false; + boolean ami = false; for(int i = 1, j = 0; i <= ports.length; ++i, ++j) { - if(j > 3) - { - j = 0; - ami = !ami; - } + if(j > 3) + { + j = 0; + ami = !ami; + } - if(!ami) - { - System.out.print("testing server #" + i + "... "); - System.out.flush(); - int pid = obj.pid(); - test(pid != oldPid); - System.out.println("ok"); - oldPid = pid; - } - else - { - System.out.print("testing server #" + i + " with AMI... "); - System.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"); - oldPid = pid; - } + if(!ami) + { + System.out.print("testing server #" + i + "... "); + System.out.flush(); + int pid = obj.pid(); + test(pid != oldPid); + System.out.println("ok"); + oldPid = pid; + } + else + { + System.out.print("testing server #" + i + " with AMI... "); + System.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"); + oldPid = pid; + } if(j == 0) { - if(!ami) - { - System.out.print("shutting down server #" + i + "... "); - System.out.flush(); - obj.shutdown(); - System.out.println("ok"); - } - else - { - System.out.print("shutting down server #" + i + " with AMI... "); - System.out.flush(); - AMI_Test_shutdownI cb = new AMI_Test_shutdownI(); - obj.shutdown_async(cb); - test(cb.check()); - System.out.println("ok"); - } + if(!ami) + { + System.out.print("shutting down server #" + i + "... "); + System.out.flush(); + obj.shutdown(); + System.out.println("ok"); + } + else + { + System.out.print("shutting down server #" + i + " with AMI... "); + System.out.flush(); + AMI_Test_shutdownI cb = new AMI_Test_shutdownI(); + obj.shutdown_async(cb); + test(cb.check()); + System.out.println("ok"); + } } else if(j == 1 || i + 1 > ports.length) { - if(!ami) - { - System.out.print("aborting server #" + i + "... "); - System.out.flush(); - try - { - obj.abort(); - test(false); - } - catch(Ice.ConnectionLostException ex) - { - System.out.println("ok"); - } - catch(Ice.ConnectFailedException exc) - { - System.out.println("ok"); - } - catch(Ice.SocketException ex) - { - System.out.println("ok"); - } - } - else - { - System.out.print("aborting server #" + i + " with AMI... "); - System.out.flush(); - AMI_Test_abortI cb = new AMI_Test_abortI(); - obj.abort_async(cb); - test(cb.check()); - System.out.println("ok"); - } + if(!ami) + { + System.out.print("aborting server #" + i + "... "); + System.out.flush(); + try + { + obj.abort(); + test(false); + } + catch(Ice.ConnectionLostException ex) + { + System.out.println("ok"); + } + catch(Ice.ConnectFailedException exc) + { + System.out.println("ok"); + } + catch(Ice.SocketException ex) + { + System.out.println("ok"); + } + } + else + { + System.out.print("aborting server #" + i + " with AMI... "); + System.out.flush(); + AMI_Test_abortI cb = new AMI_Test_abortI(); + obj.abort_async(cb); + test(cb.check()); + System.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(); - try - { - obj.idempotentAbort(); - test(false); - } - catch(Ice.ConnectionLostException ex) - { - System.out.println("ok"); - } - catch(Ice.ConnectFailedException exc) - { - System.out.println("ok"); - } - catch(Ice.SocketException ex) - { - System.out.println("ok"); - } - } - else - { - System.out.print("aborting server #" + i + " and #" + (i + 1) + " with idempotent AMI call... "); - System.out.flush(); - AMI_Test_idempotentAbortI cb = new AMI_Test_idempotentAbortI(); - obj.idempotentAbort_async(cb); - test(cb.check()); - System.out.println("ok"); - } + if(!ami) + { + System.out.print("aborting server #" + i + " and #" + (i + 1) + " with idempotent call... "); + System.out.flush(); + try + { + obj.idempotentAbort(); + test(false); + } + catch(Ice.ConnectionLostException ex) + { + System.out.println("ok"); + } + catch(Ice.ConnectFailedException exc) + { + System.out.println("ok"); + } + catch(Ice.SocketException ex) + { + System.out.println("ok"); + } + } + else + { + System.out.print("aborting server #" + i + " and #" + (i + 1) + " with idempotent AMI call... "); + System.out.flush(); + AMI_Test_idempotentAbortI cb = new AMI_Test_idempotentAbortI(); + obj.idempotentAbort_async(cb); + test(cb.check()); + System.out.println("ok"); + } ++i; } diff --git a/java/test/Ice/faultTolerance/Client.java b/java/test/Ice/faultTolerance/Client.java index 2274a560e74..f56f3b83c40 100644 --- a/java/test/Ice/faultTolerance/Client.java +++ b/java/test/Ice/faultTolerance/Client.java @@ -59,15 +59,15 @@ public class Client arr[i] = ((Integer)ports.get(i)).intValue(); } - try - { - AllTests.allTests(communicator, arr); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - AllTests.test(false); - } + try + { + AllTests.allTests(communicator, arr); + } + catch(Ice.LocalException ex) + { + ex.printStackTrace(); + AllTests.test(false); + } return 0; } @@ -80,16 +80,16 @@ public class Client try { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + 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"); + // + // This test aborts servers, so we don't want warnings. + // + initData. properties.setProperty("Ice.Warn.Connections", "0"); - communicator = Ice.Util.initialize(argsH, initData); + communicator = Ice.Util.initialize(argsH, initData); status = run(argsH.value, communicator); } catch(Ice.LocalException ex) @@ -111,7 +111,7 @@ public class Client } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/faultTolerance/Server.java b/java/test/Ice/faultTolerance/Server.java index 0d56bfef120..f8a8841d8ec 100644 --- a/java/test/Ice/faultTolerance/Server.java +++ b/java/test/Ice/faultTolerance/Server.java @@ -71,16 +71,16 @@ public class Server 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); + // + // 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. + initData.properties.setProperty("Ice.ServerIdleTime", "120"); // Two minutes. communicator = Ice.Util.initialize(argsH, initData); status = run(argsH.value, communicator); diff --git a/java/test/Ice/faultTolerance/TestI.java b/java/test/Ice/faultTolerance/TestI.java index d740d39b509..cc5dc9d20b4 100644 --- a/java/test/Ice/faultTolerance/TestI.java +++ b/java/test/Ice/faultTolerance/TestI.java @@ -15,7 +15,7 @@ public final class TestI extends _TestIntfDisp TestI(Ice.ObjectAdapter adapter, int port) { _adapter = adapter; - _pseudoPid = port; // We use the port number instead of the process ID in Java. + _pseudoPid = port; // We use the port number instead of the process ID in Java. } public void @@ -27,13 +27,13 @@ public final class TestI extends _TestIntfDisp public void abort(Ice.Current current) { - Runtime.getRuntime().halt(0); + Runtime.getRuntime().halt(0); } public void idempotentAbort(Ice.Current current) { - Runtime.getRuntime().halt(0); + Runtime.getRuntime().halt(0); } public int diff --git a/java/test/Ice/hold/AllTests.java b/java/test/Ice/hold/AllTests.java index 7c3220296e7..38917d23efc 100644 --- a/java/test/Ice/hold/AllTests.java +++ b/java/test/Ice/hold/AllTests.java @@ -23,32 +23,32 @@ public class AllTests public static void allTests(Ice.Communicator communicator) { - System.out.print("testing stringToProxy... "); - System.out.flush(); - String ref = "hold:default -p 12010 -t 10000"; - Ice.ObjectPrx base = communicator.stringToProxy(ref); - test(base != null); - System.out.println("ok"); - - System.out.print("testing checked cast... "); - System.out.flush(); - HoldPrx hold = HoldPrxHelper.checkedCast(base); - test(hold != null); - test(hold.equals(base)); - System.out.println("ok"); - - System.out.print("changing state between active and hold rapidly... "); - System.out.flush(); - for(int i = 0; i < 100; ++i) - { - hold.putOnHold(0); - } - System.out.println("ok"); - - System.out.print("changing state to hold and shutting down server... "); - System.out.flush(); - hold.shutdown(); - System.out.println("ok"); + System.out.print("testing stringToProxy... "); + System.out.flush(); + String ref = "hold:default -p 12010 -t 10000"; + Ice.ObjectPrx base = communicator.stringToProxy(ref); + test(base != null); + System.out.println("ok"); + + System.out.print("testing checked cast... "); + System.out.flush(); + HoldPrx hold = HoldPrxHelper.checkedCast(base); + test(hold != null); + test(hold.equals(base)); + System.out.println("ok"); + + System.out.print("changing state between active and hold rapidly... "); + System.out.flush(); + for(int i = 0; i < 100; ++i) + { + hold.putOnHold(0); + } + System.out.println("ok"); + + System.out.print("changing state to hold and shutting down server... "); + System.out.flush(); + hold.shutdown(); + System.out.println("ok"); } } -
\ No newline at end of file +
\ No newline at end of file diff --git a/java/test/Ice/hold/Client.java b/java/test/Ice/hold/Client.java index 05351c33027..a74fab2127a 100644 --- a/java/test/Ice/hold/Client.java +++ b/java/test/Ice/hold/Client.java @@ -46,7 +46,7 @@ public class Client } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/hold/HoldI.java b/java/test/Ice/hold/HoldI.java index a4cacba084e..bcdb0b70f86 100644 --- a/java/test/Ice/hold/HoldI.java +++ b/java/test/Ice/hold/HoldI.java @@ -14,21 +14,21 @@ public final class HoldI extends _HoldDisp public void putOnHold(int seconds, Ice.Current current) { - if(seconds <= 0) - { - current.adapter.hold(); - current.adapter.activate(); - } - else - { - assert(false); // TODO - } + if(seconds <= 0) + { + current.adapter.hold(); + current.adapter.activate(); + } + else + { + assert(false); // TODO + } } public void shutdown(Ice.Current current) { - current.adapter.hold(); - current.adapter.getCommunicator().shutdown(); + current.adapter.hold(); + current.adapter.getCommunicator().shutdown(); } } diff --git a/java/test/Ice/hold/Server.java b/java/test/Ice/hold/Server.java index ffca24d34d8..cde9df23169 100644 --- a/java/test/Ice/hold/Server.java +++ b/java/test/Ice/hold/Server.java @@ -50,7 +50,7 @@ public class Server } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/inheritance/Client.java b/java/test/Ice/inheritance/Client.java index 6ce04625d84..92492c38d98 100644 --- a/java/test/Ice/inheritance/Client.java +++ b/java/test/Ice/inheritance/Client.java @@ -49,7 +49,7 @@ public class Client } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/inheritance/Server.java b/java/test/Ice/inheritance/Server.java index c6929930217..417a854c79f 100644 --- a/java/test/Ice/inheritance/Server.java +++ b/java/test/Ice/inheritance/Server.java @@ -51,7 +51,7 @@ public class Server } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/location/AllTests.java b/java/test/Ice/location/AllTests.java index a73a8a6a2e2..9918e8e11cd 100644 --- a/java/test/Ice/location/AllTests.java +++ b/java/test/Ice/location/AllTests.java @@ -23,335 +23,335 @@ public class AllTests public static void allTests(Ice.Communicator communicator) { - ServerManagerPrx manager = ServerManagerPrxHelper.checkedCast( - communicator.stringToProxy("ServerManager :default -t 10000 -p 12010")); - test(manager != null); - TestLocatorPrx locator = TestLocatorPrxHelper.uncheckedCast(communicator.getDefaultLocator()); - test(locator != null); + ServerManagerPrx manager = ServerManagerPrxHelper.checkedCast( + communicator.stringToProxy("ServerManager :default -t 10000 -p 12010")); + test(manager != null); + TestLocatorPrx locator = TestLocatorPrxHelper.uncheckedCast(communicator.getDefaultLocator()); + test(locator != null); - System.out.print("testing stringToProxy... "); + 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"); + 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"); - System.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")); - base = base.ice_locator(anotherLocator); - test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), anotherLocator) == 0); - communicator.setDefaultLocator(null); - base = communicator.stringToProxy("test @ TestAdapter"); - test(base.ice_getLocator() == null); - base = base.ice_locator(anotherLocator); - test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), anotherLocator) == 0); - communicator.setDefaultLocator(locator); - base = communicator.stringToProxy("test @ TestAdapter"); - test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), communicator.getDefaultLocator()) == 0); - - // - // We also test ice_router/ice_getRouter (perhaps we should add a - // test/Ice/router test?) - // - test(base.ice_getRouter() == null); - Ice.RouterPrx anotherRouter = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("anotherRouter")); - base = base.ice_router(anotherRouter); - test(Ice.Util.proxyIdentityCompare(base.ice_getRouter(), anotherRouter) == 0); - Ice.RouterPrx router = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("dummyrouter")); - communicator.setDefaultRouter(router); - base = communicator.stringToProxy("test @ TestAdapter"); - test(Ice.Util.proxyIdentityCompare(base.ice_getRouter(), communicator.getDefaultRouter()) == 0); - communicator.setDefaultRouter(null); - base = communicator.stringToProxy("test @ TestAdapter"); - test(base.ice_getRouter() == null); - System.out.println("ok"); + System.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")); + base = base.ice_locator(anotherLocator); + test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), anotherLocator) == 0); + communicator.setDefaultLocator(null); + base = communicator.stringToProxy("test @ TestAdapter"); + test(base.ice_getLocator() == null); + base = base.ice_locator(anotherLocator); + test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), anotherLocator) == 0); + communicator.setDefaultLocator(locator); + base = communicator.stringToProxy("test @ TestAdapter"); + test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), communicator.getDefaultLocator()) == 0); + + // + // We also test ice_router/ice_getRouter (perhaps we should add a + // test/Ice/router test?) + // + test(base.ice_getRouter() == null); + Ice.RouterPrx anotherRouter = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("anotherRouter")); + base = base.ice_router(anotherRouter); + test(Ice.Util.proxyIdentityCompare(base.ice_getRouter(), anotherRouter) == 0); + Ice.RouterPrx router = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("dummyrouter")); + communicator.setDefaultRouter(router); + base = communicator.stringToProxy("test @ TestAdapter"); + test(Ice.Util.proxyIdentityCompare(base.ice_getRouter(), communicator.getDefaultRouter()) == 0); + communicator.setDefaultRouter(null); + base = communicator.stringToProxy("test @ TestAdapter"); + test(base.ice_getRouter() == null); + System.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... "); + // + // 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(); - manager.startServer(); - System.out.println("ok"); + manager.startServer(); + System.out.println("ok"); - System.out.print("testing checked cast... "); + System.out.print("testing checked cast... "); System.out.flush(); - TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base); - test(obj != null); - TestIntfPrx obj2 = TestIntfPrxHelper.checkedCast(base2); - test(obj2 != null); - TestIntfPrx obj3 = TestIntfPrxHelper.checkedCast(base3); - test(obj3 != null); - ServerManagerPrx obj4 = ServerManagerPrxHelper.checkedCast(base4); - test(obj4 != null); - TestIntfPrx obj5 = TestIntfPrxHelper.checkedCast(base5); - test(obj5 != null); - TestIntfPrx obj6 = TestIntfPrxHelper.checkedCast(base6); - test(obj6 != null); - System.out.println("ok"); + TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base); + test(obj != null); + TestIntfPrx obj2 = TestIntfPrxHelper.checkedCast(base2); + test(obj2 != null); + TestIntfPrx obj3 = TestIntfPrxHelper.checkedCast(base3); + test(obj3 != null); + ServerManagerPrx obj4 = ServerManagerPrxHelper.checkedCast(base4); + test(obj4 != null); + TestIntfPrx obj5 = TestIntfPrxHelper.checkedCast(base5); + test(obj5 != null); + TestIntfPrx obj6 = TestIntfPrxHelper.checkedCast(base6); + test(obj6 != null); + System.out.println("ok"); - System.out.print("testing id@AdapterId indirect proxy... "); + System.out.print("testing id@AdapterId indirect proxy... "); System.out.flush(); - obj.shutdown(); - manager.startServer(); - try - { - obj2.ice_ping(); - } - catch(Ice.LocalException ex) - { - test(false); - } - System.out.println("ok"); + obj.shutdown(); + manager.startServer(); + try + { + obj2.ice_ping(); + } + catch(Ice.LocalException ex) + { + test(false); + } + System.out.println("ok"); - System.out.print("testing id@ReplicaGroupId indirect proxy... "); + System.out.print("testing id@ReplicaGroupId indirect proxy... "); System.out.flush(); - obj.shutdown(); - manager.startServer(); - try - { - obj6 = TestIntfPrxHelper.checkedCast(base6); - obj6.ice_ping(); - } - catch(Ice.LocalException ex) - { - test(false); - } - System.out.println("ok"); + obj.shutdown(); + manager.startServer(); + try + { + obj6 = TestIntfPrxHelper.checkedCast(base6); + obj6.ice_ping(); + } + catch(Ice.LocalException ex) + { + test(false); + } + System.out.println("ok"); - System.out.print("testing identity indirect proxy... "); + System.out.print("testing identity indirect proxy... "); System.out.flush(); - obj.shutdown(); - manager.startServer(); - try - { - obj3 = TestIntfPrxHelper.checkedCast(base3); - obj3.ice_ping(); - } - catch(Ice.LocalException ex) - { - test(false); - } - try - { - obj2 = TestIntfPrxHelper.checkedCast(base2); - obj2.ice_ping(); - } - catch(Ice.LocalException ex) - { - test(false); - } - obj.shutdown(); - manager.startServer(); - try - { - obj2 = TestIntfPrxHelper.checkedCast(base2); - obj2.ice_ping(); - } - catch(Ice.LocalException ex) - { - test(false); - } - try - { - obj3 = TestIntfPrxHelper.checkedCast(base3); - obj3.ice_ping(); - } - catch(Ice.LocalException ex) - { - test(false); - } - obj.shutdown(); - manager.startServer(); - try - { - obj2 = TestIntfPrxHelper.checkedCast(base2); - obj2.ice_ping(); - } - catch(Ice.LocalException ex) - { - test(false); - } - obj.shutdown(); - manager.startServer(); - try - { - obj3 = TestIntfPrxHelper.checkedCast(base2); - obj3.ice_ping(); - } - catch(Ice.LocalException ex) - { - test(false); - } - obj.shutdown(); - manager.startServer(); - try - { - obj5 = TestIntfPrxHelper.checkedCast(base5); - obj5.ice_ping(); - } - catch(Ice.LocalException ex) - { - test(false); - } + obj.shutdown(); + manager.startServer(); + try + { + obj3 = TestIntfPrxHelper.checkedCast(base3); + obj3.ice_ping(); + } + catch(Ice.LocalException ex) + { + test(false); + } + try + { + obj2 = TestIntfPrxHelper.checkedCast(base2); + obj2.ice_ping(); + } + catch(Ice.LocalException ex) + { + test(false); + } + obj.shutdown(); + manager.startServer(); + try + { + obj2 = TestIntfPrxHelper.checkedCast(base2); + obj2.ice_ping(); + } + catch(Ice.LocalException ex) + { + test(false); + } + try + { + obj3 = TestIntfPrxHelper.checkedCast(base3); + obj3.ice_ping(); + } + catch(Ice.LocalException ex) + { + test(false); + } + obj.shutdown(); + manager.startServer(); + try + { + obj2 = TestIntfPrxHelper.checkedCast(base2); + obj2.ice_ping(); + } + catch(Ice.LocalException ex) + { + test(false); + } + obj.shutdown(); + manager.startServer(); + try + { + obj3 = TestIntfPrxHelper.checkedCast(base2); + obj3.ice_ping(); + } + catch(Ice.LocalException ex) + { + test(false); + } + obj.shutdown(); + manager.startServer(); + try + { + obj5 = TestIntfPrxHelper.checkedCast(base5); + obj5.ice_ping(); + } + catch(Ice.LocalException ex) + { + test(false); + } - System.out.println("ok"); + System.out.println("ok"); - System.out.print("testing proxy with unknown identity... "); - System.out.flush(); - try - { - base = communicator.stringToProxy("unknown/unknown"); - base.ice_ping(); - test(false); - } - catch(Ice.NotRegisteredException ex) - { - test(ex.kindOfObject.equals("object")); - test(ex.id.equals("unknown/unknown")); - } - System.out.println("ok"); + System.out.print("testing proxy with unknown identity... "); + System.out.flush(); + try + { + base = communicator.stringToProxy("unknown/unknown"); + base.ice_ping(); + test(false); + } + catch(Ice.NotRegisteredException ex) + { + test(ex.kindOfObject.equals("object")); + test(ex.id.equals("unknown/unknown")); + } + System.out.println("ok"); - System.out.print("testing proxy with unknown adapter... "); - System.out.flush(); - try - { - base = communicator.stringToProxy("test @ TestAdapterUnknown"); - base.ice_ping(); - test(false); - } - catch(Ice.NotRegisteredException ex) - { - test(ex.kindOfObject.equals("object adapter")); - test(ex.id.equals("TestAdapterUnknown")); - } - System.out.println("ok"); + System.out.print("testing proxy with unknown adapter... "); + System.out.flush(); + try + { + base = communicator.stringToProxy("test @ TestAdapterUnknown"); + base.ice_ping(); + test(false); + } + catch(Ice.NotRegisteredException ex) + { + test(ex.kindOfObject.equals("object adapter")); + test(ex.id.equals("TestAdapterUnknown")); + } + System.out.println("ok"); - System.out.print("testing locator cache timeout... "); - System.out.flush(); - - int count = locator.getRequestCount(); - communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. - test(++count == locator.getRequestCount()); - communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. - test(++count == locator.getRequestCount()); - communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout. - test(count == locator.getRequestCount()); - try - { - Thread.sleep(1200); + System.out.print("testing locator cache timeout... "); + System.out.flush(); + + int count = locator.getRequestCount(); + communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. + test(++count == locator.getRequestCount()); + communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. + test(++count == locator.getRequestCount()); + communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout. + test(count == locator.getRequestCount()); + try + { + Thread.sleep(1200); } catch(InterruptedException ex) { } - communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout. - test(++count == locator.getRequestCount()); - - communicator.stringToProxy("test").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. - count += 2; - test(count == locator.getRequestCount()); - communicator.stringToProxy("test").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout - test(count == locator.getRequestCount()); - try - { - Thread.sleep(1200); + communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout. + test(++count == locator.getRequestCount()); + + communicator.stringToProxy("test").ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. + count += 2; + test(count == locator.getRequestCount()); + communicator.stringToProxy("test").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout + test(count == locator.getRequestCount()); + try + { + Thread.sleep(1200); } catch(InterruptedException ex) { } - communicator.stringToProxy("test").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout - count += 2; - test(count == locator.getRequestCount()); - - communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(-1).ice_ping(); - test(count == locator.getRequestCount()); - communicator.stringToProxy("test").ice_locatorCacheTimeout(-1).ice_ping(); - test(count == locator.getRequestCount()); - communicator.stringToProxy("test@TestAdapter").ice_ping(); - test(count == locator.getRequestCount()); - communicator.stringToProxy("test").ice_ping(); - test(count == locator.getRequestCount()); + communicator.stringToProxy("test").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout + count += 2; + test(count == locator.getRequestCount()); + + communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(-1).ice_ping(); + test(count == locator.getRequestCount()); + communicator.stringToProxy("test").ice_locatorCacheTimeout(-1).ice_ping(); + test(count == locator.getRequestCount()); + communicator.stringToProxy("test@TestAdapter").ice_ping(); + test(count == locator.getRequestCount()); + communicator.stringToProxy("test").ice_ping(); + test(count == locator.getRequestCount()); - test(communicator.stringToProxy("test").ice_locatorCacheTimeout(99).ice_getLocatorCacheTimeout() == 99); - - System.out.println("ok"); + test(communicator.stringToProxy("test").ice_locatorCacheTimeout(99).ice_getLocatorCacheTimeout() == 99); + + System.out.println("ok"); - System.out.print("testing proxy from server... "); + System.out.print("testing proxy from server... "); System.out.flush(); - 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"); + 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"); - System.out.print("testing proxy from server after shutdown... "); + System.out.print("testing proxy from server after shutdown... "); System.out.flush(); - obj.shutdown(); - manager.startServer(); - hello.sayHello(); - System.out.println("ok"); + obj.shutdown(); + manager.startServer(); + hello.sayHello(); + System.out.println("ok"); - System.out.print("testing object migration..."); - System.out.flush(); - hello = HelloPrxHelper.checkedCast(communicator.stringToProxy("hello")); - obj.migrateHello(); - hello.sayHello(); - obj.migrateHello(); - hello.sayHello(); - obj.migrateHello(); - hello.sayHello(); - System.out.println("ok"); + System.out.print("testing object migration..."); + System.out.flush(); + hello = HelloPrxHelper.checkedCast(communicator.stringToProxy("hello")); + obj.migrateHello(); + hello.sayHello(); + obj.migrateHello(); + hello.sayHello(); + obj.migrateHello(); + hello.sayHello(); + System.out.println("ok"); - System.out.print("testing whether server is gone... "); + System.out.print("testing whether server is gone... "); System.out.flush(); - obj.shutdown(); - try - { - obj2.ice_ping(); - test(false); - } + obj.shutdown(); + try + { + obj2.ice_ping(); + test(false); + } catch(Ice.LocalException ex) { System.out.println("ok"); } - System.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"); - adapter.setLocator(locator); - TestLocatorRegistryPrx registry = TestLocatorRegistryPrxHelper.checkedCast(locator.getRegistry()); - test(registry != null); + System.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"); + adapter.setLocator(locator); + TestLocatorRegistryPrx registry = TestLocatorRegistryPrxHelper.checkedCast(locator.getRegistry()); + test(registry != null); - Ice.Identity id = new Ice.Identity(); - id.name = Ice.Util.generateUUID(); - registry.addObject(adapter.add(new HelloI(), id)); - adapter.activate(); + Ice.Identity id = new Ice.Identity(); + id.name = Ice.Util.generateUUID(); + registry.addObject(adapter.add(new HelloI(), id)); + adapter.activate(); - try - { - HelloPrx helloPrx = HelloPrxHelper.checkedCast( - communicator.stringToProxy("\"" + communicator.identityToString(id) + "\"")); - Ice.Connection connection = helloPrx.ice_getConnection(); - test(false); - } - catch(Ice.CollocationOptimizationException ex) - { - System.out.println("ok"); - } - adapter.deactivate(); + try + { + HelloPrx helloPrx = HelloPrxHelper.checkedCast( + communicator.stringToProxy("\"" + communicator.identityToString(id) + "\"")); + Ice.Connection connection = helloPrx.ice_getConnection(); + test(false); + } + catch(Ice.CollocationOptimizationException ex) + { + System.out.println("ok"); + } + adapter.deactivate(); - System.out.print("shutdown server manager... "); + System.out.print("shutdown server manager... "); System.out.flush(); - manager.shutdown(); - System.out.println("ok"); + manager.shutdown(); + System.out.println("ok"); } } diff --git a/java/test/Ice/location/Client.java b/java/test/Ice/location/Client.java index 423d20c9c10..956ba1c726f 100644 --- a/java/test/Ice/location/Client.java +++ b/java/test/Ice/location/Client.java @@ -12,7 +12,7 @@ public class Client private static int run(String[] args, Ice.Communicator communicator) { - AllTests.allTests(communicator); + AllTests.allTests(communicator); return 0; } @@ -24,9 +24,9 @@ public class Client try { - Ice.InitializationData initData = new Ice.InitializationData(); + Ice.InitializationData initData = new Ice.InitializationData(); initData.properties = Ice.Util.createProperties(args); - initData.properties.setProperty("Ice.Default.Locator", "locator:default -p 12010"); + initData.properties.setProperty("Ice.Default.Locator", "locator:default -p 12010"); communicator = Ice.Util.initialize(args, initData); status = run(args, communicator); } @@ -49,7 +49,7 @@ public class Client } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/location/Server.java b/java/test/Ice/location/Server.java index d7ae98ced7b..394d838c9aa 100644 --- a/java/test/Ice/location/Server.java +++ b/java/test/Ice/location/Server.java @@ -12,37 +12,37 @@ public class Server private static int run(String[] args, Ice.Communicator communicator, Ice.InitializationData initData) { - // - // 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.OA.ServerManagerAdapter.Endpoints", "default -p 12010 -t 30000:udp"); + // + // 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.OA.ServerManagerAdapter.Endpoints", "default -p 12010 -t 30000:udp"); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ServerManagerAdapter"); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ServerManagerAdapter"); - // - // We also register a sample server locator which implements the - // locator interface, this locator is used by the clients and the - // 'servers' created with the server manager interface. - // - ServerLocatorRegistry registry = new ServerLocatorRegistry(); - registry.addObject(adapter.createProxy(communicator.stringToIdentity("ServerManager"))); - Ice.Object object = new ServerManagerI(adapter, registry, initData); - adapter.add(object, communicator.stringToIdentity("ServerManager")); + // + // We also register a sample server locator which implements the + // locator interface, this locator is used by the clients and the + // 'servers' created with the server manager interface. + // + ServerLocatorRegistry registry = new ServerLocatorRegistry(); + registry.addObject(adapter.createProxy(communicator.stringToIdentity("ServerManager"))); + Ice.Object object = new ServerManagerI(adapter, registry, initData); + adapter.add(object, communicator.stringToIdentity("ServerManager")); - 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; + 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; } public static void @@ -53,9 +53,9 @@ public class Server try { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + 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); } diff --git a/java/test/Ice/location/ServerLocator.java b/java/test/Ice/location/ServerLocator.java index c8b84b77306..51a3434f54c 100644 --- a/java/test/Ice/location/ServerLocator.java +++ b/java/test/Ice/location/ServerLocator.java @@ -12,37 +12,37 @@ public class ServerLocator extends Test._TestLocatorDisp public ServerLocator(ServerLocatorRegistry registry, Ice.LocatorRegistryPrx registryPrx) { - _registry = registry; - _registryPrx = registryPrx; - _requestCount = 0; + _registry = registry; + _registryPrx = registryPrx; + _requestCount = 0; } public void findAdapterById_async(Ice.AMD_Locator_findAdapterById response, String adapter, Ice.Current current) - throws Ice.AdapterNotFoundException + throws Ice.AdapterNotFoundException { - ++_requestCount; - response.ice_response(_registry.getAdapter(adapter)); + ++_requestCount; + response.ice_response(_registry.getAdapter(adapter)); } public void findObjectById_async(Ice.AMD_Locator_findObjectById response, Ice.Identity id, Ice.Current current) - throws Ice.ObjectNotFoundException + throws Ice.ObjectNotFoundException { - ++_requestCount; - response.ice_response(_registry.getObject(id)); + ++_requestCount; + response.ice_response(_registry.getObject(id)); } public Ice.LocatorRegistryPrx getRegistry(Ice.Current current) { - return _registryPrx; + return _registryPrx; } public int getRequestCount(Ice.Current current) { - return _requestCount; + return _requestCount; } private ServerLocatorRegistry _registry; diff --git a/java/test/Ice/location/ServerLocatorRegistry.java b/java/test/Ice/location/ServerLocatorRegistry.java index 24218875480..4a28cdaada5 100644 --- a/java/test/Ice/location/ServerLocatorRegistry.java +++ b/java/test/Ice/location/ServerLocatorRegistry.java @@ -11,55 +11,55 @@ public class ServerLocatorRegistry extends Test._TestLocatorRegistryDisp { public void setAdapterDirectProxy_async(Ice.AMD_LocatorRegistry_setAdapterDirectProxy cb, String adapter, - Ice.ObjectPrx object, Ice.Current current) + Ice.ObjectPrx object, Ice.Current current) { - _adapters.put(adapter, object); - cb.ice_response(); + _adapters.put(adapter, object); + cb.ice_response(); } public void setReplicatedAdapterDirectProxy_async(Ice.AMD_LocatorRegistry_setReplicatedAdapterDirectProxy cb, String adapter, - String replica, Ice.ObjectPrx object, Ice.Current current) + String replica, Ice.ObjectPrx object, Ice.Current current) { - _adapters.put(adapter, object); - _adapters.put(replica, object); - cb.ice_response(); + _adapters.put(adapter, object); + _adapters.put(replica, object); + cb.ice_response(); } public void setServerProcessProxy_async(Ice.AMD_LocatorRegistry_setServerProcessProxy cb, String id, Ice.ProcessPrx proxy, - Ice.Current current) + Ice.Current current) { } public void addObject(Ice.ObjectPrx object, Ice.Current current) { - _objects.put(object.ice_getIdentity(), object); + _objects.put(object.ice_getIdentity(), object); } public Ice.ObjectPrx getAdapter(String adapter) - throws Ice.AdapterNotFoundException + throws Ice.AdapterNotFoundException { - Ice.ObjectPrx obj = (Ice.ObjectPrx)_adapters.get(adapter); - if(obj == null) - { - throw new Ice.AdapterNotFoundException(); - } - return obj; + Ice.ObjectPrx obj = (Ice.ObjectPrx)_adapters.get(adapter); + if(obj == null) + { + throw new Ice.AdapterNotFoundException(); + } + return obj; } public Ice.ObjectPrx getObject(Ice.Identity id) - throws Ice.ObjectNotFoundException + throws Ice.ObjectNotFoundException { - Ice.ObjectPrx obj = (Ice.ObjectPrx)_objects.get(id); - if(obj == null) - { - throw new Ice.ObjectNotFoundException(); - } - return obj; + Ice.ObjectPrx obj = (Ice.ObjectPrx)_objects.get(id); + if(obj == null) + { + throw new Ice.ObjectNotFoundException(); + } + return obj; } private java.util.HashMap _adapters = new java.util.HashMap(); diff --git a/java/test/Ice/location/ServerManagerI.java b/java/test/Ice/location/ServerManagerI.java index eed1a9a244b..a62e6445f89 100644 --- a/java/test/Ice/location/ServerManagerI.java +++ b/java/test/Ice/location/ServerManagerI.java @@ -13,66 +13,66 @@ public class ServerManagerI extends _ServerManagerDisp { ServerManagerI(Ice.ObjectAdapter adapter, ServerLocatorRegistry registry, Ice.InitializationData initData) { - _adapter = adapter; - _registry = registry; - _communicators = new java.util.ArrayList(); - _initData = initData; + _adapter = adapter; + _registry = registry; + _communicators = new java.util.ArrayList(); + _initData = initData; - _initData.properties.setProperty("Ice.OA.TestAdapter.Endpoints", "default"); - _initData.properties.setProperty("Ice.OA.TestAdapter.AdapterId", "TestAdapter"); - _initData.properties.setProperty("Ice.OA.TestAdapter.ReplicaGroupId", "ReplicatedAdapter"); - _initData.properties.setProperty("Ice.OA.TestAdapter2.Endpoints", "default"); - _initData.properties.setProperty("Ice.OA.TestAdapter2.AdapterId", "TestAdapter2"); + _initData.properties.setProperty("Ice.OA.TestAdapter.Endpoints", "default"); + _initData.properties.setProperty("Ice.OA.TestAdapter.AdapterId", "TestAdapter"); + _initData.properties.setProperty("Ice.OA.TestAdapter.ReplicaGroupId", "ReplicatedAdapter"); + _initData.properties.setProperty("Ice.OA.TestAdapter2.Endpoints", "default"); + _initData.properties.setProperty("Ice.OA.TestAdapter2.AdapterId", "TestAdapter2"); } public void startServer(Ice.Current current) { java.util.Iterator i = _communicators.iterator(); - while(i.hasNext()) - { - Ice.Communicator c = (Ice.Communicator)i.next(); - c.waitForShutdown(); - c.destroy(); - } - _communicators.clear(); + while(i.hasNext()) + { + Ice.Communicator c = (Ice.Communicator)i.next(); + c.waitForShutdown(); + c.destroy(); + } + _communicators.clear(); - // - // Simulate a server: create a new communicator and object - // adapter. The object adapter is started on a system allocated - // port. The configuration used here contains the Ice.Locator - // configuration variable. The new object adapter will register - // its endpoints with the locator and create references containing - // the adapter id instead of the endpoints. - // - Ice.Communicator serverCommunicator = Ice.Util.initialize(_initData); - _communicators.add(serverCommunicator); + // + // Simulate a server: create a new communicator and object + // adapter. The object adapter is started on a system allocated + // port. The configuration used here contains the Ice.Locator + // configuration variable. The new object adapter will register + // its endpoints with the locator and create references containing + // the adapter id instead of the endpoints. + // + Ice.Communicator serverCommunicator = Ice.Util.initialize(_initData); + _communicators.add(serverCommunicator); - Ice.ObjectAdapter adapter = serverCommunicator.createObjectAdapter("TestAdapter"); + Ice.ObjectAdapter adapter = serverCommunicator.createObjectAdapter("TestAdapter"); - Ice.ObjectAdapter adapter2 = serverCommunicator.createObjectAdapter("TestAdapter2"); + Ice.ObjectAdapter adapter2 = serverCommunicator.createObjectAdapter("TestAdapter2"); - Ice.ObjectPrx locator = serverCommunicator.stringToProxy("locator:default -p 12010 -t 30000"); - adapter.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator)); - adapter2.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator)); + Ice.ObjectPrx locator = serverCommunicator.stringToProxy("locator:default -p 12010 -t 30000"); + adapter.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator)); + adapter2.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator)); - Ice.Object object = new TestI(adapter, adapter2, _registry); - _registry.addObject(adapter.add(object, serverCommunicator.stringToIdentity("test"))); - _registry.addObject(adapter.add(object, serverCommunicator.stringToIdentity("test2"))); + Ice.Object object = new TestI(adapter, adapter2, _registry); + _registry.addObject(adapter.add(object, serverCommunicator.stringToIdentity("test"))); + _registry.addObject(adapter.add(object, serverCommunicator.stringToIdentity("test2"))); - adapter.activate(); - adapter2.activate(); + adapter.activate(); + adapter2.activate(); } public void shutdown(Ice.Current current) { java.util.Iterator i = _communicators.iterator(); - while(i.hasNext()) - { - ((Ice.Communicator)i.next()).destroy(); - } - _adapter.getCommunicator().shutdown(); + while(i.hasNext()) + { + ((Ice.Communicator)i.next()).destroy(); + } + _adapter.getCommunicator().shutdown(); } private Ice.ObjectAdapter _adapter; diff --git a/java/test/Ice/location/TestI.java b/java/test/Ice/location/TestI.java index 18209f8fd36..3a65aeca617 100644 --- a/java/test/Ice/location/TestI.java +++ b/java/test/Ice/location/TestI.java @@ -13,44 +13,44 @@ public class TestI extends _TestIntfDisp { TestI(Ice.ObjectAdapter adapter1, Ice.ObjectAdapter adapter2, ServerLocatorRegistry registry) { - _adapter1 = adapter1; - _adapter2 = adapter2; - _registry = registry; + _adapter1 = adapter1; + _adapter2 = adapter2; + _registry = registry; - _registry.addObject(_adapter1.add(new HelloI(), _adapter1.getCommunicator().stringToIdentity("hello"))); + _registry.addObject(_adapter1.add(new HelloI(), _adapter1.getCommunicator().stringToIdentity("hello"))); } public void shutdown(Ice.Current current) { - _adapter1.getCommunicator().shutdown(); + _adapter1.getCommunicator().shutdown(); } public HelloPrx getHello(Ice.Current current) { - return HelloPrxHelper.uncheckedCast(_adapter1.createIndirectProxy( - _adapter1.getCommunicator().stringToIdentity("hello"))); + return HelloPrxHelper.uncheckedCast(_adapter1.createIndirectProxy( + _adapter1.getCommunicator().stringToIdentity("hello"))); } public HelloPrx getReplicatedHello(Ice.Current current) { - return HelloPrxHelper.uncheckedCast(_adapter1.createProxy(_adapter1.getCommunicator().stringToIdentity("hello"))); + return HelloPrxHelper.uncheckedCast(_adapter1.createProxy(_adapter1.getCommunicator().stringToIdentity("hello"))); } public void migrateHello(Ice.Current current) { - final Ice.Identity id = _adapter1.getCommunicator().stringToIdentity("hello"); - try - { - _registry.addObject(_adapter2.add(_adapter1.remove(id), id)); - } - catch(Ice.NotRegisteredException ex) - { - _registry.addObject(_adapter1.add(_adapter2.remove(id), id)); - } + final Ice.Identity id = _adapter1.getCommunicator().stringToIdentity("hello"); + try + { + _registry.addObject(_adapter2.add(_adapter1.remove(id), id)); + } + catch(Ice.NotRegisteredException ex) + { + _registry.addObject(_adapter1.add(_adapter2.remove(id), id)); + } } private ServerLocatorRegistry _registry; diff --git a/java/test/Ice/objects/AllTests.java b/java/test/Ice/objects/AllTests.java index 7a7ddb771b5..db4d956fef5 100644 --- a/java/test/Ice/objects/AllTests.java +++ b/java/test/Ice/objects/AllTests.java @@ -139,32 +139,32 @@ public class AllTests } System.out.println("ok"); - if(!collocated) - { - System.out.print("testing UnexpectedObjectException..."); - System.out.flush(); - ref = "uoet:default -p 12010 -t 10000"; - base = communicator.stringToProxy(ref); - test(base != null); - UnexpectedObjectExceptionTestPrx uoet = UnexpectedObjectExceptionTestPrxHelper.uncheckedCast(base); - test(uoet != null); - try - { - uoet.op(); - test(false); - } - catch(Ice.UnexpectedObjectException ex) - { - test(ex.type.equals("::Test::AlsoEmpty")); - test(ex.expectedType.equals("::Test::Empty")); - } - catch(java.lang.Exception ex) - { - System.out.println(ex); - test(false); - } - System.out.println("ok"); - } + if(!collocated) + { + System.out.print("testing UnexpectedObjectException..."); + System.out.flush(); + ref = "uoet:default -p 12010 -t 10000"; + base = communicator.stringToProxy(ref); + test(base != null); + UnexpectedObjectExceptionTestPrx uoet = UnexpectedObjectExceptionTestPrxHelper.uncheckedCast(base); + test(uoet != null); + try + { + uoet.op(); + test(false); + } + catch(Ice.UnexpectedObjectException ex) + { + test(ex.type.equals("::Test::AlsoEmpty")); + test(ex.expectedType.equals("::Test::Empty")); + } + catch(java.lang.Exception ex) + { + System.out.println(ex); + test(false); + } + System.out.println("ok"); + } return initial; } diff --git a/java/test/Ice/objects/Client.java b/java/test/Ice/objects/Client.java index d4b4653869e..7d88222e906 100644 --- a/java/test/Ice/objects/Client.java +++ b/java/test/Ice/objects/Client.java @@ -82,7 +82,7 @@ public class Client } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/objects/Server.java b/java/test/Ice/objects/Server.java index 5b73aac39a6..b341452febb 100644 --- a/java/test/Ice/objects/Server.java +++ b/java/test/Ice/objects/Server.java @@ -53,7 +53,7 @@ public class Server } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/objects/UnexpectedObjectExceptionTestI.java b/java/test/Ice/objects/UnexpectedObjectExceptionTestI.java index a3c1565a873..77d48b973d6 100644 --- a/java/test/Ice/objects/UnexpectedObjectExceptionTestI.java +++ b/java/test/Ice/objects/UnexpectedObjectExceptionTestI.java @@ -14,12 +14,12 @@ public final class UnexpectedObjectExceptionTestI extends Ice.Blobject public boolean ice_invoke(byte[] inParams, Ice.ByteSeqHolder outParams, Ice.Current current) { - Ice.Communicator communicator = current.adapter.getCommunicator(); - Ice.OutputStream out = Ice.Util.createOutputStream(communicator); - AlsoEmpty ae = new AlsoEmpty(); - Test.AlsoEmptyHelper.write(out, ae); - out.writePendingObjects(); - outParams.value = out.finished(); - return true; + Ice.Communicator communicator = current.adapter.getCommunicator(); + Ice.OutputStream out = Ice.Util.createOutputStream(communicator); + AlsoEmpty ae = new AlsoEmpty(); + Test.AlsoEmptyHelper.write(out, ae); + out.writePendingObjects(); + outParams.value = out.finished(); + return true; } } diff --git a/java/test/Ice/operations/AllTests.java b/java/test/Ice/operations/AllTests.java index 0744aa12711..0bb47cda1b1 100644 --- a/java/test/Ice/operations/AllTests.java +++ b/java/test/Ice/operations/AllTests.java @@ -28,84 +28,84 @@ public class AllTests test(base != null); System.out.println("ok"); - System.out.print("testing ice_getCommunicator... "); - System.out.flush(); - test(base.ice_getCommunicator() == communicator); - System.out.println("ok"); + System.out.print("testing ice_getCommunicator... "); + System.out.flush(); + test(base.ice_getCommunicator() == communicator); + System.out.println("ok"); - System.out.print("testing proxy methods... "); - System.out.flush(); - test(communicator.identityToString( - base.ice_identity(communicator.stringToIdentity("other")).ice_getIdentity()).equals("other")); - test(base.ice_facet("facet").ice_getFacet().equals("facet")); - test(base.ice_adapterId("id").ice_getAdapterId().equals("id")); - test(base.ice_twoway().ice_isTwoway()); - test(base.ice_oneway().ice_isOneway()); - test(base.ice_batchOneway().ice_isBatchOneway()); - test(base.ice_datagram().ice_isDatagram()); - test(base.ice_batchDatagram().ice_isBatchDatagram()); - test(base.ice_secure(true).ice_isSecure()); - test(!base.ice_secure(false).ice_isSecure()); - test(base.ice_collocationOptimized(true).ice_isCollocationOptimized()); - test(!base.ice_collocationOptimized(false).ice_isCollocationOptimized()); - System.out.println("ok"); + System.out.print("testing proxy methods... "); + System.out.flush(); + test(communicator.identityToString( + base.ice_identity(communicator.stringToIdentity("other")).ice_getIdentity()).equals("other")); + test(base.ice_facet("facet").ice_getFacet().equals("facet")); + test(base.ice_adapterId("id").ice_getAdapterId().equals("id")); + test(base.ice_twoway().ice_isTwoway()); + test(base.ice_oneway().ice_isOneway()); + test(base.ice_batchOneway().ice_isBatchOneway()); + test(base.ice_datagram().ice_isDatagram()); + test(base.ice_batchDatagram().ice_isBatchDatagram()); + test(base.ice_secure(true).ice_isSecure()); + test(!base.ice_secure(false).ice_isSecure()); + test(base.ice_collocationOptimized(true).ice_isCollocationOptimized()); + test(!base.ice_collocationOptimized(false).ice_isCollocationOptimized()); + System.out.println("ok"); - System.out.print("testing proxy comparison... "); - System.out.flush(); + System.out.print("testing proxy comparison... "); + System.out.flush(); - test(communicator.stringToProxy("foo").equals(communicator.stringToProxy("foo"))); - test(!communicator.stringToProxy("foo").equals(communicator.stringToProxy("foo2"))); + test(communicator.stringToProxy("foo").equals(communicator.stringToProxy("foo"))); + test(!communicator.stringToProxy("foo").equals(communicator.stringToProxy("foo2"))); - Ice.ObjectPrx compObj = communicator.stringToProxy("foo"); + Ice.ObjectPrx compObj = communicator.stringToProxy("foo"); - test(compObj.ice_facet("facet").equals(compObj.ice_facet("facet"))); - test(!compObj.ice_facet("facet").equals(compObj.ice_facet("facet1"))); + test(compObj.ice_facet("facet").equals(compObj.ice_facet("facet"))); + test(!compObj.ice_facet("facet").equals(compObj.ice_facet("facet1"))); - test(compObj.ice_oneway().equals(compObj.ice_oneway())); - test(!compObj.ice_oneway().equals(compObj.ice_twoway())); + test(compObj.ice_oneway().equals(compObj.ice_oneway())); + test(!compObj.ice_oneway().equals(compObj.ice_twoway())); - test(compObj.ice_secure(true).equals(compObj.ice_secure(true))); - test(!compObj.ice_secure(false).equals(compObj.ice_secure(true))); + test(compObj.ice_secure(true).equals(compObj.ice_secure(true))); + test(!compObj.ice_secure(false).equals(compObj.ice_secure(true))); - test(compObj.ice_collocationOptimized(true).equals(compObj.ice_collocationOptimized(true))); - test(!compObj.ice_collocationOptimized(false).equals(compObj.ice_collocationOptimized(true))); + test(compObj.ice_collocationOptimized(true).equals(compObj.ice_collocationOptimized(true))); + test(!compObj.ice_collocationOptimized(false).equals(compObj.ice_collocationOptimized(true))); - test(compObj.ice_connectionCached(true).equals(compObj.ice_connectionCached(true))); - test(!compObj.ice_connectionCached(false).equals(compObj.ice_connectionCached(true))); + test(compObj.ice_connectionCached(true).equals(compObj.ice_connectionCached(true))); + test(!compObj.ice_connectionCached(false).equals(compObj.ice_connectionCached(true))); - test(compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random).equals( - compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random))); - test(!compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random).equals( - compObj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered))); + test(compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random).equals( + compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random))); + test(!compObj.ice_endpointSelection(Ice.EndpointSelectionType.Random).equals( + compObj.ice_endpointSelection(Ice.EndpointSelectionType.Ordered))); - test(compObj.ice_connectionId("id2").equals(compObj.ice_connectionId("id2"))); - test(!compObj.ice_connectionId("id1").equals(compObj.ice_connectionId("id2"))); + test(compObj.ice_connectionId("id2").equals(compObj.ice_connectionId("id2"))); + test(!compObj.ice_connectionId("id1").equals(compObj.ice_connectionId("id2"))); - test(compObj.ice_compress(true).equals(compObj.ice_compress(true))); - test(!compObj.ice_compress(false).equals(compObj.ice_compress(true))); + test(compObj.ice_compress(true).equals(compObj.ice_compress(true))); + test(!compObj.ice_compress(false).equals(compObj.ice_compress(true))); - test(compObj.ice_timeout(20).equals(compObj.ice_timeout(20))); - test(!compObj.ice_timeout(10).equals(compObj.ice_timeout(20))); + test(compObj.ice_timeout(20).equals(compObj.ice_timeout(20))); + test(!compObj.ice_timeout(10).equals(compObj.ice_timeout(20))); - Ice.ObjectPrx compObj1 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10000"); - Ice.ObjectPrx compObj2 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10001"); - test(!compObj1.equals(compObj2)); + Ice.ObjectPrx compObj1 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10000"); + Ice.ObjectPrx compObj2 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 10001"); + test(!compObj1.equals(compObj2)); - compObj1 = communicator.stringToProxy("foo@MyAdapter1"); - compObj2 = communicator.stringToProxy("foo@MyAdapter2"); - test(!compObj1.equals(compObj2)); + compObj1 = communicator.stringToProxy("foo@MyAdapter1"); + compObj2 = communicator.stringToProxy("foo@MyAdapter2"); + test(!compObj1.equals(compObj2)); - test(compObj1.ice_locatorCacheTimeout(20).equals(compObj1.ice_locatorCacheTimeout(20))); - test(!compObj1.ice_locatorCacheTimeout(10).equals(compObj1.ice_locatorCacheTimeout(20))); + test(compObj1.ice_locatorCacheTimeout(20).equals(compObj1.ice_locatorCacheTimeout(20))); + test(!compObj1.ice_locatorCacheTimeout(10).equals(compObj1.ice_locatorCacheTimeout(20))); - compObj1 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 1000"); - compObj2 = communicator.stringToProxy("foo@MyAdapter1"); - test(!compObj1.equals(compObj2)); + compObj1 = communicator.stringToProxy("foo:tcp -h 127.0.0.1 -p 1000"); + compObj2 = communicator.stringToProxy("foo@MyAdapter1"); + test(!compObj1.equals(compObj2)); - // - // TODO: Ideally we should also test comparison of fixed proxies. - // - System.out.println("ok"); + // + // TODO: Ideally we should also test comparison of fixed proxies. + // + System.out.println("ok"); System.out.print("testing checked cast... "); System.out.flush(); @@ -118,39 +118,39 @@ public class AllTests test(cl.equals(derived)); System.out.println("ok"); - System.out.print("testing checked cast with context... "); - System.out.flush(); - String cref = "context:default -p 12010 -t 10000"; - Ice.ObjectPrx cbase = communicator.stringToProxy(cref); - test(cbase != null); - - Test.TestCheckedCastPrx tccp = Test.TestCheckedCastPrxHelper.checkedCast(cbase); - java.util.Map c = tccp.getContext(); - test(c == null || c.size() == 0); - - c = new java.util.HashMap(); - c.put("one", "hello"); - c.put("two", "world"); - tccp = Test.TestCheckedCastPrxHelper.checkedCast(cbase, c); - java.util.Map c2 = tccp.getContext(); - test(c.equals(c2)); - System.out.println("ok"); - - if(!collocated) - { - System.out.print("testing timeout... "); - System.out.flush(); - try - { - Test.MyClassPrx clTimeout = Test.MyClassPrxHelper.uncheckedCast(cl.ice_timeout(500)); - clTimeout.opSleep(1000); - test(false); - } - catch(Ice.TimeoutException ex) - { - } - System.out.println("ok"); - } + System.out.print("testing checked cast with context... "); + System.out.flush(); + String cref = "context:default -p 12010 -t 10000"; + Ice.ObjectPrx cbase = communicator.stringToProxy(cref); + test(cbase != null); + + Test.TestCheckedCastPrx tccp = Test.TestCheckedCastPrxHelper.checkedCast(cbase); + java.util.Map c = tccp.getContext(); + test(c == null || c.size() == 0); + + c = new java.util.HashMap(); + c.put("one", "hello"); + c.put("two", "world"); + tccp = Test.TestCheckedCastPrxHelper.checkedCast(cbase, c); + java.util.Map c2 = tccp.getContext(); + test(c.equals(c2)); + System.out.println("ok"); + + if(!collocated) + { + System.out.print("testing timeout... "); + System.out.flush(); + try + { + Test.MyClassPrx clTimeout = Test.MyClassPrxHelper.uncheckedCast(cl.ice_timeout(500)); + clTimeout.opSleep(1000); + test(false); + } + catch(Ice.TimeoutException ex) + { + } + System.out.println("ok"); + } System.out.print("testing twoway operations... "); System.out.flush(); @@ -159,20 +159,20 @@ public class AllTests derived.opDerived(); System.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 batch oneway operations... "); - System.out.flush(); - BatchOneways.batchOneways(cl); - BatchOneways.batchOneways(derived); - System.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 batch oneway operations... "); + System.out.flush(); + BatchOneways.batchOneways(cl); + BatchOneways.batchOneways(derived); + System.out.println("ok"); + } return cl; } diff --git a/java/test/Ice/operations/BatchOneways.java b/java/test/Ice/operations/BatchOneways.java index 2ce6418d423..86944c0b9c9 100644 --- a/java/test/Ice/operations/BatchOneways.java +++ b/java/test/Ice/operations/BatchOneways.java @@ -21,55 +21,55 @@ class BatchOneways static void batchOneways(Test.MyClassPrx p) { - final byte[] bs1 = new byte[10 * 1024]; - final byte[] bs2 = new byte[99 * 1024]; - final byte[] bs3 = new byte[100 * 1024]; + final byte[] bs1 = new byte[10 * 1024]; + final byte[] bs2 = new byte[99 * 1024]; + final byte[] bs3 = new byte[100 * 1024]; - try + try { p.opByteSOneway(bs1); - test(true); + test(true); + } + catch(Ice.MemoryLimitException ex) + { + test(false); } - catch(Ice.MemoryLimitException ex) - { - test(false); - } - try + try { p.opByteSOneway(bs2); - test(true); + test(true); + } + catch(Ice.MemoryLimitException ex) + { + test(false); } - catch(Ice.MemoryLimitException ex) - { - test(false); - } - try + try { p.opByteSOneway(bs3); - test(false); + test(false); + } + catch(Ice.MemoryLimitException ex) + { + test(true); } - catch(Ice.MemoryLimitException ex) - { - test(true); - } - Test.MyClassPrx batch = Test.MyClassPrxHelper.uncheckedCast(p.ice_batchOneway()); + Test.MyClassPrx batch = Test.MyClassPrxHelper.uncheckedCast(p.ice_batchOneway()); - for(int i = 0 ; i < 30 ; ++i) - { - try - { - batch.opByteSOneway(bs1); - test(true); - } - catch(Ice.MemoryLimitException ex) - { - test(false); - } - } + for(int i = 0 ; i < 30 ; ++i) + { + try + { + batch.opByteSOneway(bs1); + test(true); + } + catch(Ice.MemoryLimitException ex) + { + test(false); + } + } - batch.ice_getConnection().flushBatchRequests(); + batch.ice_getConnection().flushBatchRequests(); } } diff --git a/java/test/Ice/operations/Client.java b/java/test/Ice/operations/Client.java index 598d33ed526..280d6791d65 100644 --- a/java/test/Ice/operations/Client.java +++ b/java/test/Ice/operations/Client.java @@ -38,28 +38,28 @@ public class Client 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"); + // + // 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"); + // + // 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"); - // - // We don't want connection warnings because of the timeout test. - // - initData.properties.setProperty("Ice.Warn.Connections", "0"); - + // + // 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); } @@ -82,7 +82,7 @@ public class Client } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/operations/Collocated.java b/java/test/Ice/operations/Collocated.java index 6aa4c99b0ba..de1cb34739c 100644 --- a/java/test/Ice/operations/Collocated.java +++ b/java/test/Ice/operations/Collocated.java @@ -17,7 +17,7 @@ public class Collocated Ice.Identity id = communicator.stringToIdentity("test"); adapter.add(new MyDerivedClassI(adapter, id), id); adapter.add(new TestCheckedCastI(), communicator.stringToIdentity("context")); - adapter.activate(); + adapter.activate(); AllTests.allTests(communicator, true); @@ -32,9 +32,9 @@ public class Collocated try { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + 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); } diff --git a/java/test/Ice/operations/MyDerivedClassI.java b/java/test/Ice/operations/MyDerivedClassI.java index e92b7f04536..7e44f5be060 100644 --- a/java/test/Ice/operations/MyDerivedClassI.java +++ b/java/test/Ice/operations/MyDerivedClassI.java @@ -39,23 +39,23 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opSleep(int duration, Ice.Current current) { - while(true) - { - try - { - Thread.currentThread().sleep(duration); - break; - } - catch(java.lang.InterruptedException ex) - { - } - } + while(true) + { + try + { + Thread.currentThread().sleep(duration); + break; + } + catch(java.lang.InterruptedException ex) + { + } + } } public boolean opBool(boolean p1, boolean p2, - Ice.BooleanHolder p3, - Ice.Current current) + Ice.BooleanHolder p3, + Ice.Current current) { p3.value = p1; return p2; @@ -63,7 +63,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public boolean[] opBoolS(boolean[] p1, boolean[] p2, - Test.BoolSHolder p3, + Test.BoolSHolder p3, Ice.Current current) { p3.value = new boolean[p1.length + p2.length]; @@ -80,7 +80,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public boolean[][] opBoolSS(boolean[][] p1, boolean[][] p2, - Test.BoolSSHolder p3, + Test.BoolSSHolder p3, Ice.Current current) { p3.value = new boolean[p1.length + p2.length][]; @@ -97,8 +97,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public byte opByte(byte p1, byte p2, - Ice.ByteHolder p3, - Ice.Current current) + Ice.ByteHolder p3, + Ice.Current current) { p3.value = (byte)(p1 ^ p2); return p1; @@ -106,7 +106,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public java.util.Map opByteBoolD(java.util.Map p1, java.util.Map p2, - Test.ByteBoolDHolder p3, + Test.ByteBoolDHolder p3, Ice.Current current) { p3.value = p1; @@ -118,8 +118,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public byte[] opByteS(byte[] p1, byte[] p2, - Test.ByteSHolder p3, - Ice.Current current) + Test.ByteSHolder p3, + Ice.Current current) { p3.value = new byte[p1.length]; for(int i = 0; i < p1.length; i++) @@ -135,7 +135,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public byte[][] opByteSS(byte[][] p1, byte[][] p2, - Test.ByteSSHolder p3, + Test.ByteSSHolder p3, Ice.Current current) { p3.value = new byte[p1.length][]; @@ -152,8 +152,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public double opFloatDouble(float p1, double p2, - Ice.FloatHolder p3, Ice.DoubleHolder p4, - Ice.Current current) + Ice.FloatHolder p3, Ice.DoubleHolder p4, + Ice.Current current) { p3.value = p1; p4.value = p2; @@ -162,8 +162,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public double[] opFloatDoubleS(float[] p1, double[] p2, - Test.FloatSHolder p3, Test.DoubleSHolder p4, - Ice.Current current) + Test.FloatSHolder p3, Test.DoubleSHolder p4, + Ice.Current current) { p3.value = p1; p4.value = new double[p2.length]; @@ -182,8 +182,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public double[][] opFloatDoubleSS(float[][] p1, double[][] p2, - Test.FloatSSHolder p3, Test.DoubleSSHolder p4, - Ice.Current current) + Test.FloatSSHolder p3, Test.DoubleSSHolder p4, + Ice.Current current) { p3.value = p1; p4.value = new double[p2.length][]; @@ -199,7 +199,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public java.util.Map opLongFloatD(java.util.Map p1, java.util.Map p2, - Test.LongFloatDHolder p3, + Test.LongFloatDHolder p3, Ice.Current current) { p3.value = p1; @@ -211,19 +211,19 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public Test.MyClassPrx opMyClass(Test.MyClassPrx p1, - Test.MyClassPrxHolder p2, Test.MyClassPrxHolder p3, - Ice.Current current) + Test.MyClassPrxHolder p2, Test.MyClassPrxHolder p3, + Ice.Current current) { p2.value = p1; p3.value = Test.MyClassPrxHelper.uncheckedCast( - _adapter.createProxy(_adapter.getCommunicator().stringToIdentity("noSuchIdentity"))); + _adapter.createProxy(_adapter.getCommunicator().stringToIdentity("noSuchIdentity"))); return Test.MyClassPrxHelper.uncheckedCast(_adapter.createProxy(_identity)); } public Test.MyEnum opMyEnum(Test.MyEnum p1, - Test.MyEnumHolder p2, - Ice.Current current) + Test.MyEnumHolder p2, + Ice.Current current) { p2.value = p1; return Test.MyEnum.enum3; @@ -231,7 +231,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public java.util.Map opShortIntD(java.util.Map p1, java.util.Map p2, - Test.ShortIntDHolder p3, + Test.ShortIntDHolder p3, Ice.Current current) { p3.value = p1; @@ -243,8 +243,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public long opShortIntLong(short p1, int p2, long p3, - Ice.ShortHolder p4, Ice.IntHolder p5, Ice.LongHolder p6, - Ice.Current current) + Ice.ShortHolder p4, Ice.IntHolder p5, Ice.LongHolder p6, + Ice.Current current) { p4.value = p1; p5.value = p2; @@ -254,7 +254,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, + Test.ShortSHolder p4, Test.IntSHolder p5, Test.LongSHolder p6, Ice.Current current) { p4.value = p1; @@ -272,7 +272,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, - Ice.Current current) + Ice.Current current) { p4.value = p1; p5.value = new int[p2.length][]; @@ -288,8 +288,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public String opString(String p1, String p2, - Ice.StringHolder p3, - Ice.Current current) + Ice.StringHolder p3, + Ice.Current current) { p3.value = p2 + " " + p1; return p1 + " " + p2; @@ -298,7 +298,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public java.util.Map opStringMyEnumD(java.util.Map p1, java.util.Map p2, Test.StringMyEnumDHolder p3, - Ice.Current current) + Ice.Current current) { p3.value = p1; java.util.Map r = new java.util.HashMap(); @@ -310,11 +310,11 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public int[] opIntS(int[] s, Ice.Current current) { - int[] r = new int[s.length]; - for(int i = 0; i < r.length; ++i) - { - r[i] = -s[i]; - } + int[] r = new int[s.length]; + for(int i = 0; i < r.length; ++i) + { + r[i] = -s[i]; + } return r; } @@ -326,23 +326,23 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public java.util.Map opContext(Ice.Current current) { - return current.ctx; + return current.ctx; } public void opDoubleMarshaling(double p1, double[] p2, Ice.Current current) { - double d = 1278312346.0 / 13.0; - test(p1 == d); - for(int i = 0; i < p2.length; ++i) - { - test(p2[i] == d); - } + double d = 1278312346.0 / 13.0; + test(p1 == d); + for(int i = 0; i < p2.length; ++i) + { + test(p2[i] == d); + } } public String[] opStringS(String[] p1, String[] p2, - Test.StringSHolder p3, + Test.StringSHolder p3, Ice.Current current) { p3.value = new String[p1.length + p2.length]; @@ -359,7 +359,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public String[][] opStringSS(String[][] p1, String[][] p2, - Test.StringSSHolder p3, + Test.StringSSHolder p3, Ice.Current current) { p3.value = new String[p1.length + p2.length][]; @@ -376,7 +376,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public String[][][] opStringSSS(String[][][] p1, String[][][] p2, - Test.StringSSSHolder p3, + Test.StringSSSHolder p3, Ice.Current current) { p3.value = new String[p1.length + p2.length][][]; @@ -394,7 +394,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public java.util.Map opStringStringD(java.util.Map p1, java.util.Map p2, Test.StringStringDHolder p3, - Ice.Current current) + Ice.Current current) { p3.value = p1; java.util.Map r = new java.util.HashMap(); @@ -405,7 +405,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public Test.Structure opStruct(Test.Structure p1, Test.Structure p2, - Test.StructureHolder p3, + Test.StructureHolder p3, Ice.Current current) { p3.value = p1; diff --git a/java/test/Ice/operations/Server.java b/java/test/Ice/operations/Server.java index 41de47c5418..02a84b8100c 100644 --- a/java/test/Ice/operations/Server.java +++ b/java/test/Ice/operations/Server.java @@ -31,10 +31,10 @@ public class Server 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"); + 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(argsH.value, communicator); @@ -58,7 +58,7 @@ public class Server } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/operations/Test.ice b/java/test/Ice/operations/Test.ice index d6637fef4cf..aaaa2975345 100644 --- a/java/test/Ice/operations/Test.ice +++ b/java/test/Ice/operations/Test.ice @@ -75,75 +75,75 @@ dictionary<string, MyEnum> StringMyEnumD; void opSleep(int duration); byte opByte(byte p1, byte p2, - out byte p3); + out byte p3); bool opBool(bool p1, bool p2, - out bool p3); + out bool p3); long opShortIntLong(short p1, int p2, long p3, - out short p4, out int p5, out long p6); + out short p4, out int p5, out long p6); double opFloatDouble(float p1, double p2, - out float p3, out double p4); + out float p3, out double p4); string opString(string p1, string p2, - out string p3); + out string p3); MyEnum opMyEnum(MyEnum p1, out MyEnum p2); MyClass* opMyClass(MyClass* p1, out MyClass* p2, out MyClass* p3); Structure opStruct(Structure p1, Structure p2, - out Structure p3); + out Structure p3); ByteS opByteS(ByteS p1, ByteS p2, - out ByteS p3); + out ByteS p3); BoolS opBoolS(BoolS p1, BoolS p2, - out BoolS p3); + out BoolS p3); LongS opShortIntLongS(Test::ShortS p1, IntS p2, LongS p3, - out ::Test::ShortS p4, out IntS p5, out LongS p6); + out ::Test::ShortS p4, out IntS p5, out LongS p6); DoubleS opFloatDoubleS(FloatS p1, DoubleS p2, - out FloatS p3, out DoubleS p4); + out FloatS p3, out DoubleS p4); StringS opStringS(StringS p1, StringS p2, - out StringS p3); + out StringS p3); ByteSS opByteSS(ByteSS p1, ByteSS p2, - out ByteSS p3); + out ByteSS p3); BoolSS opBoolSS(BoolSS p1, BoolSS p2, - out BoolSS p3); + out BoolSS p3); LongSS opShortIntLongSS(ShortSS p1, IntSS p2, LongSS p3, - out ShortSS p4, out IntSS p5, out LongSS p6); + out ShortSS p4, out IntSS p5, out LongSS p6); DoubleSS opFloatDoubleSS(FloatSS p1, DoubleSS p2, - out FloatSS p3, out DoubleSS p4); + out FloatSS p3, out DoubleSS p4); StringSS opStringSS(StringSS p1, StringSS p2, - out StringSS p3); + out StringSS p3); StringSSS opStringSSS(StringSSS p1, StringSSS p2, - out StringSSS p3); + out StringSSS p3); ByteBoolD opByteBoolD(ByteBoolD p1, ByteBoolD p2, - out ByteBoolD p3); + out ByteBoolD p3); ShortIntD opShortIntD(ShortIntD p1, ShortIntD p2, - out ShortIntD p3); + out ShortIntD p3); LongFloatD opLongFloatD(LongFloatD p1, LongFloatD p2, - out LongFloatD p3); + out LongFloatD p3); StringStringD opStringStringD(StringStringD p1, StringStringD p2, - out StringStringD p3); + out StringStringD p3); StringMyEnumD opStringMyEnumD(StringMyEnumD p1, StringMyEnumD p2, - out StringMyEnumD p3); + out StringMyEnumD p3); IntS opIntS(IntS s); diff --git a/java/test/Ice/operations/Twoways.java b/java/test/Ice/operations/Twoways.java index c8f49ebb81a..328b3ae4013 100644 --- a/java/test/Ice/operations/Twoways.java +++ b/java/test/Ice/operations/Twoways.java @@ -403,80 +403,80 @@ class Twoways test(rso[2].length == 0); } - { - final String[][][] sssi1 = - { - { - { - "abc", "de" - }, - { - "xyz" - } - }, - { - { - "hello" - } - } - }; - - final String[][][] sssi2 = - { - { - { - "", "" - }, - { - "abcd" - } - }, - { - { - "" - } - }, - { - } - }; - - Test.StringSSSHolder ssso = new Test.StringSSSHolder(); - String rsso[][][]; - - rsso = p.opStringSSS(sssi1, sssi2, ssso); - test(ssso.value.length == 5); - test(ssso.value[0].length == 2); - test(ssso.value[0][0].length == 2); - test(ssso.value[0][1].length == 1); - test(ssso.value[1].length == 1); - test(ssso.value[1][0].length == 1); - test(ssso.value[2].length == 2); - test(ssso.value[2][0].length == 2); - test(ssso.value[2][1].length == 1); - test(ssso.value[3].length == 1); - test(ssso.value[3][0].length == 1); - test(ssso.value[4].length == 0); - test(ssso.value[0][0][0].equals("abc")); - test(ssso.value[0][0][1].equals("de")); - test(ssso.value[0][1][0].equals("xyz")); - test(ssso.value[1][0][0].equals("hello")); - test(ssso.value[2][0][0].equals("")); - test(ssso.value[2][0][1].equals("")); - test(ssso.value[2][1][0].equals("abcd")); - test(ssso.value[3][0][0].equals("")); - - test(rsso.length == 3); - test(rsso[0].length == 0); - test(rsso[1].length == 1); - test(rsso[1][0].length == 1); - test(rsso[2].length == 2); - test(rsso[2][0].length == 2); - test(rsso[2][1].length == 1); - test(rsso[1][0][0].equals("")); - test(rsso[2][0][0].equals("")); - test(rsso[2][0][1].equals("")); - test(rsso[2][1][0].equals("abcd")); - } + { + final String[][][] sssi1 = + { + { + { + "abc", "de" + }, + { + "xyz" + } + }, + { + { + "hello" + } + } + }; + + final String[][][] sssi2 = + { + { + { + "", "" + }, + { + "abcd" + } + }, + { + { + "" + } + }, + { + } + }; + + Test.StringSSSHolder ssso = new Test.StringSSSHolder(); + String rsso[][][]; + + rsso = p.opStringSSS(sssi1, sssi2, ssso); + test(ssso.value.length == 5); + test(ssso.value[0].length == 2); + test(ssso.value[0][0].length == 2); + test(ssso.value[0][1].length == 1); + test(ssso.value[1].length == 1); + test(ssso.value[1][0].length == 1); + test(ssso.value[2].length == 2); + test(ssso.value[2][0].length == 2); + test(ssso.value[2][1].length == 1); + test(ssso.value[3].length == 1); + test(ssso.value[3][0].length == 1); + test(ssso.value[4].length == 0); + test(ssso.value[0][0][0].equals("abc")); + test(ssso.value[0][0][1].equals("de")); + test(ssso.value[0][1][0].equals("xyz")); + test(ssso.value[1][0][0].equals("hello")); + test(ssso.value[2][0][0].equals("")); + test(ssso.value[2][0][1].equals("")); + test(ssso.value[2][1][0].equals("abcd")); + test(ssso.value[3][0][0].equals("")); + + test(rsso.length == 3); + test(rsso[0].length == 0); + test(rsso[1].length == 1); + test(rsso[1][0].length == 1); + test(rsso[2].length == 2); + test(rsso[2][0].length == 2); + test(rsso[2][1].length == 1); + test(rsso[1][0][0].equals("")); + test(rsso[2][0][0].equals("")); + test(rsso[2][0][1].equals("")); + test(rsso[2][1][0].equals("abcd")); + } { java.util.Map di1 = new java.util.HashMap(); @@ -579,153 +579,153 @@ class Twoways } { - int[] lengths = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 }; - - for(int l = 0; l < lengths.length; ++l) - { - int[] s = new int[lengths[l]]; - for(int i = 0; i < lengths[l]; ++i) - { - s[i] = i; - } - int[] r = p.opIntS(s); - test(r.length == lengths[l]); - for(int j = 0; j < r.length; ++j) - { - test(r[j] == -j); - } - } + int[] lengths = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 }; + + for(int l = 0; l < lengths.length; ++l) + { + int[] s = new int[lengths[l]]; + for(int i = 0; i < lengths[l]; ++i) + { + s[i] = i; + } + int[] r = p.opIntS(s); + test(r.length == lengths[l]); + for(int j = 0; j < r.length; ++j) + { + test(r[j] == -j); + } + } } - { - java.util.HashMap ctx = new java.util.HashMap(); - ctx.put("one", "ONE"); - ctx.put("two", "TWO"); - ctx.put("three", "THREE"); - { - test(p.ice_getContext().isEmpty()); - java.util.Map r = p.opContext(); - test(!r.equals(ctx)); - } - { - java.util.Map r = p.opContext(ctx); - test(p.ice_getContext().isEmpty()); - test(r.equals(ctx)); - } - { - Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx)); - test(p2.ice_getContext().equals(ctx)); - java.util.Map r = p2.opContext(); - test(r.equals(ctx)); - r = p2.opContext(ctx); - test(r.equals(ctx)); - } - { - // - // Test that default context is obtained correctly from communicator. - // + { + java.util.HashMap ctx = new java.util.HashMap(); + ctx.put("one", "ONE"); + ctx.put("two", "TWO"); + ctx.put("three", "THREE"); + { + test(p.ice_getContext().isEmpty()); + java.util.Map r = p.opContext(); + test(!r.equals(ctx)); + } + { + java.util.Map r = p.opContext(ctx); + test(p.ice_getContext().isEmpty()); + test(r.equals(ctx)); + } + { + Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx)); + test(p2.ice_getContext().equals(ctx)); + java.util.Map r = p2.opContext(); + test(r.equals(ctx)); + r = p2.opContext(ctx); + test(r.equals(ctx)); + } + { + // + // Test that default context is obtained correctly from communicator. + // /* DEPRECATED - java.util.HashMap dflt = new java.util.HashMap(); - dflt.put("a", "b"); - communicator.setDefaultContext(dflt); - test(!p.opContext().equals(dflt)); + java.util.HashMap dflt = new java.util.HashMap(); + dflt.put("a", "b"); + communicator.setDefaultContext(dflt); + test(!p.opContext().equals(dflt)); - Test.MyClassPrx p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_context(new java.util.HashMap())); - test(p2.opContext().isEmpty()); + Test.MyClassPrx p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_context(new java.util.HashMap())); + test(p2.opContext().isEmpty()); - p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_defaultContext()); - test(p2.opContext().equals(dflt)); + p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_defaultContext()); + test(p2.opContext().equals(dflt)); - communicator.setDefaultContext(new java.util.HashMap()); - test(!p2.opContext().isEmpty()); + 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")); - test(c.opContext().equals(dflt)); + communicator.setDefaultContext(dflt); + Test.MyClassPrx c = Test.MyClassPrxHelper.checkedCast( + communicator.stringToProxy("test:default -p 12010 -t 10000")); + test(c.opContext().equals(dflt)); - dflt.put("a", "c"); - Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_context(dflt)); - test(c2.opContext().get("a").equals("c")); + dflt.put("a", "c"); + Test.MyClassPrx c2 = Test.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)); - test(c3.opContext().get("a") == null); + dflt.clear(); + Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_context(dflt)); + test(c3.opContext().get("a") == null); - Test.MyClassPrx c4 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_defaultContext()); - test(c4.opContext().get("a").equals("b")); + Test.MyClassPrx c4 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_defaultContext()); + test(c4.opContext().get("a").equals("b")); - dflt.put("a", "d"); - communicator.setDefaultContext(dflt); + dflt.put("a", "d"); + communicator.setDefaultContext(dflt); - Test.MyClassPrx c5 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_defaultContext()); - test(c5.opContext().get("a").equals("d")); + Test.MyClassPrx c5 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_defaultContext()); + test(c5.opContext().get("a").equals("d")); - communicator.setDefaultContext(new java.util.HashMap()); + communicator.setDefaultContext(new java.util.HashMap()); */ - } - } - { - // - // Test implicit context propagation - // - - String[] impls = {"Shared", "SharedWithoutLocking", "PerThread"}; - for(int i = 0; i < 3; i++) - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = communicator.getProperties()._clone(); - initData.properties.setProperty("Ice.ImplicitContext", impls[i]); - - Ice.Communicator ic = Ice.Util.initialize(initData); - - java.util.Map ctx = new java.util.HashMap(); - 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")); - - ic.getImplicitContext().setContext(ctx); - test(ic.getImplicitContext().getContext().equals(ctx)); - test(p3.opContext().equals(ctx)); - - ic.getImplicitContext().set("zero", "ZERO"); - test(ic.getImplicitContext().get("zero").equals("ZERO")); - test(ic.getImplicitContext().getWithDefault("foobar", "foo").equals("foo")); - - ctx = ic.getImplicitContext().getContext(); - test(p3.opContext().equals(ctx)); - - java.util.Map prxContext = new java.util.HashMap(); - prxContext.put("one", "UN"); - prxContext.put("four", "QUATRE"); - - java.util.Map combined = new java.util.HashMap(ctx); - combined.putAll(prxContext); - test(combined.get("one").equals("UN")); - - p3 = Test.MyClassPrxHelper.uncheckedCast(p3.ice_context(prxContext)); - - ic.getImplicitContext().setContext(null); - test(p3.opContext().equals(prxContext)); - - ic.getImplicitContext().setContext(ctx); - test(p3.opContext().equals(combined)); - - ic.destroy(); - } - } - - { - double d = 1278312346.0 / 13.0; - double[] ds = new double[5]; - for(int i = 0; i < 5; i++) - { - ds[i] = d; - } - p.opDoubleMarshaling(d, ds); - } + } + } + { + // + // Test implicit context propagation + // + + String[] impls = {"Shared", "SharedWithoutLocking", "PerThread"}; + for(int i = 0; i < 3; i++) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = communicator.getProperties()._clone(); + initData.properties.setProperty("Ice.ImplicitContext", impls[i]); + + Ice.Communicator ic = Ice.Util.initialize(initData); + + java.util.Map ctx = new java.util.HashMap(); + 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")); + + ic.getImplicitContext().setContext(ctx); + test(ic.getImplicitContext().getContext().equals(ctx)); + test(p3.opContext().equals(ctx)); + + ic.getImplicitContext().set("zero", "ZERO"); + test(ic.getImplicitContext().get("zero").equals("ZERO")); + test(ic.getImplicitContext().getWithDefault("foobar", "foo").equals("foo")); + + ctx = ic.getImplicitContext().getContext(); + test(p3.opContext().equals(ctx)); + + java.util.Map prxContext = new java.util.HashMap(); + prxContext.put("one", "UN"); + prxContext.put("four", "QUATRE"); + + java.util.Map combined = new java.util.HashMap(ctx); + combined.putAll(prxContext); + test(combined.get("one").equals("UN")); + + p3 = Test.MyClassPrxHelper.uncheckedCast(p3.ice_context(prxContext)); + + ic.getImplicitContext().setContext(null); + test(p3.opContext().equals(prxContext)); + + ic.getImplicitContext().setContext(ctx); + test(p3.opContext().equals(combined)); + + ic.destroy(); + } + } + + { + double d = 1278312346.0 / 13.0; + double[] ds = new double[5]; + for(int i = 0; i < 5; i++) + { + ds[i] = d; + } + p.opDoubleMarshaling(d, ds); + } } } diff --git a/java/test/Ice/operations/TwowaysAMI.java b/java/test/Ice/operations/TwowaysAMI.java index 1d59123bec9..83b78ff912d 100644 --- a/java/test/Ice/operations/TwowaysAMI.java +++ b/java/test/Ice/operations/TwowaysAMI.java @@ -20,473 +20,473 @@ class TwowaysAMI private static class Callback { - Callback() - { - _called = false; - } - - public synchronized boolean - check() - { - while(!_called) - { - try - { - wait(5000); - } - catch(InterruptedException ex) - { - continue; - } - - if(!_called) - { - return false; // Must be timeout. - } - } - - _called = false; - return true; - } - - public synchronized void - called() - { - assert(!_called); - _called = true; - notify(); - } - - private boolean _called; + Callback() + { + _called = false; + } + + public synchronized boolean + check() + { + while(!_called) + { + try + { + wait(5000); + } + catch(InterruptedException ex) + { + continue; + } + + if(!_called) + { + return false; // Must be timeout. + } + } + + _called = false; + return true; + } + + public synchronized void + called() + { + assert(!_called); + _called = true; + notify(); + } + + private boolean _called; } private static class AMI_MyClass_opVoidI extends Test.AMI_MyClass_opVoid { - public void - ice_response() - { - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opVoidExI extends Test.AMI_MyClass_opVoid { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(ex instanceof Ice.TwowayOnlyException); - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(ex instanceof Ice.TwowayOnlyException); + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opByteI extends Test.AMI_MyClass_opByte { - public void - ice_response(byte r, byte b) - { - test(b == (byte)0xf0); - test(r == (byte)0xff); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response(byte r, byte b) + { + test(b == (byte)0xf0); + test(r == (byte)0xff); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opByteExI extends Test.AMI_MyClass_opByte { - public void - ice_response(byte r, byte b) - { - test(false); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(ex instanceof Ice.TwowayOnlyException); - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response(byte r, byte b) + { + test(false); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(ex instanceof Ice.TwowayOnlyException); + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opBoolI extends Test.AMI_MyClass_opBool { - public void - ice_response(boolean r, boolean b) - { - test(b); - test(!r); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response(boolean r, boolean b) + { + test(b); + test(!r); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opShortIntLongI extends Test.AMI_MyClass_opShortIntLong { - public void - ice_response(long r, short s, int i, long l) - { - test(s == 10); - test(i == 11); - test(l == 12); - test(r == 12); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response(long r, short s, int i, long l) + { + test(s == 10); + test(i == 11); + test(l == 12); + test(r == 12); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opFloatDoubleI extends Test.AMI_MyClass_opFloatDouble { - public void - ice_response(double r, float f, double d) - { - test(f == 3.14f); - test(d == 1.1E10); - test(r == 1.1E10); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response(double r, float f, double d) + { + test(f == 3.14f); + test(d == 1.1E10); + test(r == 1.1E10); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opStringI extends Test.AMI_MyClass_opString { - public void - ice_response(String r, String s) - { - test(s.equals("world hello")); - test(r.equals("hello world")); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response(String r, String s) + { + test(s.equals("world hello")); + test(r.equals("hello world")); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opMyEnumI extends Test.AMI_MyClass_opMyEnum { - public void - ice_response(Test.MyEnum r, Test.MyEnum e) - { + public void + ice_response(Test.MyEnum r, Test.MyEnum e) + { test(e == Test.MyEnum.enum2); test(r == Test.MyEnum.enum3); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opMyClassI extends Test.AMI_MyClass_opMyClass { AMI_MyClass_opMyClassI(Ice.Communicator communicator) - { - _communicator = communicator; - } + { + _communicator = communicator; + } - public void - ice_response(Test.MyClassPrx r, Test.MyClassPrx c1, Test.MyClassPrx c2) - { + public void + ice_response(Test.MyClassPrx r, Test.MyClassPrx c1, Test.MyClassPrx c2) + { test(c1.ice_getIdentity().equals(_communicator.stringToIdentity("test"))); test(c2.ice_getIdentity().equals(_communicator.stringToIdentity("noSuchIdentity"))); test(r.ice_getIdentity().equals(_communicator.stringToIdentity("test"))); - // We can't do the callbacks below in thread per connection mode. - if(_communicator.getProperties().getPropertyAsInt("Ice.ThreadPerConnection") == 0) - { - r.opVoid(); - c1.opVoid(); - try - { - c2.opVoid(); - test(false); - } - catch(Ice.ObjectNotExistException ex) - { - } - } - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - private Ice.Communicator _communicator; + // We can't do the callbacks below in thread per connection mode. + if(_communicator.getProperties().getPropertyAsInt("Ice.ThreadPerConnection") == 0) + { + r.opVoid(); + c1.opVoid(); + try + { + c2.opVoid(); + test(false); + } + catch(Ice.ObjectNotExistException ex) + { + } + } + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); + private Ice.Communicator _communicator; } private static class AMI_MyClass_opStructI extends Test.AMI_MyClass_opStruct { - AMI_MyClass_opStructI(Ice.Communicator communicator) - { - _communicator = communicator; - } - - public void - ice_response(Test.Structure rso, Test.Structure so) - { + AMI_MyClass_opStructI(Ice.Communicator communicator) + { + _communicator = communicator; + } + + public void + ice_response(Test.Structure rso, Test.Structure so) + { test(rso.p == null); test(rso.e == Test.MyEnum.enum2); test(rso.s.s.equals("def")); test(so.e == Test.MyEnum.enum3); test(so.s.s.equals("a new string")); - // We can't do the callbacks below in thread per connection mode. - if(_communicator.getProperties().getPropertyAsInt("Ice.ThreadPerConnection") == 0) - { - so.p.opVoid(); - } - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - private Ice.Communicator _communicator; + // We can't do the callbacks below in thread per connection mode. + if(_communicator.getProperties().getPropertyAsInt("Ice.ThreadPerConnection") == 0) + { + so.p.opVoid(); + } + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); + private Ice.Communicator _communicator; } private static class AMI_MyClass_opByteSI extends Test.AMI_MyClass_opByteS { - public void - ice_response(byte[] rso, byte[] bso) - { - test(bso.length == 4); - test(bso[0] == (byte)0x22); - test(bso[1] == (byte)0x12); - test(bso[2] == (byte)0x11); - test(bso[3] == (byte)0x01); - test(rso.length == 8); - test(rso[0] == (byte)0x01); - test(rso[1] == (byte)0x11); - test(rso[2] == (byte)0x12); - test(rso[3] == (byte)0x22); - test(rso[4] == (byte)0xf1); - test(rso[5] == (byte)0xf2); - test(rso[6] == (byte)0xf3); - test(rso[7] == (byte)0xf4); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response(byte[] rso, byte[] bso) + { + test(bso.length == 4); + test(bso[0] == (byte)0x22); + test(bso[1] == (byte)0x12); + test(bso[2] == (byte)0x11); + test(bso[3] == (byte)0x01); + test(rso.length == 8); + test(rso[0] == (byte)0x01); + test(rso[1] == (byte)0x11); + test(rso[2] == (byte)0x12); + test(rso[3] == (byte)0x22); + test(rso[4] == (byte)0xf1); + test(rso[5] == (byte)0xf2); + test(rso[6] == (byte)0xf3); + test(rso[7] == (byte)0xf4); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opBoolSI extends Test.AMI_MyClass_opBoolS { - public void - ice_response(boolean[] rso, boolean[] bso) - { - test(bso.length == 4); - test(bso[0]); - test(bso[1]); - test(!bso[2]); - test(!bso[3]); - test(rso.length == 3); - test(!rso[0]); - test(rso[1]); - test(rso[2]); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response(boolean[] rso, boolean[] bso) + { + test(bso.length == 4); + test(bso[0]); + test(bso[1]); + test(!bso[2]); + test(!bso[3]); + test(rso.length == 3); + test(!rso[0]); + test(rso[1]); + test(rso[2]); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opShortIntLongSI extends Test.AMI_MyClass_opShortIntLongS { - public void - ice_response(long[] rso, short[] sso, int[] iso, - long[] lso) - { - test(sso.length == 3); - test(sso[0] == 1); - test(sso[1] == 2); - test(sso[2] == 3); - test(iso.length == 4); - test(iso[0] == 8); - test(iso[1] == 7); - test(iso[2] == 6); - test(iso[3] == 5); - test(lso.length == 6); - test(lso[0] == 10); - test(lso[1] == 30); - test(lso[2] == 20); - test(lso[3] == 10); - test(lso[4] == 30); - test(lso[5] == 20); - test(rso.length == 3); - test(rso[0] == 10); - test(rso[1] == 30); - test(rso[2] == 20); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response(long[] rso, short[] sso, int[] iso, + long[] lso) + { + test(sso.length == 3); + test(sso[0] == 1); + test(sso[1] == 2); + test(sso[2] == 3); + test(iso.length == 4); + test(iso[0] == 8); + test(iso[1] == 7); + test(iso[2] == 6); + test(iso[3] == 5); + test(lso.length == 6); + test(lso[0] == 10); + test(lso[1] == 30); + test(lso[2] == 20); + test(lso[3] == 10); + test(lso[4] == 30); + test(lso[5] == 20); + test(rso.length == 3); + test(rso[0] == 10); + test(rso[1] == 30); + test(rso[2] == 20); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opFloatDoubleSI extends Test.AMI_MyClass_opFloatDoubleS { - public void - ice_response(double[] rso, float[] fso, double[] dso) - { + public void + ice_response(double[] rso, float[] fso, double[] dso) + { test(fso.length == 2); test(fso[0] == 3.14f); test(fso[1] == 1.11f); @@ -500,29 +500,29 @@ class TwowaysAMI test(rso[2] == 1.3E10); test((float)rso[3] == 3.14f); test((float)rso[4] == 1.11f); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opStringSI extends Test.AMI_MyClass_opStringS { - public void - ice_response(String[] rso, String[] sso) - { + public void + ice_response(String[] rso, String[] sso) + { test(sso.length == 4); test(sso[0].equals("abc")); test(sso[1].equals("de")); @@ -532,160 +532,160 @@ class TwowaysAMI test(rso[0].equals("fghi")); test(rso[1].equals("de")); test(rso[2].equals("abc")); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opByteSSI extends Test.AMI_MyClass_opByteSS { - public void - ice_response(byte[][] rso, byte[][] bso) - { - test(bso.length == 2); - test(bso[0].length == 1); - test(bso[0][0] == (byte)0xff); - test(bso[1].length == 3); - test(bso[1][0] == (byte)0x01); - test(bso[1][1] == (byte)0x11); - test(bso[1][2] == (byte)0x12); - test(rso.length == 4); - test(rso[0].length == 3); - test(rso[0][0] == (byte)0x01); - test(rso[0][1] == (byte)0x11); - test(rso[0][2] == (byte)0x12); - test(rso[1].length == 1); - test(rso[1][0] == (byte)0xff); - test(rso[2].length == 1); - test(rso[2][0] == (byte)0x0e); - test(rso[3].length == 2); - test(rso[3][0] == (byte)0xf2); - test(rso[3][1] == (byte)0xf1); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response(byte[][] rso, byte[][] bso) + { + test(bso.length == 2); + test(bso[0].length == 1); + test(bso[0][0] == (byte)0xff); + test(bso[1].length == 3); + test(bso[1][0] == (byte)0x01); + test(bso[1][1] == (byte)0x11); + test(bso[1][2] == (byte)0x12); + test(rso.length == 4); + test(rso[0].length == 3); + test(rso[0][0] == (byte)0x01); + test(rso[0][1] == (byte)0x11); + test(rso[0][2] == (byte)0x12); + test(rso[1].length == 1); + test(rso[1][0] == (byte)0xff); + test(rso[2].length == 1); + test(rso[2][0] == (byte)0x0e); + test(rso[3].length == 2); + test(rso[3][0] == (byte)0xf2); + test(rso[3][1] == (byte)0xf1); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opBoolSSI extends Test.AMI_MyClass_opBoolSS { - public void - ice_response(boolean[][] rso, boolean[][] bso) - { - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response(boolean[][] rso, boolean[][] bso) + { + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opShortIntLongSSI extends Test.AMI_MyClass_opShortIntLongSS { - public void - ice_response(long[][] rso, short[][] sso, int[][] iso, long[][] lso) - { - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response(long[][] rso, short[][] sso, int[][] iso, long[][] lso) + { + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opFloatDoubleSSI extends Test.AMI_MyClass_opFloatDoubleSS { - public void - ice_response(double[][] rso, float[][] fso, double[][] dso) - { - test(fso.length == 3); - test(fso[0].length == 1); - test(fso[0][0] == 3.14f); - test(fso[1].length == 1); - test(fso[1][0] == 1.11f); - test(fso[2].length == 0); - test(dso.length == 1); - test(dso[0].length == 3); - test(dso[0][0] == 1.1E10); - test(dso[0][1] == 1.2E10); - test(dso[0][2] == 1.3E10); - test(rso.length == 2); - test(rso[0].length == 3); - test(rso[0][0] == 1.1E10); - test(rso[0][1] == 1.2E10); - test(rso[0][2] == 1.3E10); - test(rso[1].length == 3); - test(rso[1][0] == 1.1E10); - test(rso[1][1] == 1.2E10); - test(rso[1][2] == 1.3E10); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response(double[][] rso, float[][] fso, double[][] dso) + { + test(fso.length == 3); + test(fso[0].length == 1); + test(fso[0][0] == 3.14f); + test(fso[1].length == 1); + test(fso[1][0] == 1.11f); + test(fso[2].length == 0); + test(dso.length == 1); + test(dso[0].length == 3); + test(dso[0][0] == 1.1E10); + test(dso[0][1] == 1.2E10); + test(dso[0][2] == 1.3E10); + test(rso.length == 2); + test(rso[0].length == 3); + test(rso[0][0] == 1.1E10); + test(rso[0][1] == 1.2E10); + test(rso[0][2] == 1.3E10); + test(rso[1].length == 3); + test(rso[1][0] == 1.1E10); + test(rso[1][1] == 1.2E10); + test(rso[1][2] == 1.3E10); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opStringSSI extends Test.AMI_MyClass_opStringSS { - public void - ice_response(String[][] rso, String[][] sso) - { + public void + ice_response(String[][] rso, String[][] sso) + { test(sso.length == 5); test(sso[0].length == 1); test(sso[0][0].equals("abc")); @@ -701,84 +701,84 @@ class TwowaysAMI test(rso[0][0].equals("xyz")); test(rso[1].length == 0); test(rso[2].length == 0); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opStringSSSI extends Test.AMI_MyClass_opStringSSS { - public void - ice_response(String[][][] rsso, String[][][] ssso) - { - test(ssso.length == 5); - test(ssso[0].length == 2); - test(ssso[0][0].length == 2); - test(ssso[0][1].length == 1); - test(ssso[1].length == 1); - test(ssso[1][0].length == 1); - test(ssso[2].length == 2); - test(ssso[2][0].length == 2); - test(ssso[2][1].length == 1); - test(ssso[3].length == 1); - test(ssso[3][0].length == 1); - test(ssso[4].length == 0); - test(ssso[0][0][0].equals("abc")); - test(ssso[0][0][1].equals("de")); - test(ssso[0][1][0].equals("xyz")); - test(ssso[1][0][0].equals("hello")); - test(ssso[2][0][0].equals("")); - test(ssso[2][0][1].equals("")); - test(ssso[2][1][0].equals("abcd")); - test(ssso[3][0][0].equals("")); - - test(rsso.length == 3); - test(rsso[0].length == 0); - test(rsso[1].length == 1); - test(rsso[1][0].length == 1); - test(rsso[2].length == 2); - test(rsso[2][0].length == 2); - test(rsso[2][1].length == 1); - test(rsso[1][0][0].equals("")); - test(rsso[2][0][0].equals("")); - test(rsso[2][0][1].equals("")); - test(rsso[2][1][0].equals("abcd")); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response(String[][][] rsso, String[][][] ssso) + { + test(ssso.length == 5); + test(ssso[0].length == 2); + test(ssso[0][0].length == 2); + test(ssso[0][1].length == 1); + test(ssso[1].length == 1); + test(ssso[1][0].length == 1); + test(ssso[2].length == 2); + test(ssso[2][0].length == 2); + test(ssso[2][1].length == 1); + test(ssso[3].length == 1); + test(ssso[3][0].length == 1); + test(ssso[4].length == 0); + test(ssso[0][0][0].equals("abc")); + test(ssso[0][0][1].equals("de")); + test(ssso[0][1][0].equals("xyz")); + test(ssso[1][0][0].equals("hello")); + test(ssso[2][0][0].equals("")); + test(ssso[2][0][1].equals("")); + test(ssso[2][1][0].equals("abcd")); + test(ssso[3][0][0].equals("")); + + test(rsso.length == 3); + test(rsso[0].length == 0); + test(rsso[1].length == 1); + test(rsso[1][0].length == 1); + test(rsso[2].length == 2); + test(rsso[2][0].length == 2); + test(rsso[2][1].length == 1); + test(rsso[1][0][0].equals("")); + test(rsso[2][0][0].equals("")); + test(rsso[2][0][1].equals("")); + test(rsso[2][1][0].equals("abcd")); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opByteBoolDI extends Test.AMI_MyClass_opByteBoolD { - public void - ice_response(java.util.Map ro, java.util.Map _do) - { + public void + ice_response(java.util.Map ro, java.util.Map _do) + { java.util.Map di1 = new java.util.HashMap(); di1.put(new Byte((byte)10), Boolean.TRUE); di1.put(new Byte((byte)100), Boolean.FALSE); @@ -788,29 +788,29 @@ class TwowaysAMI test(((Boolean)ro.get(new Byte((byte)11))).booleanValue() == false); test(((Boolean)ro.get(new Byte((byte)100))).booleanValue() == false); test(((Boolean)ro.get(new Byte((byte)101))).booleanValue() == true); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opShortIntDI extends Test.AMI_MyClass_opShortIntD { - public void - ice_response(java.util.Map ro, java.util.Map _do) - { + public void + ice_response(java.util.Map ro, java.util.Map _do) + { java.util.Map di1 = new java.util.HashMap(); di1.put(new Short((short)110), new Integer(-1)); di1.put(new Short((short)1100), new Integer(123123)); @@ -820,29 +820,29 @@ class TwowaysAMI test(((Integer)ro.get(new Short((short)111))).intValue() == -100); test(((Integer)ro.get(new Short((short)1100))).intValue() == 123123); test(((Integer)ro.get(new Short((short)1101))).intValue() == 0); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opLongFloatDI extends Test.AMI_MyClass_opLongFloatD { - public void - ice_response(java.util.Map ro, java.util.Map _do) - { + public void + ice_response(java.util.Map ro, java.util.Map _do) + { java.util.Map di1 = new java.util.HashMap(); di1.put(new Long(999999110L), new Float(-1.1f)); di1.put(new Long(999999111L), new Float(123123.2f)); @@ -852,29 +852,29 @@ class TwowaysAMI test(((Float)ro.get(new Long(999999120L))).floatValue() == -100.4f); test(((Float)ro.get(new Long(999999111L))).floatValue() == 123123.2f); test(((Float)ro.get(new Long(999999130L))).floatValue() == 0.5f); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opStringStringDI extends Test.AMI_MyClass_opStringStringD { - public void - ice_response(java.util.Map ro, java.util.Map _do) - { + public void + ice_response(java.util.Map ro, java.util.Map _do) + { java.util.Map di1 = new java.util.HashMap(); di1.put("foo", "abc -1.1"); di1.put("bar", "abc 123123.2"); @@ -884,29 +884,29 @@ class TwowaysAMI test(((String)ro.get("FOO")).equals("abc -100.4")); test(((String)ro.get("bar")).equals("abc 123123.2")); test(((String)ro.get("BAR")).equals("abc 0.5")); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opStringMyEnumDI extends Test.AMI_MyClass_opStringMyEnumD { - public void - ice_response(java.util.Map ro, java.util.Map _do) - { + public void + ice_response(java.util.Map ro, java.util.Map _do) + { java.util.Map di1 = new java.util.HashMap(); di1.put("abc", Test.MyEnum.enum1); di1.put("", Test.MyEnum.enum2); @@ -916,254 +916,254 @@ class TwowaysAMI test(((Test.MyEnum)ro.get("qwerty")) == Test.MyEnum.enum3); test(((Test.MyEnum)ro.get("")) == Test.MyEnum.enum2); test(((Test.MyEnum)ro.get("Hello!!")) == Test.MyEnum.enum2); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opIntSI extends Test.AMI_MyClass_opIntS { AMI_MyClass_opIntSI(int l) - { - _l = l; - } - - public void - ice_response(int[] r) - { - test(r.length == _l); - for(int j = 0; j < r.length; ++j) - { - test(r[j] == -j); - } - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private int _l; - private Callback callback = new Callback(); + { + _l = l; + } + + public void + ice_response(int[] r) + { + test(r.length == _l); + for(int j = 0; j < r.length; ++j) + { + test(r[j] == -j); + } + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private int _l; + private Callback callback = new Callback(); } private static class AMI_MyClass_opContextEqualI extends Test.AMI_MyClass_opContext { AMI_MyClass_opContextEqualI(java.util.Map d) - { - _d = d; - } - - public void - ice_response(java.util.Map r) - { - test(r.equals(_d)); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private java.util.Map _d; - private Callback callback = new Callback(); + { + _d = d; + } + + public void + ice_response(java.util.Map r) + { + test(r.equals(_d)); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private java.util.Map _d; + private Callback callback = new Callback(); } private static class AMI_MyClass_opContextNotEqualI extends Test.AMI_MyClass_opContext { AMI_MyClass_opContextNotEqualI(java.util.Map d) - { - _d = d; - } - - public void - ice_response(java.util.Map r) - { - test(!r.equals(_d)); - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private java.util.Map _d; - private Callback callback = new Callback(); + { + _d = d; + } + + public void + ice_response(java.util.Map r) + { + test(!r.equals(_d)); + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private java.util.Map _d; + private Callback callback = new Callback(); } private static class AMI_MyDerivedClass_opDerivedI extends Test.AMI_MyDerivedClass_opDerived { - public void - ice_response() - { - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_MyClass_opDoubleMarshalingI extends Test.AMI_MyClass_opDoubleMarshaling { - public void - ice_response() - { - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } static void twowaysAMI(Ice.Communicator communicator, Test.MyClassPrx p) { { - // Check that a call to a void operation raises TwowayOnlyException - // in the ice_exception() callback instead of at the point of call. - Test.MyClassPrx oneway = Test.MyClassPrxHelper.uncheckedCast(p.ice_oneway()); - AMI_MyClass_opVoidExI cb = new AMI_MyClass_opVoidExI(); - try - { - oneway.opVoid_async(cb); - } - catch(java.lang.Exception ex) - { - test(false); - } - test(cb.check()); - } - - { - // Check that a call to a twoway operation raises TwowayOnlyException - // in the ice_exception() callback instead of at the point of call. - Test.MyClassPrx oneway = Test.MyClassPrxHelper.uncheckedCast(p.ice_oneway()); - AMI_MyClass_opByteExI cb = new AMI_MyClass_opByteExI(); - try - { - oneway.opByte_async(cb, (byte)0, (byte)0); - } - catch(java.lang.Exception ex) - { - test(false); - } - test(cb.check()); - } - - { - AMI_MyClass_opVoidI cb = new AMI_MyClass_opVoidI(); - p.opVoid_async(cb); - test(cb.check()); - // Let's check if we can reuse the same callback object for another call. - p.opVoid_async(cb); - test(cb.check()); - } - - { - AMI_MyClass_opByteI cb = new AMI_MyClass_opByteI(); - p.opByte_async(cb, (byte)0xff, (byte)0x0f); - test(cb.check()); - } - - { - AMI_MyClass_opBoolI cb = new AMI_MyClass_opBoolI(); - p.opBool_async(cb, true, false); - test(cb.check()); - } - - { - AMI_MyClass_opShortIntLongI cb = new AMI_MyClass_opShortIntLongI(); - p.opShortIntLong_async(cb, (short)10, 11, 12L); - test(cb.check()); - } - - { - AMI_MyClass_opFloatDoubleI cb = new AMI_MyClass_opFloatDoubleI(); - p.opFloatDouble_async(cb, 3.14f, 1.1E10); - test(cb.check()); - // Let's check if we can reuse the same callback object for another call. - p.opFloatDouble_async(cb, 3.14f, 1.1E10); - test(cb.check()); - } - - { - AMI_MyClass_opStringI cb = new AMI_MyClass_opStringI(); - p.opString_async(cb, "hello", "world"); - test(cb.check()); - } - - { - AMI_MyClass_opMyEnumI cb = new AMI_MyClass_opMyEnumI(); - p.opMyEnum_async(cb, Test.MyEnum.enum2); - test(cb.check()); - } - - { - AMI_MyClass_opMyClassI cb = new AMI_MyClass_opMyClassI(communicator); - p.opMyClass_async(cb, p); - test(cb.check()); - } - - { + // Check that a call to a void operation raises TwowayOnlyException + // in the ice_exception() callback instead of at the point of call. + Test.MyClassPrx oneway = Test.MyClassPrxHelper.uncheckedCast(p.ice_oneway()); + AMI_MyClass_opVoidExI cb = new AMI_MyClass_opVoidExI(); + try + { + oneway.opVoid_async(cb); + } + catch(java.lang.Exception ex) + { + test(false); + } + test(cb.check()); + } + + { + // Check that a call to a twoway operation raises TwowayOnlyException + // in the ice_exception() callback instead of at the point of call. + Test.MyClassPrx oneway = Test.MyClassPrxHelper.uncheckedCast(p.ice_oneway()); + AMI_MyClass_opByteExI cb = new AMI_MyClass_opByteExI(); + try + { + oneway.opByte_async(cb, (byte)0, (byte)0); + } + catch(java.lang.Exception ex) + { + test(false); + } + test(cb.check()); + } + + { + AMI_MyClass_opVoidI cb = new AMI_MyClass_opVoidI(); + p.opVoid_async(cb); + test(cb.check()); + // Let's check if we can reuse the same callback object for another call. + p.opVoid_async(cb); + test(cb.check()); + } + + { + AMI_MyClass_opByteI cb = new AMI_MyClass_opByteI(); + p.opByte_async(cb, (byte)0xff, (byte)0x0f); + test(cb.check()); + } + + { + AMI_MyClass_opBoolI cb = new AMI_MyClass_opBoolI(); + p.opBool_async(cb, true, false); + test(cb.check()); + } + + { + AMI_MyClass_opShortIntLongI cb = new AMI_MyClass_opShortIntLongI(); + p.opShortIntLong_async(cb, (short)10, 11, 12L); + test(cb.check()); + } + + { + AMI_MyClass_opFloatDoubleI cb = new AMI_MyClass_opFloatDoubleI(); + p.opFloatDouble_async(cb, 3.14f, 1.1E10); + test(cb.check()); + // Let's check if we can reuse the same callback object for another call. + p.opFloatDouble_async(cb, 3.14f, 1.1E10); + test(cb.check()); + } + + { + AMI_MyClass_opStringI cb = new AMI_MyClass_opStringI(); + p.opString_async(cb, "hello", "world"); + test(cb.check()); + } + + { + AMI_MyClass_opMyEnumI cb = new AMI_MyClass_opMyEnumI(); + p.opMyEnum_async(cb, Test.MyEnum.enum2); + test(cb.check()); + } + + { + AMI_MyClass_opMyClassI cb = new AMI_MyClass_opMyClassI(communicator); + p.opMyClass_async(cb, p); + test(cb.check()); + } + + { Test.Structure si1 = new Test.Structure(); si1.p = p; si1.e = Test.MyEnum.enum3; @@ -1174,165 +1174,165 @@ class TwowaysAMI si2.e = Test.MyEnum.enum2; si2.s = new Test.AnotherStruct(); si2.s.s = "def"; - - AMI_MyClass_opStructI cb = new AMI_MyClass_opStructI(communicator); - p.opStruct_async(cb, si1, si2); - test(cb.check()); - } - - { + + AMI_MyClass_opStructI cb = new AMI_MyClass_opStructI(communicator); + p.opStruct_async(cb, si1, si2); + test(cb.check()); + } + + { final byte[] bsi1 = - { - (byte)0x01, - (byte)0x11, - (byte)0x12, - (byte)0x22 - }; + { + (byte)0x01, + (byte)0x11, + (byte)0x12, + (byte)0x22 + }; final byte[] bsi2 = - { - (byte)0xf1, - (byte)0xf2, - (byte)0xf3, - (byte)0xf4 - }; - - AMI_MyClass_opByteSI cb = new AMI_MyClass_opByteSI(); - p.opByteS_async(cb, bsi1, bsi2); - test(cb.check()); - } - - { + { + (byte)0xf1, + (byte)0xf2, + (byte)0xf3, + (byte)0xf4 + }; + + AMI_MyClass_opByteSI cb = new AMI_MyClass_opByteSI(); + p.opByteS_async(cb, bsi1, bsi2); + test(cb.check()); + } + + { final boolean[] bsi1 = { true, true, false }; final boolean[] bsi2 = { false }; - - AMI_MyClass_opBoolSI cb = new AMI_MyClass_opBoolSI(); - p.opBoolS_async(cb, bsi1, bsi2); - test(cb.check()); - } - - { + + AMI_MyClass_opBoolSI cb = new AMI_MyClass_opBoolSI(); + p.opBoolS_async(cb, bsi1, bsi2); + test(cb.check()); + } + + { final short[] ssi = { 1, 2, 3 }; final int[] isi = { 5, 6, 7, 8 }; final long[] lsi = { 10, 30, 20 }; - - AMI_MyClass_opShortIntLongSI cb = new AMI_MyClass_opShortIntLongSI(); - p.opShortIntLongS_async(cb, ssi, isi, lsi); - test(cb.check()); - } - - { + + AMI_MyClass_opShortIntLongSI cb = new AMI_MyClass_opShortIntLongSI(); + p.opShortIntLongS_async(cb, ssi, isi, lsi); + test(cb.check()); + } + + { final float[] fsi = { 3.14f, 1.11f }; final double[] dsi = { 1.1E10, 1.2E10, 1.3E10 }; - - AMI_MyClass_opFloatDoubleSI cb = new AMI_MyClass_opFloatDoubleSI(); - p.opFloatDoubleS_async(cb, fsi, dsi); - test(cb.check()); - } - - { + + AMI_MyClass_opFloatDoubleSI cb = new AMI_MyClass_opFloatDoubleSI(); + p.opFloatDoubleS_async(cb, fsi, dsi); + test(cb.check()); + } + + { final String[] ssi1 = { "abc", "de", "fghi" }; final String[] ssi2 = { "xyz" }; - - AMI_MyClass_opStringSI cb = new AMI_MyClass_opStringSI(); - p.opStringS_async(cb, ssi1, ssi2); - test(cb.check()); - } - - { + + AMI_MyClass_opStringSI cb = new AMI_MyClass_opStringSI(); + p.opStringS_async(cb, ssi1, ssi2); + test(cb.check()); + } + + { final byte[][] bsi1 = - { - { (byte)0x01, (byte)0x11, (byte)0x12 }, - { (byte)0xff } - }; + { + { (byte)0x01, (byte)0x11, (byte)0x12 }, + { (byte)0xff } + }; final byte[][] bsi2 = - { - { (byte)0x0e }, - { (byte)0xf2, (byte)0xf1 } - }; - - AMI_MyClass_opByteSSI cb = new AMI_MyClass_opByteSSI(); - p.opByteSS_async(cb, bsi1, bsi2); - test(cb.check()); - } + { + { (byte)0x0e }, + { (byte)0xf2, (byte)0xf1 } + }; + + AMI_MyClass_opByteSSI cb = new AMI_MyClass_opByteSSI(); + p.opByteSS_async(cb, bsi1, bsi2); + test(cb.check()); + } - { + { final float[][] fsi = - { - { 3.14f }, - { 1.11f }, - { }, - }; + { + { 3.14f }, + { 1.11f }, + { }, + }; final double[][] dsi = - { - { 1.1E10, 1.2E10, 1.3E10 } - }; + { + { 1.1E10, 1.2E10, 1.3E10 } + }; - AMI_MyClass_opFloatDoubleSSI cb = new AMI_MyClass_opFloatDoubleSSI(); - p.opFloatDoubleSS_async(cb, fsi, dsi); - test(cb.check()); - } + AMI_MyClass_opFloatDoubleSSI cb = new AMI_MyClass_opFloatDoubleSSI(); + p.opFloatDoubleSS_async(cb, fsi, dsi); + test(cb.check()); + } - { + { final String[][] ssi1 = - { - { "abc" }, - { "de", "fghi" } - }; + { + { "abc" }, + { "de", "fghi" } + }; final String[][] ssi2 = - { - { }, - { }, - { "xyz" } - }; - - AMI_MyClass_opStringSSI cb = new AMI_MyClass_opStringSSI(); - p.opStringSS_async(cb, ssi1, ssi2); - test(cb.check()); - } - - { - final String[][][] sssi1 = - { - { - { - "abc", "de" - }, - { - "xyz" - } - }, - { - { - "hello" - } - } - }; - - final String[][][] sssi2 = - { - { - { - "", "" - }, - { - "abcd" - } - }, - { - { - "" - } - }, - { - } - }; - - AMI_MyClass_opStringSSSI cb = new AMI_MyClass_opStringSSSI(); - p.opStringSSS_async(cb, sssi1, sssi2); - test(cb.check()); - } - - { + { + { }, + { }, + { "xyz" } + }; + + AMI_MyClass_opStringSSI cb = new AMI_MyClass_opStringSSI(); + p.opStringSS_async(cb, ssi1, ssi2); + test(cb.check()); + } + + { + final String[][][] sssi1 = + { + { + { + "abc", "de" + }, + { + "xyz" + } + }, + { + { + "hello" + } + } + }; + + final String[][][] sssi2 = + { + { + { + "", "" + }, + { + "abcd" + } + }, + { + { + "" + } + }, + { + } + }; + + AMI_MyClass_opStringSSSI cb = new AMI_MyClass_opStringSSSI(); + p.opStringSSS_async(cb, sssi1, sssi2); + test(cb.check()); + } + + { java.util.Map di1 = new java.util.HashMap(); di1.put(new Byte((byte)10), Boolean.TRUE); di1.put(new Byte((byte)100), Boolean.FALSE); @@ -1341,12 +1341,12 @@ class TwowaysAMI di2.put(new Byte((byte)11), Boolean.FALSE); di2.put(new Byte((byte)101), Boolean.TRUE); - AMI_MyClass_opByteBoolDI cb = new AMI_MyClass_opByteBoolDI(); - p.opByteBoolD_async(cb, di1, di2); - test(cb.check()); - } + AMI_MyClass_opByteBoolDI cb = new AMI_MyClass_opByteBoolDI(); + p.opByteBoolD_async(cb, di1, di2); + test(cb.check()); + } - { + { java.util.Map di1 = new java.util.HashMap(); di1.put(new Short((short)110), new Integer(-1)); di1.put(new Short((short)1100), new Integer(123123)); @@ -1355,12 +1355,12 @@ class TwowaysAMI di2.put(new Short((short)111), new Integer(-100)); di2.put(new Short((short)1101), new Integer(0)); - AMI_MyClass_opShortIntDI cb = new AMI_MyClass_opShortIntDI(); - p.opShortIntD_async(cb, di1, di2); - test(cb.check()); - } + AMI_MyClass_opShortIntDI cb = new AMI_MyClass_opShortIntDI(); + p.opShortIntD_async(cb, di1, di2); + test(cb.check()); + } - { + { java.util.Map di1 = new java.util.HashMap(); di1.put(new Long(999999110L), new Float(-1.1f)); di1.put(new Long(999999111L), new Float(123123.2f)); @@ -1369,12 +1369,12 @@ class TwowaysAMI di2.put(new Long(999999120L), new Float(-100.4f)); di2.put(new Long(999999130L), new Float(0.5f)); - AMI_MyClass_opLongFloatDI cb = new AMI_MyClass_opLongFloatDI(); - p.opLongFloatD_async(cb, di1, di2); - test(cb.check()); - } + AMI_MyClass_opLongFloatDI cb = new AMI_MyClass_opLongFloatDI(); + p.opLongFloatD_async(cb, di1, di2); + test(cb.check()); + } - { + { java.util.Map di1 = new java.util.HashMap(); di1.put("foo", "abc -1.1"); di1.put("bar", "abc 123123.2"); @@ -1383,12 +1383,12 @@ class TwowaysAMI di2.put("FOO", "abc -100.4"); di2.put("BAR", "abc 0.5"); - AMI_MyClass_opStringStringDI cb = new AMI_MyClass_opStringStringDI(); - p.opStringStringD_async(cb, di1, di2); - test(cb.check()); - } + AMI_MyClass_opStringStringDI cb = new AMI_MyClass_opStringStringDI(); + p.opStringStringD_async(cb, di1, di2); + test(cb.check()); + } - { + { java.util.Map di1 = new java.util.HashMap(); di1.put("abc", Test.MyEnum.enum1); di1.put("", Test.MyEnum.enum2); @@ -1397,235 +1397,235 @@ class TwowaysAMI di2.put("qwerty", Test.MyEnum.enum3); di2.put("Hello!!", Test.MyEnum.enum2); - AMI_MyClass_opStringMyEnumDI cb = new AMI_MyClass_opStringMyEnumDI(); - p.opStringMyEnumD_async(cb, di1, di2); - test(cb.check()); - } - - { - int[] lengths = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 }; - - for(int l = 0; l < lengths.length; ++l) - { - int[] s = new int[lengths[l]]; - for(int i = 0; i < s.length; ++i) - { - s[i] = i; - } - AMI_MyClass_opIntSI cb = new AMI_MyClass_opIntSI(lengths[l]); - p.opIntS_async(cb, s); - test(cb.check()); - } - } - - { - java.util.Map ctx = new java.util.HashMap(); - ctx.put("one", "ONE"); - ctx.put("two", "TWO"); - ctx.put("three", "THREE"); - { - test(p.ice_getContext().isEmpty()); - AMI_MyClass_opContextNotEqualI cb = new AMI_MyClass_opContextNotEqualI(ctx); - p.opContext_async(cb); - test(cb.check()); - } - { - test(p.ice_getContext().isEmpty()); - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); - p.opContext_async(cb, ctx); - test(cb.check()); - } - Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx)); - test(p2.ice_getContext().equals(ctx)); - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); - p2.opContext_async(cb); - test(cb.check()); - } - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); - p2.opContext_async(cb, ctx); - test(cb.check()); - } - - { - // - // Test that default context is obtained correctly from communicator. - // + AMI_MyClass_opStringMyEnumDI cb = new AMI_MyClass_opStringMyEnumDI(); + p.opStringMyEnumD_async(cb, di1, di2); + test(cb.check()); + } + + { + int[] lengths = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 }; + + for(int l = 0; l < lengths.length; ++l) + { + int[] s = new int[lengths[l]]; + for(int i = 0; i < s.length; ++i) + { + s[i] = i; + } + AMI_MyClass_opIntSI cb = new AMI_MyClass_opIntSI(lengths[l]); + p.opIntS_async(cb, s); + test(cb.check()); + } + } + + { + java.util.Map ctx = new java.util.HashMap(); + ctx.put("one", "ONE"); + ctx.put("two", "TWO"); + ctx.put("three", "THREE"); + { + test(p.ice_getContext().isEmpty()); + AMI_MyClass_opContextNotEqualI cb = new AMI_MyClass_opContextNotEqualI(ctx); + p.opContext_async(cb); + test(cb.check()); + } + { + test(p.ice_getContext().isEmpty()); + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); + p.opContext_async(cb, ctx); + test(cb.check()); + } + Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx)); + test(p2.ice_getContext().equals(ctx)); + { + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); + p2.opContext_async(cb); + test(cb.check()); + } + { + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); + p2.opContext_async(cb, ctx); + test(cb.check()); + } + + { + // + // Test that default context is obtained correctly from communicator. + // /* DEPRECATED - java.util.HashMap dflt = new java.util.HashMap(); - dflt.put("a", "b"); - communicator.setDefaultContext(dflt); - { - AMI_MyClass_opContextNotEqualI cb = new AMI_MyClass_opContextNotEqualI(dflt); - p.opContext_async(cb); - test(cb.check()); - } - - p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_context(new java.util.HashMap())); - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(new java.util.HashMap()); - p2.opContext_async(cb); - test(cb.check()); - } - - p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_defaultContext()); - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(dflt); - p2.opContext_async(cb); - test(cb.check()); - } - - communicator.setDefaultContext(new java.util.HashMap()); - { - AMI_MyClass_opContextNotEqualI cb = new AMI_MyClass_opContextNotEqualI(new java.util.HashMap()); - p2.opContext_async(cb); - test(cb.check()); - } - - communicator.setDefaultContext(dflt); - Test.MyClassPrx c = Test.MyClassPrxHelper.checkedCast( - communicator.stringToProxy("test:default -p 12010 -t 10000")); - { - java.util.HashMap tmp = new java.util.HashMap(); - tmp.put("a", "b"); - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); - c.opContext_async(cb); - test(cb.check()); - } - - dflt.put("a", "c"); - Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_context(dflt)); - { - java.util.HashMap tmp = new java.util.HashMap(); - tmp.put("a", "c"); - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); - c2.opContext_async(cb); - test(cb.check()); - } - - dflt.clear(); - Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_context(dflt)); - { - java.util.HashMap tmp = new java.util.HashMap(); - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); - c3.opContext_async(cb); - test(cb.check()); - } - - Test.MyClassPrx c4 = Test.MyClassPrxHelper.uncheckedCast(c.ice_defaultContext()); - { - java.util.HashMap tmp = new java.util.HashMap(); - tmp.put("a", "b"); - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); - c4.opContext_async(cb); - test(cb.check()); - } - - dflt.put("a", "d"); - communicator.setDefaultContext(dflt); - - Test.MyClassPrx c5 = Test.MyClassPrxHelper.uncheckedCast(c.ice_defaultContext()); - { - java.util.HashMap tmp = new java.util.HashMap(); - tmp.put("a", "d"); - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); - c5.opContext_async(cb); - test(cb.check()); - } - - communicator.setDefaultContext(new java.util.HashMap()); + java.util.HashMap dflt = new java.util.HashMap(); + dflt.put("a", "b"); + communicator.setDefaultContext(dflt); + { + AMI_MyClass_opContextNotEqualI cb = new AMI_MyClass_opContextNotEqualI(dflt); + p.opContext_async(cb); + test(cb.check()); + } + + p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_context(new java.util.HashMap())); + { + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(new java.util.HashMap()); + p2.opContext_async(cb); + test(cb.check()); + } + + p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_defaultContext()); + { + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(dflt); + p2.opContext_async(cb); + test(cb.check()); + } + + communicator.setDefaultContext(new java.util.HashMap()); + { + AMI_MyClass_opContextNotEqualI cb = new AMI_MyClass_opContextNotEqualI(new java.util.HashMap()); + p2.opContext_async(cb); + test(cb.check()); + } + + communicator.setDefaultContext(dflt); + Test.MyClassPrx c = Test.MyClassPrxHelper.checkedCast( + communicator.stringToProxy("test:default -p 12010 -t 10000")); + { + java.util.HashMap tmp = new java.util.HashMap(); + tmp.put("a", "b"); + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); + c.opContext_async(cb); + test(cb.check()); + } + + dflt.put("a", "c"); + Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_context(dflt)); + { + java.util.HashMap tmp = new java.util.HashMap(); + tmp.put("a", "c"); + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); + c2.opContext_async(cb); + test(cb.check()); + } + + dflt.clear(); + Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_context(dflt)); + { + java.util.HashMap tmp = new java.util.HashMap(); + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); + c3.opContext_async(cb); + test(cb.check()); + } + + Test.MyClassPrx c4 = Test.MyClassPrxHelper.uncheckedCast(c.ice_defaultContext()); + { + java.util.HashMap tmp = new java.util.HashMap(); + tmp.put("a", "b"); + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); + c4.opContext_async(cb); + test(cb.check()); + } + + dflt.put("a", "d"); + communicator.setDefaultContext(dflt); + + Test.MyClassPrx c5 = Test.MyClassPrxHelper.uncheckedCast(c.ice_defaultContext()); + { + java.util.HashMap tmp = new java.util.HashMap(); + tmp.put("a", "d"); + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); + c5.opContext_async(cb); + test(cb.check()); + } + + communicator.setDefaultContext(new java.util.HashMap()); */ - } - } - - { - // - // Test implicit context propagation - // - - String[] impls = {"Shared", "SharedWithoutLocking", "PerThread"}; - for(int i = 0; i < 3; i++) - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = communicator.getProperties()._clone(); - initData.properties.setProperty("Ice.ImplicitContext", impls[i]); - - Ice.Communicator ic = Ice.Util.initialize(initData); - - java.util.Map ctx = new java.util.HashMap(); - 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")); - - ic.getImplicitContext().setContext(ctx); - test(ic.getImplicitContext().getContext().equals(ctx)); - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); - p3.opContext_async(cb); - test(cb.check()); - } - - ic.getImplicitContext().set("zero", "ZERO"); - test(ic.getImplicitContext().get("zero").equals("ZERO")); - test(ic.getImplicitContext().getWithDefault("foobar", "foo").equals("foo")); - - ctx = ic.getImplicitContext().getContext(); - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); - p3.opContext_async(cb); - test(cb.check()); - } - - java.util.Map prxContext = new java.util.HashMap(); - prxContext.put("one", "UN"); - prxContext.put("four", "QUATRE"); - - java.util.Map combined = new java.util.HashMap(ctx); - combined.putAll(prxContext); - test(combined.get("one").equals("UN")); - - p3 = Test.MyClassPrxHelper.uncheckedCast(p3.ice_context(prxContext)); - - ic.getImplicitContext().setContext(null); - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(prxContext); - p3.opContext_async(cb); - test(cb.check()); - } - - ic.getImplicitContext().setContext(ctx); - { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(combined); - p3.opContext_async(cb); - test(cb.check()); - } - - ic.destroy(); - } - } - - { - double d = 1278312346.0 / 13.0; - double[] ds = new double[5]; - for(int i = 0; i < 5; i++) - { - ds[i] = d; - } - AMI_MyClass_opDoubleMarshalingI cb = new AMI_MyClass_opDoubleMarshalingI(); - p.opDoubleMarshaling_async(cb, d, ds); - test(cb.check()); - } - - { - Test.MyDerivedClassPrx derived = Test.MyDerivedClassPrxHelper.checkedCast(p); - test(derived != null); - AMI_MyDerivedClass_opDerivedI cb = new AMI_MyDerivedClass_opDerivedI(); - derived.opDerived_async(cb); - test(cb.check()); - } + } + } + + { + // + // Test implicit context propagation + // + + String[] impls = {"Shared", "SharedWithoutLocking", "PerThread"}; + for(int i = 0; i < 3; i++) + { + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = communicator.getProperties()._clone(); + initData.properties.setProperty("Ice.ImplicitContext", impls[i]); + + Ice.Communicator ic = Ice.Util.initialize(initData); + + java.util.Map ctx = new java.util.HashMap(); + 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")); + + ic.getImplicitContext().setContext(ctx); + test(ic.getImplicitContext().getContext().equals(ctx)); + { + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); + p3.opContext_async(cb); + test(cb.check()); + } + + ic.getImplicitContext().set("zero", "ZERO"); + test(ic.getImplicitContext().get("zero").equals("ZERO")); + test(ic.getImplicitContext().getWithDefault("foobar", "foo").equals("foo")); + + ctx = ic.getImplicitContext().getContext(); + { + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); + p3.opContext_async(cb); + test(cb.check()); + } + + java.util.Map prxContext = new java.util.HashMap(); + prxContext.put("one", "UN"); + prxContext.put("four", "QUATRE"); + + java.util.Map combined = new java.util.HashMap(ctx); + combined.putAll(prxContext); + test(combined.get("one").equals("UN")); + + p3 = Test.MyClassPrxHelper.uncheckedCast(p3.ice_context(prxContext)); + + ic.getImplicitContext().setContext(null); + { + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(prxContext); + p3.opContext_async(cb); + test(cb.check()); + } + + ic.getImplicitContext().setContext(ctx); + { + AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(combined); + p3.opContext_async(cb); + test(cb.check()); + } + + ic.destroy(); + } + } + + { + double d = 1278312346.0 / 13.0; + double[] ds = new double[5]; + for(int i = 0; i < 5; i++) + { + ds[i] = d; + } + AMI_MyClass_opDoubleMarshalingI cb = new AMI_MyClass_opDoubleMarshalingI(); + p.opDoubleMarshaling_async(cb, d, ds); + test(cb.check()); + } + + { + Test.MyDerivedClassPrx derived = Test.MyDerivedClassPrxHelper.checkedCast(p); + test(derived != null); + AMI_MyDerivedClass_opDerivedI cb = new AMI_MyDerivedClass_opDerivedI(); + derived.opDerived_async(cb); + test(cb.check()); + } } } diff --git a/java/test/Ice/operationsAMD/MyDerivedClassI.java b/java/test/Ice/operationsAMD/MyDerivedClassI.java index 5b173590abe..d97d0eb3225 100644 --- a/java/test/Ice/operationsAMD/MyDerivedClassI.java +++ b/java/test/Ice/operationsAMD/MyDerivedClassI.java @@ -20,19 +20,19 @@ public final class MyDerivedClassI extends Test.MyDerivedClass static class Thread_opVoid extends Thread { - public - Thread_opVoid(Test.AMD_MyClass_opVoid cb) - { - _cb = cb; - } - - public void - run() - { - _cb.ice_response(); - } + public + Thread_opVoid(Test.AMD_MyClass_opVoid cb) + { + _cb = cb; + } + + public void + run() + { + _cb.ice_response(); + } - private Test.AMD_MyClass_opVoid _cb; + private Test.AMD_MyClass_opVoid _cb; } public @@ -44,73 +44,73 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void shutdown_async(Test.AMD_MyClass_shutdown cb, - Ice.Current current) - { - while(_opVoidThread != null) - { - try - { - _opVoidThread.join(); - _opVoidThread = null; - } - catch(java.lang.InterruptedException ex) - { - } - } + Ice.Current current) + { + while(_opVoidThread != null) + { + try + { + _opVoidThread.join(); + _opVoidThread = null; + } + catch(java.lang.InterruptedException ex) + { + } + } _adapter.getCommunicator().shutdown(); - cb.ice_response(); + cb.ice_response(); } public void opVoid_async(Test.AMD_MyClass_opVoid cb, - Ice.Current current) + Ice.Current current) { - while(_opVoidThread != null) - { - try - { - _opVoidThread.join(); - _opVoidThread = null; - } - catch(java.lang.InterruptedException ex) - { - } - } + while(_opVoidThread != null) + { + try + { + _opVoidThread.join(); + _opVoidThread = null; + } + catch(java.lang.InterruptedException ex) + { + } + } - _opVoidThread = new Thread_opVoid(cb); - _opVoidThread.start(); + _opVoidThread = new Thread_opVoid(cb); + _opVoidThread.start(); } public void opSleep_async(Test.AMD_MyClass_opSleep cb, int duration, Ice.Current current) { - while(true) - { - try - { - Thread.currentThread().sleep(duration); - cb.ice_response(); - break; - } - catch(java.lang.InterruptedException ex) - { - } - } + while(true) + { + try + { + Thread.currentThread().sleep(duration); + cb.ice_response(); + break; + } + catch(java.lang.InterruptedException ex) + { + } + } } public void opBool_async(Test.AMD_MyClass_opBool cb, - boolean p1, boolean p2, - Ice.Current current) + boolean p1, boolean p2, + Ice.Current current) { - cb.ice_response(p2, p1); + cb.ice_response(p2, p1); } public void opBoolS_async(Test.AMD_MyClass_opBoolS cb, - boolean[] p1, boolean[] p2, - Ice.Current current) + boolean[] p1, boolean[] p2, + Ice.Current current) { boolean[] p3 = new boolean[p1.length + p2.length]; System.arraycopy(p1, 0, p3, 0, p1.length); @@ -126,8 +126,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opBoolSS_async(Test.AMD_MyClass_opBoolSS cb, - boolean[][] p1, boolean[][] p2, - Ice.Current current) + boolean[][] p1, boolean[][] p2, + Ice.Current current) { boolean[][] p3 = new boolean[p1.length + p2.length][]; System.arraycopy(p1, 0, p3, 0, p1.length); @@ -143,16 +143,16 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opByte_async(Test.AMD_MyClass_opByte cb, - byte p1, byte p2, - Ice.Current current) + byte p1, byte p2, + Ice.Current current) { cb.ice_response(p1, (byte)(p1 ^ p2)); } public void opByteBoolD_async(Test.AMD_MyClass_opByteBoolD cb, - java.util.Map p1, java.util.Map p2, - Ice.Current current) + java.util.Map p1, java.util.Map p2, + Ice.Current current) { java.util.Map p3 = p1; java.util.Map r = new java.util.HashMap(); @@ -163,8 +163,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opByteS_async(Test.AMD_MyClass_opByteS cb, - byte[] p1, byte[] p2, - Ice.Current current) + byte[] p1, byte[] p2, + Ice.Current current) { byte[] p3 = new byte[p1.length]; for(int i = 0; i < p1.length; i++) @@ -180,8 +180,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opByteSS_async(Test.AMD_MyClass_opByteSS cb, - byte[][] p1, byte[][] p2, - Ice.Current current) + byte[][] p1, byte[][] p2, + Ice.Current current) { byte[][] p3 = new byte[p1.length][]; for(int i = 0; i < p1.length; i++) @@ -197,16 +197,16 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opFloatDouble_async(Test.AMD_MyClass_opFloatDouble cb, - float p1, double p2, - Ice.Current current) + float p1, double p2, + Ice.Current current) { cb.ice_response(p2, p1, p2); } public void opFloatDoubleS_async(Test.AMD_MyClass_opFloatDoubleS cb, - float[] p1, double[] p2, - Ice.Current current) + float[] p1, double[] p2, + Ice.Current current) { float[] p3 = p1; double[] p4 = new double[p2.length]; @@ -225,8 +225,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opFloatDoubleSS_async(Test.AMD_MyClass_opFloatDoubleSS cb, - float[][] p1, double[][] p2, - Ice.Current current) + float[][] p1, double[][] p2, + Ice.Current current) { float[][] p3 = p1; double[][] p4 = new double[p2.length][]; @@ -242,8 +242,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opLongFloatD_async(Test.AMD_MyClass_opLongFloatD cb, - java.util.Map p1, java.util.Map p2, - Ice.Current current) + java.util.Map p1, java.util.Map p2, + Ice.Current current) { java.util.Map p3 = p1; java.util.Map r = new java.util.HashMap(); @@ -254,27 +254,27 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opMyClass_async(Test.AMD_MyClass_opMyClass cb, - Test.MyClassPrx p1, - Ice.Current current) + Test.MyClassPrx p1, + Ice.Current current) { Test.MyClassPrx p2 = p1; Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast( - _adapter.createProxy(_adapter.getCommunicator().stringToIdentity("noSuchIdentity"))); + _adapter.createProxy(_adapter.getCommunicator().stringToIdentity("noSuchIdentity"))); cb.ice_response(Test.MyClassPrxHelper.uncheckedCast(_adapter.createProxy(_identity)), p2, p3); } public void opMyEnum_async(Test.AMD_MyClass_opMyEnum cb, - Test.MyEnum p1, - Ice.Current current) + Test.MyEnum p1, + Ice.Current current) { cb.ice_response(Test.MyEnum.enum3, p1); } public void opShortIntD_async(Test.AMD_MyClass_opShortIntD cb, - java.util.Map p1, java.util.Map p2, - Ice.Current current) + java.util.Map p1, java.util.Map p2, + Ice.Current current) { java.util.Map p3 = p1; java.util.Map r = new java.util.HashMap(); @@ -285,16 +285,16 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opShortIntLong_async(Test.AMD_MyClass_opShortIntLong cb, - short p1, int p2, long p3, - Ice.Current current) + short p1, int p2, long p3, + Ice.Current current) { cb.ice_response(p3, p1, p2, p3); } public void opShortIntLongS_async(Test.AMD_MyClass_opShortIntLongS cb, - short[] p1, int[] p2, long[] p3, - Ice.Current current) + short[] p1, int[] p2, long[] p3, + Ice.Current current) { short[] p4 = p1; int[] p5 = new int[p2.length]; @@ -310,8 +310,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opShortIntLongSS_async(Test.AMD_MyClass_opShortIntLongSS cb, - short[][] p1, int[][] p2, long[][] p3, - Ice.Current current) + short[][] p1, int[][] p2, long[][] p3, + Ice.Current current) { short[][] p4 = p1; int[][] p5 = new int[p2.length][]; @@ -327,16 +327,16 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opString_async(Test.AMD_MyClass_opString cb, - String p1, String p2, - Ice.Current current) + String p1, String p2, + Ice.Current current) { - cb.ice_response(p1 + " " + p2, p2 + " " + p1); + cb.ice_response(p1 + " " + p2, p2 + " " + p1); } public void opStringMyEnumD_async(Test.AMD_MyClass_opStringMyEnumD cb, - java.util.Map p1, java.util.Map p2, - Ice.Current current) + java.util.Map p1, java.util.Map p2, + Ice.Current current) { java.util.Map p3 = p1; java.util.Map r = new java.util.HashMap(); @@ -348,11 +348,11 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opIntS_async(Test.AMD_MyClass_opIntS cb, int[] s, Ice.Current current) { - int[] r = new int[s.length]; - for(int i = 0; i < r.length; ++i) - { - r[i] = -s[i]; - } + int[] r = new int[s.length]; + for(int i = 0; i < r.length; ++i) + { + r[i] = -s[i]; + } cb.ice_response(r); } @@ -371,19 +371,19 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opDoubleMarshaling_async(Test.AMD_MyClass_opDoubleMarshaling cb, double p1, double[] p2, Ice.Current current) { - double d = 1278312346.0 / 13.0; - test(p1 == d); - for(int i = 0; i < p2.length; ++i) - { - test(p2[i] == d); - } - cb.ice_response(); + double d = 1278312346.0 / 13.0; + test(p1 == d); + for(int i = 0; i < p2.length; ++i) + { + test(p2[i] == d); + } + cb.ice_response(); } public void opStringS_async(Test.AMD_MyClass_opStringS cb, - String[] p1, String[] p2, - Ice.Current current) + String[] p1, String[] p2, + Ice.Current current) { String[] p3 = new String[p1.length + p2.length]; System.arraycopy(p1, 0, p3, 0, p1.length); @@ -399,8 +399,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opStringSS_async(Test.AMD_MyClass_opStringSS cb, - String[][] p1, String[][] p2, - Ice.Current current) + String[][] p1, String[][] p2, + Ice.Current current) { String[][] p3 = new String[p1.length + p2.length][]; System.arraycopy(p1, 0, p3, 0, p1.length); @@ -416,8 +416,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opStringSSS_async(Test.AMD_MyClass_opStringSSS cb, - String[][][] p1, String[][][] p2, - Ice.Current current) + String[][][] p1, String[][][] p2, + Ice.Current current) { String[][][] p3 = new String[p1.length + p2.length][][]; System.arraycopy(p1, 0, p3, 0, p1.length); @@ -433,8 +433,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opStringStringD_async(Test.AMD_MyClass_opStringStringD cb, - java.util.Map p1, java.util.Map p2, - Ice.Current current) + java.util.Map p1, java.util.Map p2, + Ice.Current current) { java.util.Map p3 = p1; java.util.Map r = new java.util.HashMap(); @@ -445,8 +445,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opStruct_async(Test.AMD_MyClass_opStruct cb, - Test.Structure p1, Test.Structure p2, - Ice.Current current) + Test.Structure p1, Test.Structure p2, + Ice.Current current) { Test.Structure p3 = p1; p3.s.s = "a new string"; @@ -455,9 +455,9 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opDerived_async(Test.AMD_MyDerivedClass_opDerived cb, - Ice.Current current) + Ice.Current current) { - cb.ice_response(); + cb.ice_response(); } private Ice.ObjectAdapter _adapter; diff --git a/java/test/Ice/operationsAMD/Server.java b/java/test/Ice/operationsAMD/Server.java index c69b403de75..b60fa538c33 100644 --- a/java/test/Ice/operationsAMD/Server.java +++ b/java/test/Ice/operationsAMD/Server.java @@ -31,11 +31,11 @@ public class Server try { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + 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"); + initData.properties.setProperty("Ice.Warn.Connections", "0"); communicator = Ice.Util.initialize(argsH, initData); status = run(args, communicator); @@ -59,7 +59,7 @@ public class Server } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/operationsAMD/TestAMD.ice b/java/test/Ice/operationsAMD/TestAMD.ice index 00df3c3a676..8efa097d48a 100644 --- a/java/test/Ice/operationsAMD/TestAMD.ice +++ b/java/test/Ice/operationsAMD/TestAMD.ice @@ -75,75 +75,75 @@ dictionary<string, MyEnum> StringMyEnumD; void opSleep(int duration); byte opByte(byte p1, byte p2, - out byte p3); + out byte p3); bool opBool(bool p1, bool p2, - out bool p3); + out bool p3); long opShortIntLong(short p1, int p2, long p3, - out short p4, out int p5, out long p6); + out short p4, out int p5, out long p6); double opFloatDouble(float p1, double p2, - out float p3, out double p4); + out float p3, out double p4); string opString(string p1, string p2, - out string p3); + out string p3); MyEnum opMyEnum(MyEnum p1, out MyEnum p2); MyClass* opMyClass(MyClass* p1, out MyClass* p2, out MyClass* p3); Structure opStruct(Structure p1, Structure p2, - out Structure p3); + out Structure p3); ByteS opByteS(ByteS p1, ByteS p2, - out ByteS p3); + out ByteS p3); BoolS opBoolS(BoolS p1, BoolS p2, - out BoolS p3); + out BoolS p3); LongS opShortIntLongS(Test::ShortS p1, IntS p2, LongS p3, - out ::Test::ShortS p4, out IntS p5, out LongS p6); + out ::Test::ShortS p4, out IntS p5, out LongS p6); DoubleS opFloatDoubleS(FloatS p1, DoubleS p2, - out FloatS p3, out DoubleS p4); + out FloatS p3, out DoubleS p4); StringS opStringS(StringS p1, StringS p2, - out StringS p3); + out StringS p3); ByteSS opByteSS(ByteSS p1, ByteSS p2, - out ByteSS p3); + out ByteSS p3); BoolSS opBoolSS(BoolSS p1, BoolSS p2, - out BoolSS p3); + out BoolSS p3); LongSS opShortIntLongSS(ShortSS p1, IntSS p2, LongSS p3, - out ShortSS p4, out IntSS p5, out LongSS p6); + out ShortSS p4, out IntSS p5, out LongSS p6); DoubleSS opFloatDoubleSS(FloatSS p1, DoubleSS p2, - out FloatSS p3, out DoubleSS p4); + out FloatSS p3, out DoubleSS p4); StringSS opStringSS(StringSS p1, StringSS p2, - out StringSS p3); + out StringSS p3); StringSSS opStringSSS(StringSSS p1, StringSSS p2, - out StringSSS p3); + out StringSSS p3); ByteBoolD opByteBoolD(ByteBoolD p1, ByteBoolD p2, - out ByteBoolD p3); + out ByteBoolD p3); ShortIntD opShortIntD(ShortIntD p1, ShortIntD p2, - out ShortIntD p3); + out ShortIntD p3); LongFloatD opLongFloatD(LongFloatD p1, LongFloatD p2, - out LongFloatD p3); + out LongFloatD p3); StringStringD opStringStringD(StringStringD p1, StringStringD p2, - out StringStringD p3); + out StringStringD p3); StringMyEnumD opStringMyEnumD(StringMyEnumD p1, StringMyEnumD p2, - out StringMyEnumD p3); + out StringMyEnumD p3); IntS opIntS(IntS s); diff --git a/java/test/Ice/package/Client.java b/java/test/Ice/package/Client.java index c0e7bf3b020..6593ce9b6f5 100644 --- a/java/test/Ice/package/Client.java +++ b/java/test/Ice/package/Client.java @@ -47,7 +47,7 @@ public class Client } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/package/Server.java b/java/test/Ice/package/Server.java index 76daf0eb098..6833dc9f669 100644 --- a/java/test/Ice/package/Server.java +++ b/java/test/Ice/package/Server.java @@ -51,7 +51,7 @@ public class Server } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/retry/AllTests.java b/java/test/Ice/retry/AllTests.java index 28385951ee1..e7c2f061ecd 100644 --- a/java/test/Ice/retry/AllTests.java +++ b/java/test/Ice/retry/AllTests.java @@ -94,8 +94,8 @@ public class AllTests public void ice_exception(Ice.LocalException ex) { - test(ex instanceof Ice.ConnectionLostException); - callback.called(); + test(ex instanceof Ice.ConnectionLostException); + callback.called(); } public boolean @@ -115,7 +115,7 @@ public class AllTests String ref = "retry:default -p 12010 -t 10000"; Ice.ObjectPrx base1 = communicator.stringToProxy(ref); test(base1 != null); - Ice.ObjectPrx base2 = communicator.stringToProxy(ref); + Ice.ObjectPrx base2 = communicator.stringToProxy(ref); test(base2 != null); out.println("ok"); @@ -123,51 +123,51 @@ public class AllTests out.flush(); Test.RetryPrx retry1 = Test.RetryPrxHelper.checkedCast(base1); test(retry1 != null); - test(retry1.equals(base1)); + test(retry1.equals(base1)); Test.RetryPrx retry2 = Test.RetryPrxHelper.checkedCast(base2); test(retry2 != null); - test(retry2.equals(base2)); + test(retry2.equals(base2)); out.println("ok"); - out.print("calling regular operation with first proxy... "); - out.flush(); - retry1.op(false); - out.println("ok"); - - out.print("calling operation to kill connection with second proxy... "); - out.flush(); - try - { - retry2.op(true); - test(false); - } - catch(Ice.ConnectionLostException ex) - { - out.println("ok"); - } + out.print("calling regular operation with first proxy... "); + out.flush(); + retry1.op(false); + out.println("ok"); + + out.print("calling operation to kill connection with second proxy... "); + out.flush(); + try + { + retry2.op(true); + test(false); + } + catch(Ice.ConnectionLostException ex) + { + out.println("ok"); + } out.print("calling regular operation with first proxy again... "); out.flush(); - retry1.op(false); - out.println("ok"); - - AMIRegular cb1 = new AMIRegular(); - AMIException cb2 = new AMIException(); - - out.print("calling regular AMI operation with first proxy... "); - retry1.op_async(cb1, false); - test(cb1.check()); - out.println("ok"); - - out.print("calling AMI operation to kill connection with second proxy... "); - retry2.op_async(cb2, true); - test(cb2.check()); - out.println("ok"); - - out.print("calling regular AMI operation with first proxy again... "); - retry1.op_async(cb1, false); - test(cb1.check()); - out.println("ok"); + retry1.op(false); + out.println("ok"); + + AMIRegular cb1 = new AMIRegular(); + AMIException cb2 = new AMIException(); + + out.print("calling regular AMI operation with first proxy... "); + retry1.op_async(cb1, false); + test(cb1.check()); + out.println("ok"); + + out.print("calling AMI operation to kill connection with second proxy... "); + retry2.op_async(cb2, true); + test(cb2.check()); + out.println("ok"); + + out.print("calling regular AMI operation with first proxy again... "); + retry1.op_async(cb1, false); + test(cb1.check()); + out.println("ok"); return retry1; } diff --git a/java/test/Ice/retry/Client.java b/java/test/Ice/retry/Client.java index 3200822416e..d801ad6b535 100644 --- a/java/test/Ice/retry/Client.java +++ b/java/test/Ice/retry/Client.java @@ -25,22 +25,22 @@ public class Client try { - Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args); - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); + 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"); + // + // 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"); + // + // 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(Ice.LocalException ex) @@ -62,7 +62,7 @@ public class Client } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/retry/RetryI.java b/java/test/Ice/retry/RetryI.java index ef6dfcdc4c7..c8354acdbfa 100644 --- a/java/test/Ice/retry/RetryI.java +++ b/java/test/Ice/retry/RetryI.java @@ -20,9 +20,9 @@ public final class RetryI extends _RetryDisp op(boolean kill, Ice.Current current) { if(kill) - { - current.con.close(true); - } + { + current.con.close(true); + } } public void diff --git a/java/test/Ice/retry/Server.java b/java/test/Ice/retry/Server.java index ae0e79d2886..25cb40a1445 100644 --- a/java/test/Ice/retry/Server.java +++ b/java/test/Ice/retry/Server.java @@ -12,15 +12,15 @@ public class Server public static int run(String[] args, Ice.Communicator communicator, java.io.PrintStream out) { - // - // 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("Ice.OA.TestAdapter.Endpoints").length() == 0) - { - communicator.getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000"); - } + // + // 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("Ice.OA.TestAdapter.Endpoints").length() == 0) + { + communicator.getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000"); + } Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new RetryI(), communicator.stringToIdentity("retry")); @@ -60,7 +60,7 @@ public class Server } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/servantLocator/AllTests.java b/java/test/Ice/servantLocator/AllTests.java index eaf730541b0..74f19f9e24f 100644 --- a/java/test/Ice/servantLocator/AllTests.java +++ b/java/test/Ice/servantLocator/AllTests.java @@ -24,101 +24,101 @@ public class AllTests public static void testExceptions(TestIntfPrx obj, boolean collocated) { - try - { - obj.requestFailedException(); - test(false); - } - catch(ObjectNotExistException ex) - { - if(!collocated) - { - test(ex.id.equals(obj.ice_getIdentity())); - test(ex.facet.equals(obj.ice_getFacet())); - test(ex.operation.equals("requestFailedException")); - } - } - - try - { - obj.unknownUserException(); - test(false); - } - catch(UnknownUserException ex) - { - test(ex.unknown.equals("reason")); - } - - try - { - obj.unknownLocalException(); - test(false); - } - catch(UnknownLocalException ex) - { - test(ex.unknown.equals("reason")); - } - - try - { - obj.unknownException(); - test(false); - } - catch(UnknownException ex) - { - test(ex.unknown.equals("reason")); - } - - // - // User exceptions are checked exceptions - // -// try -// { -// obj.userException(); -// test(false); -// } -// catch(UnknownUserException ex) -// { -// //System.err.println(ex.unknown); -// test(!collocated); -// test(ex.unknown.equals("Test::TestIntfUserException")); -// } -// catch(TestIntfUserException ex) -// { -// test(collocated); -// } - - try - { - obj.localException(); - test(false); - } - catch(UnknownLocalException ex) - { - //System.err.println(ex.unknown); - test(!collocated); - test(ex.unknown.indexOf("Ice.SocketException") >= 0); - } - catch(SocketException ex) - { - test(collocated); - } - - try - { - obj.javaException(); - test(false); - } - catch(UnknownException ex) - { - //System.err.println(ex.unknown); - test(!collocated); - test(ex.unknown.indexOf("java.lang.RuntimeException: message") >= 0); - } - catch(java.lang.RuntimeException ex) - { - test(collocated); - } + try + { + obj.requestFailedException(); + test(false); + } + catch(ObjectNotExistException ex) + { + if(!collocated) + { + test(ex.id.equals(obj.ice_getIdentity())); + test(ex.facet.equals(obj.ice_getFacet())); + test(ex.operation.equals("requestFailedException")); + } + } + + try + { + obj.unknownUserException(); + test(false); + } + catch(UnknownUserException ex) + { + test(ex.unknown.equals("reason")); + } + + try + { + obj.unknownLocalException(); + test(false); + } + catch(UnknownLocalException ex) + { + test(ex.unknown.equals("reason")); + } + + try + { + obj.unknownException(); + test(false); + } + catch(UnknownException ex) + { + test(ex.unknown.equals("reason")); + } + + // + // User exceptions are checked exceptions + // +// try +// { +// obj.userException(); +// test(false); +// } +// catch(UnknownUserException ex) +// { +// //System.err.println(ex.unknown); +// test(!collocated); +// test(ex.unknown.equals("Test::TestIntfUserException")); +// } +// catch(TestIntfUserException ex) +// { +// test(collocated); +// } + + try + { + obj.localException(); + test(false); + } + catch(UnknownLocalException ex) + { + //System.err.println(ex.unknown); + test(!collocated); + test(ex.unknown.indexOf("Ice.SocketException") >= 0); + } + catch(SocketException ex) + { + test(collocated); + } + + try + { + obj.javaException(); + test(false); + } + catch(UnknownException ex) + { + //System.err.println(ex.unknown); + test(!collocated); + test(ex.unknown.indexOf("java.lang.RuntimeException: message") >= 0); + } + catch(java.lang.RuntimeException ex) + { + test(collocated); + } } public static TestIntfPrx @@ -138,54 +138,54 @@ public class AllTests test(obj.equals(base)); System.out.println("ok"); - System.out.print("testing servant locator... "); + System.out.print("testing servant locator... "); System.out.flush(); - base = communicator.stringToProxy("category/locate:default -p 12010 -t 10000"); - obj = TestIntfPrxHelper.checkedCast(base); - try - { - TestIntfPrxHelper.checkedCast(communicator.stringToProxy("category/unknown:default -p 12010 -t 10000")); - } - catch(ObjectNotExistException ex) - { - } - System.out.println("ok"); - - System.out.print("testing default servant locator... "); + base = communicator.stringToProxy("category/locate:default -p 12010 -t 10000"); + obj = TestIntfPrxHelper.checkedCast(base); + try + { + TestIntfPrxHelper.checkedCast(communicator.stringToProxy("category/unknown:default -p 12010 -t 10000")); + } + catch(ObjectNotExistException ex) + { + } + System.out.println("ok"); + + System.out.print("testing default servant locator... "); System.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"); - obj = TestIntfPrxHelper.checkedCast(base); - try - { - TestIntfPrxHelper.checkedCast(communicator.stringToProxy("anothercat/unknown:default -p 12010 -t 10000")); - } - catch(ObjectNotExistException ex) - { - } - try - { - TestIntfPrxHelper.checkedCast(communicator.stringToProxy("unknown:default -p 12010 -t 10000")); - } - catch(ObjectNotExistException ex) - { - } - System.out.println("ok"); - - System.out.print("testing locate exceptions... "); + base = communicator.stringToProxy("anothercat/locate:default -p 12010 -t 10000"); + obj = TestIntfPrxHelper.checkedCast(base); + base = communicator.stringToProxy("locate:default -p 12010 -t 10000"); + obj = TestIntfPrxHelper.checkedCast(base); + try + { + TestIntfPrxHelper.checkedCast(communicator.stringToProxy("anothercat/unknown:default -p 12010 -t 10000")); + } + catch(ObjectNotExistException ex) + { + } + try + { + TestIntfPrxHelper.checkedCast(communicator.stringToProxy("unknown:default -p 12010 -t 10000")); + } + catch(ObjectNotExistException ex) + { + } + System.out.println("ok"); + + System.out.print("testing locate exceptions... "); System.out.flush(); - base = communicator.stringToProxy("category/locate:default -p 12010 -t 10000"); - obj = TestIntfPrxHelper.checkedCast(base); - testExceptions(obj, collocated); - System.out.println("ok"); + base = communicator.stringToProxy("category/locate:default -p 12010 -t 10000"); + obj = TestIntfPrxHelper.checkedCast(base); + testExceptions(obj, collocated); + System.out.println("ok"); - System.out.print("testing finished exceptions... "); + System.out.print("testing finished exceptions... "); System.out.flush(); - base = communicator.stringToProxy("category/finished:default -p 12010 -t 10000"); - obj = TestIntfPrxHelper.checkedCast(base); - testExceptions(obj, collocated); - System.out.println("ok"); + base = communicator.stringToProxy("category/finished:default -p 12010 -t 10000"); + obj = TestIntfPrxHelper.checkedCast(base); + testExceptions(obj, collocated); + System.out.println("ok"); return obj; } diff --git a/java/test/Ice/servantLocator/Client.java b/java/test/Ice/servantLocator/Client.java index 403616d3c10..808b9c46d6e 100644 --- a/java/test/Ice/servantLocator/Client.java +++ b/java/test/Ice/servantLocator/Client.java @@ -17,7 +17,7 @@ public class Client run(String[] args) { TestIntfPrx obj = AllTests.allTests(communicator(), false); - obj.shutdown(); + obj.shutdown(); return 0; } } diff --git a/java/test/Ice/servantLocator/Collocated.java b/java/test/Ice/servantLocator/Collocated.java index 96147dd2775..7600e2c2a9a 100644 --- a/java/test/Ice/servantLocator/Collocated.java +++ b/java/test/Ice/servantLocator/Collocated.java @@ -15,12 +15,12 @@ public class Collocated run(String[] args) { communicator().getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000"); - communicator().getProperties().setProperty("Ice.Warn.Dispatch", "0"); + 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.add(new TestI(), communicator().stringToIdentity("asm")); AllTests.allTests(communicator(), true); diff --git a/java/test/Ice/servantLocator/ServantLocatorI.java b/java/test/Ice/servantLocator/ServantLocatorI.java index 7fab16bfb87..ec40d3fbc5f 100644 --- a/java/test/Ice/servantLocator/ServantLocatorI.java +++ b/java/test/Ice/servantLocator/ServantLocatorI.java @@ -15,7 +15,7 @@ public final class ServantLocatorI extends Ice.LocalObjectImpl implements Ice.Se public ServantLocatorI(String category) { - _category = category; + _category = category; _deactivated = false; } @@ -39,22 +39,22 @@ public final class ServantLocatorI extends Ice.LocalObjectImpl implements Ice.Se locate(Ice.Current current, Ice.LocalObjectHolder cookie) { synchronized(this) - { - test(!_deactivated); - } + { + test(!_deactivated); + } - test(current.id.category.equals(_category) || _category.length() == 0); - - if(current.id.name.equals("unknown")) - { - return null; - } + test(current.id.category.equals(_category) || _category.length() == 0); + + if(current.id.name.equals("unknown")) + { + return null; + } - test(current.id.name.equals("locate") || current.id.name.equals("finished")); - if(current.id.name.equals("locate")) - { - exception(current); - } + test(current.id.name.equals("locate") || current.id.name.equals("finished")); + if(current.id.name.equals("locate")) + { + exception(current); + } cookie.value = new CookieI(); @@ -64,19 +64,19 @@ public final class ServantLocatorI extends Ice.LocalObjectImpl implements Ice.Se public void finished(Ice.Current current, Ice.Object servant, Ice.LocalObject cookie) { - synchronized(this) - { - test(!_deactivated); - } + synchronized(this) + { + test(!_deactivated); + } - test(current.id.category.equals(_category) || _category.length() == 0); - test(current.id.name.equals("locate") || current.id.name.equals("finished")); - - if(current.id.name.equals("finished")) - { - exception(current); - } - + test(current.id.category.equals(_category) || _category.length() == 0); + test(current.id.name.equals("locate") || current.id.name.equals("finished")); + + if(current.id.name.equals("finished")) + { + exception(current); + } + Cookie co = (Cookie)cookie; test(co.message().equals("blahblah")); } @@ -84,49 +84,49 @@ public final class ServantLocatorI extends Ice.LocalObjectImpl implements Ice.Se public synchronized void deactivate(String category) { - synchronized(this) - { - test(!_deactivated); + synchronized(this) + { + test(!_deactivated); - _deactivated = true; - } + _deactivated = true; + } } private void exception(Ice.Current current) { - if(current.operation.equals("requestFailedException")) - { - throw new ObjectNotExistException(); - } - else if(current.operation.equals("unknownUserException")) - { - throw new UnknownUserException("reason"); - } - else if(current.operation.equals("unknownLocalException")) - { - throw new UnknownLocalException("reason"); - } - else if(current.operation.equals("unknownException")) - { - throw new UnknownException("reason"); - } - // - // User exceptions are checked exceptions in Java, so it's not - // possible to throw it from the servant locator. - // -// else if(current.operation.equals("userException")) -// { -// throw new TestIntfUserException(); -// } - else if(current.operation.equals("localException")) - { - throw new SocketException(0); - } - else if(current.operation.equals("javaException")) - { - throw new java.lang.RuntimeException("message"); - } + if(current.operation.equals("requestFailedException")) + { + throw new ObjectNotExistException(); + } + else if(current.operation.equals("unknownUserException")) + { + throw new UnknownUserException("reason"); + } + else if(current.operation.equals("unknownLocalException")) + { + throw new UnknownLocalException("reason"); + } + else if(current.operation.equals("unknownException")) + { + throw new UnknownException("reason"); + } + // + // User exceptions are checked exceptions in Java, so it's not + // possible to throw it from the servant locator. + // +// else if(current.operation.equals("userException")) +// { +// throw new TestIntfUserException(); +// } + else if(current.operation.equals("localException")) + { + throw new SocketException(0); + } + else if(current.operation.equals("javaException")) + { + throw new java.lang.RuntimeException("message"); + } } private boolean _deactivated; diff --git a/java/test/Ice/servantLocator/Server.java b/java/test/Ice/servantLocator/Server.java index a6e9f74be45..25bf925deb5 100644 --- a/java/test/Ice/servantLocator/Server.java +++ b/java/test/Ice/servantLocator/Server.java @@ -15,12 +15,12 @@ public class Server run(String[] args) { communicator().getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000"); - communicator().getProperties().setProperty("Ice.Warn.Dispatch", "0"); + 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.add(new TestI(), communicator().stringToIdentity("asm")); adapter.activate(); adapter.waitForDeactivate(); @@ -33,7 +33,7 @@ public class Server { TestServer app = new TestServer(); int result = app.main("Server", args); - System.gc(); + System.gc(); System.exit(result); } } diff --git a/java/test/Ice/servantLocatorAMD/ServantLocatorI.java b/java/test/Ice/servantLocatorAMD/ServantLocatorI.java index 7fab16bfb87..ec40d3fbc5f 100644 --- a/java/test/Ice/servantLocatorAMD/ServantLocatorI.java +++ b/java/test/Ice/servantLocatorAMD/ServantLocatorI.java @@ -15,7 +15,7 @@ public final class ServantLocatorI extends Ice.LocalObjectImpl implements Ice.Se public ServantLocatorI(String category) { - _category = category; + _category = category; _deactivated = false; } @@ -39,22 +39,22 @@ public final class ServantLocatorI extends Ice.LocalObjectImpl implements Ice.Se locate(Ice.Current current, Ice.LocalObjectHolder cookie) { synchronized(this) - { - test(!_deactivated); - } + { + test(!_deactivated); + } - test(current.id.category.equals(_category) || _category.length() == 0); - - if(current.id.name.equals("unknown")) - { - return null; - } + test(current.id.category.equals(_category) || _category.length() == 0); + + if(current.id.name.equals("unknown")) + { + return null; + } - test(current.id.name.equals("locate") || current.id.name.equals("finished")); - if(current.id.name.equals("locate")) - { - exception(current); - } + test(current.id.name.equals("locate") || current.id.name.equals("finished")); + if(current.id.name.equals("locate")) + { + exception(current); + } cookie.value = new CookieI(); @@ -64,19 +64,19 @@ public final class ServantLocatorI extends Ice.LocalObjectImpl implements Ice.Se public void finished(Ice.Current current, Ice.Object servant, Ice.LocalObject cookie) { - synchronized(this) - { - test(!_deactivated); - } + synchronized(this) + { + test(!_deactivated); + } - test(current.id.category.equals(_category) || _category.length() == 0); - test(current.id.name.equals("locate") || current.id.name.equals("finished")); - - if(current.id.name.equals("finished")) - { - exception(current); - } - + test(current.id.category.equals(_category) || _category.length() == 0); + test(current.id.name.equals("locate") || current.id.name.equals("finished")); + + if(current.id.name.equals("finished")) + { + exception(current); + } + Cookie co = (Cookie)cookie; test(co.message().equals("blahblah")); } @@ -84,49 +84,49 @@ public final class ServantLocatorI extends Ice.LocalObjectImpl implements Ice.Se public synchronized void deactivate(String category) { - synchronized(this) - { - test(!_deactivated); + synchronized(this) + { + test(!_deactivated); - _deactivated = true; - } + _deactivated = true; + } } private void exception(Ice.Current current) { - if(current.operation.equals("requestFailedException")) - { - throw new ObjectNotExistException(); - } - else if(current.operation.equals("unknownUserException")) - { - throw new UnknownUserException("reason"); - } - else if(current.operation.equals("unknownLocalException")) - { - throw new UnknownLocalException("reason"); - } - else if(current.operation.equals("unknownException")) - { - throw new UnknownException("reason"); - } - // - // User exceptions are checked exceptions in Java, so it's not - // possible to throw it from the servant locator. - // -// else if(current.operation.equals("userException")) -// { -// throw new TestIntfUserException(); -// } - else if(current.operation.equals("localException")) - { - throw new SocketException(0); - } - else if(current.operation.equals("javaException")) - { - throw new java.lang.RuntimeException("message"); - } + if(current.operation.equals("requestFailedException")) + { + throw new ObjectNotExistException(); + } + else if(current.operation.equals("unknownUserException")) + { + throw new UnknownUserException("reason"); + } + else if(current.operation.equals("unknownLocalException")) + { + throw new UnknownLocalException("reason"); + } + else if(current.operation.equals("unknownException")) + { + throw new UnknownException("reason"); + } + // + // User exceptions are checked exceptions in Java, so it's not + // possible to throw it from the servant locator. + // +// else if(current.operation.equals("userException")) +// { +// throw new TestIntfUserException(); +// } + else if(current.operation.equals("localException")) + { + throw new SocketException(0); + } + else if(current.operation.equals("javaException")) + { + throw new java.lang.RuntimeException("message"); + } } private boolean _deactivated; diff --git a/java/test/Ice/servantLocatorAMD/Server.java b/java/test/Ice/servantLocatorAMD/Server.java index a6e9f74be45..25bf925deb5 100644 --- a/java/test/Ice/servantLocatorAMD/Server.java +++ b/java/test/Ice/servantLocatorAMD/Server.java @@ -15,12 +15,12 @@ public class Server run(String[] args) { communicator().getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000"); - communicator().getProperties().setProperty("Ice.Warn.Dispatch", "0"); + 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.add(new TestI(), communicator().stringToIdentity("asm")); adapter.activate(); adapter.waitForDeactivate(); @@ -33,7 +33,7 @@ public class Server { TestServer app = new TestServer(); int result = app.main("Server", args); - System.gc(); + System.gc(); System.exit(result); } } diff --git a/java/test/Ice/servantLocatorAMD/TestI.java b/java/test/Ice/servantLocatorAMD/TestI.java index bbdbecb3a28..eaa5657feba 100644 --- a/java/test/Ice/servantLocatorAMD/TestI.java +++ b/java/test/Ice/servantLocatorAMD/TestI.java @@ -14,31 +14,31 @@ public final class TestI extends _TestIntfDisp public void requestFailedException_async(AMD_TestIntf_requestFailedException cb, Ice.Current current) { - cb.ice_response(); + cb.ice_response(); } public void unknownUserException_async(AMD_TestIntf_unknownUserException cb, Ice.Current current) { - cb.ice_response(); + cb.ice_response(); } public void unknownLocalException_async(AMD_TestIntf_unknownLocalException cb, Ice.Current current) { - cb.ice_response(); + cb.ice_response(); } public void unknownException_async(AMD_TestIntf_unknownException cb, Ice.Current current) { - cb.ice_response(); + cb.ice_response(); } public void localException_async(AMD_TestIntf_localException cb, Ice.Current current) { - cb.ice_response(); + cb.ice_response(); } // public void @@ -50,13 +50,13 @@ public final class TestI extends _TestIntfDisp public void javaException_async(AMD_TestIntf_javaException cb, Ice.Current current) { - cb.ice_response(); + cb.ice_response(); } public void shutdown_async(AMD_TestIntf_shutdown cb, Ice.Current current) { current.adapter.deactivate(); - cb.ice_response(); + cb.ice_response(); } } diff --git a/java/test/Ice/slicing/exceptions/csrc/AllTests.java b/java/test/Ice/slicing/exceptions/csrc/AllTests.java index 14870c18a3f..f2684bc9aff 100644 --- a/java/test/Ice/slicing/exceptions/csrc/AllTests.java +++ b/java/test/Ice/slicing/exceptions/csrc/AllTests.java @@ -22,606 +22,606 @@ public class AllTests private static class Callback { - Callback() - { - _called = false; - } - - public synchronized boolean - check() - { - while(!_called) - { - try - { - wait(5000); - } - catch(InterruptedException ex) - { - continue; - } - - if(!_called) - { - return false; // Must be timeout. - } - } - - _called = false; - return true; - } - - public synchronized void - called() - { - assert(!_called); - _called = true; - notify(); - } - - private boolean _called; + Callback() + { + _called = false; + } + + public synchronized boolean + check() + { + while(!_called) + { + try + { + wait(5000); + } + catch(InterruptedException ex) + { + continue; + } + + if(!_called) + { + return false; // Must be timeout. + } + } + + _called = false; + return true; + } + + public synchronized void + called() + { + assert(!_called); + _called = true; + notify(); + } + + private boolean _called; } private static class AMI_Test_baseAsBaseI extends AMI_TestIntf_baseAsBase { public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(Base b) - { - test(b.b.equals("Base.b")); - test(b.ice_name().equals("Test::Base")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(Base b) + { + test(b.b.equals("Base.b")); + test(b.ice_name().equals("Test::Base")); + } + catch(Exception ex) + { + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_unknownDerivedAsBaseI extends AMI_TestIntf_unknownDerivedAsBase { public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(Base b) - { - test(b.b.equals("UnknownDerived.b")); - test(b.ice_name().equals("Test::Base")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(Base b) + { + test(b.b.equals("UnknownDerived.b")); + test(b.ice_name().equals("Test::Base")); + } + catch(Exception ex) + { + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_knownDerivedAsBaseI extends AMI_TestIntf_knownDerivedAsBase { public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(KnownDerived k) - { - test(k.b.equals("KnownDerived.b")); - test(k.kd.equals("KnownDerived.kd")); - test(k.ice_name().equals("Test::KnownDerived")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(KnownDerived k) + { + test(k.b.equals("KnownDerived.b")); + test(k.kd.equals("KnownDerived.kd")); + test(k.ice_name().equals("Test::KnownDerived")); + } + catch(Exception ex) + { + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_knownDerivedAsKnownDerivedI extends AMI_TestIntf_knownDerivedAsKnownDerived { public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(KnownDerived k) - { - test(k.b.equals("KnownDerived.b")); - test(k.kd.equals("KnownDerived.kd")); - test(k.ice_name().equals("Test::KnownDerived")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(KnownDerived k) + { + test(k.b.equals("KnownDerived.b")); + test(k.kd.equals("KnownDerived.kd")); + test(k.ice_name().equals("Test::KnownDerived")); + } + catch(Exception ex) + { + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_unknownIntermediateAsBaseI extends AMI_TestIntf_unknownIntermediateAsBase { public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(Base b) - { - test(b.b.equals("UnknownIntermediate.b")); - test(b.ice_name().equals("Test::Base")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(Base b) + { + test(b.b.equals("UnknownIntermediate.b")); + test(b.ice_name().equals("Test::Base")); + } + catch(Exception ex) + { + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_knownIntermediateAsBaseI extends AMI_TestIntf_knownIntermediateAsBase { public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(KnownIntermediate ki) - { - test(ki.b.equals("KnownIntermediate.b")); - test(ki.ki.equals("KnownIntermediate.ki")); - test(ki.ice_name().equals("Test::KnownIntermediate")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(KnownIntermediate ki) + { + test(ki.b.equals("KnownIntermediate.b")); + test(ki.ki.equals("KnownIntermediate.ki")); + test(ki.ice_name().equals("Test::KnownIntermediate")); + } + catch(Exception ex) + { + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_knownMostDerivedAsBaseI extends AMI_TestIntf_knownMostDerivedAsBase { public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(KnownMostDerived kmd) - { - test(kmd.b.equals("KnownMostDerived.b")); - test(kmd.ki.equals("KnownMostDerived.ki")); - test(kmd.kmd.equals("KnownMostDerived.kmd")); - test(kmd.ice_name().equals("Test::KnownMostDerived")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(KnownMostDerived kmd) + { + test(kmd.b.equals("KnownMostDerived.b")); + test(kmd.ki.equals("KnownMostDerived.ki")); + test(kmd.kmd.equals("KnownMostDerived.kmd")); + test(kmd.ice_name().equals("Test::KnownMostDerived")); + } + catch(Exception ex) + { + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_knownIntermediateAsKnownIntermediateI - extends AMI_TestIntf_knownIntermediateAsKnownIntermediate + extends AMI_TestIntf_knownIntermediateAsKnownIntermediate { public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(KnownIntermediate ki) - { - test(ki.b.equals("KnownIntermediate.b")); - test(ki.ki.equals("KnownIntermediate.ki")); - test(ki.ice_name().equals("Test::KnownIntermediate")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(KnownIntermediate ki) + { + test(ki.b.equals("KnownIntermediate.b")); + test(ki.ki.equals("KnownIntermediate.ki")); + test(ki.ice_name().equals("Test::KnownIntermediate")); + } + catch(Exception ex) + { + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_knownMostDerivedAsKnownIntermediateI - extends AMI_TestIntf_knownMostDerivedAsKnownIntermediate + extends AMI_TestIntf_knownMostDerivedAsKnownIntermediate { public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(KnownMostDerived kmd) - { - test(kmd.b.equals("KnownMostDerived.b")); - test(kmd.ki.equals("KnownMostDerived.ki")); - test(kmd.kmd.equals("KnownMostDerived.kmd")); - test(kmd.ice_name().equals("Test::KnownMostDerived")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(KnownMostDerived kmd) + { + test(kmd.b.equals("KnownMostDerived.b")); + test(kmd.ki.equals("KnownMostDerived.ki")); + test(kmd.kmd.equals("KnownMostDerived.kmd")); + test(kmd.ice_name().equals("Test::KnownMostDerived")); + } + catch(Exception ex) + { + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_knownMostDerivedAsKnownMostDerivedI - extends AMI_TestIntf_knownMostDerivedAsKnownMostDerived + extends AMI_TestIntf_knownMostDerivedAsKnownMostDerived { public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(KnownMostDerived kmd) - { - test(kmd.b.equals("KnownMostDerived.b")); - test(kmd.ki.equals("KnownMostDerived.ki")); - test(kmd.kmd.equals("KnownMostDerived.kmd")); - test(kmd.ice_name().equals("Test::KnownMostDerived")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(KnownMostDerived kmd) + { + test(kmd.b.equals("KnownMostDerived.b")); + test(kmd.ki.equals("KnownMostDerived.ki")); + test(kmd.kmd.equals("KnownMostDerived.kmd")); + test(kmd.ice_name().equals("Test::KnownMostDerived")); + } + catch(Exception ex) + { + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_unknownMostDerived1AsBaseI extends AMI_TestIntf_unknownMostDerived1AsBase { public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(KnownIntermediate ki) - { - test(ki.b.equals("UnknownMostDerived1.b")); - test(ki.ki.equals("UnknownMostDerived1.ki")); - test(ki.ice_name().equals("Test::KnownIntermediate")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(KnownIntermediate ki) + { + test(ki.b.equals("UnknownMostDerived1.b")); + test(ki.ki.equals("UnknownMostDerived1.ki")); + test(ki.ice_name().equals("Test::KnownIntermediate")); + } + catch(Exception ex) + { + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_unknownMostDerived1AsKnownIntermediateI - extends AMI_TestIntf_unknownMostDerived1AsKnownIntermediate + extends AMI_TestIntf_unknownMostDerived1AsKnownIntermediate { public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(KnownIntermediate ki) - { - test(ki.b.equals("UnknownMostDerived1.b")); - test(ki.ki.equals("UnknownMostDerived1.ki")); - test(ki.ice_name().equals("Test::KnownIntermediate")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(KnownIntermediate ki) + { + test(ki.b.equals("UnknownMostDerived1.b")); + test(ki.ki.equals("UnknownMostDerived1.ki")); + test(ki.ice_name().equals("Test::KnownIntermediate")); + } + catch(Exception ex) + { + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_unknownMostDerived2AsBaseI extends AMI_TestIntf_unknownMostDerived2AsBase { public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(Base b) - { - test(b.b.equals("UnknownMostDerived2.b")); - test(b.ice_name().equals("Test::Base")); - } - catch(Exception ex) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + throw exc; + } + catch(Base b) + { + test(b.b.equals("UnknownMostDerived2.b")); + test(b.ice_name().equals("Test::Base")); + } + catch(Exception ex) + { + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } public static TestIntfPrx @@ -641,395 +641,395 @@ public class AllTests test(test.equals(base)); System.out.println("ok"); - System.out.print("base... "); + System.out.print("base... "); + System.out.flush(); + { + try + { + test.baseAsBase(); + test(false); + } + catch(Base b) + { + test(b.b.equals("Base.b")); + test(b.ice_name().equals("Test::Base")); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("base (AMI)... "); + System.out.flush(); + { + AMI_Test_baseAsBaseI cb = new AMI_Test_baseAsBaseI(); + test.baseAsBase_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("slicing of unknown derived... "); + System.out.flush(); + { + try + { + test.unknownDerivedAsBase(); + test(false); + } + catch(Base b) + { + test(b.b.equals("UnknownDerived.b")); + test(b.ice_name().equals("Test::Base")); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("slicing of unknown derived (AMI)... "); + System.out.flush(); + { + AMI_Test_unknownDerivedAsBaseI cb = new AMI_Test_unknownDerivedAsBaseI(); + test.unknownDerivedAsBase_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("non-slicing of known derived as base... "); + System.out.flush(); + { + try + { + test.knownDerivedAsBase(); + test(false); + } + catch(KnownDerived k) + { + test(k.b.equals("KnownDerived.b")); + test(k.kd.equals("KnownDerived.kd")); + test(k.ice_name().equals("Test::KnownDerived")); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("non-slicing of known derived as base (AMI)... "); + System.out.flush(); + { + AMI_Test_knownDerivedAsBaseI cb = new AMI_Test_knownDerivedAsBaseI(); + test.knownDerivedAsBase_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("non-slicing of known derived as derived... "); + System.out.flush(); + { + try + { + test.knownDerivedAsKnownDerived(); + test(false); + } + catch(KnownDerived k) + { + test(k.b.equals("KnownDerived.b")); + test(k.kd.equals("KnownDerived.kd")); + test(k.ice_name().equals("Test::KnownDerived")); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("non-slicing of known derived as derived (AMI)... "); + System.out.flush(); + { + AMI_Test_knownDerivedAsKnownDerivedI cb = new AMI_Test_knownDerivedAsKnownDerivedI(); + test.knownDerivedAsKnownDerived_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("slicing of unknown intermediate as base... "); + System.out.flush(); + { + try + { + test.unknownIntermediateAsBase(); + test(false); + } + catch(Base b) + { + test(b.b.equals("UnknownIntermediate.b")); + test(b.ice_name().equals("Test::Base")); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("slicing of unknown intermediate as base (AMI)... "); + System.out.flush(); + { + AMI_Test_unknownIntermediateAsBaseI cb = new AMI_Test_unknownIntermediateAsBaseI(); + test.unknownIntermediateAsBase_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("slicing of known intermediate as base... "); + System.out.flush(); + { + try + { + test.knownIntermediateAsBase(); + test(false); + } + catch(KnownIntermediate ki) + { + test(ki.b.equals("KnownIntermediate.b")); + test(ki.ki.equals("KnownIntermediate.ki")); + test(ki.ice_name().equals("Test::KnownIntermediate")); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("slicing of known intermediate as base (AMI)... "); + System.out.flush(); + { + AMI_Test_knownIntermediateAsBaseI cb = new AMI_Test_knownIntermediateAsBaseI(); + test.knownIntermediateAsBase_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("slicing of known most derived as base... "); + System.out.flush(); + { + try + { + test.knownMostDerivedAsBase(); + test(false); + } + catch(KnownMostDerived kmd) + { + test(kmd.b.equals("KnownMostDerived.b")); + test(kmd.ki.equals("KnownMostDerived.ki")); + test(kmd.kmd.equals("KnownMostDerived.kmd")); + test(kmd.ice_name().equals("Test::KnownMostDerived")); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("slicing of known most derived as base (AMI)... "); + System.out.flush(); + { + AMI_Test_knownMostDerivedAsBaseI cb = new AMI_Test_knownMostDerivedAsBaseI(); + test.knownMostDerivedAsBase_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("non-slicing of known intermediate as intermediate... "); + System.out.flush(); + { + try + { + test.knownIntermediateAsKnownIntermediate(); + test(false); + } + catch(KnownIntermediate ki) + { + test(ki.b.equals("KnownIntermediate.b")); + test(ki.ki.equals("KnownIntermediate.ki")); + test(ki.ice_name().equals("Test::KnownIntermediate")); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("non-slicing of known intermediate as intermediate (AMI)... "); + System.out.flush(); + { + AMI_Test_knownIntermediateAsKnownIntermediateI cb = new AMI_Test_knownIntermediateAsKnownIntermediateI(); + test.knownIntermediateAsKnownIntermediate_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("non-slicing of known most derived as intermediate... "); System.out.flush(); - { - try - { - test.baseAsBase(); - test(false); - } - catch(Base b) - { - test(b.b.equals("Base.b")); - test(b.ice_name().equals("Test::Base")); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("base (AMI)... "); + { + try + { + test.knownMostDerivedAsKnownIntermediate(); + test(false); + } + catch(KnownMostDerived kmd) + { + test(kmd.b.equals("KnownMostDerived.b")); + test(kmd.ki.equals("KnownMostDerived.ki")); + test(kmd.kmd.equals("KnownMostDerived.kmd")); + test(kmd.ice_name().equals("Test::KnownMostDerived")); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("non-slicing of known most derived as intermediate (AMI)... "); System.out.flush(); - { - AMI_Test_baseAsBaseI cb = new AMI_Test_baseAsBaseI(); - test.baseAsBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("slicing of unknown derived... "); - System.out.flush(); - { - try - { - test.unknownDerivedAsBase(); - test(false); - } - catch(Base b) - { - test(b.b.equals("UnknownDerived.b")); - test(b.ice_name().equals("Test::Base")); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("slicing of unknown derived (AMI)... "); - System.out.flush(); - { - AMI_Test_unknownDerivedAsBaseI cb = new AMI_Test_unknownDerivedAsBaseI(); - test.unknownDerivedAsBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("non-slicing of known derived as base... "); - System.out.flush(); - { - try - { - test.knownDerivedAsBase(); - test(false); - } - catch(KnownDerived k) - { - test(k.b.equals("KnownDerived.b")); - test(k.kd.equals("KnownDerived.kd")); - test(k.ice_name().equals("Test::KnownDerived")); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("non-slicing of known derived as base (AMI)... "); - System.out.flush(); - { - AMI_Test_knownDerivedAsBaseI cb = new AMI_Test_knownDerivedAsBaseI(); - test.knownDerivedAsBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("non-slicing of known derived as derived... "); - System.out.flush(); - { - try - { - test.knownDerivedAsKnownDerived(); - test(false); - } - catch(KnownDerived k) - { - test(k.b.equals("KnownDerived.b")); - test(k.kd.equals("KnownDerived.kd")); - test(k.ice_name().equals("Test::KnownDerived")); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("non-slicing of known derived as derived (AMI)... "); - System.out.flush(); - { - AMI_Test_knownDerivedAsKnownDerivedI cb = new AMI_Test_knownDerivedAsKnownDerivedI(); - test.knownDerivedAsKnownDerived_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("slicing of unknown intermediate as base... "); - System.out.flush(); - { - try - { - test.unknownIntermediateAsBase(); - test(false); - } - catch(Base b) - { - test(b.b.equals("UnknownIntermediate.b")); - test(b.ice_name().equals("Test::Base")); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("slicing of unknown intermediate as base (AMI)... "); - System.out.flush(); - { - AMI_Test_unknownIntermediateAsBaseI cb = new AMI_Test_unknownIntermediateAsBaseI(); - test.unknownIntermediateAsBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("slicing of known intermediate as base... "); - System.out.flush(); - { - try - { - test.knownIntermediateAsBase(); - test(false); - } - catch(KnownIntermediate ki) - { - test(ki.b.equals("KnownIntermediate.b")); - test(ki.ki.equals("KnownIntermediate.ki")); - test(ki.ice_name().equals("Test::KnownIntermediate")); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("slicing of known intermediate as base (AMI)... "); - System.out.flush(); - { - AMI_Test_knownIntermediateAsBaseI cb = new AMI_Test_knownIntermediateAsBaseI(); - test.knownIntermediateAsBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("slicing of known most derived as base... "); - System.out.flush(); - { - try - { - test.knownMostDerivedAsBase(); - test(false); - } - catch(KnownMostDerived kmd) - { - test(kmd.b.equals("KnownMostDerived.b")); - test(kmd.ki.equals("KnownMostDerived.ki")); - test(kmd.kmd.equals("KnownMostDerived.kmd")); - test(kmd.ice_name().equals("Test::KnownMostDerived")); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("slicing of known most derived as base (AMI)... "); - System.out.flush(); - { - AMI_Test_knownMostDerivedAsBaseI cb = new AMI_Test_knownMostDerivedAsBaseI(); - test.knownMostDerivedAsBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("non-slicing of known intermediate as intermediate... "); - System.out.flush(); - { - try - { - test.knownIntermediateAsKnownIntermediate(); - test(false); - } - catch(KnownIntermediate ki) - { - test(ki.b.equals("KnownIntermediate.b")); - test(ki.ki.equals("KnownIntermediate.ki")); - test(ki.ice_name().equals("Test::KnownIntermediate")); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("non-slicing of known intermediate as intermediate (AMI)... "); - System.out.flush(); - { - AMI_Test_knownIntermediateAsKnownIntermediateI cb = new AMI_Test_knownIntermediateAsKnownIntermediateI(); - test.knownIntermediateAsKnownIntermediate_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("non-slicing of known most derived as intermediate... "); - System.out.flush(); - { - try - { - test.knownMostDerivedAsKnownIntermediate(); - test(false); - } - catch(KnownMostDerived kmd) - { - test(kmd.b.equals("KnownMostDerived.b")); - test(kmd.ki.equals("KnownMostDerived.ki")); - test(kmd.kmd.equals("KnownMostDerived.kmd")); - test(kmd.ice_name().equals("Test::KnownMostDerived")); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("non-slicing of known most derived as intermediate (AMI)... "); - System.out.flush(); - { - AMI_Test_knownMostDerivedAsKnownIntermediateI cb = new AMI_Test_knownMostDerivedAsKnownIntermediateI(); - test.knownMostDerivedAsKnownIntermediate_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("non-slicing of known most derived as most derived... "); - System.out.flush(); - { - try - { - test.knownMostDerivedAsKnownMostDerived(); - test(false); - } - catch(KnownMostDerived kmd) - { - test(kmd.b.equals("KnownMostDerived.b")); - test(kmd.ki.equals("KnownMostDerived.ki")); - test(kmd.kmd.equals("KnownMostDerived.kmd")); - test(kmd.ice_name().equals("Test::KnownMostDerived")); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("non-slicing of known most derived as most derived (AMI)... "); - System.out.flush(); - { - AMI_Test_knownMostDerivedAsKnownMostDerivedI cb = new AMI_Test_knownMostDerivedAsKnownMostDerivedI(); - test.knownMostDerivedAsKnownMostDerived_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("slicing of unknown most derived, known intermediate as base... "); - System.out.flush(); - { - try - { - test.unknownMostDerived1AsBase(); - test(false); - } - catch(KnownIntermediate ki) - { - test(ki.b.equals("UnknownMostDerived1.b")); - test(ki.ki.equals("UnknownMostDerived1.ki")); - test(ki.ice_name().equals("Test::KnownIntermediate")); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("slicing of unknown most derived, known intermediate as base (AMI)... "); - System.out.flush(); - { - AMI_Test_unknownMostDerived1AsBaseI cb = new AMI_Test_unknownMostDerived1AsBaseI(); - test.unknownMostDerived1AsBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("slicing of unknown most derived, known intermediate as intermediate... "); - System.out.flush(); - { - try - { - test.unknownMostDerived1AsKnownIntermediate(); - test(false); - } - catch(KnownIntermediate ki) - { - test(ki.b.equals("UnknownMostDerived1.b")); - test(ki.ki.equals("UnknownMostDerived1.ki")); - test(ki.ice_name().equals("Test::KnownIntermediate")); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("slicing of unknown most derived, known intermediate as intermediate (AMI)... "); - System.out.flush(); - { - AMI_Test_unknownMostDerived1AsKnownIntermediateI cb = - new AMI_Test_unknownMostDerived1AsKnownIntermediateI(); - test.unknownMostDerived1AsKnownIntermediate_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("slicing of unknown most derived, unknown intermediate thrown as base... "); - System.out.flush(); - { - try - { - test.unknownMostDerived2AsBase(); - test(false); - } - catch(Base b) - { - test(b.b.equals("UnknownMostDerived2.b")); - test(b.ice_name().equals("Test::Base")); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("slicing of unknown most derived, unknown intermediate thrown as base (AMI)... "); - System.out.flush(); - { - AMI_Test_unknownMostDerived2AsBaseI cb = new AMI_Test_unknownMostDerived2AsBaseI(); - test.unknownMostDerived2AsBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); + { + AMI_Test_knownMostDerivedAsKnownIntermediateI cb = new AMI_Test_knownMostDerivedAsKnownIntermediateI(); + test.knownMostDerivedAsKnownIntermediate_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("non-slicing of known most derived as most derived... "); + System.out.flush(); + { + try + { + test.knownMostDerivedAsKnownMostDerived(); + test(false); + } + catch(KnownMostDerived kmd) + { + test(kmd.b.equals("KnownMostDerived.b")); + test(kmd.ki.equals("KnownMostDerived.ki")); + test(kmd.kmd.equals("KnownMostDerived.kmd")); + test(kmd.ice_name().equals("Test::KnownMostDerived")); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("non-slicing of known most derived as most derived (AMI)... "); + System.out.flush(); + { + AMI_Test_knownMostDerivedAsKnownMostDerivedI cb = new AMI_Test_knownMostDerivedAsKnownMostDerivedI(); + test.knownMostDerivedAsKnownMostDerived_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("slicing of unknown most derived, known intermediate as base... "); + System.out.flush(); + { + try + { + test.unknownMostDerived1AsBase(); + test(false); + } + catch(KnownIntermediate ki) + { + test(ki.b.equals("UnknownMostDerived1.b")); + test(ki.ki.equals("UnknownMostDerived1.ki")); + test(ki.ice_name().equals("Test::KnownIntermediate")); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("slicing of unknown most derived, known intermediate as base (AMI)... "); + System.out.flush(); + { + AMI_Test_unknownMostDerived1AsBaseI cb = new AMI_Test_unknownMostDerived1AsBaseI(); + test.unknownMostDerived1AsBase_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("slicing of unknown most derived, known intermediate as intermediate... "); + System.out.flush(); + { + try + { + test.unknownMostDerived1AsKnownIntermediate(); + test(false); + } + catch(KnownIntermediate ki) + { + test(ki.b.equals("UnknownMostDerived1.b")); + test(ki.ki.equals("UnknownMostDerived1.ki")); + test(ki.ice_name().equals("Test::KnownIntermediate")); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("slicing of unknown most derived, known intermediate as intermediate (AMI)... "); + System.out.flush(); + { + AMI_Test_unknownMostDerived1AsKnownIntermediateI cb = + new AMI_Test_unknownMostDerived1AsKnownIntermediateI(); + test.unknownMostDerived1AsKnownIntermediate_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("slicing of unknown most derived, unknown intermediate thrown as base... "); + System.out.flush(); + { + try + { + test.unknownMostDerived2AsBase(); + test(false); + } + catch(Base b) + { + test(b.b.equals("UnknownMostDerived2.b")); + test(b.ice_name().equals("Test::Base")); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("slicing of unknown most derived, unknown intermediate thrown as base (AMI)... "); + System.out.flush(); + { + AMI_Test_unknownMostDerived2AsBaseI cb = new AMI_Test_unknownMostDerived2AsBaseI(); + test.unknownMostDerived2AsBase_async(cb); + test(cb.check()); + } + System.out.println("ok"); return test; } diff --git a/java/test/Ice/slicing/exceptions/csrc/Client.java b/java/test/Ice/slicing/exceptions/csrc/Client.java index b766d24bc3f..14feb00a91a 100644 --- a/java/test/Ice/slicing/exceptions/csrc/Client.java +++ b/java/test/Ice/slicing/exceptions/csrc/Client.java @@ -49,7 +49,7 @@ public class Client } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/slicing/exceptions/ssrc/Server.java b/java/test/Ice/slicing/exceptions/ssrc/Server.java index 1274fb465dc..03ede9cb41c 100644 --- a/java/test/Ice/slicing/exceptions/ssrc/Server.java +++ b/java/test/Ice/slicing/exceptions/ssrc/Server.java @@ -53,7 +53,7 @@ public class Server } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/slicing/exceptions/ssrc/TestI.java b/java/test/Ice/slicing/exceptions/ssrc/TestI.java index 40ddeb88d1c..5f1070b7e95 100644 --- a/java/test/Ice/slicing/exceptions/ssrc/TestI.java +++ b/java/test/Ice/slicing/exceptions/ssrc/TestI.java @@ -28,134 +28,134 @@ public final class TestI extends _TestIntfDisp throws Base { Base b = new Base(); - b.b = "Base.b"; - throw b; + b.b = "Base.b"; + throw b; } public void unknownDerivedAsBase(Ice.Current current) throws Base { - UnknownDerived d = new UnknownDerived(); - d.b = "UnknownDerived.b"; - d.ud = "UnknownDerived.ud"; - throw d; + UnknownDerived d = new UnknownDerived(); + d.b = "UnknownDerived.b"; + d.ud = "UnknownDerived.ud"; + throw d; } public void knownDerivedAsBase(Ice.Current current) throws Base { - KnownDerived d = new KnownDerived(); - d.b = "KnownDerived.b"; - d.kd = "KnownDerived.kd"; - throw d; + KnownDerived d = new KnownDerived(); + d.b = "KnownDerived.b"; + d.kd = "KnownDerived.kd"; + throw d; } public void knownDerivedAsKnownDerived(Ice.Current current) throws KnownDerived { - KnownDerived d = new KnownDerived(); - d.b = "KnownDerived.b"; - d.kd = "KnownDerived.kd"; - throw d; + KnownDerived d = new KnownDerived(); + d.b = "KnownDerived.b"; + d.kd = "KnownDerived.kd"; + throw d; } public void unknownIntermediateAsBase(Ice.Current current) throws Base { - UnknownIntermediate ui = new UnknownIntermediate(); - ui.b = "UnknownIntermediate.b"; - ui.ui = "UnknownIntermediate.ui"; - throw ui; + UnknownIntermediate ui = new UnknownIntermediate(); + ui.b = "UnknownIntermediate.b"; + ui.ui = "UnknownIntermediate.ui"; + throw ui; } public void knownIntermediateAsBase(Ice.Current current) throws Base { - KnownIntermediate ki = new KnownIntermediate(); - ki.b = "KnownIntermediate.b"; - ki.ki = "KnownIntermediate.ki"; - throw ki; + KnownIntermediate ki = new KnownIntermediate(); + ki.b = "KnownIntermediate.b"; + ki.ki = "KnownIntermediate.ki"; + throw ki; } public void knownMostDerivedAsBase(Ice.Current current) throws Base { - KnownMostDerived kmd = new KnownMostDerived(); - kmd.b = "KnownMostDerived.b"; - kmd.ki = "KnownMostDerived.ki"; - kmd.kmd = "KnownMostDerived.kmd"; - throw kmd; + KnownMostDerived kmd = new KnownMostDerived(); + kmd.b = "KnownMostDerived.b"; + kmd.ki = "KnownMostDerived.ki"; + kmd.kmd = "KnownMostDerived.kmd"; + throw kmd; } public void knownIntermediateAsKnownIntermediate(Ice.Current current) throws KnownIntermediate { - KnownIntermediate ki = new KnownIntermediate(); - ki.b = "KnownIntermediate.b"; - ki.ki = "KnownIntermediate.ki"; - throw ki; + KnownIntermediate ki = new KnownIntermediate(); + ki.b = "KnownIntermediate.b"; + ki.ki = "KnownIntermediate.ki"; + throw ki; } public void knownMostDerivedAsKnownIntermediate(Ice.Current current) throws KnownIntermediate { - KnownMostDerived kmd = new KnownMostDerived(); - kmd.b = "KnownMostDerived.b"; - kmd.ki = "KnownMostDerived.ki"; - kmd.kmd = "KnownMostDerived.kmd"; - throw kmd; + KnownMostDerived kmd = new KnownMostDerived(); + kmd.b = "KnownMostDerived.b"; + kmd.ki = "KnownMostDerived.ki"; + kmd.kmd = "KnownMostDerived.kmd"; + throw kmd; } public void knownMostDerivedAsKnownMostDerived(Ice.Current current) throws KnownMostDerived { - KnownMostDerived kmd = new KnownMostDerived(); - kmd.b = "KnownMostDerived.b"; - kmd.ki = "KnownMostDerived.ki"; - kmd.kmd = "KnownMostDerived.kmd"; - throw kmd; + KnownMostDerived kmd = new KnownMostDerived(); + kmd.b = "KnownMostDerived.b"; + kmd.ki = "KnownMostDerived.ki"; + kmd.kmd = "KnownMostDerived.kmd"; + throw kmd; } public void unknownMostDerived1AsBase(Ice.Current current) throws Base { - UnknownMostDerived1 umd1 = new UnknownMostDerived1(); - umd1.b = "UnknownMostDerived1.b"; - umd1.ki = "UnknownMostDerived1.ki"; - umd1.umd1 = "UnknownMostDerived1.umd1"; - throw umd1; + UnknownMostDerived1 umd1 = new UnknownMostDerived1(); + umd1.b = "UnknownMostDerived1.b"; + umd1.ki = "UnknownMostDerived1.ki"; + umd1.umd1 = "UnknownMostDerived1.umd1"; + throw umd1; } public void unknownMostDerived1AsKnownIntermediate(Ice.Current current) throws KnownIntermediate { - UnknownMostDerived1 umd1 = new UnknownMostDerived1(); - umd1.b = "UnknownMostDerived1.b"; - umd1.ki = "UnknownMostDerived1.ki"; - umd1.umd1 = "UnknownMostDerived1.umd1"; - throw umd1; + UnknownMostDerived1 umd1 = new UnknownMostDerived1(); + umd1.b = "UnknownMostDerived1.b"; + umd1.ki = "UnknownMostDerived1.ki"; + umd1.umd1 = "UnknownMostDerived1.umd1"; + throw umd1; } public void unknownMostDerived2AsBase(Ice.Current current) throws Base { - UnknownMostDerived2 umd2 = new UnknownMostDerived2(); - umd2.b = "UnknownMostDerived2.b"; - umd2.ui = "UnknownMostDerived2.ui"; - umd2.umd2 = "UnknownMostDerived2.umd2"; - throw umd2; + UnknownMostDerived2 umd2 = new UnknownMostDerived2(); + umd2.b = "UnknownMostDerived2.b"; + umd2.ui = "UnknownMostDerived2.ui"; + umd2.umd2 = "UnknownMostDerived2.umd2"; + throw umd2; } private Ice.ObjectAdapter _adapter; } diff --git a/java/test/Ice/slicing/exceptionsAMD/Server.java b/java/test/Ice/slicing/exceptionsAMD/Server.java index f444f94ba6d..c1a6dba0ac3 100644 --- a/java/test/Ice/slicing/exceptionsAMD/Server.java +++ b/java/test/Ice/slicing/exceptionsAMD/Server.java @@ -53,7 +53,7 @@ public class Server } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/slicing/exceptionsAMD/TestI.java b/java/test/Ice/slicing/exceptionsAMD/TestI.java index 9c5dc78e31b..1f2b85dba9e 100644 --- a/java/test/Ice/slicing/exceptionsAMD/TestI.java +++ b/java/test/Ice/slicing/exceptionsAMD/TestI.java @@ -21,7 +21,7 @@ public final class TestI extends _TestIntfDisp shutdown_async(AMD_TestIntf_shutdown cb, Ice.Current current) { _adapter.getCommunicator().shutdown(); - cb.ice_response(); + cb.ice_response(); } public void @@ -29,115 +29,115 @@ public final class TestI extends _TestIntfDisp throws Base { Base b = new Base(); - b.b = "Base.b"; - cb.ice_exception(b); + b.b = "Base.b"; + cb.ice_exception(b); } public void unknownDerivedAsBase_async(AMD_TestIntf_unknownDerivedAsBase cb, Ice.Current current) throws Base { - UnknownDerived d = new UnknownDerived(); - d.b = "UnknownDerived.b"; - d.ud = "UnknownDerived.ud"; - cb.ice_exception(d); + UnknownDerived d = new UnknownDerived(); + d.b = "UnknownDerived.b"; + d.ud = "UnknownDerived.ud"; + cb.ice_exception(d); } public void knownDerivedAsBase_async(AMD_TestIntf_knownDerivedAsBase cb, Ice.Current current) throws Base { - KnownDerived d = new KnownDerived(); - d.b = "KnownDerived.b"; - d.kd = "KnownDerived.kd"; - cb.ice_exception(d); + KnownDerived d = new KnownDerived(); + d.b = "KnownDerived.b"; + d.kd = "KnownDerived.kd"; + cb.ice_exception(d); } public void knownDerivedAsKnownDerived_async(AMD_TestIntf_knownDerivedAsKnownDerived cb, Ice.Current current) throws KnownDerived { - KnownDerived d = new KnownDerived(); - d.b = "KnownDerived.b"; - d.kd = "KnownDerived.kd"; - cb.ice_exception(d); + KnownDerived d = new KnownDerived(); + d.b = "KnownDerived.b"; + d.kd = "KnownDerived.kd"; + cb.ice_exception(d); } public void unknownIntermediateAsBase_async(AMD_TestIntf_unknownIntermediateAsBase cb, Ice.Current current) throws Base { - UnknownIntermediate ui = new UnknownIntermediate(); - ui.b = "UnknownIntermediate.b"; - ui.ui = "UnknownIntermediate.ui"; - cb.ice_exception(ui); + UnknownIntermediate ui = new UnknownIntermediate(); + ui.b = "UnknownIntermediate.b"; + ui.ui = "UnknownIntermediate.ui"; + cb.ice_exception(ui); } public void knownIntermediateAsBase_async(AMD_TestIntf_knownIntermediateAsBase cb, Ice.Current current) throws Base { - KnownIntermediate ki = new KnownIntermediate(); - ki.b = "KnownIntermediate.b"; - ki.ki = "KnownIntermediate.ki"; - cb.ice_exception(ki); + KnownIntermediate ki = new KnownIntermediate(); + ki.b = "KnownIntermediate.b"; + ki.ki = "KnownIntermediate.ki"; + cb.ice_exception(ki); } public void knownMostDerivedAsBase_async(AMD_TestIntf_knownMostDerivedAsBase cb, Ice.Current current) throws Base { - KnownMostDerived kmd = new KnownMostDerived(); - kmd.b = "KnownMostDerived.b"; - kmd.ki = "KnownMostDerived.ki"; - kmd.kmd = "KnownMostDerived.kmd"; - cb.ice_exception(kmd); + KnownMostDerived kmd = new KnownMostDerived(); + kmd.b = "KnownMostDerived.b"; + kmd.ki = "KnownMostDerived.ki"; + kmd.kmd = "KnownMostDerived.kmd"; + cb.ice_exception(kmd); } public void knownIntermediateAsKnownIntermediate_async(AMD_TestIntf_knownIntermediateAsKnownIntermediate cb, - Ice.Current current) + Ice.Current current) throws KnownIntermediate { - KnownIntermediate ki = new KnownIntermediate(); - ki.b = "KnownIntermediate.b"; - ki.ki = "KnownIntermediate.ki"; - cb.ice_exception(ki); + KnownIntermediate ki = new KnownIntermediate(); + ki.b = "KnownIntermediate.b"; + ki.ki = "KnownIntermediate.ki"; + cb.ice_exception(ki); } public void knownMostDerivedAsKnownIntermediate_async(AMD_TestIntf_knownMostDerivedAsKnownIntermediate cb, - Ice.Current current) + Ice.Current current) throws KnownIntermediate { - KnownMostDerived kmd = new KnownMostDerived(); - kmd.b = "KnownMostDerived.b"; - kmd.ki = "KnownMostDerived.ki"; - kmd.kmd = "KnownMostDerived.kmd"; - cb.ice_exception(kmd); + KnownMostDerived kmd = new KnownMostDerived(); + kmd.b = "KnownMostDerived.b"; + kmd.ki = "KnownMostDerived.ki"; + kmd.kmd = "KnownMostDerived.kmd"; + cb.ice_exception(kmd); } public void knownMostDerivedAsKnownMostDerived_async(AMD_TestIntf_knownMostDerivedAsKnownMostDerived cb, - Ice.Current current) + Ice.Current current) throws KnownMostDerived { - KnownMostDerived kmd = new KnownMostDerived(); - kmd.b = "KnownMostDerived.b"; - kmd.ki = "KnownMostDerived.ki"; - kmd.kmd = "KnownMostDerived.kmd"; - cb.ice_exception(kmd); + KnownMostDerived kmd = new KnownMostDerived(); + kmd.b = "KnownMostDerived.b"; + kmd.ki = "KnownMostDerived.ki"; + kmd.kmd = "KnownMostDerived.kmd"; + cb.ice_exception(kmd); } public void unknownMostDerived1AsBase_async(AMD_TestIntf_unknownMostDerived1AsBase cb, Ice.Current current) throws Base { - UnknownMostDerived1 umd1 = new UnknownMostDerived1(); - umd1.b = "UnknownMostDerived1.b"; - umd1.ki = "UnknownMostDerived1.ki"; - umd1.umd1 = "UnknownMostDerived1.umd1"; - cb.ice_exception(umd1); + UnknownMostDerived1 umd1 = new UnknownMostDerived1(); + umd1.b = "UnknownMostDerived1.b"; + umd1.ki = "UnknownMostDerived1.ki"; + umd1.umd1 = "UnknownMostDerived1.umd1"; + cb.ice_exception(umd1); } public void @@ -145,22 +145,22 @@ public final class TestI extends _TestIntfDisp Ice.Current current) throws KnownIntermediate { - UnknownMostDerived1 umd1 = new UnknownMostDerived1(); - umd1.b = "UnknownMostDerived1.b"; - umd1.ki = "UnknownMostDerived1.ki"; - umd1.umd1 = "UnknownMostDerived1.umd1"; - cb.ice_exception(umd1); + UnknownMostDerived1 umd1 = new UnknownMostDerived1(); + umd1.b = "UnknownMostDerived1.b"; + umd1.ki = "UnknownMostDerived1.ki"; + umd1.umd1 = "UnknownMostDerived1.umd1"; + cb.ice_exception(umd1); } public void unknownMostDerived2AsBase_async(AMD_TestIntf_unknownMostDerived2AsBase cb, Ice.Current current) throws Base { - UnknownMostDerived2 umd2 = new UnknownMostDerived2(); - umd2.b = "UnknownMostDerived2.b"; - umd2.ui = "UnknownMostDerived2.ui"; - umd2.umd2 = "UnknownMostDerived2.umd2"; - cb.ice_exception(umd2); + UnknownMostDerived2 umd2 = new UnknownMostDerived2(); + umd2.b = "UnknownMostDerived2.b"; + umd2.ui = "UnknownMostDerived2.ui"; + umd2.umd2 = "UnknownMostDerived2.umd2"; + cb.ice_exception(umd2); } private Ice.ObjectAdapter _adapter; } diff --git a/java/test/Ice/slicing/objects/Test.ice b/java/test/Ice/slicing/objects/Test.ice index 9d31ce660b5..01e91579311 100644 --- a/java/test/Ice/slicing/objects/Test.ice +++ b/java/test/Ice/slicing/objects/Test.ice @@ -67,7 +67,7 @@ exception DerivedException extends BaseException D1 pd1; }; -class Forward; // Forward-declared class defined in another compilation unit +class Forward; // Forward-declared class defined in another compilation unit ["ami"] interface TestIntf { @@ -104,7 +104,7 @@ class Forward; // Forward-declared class defined in another compilation unit 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 useForward(out Forward f); // Use of forward-declared class to verify that code is generated correctly. void shutdown(); }; diff --git a/java/test/Ice/slicing/objects/csrc/AllTests.java b/java/test/Ice/slicing/objects/csrc/AllTests.java index 6a74f627600..6e0c9b244d6 100644 --- a/java/test/Ice/slicing/objects/csrc/AllTests.java +++ b/java/test/Ice/slicing/objects/csrc/AllTests.java @@ -22,967 +22,967 @@ public class AllTests private static class Callback { - Callback() - { - _called = false; - } - - public synchronized boolean - check() - { - while(!_called) - { - try - { - wait(5000); - } - catch(InterruptedException ex) - { - continue; - } - - if(!_called) - { - return false; // Must be timeout. - } - } - - _called = false; - return true; - } - - public synchronized void - called() - { - assert(!_called); - _called = true; - notify(); - } - - private boolean _called; + Callback() + { + _called = false; + } + + public synchronized boolean + check() + { + while(!_called) + { + try + { + wait(5000); + } + catch(InterruptedException ex) + { + continue; + } + + if(!_called) + { + return false; // Must be timeout. + } + } + + _called = false; + return true; + } + + public synchronized void + called() + { + assert(!_called); + _called = true; + notify(); + } + + private boolean _called; } private static class AMI_Test_SBaseAsObjectI extends AMI_TestIntf_SBaseAsObject { public void - ice_response(Ice.Object o) - { - test(o != null); - test(o.ice_id().equals("::Test::SBase")); - SBase sb = (SBase)o; - test(sb != null); - test(sb.sb.equals("SBase.sb")); - callback.called(); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response(Ice.Object o) + { + test(o != null); + test(o.ice_id().equals("::Test::SBase")); + SBase sb = (SBase)o; + test(sb != null); + test(sb.sb.equals("SBase.sb")); + callback.called(); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_SBaseAsSBaseI extends AMI_TestIntf_SBaseAsSBase { public void - ice_response(SBase sb) - { - test(sb.sb.equals("SBase.sb")); - callback.called(); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response(SBase sb) + { + test(sb.sb.equals("SBase.sb")); + callback.called(); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_SBSKnownDerivedAsSBaseI extends AMI_TestIntf_SBSKnownDerivedAsSBase { public void - ice_response(SBase sb) - { - test(sb.sb.equals("SBSKnownDerived.sb")); - SBSKnownDerived sbskd = (SBSKnownDerived)sb; - test(sbskd != null); - test(sbskd.sbskd.equals("SBSKnownDerived.sbskd")); - callback.called(); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response(SBase sb) + { + test(sb.sb.equals("SBSKnownDerived.sb")); + SBSKnownDerived sbskd = (SBSKnownDerived)sb; + test(sbskd != null); + test(sbskd.sbskd.equals("SBSKnownDerived.sbskd")); + callback.called(); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_SBSKnownDerivedAsSBSKnownDerivedI - extends AMI_TestIntf_SBSKnownDerivedAsSBSKnownDerived + extends AMI_TestIntf_SBSKnownDerivedAsSBSKnownDerived { public void - ice_response(SBSKnownDerived sbskd) - { - test(sbskd.sbskd.equals("SBSKnownDerived.sbskd")); - callback.called(); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response(SBSKnownDerived sbskd) + { + test(sbskd.sbskd.equals("SBSKnownDerived.sbskd")); + callback.called(); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_SBSUnknownDerivedAsSBaseI extends AMI_TestIntf_SBSUnknownDerivedAsSBase { public void - ice_response(SBase sb) - { - test(sb.sb.equals("SBSUnknownDerived.sb")); - callback.called(); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response(SBase sb) + { + test(sb.sb.equals("SBSUnknownDerived.sb")); + callback.called(); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_SUnknownAsObjectI extends AMI_TestIntf_SUnknownAsObject { public void - ice_response(Ice.Object o) - { - test(false); - } + ice_response(Ice.Object o) + { + test(false); + } - public void - ice_exception(Ice.LocalException exc) - { + public void + ice_exception(Ice.LocalException exc) + { - test(exc.ice_name().equals("Ice::NoObjectFactoryException")); - callback.called(); - } + test(exc.ice_name().equals("Ice::NoObjectFactoryException")); + callback.called(); + } - public void - ice_exception(Ice.UserException exc) - { - test(false); - } + public void + ice_exception(Ice.UserException exc) + { + test(false); + } - public boolean - check() - { - return callback.check(); - } + public boolean + check() + { + return callback.check(); + } - private Callback callback = new Callback(); + private Callback callback = new Callback(); } private static class AMI_Test_oneElementCycleI extends AMI_TestIntf_oneElementCycle { public void - ice_response(B b) - { - test(b != null); - test(b.ice_id().equals("::Test::B")); - test(b.sb.equals("B1.sb")); - test(b.pb == b); - callback.called(); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response(B b) + { + test(b != null); + test(b.ice_id().equals("::Test::B")); + test(b.sb.equals("B1.sb")); + test(b.pb == b); + callback.called(); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_twoElementCycleI extends AMI_TestIntf_twoElementCycle { public void - ice_response(B b1) - { - test(b1 != null); - test(b1.ice_id().equals("::Test::B")); - test(b1.sb.equals("B1.sb")); - - B b2 = b1.pb; - test(b2 != null); - test(b2.ice_id().equals("::Test::B")); - test(b2.sb.equals("B2.sb")); - test(b2.pb == b1); - callback.called(); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response(B b1) + { + test(b1 != null); + test(b1.ice_id().equals("::Test::B")); + test(b1.sb.equals("B1.sb")); + + B b2 = b1.pb; + test(b2 != null); + test(b2.ice_id().equals("::Test::B")); + test(b2.sb.equals("B2.sb")); + test(b2.pb == b1); + callback.called(); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_D1AsBI extends AMI_TestIntf_D1AsB { public void - ice_response(B b1) - { - test(b1 != null); - test(b1.ice_id().equals("::Test::D1")); - test(b1.sb.equals("D1.sb")); - test(b1.pb != null); - test(b1.pb != b1); - D1 d1 = (D1)b1; - test(d1 != null); - test(d1.sd1.equals("D1.sd1")); - test(d1.pd1 != null); - test(d1.pd1 != b1); - test(b1.pb == d1.pd1); - - B b2 = b1.pb; - test(b2 != null); - test(b2.pb == b1); - test(b2.sb.equals("D2.sb")); - test(b2.ice_id().equals("::Test::B")); - callback.called(); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response(B b1) + { + test(b1 != null); + test(b1.ice_id().equals("::Test::D1")); + test(b1.sb.equals("D1.sb")); + test(b1.pb != null); + test(b1.pb != b1); + D1 d1 = (D1)b1; + test(d1 != null); + test(d1.sd1.equals("D1.sd1")); + test(d1.pd1 != null); + test(d1.pd1 != b1); + test(b1.pb == d1.pd1); + + B b2 = b1.pb; + test(b2 != null); + test(b2.pb == b1); + test(b2.sb.equals("D2.sb")); + test(b2.ice_id().equals("::Test::B")); + callback.called(); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_D1AsD1I extends AMI_TestIntf_D1AsD1 { public void - ice_response(D1 d1) - { - test(d1 != null); - test(d1.ice_id().equals("::Test::D1")); - test(d1.sb.equals("D1.sb")); - test(d1.pb != null); - test(d1.pb != d1); - - B b2 = d1.pb; - test(b2 != null); - test(b2.ice_id().equals("::Test::B")); - test(b2.sb.equals("D2.sb")); - test(b2.pb == d1); - callback.called(); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response(D1 d1) + { + test(d1 != null); + test(d1.ice_id().equals("::Test::D1")); + test(d1.sb.equals("D1.sb")); + test(d1.pb != null); + test(d1.pb != d1); + + B b2 = d1.pb; + test(b2 != null); + test(b2.ice_id().equals("::Test::B")); + test(b2.sb.equals("D2.sb")); + test(b2.pb == d1); + callback.called(); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_D2AsBI extends AMI_TestIntf_D2AsB { public void - ice_response(B b2) - { - test(b2 != null); - test(b2.ice_id().equals("::Test::B")); - test(b2.sb.equals("D2.sb")); - test(b2.pb != null); - test(b2.pb != b2); - - B b1 = b2.pb; - test(b1 != null); - test(b1.ice_id().equals("::Test::D1")); - test(b1.sb.equals("D1.sb")); - test(b1.pb == b2); - D1 d1 = (D1)b1; - test(d1 != null); - test(d1.sd1.equals("D1.sd1")); - test(d1.pd1 == b2); - callback.called(); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response(B b2) + { + test(b2 != null); + test(b2.ice_id().equals("::Test::B")); + test(b2.sb.equals("D2.sb")); + test(b2.pb != null); + test(b2.pb != b2); + + B b1 = b2.pb; + test(b1 != null); + test(b1.ice_id().equals("::Test::D1")); + test(b1.sb.equals("D1.sb")); + test(b1.pb == b2); + D1 d1 = (D1)b1; + test(d1 != null); + test(d1.sd1.equals("D1.sd1")); + test(d1.pd1 == b2); + callback.called(); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_paramTest1I extends AMI_TestIntf_paramTest1 { public void - ice_response(B b1, B b2) - { - test(b1 != null); - test(b1.ice_id().equals("::Test::D1")); - test(b1.sb.equals("D1.sb")); - test(b1.pb == b2); - D1 d1 = (D1)b1; - test(d1 != null); - test(d1.sd1.equals("D1.sd1")); - test(d1.pd1 == b2); - - test(b2 != null); - test(b2.ice_id().equals("::Test::B")); // No factory, must be sliced - test(b2.sb.equals("D2.sb")); - test(b2.pb == b1); - callback.called(); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response(B b1, B b2) + { + test(b1 != null); + test(b1.ice_id().equals("::Test::D1")); + test(b1.sb.equals("D1.sb")); + test(b1.pb == b2); + D1 d1 = (D1)b1; + test(d1 != null); + test(d1.sd1.equals("D1.sd1")); + test(d1.pd1 == b2); + + test(b2 != null); + test(b2.ice_id().equals("::Test::B")); // No factory, must be sliced + test(b2.sb.equals("D2.sb")); + test(b2.pb == b1); + callback.called(); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_paramTest2I extends AMI_TestIntf_paramTest2 { public void - ice_response(B b2, B b1) - { - test(b1 != null); - test(b1.ice_id().equals("::Test::D1")); - test(b1.sb.equals("D1.sb")); - test(b1.pb == b2); - D1 d1 = (D1)b1; - test(d1 != null); - test(d1.sd1.equals("D1.sd1")); - test(d1.pd1 == b2); - - test(b2 != null); - test(b2.ice_id().equals("::Test::B")); // No factory, must be sliced - test(b2.sb.equals("D2.sb")); - test(b2.pb == b1); - callback.called(); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response(B b2, B b1) + { + test(b1 != null); + test(b1.ice_id().equals("::Test::D1")); + test(b1.sb.equals("D1.sb")); + test(b1.pb == b2); + D1 d1 = (D1)b1; + test(d1 != null); + test(d1.sd1.equals("D1.sd1")); + test(d1.pd1 == b2); + + test(b2 != null); + test(b2.ice_id().equals("::Test::B")); // No factory, must be sliced + test(b2.sb.equals("D2.sb")); + test(b2.pb == b1); + callback.called(); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_returnTest1I extends AMI_TestIntf_returnTest1 { public void - ice_response(B r, B p1, B p2) - { - test(r == p1); - callback.called(); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response(B r, B p1, B p2) + { + test(r == p1); + callback.called(); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_returnTest2I extends AMI_TestIntf_returnTest2 { public void - ice_response(B r, B p1, B p2) - { - test(r == p1); - callback.called(); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response(B r, B p1, B p2) + { + test(r == p1); + callback.called(); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_returnTest3I extends AMI_TestIntf_returnTest3 { public void - ice_response(B b) - { - r = b; - callback.called(); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - - public B r; + ice_response(B b) + { + r = b; + callback.called(); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); + + public B r; } private static class AMI_Test_paramTest3I extends AMI_TestIntf_paramTest3 { public void - ice_response(B ret, B p1, B p2) - { - test(p1 != null); - test(p1.sb.equals("D2.sb (p1 1)")); - test(p1.pb == null); - test(p1.ice_id().equals("::Test::B")); - - test(p2 != null); - test(p2.sb.equals("D2.sb (p2 1)")); - test(p2.pb == null); - test(p2.ice_id().equals("::Test::B")); - - test(ret != null); - test(ret.sb.equals("D1.sb (p2 2)")); - test(ret.pb == null); - test(ret.ice_id().equals("::Test::D1")); - callback.called(); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response(B ret, B p1, B p2) + { + test(p1 != null); + test(p1.sb.equals("D2.sb (p1 1)")); + test(p1.pb == null); + test(p1.ice_id().equals("::Test::B")); + + test(p2 != null); + test(p2.sb.equals("D2.sb (p2 1)")); + test(p2.pb == null); + test(p2.ice_id().equals("::Test::B")); + + test(ret != null); + test(ret.sb.equals("D1.sb (p2 2)")); + test(ret.pb == null); + test(ret.ice_id().equals("::Test::D1")); + callback.called(); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_paramTest4I extends AMI_TestIntf_paramTest4 { public void - ice_response(B ret, B b) - { - test(b != null); - test(b.sb.equals("D4.sb (1)")); - test(b.pb == null); - test(b.ice_id().equals("::Test::B")); - - test(ret != null); - test(ret.sb.equals("B.sb (2)")); - test(ret.pb == null); - test(ret.ice_id().equals("::Test::B")); - callback.called(); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response(B ret, B b) + { + test(b != null); + test(b.sb.equals("D4.sb (1)")); + test(b.pb == null); + test(b.ice_id().equals("::Test::B")); + + test(ret != null); + test(ret.sb.equals("B.sb (2)")); + test(ret.pb == null); + test(ret.ice_id().equals("::Test::B")); + callback.called(); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_sequenceTestI extends AMI_TestIntf_sequenceTest { public void - ice_response(SS ss) - { - r = ss; - callback.called(); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - - public SS r; + ice_response(SS ss) + { + r = ss; + callback.called(); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); + + public SS r; } private static class AMI_Test_dictionaryTestI extends AMI_TestIntf_dictionaryTest { public void - ice_response(java.util.Map r, java.util.Map bout) - { - this.r = r; - this.bout = bout; - callback.called(); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); - - public java.util.Map r; - public java.util.Map bout; + ice_response(java.util.Map r, java.util.Map bout) + { + this.r = r; + this.bout = bout; + callback.called(); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); + + public java.util.Map r; + public java.util.Map bout; } private static class AMI_Test_throwBaseAsBaseI extends AMI_TestIntf_throwBaseAsBase { public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - BaseException e = (BaseException)exc; - test(e.ice_name().equals("Test::BaseException")); - test(e.sbe.equals("sbe")); - test(e.pb != null); - test(e.pb.sb.equals("sb")); - test(e.pb.pb == e.pb); - } - catch(Exception e) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + BaseException e = (BaseException)exc; + test(e.ice_name().equals("Test::BaseException")); + test(e.sbe.equals("sbe")); + test(e.pb != null); + test(e.pb.sb.equals("sb")); + test(e.pb.pb == e.pb); + } + catch(Exception e) + { + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_throwDerivedAsBaseI extends AMI_TestIntf_throwDerivedAsBase { public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - DerivedException e = (DerivedException)exc; - test(e.ice_name().equals("Test::DerivedException")); - test(e.sbe.equals("sbe")); - test(e.pb != null); - test(e.pb.sb.equals("sb1")); - test(e.pb.pb == e.pb); - test(e.sde.equals("sde1")); - test(e.pd1 != null); - test(e.pd1.sb.equals("sb2")); - test(e.pd1.pb == e.pd1); - test(e.pd1.sd1.equals("sd2")); - test(e.pd1.pd1 == e.pd1); - } - catch(Exception e) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + DerivedException e = (DerivedException)exc; + test(e.ice_name().equals("Test::DerivedException")); + test(e.sbe.equals("sbe")); + test(e.pb != null); + test(e.pb.sb.equals("sb1")); + test(e.pb.pb == e.pb); + test(e.sde.equals("sde1")); + test(e.pd1 != null); + test(e.pd1.sb.equals("sb2")); + test(e.pd1.pb == e.pd1); + test(e.pd1.sd1.equals("sd2")); + test(e.pd1.pd1 == e.pd1); + } + catch(Exception e) + { + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_throwDerivedAsDerivedI extends AMI_TestIntf_throwDerivedAsDerived { public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - DerivedException e = (DerivedException)exc; - test(e.ice_name().equals("Test::DerivedException")); - test(e.sbe.equals("sbe")); - test(e.pb != null); - test(e.pb.sb.equals("sb1")); - test(e.pb.pb == e.pb); - test(e.sde.equals("sde1")); - test(e.pd1 != null); - test(e.pd1.sb.equals("sb2")); - test(e.pd1.pb == e.pd1); - test(e.pd1.sd1.equals("sd2")); - test(e.pd1.pd1 == e.pd1); - } - catch(Exception e) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + DerivedException e = (DerivedException)exc; + test(e.ice_name().equals("Test::DerivedException")); + test(e.sbe.equals("sbe")); + test(e.pb != null); + test(e.pb.sb.equals("sb1")); + test(e.pb.pb == e.pb); + test(e.sde.equals("sde1")); + test(e.pd1 != null); + test(e.pd1.sb.equals("sb2")); + test(e.pd1.pb == e.pd1); + test(e.pd1.sd1.equals("sd2")); + test(e.pd1.pd1 == e.pd1); + } + catch(Exception e) + { + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_throwUnknownDerivedAsBaseI extends AMI_TestIntf_throwUnknownDerivedAsBase { public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - try - { - BaseException e = (BaseException)exc; - test(e.ice_name().equals("Test::BaseException")); - test(e.sbe.equals("sbe")); - test(e.pb != null); - test(e.pb.sb.equals("sb d2")); - test(e.pb.pb == e.pb); - } - catch(Exception e) - { - test(false); - } - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + try + { + BaseException e = (BaseException)exc; + test(e.ice_name().equals("Test::BaseException")); + test(e.sbe.equals("sbe")); + test(e.pb != null); + test(e.pb.sb.equals("sb d2")); + test(e.pb.pb == e.pb); + } + catch(Exception e) + { + test(false); + } + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMI_Test_useForwardI extends AMI_TestIntf_useForward { public void - ice_response(Forward f) - { - test(f != null); - callback.called(); - } - - public void - ice_exception(Ice.LocalException exc) - { - test(false); - } - - public void - ice_exception(Ice.UserException exc) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + ice_response(Forward f) + { + test(f != null); + callback.called(); + } + + public void + ice_exception(Ice.LocalException exc) + { + test(false); + } + + public void + ice_exception(Ice.UserException exc) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } public static TestIntfPrx @@ -1002,1323 +1002,1323 @@ public class AllTests test(test.equals(base)); System.out.println("ok"); - System.out.print("base as Object... "); - System.out.flush(); - { - Ice.Object o; - SBase sb = null; - try - { - o = test.SBaseAsObject(); - test(o != null); - test(o.ice_id().equals("::Test::SBase")); - sb = (SBase)o; - } - catch(Exception ex) - { - test(false); - } - test(sb != null); - test(sb.sb.equals("SBase.sb")); - } - System.out.println("ok"); - - System.out.print("base as Object (AMI)... "); - System.out.flush(); - { - AMI_Test_SBaseAsObjectI cb = new AMI_Test_SBaseAsObjectI(); - test.SBaseAsObject_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("base as base... "); - System.out.flush(); - { - SBase sb; - try - { - sb = test.SBaseAsSBase(); - test(sb.sb.equals("SBase.sb")); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("base as base (AMI)... "); - System.out.flush(); - { - AMI_Test_SBaseAsSBaseI cb = new AMI_Test_SBaseAsSBaseI(); - test.SBaseAsSBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("base with known derived as base... "); - System.out.flush(); - { - SBase sb; - SBSKnownDerived sbskd = null; - try - { - sb = test.SBSKnownDerivedAsSBase(); - test(sb.sb.equals("SBSKnownDerived.sb")); - sbskd = (SBSKnownDerived)sb; - } - catch(Exception ex) - { - test(false); - } - test(sbskd != null); - test(sbskd.sbskd.equals("SBSKnownDerived.sbskd")); - } - System.out.println("ok"); - - System.out.print("base with known derived as base (AMI)... "); - System.out.flush(); - { - AMI_Test_SBSKnownDerivedAsSBaseI cb = new AMI_Test_SBSKnownDerivedAsSBaseI(); - test.SBSKnownDerivedAsSBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("base with known derived as known derived... "); - System.out.flush(); - { - SBSKnownDerived sbskd; - try - { - sbskd = test.SBSKnownDerivedAsSBSKnownDerived(); - test(sbskd.sbskd.equals("SBSKnownDerived.sbskd")); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("base with known derived as known derived (AMI)... "); - System.out.flush(); - { - AMI_Test_SBSKnownDerivedAsSBSKnownDerivedI cb = new AMI_Test_SBSKnownDerivedAsSBSKnownDerivedI(); - test.SBSKnownDerivedAsSBSKnownDerived_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("base with unknown derived as base... "); - System.out.flush(); - { - SBase sb; - try - { - sb = test.SBSUnknownDerivedAsSBase(); - test(sb.sb.equals("SBSUnknownDerived.sb")); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("base with unknown derived as base (AMI)... "); - System.out.flush(); - { - AMI_Test_SBSUnknownDerivedAsSBaseI cb = new AMI_Test_SBSUnknownDerivedAsSBaseI(); - test.SBSUnknownDerivedAsSBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("unknown with Object as Object... "); - System.out.flush(); - { - Ice.Object o; - try - { - o = test.SUnknownAsObject(); - test(false); - } - catch(Ice.NoObjectFactoryException ex) - { - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("unknown with Object as Object (AMI)... "); - System.out.flush(); - { - AMI_Test_SUnknownAsObjectI cb = new AMI_Test_SUnknownAsObjectI(); - test.SUnknownAsObject_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("one-element cycle... "); - System.out.flush(); - { - try - { - B b = test.oneElementCycle(); - test(b != null); - test(b.ice_id().equals("::Test::B")); - test(b.sb.equals("B1.sb")); - test(b.pb == b); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("one-element cycle (AMI)... "); - System.out.flush(); - { - AMI_Test_oneElementCycleI cb = new AMI_Test_oneElementCycleI(); - test.oneElementCycle_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("two-element cycle... "); - System.out.flush(); - { - try - { - B b1 = test.twoElementCycle(); - test(b1 != null); - test(b1.ice_id().equals("::Test::B")); - test(b1.sb.equals("B1.sb")); - - B b2 = b1.pb; - test(b2 != null); - test(b2.ice_id().equals("::Test::B")); - test(b2.sb.equals("B2.sb")); - test(b2.pb == b1); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("two-element cycle (AMI)... "); - System.out.flush(); - { - AMI_Test_twoElementCycleI cb = new AMI_Test_twoElementCycleI(); - test.twoElementCycle_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("known derived pointer slicing as base... "); - System.out.flush(); - { - try - { - B b1; - b1 = test.D1AsB(); - test(b1 != null); - test(b1.ice_id().equals("::Test::D1")); - test(b1.sb.equals("D1.sb")); - test(b1.pb != null); - test(b1.pb != b1); - D1 d1 = (D1)b1; - test(d1 != null); - test(d1.sd1.equals("D1.sd1")); - test(d1.pd1 != null); - test(d1.pd1 != b1); - test(b1.pb == d1.pd1); - - B b2 = b1.pb; - test(b2 != null); - test(b2.pb == b1); - test(b2.sb.equals("D2.sb")); - test(b2.ice_id().equals("::Test::B")); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("known derived pointer slicing as base (AMI)... "); - System.out.flush(); - { - AMI_Test_D1AsBI cb = new AMI_Test_D1AsBI(); - test.D1AsB_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("known derived pointer slicing as derived... "); - System.out.flush(); - { - try - { - D1 d1; - d1 = test.D1AsD1(); - test(d1 != null); - test(d1.ice_id().equals("::Test::D1")); - test(d1.sb.equals("D1.sb")); - test(d1.pb != null); - test(d1.pb != d1); - - B b2 = d1.pb; - test(b2 != null); - test(b2.ice_id().equals("::Test::B")); - test(b2.sb.equals("D2.sb")); - test(b2.pb == d1); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("known derived pointer slicing as derived (AMI)... "); - System.out.flush(); - { - AMI_Test_D1AsD1I cb = new AMI_Test_D1AsD1I(); - test.D1AsD1_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("unknown derived pointer slicing as base... "); - System.out.flush(); - { - try - { - B b2; - b2 = test.D2AsB(); - test(b2 != null); - test(b2.ice_id().equals("::Test::B")); - test(b2.sb.equals("D2.sb")); - test(b2.pb != null); - test(b2.pb != b2); - - B b1 = b2.pb; - test(b1 != null); - test(b1.ice_id().equals("::Test::D1")); - test(b1.sb.equals("D1.sb")); - test(b1.pb == b2); - D1 d1 = (D1)b1; - test(d1 != null); - test(d1.sd1.equals("D1.sd1")); - test(d1.pd1 == b2); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("unknown derived pointer slicing as base (AMI)... "); - System.out.flush(); - { - AMI_Test_D2AsBI cb = new AMI_Test_D2AsBI(); - test.D2AsB_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("param ptr slicing with known first... "); - System.out.flush(); - { - try - { - BHolder b1 = new BHolder(); - BHolder b2 = new BHolder(); - test.paramTest1(b1, b2); - - test(b1.value != null); - test(b1.value.ice_id().equals("::Test::D1")); - test(b1.value.sb.equals("D1.sb")); - test(b1.value.pb == b2.value); - D1 d1 = (D1)b1.value; - test(d1 != null); - test(d1.sd1.equals("D1.sd1")); - test(d1.pd1 == b2.value); - - test(b2.value != null); - test(b2.value.ice_id().equals("::Test::B")); // No factory, must be sliced - test(b2.value.sb.equals("D2.sb")); - test(b2.value.pb == b1.value); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("param ptr slicing with known first (AMI)... "); - System.out.flush(); - { - AMI_Test_paramTest1I cb = new AMI_Test_paramTest1I(); - test.paramTest1_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("param ptr slicing with unknown first... "); - System.out.flush(); - { - try - { - BHolder b2 = new BHolder(); - BHolder b1 = new BHolder(); - test.paramTest2(b2, b1); - - test(b1.value != null); - test(b1.value.ice_id().equals("::Test::D1")); - test(b1.value.sb.equals("D1.sb")); - test(b1.value.pb == b2.value); - D1 d1 = (D1)b1.value; - test(d1 != null); - test(d1.sd1.equals("D1.sd1")); - test(d1.pd1 == b2.value); - - test(b2.value != null); - test(b2.value.ice_id().equals("::Test::B")); // No factory, must be sliced - test(b2.value.sb.equals("D2.sb")); - test(b2.value.pb == b1.value); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("param ptr slicing with unknown first (AMI)... "); - System.out.flush(); - { - AMI_Test_paramTest2I cb = new AMI_Test_paramTest2I(); - test.paramTest2_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("return value identity with known first... "); - System.out.flush(); - { - try - { - BHolder p1 = new BHolder(); - BHolder p2 = new BHolder(); - B r = test.returnTest1(p1, p2); - test(r == p1.value); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("return value identity with known first (AMI)... "); - System.out.flush(); - { - AMI_Test_returnTest1I cb = new AMI_Test_returnTest1I(); - test.returnTest1_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("return value identity with unknown first... "); - System.out.flush(); - { - try - { - BHolder p1 = new BHolder(); - BHolder p2 = new BHolder(); - B r = test.returnTest2(p1, p2); - test(r == p1.value); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("return value identity with unknown first (AMI)... "); - System.out.flush(); - { - AMI_Test_returnTest2I cb = new AMI_Test_returnTest2I(); - test.returnTest2_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("return value identity for input params known first... "); - System.out.flush(); - { - try - { - D1 d1 = new D1(); - d1.sb = "D1.sb"; - d1.sd1 = "D1.sd1"; - D3 d3 = new D3(); - d3.pb = d1; - d3.sb = "D3.sb"; - d3.sd3 = "D3.sd3"; - d3.pd3 = d1; - d1.pb = d3; - d1.pd1 = d3; - - B b1 = test.returnTest3(d1, d3); - - test(b1 != null); - test(b1.sb.equals("D1.sb")); - test(b1.ice_id().equals("::Test::D1")); - D1 p1 = (D1)b1; - test(p1 != null); - test(p1.sd1.equals("D1.sd1")); - test(p1.pd1 == b1.pb); - - B b2 = b1.pb; - test(b2 != null); - test(b2.sb.equals("D3.sb")); - test(b2.ice_id().equals("::Test::B")); // Sliced by server - test(b2.pb == b1); - try - { - D3 p3 = (D3)b2; - test(false); - } - catch(ClassCastException ex) - { - } - - test(b1 != d1); - test(b1 != d3); - test(b2 != d1); - test(b2 != d3); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("return value identity for input params known first (AMI)... "); - System.out.flush(); - { - D1 d1 = new D1(); - d1.sb = "D1.sb"; - d1.sd1 = "D1.sd1"; - D3 d3 = new D3(); - d3.pb = d1; - d3.sb = "D3.sb"; - d3.sd3 = "D3.sd3"; - d3.pd3 = d1; - d1.pb = d3; - d1.pd1 = d3; - - AMI_Test_returnTest3I cb = new AMI_Test_returnTest3I(); - test.returnTest3_async(cb, d1, d3); - test(cb.check()); - B b1 = cb.r; - - test(b1 != null); - test(b1.sb.equals("D1.sb")); - test(b1.ice_id().equals("::Test::D1")); - D1 p1 = (D1)b1; - test(p1 != null); - test(p1.sd1.equals("D1.sd1")); - test(p1.pd1 == b1.pb); - - B b2 = b1.pb; - test(b2 != null); - test(b2.sb.equals("D3.sb")); - test(b2.ice_id().equals("::Test::B")); // Sliced by server - test(b2.pb == b1); - try - { - D3 p3 = (D3)b2; - test(false); - } - catch(ClassCastException ex) - { - } - - test(b1 != d1); - test(b1 != d3); - test(b2 != d1); - test(b2 != d3); - } - System.out.println("ok"); - - System.out.print("return value identity for input params unknown first... "); - System.out.flush(); - { - try - { - D1 d1 = new D1(); - d1.sb = "D1.sb"; - d1.sd1 = "D1.sd1"; - D3 d3 = new D3(); - d3.pb = d1; - d3.sb = "D3.sb"; - d3.sd3 = "D3.sd3"; - d3.pd3 = d1; - d1.pb = d3; - d1.pd1 = d3; - - B b1 = test.returnTest3(d3, d1); - - test(b1 != null); - test(b1.sb.equals("D3.sb")); - test(b1.ice_id().equals("::Test::B")); // Sliced by server - - try - { - D3 p1 = (D3)b1; - test(false); - } - catch(ClassCastException ex) - { - } - - B b2 = b1.pb; - test(b2 != null); - test(b2.sb.equals("D1.sb")); - test(b2.ice_id().equals("::Test::D1")); - test(b2.pb == b1); - D1 p3 = (D1)b2; - test(p3 != null); - test(p3.sd1.equals("D1.sd1")); - test(p3.pd1 == b1); - - test(b1 != d1); - test(b1 != d3); - test(b2 != d1); - test(b2 != d3); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("return value identity for input params unknown first (AMI)... "); - System.out.flush(); - { - D1 d1 = new D1(); - d1.sb = "D1.sb"; - d1.sd1 = "D1.sd1"; - D3 d3 = new D3(); - d3.pb = d1; - d3.sb = "D3.sb"; - d3.sd3 = "D3.sd3"; - d3.pd3 = d1; - d1.pb = d3; - d1.pd1 = d3; - - AMI_Test_returnTest3I cb = new AMI_Test_returnTest3I(); - test.returnTest3_async(cb, d3, d1); - test(cb.check()); - B b1 = cb.r; - - test(b1 != null); - test(b1.sb.equals("D3.sb")); - test(b1.ice_id().equals("::Test::B")); // Sliced by server - - try - { - D3 p1 = (D3)b1; - test(false); - } - catch(ClassCastException ex) - { - } - - B b2 = b1.pb; - test(b2 != null); - test(b2.sb.equals("D1.sb")); - test(b2.ice_id().equals("::Test::D1")); - test(b2.pb == b1); - D1 p3 = (D1)b2; - test(p3 != null); - test(p3.sd1.equals("D1.sd1")); - test(p3.pd1 == b1); - - test(b1 != d1); - test(b1 != d3); - test(b2 != d1); - test(b2 != d3); - } - System.out.println("ok"); - - System.out.print("remainder unmarshaling (3 instances)... "); - System.out.flush(); - { - try - { - BHolder p1 = new BHolder(); - BHolder p2 = new BHolder(); - B ret = test.paramTest3(p1, p2); - - test(p1.value != null); - test(p1.value.sb.equals("D2.sb (p1 1)")); - test(p1.value.pb == null); - test(p1.value.ice_id().equals("::Test::B")); - - test(p2.value != null); - test(p2.value.sb.equals("D2.sb (p2 1)")); - test(p2.value.pb == null); - test(p2.value.ice_id().equals("::Test::B")); - - test(ret != null); - test(ret.sb.equals("D1.sb (p2 2)")); - test(ret.pb == null); - test(ret.ice_id().equals("::Test::D1")); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("remainder unmarshaling (3 instances) (AMI)... "); - System.out.flush(); - { - AMI_Test_paramTest3I cb = new AMI_Test_paramTest3I(); - test.paramTest3_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("remainder unmarshaling (4 instances)... "); - System.out.flush(); - { - try - { - BHolder b = new BHolder(); - B ret = test.paramTest4(b); - - test(b.value != null); - test(b.value.sb.equals("D4.sb (1)")); - test(b.value.pb == null); - test(b.value.ice_id().equals("::Test::B")); - - test(ret != null); - test(ret.sb.equals("B.sb (2)")); - test(ret.pb == null); - test(ret.ice_id().equals("::Test::B")); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("remainder unmarshaling (4 instances) (AMI)... "); - System.out.flush(); - { - AMI_Test_paramTest4I cb = new AMI_Test_paramTest4I(); - test.paramTest4_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("param ptr slicing, instance marshaled in unknown derived as base... "); - System.out.flush(); - { - try - { - B b1 = new B(); - b1.sb = "B.sb(1)"; - b1.pb = b1; - - D3 d3 = new D3(); - d3.sb = "D3.sb"; - d3.pb = d3; - d3.sd3 = "D3.sd3"; - d3.pd3 = b1; - - B b2 = new B(); - b2.sb = "B.sb(2)"; - b2.pb = b1; - - B r = test.returnTest3(d3, b2); - - test(r != null); - test(r.ice_id().equals("::Test::B")); - test(r.sb.equals("D3.sb")); - test(r.pb == r); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("param ptr slicing, instance marshaled in unknown derived as base (AMI)... "); - System.out.flush(); - { - B b1 = new B(); - b1.sb = "B.sb(1)"; - b1.pb = b1; - - D3 d3 = new D3(); - d3.sb = "D3.sb"; - d3.pb = d3; - d3.sd3 = "D3.sd3"; - d3.pd3 = b1; - - B b2 = new B(); - b2.sb = "B.sb(2)"; - b2.pb = b1; - - AMI_Test_returnTest3I cb = new AMI_Test_returnTest3I(); - test.returnTest3_async(cb, d3, b2); - test(cb.check()); - B r = cb.r; - - test(r != null); - test(r.ice_id().equals("::Test::B")); - test(r.sb.equals("D3.sb")); - test(r.pb == r); - } - System.out.println("ok"); - - System.out.print("param ptr slicing, instance marshaled in unknown derived as derived... "); - System.out.flush(); - { - try - { - D1 d11 = new D1(); - d11.sb = "D1.sb(1)"; - d11.pb = d11; - d11.sd1 = "D1.sd1(1)"; - - D3 d3 = new D3(); - d3.sb = "D3.sb"; - d3.pb = d3; - d3.sd3 = "D3.sd3"; - d3.pd3 = d11; - - D1 d12 = new D1(); - d12.sb = "D1.sb(2)"; - d12.pb = d12; - d12.sd1 = "D1.sd1(2)"; - d12.pd1 = d11; - - B r = test.returnTest3(d3, d12); - test(r != null); - test(r.ice_id().equals("::Test::B")); - test(r.sb.equals("D3.sb")); - test(r.pb == r); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("param ptr slicing, instance marshaled in unknown derived as derived (AMI)... "); - System.out.flush(); - { - D1 d11 = new D1(); - d11.sb = "D1.sb(1)"; - d11.pb = d11; - d11.sd1 = "D1.sd1(1)"; - - D3 d3 = new D3(); - d3.sb = "D3.sb"; - d3.pb = d3; - d3.sd3 = "D3.sd3"; - d3.pd3 = d11; - - D1 d12 = new D1(); - d12.sb = "D1.sb(2)"; - d12.pb = d12; - d12.sd1 = "D1.sd1(2)"; - d12.pd1 = d11; - - AMI_Test_returnTest3I cb = new AMI_Test_returnTest3I(); - test.returnTest3_async(cb, d3, d12); - test(cb.check()); - B r = cb.r; - - test(r != null); - test(r.ice_id().equals("::Test::B")); - test(r.sb.equals("D3.sb")); - test(r.pb == r); - } - System.out.println("ok"); - - System.out.print("sequence slicing... "); - System.out.flush(); - { - try - { - SS ss; - { - B ss1b = new B(); - ss1b.sb = "B.sb"; - ss1b.pb = ss1b; - - D1 ss1d1 = new D1(); - ss1d1.sb = "D1.sb"; - ss1d1.sd1 = "D1.sd1"; - ss1d1.pb = ss1b; - - D3 ss1d3 = new D3(); - ss1d3.sb = "D3.sb"; - ss1d3.sd3 = "D3.sd3"; - ss1d3.pb = ss1b; - - B ss2b = new B(); - ss2b.sb = "B.sb"; - ss2b.pb = ss1b; - - D1 ss2d1 = new D1(); - ss2d1.sb = "D1.sb"; - ss2d1.sd1 = "D1.sd1"; - ss2d1.pb = ss2b; - - D3 ss2d3 = new D3(); - ss2d3.sb = "D3.sb"; - ss2d3.sd3 = "D3.sd3"; - ss2d3.pb = ss2b; - - ss1d1.pd1 = ss2b; - ss1d3.pd3 = ss2d1; - - ss2d1.pd1 = ss1d3; - ss2d3.pd3 = ss1d1; - - SS1 ss1 = new SS1(); - ss1.s = new B[3]; - ss1.s[0] = ss1b; - ss1.s[1] = ss1d1; - ss1.s[2] = ss1d3; - - SS2 ss2 = new SS2(); - ss2.s = new B[3]; - ss2.s[0] = ss2b; - ss2.s[1] = ss2d1; - ss2.s[2] = ss2d3; - - ss = test.sequenceTest(ss1, ss2); - } - - test(ss.c1 != null); - B ss1b = ss.c1.s[0]; - B ss1d1 = ss.c1.s[1]; - test(ss.c2 != null); - B ss1d3 = ss.c1.s[2]; - - test(ss.c2 != null); - B ss2b = ss.c2.s[0]; - B ss2d1 = ss.c2.s[1]; - B ss2d3 = ss.c2.s[2]; - - test(ss1b.pb == ss1b); - test(ss1d1.pb == ss1b); - test(ss1d3.pb == ss1b); - - test(ss2b.pb == ss1b); - test(ss2d1.pb == ss2b); - test(ss2d3.pb == ss2b); - - test(ss1b.ice_id().equals("::Test::B")); - test(ss1d1.ice_id().equals("::Test::D1")); - test(ss1d3.ice_id().equals("::Test::B")); - - test(ss2b.ice_id().equals("::Test::B")); - test(ss2d1.ice_id().equals("::Test::D1")); - test(ss2d3.ice_id().equals("::Test::B")); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("sequence slicing (AMI)... "); - System.out.flush(); - { - SS ss; - { - B ss1b = new B(); - ss1b.sb = "B.sb"; - ss1b.pb = ss1b; - - D1 ss1d1 = new D1(); - ss1d1.sb = "D1.sb"; - ss1d1.sd1 = "D1.sd1"; - ss1d1.pb = ss1b; - - D3 ss1d3 = new D3(); - ss1d3.sb = "D3.sb"; - ss1d3.sd3 = "D3.sd3"; - ss1d3.pb = ss1b; - - B ss2b = new B(); - ss2b.sb = "B.sb"; - ss2b.pb = ss1b; - - D1 ss2d1 = new D1(); - ss2d1.sb = "D1.sb"; - ss2d1.sd1 = "D1.sd1"; - ss2d1.pb = ss2b; - - D3 ss2d3 = new D3(); - ss2d3.sb = "D3.sb"; - ss2d3.sd3 = "D3.sd3"; - ss2d3.pb = ss2b; - - ss1d1.pd1 = ss2b; - ss1d3.pd3 = ss2d1; - - ss2d1.pd1 = ss1d3; - ss2d3.pd3 = ss1d1; - - SS1 ss1 = new SS1(); - ss1.s = new B[3]; - ss1.s[0] = ss1b; - ss1.s[1] = ss1d1; - ss1.s[2] = ss1d3; - - SS2 ss2 = new SS2(); - ss2.s = new B[3]; - ss2.s[0] = ss2b; - ss2.s[1] = ss2d1; - ss2.s[2] = ss2d3; - - AMI_Test_sequenceTestI cb = new AMI_Test_sequenceTestI(); - test.sequenceTest_async(cb, ss1, ss2); - test(cb.check()); - ss = cb.r; - } - test(ss.c1 != null); - B ss1b = ss.c1.s[0]; - B ss1d1 = ss.c1.s[1]; - test(ss.c2 != null); - B ss1d3 = ss.c1.s[2]; - - test(ss.c2 != null); - B ss2b = ss.c2.s[0]; - B ss2d1 = ss.c2.s[1]; - B ss2d3 = ss.c2.s[2]; - - test(ss1b.pb == ss1b); - test(ss1d1.pb == ss1b); - test(ss1d3.pb == ss1b); - - test(ss2b.pb == ss1b); - test(ss2d1.pb == ss2b); - test(ss2d3.pb == ss2b); - - test(ss1b.ice_id().equals("::Test::B")); - test(ss1d1.ice_id().equals("::Test::D1")); - test(ss1d3.ice_id().equals("::Test::B")); - - test(ss2b.ice_id().equals("::Test::B")); - test(ss2d1.ice_id().equals("::Test::D1")); - test(ss2d3.ice_id().equals("::Test::B")); - } - System.out.println("ok"); - - System.out.print("dictionary slicing... "); - System.out.flush(); - { - try - { - java.util.IdentityHashMap bin = new java.util.IdentityHashMap(); - BDictHolder bout = new BDictHolder(); - java.util.Map r; - int i; - for(i = 0; i < 10; ++i) - { - String s = "D1." + new Integer(i).toString(); - D1 d1 = new D1(); - d1.sb = s; - d1.pb = d1; - d1.sd1 = s; - bin.put(new Integer(i), d1); - } - - r = test.dictionaryTest(bin, bout); - - test(bout.value.size() == 10); - for(i = 0; i < 10; ++i) - { - B b = (B)bout.value.get(new Integer(i * 10)); - test(b != null); - String s = "D1." + new Integer(i).toString(); - test(b.sb.equals(s)); - test(b.pb != null); - test(b.pb != b); - test(b.pb.sb.equals(s)); - test(b.pb.pb == b.pb); - } - - test(r.size() == 10); - for(i = 0; i < 10; ++i) - { - B b = (B)r.get(new Integer(i * 20)); - test(b != null); - String s = "D1." + new Integer(i * 20).toString(); - test(b.sb.equals(s)); - test(b.pb == (i == 0 ? (B)null : (B)r.get(new Integer((i - 1) * 20)))); - D1 d1 = (D1)b; - test(d1 != null); - test(d1.sd1.equals(s)); - test(d1.pd1 == d1); - } - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("dictionary slicing (AMI)... "); - System.out.flush(); - { - java.util.Map bin = new java.util.HashMap(); - java.util.Map bout; - java.util.Map r; - int i; - for(i = 0; i < 10; ++i) - { - String s = "D1." + new Integer(i).toString(); - D1 d1 = new D1(); - d1.sb = s; - d1.pb = d1; - d1.sd1 = s; - bin.put(new Integer(i), d1); - } - - AMI_Test_dictionaryTestI cb = new AMI_Test_dictionaryTestI(); - test.dictionaryTest_async(cb, bin); - test(cb.check()); - bout = cb.bout; - r = cb.r; - - test(bout.size() == 10); - for(i = 0; i < 10; ++i) - { - B b = (B)bout.get(new Integer(i * 10)); - test(b != null); - String s = "D1." + new Integer(i).toString(); - test(b.sb.equals(s)); - test(b.pb != null); - test(b.pb != b); - test(b.pb.sb.equals(s)); - test(b.pb.pb == b.pb); - } - - test(r.size() == 10); - for(i = 0; i < 10; ++i) - { - B b = (B)r.get(new Integer(i * 20)); - test(b != null); - String s = "D1." + new Integer(i * 20).toString(); - test(b.sb.equals(s)); - test(b.pb == (i == 0 ? (B)null : (B)r.get(new Integer((i - 1) * 20)))); - D1 d1 = (D1)b; - test(d1 != null); - test(d1.sd1.equals(s)); - test(d1.pd1 == d1); - } - } - System.out.println("ok"); - - System.out.print("base exception thrown as base exception... "); - System.out.flush(); - { - try - { - test.throwBaseAsBase(); - test(false); - } - catch(BaseException e) - { - test(e.ice_name().equals("Test::BaseException")); - test(e.sbe.equals("sbe")); - test(e.pb != null); - test(e.pb.sb.equals("sb")); - test(e.pb.pb == e.pb); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("base exception thrown as base exception (AMI)... "); - System.out.flush(); - { - AMI_Test_throwBaseAsBaseI cb = new AMI_Test_throwBaseAsBaseI(); - test.throwBaseAsBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("derived exception thrown as base exception... "); - System.out.flush(); - { - try - { - test.throwDerivedAsBase(); - test(false); - } - catch(DerivedException e) - { - test(e.ice_name().equals("Test::DerivedException")); - test(e.sbe.equals("sbe")); - test(e.pb != null); - test(e.pb.sb.equals("sb1")); - test(e.pb.pb == e.pb); - test(e.sde.equals("sde1")); - test(e.pd1 != null); - test(e.pd1.sb.equals("sb2")); - test(e.pd1.pb == e.pd1); - test(e.pd1.sd1.equals("sd2")); - test(e.pd1.pd1 == e.pd1); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("derived exception thrown as base exception (AMI)... "); - System.out.flush(); - { - AMI_Test_throwDerivedAsBaseI cb = new AMI_Test_throwDerivedAsBaseI(); - test.throwDerivedAsBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("derived exception thrown as derived exception... "); - System.out.flush(); - { - try - { - test.throwDerivedAsDerived(); - test(false); - } - catch(DerivedException e) - { - test(e.ice_name().equals("Test::DerivedException")); - test(e.sbe.equals("sbe")); - test(e.pb != null); - test(e.pb.sb.equals("sb1")); - test(e.pb.pb == e.pb); - test(e.sde.equals("sde1")); - test(e.pd1 != null); - test(e.pd1.sb.equals("sb2")); - test(e.pd1.pb == e.pd1); - test(e.pd1.sd1.equals("sd2")); - test(e.pd1.pd1 == e.pd1); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("derived exception thrown as derived exception (AMI)... "); - System.out.flush(); - { - AMI_Test_throwDerivedAsDerivedI cb = new AMI_Test_throwDerivedAsDerivedI(); - test.throwDerivedAsDerived_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("unknown derived exception thrown as base exception... "); - System.out.flush(); - { - try - { - test.throwUnknownDerivedAsBase(); - test(false); - } - catch(BaseException e) - { - test(e.ice_name().equals("Test::BaseException")); - test(e.sbe.equals("sbe")); - test(e.pb != null); - test(e.pb.sb.equals("sb d2")); - test(e.pb.pb == e.pb); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("unknown derived exception thrown as base exception (AMI)... "); - System.out.flush(); - { - AMI_Test_throwUnknownDerivedAsBaseI cb = new AMI_Test_throwUnknownDerivedAsBaseI(); - test.throwUnknownDerivedAsBase_async(cb); - test(cb.check()); - } - System.out.println("ok"); - - System.out.print("forward-declared class... "); - System.out.flush(); - { - try - { - ForwardHolder f = new ForwardHolder(); - test.useForward(f); - test(f.value != null); - } - catch(Exception ex) - { - test(false); - } - } - System.out.println("ok"); - - System.out.print("forward-declared class (AMI)... "); - System.out.flush(); - { - AMI_Test_useForwardI cb = new AMI_Test_useForwardI(); - test.useForward_async(cb); - test(cb.check()); - } - System.out.println("ok"); + System.out.print("base as Object... "); + System.out.flush(); + { + Ice.Object o; + SBase sb = null; + try + { + o = test.SBaseAsObject(); + test(o != null); + test(o.ice_id().equals("::Test::SBase")); + sb = (SBase)o; + } + catch(Exception ex) + { + test(false); + } + test(sb != null); + test(sb.sb.equals("SBase.sb")); + } + System.out.println("ok"); + + System.out.print("base as Object (AMI)... "); + System.out.flush(); + { + AMI_Test_SBaseAsObjectI cb = new AMI_Test_SBaseAsObjectI(); + test.SBaseAsObject_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("base as base... "); + System.out.flush(); + { + SBase sb; + try + { + sb = test.SBaseAsSBase(); + test(sb.sb.equals("SBase.sb")); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("base as base (AMI)... "); + System.out.flush(); + { + AMI_Test_SBaseAsSBaseI cb = new AMI_Test_SBaseAsSBaseI(); + test.SBaseAsSBase_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("base with known derived as base... "); + System.out.flush(); + { + SBase sb; + SBSKnownDerived sbskd = null; + try + { + sb = test.SBSKnownDerivedAsSBase(); + test(sb.sb.equals("SBSKnownDerived.sb")); + sbskd = (SBSKnownDerived)sb; + } + catch(Exception ex) + { + test(false); + } + test(sbskd != null); + test(sbskd.sbskd.equals("SBSKnownDerived.sbskd")); + } + System.out.println("ok"); + + System.out.print("base with known derived as base (AMI)... "); + System.out.flush(); + { + AMI_Test_SBSKnownDerivedAsSBaseI cb = new AMI_Test_SBSKnownDerivedAsSBaseI(); + test.SBSKnownDerivedAsSBase_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("base with known derived as known derived... "); + System.out.flush(); + { + SBSKnownDerived sbskd; + try + { + sbskd = test.SBSKnownDerivedAsSBSKnownDerived(); + test(sbskd.sbskd.equals("SBSKnownDerived.sbskd")); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("base with known derived as known derived (AMI)... "); + System.out.flush(); + { + AMI_Test_SBSKnownDerivedAsSBSKnownDerivedI cb = new AMI_Test_SBSKnownDerivedAsSBSKnownDerivedI(); + test.SBSKnownDerivedAsSBSKnownDerived_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("base with unknown derived as base... "); + System.out.flush(); + { + SBase sb; + try + { + sb = test.SBSUnknownDerivedAsSBase(); + test(sb.sb.equals("SBSUnknownDerived.sb")); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("base with unknown derived as base (AMI)... "); + System.out.flush(); + { + AMI_Test_SBSUnknownDerivedAsSBaseI cb = new AMI_Test_SBSUnknownDerivedAsSBaseI(); + test.SBSUnknownDerivedAsSBase_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("unknown with Object as Object... "); + System.out.flush(); + { + Ice.Object o; + try + { + o = test.SUnknownAsObject(); + test(false); + } + catch(Ice.NoObjectFactoryException ex) + { + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("unknown with Object as Object (AMI)... "); + System.out.flush(); + { + AMI_Test_SUnknownAsObjectI cb = new AMI_Test_SUnknownAsObjectI(); + test.SUnknownAsObject_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("one-element cycle... "); + System.out.flush(); + { + try + { + B b = test.oneElementCycle(); + test(b != null); + test(b.ice_id().equals("::Test::B")); + test(b.sb.equals("B1.sb")); + test(b.pb == b); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("one-element cycle (AMI)... "); + System.out.flush(); + { + AMI_Test_oneElementCycleI cb = new AMI_Test_oneElementCycleI(); + test.oneElementCycle_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("two-element cycle... "); + System.out.flush(); + { + try + { + B b1 = test.twoElementCycle(); + test(b1 != null); + test(b1.ice_id().equals("::Test::B")); + test(b1.sb.equals("B1.sb")); + + B b2 = b1.pb; + test(b2 != null); + test(b2.ice_id().equals("::Test::B")); + test(b2.sb.equals("B2.sb")); + test(b2.pb == b1); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("two-element cycle (AMI)... "); + System.out.flush(); + { + AMI_Test_twoElementCycleI cb = new AMI_Test_twoElementCycleI(); + test.twoElementCycle_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("known derived pointer slicing as base... "); + System.out.flush(); + { + try + { + B b1; + b1 = test.D1AsB(); + test(b1 != null); + test(b1.ice_id().equals("::Test::D1")); + test(b1.sb.equals("D1.sb")); + test(b1.pb != null); + test(b1.pb != b1); + D1 d1 = (D1)b1; + test(d1 != null); + test(d1.sd1.equals("D1.sd1")); + test(d1.pd1 != null); + test(d1.pd1 != b1); + test(b1.pb == d1.pd1); + + B b2 = b1.pb; + test(b2 != null); + test(b2.pb == b1); + test(b2.sb.equals("D2.sb")); + test(b2.ice_id().equals("::Test::B")); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("known derived pointer slicing as base (AMI)... "); + System.out.flush(); + { + AMI_Test_D1AsBI cb = new AMI_Test_D1AsBI(); + test.D1AsB_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("known derived pointer slicing as derived... "); + System.out.flush(); + { + try + { + D1 d1; + d1 = test.D1AsD1(); + test(d1 != null); + test(d1.ice_id().equals("::Test::D1")); + test(d1.sb.equals("D1.sb")); + test(d1.pb != null); + test(d1.pb != d1); + + B b2 = d1.pb; + test(b2 != null); + test(b2.ice_id().equals("::Test::B")); + test(b2.sb.equals("D2.sb")); + test(b2.pb == d1); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("known derived pointer slicing as derived (AMI)... "); + System.out.flush(); + { + AMI_Test_D1AsD1I cb = new AMI_Test_D1AsD1I(); + test.D1AsD1_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("unknown derived pointer slicing as base... "); + System.out.flush(); + { + try + { + B b2; + b2 = test.D2AsB(); + test(b2 != null); + test(b2.ice_id().equals("::Test::B")); + test(b2.sb.equals("D2.sb")); + test(b2.pb != null); + test(b2.pb != b2); + + B b1 = b2.pb; + test(b1 != null); + test(b1.ice_id().equals("::Test::D1")); + test(b1.sb.equals("D1.sb")); + test(b1.pb == b2); + D1 d1 = (D1)b1; + test(d1 != null); + test(d1.sd1.equals("D1.sd1")); + test(d1.pd1 == b2); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("unknown derived pointer slicing as base (AMI)... "); + System.out.flush(); + { + AMI_Test_D2AsBI cb = new AMI_Test_D2AsBI(); + test.D2AsB_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("param ptr slicing with known first... "); + System.out.flush(); + { + try + { + BHolder b1 = new BHolder(); + BHolder b2 = new BHolder(); + test.paramTest1(b1, b2); + + test(b1.value != null); + test(b1.value.ice_id().equals("::Test::D1")); + test(b1.value.sb.equals("D1.sb")); + test(b1.value.pb == b2.value); + D1 d1 = (D1)b1.value; + test(d1 != null); + test(d1.sd1.equals("D1.sd1")); + test(d1.pd1 == b2.value); + + test(b2.value != null); + test(b2.value.ice_id().equals("::Test::B")); // No factory, must be sliced + test(b2.value.sb.equals("D2.sb")); + test(b2.value.pb == b1.value); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("param ptr slicing with known first (AMI)... "); + System.out.flush(); + { + AMI_Test_paramTest1I cb = new AMI_Test_paramTest1I(); + test.paramTest1_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("param ptr slicing with unknown first... "); + System.out.flush(); + { + try + { + BHolder b2 = new BHolder(); + BHolder b1 = new BHolder(); + test.paramTest2(b2, b1); + + test(b1.value != null); + test(b1.value.ice_id().equals("::Test::D1")); + test(b1.value.sb.equals("D1.sb")); + test(b1.value.pb == b2.value); + D1 d1 = (D1)b1.value; + test(d1 != null); + test(d1.sd1.equals("D1.sd1")); + test(d1.pd1 == b2.value); + + test(b2.value != null); + test(b2.value.ice_id().equals("::Test::B")); // No factory, must be sliced + test(b2.value.sb.equals("D2.sb")); + test(b2.value.pb == b1.value); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("param ptr slicing with unknown first (AMI)... "); + System.out.flush(); + { + AMI_Test_paramTest2I cb = new AMI_Test_paramTest2I(); + test.paramTest2_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("return value identity with known first... "); + System.out.flush(); + { + try + { + BHolder p1 = new BHolder(); + BHolder p2 = new BHolder(); + B r = test.returnTest1(p1, p2); + test(r == p1.value); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("return value identity with known first (AMI)... "); + System.out.flush(); + { + AMI_Test_returnTest1I cb = new AMI_Test_returnTest1I(); + test.returnTest1_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("return value identity with unknown first... "); + System.out.flush(); + { + try + { + BHolder p1 = new BHolder(); + BHolder p2 = new BHolder(); + B r = test.returnTest2(p1, p2); + test(r == p1.value); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("return value identity with unknown first (AMI)... "); + System.out.flush(); + { + AMI_Test_returnTest2I cb = new AMI_Test_returnTest2I(); + test.returnTest2_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("return value identity for input params known first... "); + System.out.flush(); + { + try + { + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D3 d3 = new D3(); + d3.pb = d1; + d3.sb = "D3.sb"; + d3.sd3 = "D3.sd3"; + d3.pd3 = d1; + d1.pb = d3; + d1.pd1 = d3; + + B b1 = test.returnTest3(d1, d3); + + test(b1 != null); + test(b1.sb.equals("D1.sb")); + test(b1.ice_id().equals("::Test::D1")); + D1 p1 = (D1)b1; + test(p1 != null); + test(p1.sd1.equals("D1.sd1")); + test(p1.pd1 == b1.pb); + + B b2 = b1.pb; + test(b2 != null); + test(b2.sb.equals("D3.sb")); + test(b2.ice_id().equals("::Test::B")); // Sliced by server + test(b2.pb == b1); + try + { + D3 p3 = (D3)b2; + test(false); + } + catch(ClassCastException ex) + { + } + + test(b1 != d1); + test(b1 != d3); + test(b2 != d1); + test(b2 != d3); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("return value identity for input params known first (AMI)... "); + System.out.flush(); + { + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D3 d3 = new D3(); + d3.pb = d1; + d3.sb = "D3.sb"; + d3.sd3 = "D3.sd3"; + d3.pd3 = d1; + d1.pb = d3; + d1.pd1 = d3; + + AMI_Test_returnTest3I cb = new AMI_Test_returnTest3I(); + test.returnTest3_async(cb, d1, d3); + test(cb.check()); + B b1 = cb.r; + + test(b1 != null); + test(b1.sb.equals("D1.sb")); + test(b1.ice_id().equals("::Test::D1")); + D1 p1 = (D1)b1; + test(p1 != null); + test(p1.sd1.equals("D1.sd1")); + test(p1.pd1 == b1.pb); + + B b2 = b1.pb; + test(b2 != null); + test(b2.sb.equals("D3.sb")); + test(b2.ice_id().equals("::Test::B")); // Sliced by server + test(b2.pb == b1); + try + { + D3 p3 = (D3)b2; + test(false); + } + catch(ClassCastException ex) + { + } + + test(b1 != d1); + test(b1 != d3); + test(b2 != d1); + test(b2 != d3); + } + System.out.println("ok"); + + System.out.print("return value identity for input params unknown first... "); + System.out.flush(); + { + try + { + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D3 d3 = new D3(); + d3.pb = d1; + d3.sb = "D3.sb"; + d3.sd3 = "D3.sd3"; + d3.pd3 = d1; + d1.pb = d3; + d1.pd1 = d3; + + B b1 = test.returnTest3(d3, d1); + + test(b1 != null); + test(b1.sb.equals("D3.sb")); + test(b1.ice_id().equals("::Test::B")); // Sliced by server + + try + { + D3 p1 = (D3)b1; + test(false); + } + catch(ClassCastException ex) + { + } + + B b2 = b1.pb; + test(b2 != null); + test(b2.sb.equals("D1.sb")); + test(b2.ice_id().equals("::Test::D1")); + test(b2.pb == b1); + D1 p3 = (D1)b2; + test(p3 != null); + test(p3.sd1.equals("D1.sd1")); + test(p3.pd1 == b1); + + test(b1 != d1); + test(b1 != d3); + test(b2 != d1); + test(b2 != d3); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("return value identity for input params unknown first (AMI)... "); + System.out.flush(); + { + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D3 d3 = new D3(); + d3.pb = d1; + d3.sb = "D3.sb"; + d3.sd3 = "D3.sd3"; + d3.pd3 = d1; + d1.pb = d3; + d1.pd1 = d3; + + AMI_Test_returnTest3I cb = new AMI_Test_returnTest3I(); + test.returnTest3_async(cb, d3, d1); + test(cb.check()); + B b1 = cb.r; + + test(b1 != null); + test(b1.sb.equals("D3.sb")); + test(b1.ice_id().equals("::Test::B")); // Sliced by server + + try + { + D3 p1 = (D3)b1; + test(false); + } + catch(ClassCastException ex) + { + } + + B b2 = b1.pb; + test(b2 != null); + test(b2.sb.equals("D1.sb")); + test(b2.ice_id().equals("::Test::D1")); + test(b2.pb == b1); + D1 p3 = (D1)b2; + test(p3 != null); + test(p3.sd1.equals("D1.sd1")); + test(p3.pd1 == b1); + + test(b1 != d1); + test(b1 != d3); + test(b2 != d1); + test(b2 != d3); + } + System.out.println("ok"); + + System.out.print("remainder unmarshaling (3 instances)... "); + System.out.flush(); + { + try + { + BHolder p1 = new BHolder(); + BHolder p2 = new BHolder(); + B ret = test.paramTest3(p1, p2); + + test(p1.value != null); + test(p1.value.sb.equals("D2.sb (p1 1)")); + test(p1.value.pb == null); + test(p1.value.ice_id().equals("::Test::B")); + + test(p2.value != null); + test(p2.value.sb.equals("D2.sb (p2 1)")); + test(p2.value.pb == null); + test(p2.value.ice_id().equals("::Test::B")); + + test(ret != null); + test(ret.sb.equals("D1.sb (p2 2)")); + test(ret.pb == null); + test(ret.ice_id().equals("::Test::D1")); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("remainder unmarshaling (3 instances) (AMI)... "); + System.out.flush(); + { + AMI_Test_paramTest3I cb = new AMI_Test_paramTest3I(); + test.paramTest3_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("remainder unmarshaling (4 instances)... "); + System.out.flush(); + { + try + { + BHolder b = new BHolder(); + B ret = test.paramTest4(b); + + test(b.value != null); + test(b.value.sb.equals("D4.sb (1)")); + test(b.value.pb == null); + test(b.value.ice_id().equals("::Test::B")); + + test(ret != null); + test(ret.sb.equals("B.sb (2)")); + test(ret.pb == null); + test(ret.ice_id().equals("::Test::B")); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("remainder unmarshaling (4 instances) (AMI)... "); + System.out.flush(); + { + AMI_Test_paramTest4I cb = new AMI_Test_paramTest4I(); + test.paramTest4_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("param ptr slicing, instance marshaled in unknown derived as base... "); + System.out.flush(); + { + try + { + B b1 = new B(); + b1.sb = "B.sb(1)"; + b1.pb = b1; + + D3 d3 = new D3(); + d3.sb = "D3.sb"; + d3.pb = d3; + d3.sd3 = "D3.sd3"; + d3.pd3 = b1; + + B b2 = new B(); + b2.sb = "B.sb(2)"; + b2.pb = b1; + + B r = test.returnTest3(d3, b2); + + test(r != null); + test(r.ice_id().equals("::Test::B")); + test(r.sb.equals("D3.sb")); + test(r.pb == r); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("param ptr slicing, instance marshaled in unknown derived as base (AMI)... "); + System.out.flush(); + { + B b1 = new B(); + b1.sb = "B.sb(1)"; + b1.pb = b1; + + D3 d3 = new D3(); + d3.sb = "D3.sb"; + d3.pb = d3; + d3.sd3 = "D3.sd3"; + d3.pd3 = b1; + + B b2 = new B(); + b2.sb = "B.sb(2)"; + b2.pb = b1; + + AMI_Test_returnTest3I cb = new AMI_Test_returnTest3I(); + test.returnTest3_async(cb, d3, b2); + test(cb.check()); + B r = cb.r; + + test(r != null); + test(r.ice_id().equals("::Test::B")); + test(r.sb.equals("D3.sb")); + test(r.pb == r); + } + System.out.println("ok"); + + System.out.print("param ptr slicing, instance marshaled in unknown derived as derived... "); + System.out.flush(); + { + try + { + D1 d11 = new D1(); + d11.sb = "D1.sb(1)"; + d11.pb = d11; + d11.sd1 = "D1.sd1(1)"; + + D3 d3 = new D3(); + d3.sb = "D3.sb"; + d3.pb = d3; + d3.sd3 = "D3.sd3"; + d3.pd3 = d11; + + D1 d12 = new D1(); + d12.sb = "D1.sb(2)"; + d12.pb = d12; + d12.sd1 = "D1.sd1(2)"; + d12.pd1 = d11; + + B r = test.returnTest3(d3, d12); + test(r != null); + test(r.ice_id().equals("::Test::B")); + test(r.sb.equals("D3.sb")); + test(r.pb == r); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("param ptr slicing, instance marshaled in unknown derived as derived (AMI)... "); + System.out.flush(); + { + D1 d11 = new D1(); + d11.sb = "D1.sb(1)"; + d11.pb = d11; + d11.sd1 = "D1.sd1(1)"; + + D3 d3 = new D3(); + d3.sb = "D3.sb"; + d3.pb = d3; + d3.sd3 = "D3.sd3"; + d3.pd3 = d11; + + D1 d12 = new D1(); + d12.sb = "D1.sb(2)"; + d12.pb = d12; + d12.sd1 = "D1.sd1(2)"; + d12.pd1 = d11; + + AMI_Test_returnTest3I cb = new AMI_Test_returnTest3I(); + test.returnTest3_async(cb, d3, d12); + test(cb.check()); + B r = cb.r; + + test(r != null); + test(r.ice_id().equals("::Test::B")); + test(r.sb.equals("D3.sb")); + test(r.pb == r); + } + System.out.println("ok"); + + System.out.print("sequence slicing... "); + System.out.flush(); + { + try + { + SS ss; + { + B ss1b = new B(); + ss1b.sb = "B.sb"; + ss1b.pb = ss1b; + + D1 ss1d1 = new D1(); + ss1d1.sb = "D1.sb"; + ss1d1.sd1 = "D1.sd1"; + ss1d1.pb = ss1b; + + D3 ss1d3 = new D3(); + ss1d3.sb = "D3.sb"; + ss1d3.sd3 = "D3.sd3"; + ss1d3.pb = ss1b; + + B ss2b = new B(); + ss2b.sb = "B.sb"; + ss2b.pb = ss1b; + + D1 ss2d1 = new D1(); + ss2d1.sb = "D1.sb"; + ss2d1.sd1 = "D1.sd1"; + ss2d1.pb = ss2b; + + D3 ss2d3 = new D3(); + ss2d3.sb = "D3.sb"; + ss2d3.sd3 = "D3.sd3"; + ss2d3.pb = ss2b; + + ss1d1.pd1 = ss2b; + ss1d3.pd3 = ss2d1; + + ss2d1.pd1 = ss1d3; + ss2d3.pd3 = ss1d1; + + SS1 ss1 = new SS1(); + ss1.s = new B[3]; + ss1.s[0] = ss1b; + ss1.s[1] = ss1d1; + ss1.s[2] = ss1d3; + + SS2 ss2 = new SS2(); + ss2.s = new B[3]; + ss2.s[0] = ss2b; + ss2.s[1] = ss2d1; + ss2.s[2] = ss2d3; + + ss = test.sequenceTest(ss1, ss2); + } + + test(ss.c1 != null); + B ss1b = ss.c1.s[0]; + B ss1d1 = ss.c1.s[1]; + test(ss.c2 != null); + B ss1d3 = ss.c1.s[2]; + + test(ss.c2 != null); + B ss2b = ss.c2.s[0]; + B ss2d1 = ss.c2.s[1]; + B ss2d3 = ss.c2.s[2]; + + test(ss1b.pb == ss1b); + test(ss1d1.pb == ss1b); + test(ss1d3.pb == ss1b); + + test(ss2b.pb == ss1b); + test(ss2d1.pb == ss2b); + test(ss2d3.pb == ss2b); + + test(ss1b.ice_id().equals("::Test::B")); + test(ss1d1.ice_id().equals("::Test::D1")); + test(ss1d3.ice_id().equals("::Test::B")); + + test(ss2b.ice_id().equals("::Test::B")); + test(ss2d1.ice_id().equals("::Test::D1")); + test(ss2d3.ice_id().equals("::Test::B")); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("sequence slicing (AMI)... "); + System.out.flush(); + { + SS ss; + { + B ss1b = new B(); + ss1b.sb = "B.sb"; + ss1b.pb = ss1b; + + D1 ss1d1 = new D1(); + ss1d1.sb = "D1.sb"; + ss1d1.sd1 = "D1.sd1"; + ss1d1.pb = ss1b; + + D3 ss1d3 = new D3(); + ss1d3.sb = "D3.sb"; + ss1d3.sd3 = "D3.sd3"; + ss1d3.pb = ss1b; + + B ss2b = new B(); + ss2b.sb = "B.sb"; + ss2b.pb = ss1b; + + D1 ss2d1 = new D1(); + ss2d1.sb = "D1.sb"; + ss2d1.sd1 = "D1.sd1"; + ss2d1.pb = ss2b; + + D3 ss2d3 = new D3(); + ss2d3.sb = "D3.sb"; + ss2d3.sd3 = "D3.sd3"; + ss2d3.pb = ss2b; + + ss1d1.pd1 = ss2b; + ss1d3.pd3 = ss2d1; + + ss2d1.pd1 = ss1d3; + ss2d3.pd3 = ss1d1; + + SS1 ss1 = new SS1(); + ss1.s = new B[3]; + ss1.s[0] = ss1b; + ss1.s[1] = ss1d1; + ss1.s[2] = ss1d3; + + SS2 ss2 = new SS2(); + ss2.s = new B[3]; + ss2.s[0] = ss2b; + ss2.s[1] = ss2d1; + ss2.s[2] = ss2d3; + + AMI_Test_sequenceTestI cb = new AMI_Test_sequenceTestI(); + test.sequenceTest_async(cb, ss1, ss2); + test(cb.check()); + ss = cb.r; + } + test(ss.c1 != null); + B ss1b = ss.c1.s[0]; + B ss1d1 = ss.c1.s[1]; + test(ss.c2 != null); + B ss1d3 = ss.c1.s[2]; + + test(ss.c2 != null); + B ss2b = ss.c2.s[0]; + B ss2d1 = ss.c2.s[1]; + B ss2d3 = ss.c2.s[2]; + + test(ss1b.pb == ss1b); + test(ss1d1.pb == ss1b); + test(ss1d3.pb == ss1b); + + test(ss2b.pb == ss1b); + test(ss2d1.pb == ss2b); + test(ss2d3.pb == ss2b); + + test(ss1b.ice_id().equals("::Test::B")); + test(ss1d1.ice_id().equals("::Test::D1")); + test(ss1d3.ice_id().equals("::Test::B")); + + test(ss2b.ice_id().equals("::Test::B")); + test(ss2d1.ice_id().equals("::Test::D1")); + test(ss2d3.ice_id().equals("::Test::B")); + } + System.out.println("ok"); + + System.out.print("dictionary slicing... "); + System.out.flush(); + { + try + { + java.util.IdentityHashMap bin = new java.util.IdentityHashMap(); + BDictHolder bout = new BDictHolder(); + java.util.Map r; + int i; + for(i = 0; i < 10; ++i) + { + String s = "D1." + new Integer(i).toString(); + D1 d1 = new D1(); + d1.sb = s; + d1.pb = d1; + d1.sd1 = s; + bin.put(new Integer(i), d1); + } + + r = test.dictionaryTest(bin, bout); + + test(bout.value.size() == 10); + for(i = 0; i < 10; ++i) + { + B b = (B)bout.value.get(new Integer(i * 10)); + test(b != null); + String s = "D1." + new Integer(i).toString(); + test(b.sb.equals(s)); + test(b.pb != null); + test(b.pb != b); + test(b.pb.sb.equals(s)); + test(b.pb.pb == b.pb); + } + + test(r.size() == 10); + for(i = 0; i < 10; ++i) + { + B b = (B)r.get(new Integer(i * 20)); + test(b != null); + String s = "D1." + new Integer(i * 20).toString(); + test(b.sb.equals(s)); + test(b.pb == (i == 0 ? (B)null : (B)r.get(new Integer((i - 1) * 20)))); + D1 d1 = (D1)b; + test(d1 != null); + test(d1.sd1.equals(s)); + test(d1.pd1 == d1); + } + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("dictionary slicing (AMI)... "); + System.out.flush(); + { + java.util.Map bin = new java.util.HashMap(); + java.util.Map bout; + java.util.Map r; + int i; + for(i = 0; i < 10; ++i) + { + String s = "D1." + new Integer(i).toString(); + D1 d1 = new D1(); + d1.sb = s; + d1.pb = d1; + d1.sd1 = s; + bin.put(new Integer(i), d1); + } + + AMI_Test_dictionaryTestI cb = new AMI_Test_dictionaryTestI(); + test.dictionaryTest_async(cb, bin); + test(cb.check()); + bout = cb.bout; + r = cb.r; + + test(bout.size() == 10); + for(i = 0; i < 10; ++i) + { + B b = (B)bout.get(new Integer(i * 10)); + test(b != null); + String s = "D1." + new Integer(i).toString(); + test(b.sb.equals(s)); + test(b.pb != null); + test(b.pb != b); + test(b.pb.sb.equals(s)); + test(b.pb.pb == b.pb); + } + + test(r.size() == 10); + for(i = 0; i < 10; ++i) + { + B b = (B)r.get(new Integer(i * 20)); + test(b != null); + String s = "D1." + new Integer(i * 20).toString(); + test(b.sb.equals(s)); + test(b.pb == (i == 0 ? (B)null : (B)r.get(new Integer((i - 1) * 20)))); + D1 d1 = (D1)b; + test(d1 != null); + test(d1.sd1.equals(s)); + test(d1.pd1 == d1); + } + } + System.out.println("ok"); + + System.out.print("base exception thrown as base exception... "); + System.out.flush(); + { + try + { + test.throwBaseAsBase(); + test(false); + } + catch(BaseException e) + { + test(e.ice_name().equals("Test::BaseException")); + test(e.sbe.equals("sbe")); + test(e.pb != null); + test(e.pb.sb.equals("sb")); + test(e.pb.pb == e.pb); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("base exception thrown as base exception (AMI)... "); + System.out.flush(); + { + AMI_Test_throwBaseAsBaseI cb = new AMI_Test_throwBaseAsBaseI(); + test.throwBaseAsBase_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("derived exception thrown as base exception... "); + System.out.flush(); + { + try + { + test.throwDerivedAsBase(); + test(false); + } + catch(DerivedException e) + { + test(e.ice_name().equals("Test::DerivedException")); + test(e.sbe.equals("sbe")); + test(e.pb != null); + test(e.pb.sb.equals("sb1")); + test(e.pb.pb == e.pb); + test(e.sde.equals("sde1")); + test(e.pd1 != null); + test(e.pd1.sb.equals("sb2")); + test(e.pd1.pb == e.pd1); + test(e.pd1.sd1.equals("sd2")); + test(e.pd1.pd1 == e.pd1); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("derived exception thrown as base exception (AMI)... "); + System.out.flush(); + { + AMI_Test_throwDerivedAsBaseI cb = new AMI_Test_throwDerivedAsBaseI(); + test.throwDerivedAsBase_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("derived exception thrown as derived exception... "); + System.out.flush(); + { + try + { + test.throwDerivedAsDerived(); + test(false); + } + catch(DerivedException e) + { + test(e.ice_name().equals("Test::DerivedException")); + test(e.sbe.equals("sbe")); + test(e.pb != null); + test(e.pb.sb.equals("sb1")); + test(e.pb.pb == e.pb); + test(e.sde.equals("sde1")); + test(e.pd1 != null); + test(e.pd1.sb.equals("sb2")); + test(e.pd1.pb == e.pd1); + test(e.pd1.sd1.equals("sd2")); + test(e.pd1.pd1 == e.pd1); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("derived exception thrown as derived exception (AMI)... "); + System.out.flush(); + { + AMI_Test_throwDerivedAsDerivedI cb = new AMI_Test_throwDerivedAsDerivedI(); + test.throwDerivedAsDerived_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("unknown derived exception thrown as base exception... "); + System.out.flush(); + { + try + { + test.throwUnknownDerivedAsBase(); + test(false); + } + catch(BaseException e) + { + test(e.ice_name().equals("Test::BaseException")); + test(e.sbe.equals("sbe")); + test(e.pb != null); + test(e.pb.sb.equals("sb d2")); + test(e.pb.pb == e.pb); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("unknown derived exception thrown as base exception (AMI)... "); + System.out.flush(); + { + AMI_Test_throwUnknownDerivedAsBaseI cb = new AMI_Test_throwUnknownDerivedAsBaseI(); + test.throwUnknownDerivedAsBase_async(cb); + test(cb.check()); + } + System.out.println("ok"); + + System.out.print("forward-declared class... "); + System.out.flush(); + { + try + { + ForwardHolder f = new ForwardHolder(); + test.useForward(f); + test(f.value != null); + } + catch(Exception ex) + { + test(false); + } + } + System.out.println("ok"); + + System.out.print("forward-declared class (AMI)... "); + System.out.flush(); + { + AMI_Test_useForwardI cb = new AMI_Test_useForwardI(); + test.useForward_async(cb); + test(cb.check()); + } + System.out.println("ok"); return test; } diff --git a/java/test/Ice/slicing/objects/csrc/Client.java b/java/test/Ice/slicing/objects/csrc/Client.java index b766d24bc3f..14feb00a91a 100644 --- a/java/test/Ice/slicing/objects/csrc/Client.java +++ b/java/test/Ice/slicing/objects/csrc/Client.java @@ -49,7 +49,7 @@ public class Client } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/slicing/objects/ssrc/Server.java b/java/test/Ice/slicing/objects/ssrc/Server.java index 1274fb465dc..03ede9cb41c 100644 --- a/java/test/Ice/slicing/objects/ssrc/Server.java +++ b/java/test/Ice/slicing/objects/ssrc/Server.java @@ -53,7 +53,7 @@ public class Server } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/slicing/objects/ssrc/TestI.java b/java/test/Ice/slicing/objects/ssrc/TestI.java index 68ea468f68c..fdad2fb3487 100644 --- a/java/test/Ice/slicing/objects/ssrc/TestI.java +++ b/java/test/Ice/slicing/objects/ssrc/TestI.java @@ -26,324 +26,324 @@ public final class TestI extends _TestIntfDisp public Ice.Object SBaseAsObject(Ice.Current current) { - SBase sb = new SBase(); - sb.sb = "SBase.sb"; - return sb; + SBase sb = new SBase(); + sb.sb = "SBase.sb"; + return sb; } public SBase SBaseAsSBase(Ice.Current current) { - SBase sb = new SBase(); - sb.sb = "SBase.sb"; - return sb; + SBase sb = new SBase(); + sb.sb = "SBase.sb"; + return sb; } public SBase SBSKnownDerivedAsSBase(Ice.Current current) { - SBSKnownDerived sbskd = new SBSKnownDerived(); - sbskd.sb = "SBSKnownDerived.sb"; - sbskd.sbskd = "SBSKnownDerived.sbskd"; - return sbskd; + SBSKnownDerived sbskd = new SBSKnownDerived(); + sbskd.sb = "SBSKnownDerived.sb"; + sbskd.sbskd = "SBSKnownDerived.sbskd"; + return sbskd; } public SBSKnownDerived SBSKnownDerivedAsSBSKnownDerived(Ice.Current current) { - SBSKnownDerived sbskd = new SBSKnownDerived(); - sbskd.sb = "SBSKnownDerived.sb"; - sbskd.sbskd = "SBSKnownDerived.sbskd"; - return sbskd; + SBSKnownDerived sbskd = new SBSKnownDerived(); + sbskd.sb = "SBSKnownDerived.sb"; + sbskd.sbskd = "SBSKnownDerived.sbskd"; + return sbskd; } public SBase SBSUnknownDerivedAsSBase(Ice.Current current) { - SBSUnknownDerived sbsud = new SBSUnknownDerived(); - sbsud.sb = "SBSUnknownDerived.sb"; - sbsud.sbsud = "SBSUnknownDerived.sbsud"; - return sbsud; + SBSUnknownDerived sbsud = new SBSUnknownDerived(); + sbsud.sb = "SBSUnknownDerived.sb"; + sbsud.sbsud = "SBSUnknownDerived.sbsud"; + return sbsud; } public Ice.Object SUnknownAsObject(Ice.Current current) { - SUnknown su = new SUnknown(); - su.su = "SUnknown.su"; - return su; + SUnknown su = new SUnknown(); + su.su = "SUnknown.su"; + return su; } public B oneElementCycle(Ice.Current current) { - B b = new B(); - b.sb = "B1.sb"; - b.pb = b; - return b; + B b = new B(); + b.sb = "B1.sb"; + b.pb = b; + return b; } public B twoElementCycle(Ice.Current current) { - B b1 = new B(); - b1.sb = "B1.sb"; - B b2 = new B(); - b2.sb = "B2.sb"; - b2.pb = b1; - b1.pb = b2; - return b1; + B b1 = new B(); + b1.sb = "B1.sb"; + B b2 = new B(); + b2.sb = "B2.sb"; + b2.pb = b1; + b1.pb = b2; + return b1; } public B D1AsB(Ice.Current current) { - D1 d1 = new D1(); - d1.sb = "D1.sb"; - d1.sd1 = "D1.sd1"; - D2 d2 = new D2(); - d2.pb = d1; - d2.sb = "D2.sb"; - d2.sd2 = "D2.sd2"; - d2.pd2 = d1; - d1.pb = d2; - d1.pd1 = d2; - return d1; + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D2 d2 = new D2(); + d2.pb = d1; + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + d2.pd2 = d1; + d1.pb = d2; + d1.pd1 = d2; + return d1; } public D1 D1AsD1(Ice.Current current) { - D1 d1 = new D1(); - d1.sb = "D1.sb"; - d1.sd1 = "D1.sd1"; - D2 d2 = new D2(); - d2.pb = d1; - d2.sb = "D2.sb"; - d2.sd2 = "D2.sd2"; - d2.pd2 = d1; - d1.pb = d2; - d1.pd1 = d2; - return d1; + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D2 d2 = new D2(); + d2.pb = d1; + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + d2.pd2 = d1; + d1.pb = d2; + d1.pd1 = d2; + return d1; } public B D2AsB(Ice.Current current) { - D2 d2 = new D2(); - d2.sb = "D2.sb"; - d2.sd2 = "D2.sd2"; - D1 d1 = new D1(); - d1.pb = d2; - d1.sb = "D1.sb"; - d1.sd1 = "D1.sd1"; - d1.pd1 = d2; - d2.pb = d1; - d2.pd2 = d1; - return d2; + D2 d2 = new D2(); + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + D1 d1 = new D1(); + d1.pb = d2; + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + d1.pd1 = d2; + d2.pb = d1; + d2.pd2 = d1; + return d2; } public void paramTest1(BHolder p1, BHolder p2, Ice.Current current) { - D1 d1 = new D1(); - d1.sb = "D1.sb"; - d1.sd1 = "D1.sd1"; - D2 d2 = new D2(); - d2.pb = d1; - d2.sb = "D2.sb"; - d2.sd2 = "D2.sd2"; - d2.pd2 = d1; - d1.pb = d2; - d1.pd1 = d2; - p1.value = d1; - p2.value = d2; + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D2 d2 = new D2(); + d2.pb = d1; + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + d2.pd2 = d1; + d1.pb = d2; + d1.pd1 = d2; + p1.value = d1; + p2.value = d2; } public void paramTest2(BHolder p1, BHolder p2, Ice.Current current) { - paramTest1(p2, p1, current); + paramTest1(p2, p1, current); } public B paramTest3(BHolder p1, BHolder p2, Ice.Current current) { - D2 d2 = new D2(); - d2.sb = "D2.sb (p1 1)"; - d2.pb = null; - d2.sd2 = "D2.sd2 (p1 1)"; - p1.value = d2; - - D1 d1 = new D1(); - d1.sb = "D1.sb (p1 2)"; - d1.pb = null; - d1.sd1 = "D1.sd2 (p1 2)"; - d1.pd1 = null; - d2.pd2 = d1; - - D2 d4 = new D2(); - d4.sb = "D2.sb (p2 1)"; - d4.pb = null; - d4.sd2 = "D2.sd2 (p2 1)"; - p2.value = d4; - - D1 d3 = new D1(); - d3.sb = "D1.sb (p2 2)"; - d3.pb = null; - d3.sd1 = "D1.sd2 (p2 2)"; - d3.pd1 = null; - d4.pd2 = d3; - - return d3; + D2 d2 = new D2(); + d2.sb = "D2.sb (p1 1)"; + d2.pb = null; + d2.sd2 = "D2.sd2 (p1 1)"; + p1.value = d2; + + D1 d1 = new D1(); + d1.sb = "D1.sb (p1 2)"; + d1.pb = null; + d1.sd1 = "D1.sd2 (p1 2)"; + d1.pd1 = null; + d2.pd2 = d1; + + D2 d4 = new D2(); + d4.sb = "D2.sb (p2 1)"; + d4.pb = null; + d4.sd2 = "D2.sd2 (p2 1)"; + p2.value = d4; + + D1 d3 = new D1(); + d3.sb = "D1.sb (p2 2)"; + d3.pb = null; + d3.sd1 = "D1.sd2 (p2 2)"; + d3.pd1 = null; + d4.pd2 = d3; + + return d3; } public B paramTest4(BHolder p1, Ice.Current current) { - D4 d4 = new D4(); - d4.sb = "D4.sb (1)"; - d4.pb = null; - d4.p1 = new B(); - d4.p1.sb = "B.sb (1)"; - d4.p2 = new B(); - d4.p2.sb = "B.sb (2)"; - p1.value = d4; - return d4.p2; + D4 d4 = new D4(); + d4.sb = "D4.sb (1)"; + d4.pb = null; + d4.p1 = new B(); + d4.p1.sb = "B.sb (1)"; + d4.p2 = new B(); + d4.p2.sb = "B.sb (2)"; + p1.value = d4; + return d4.p2; } public B returnTest1(BHolder p1, BHolder p2, Ice.Current current) { - Ice.Current c; - paramTest1(p1, p2, current); - return p1.value; + Ice.Current c; + paramTest1(p1, p2, current); + return p1.value; } public B returnTest2(BHolder p1, BHolder p2, Ice.Current current) { - Ice.Current c; - paramTest1(p2, p1, current); - return p1.value; + Ice.Current c; + paramTest1(p2, p1, current); + return p1.value; } public B returnTest3(B p1, B p2, Ice.Current current) { - return p1; + return p1; } public SS sequenceTest(SS1 p1, SS2 p2, Ice.Current current) { - SS ss = new SS(); - ss.c1 = p1; - ss.c2 = p2; - return ss; + SS ss = new SS(); + ss.c1 = p1; + ss.c2 = p2; + return ss; } public java.util.Map dictionaryTest(java.util.Map bin, BDictHolder bout, Ice.Current current) { - bout.value = new java.util.HashMap(); - int i; - for(i = 0; i < 10; ++i) - { - B b = (B)bin.get(new Integer(i)); - D2 d2 = new D2(); - d2.sb = b.sb; - d2.pb = b.pb; - d2.sd2 = "D2"; - d2.pd2 = d2; - bout.value.put(new Integer(i * 10), d2); - } - java.util.Map r = new java.util.HashMap(); - for(i = 0; i < 10; ++i) - { - String s = "D1." + new Integer(i * 20).toString(); - D1 d1 = new D1(); - d1.sb = s; - d1.pb = (i == 0 ? (B)null : (B)r.get(new Integer((i - 1) * 20))); - d1.sd1 = s; - d1.pd1 = d1; - r.put(new Integer(i * 20), d1); - } - return r; + bout.value = new java.util.HashMap(); + int i; + for(i = 0; i < 10; ++i) + { + B b = (B)bin.get(new Integer(i)); + D2 d2 = new D2(); + d2.sb = b.sb; + d2.pb = b.pb; + d2.sd2 = "D2"; + d2.pd2 = d2; + bout.value.put(new Integer(i * 10), d2); + } + java.util.Map r = new java.util.HashMap(); + for(i = 0; i < 10; ++i) + { + String s = "D1." + new Integer(i * 20).toString(); + D1 d1 = new D1(); + d1.sb = s; + d1.pb = (i == 0 ? (B)null : (B)r.get(new Integer((i - 1) * 20))); + d1.sd1 = s; + d1.pd1 = d1; + r.put(new Integer(i * 20), d1); + } + return r; } public void throwBaseAsBase(Ice.Current current) throws BaseException { - BaseException be = new BaseException(); - be.sbe = "sbe"; - be.pb = new B(); - be.pb.sb = "sb"; - be.pb.pb = be.pb; - throw be; + BaseException be = new BaseException(); + be.sbe = "sbe"; + be.pb = new B(); + be.pb.sb = "sb"; + be.pb.pb = be.pb; + throw be; } public void throwDerivedAsBase(Ice.Current current) throws BaseException { - DerivedException de = new DerivedException(); - de.sbe = "sbe"; - de.pb = new B(); - de.pb.sb = "sb1"; - de.pb.pb = de.pb; - de.sde = "sde1"; - de.pd1 = new D1(); - de.pd1.sb = "sb2"; - de.pd1.pb = de.pd1; - de.pd1.sd1 = "sd2"; - de.pd1.pd1 = de.pd1; - throw de; + DerivedException de = new DerivedException(); + de.sbe = "sbe"; + de.pb = new B(); + de.pb.sb = "sb1"; + de.pb.pb = de.pb; + de.sde = "sde1"; + de.pd1 = new D1(); + de.pd1.sb = "sb2"; + de.pd1.pb = de.pd1; + de.pd1.sd1 = "sd2"; + de.pd1.pd1 = de.pd1; + throw de; } public void throwDerivedAsDerived(Ice.Current current) throws DerivedException { - DerivedException de = new DerivedException(); - de.sbe = "sbe"; - de.pb = new B(); - de.pb.sb = "sb1"; - de.pb.pb = de.pb; - de.sde = "sde1"; - de.pd1 = new D1(); - de.pd1.sb = "sb2"; - de.pd1.pb = de.pd1; - de.pd1.sd1 = "sd2"; - de.pd1.pd1 = de.pd1; - throw de; + DerivedException de = new DerivedException(); + de.sbe = "sbe"; + de.pb = new B(); + de.pb.sb = "sb1"; + de.pb.pb = de.pb; + de.sde = "sde1"; + de.pd1 = new D1(); + de.pd1.sb = "sb2"; + de.pd1.pb = de.pd1; + de.pd1.sd1 = "sd2"; + de.pd1.pd1 = de.pd1; + throw de; } public void throwUnknownDerivedAsBase(Ice.Current current) - throws BaseException + throws BaseException { - D2 d2 = new D2(); - d2.sb = "sb d2"; - d2.pb = d2; - d2.sd2 = "sd2 d2"; - d2.pd2 = d2; - - UnknownDerivedException ude = new UnknownDerivedException(); - ude.sbe = "sbe"; - ude.pb = d2; - ude.sude = "sude"; - ude.pd2 = d2; - throw ude; + D2 d2 = new D2(); + d2.sb = "sb d2"; + d2.pb = d2; + d2.sd2 = "sd2 d2"; + d2.pd2 = d2; + + UnknownDerivedException ude = new UnknownDerivedException(); + ude.sbe = "sbe"; + ude.pb = d2; + ude.sude = "sude"; + ude.pd2 = d2; + throw ude; } public void useForward(ForwardHolder f, Ice.Current current) { - f.value = new Forward(); - f.value.h = new Hidden(); - f.value.h.f = f.value; + f.value = new Forward(); + f.value.h = new Hidden(); + f.value.h.f = f.value; } private Ice.ObjectAdapter _adapter; diff --git a/java/test/Ice/slicing/objectsAMD/Server.java b/java/test/Ice/slicing/objectsAMD/Server.java index f444f94ba6d..c1a6dba0ac3 100644 --- a/java/test/Ice/slicing/objectsAMD/Server.java +++ b/java/test/Ice/slicing/objectsAMD/Server.java @@ -53,7 +53,7 @@ public class Server } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/slicing/objectsAMD/TestAMD.ice b/java/test/Ice/slicing/objectsAMD/TestAMD.ice index 9303d9e8325..1fe41bec3f5 100644 --- a/java/test/Ice/slicing/objectsAMD/TestAMD.ice +++ b/java/test/Ice/slicing/objectsAMD/TestAMD.ice @@ -67,7 +67,7 @@ exception DerivedException extends BaseException D1 pd1; }; -class Forward; // Forward-declared class defined in another compilation unit +class Forward; // Forward-declared class defined in another compilation unit ["ami", "amd"] interface TestIntf { @@ -104,7 +104,7 @@ class Forward; // Forward-declared class defined in another compilation unit 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 useForward(out Forward f); // Use of forward-declared class to verify that code is generated correctly. void shutdown(); }; diff --git a/java/test/Ice/slicing/objectsAMD/TestI.java b/java/test/Ice/slicing/objectsAMD/TestI.java index ba3ff59afcf..3700d9dae29 100644 --- a/java/test/Ice/slicing/objectsAMD/TestI.java +++ b/java/test/Ice/slicing/objectsAMD/TestI.java @@ -21,353 +21,353 @@ public final class TestI extends _TestIntfDisp shutdown_async(AMD_TestIntf_shutdown cb, Ice.Current current) { _adapter.getCommunicator().shutdown(); - cb.ice_response(); + cb.ice_response(); } public void SBaseAsObject_async(AMD_TestIntf_SBaseAsObject cb, Ice.Current current) { - SBase sb = new SBase(); - sb.sb = "SBase.sb"; - cb.ice_response(sb); + SBase sb = new SBase(); + sb.sb = "SBase.sb"; + cb.ice_response(sb); } public void SBaseAsSBase_async(AMD_TestIntf_SBaseAsSBase cb, Ice.Current current) { - SBase sb = new SBase(); - sb.sb = "SBase.sb"; - cb.ice_response(sb); + SBase sb = new SBase(); + sb.sb = "SBase.sb"; + cb.ice_response(sb); } public void SBSKnownDerivedAsSBase_async(AMD_TestIntf_SBSKnownDerivedAsSBase cb, Ice.Current current) { - SBSKnownDerived sbskd = new SBSKnownDerived(); - sbskd.sb = "SBSKnownDerived.sb"; - sbskd.sbskd = "SBSKnownDerived.sbskd"; - cb.ice_response(sbskd); + SBSKnownDerived sbskd = new SBSKnownDerived(); + sbskd.sb = "SBSKnownDerived.sb"; + sbskd.sbskd = "SBSKnownDerived.sbskd"; + cb.ice_response(sbskd); } public void SBSKnownDerivedAsSBSKnownDerived_async(AMD_TestIntf_SBSKnownDerivedAsSBSKnownDerived cb, Ice.Current current) { - SBSKnownDerived sbskd = new SBSKnownDerived(); - sbskd.sb = "SBSKnownDerived.sb"; - sbskd.sbskd = "SBSKnownDerived.sbskd"; - cb.ice_response(sbskd); + SBSKnownDerived sbskd = new SBSKnownDerived(); + sbskd.sb = "SBSKnownDerived.sb"; + sbskd.sbskd = "SBSKnownDerived.sbskd"; + cb.ice_response(sbskd); } public void SBSUnknownDerivedAsSBase_async(AMD_TestIntf_SBSUnknownDerivedAsSBase cb, Ice.Current current) { - SBSUnknownDerived sbsud = new SBSUnknownDerived(); - sbsud.sb = "SBSUnknownDerived.sb"; - sbsud.sbsud = "SBSUnknownDerived.sbsud"; - cb.ice_response(sbsud); + SBSUnknownDerived sbsud = new SBSUnknownDerived(); + sbsud.sb = "SBSUnknownDerived.sb"; + sbsud.sbsud = "SBSUnknownDerived.sbsud"; + cb.ice_response(sbsud); } public void SUnknownAsObject_async(AMD_TestIntf_SUnknownAsObject cb, Ice.Current current) { - SUnknown su = new SUnknown(); - su.su = "SUnknown.su"; - cb.ice_response(su); + SUnknown su = new SUnknown(); + su.su = "SUnknown.su"; + cb.ice_response(su); } public void oneElementCycle_async(AMD_TestIntf_oneElementCycle cb, Ice.Current current) { - B b = new B(); - b.sb = "B1.sb"; - b.pb = b; - cb.ice_response(b); + B b = new B(); + b.sb = "B1.sb"; + b.pb = b; + cb.ice_response(b); } public void twoElementCycle_async(AMD_TestIntf_twoElementCycle cb, Ice.Current current) { - B b1 = new B(); - b1.sb = "B1.sb"; - B b2 = new B(); - b2.sb = "B2.sb"; - b2.pb = b1; - b1.pb = b2; - cb.ice_response(b1); + B b1 = new B(); + b1.sb = "B1.sb"; + B b2 = new B(); + b2.sb = "B2.sb"; + b2.pb = b1; + b1.pb = b2; + cb.ice_response(b1); } public void D1AsB_async(AMD_TestIntf_D1AsB cb, Ice.Current current) { - D1 d1 = new D1(); - d1.sb = "D1.sb"; - d1.sd1 = "D1.sd1"; - D2 d2 = new D2(); - d2.pb = d1; - d2.sb = "D2.sb"; - d2.sd2 = "D2.sd2"; - d2.pd2 = d1; - d1.pb = d2; - d1.pd1 = d2; - cb.ice_response(d1); + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D2 d2 = new D2(); + d2.pb = d1; + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + d2.pd2 = d1; + d1.pb = d2; + d1.pd1 = d2; + cb.ice_response(d1); } public void D1AsD1_async(AMD_TestIntf_D1AsD1 cb, Ice.Current current) { - D1 d1 = new D1(); - d1.sb = "D1.sb"; - d1.sd1 = "D1.sd1"; - D2 d2 = new D2(); - d2.pb = d1; - d2.sb = "D2.sb"; - d2.sd2 = "D2.sd2"; - d2.pd2 = d1; - d1.pb = d2; - d1.pd1 = d2; - cb.ice_response(d1); + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D2 d2 = new D2(); + d2.pb = d1; + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + d2.pd2 = d1; + d1.pb = d2; + d1.pd1 = d2; + cb.ice_response(d1); } public void D2AsB_async(AMD_TestIntf_D2AsB cb, Ice.Current current) { - D2 d2 = new D2(); - d2.sb = "D2.sb"; - d2.sd2 = "D2.sd2"; - D1 d1 = new D1(); - d1.pb = d2; - d1.sb = "D1.sb"; - d1.sd1 = "D1.sd1"; - d1.pd1 = d2; - d2.pb = d1; - d2.pd2 = d1; - cb.ice_response(d2); + D2 d2 = new D2(); + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + D1 d1 = new D1(); + d1.pb = d2; + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + d1.pd1 = d2; + d2.pb = d1; + d2.pd2 = d1; + cb.ice_response(d2); } public void paramTest1_async(AMD_TestIntf_paramTest1 cb, Ice.Current current) { - D1 d1 = new D1(); - d1.sb = "D1.sb"; - d1.sd1 = "D1.sd1"; - D2 d2 = new D2(); - d2.pb = d1; - d2.sb = "D2.sb"; - d2.sd2 = "D2.sd2"; - d2.pd2 = d1; - d1.pb = d2; - d1.pd1 = d2; - cb.ice_response(d1, d2); + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D2 d2 = new D2(); + d2.pb = d1; + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + d2.pd2 = d1; + d1.pb = d2; + d1.pd1 = d2; + cb.ice_response(d1, d2); } public void paramTest2_async(AMD_TestIntf_paramTest2 cb, Ice.Current current) { - D1 d1 = new D1(); - d1.sb = "D1.sb"; - d1.sd1 = "D1.sd1"; - D2 d2 = new D2(); - d2.pb = d1; - d2.sb = "D2.sb"; - d2.sd2 = "D2.sd2"; - d2.pd2 = d1; - d1.pb = d2; - d1.pd1 = d2; - cb.ice_response(d2, d1); + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D2 d2 = new D2(); + d2.pb = d1; + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + d2.pd2 = d1; + d1.pb = d2; + d1.pd1 = d2; + cb.ice_response(d2, d1); } public void paramTest3_async(AMD_TestIntf_paramTest3 cb, Ice.Current current) { - D2 d2 = new D2(); - d2.sb = "D2.sb (p1 1)"; - d2.pb = null; - d2.sd2 = "D2.sd2 (p1 1)"; - - D1 d1 = new D1(); - d1.sb = "D1.sb (p1 2)"; - d1.pb = null; - d1.sd1 = "D1.sd2 (p1 2)"; - d1.pd1 = null; - d2.pd2 = d1; - - D2 d4 = new D2(); - d4.sb = "D2.sb (p2 1)"; - d4.pb = null; - d4.sd2 = "D2.sd2 (p2 1)"; - - D1 d3 = new D1(); - d3.sb = "D1.sb (p2 2)"; - d3.pb = null; - d3.sd1 = "D1.sd2 (p2 2)"; - d3.pd1 = null; - d4.pd2 = d3; - cb.ice_response(d3, d2, d4); + D2 d2 = new D2(); + d2.sb = "D2.sb (p1 1)"; + d2.pb = null; + d2.sd2 = "D2.sd2 (p1 1)"; + + D1 d1 = new D1(); + d1.sb = "D1.sb (p1 2)"; + d1.pb = null; + d1.sd1 = "D1.sd2 (p1 2)"; + d1.pd1 = null; + d2.pd2 = d1; + + D2 d4 = new D2(); + d4.sb = "D2.sb (p2 1)"; + d4.pb = null; + d4.sd2 = "D2.sd2 (p2 1)"; + + D1 d3 = new D1(); + d3.sb = "D1.sb (p2 2)"; + d3.pb = null; + d3.sd1 = "D1.sd2 (p2 2)"; + d3.pd1 = null; + d4.pd2 = d3; + cb.ice_response(d3, d2, d4); } public void paramTest4_async(AMD_TestIntf_paramTest4 cb, Ice.Current current) { - D4 d4 = new D4(); - d4.sb = "D4.sb (1)"; - d4.pb = null; - d4.p1 = new B(); - d4.p1.sb = "B.sb (1)"; - d4.p2 = new B(); - d4.p2.sb = "B.sb (2)"; - cb.ice_response(d4.p2, d4); + D4 d4 = new D4(); + d4.sb = "D4.sb (1)"; + d4.pb = null; + d4.p1 = new B(); + d4.p1.sb = "B.sb (1)"; + d4.p2 = new B(); + d4.p2.sb = "B.sb (2)"; + cb.ice_response(d4.p2, d4); } public void returnTest1_async(AMD_TestIntf_returnTest1 cb, Ice.Current current) { - D1 d1 = new D1(); - d1.sb = "D1.sb"; - d1.sd1 = "D1.sd1"; - D2 d2 = new D2(); - d2.pb = d1; - d2.sb = "D2.sb"; - d2.sd2 = "D2.sd2"; - d2.pd2 = d1; - d1.pb = d2; - d1.pd1 = d2; - cb.ice_response(d2, d2, d1); + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D2 d2 = new D2(); + d2.pb = d1; + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + d2.pd2 = d1; + d1.pb = d2; + d1.pd1 = d2; + cb.ice_response(d2, d2, d1); } public void returnTest2_async(AMD_TestIntf_returnTest2 cb, Ice.Current current) { - D1 d1 = new D1(); - d1.sb = "D1.sb"; - d1.sd1 = "D1.sd1"; - D2 d2 = new D2(); - d2.pb = d1; - d2.sb = "D2.sb"; - d2.sd2 = "D2.sd2"; - d2.pd2 = d1; - d1.pb = d2; - d1.pd1 = d2; - cb.ice_response(d1, d1, d2); + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D2 d2 = new D2(); + d2.pb = d1; + d2.sb = "D2.sb"; + d2.sd2 = "D2.sd2"; + d2.pd2 = d1; + d1.pb = d2; + d1.pd1 = d2; + cb.ice_response(d1, d1, d2); } public void returnTest3_async(AMD_TestIntf_returnTest3 cb, B p1, B p2, Ice.Current current) { - cb.ice_response(p1); + cb.ice_response(p1); } public void sequenceTest_async(AMD_TestIntf_sequenceTest cb, SS1 p1, SS2 p2, Ice.Current current) { - SS ss = new SS(); - ss.c1 = p1; - ss.c2 = p2; - cb.ice_response(ss); + SS ss = new SS(); + ss.c1 = p1; + ss.c2 = p2; + cb.ice_response(ss); } public void dictionaryTest_async(AMD_TestIntf_dictionaryTest cb, java.util.Map bin, Ice.Current current) { - java.util.Map bout = new java.util.HashMap(); - int i; - for(i = 0; i < 10; ++i) - { - B b = (B)bin.get(new Integer(i)); - D2 d2 = new D2(); - d2.sb = b.sb; - d2.pb = b.pb; - d2.sd2 = "D2"; - d2.pd2 = d2; - bout.put(new Integer(i * 10), d2); - } - java.util.Map r = new java.util.HashMap(); - for(i = 0; i < 10; ++i) - { - String s = "D1." + new Integer(i * 20).toString(); - D1 d1 = new D1(); - d1.sb = s; - d1.pb = (i == 0 ? (B)null : (B)r.get(new Integer((i - 1) * 20))); - d1.sd1 = s; - d1.pd1 = d1; - r.put(new Integer(i * 20), d1); - } - cb.ice_response(r, bout); + java.util.Map bout = new java.util.HashMap(); + int i; + for(i = 0; i < 10; ++i) + { + B b = (B)bin.get(new Integer(i)); + D2 d2 = new D2(); + d2.sb = b.sb; + d2.pb = b.pb; + d2.sd2 = "D2"; + d2.pd2 = d2; + bout.put(new Integer(i * 10), d2); + } + java.util.Map r = new java.util.HashMap(); + for(i = 0; i < 10; ++i) + { + String s = "D1." + new Integer(i * 20).toString(); + D1 d1 = new D1(); + d1.sb = s; + d1.pb = (i == 0 ? (B)null : (B)r.get(new Integer((i - 1) * 20))); + d1.sd1 = s; + d1.pd1 = d1; + r.put(new Integer(i * 20), d1); + } + cb.ice_response(r, bout); } public void throwBaseAsBase_async(AMD_TestIntf_throwBaseAsBase cb, Ice.Current current) throws BaseException { - BaseException be = new BaseException(); - be.sbe = "sbe"; - be.pb = new B(); - be.pb.sb = "sb"; - be.pb.pb = be.pb; - cb.ice_exception(be); + BaseException be = new BaseException(); + be.sbe = "sbe"; + be.pb = new B(); + be.pb.sb = "sb"; + be.pb.pb = be.pb; + cb.ice_exception(be); } public void throwDerivedAsBase_async(AMD_TestIntf_throwDerivedAsBase cb, Ice.Current current) throws BaseException { - DerivedException de = new DerivedException(); - de.sbe = "sbe"; - de.pb = new B(); - de.pb.sb = "sb1"; - de.pb.pb = de.pb; - de.sde = "sde1"; - de.pd1 = new D1(); - de.pd1.sb = "sb2"; - de.pd1.pb = de.pd1; - de.pd1.sd1 = "sd2"; - de.pd1.pd1 = de.pd1; - cb.ice_exception(de); + DerivedException de = new DerivedException(); + de.sbe = "sbe"; + de.pb = new B(); + de.pb.sb = "sb1"; + de.pb.pb = de.pb; + de.sde = "sde1"; + de.pd1 = new D1(); + de.pd1.sb = "sb2"; + de.pd1.pb = de.pd1; + de.pd1.sd1 = "sd2"; + de.pd1.pd1 = de.pd1; + cb.ice_exception(de); } public void throwDerivedAsDerived_async(AMD_TestIntf_throwDerivedAsDerived cb, Ice.Current current) throws DerivedException { - DerivedException de = new DerivedException(); - de.sbe = "sbe"; - de.pb = new B(); - de.pb.sb = "sb1"; - de.pb.pb = de.pb; - de.sde = "sde1"; - de.pd1 = new D1(); - de.pd1.sb = "sb2"; - de.pd1.pb = de.pd1; - de.pd1.sd1 = "sd2"; - de.pd1.pd1 = de.pd1; - cb.ice_exception(de); + DerivedException de = new DerivedException(); + de.sbe = "sbe"; + de.pb = new B(); + de.pb.sb = "sb1"; + de.pb.pb = de.pb; + de.sde = "sde1"; + de.pd1 = new D1(); + de.pd1.sb = "sb2"; + de.pd1.pb = de.pd1; + de.pd1.sd1 = "sd2"; + de.pd1.pd1 = de.pd1; + cb.ice_exception(de); } public void throwUnknownDerivedAsBase_async(AMD_TestIntf_throwUnknownDerivedAsBase cb, Ice.Current current) - throws BaseException + throws BaseException { - D2 d2 = new D2(); - d2.sb = "sb d2"; - d2.pb = d2; - d2.sd2 = "sd2 d2"; - d2.pd2 = d2; - - UnknownDerivedException ude = new UnknownDerivedException(); - ude.sbe = "sbe"; - ude.pb = d2; - ude.sude = "sude"; - ude.pd2 = d2; - cb.ice_exception(ude); + D2 d2 = new D2(); + d2.sb = "sb d2"; + d2.pb = d2; + d2.sd2 = "sd2 d2"; + d2.pd2 = d2; + + UnknownDerivedException ude = new UnknownDerivedException(); + ude.sbe = "sbe"; + ude.pb = d2; + ude.sude = "sude"; + ude.pd2 = d2; + cb.ice_exception(ude); } public void useForward_async(AMD_TestIntf_useForward cb, Ice.Current current) { - Forward f = new Forward(); - f = new Forward(); - f.h = new Hidden(); - f.h.f = f; - cb.ice_response(f); + Forward f = new Forward(); + f = new Forward(); + f.h = new Hidden(); + f.h.f = f; + cb.ice_response(f); } private Ice.ObjectAdapter _adapter; diff --git a/java/test/Ice/stream/Client.java b/java/test/Ice/stream/Client.java index 44d15aeab6a..560afec548e 100644 --- a/java/test/Ice/stream/Client.java +++ b/java/test/Ice/stream/Client.java @@ -78,36 +78,36 @@ public class Client private static class MyClassFactoryWrapper extends Ice.LocalObjectImpl implements Ice.ObjectFactory { - MyClassFactoryWrapper() - { - _factory = Test.MyClass.ice_factory(); - } - - public Ice.Object - create(String type) - { - return _factory.create(type); - } - - public void - destroy() - { - } - - void - setFactory(Ice.ObjectFactory factory) - { - _factory = factory; - } - - private Ice.ObjectFactory _factory; + MyClassFactoryWrapper() + { + _factory = Test.MyClass.ice_factory(); + } + + public Ice.Object + create(String type) + { + return _factory.create(type); + } + + public void + destroy() + { + } + + void + setFactory(Ice.ObjectFactory factory) + { + _factory = factory; + } + + private Ice.ObjectFactory _factory; } private static int run(String[] args, Ice.Communicator communicator) { - MyClassFactoryWrapper factoryWrapper = new MyClassFactoryWrapper(); - communicator.addObjectFactory(factoryWrapper, Test.MyClass.ice_staticId()); + MyClassFactoryWrapper factoryWrapper = new MyClassFactoryWrapper(); + communicator.addObjectFactory(factoryWrapper, Test.MyClass.ice_staticId()); Ice.InputStream in; Ice.OutputStream out; @@ -506,7 +506,7 @@ public class Client } } - System.gc(); + System.gc(); System.exit(status); } } diff --git a/java/test/Ice/timeout/AllTests.java b/java/test/Ice/timeout/AllTests.java index 8a2ff1d6350..6484d7aee2e 100644 --- a/java/test/Ice/timeout/AllTests.java +++ b/java/test/Ice/timeout/AllTests.java @@ -14,414 +14,414 @@ public class AllTests private static void test(boolean b) { - if(!b) - { - throw new RuntimeException(); - } + if(!b) + { + throw new RuntimeException(); + } } private static class Callback { - Callback() - { - _called = false; - } - - public synchronized boolean - check() - { - while(!_called) - { - try - { - wait(5000); - } - catch(InterruptedException ex) - { - continue; - } - - if(!_called) - { - return false; // Must be timeout. - } - } - - _called = false; - return true; - } - - public synchronized void - called() - { - assert(!_called); - _called = true; - notify(); - } - - private boolean _called; + Callback() + { + _called = false; + } + + public synchronized boolean + check() + { + while(!_called) + { + try + { + wait(5000); + } + catch(InterruptedException ex) + { + continue; + } + + if(!_called) + { + return false; // Must be timeout. + } + } + + _called = false; + return true; + } + + public synchronized void + called() + { + assert(!_called); + _called = true; + notify(); + } + + private boolean _called; } private static class AMISendData extends Test.AMI_Timeout_sendData { - public void - ice_response() - { - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMISendDataEx extends Test.AMI_Timeout_sendData { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(ex instanceof Ice.TimeoutException); - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(ex instanceof Ice.TimeoutException); + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMISleep extends Test.AMI_Timeout_sleep { - public void - ice_response() - { - callback.called(); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(false); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + callback.called(); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(false); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } private static class AMISleepEx extends Test.AMI_Timeout_sleep { - public void - ice_response() - { - test(false); - } - - public void - ice_exception(Ice.LocalException ex) - { - test(ex instanceof Ice.TimeoutException); - callback.called(); - } - - public boolean - check() - { - return callback.check(); - } - - private Callback callback = new Callback(); + public void + ice_response() + { + test(false); + } + + public void + ice_exception(Ice.LocalException ex) + { + test(ex instanceof Ice.TimeoutException); + callback.called(); + } + + public boolean + check() + { + return callback.check(); + } + + private Callback callback = new Callback(); } public static Test.TimeoutPrx allTests(Ice.Communicator communicator, java.io.PrintStream out) { - String sref = "timeout:default -p 12010 -t 10000"; - Ice.ObjectPrx obj = communicator.stringToProxy(sref); - test(obj != null); - - TimeoutPrx timeout = TimeoutPrxHelper.checkedCast(obj); - test(timeout != null); - - out.print("testing connect timeout... "); - out.flush(); - { - // - // Expect ConnectTimeoutException. - // - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); - to.holdAdapter(1000); - to.ice_getConnection().close(true); // Force a reconnect. - try - { - to.op(); - test(false); - } - catch(Ice.ConnectTimeoutException ex) - { - // Expected. - } - } - { - // - // Expect success. - // - timeout.op(); // Ensure adapter is active. - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000)); - to.holdAdapter(500); - to.ice_getConnection().close(true); // Force a reconnect. - try - { - to.op(); - } - catch(Ice.ConnectTimeoutException ex) - { - test(false); - } - } - out.println("ok"); - - out.print("testing read timeout... "); - out.flush(); - { - // - // Expect TimeoutException. - // - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); - try - { - to.sleep(750); - test(false); - } - catch(Ice.TimeoutException ex) - { - // Expected. - } - } - { - // - // Expect success. - // - timeout.op(); // Ensure adapter is active. - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000)); - try - { - to.sleep(500); - } - catch(Ice.TimeoutException ex) - { - test(false); - } - } - out.println("ok"); - - out.print("testing write timeout... "); - out.flush(); - { - // - // Expect TimeoutException. - // - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); - to.holdAdapter(750); - try - { - byte[] seq = new byte[100000]; - to.sendData(seq); - test(false); - } - catch(Ice.TimeoutException ex) - { - // Expected. - } - } - { - // - // Expect success. - // - timeout.op(); // Ensure adapter is active. - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000)); - to.holdAdapter(500); - try - { - byte[] seq = new byte[100000]; - to.sendData(seq); - } - catch(Ice.TimeoutException ex) - { - test(false); - } - } - out.println("ok"); - - out.print("testing AMI read timeout... "); - out.flush(); - { - // - // The resolution of AMI timeouts is limited by the connection monitor - // thread. We set Ice.MonitorConnections=1 (one second) in main(). - // - // Expect TimeoutException. - // - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); - AMISleepEx cb = new AMISleepEx(); - to.sleep_async(cb, 2000); - test(cb.check()); - } - { - // - // Expect success. - // - timeout.op(); // Ensure adapter is active. - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000)); - AMISleep cb = new AMISleep(); - to.sleep_async(cb, 500); - test(cb.check()); - } - out.println("ok"); - - out.print("testing AMI write timeout... "); - out.flush(); - { - // - // The resolution of AMI timeouts is limited by the connection monitor - // thread. We set Ice.MonitorConnections=1 (one second) in main(). - // - // Expect TimeoutException. - // - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); - to.holdAdapter(2000); - byte[] seq = new byte[100000]; - AMISendDataEx cb = new AMISendDataEx(); - to.sendData_async(cb, seq); - test(cb.check()); - } - { - // - // Expect success. - // - timeout.op(); // Ensure adapter is active. - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000)); - to.holdAdapter(500); - byte[] seq = new byte[100000]; - AMISendData cb = new AMISendData(); - to.sendData_async(cb, seq); - test(cb.check()); - } - out.println("ok"); - - out.print("testing timeout overrides... "); - out.flush(); - { - // - // Test Ice.Override.Timeout. This property overrides all - // endpoint timeouts. - // - 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); - TimeoutPrx to = TimeoutPrxHelper.checkedCast(comm.stringToProxy(sref)); - try - { - to.sleep(750); - test(false); - } - catch(Ice.TimeoutException ex) - { - // Expected. - } - // - // Calling ice_timeout() should have no effect. - // - timeout.op(); // Ensure adapter is active. - to = TimeoutPrxHelper.checkedCast(to.ice_timeout(1000)); - try - { - to.sleep(750); - test(false); - } - catch(Ice.TimeoutException ex) - { - // Expected. - } - comm.destroy(); - } - { - // - // Test Ice.Override.ConnectTimeout. - // - String[] args = new String[0]; - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = communicator.getProperties()._clone(); - initData.properties.setProperty("Ice.Override.ConnectTimeout", "750"); - Ice.Communicator comm = Ice.Util.initialize(args, initData); - timeout.holdAdapter(1250); - TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(comm.stringToProxy(sref)); - try - { - to.op(); - test(false); - } - catch(Ice.ConnectTimeoutException ex) - { - // Expected. - } - // - // Calling ice_timeout() should have no effect on the connect timeout. - // - timeout.op(); // Ensure adapter is active. - timeout.holdAdapter(1250); - to = TimeoutPrxHelper.uncheckedCast(to.ice_timeout(1500)); - try - { - to.op(); - test(false); - } - catch(Ice.ConnectTimeoutException ex) - { - // Expected. - } - // - // Verify that timeout set via ice_timeout() is still used for requests. - // - to.op(); // Force connection. - try - { - to.sleep(1750); - test(false); - } - catch(Ice.TimeoutException ex) - { - // Expected. - } - comm.destroy(); - } - out.println("ok"); - - return timeout; + String sref = "timeout:default -p 12010 -t 10000"; + Ice.ObjectPrx obj = communicator.stringToProxy(sref); + test(obj != null); + + TimeoutPrx timeout = TimeoutPrxHelper.checkedCast(obj); + test(timeout != null); + + out.print("testing connect timeout... "); + out.flush(); + { + // + // Expect ConnectTimeoutException. + // + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); + to.holdAdapter(1000); + to.ice_getConnection().close(true); // Force a reconnect. + try + { + to.op(); + test(false); + } + catch(Ice.ConnectTimeoutException ex) + { + // Expected. + } + } + { + // + // Expect success. + // + timeout.op(); // Ensure adapter is active. + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000)); + to.holdAdapter(500); + to.ice_getConnection().close(true); // Force a reconnect. + try + { + to.op(); + } + catch(Ice.ConnectTimeoutException ex) + { + test(false); + } + } + out.println("ok"); + + out.print("testing read timeout... "); + out.flush(); + { + // + // Expect TimeoutException. + // + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); + try + { + to.sleep(750); + test(false); + } + catch(Ice.TimeoutException ex) + { + // Expected. + } + } + { + // + // Expect success. + // + timeout.op(); // Ensure adapter is active. + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000)); + try + { + to.sleep(500); + } + catch(Ice.TimeoutException ex) + { + test(false); + } + } + out.println("ok"); + + out.print("testing write timeout... "); + out.flush(); + { + // + // Expect TimeoutException. + // + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); + to.holdAdapter(750); + try + { + byte[] seq = new byte[100000]; + to.sendData(seq); + test(false); + } + catch(Ice.TimeoutException ex) + { + // Expected. + } + } + { + // + // Expect success. + // + timeout.op(); // Ensure adapter is active. + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000)); + to.holdAdapter(500); + try + { + byte[] seq = new byte[100000]; + to.sendData(seq); + } + catch(Ice.TimeoutException ex) + { + test(false); + } + } + out.println("ok"); + + out.print("testing AMI read timeout... "); + out.flush(); + { + // + // The resolution of AMI timeouts is limited by the connection monitor + // thread. We set Ice.MonitorConnections=1 (one second) in main(). + // + // Expect TimeoutException. + // + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); + AMISleepEx cb = new AMISleepEx(); + to.sleep_async(cb, 2000); + test(cb.check()); + } + { + // + // Expect success. + // + timeout.op(); // Ensure adapter is active. + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000)); + AMISleep cb = new AMISleep(); + to.sleep_async(cb, 500); + test(cb.check()); + } + out.println("ok"); + + out.print("testing AMI write timeout... "); + out.flush(); + { + // + // The resolution of AMI timeouts is limited by the connection monitor + // thread. We set Ice.MonitorConnections=1 (one second) in main(). + // + // Expect TimeoutException. + // + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(500)); + to.holdAdapter(2000); + byte[] seq = new byte[100000]; + AMISendDataEx cb = new AMISendDataEx(); + to.sendData_async(cb, seq); + test(cb.check()); + } + { + // + // Expect success. + // + timeout.op(); // Ensure adapter is active. + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(obj.ice_timeout(1000)); + to.holdAdapter(500); + byte[] seq = new byte[100000]; + AMISendData cb = new AMISendData(); + to.sendData_async(cb, seq); + test(cb.check()); + } + out.println("ok"); + + out.print("testing timeout overrides... "); + out.flush(); + { + // + // Test Ice.Override.Timeout. This property overrides all + // endpoint timeouts. + // + 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); + TimeoutPrx to = TimeoutPrxHelper.checkedCast(comm.stringToProxy(sref)); + try + { + to.sleep(750); + test(false); + } + catch(Ice.TimeoutException ex) + { + // Expected. + } + // + // Calling ice_timeout() should have no effect. + // + timeout.op(); // Ensure adapter is active. + to = TimeoutPrxHelper.checkedCast(to.ice_timeout(1000)); + try + { + to.sleep(750); + test(false); + } + catch(Ice.TimeoutException ex) + { + // Expected. + } + comm.destroy(); + } + { + // + // Test Ice.Override.ConnectTimeout. + // + String[] args = new String[0]; + Ice.InitializationData initData = new Ice.InitializationData(); + initData.properties = communicator.getProperties()._clone(); + initData.properties.setProperty("Ice.Override.ConnectTimeout", "750"); + Ice.Communicator comm = Ice.Util.initialize(args, initData); + timeout.holdAdapter(1250); + TimeoutPrx to = TimeoutPrxHelper.uncheckedCast(comm.stringToProxy(sref)); + try + { + to.op(); + test(false); + } + catch(Ice.ConnectTimeoutException ex) + { + // Expected. + } + // + // Calling ice_timeout() should have no effect on the connect timeout. + // + timeout.op(); // Ensure adapter is active. + timeout.holdAdapter(1250); + to = TimeoutPrxHelper.uncheckedCast(to.ice_timeout(1500)); + try + { + to.op(); + test(false); + } + catch(Ice.ConnectTimeoutException ex) + { + // Expected. + } + // + // Verify that timeout set via ice_timeout() is still used for requests. + // + to.op(); // Force connection. + try + { + to.sleep(1750); + test(false); + } + catch(Ice.TimeoutException ex) + { + // Expected. + } + comm.destroy(); + } + out.println("ok"); + + return timeout; } } diff --git a/java/test/Ice/timeout/Client.java b/java/test/Ice/timeout/Client.java index 18077666e71..3fcec904a74 100644 --- a/java/test/Ice/timeout/Client.java +++ b/java/test/Ice/timeout/Client.java @@ -12,61 +12,61 @@ public class Client public static int run(String[] args, Ice.Communicator communicator, java.io.PrintStream out) { - Test.TimeoutPrx timeout = AllTests.allTests(communicator, out); - timeout.shutdown(); - return 0; + Test.TimeoutPrx timeout = AllTests.allTests(communicator, out); + timeout.shutdown(); + return 0; } public static void main(String[] args) { - int status = 0; - Ice.Communicator communicator = null; + 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); + 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"); + // + // 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"); - // - // Check for AMI timeouts every second. - // - initData.properties.setProperty("Ice.MonitorConnections", "1"); + // + // Check for AMI timeouts every second. + // + initData.properties.setProperty("Ice.MonitorConnections", "1"); - communicator = Ice.Util.initialize(argsH, initData); - status = run(argsH.value, communicator, System.out); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } + communicator = Ice.Util.initialize(argsH, initData); + status = run(argsH.value, communicator, System.out); + } + catch(Ice.LocalException ex) + { + ex.printStackTrace(); + status = 1; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - 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); + System.gc(); + System.exit(status); } } diff --git a/java/test/Ice/timeout/Server.java b/java/test/Ice/timeout/Server.java index 5a52f526046..50f87044eb3 100644 --- a/java/test/Ice/timeout/Server.java +++ b/java/test/Ice/timeout/Server.java @@ -12,64 +12,64 @@ public class Server public static int run(String[] args, Ice.Communicator communicator, java.io.PrintStream out) { - // - // 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("Ice.OA.TestAdapter.Endpoints").length() == 0) - { - communicator.getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000"); - } + // + // 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("Ice.OA.TestAdapter.Endpoints").length() == 0) + { + communicator.getProperties().setProperty("Ice.OA.TestAdapter.Endpoints", "default -p 12010 -t 10000"); + } - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - adapter.add(new TimeoutI(), communicator.stringToIdentity("timeout")); - adapter.activate(); + Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); + adapter.add(new TimeoutI(), communicator.stringToIdentity("timeout")); + adapter.activate(); - communicator.waitForShutdown(); - return 0; + communicator.waitForShutdown(); + return 0; } public static void main(String[] args) { - int status = 0; - Ice.Communicator communicator = null; + 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"); + 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"); - communicator = Ice.Util.initialize(argsH, initData); - status = run(argsH.value, communicator, System.out); - } - catch(Ice.LocalException ex) - { - ex.printStackTrace(); - status = 1; - } + communicator = Ice.Util.initialize(argsH, initData); + status = run(argsH.value, communicator, System.out); + } + catch(Ice.LocalException ex) + { + ex.printStackTrace(); + status = 1; + } - if(communicator != null) - { - try - { - communicator.destroy(); - } - 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); + System.gc(); + System.exit(status); } } diff --git a/java/test/Ice/timeout/TimeoutI.java b/java/test/Ice/timeout/TimeoutI.java index 73d26461fde..0221ce830b1 100644 --- a/java/test/Ice/timeout/TimeoutI.java +++ b/java/test/Ice/timeout/TimeoutI.java @@ -13,28 +13,28 @@ class TimeoutI extends _TimeoutDisp { static class ActivateAdapterThread extends Thread { - ActivateAdapterThread(Ice.ObjectAdapter adapter, int timeout) - { - _adapter = adapter; - _timeout = timeout; - } + ActivateAdapterThread(Ice.ObjectAdapter adapter, int timeout) + { + _adapter = adapter; + _timeout = timeout; + } - public void - run() - { - _adapter.waitForHold(); - try - { - sleep(_timeout); - } - catch(InterruptedException ex) - { - } - _adapter.activate(); - } + public void + run() + { + _adapter.waitForHold(); + try + { + sleep(_timeout); + } + catch(InterruptedException ex) + { + } + _adapter.activate(); + } - Ice.ObjectAdapter _adapter; - int _timeout; + Ice.ObjectAdapter _adapter; + int _timeout; } public void @@ -50,26 +50,26 @@ class TimeoutI extends _TimeoutDisp public void sleep(int to, Ice.Current current) { - try - { - Thread.currentThread().sleep(to); - } - catch(InterruptedException ex) - { - } + try + { + Thread.currentThread().sleep(to); + } + catch(InterruptedException ex) + { + } } public void holdAdapter(int to, Ice.Current current) { - current.adapter.hold(); - Thread thread = new ActivateAdapterThread(current.adapter, to); - thread.start(); + current.adapter.hold(); + Thread thread = new ActivateAdapterThread(current.adapter, to); + thread.start(); } public void shutdown(Ice.Current current) { - current.adapter.getCommunicator().shutdown(); + current.adapter.getCommunicator().shutdown(); } } diff --git a/java/test/Ice/translator/Metadata.ice b/java/test/Ice/translator/Metadata.ice index 5dfaaba4ea1..ff74074ad8e 100644 --- a/java/test/Ice/translator/Metadata.ice +++ b/java/test/Ice/translator/Metadata.ice @@ -26,15 +26,15 @@ module MetadataTest ["java:type:java.util.ArrayList"] ObjectSeq modifiedObjectSeqMember; ["java:type:Test.CustomList"] ObjectList modifiedObjectListMember; - StringDict stringDictMember; - StringMap stringMapMember; - ["java:type:java.util.TreeMap"] StringDict modifiedStringDictMember; - ["java:type:java.util.IdentityHashMap"] StringMap modifiedStringMapMember; + StringDict stringDictMember; + StringMap stringMapMember; + ["java:type:java.util.TreeMap"] StringDict modifiedStringDictMember; + ["java:type:java.util.IdentityHashMap"] StringMap modifiedStringMapMember; - ObjectDict objectDictMember; - ObjectMap objectMapMember; - ["java:type:java.util.TreeMap"] ObjectDict modifiedObjectDictMember; - ["java:type:java.util.IdentityHashMap"] ObjectMap modifiedObjectMapMember; + ObjectDict objectDictMember; + ObjectMap objectMapMember; + ["java:type:java.util.TreeMap"] ObjectDict modifiedObjectDictMember; + ["java:type:java.util.IdentityHashMap"] ObjectMap modifiedObjectMapMember; IntSeq opIntSeq(IntSeq inArg, out IntSeq outArg); IntList opIntList(IntList inArg, out IntList outArg); @@ -79,9 +79,9 @@ module MetadataTest opObjectList2(["java:type:java.util.ArrayList"] ObjectList inArg, out ["java:type:Test.CustomList"] ObjectList outArg); - ["java:type:java.util.IdentityHashMap"] StringMap - opStringMap2(["java:type:java.util.IdentityHashMap"] StringMap inArg, - out ["java:type:java.util.IdentityHashMap"] StringMap outArg); + ["java:type:java.util.IdentityHashMap"] StringMap + opStringMap2(["java:type:java.util.IdentityHashMap"] StringMap inArg, + out ["java:type:java.util.IdentityHashMap"] StringMap outArg); ["ami", "java:type:java.util.LinkedList"] IntSeq opIntSeq2AMI(["java:type:java.util.ArrayList"] IntSeq inArg, diff --git a/java/test/Ice/translator/Metadata2.ice b/java/test/Ice/translator/Metadata2.ice index 5dfaaba4ea1..ff74074ad8e 100644 --- a/java/test/Ice/translator/Metadata2.ice +++ b/java/test/Ice/translator/Metadata2.ice @@ -26,15 +26,15 @@ module MetadataTest ["java:type:java.util.ArrayList"] ObjectSeq modifiedObjectSeqMember; ["java:type:Test.CustomList"] ObjectList modifiedObjectListMember; - StringDict stringDictMember; - StringMap stringMapMember; - ["java:type:java.util.TreeMap"] StringDict modifiedStringDictMember; - ["java:type:java.util.IdentityHashMap"] StringMap modifiedStringMapMember; + StringDict stringDictMember; + StringMap stringMapMember; + ["java:type:java.util.TreeMap"] StringDict modifiedStringDictMember; + ["java:type:java.util.IdentityHashMap"] StringMap modifiedStringMapMember; - ObjectDict objectDictMember; - ObjectMap objectMapMember; - ["java:type:java.util.TreeMap"] ObjectDict modifiedObjectDictMember; - ["java:type:java.util.IdentityHashMap"] ObjectMap modifiedObjectMapMember; + ObjectDict objectDictMember; + ObjectMap objectMapMember; + ["java:type:java.util.TreeMap"] ObjectDict modifiedObjectDictMember; + ["java:type:java.util.IdentityHashMap"] ObjectMap modifiedObjectMapMember; IntSeq opIntSeq(IntSeq inArg, out IntSeq outArg); IntList opIntList(IntList inArg, out IntList outArg); @@ -79,9 +79,9 @@ module MetadataTest opObjectList2(["java:type:java.util.ArrayList"] ObjectList inArg, out ["java:type:Test.CustomList"] ObjectList outArg); - ["java:type:java.util.IdentityHashMap"] StringMap - opStringMap2(["java:type:java.util.IdentityHashMap"] StringMap inArg, - out ["java:type:java.util.IdentityHashMap"] StringMap outArg); + ["java:type:java.util.IdentityHashMap"] StringMap + opStringMap2(["java:type:java.util.IdentityHashMap"] StringMap inArg, + out ["java:type:java.util.IdentityHashMap"] StringMap outArg); ["ami", "java:type:java.util.LinkedList"] IntSeq opIntSeq2AMI(["java:type:java.util.ArrayList"] IntSeq inArg, |