diff options
author | Matthew Newhook <matthew@zeroc.com> | 2014-10-23 16:28:09 -0230 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2014-10-23 16:28:09 -0230 |
commit | f6bb0396e7d8fd12ed50f72ab9fc99436d418576 (patch) | |
tree | ee6ef1cb32f2523839f210eb9ec3b924b97d5998 /java/test/Ice/exceptions | |
parent | Add Object.equals, and minor fix to HashMap.equals (diff) | |
download | ice-f6bb0396e7d8fd12ed50f72ab9fc99436d418576.tar.bz2 ice-f6bb0396e7d8fd12ed50f72ab9fc99436d418576.tar.xz ice-f6bb0396e7d8fd12ed50f72ab9fc99436d418576.zip |
More gradle changes.
Moved android stuff to its own package.
Moved java tests to src/main/java/test subdirectory.
Diffstat (limited to 'java/test/Ice/exceptions')
-rw-r--r-- | java/test/Ice/exceptions/AMDServer.java | 51 | ||||
-rw-r--r-- | java/test/Ice/exceptions/AMDThrowerI.java | 240 | ||||
-rw-r--r-- | java/test/Ice/exceptions/AllTests.java | 1491 | ||||
-rw-r--r-- | java/test/Ice/exceptions/Client.java | 43 | ||||
-rw-r--r-- | java/test/Ice/exceptions/Collocated.java | 55 | ||||
-rw-r--r-- | java/test/Ice/exceptions/DummyLogger.java | 66 | ||||
-rw-r--r-- | java/test/Ice/exceptions/EmptyI.java | 17 | ||||
-rw-r--r-- | java/test/Ice/exceptions/ObjectFactoryI.java | 25 | ||||
-rw-r--r-- | java/test/Ice/exceptions/ServantLocatorI.java | 30 | ||||
-rw-r--r-- | java/test/Ice/exceptions/Server.java | 51 | ||||
-rw-r--r-- | java/test/Ice/exceptions/Test.ice | 77 | ||||
-rw-r--r-- | java/test/Ice/exceptions/TestAMD.ice | 72 | ||||
-rw-r--r-- | java/test/Ice/exceptions/ThrowerI.java | 201 | ||||
-rwxr-xr-x | java/test/Ice/exceptions/run.py | 48 |
14 files changed, 0 insertions, 2467 deletions
diff --git a/java/test/Ice/exceptions/AMDServer.java b/java/test/Ice/exceptions/AMDServer.java deleted file mode 100644 index afd5450bffc..00000000000 --- a/java/test/Ice/exceptions/AMDServer.java +++ /dev/null @@ -1,51 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package test.Ice.exceptions; - -public class AMDServer extends test.Util.Application -{ - @Override - public int run(String[] args) - { - Ice.Communicator communicator = communicator(); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.Object object = new AMDThrowerI(); - adapter.add(object, communicator.stringToIdentity("thrower")); - adapter.activate(); - return WAIT; - } - - @Override - protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) - { - Ice.InitializationData initData = new Ice.InitializationData(); - // - // For this test, we need a dummy logger, otherwise the - // assertion test will print an error message. - // - initData.logger = new DummyLogger(); - - initData.properties = Ice.Util.createProperties(argsH); - initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions.AMD"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); - initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max - - return initData; - } - - public static void main(String[] args) - { - AMDServer app = new AMDServer(); - int result = app.main("AMDServer", args); - System.gc(); - System.exit(result); - } -} diff --git a/java/test/Ice/exceptions/AMDThrowerI.java b/java/test/Ice/exceptions/AMDThrowerI.java deleted file mode 100644 index bd1013bd589..00000000000 --- a/java/test/Ice/exceptions/AMDThrowerI.java +++ /dev/null @@ -1,240 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package test.Ice.exceptions; - -import test.Ice.exceptions.AMD.Test.A; -import test.Ice.exceptions.AMD.Test.AMD_Thrower_shutdown; -import test.Ice.exceptions.AMD.Test.AMD_Thrower_supportsAssertException; -import test.Ice.exceptions.AMD.Test.AMD_Thrower_supportsUndeclaredExceptions; -import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwAasA; -import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwAorDasAorD; -import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwAssertException; -import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwMemoryLimitException; -import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwBasA; -import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwBasB; -import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwCasA; -import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwCasB; -import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwCasC; -import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwLocalException; -import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwLocalExceptionIdempotent; -import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwNonIceException; -import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwUndeclaredA; -import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwUndeclaredB; -import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwUndeclaredC; -import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwAfterResponse; -import test.Ice.exceptions.AMD.Test.AMD_Thrower_throwAfterException; -import test.Ice.exceptions.AMD.Test.B; -import test.Ice.exceptions.AMD.Test.C; -import test.Ice.exceptions.AMD.Test.D; -import test.Ice.exceptions.AMD.Test._ThrowerDisp; - -public final class AMDThrowerI extends _ThrowerDisp -{ - public - AMDThrowerI() - { - } - - @Override - public void - shutdown_async(AMD_Thrower_shutdown cb, Ice.Current current) - { - current.adapter.getCommunicator().shutdown(); - cb.ice_response(); - } - - @Override - public void - supportsUndeclaredExceptions_async(AMD_Thrower_supportsUndeclaredExceptions cb, Ice.Current current) - { - cb.ice_response(true); - } - - @Override - public void - supportsAssertException_async(AMD_Thrower_supportsAssertException cb, Ice.Current current) - { - cb.ice_response(true); - } - - @Override - public void - throwAasA_async(AMD_Thrower_throwAasA cb, int a, Ice.Current current) - throws A - { - A ex = new A(); - ex.aMem = a; - cb.ice_exception(ex); - } - - @Override - public void - throwAorDasAorD_async(AMD_Thrower_throwAorDasAorD cb, int a, Ice.Current current) - throws A, - D - { - if(a > 0) - { - A ex = new A(); - ex.aMem = a; - cb.ice_exception(ex); - } - else - { - D ex = new D(); - ex.dMem = a; - cb.ice_exception(ex); - } - } - - @Override - public void - 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); - } - - @Override - public void - throwBasB_async(AMD_Thrower_throwBasB cb, int a, int b, Ice.Current current) - throws B - { - B ex = new B(); - ex.aMem = a; - ex.bMem = b; - throw ex; - //cb.ice_exception(ex); - } - - @Override - 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); - } - - @Override - 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); - } - - @Override - public void - throwCasC_async(AMD_Thrower_throwCasC cb, int a, int b, int c, Ice.Current current) - throws C - { - C ex = new C(); - ex.aMem = a; - ex.bMem = b; - ex.cMem = c; - cb.ice_exception(ex); - } - - @Override - public void - throwUndeclaredA_async(AMD_Thrower_throwUndeclaredA cb, int a, Ice.Current current) - { - A ex = new A(); - ex.aMem = a; - cb.ice_exception(ex); - } - - @Override - 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); - } - - @Override - public void - throwUndeclaredC_async(AMD_Thrower_throwUndeclaredC cb, int a, int b, int c, Ice.Current current) - { - C ex = new C(); - ex.aMem = a; - ex.bMem = b; - ex.cMem = c; - cb.ice_exception(ex); - } - - @Override - public void - throwLocalException_async(AMD_Thrower_throwLocalException cb, Ice.Current current) - { - cb.ice_exception(new Ice.TimeoutException()); - } - - @Override - public void - throwNonIceException_async(AMD_Thrower_throwNonIceException cb, Ice.Current current) - { - throw new RuntimeException(); - } - - @Override - public void - throwAssertException_async(AMD_Thrower_throwAssertException cb, Ice.Current current) - { - throw new java.lang.AssertionError(); - } - - @Override - public void - throwMemoryLimitException_async(AMD_Thrower_throwMemoryLimitException cb, byte[] seq, Ice.Current current) - { - cb.ice_response(new byte[1024 * 20]); // 20KB is over the configured 10KB message size max. - } - - @Override - public void - throwLocalExceptionIdempotent_async(AMD_Thrower_throwLocalExceptionIdempotent cb, Ice.Current current) - { - cb.ice_exception(new Ice.TimeoutException()); - } - - @Override - public void - throwAfterResponse_async(AMD_Thrower_throwAfterResponse cb, Ice.Current current) - { - cb.ice_response(); - - throw new RuntimeException(); - } - - @Override - public void - throwAfterException_async(AMD_Thrower_throwAfterException cb, Ice.Current current) - throws A - { - cb.ice_exception(new A()); - - throw new RuntimeException(); - } -} diff --git a/java/test/Ice/exceptions/AllTests.java b/java/test/Ice/exceptions/AllTests.java deleted file mode 100644 index 7d68606047e..00000000000 --- a/java/test/Ice/exceptions/AllTests.java +++ /dev/null @@ -1,1491 +0,0 @@ -// ********************************************************************** -// -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package test.Ice.exceptions; - -import java.io.PrintWriter; - -import test.Ice.exceptions.Test.A; -import test.Ice.exceptions.Test.B; -import test.Ice.exceptions.Test.C; -import test.Ice.exceptions.Test.D; -import test.Ice.exceptions.Test.ThrowerPrx; -import test.Ice.exceptions.Test.ThrowerPrxHelper; -import test.Ice.exceptions.Test.WrongOperationPrx; -import test.Ice.exceptions.Test.WrongOperationPrxHelper; -import test.Ice.exceptions.Test.Callback_Thrower_throwAasA; -import test.Ice.exceptions.Test.Callback_Thrower_throwAorDasAorD; -import test.Ice.exceptions.Test.Callback_Thrower_throwAssertException; -import test.Ice.exceptions.Test.Callback_Thrower_throwBasA; -import test.Ice.exceptions.Test.Callback_Thrower_throwBasB; -import test.Ice.exceptions.Test.Callback_Thrower_throwCasA; -import test.Ice.exceptions.Test.Callback_Thrower_throwCasB; -import test.Ice.exceptions.Test.Callback_Thrower_throwCasC; -import test.Ice.exceptions.Test.Callback_Thrower_throwLocalException; -import test.Ice.exceptions.Test.Callback_Thrower_throwLocalExceptionIdempotent; -import test.Ice.exceptions.Test.Callback_Thrower_throwNonIceException; -import test.Ice.exceptions.Test.Callback_Thrower_throwUndeclaredA; -import test.Ice.exceptions.Test.Callback_Thrower_throwUndeclaredB; -import test.Ice.exceptions.Test.Callback_Thrower_throwUndeclaredC; -import test.Ice.exceptions.Test.Callback_WrongOperation_noSuchOperation; - -public class AllTests -{ - private static void - test(boolean b) - { - if(!b) - { - throw new RuntimeException(); - } - } - - private static class Callback - { - Callback() - { - _called = false; - } - - public synchronized void check() - { - while(!_called) - { - try - { - wait(); - } - catch(InterruptedException ex) - { - } - } - - _called = false; - } - - public synchronized void called() - { - assert(!_called); - _called = true; - notify(); - } - - private boolean _called; - } - - private static class Callback_Thrower_throwAasAI extends Callback_Thrower_throwAasA - { - @Override - public void response() - { - test(false); - } - - @Override - public void exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - @Override - public void exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(A ex) - { - test(ex.aMem == 1); - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class Callback_Thrower_throwAasAObjectNotExistI extends Callback_Thrower_throwAasA - { - Callback_Thrower_throwAasAObjectNotExistI(Ice.Communicator communicator) - { - _communicator = communicator; - } - - @Override - public void response() - { - test(false); - } - - @Override - public void 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(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - @Override - public void exception(Ice.UserException exc) - { - exc.printStackTrace(); - test(false); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - private Ice.Communicator _communicator; - } - - private static class Callback_Thrower_throwAasAFacetNotExistI extends Callback_Thrower_throwAasA - { - @Override - public void response() - { - test(false); - } - - @Override - public void exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.FacetNotExistException ex) - { - test(ex.facet.equals("no such facet")); - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - @Override - public void exception(Ice.UserException exc) - { - exc.printStackTrace(); - test(false); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class Callback_Thrower_throwAorDasAorDI extends Callback_Thrower_throwAorDasAorD - { - @Override - public void response() - { - test(false); - } - - @Override - public void exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - @Override - public void exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(A ex) - { - test(ex.aMem == 1); - } - catch(D ex) - { - test(ex.dMem == -1); - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class Callback_Thrower_throwBasAI extends Callback_Thrower_throwBasA - { - @Override - public void response() - { - test(false); - } - - @Override - public void exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - @Override - public void exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(B ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class Callback_Thrower_throwCasAI extends Callback_Thrower_throwCasA - { - @Override - public void response() - { - test(false); - } - - @Override - public void exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - @Override - public void exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(C ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - test(ex.cMem == 3); - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class Callback_Thrower_throwBasBI extends Callback_Thrower_throwBasB - { - @Override - public void response() - { - test(false); - } - - @Override - public void exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - @Override - public void exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(B ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class Callback_Thrower_throwCasBI extends Callback_Thrower_throwCasB - { - @Override - public void response() - { - test(false); - } - - @Override - public void exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - @Override - public void exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(C ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - test(ex.cMem == 3); - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class Callback_Thrower_throwCasCI extends Callback_Thrower_throwCasC - { - @Override - public void response() - { - test(false); - } - - @Override - public void exception(Ice.LocalException exc) - { - exc.printStackTrace(); - test(false); - } - - @Override - public void exception(Ice.UserException exc) - { - try - { - throw exc; - } - catch(C ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - test(ex.cMem == 3); - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class Callback_Thrower_throwUndeclaredAI extends Callback_Thrower_throwUndeclaredA - { - @Override - public void response() - { - test(false); - } - - @Override - public void exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.UnknownUserException ex) - { - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class Callback_Thrower_throwUndeclaredBI extends Callback_Thrower_throwUndeclaredB - { - @Override - public void response() - { - test(false); - } - - @Override - public void exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.UnknownUserException ex) - { - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class Callback_Thrower_throwUndeclaredCI extends Callback_Thrower_throwUndeclaredC - { - @Override - public void response() - { - test(false); - } - - @Override - public void exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.UnknownUserException ex) - { - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class Callback_Thrower_throwLocalExceptionI extends Callback_Thrower_throwLocalException - { - @Override - public void response() - { - test(false); - } - - @Override - public void exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.UnknownLocalException ex) - { - } - catch(Ice.OperationNotExistException ex) - { - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class Callback_Thrower_throwNonIceExceptionI extends Callback_Thrower_throwNonIceException - { - @Override - public void response() - { - test(false); - } - - @Override - public void exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.UnknownException ex) - { - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class Callback_Thrower_throwAssertExceptionI extends Callback_Thrower_throwAssertException - { - @Override - public void response() - { - test(false); - } - - @Override - public void exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.ConnectionLostException ex) - { - } - catch(Ice.UnknownException ex) - { - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - } - - private static class Callback_WrongOperation_noSuchOperationI extends Callback_WrongOperation_noSuchOperation - { - @Override - public void response() - { - test(false); - } - - @Override - public void exception(Ice.LocalException exc) - { - try - { - throw exc; - } - catch(Ice.OperationNotExistException ex) - { - test(ex.operation.equals("noSuchOperation")); - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - callback.called(); - } - - public void check() - { - callback.check(); - } - - private Callback callback = new Callback(); - } - - public static ThrowerPrx - allTests(Ice.Communicator communicator, PrintWriter out) - { - { - out.print("testing object adapter registration exceptions... "); - Ice.ObjectAdapter first; - try - { - first = communicator.createObjectAdapter("TestAdapter0"); - } - catch(Ice.InitializationException ex) - { - // Expected - } - - communicator.getProperties().setProperty("TestAdapter0.Endpoints", "default"); - first = communicator.createObjectAdapter("TestAdapter0"); - try - { - communicator.createObjectAdapter("TestAdapter0"); - test(false); - } - catch(Ice.AlreadyRegisteredException ex) - { - // Expected - } - - try - { - communicator.createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12011"); - test(false); - } - catch(Ice.AlreadyRegisteredException ex) - { - // Expected - } - first.deactivate(); - out.println("ok"); - } - - { - out.print("testing servant registration exceptions... "); - communicator.getProperties().setProperty("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) - { - } - - try - { - adapter.add(obj, communicator.stringToIdentity("")); - test(false); - } - catch(Ice.IllegalIdentityException ex) - { - test(ex.id.name.equals("")); - } - try - { - adapter.add(null, communicator.stringToIdentity("x")); - test(false); - } - catch(Ice.IllegalServantException ex) - { - } - - adapter.remove(communicator.stringToIdentity("x")); - try - { - adapter.remove(communicator.stringToIdentity("x")); - test(false); - } - catch(Ice.NotRegisteredException ex) - { - } - adapter.deactivate(); - out.println("ok"); - } - - { - out.print("testing servant locator registration exceptions... "); - communicator.getProperties().setProperty("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(); - out.println("ok"); - } - - { - 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) - { - } - out.println("ok"); - } - - out.print("testing stringToProxy... "); - out.flush(); - String ref = "thrower:default -p 12010"; - Ice.ObjectPrx base = communicator.stringToProxy(ref); - test(base != null); - out.println("ok"); - - out.print("testing checked cast... "); - out.flush(); - ThrowerPrx thrower = ThrowerPrxHelper.checkedCast(base); - test(thrower != null); - test(thrower.equals(base)); - out.println("ok"); - - out.print("catching exact types... "); - out.flush(); - - try - { - thrower.throwAasA(1); - test(false); - } - catch(A ex) - { - test(ex.aMem == 1); - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - - try - { - thrower.throwAorDasAorD(1); - test(false); - } - catch(A ex) - { - test(ex.aMem == 1); - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - - try - { - thrower.throwAorDasAorD(-1); - test(false); - } - catch(D ex) - { - test(ex.dMem == -1); - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - - try - { - thrower.throwBasB(1, 2); - test(false); - } - catch(B ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - - try - { - thrower.throwCasC(1, 2, 3); - test(false); - } - catch(C ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - test(ex.cMem == 3); - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - - out.println("ok"); - - out.print("catching base types... "); - out.flush(); - - try - { - thrower.throwBasB(1, 2); - test(false); - } - catch(A ex) - { - test(ex.aMem == 1); - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - - try - { - thrower.throwCasC(1, 2, 3); - test(false); - } - catch(B ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - - out.println("ok"); - - out.print("catching derived types... "); - out.flush(); - - try - { - thrower.throwBasA(1, 2); - test(false); - } - catch(B ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - - try - { - thrower.throwCasA(1, 2, 3); - test(false); - } - catch(C ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - test(ex.cMem == 3); - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - - try - { - thrower.throwCasB(1, 2, 3); - test(false); - } - catch(C ex) - { - test(ex.aMem == 1); - test(ex.bMem == 2); - test(ex.cMem == 3); - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - - out.println("ok"); - - if(thrower.supportsUndeclaredExceptions()) - { - out.print("catching unknown user exception... "); - out.flush(); - - try - { - thrower.throwUndeclaredA(1); - test(false); - } - catch(Ice.UnknownUserException ex) - { - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - - try - { - thrower.throwUndeclaredB(1, 2); - test(false); - } - catch(Ice.UnknownUserException ex) - { - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - - try - { - thrower.throwUndeclaredC(1, 2, 3); - test(false); - } - catch(Ice.UnknownUserException ex) - { - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - - out.println("ok"); - } - - if(thrower.supportsAssertException()) - { - out.print("testing assert in the server... "); - out.flush(); - - try - { - thrower.throwAssertException(); - test(false); - } - catch(Ice.ConnectionLostException ex) - { - } - catch(Ice.UnknownException ex) - { - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - - out.println("ok"); - } - - out.print("testing memory limit marshal exception..."); - out.flush(); - { - try - { - thrower.throwMemoryLimitException(null); - test(false); - } - catch(Ice.UnknownLocalException ex) - { - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - - try - { - thrower.throwMemoryLimitException(new byte[20 * 1024]); // 20KB - test(false); - } - catch(Ice.MemoryLimitException ex) - { - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - - try - { - thrower.end_throwMemoryLimitException( - thrower.begin_throwMemoryLimitException(new byte[20 * 1024])); // 20KB - test(false); - } - catch(Ice.MemoryLimitException ex) - { - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - } - out.println("ok"); - - out.print("catching object not exist exception... "); - 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(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - } - - out.println("ok"); - - out.print("catching facet not exist exception... "); - 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")); - } - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - - out.println("ok"); - - out.print("catching operation not exist exception... "); - out.flush(); - - try - { - WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower); - thrower2.noSuchOperation(); - test(false); - } - catch(Ice.OperationNotExistException ex) - { - test(ex.operation.equals("noSuchOperation")); - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - - out.println("ok"); - - out.print("catching unknown local exception... "); - out.flush(); - - try - { - thrower.throwLocalException(); - test(false); - } - catch(Ice.UnknownLocalException ex) - { - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - - try - { - thrower.throwLocalExceptionIdempotent(); - test(false); - } - catch(Ice.UnknownLocalException ex) - { - } - catch(Ice.OperationNotExistException ex) - { - } - catch(Throwable ex) - { - ex.printStackTrace(); - test(false); - } - - out.println("ok"); - - out.print("catching unknown non-Ice exception... "); - out.flush(); - - try - { - thrower.throwNonIceException(); - test(false); - } - catch(Ice.UnknownException ex) - { - } - catch(Throwable ex) - { - out.println(ex); - test(false); - } - - out.println("ok"); - - out.print("testing asynchronous exceptions... "); - out.flush(); - - try - { - thrower.throwAfterResponse(); - } - catch(Ice.LocalException ex) - { - test(false); - } - catch(Throwable ex) - { - out.println(ex); - test(false); - } - - try - { - thrower.throwAfterException(); - test(false); - } - catch(A ex) - { - } - catch(Ice.LocalException ex) - { - test(false); - } - catch(Throwable ex) - { - out.println(ex); - test(false); - } - - out.println("ok"); - - out.print("catching exact types with AMI mapping... "); - out.flush(); - - { - Callback_Thrower_throwAasAI cb = new Callback_Thrower_throwAasAI(); - thrower.begin_throwAasA(1, cb); - cb.check(); - } - - { - Callback_Thrower_throwAorDasAorDI cb = new Callback_Thrower_throwAorDasAorDI(); - thrower.begin_throwAorDasAorD(1, cb); - cb.check(); - } - - { - Callback_Thrower_throwAorDasAorDI cb = new Callback_Thrower_throwAorDasAorDI(); - thrower.begin_throwAorDasAorD(-1, cb); - cb.check(); - } - - { - Callback_Thrower_throwBasBI cb = new Callback_Thrower_throwBasBI(); - thrower.begin_throwBasB(1, 2, cb); - cb.check(); - } - - { - Callback_Thrower_throwCasCI cb = new Callback_Thrower_throwCasCI(); - thrower.begin_throwCasC(1, 2, 3, cb); - cb.check(); - } - - out.println("ok"); - - out.print("catching derived types with mapping... "); - out.flush(); - - { - Callback_Thrower_throwBasAI cb = new Callback_Thrower_throwBasAI(); - thrower.begin_throwBasA(1, 2, cb); - cb.check(); - } - - { - Callback_Thrower_throwCasAI cb = new Callback_Thrower_throwCasAI(); - thrower.begin_throwCasA(1, 2, 3, cb); - cb.check(); - } - - { - Callback_Thrower_throwCasBI cb = new Callback_Thrower_throwCasBI(); - thrower.begin_throwCasB(1, 2, 3, cb); - cb.check(); - } - - out.println("ok"); - - if(thrower.supportsUndeclaredExceptions()) - { - out.print("catching unknown user exception with mapping... "); - out.flush(); - - { - Callback_Thrower_throwUndeclaredAI cb = new Callback_Thrower_throwUndeclaredAI(); - thrower.begin_throwUndeclaredA(1, cb); - cb.check(); - } - - { - Callback_Thrower_throwUndeclaredBI cb = new Callback_Thrower_throwUndeclaredBI(); - thrower.begin_throwUndeclaredB(1, 2, cb); - cb.check(); - } - - { - Callback_Thrower_throwUndeclaredCI cb = new Callback_Thrower_throwUndeclaredCI(); - thrower.begin_throwUndeclaredC(1, 2, 3, cb); - cb.check(); - } - - out.println("ok"); - } - - if(thrower.supportsAssertException()) - { - out.print("catching assert in the server with mapping... "); - out.flush(); - - Callback_Thrower_throwAssertExceptionI cb = new Callback_Thrower_throwAssertExceptionI(); - thrower.begin_throwAssertException(cb); - cb.check(); - - out.println("ok"); - } - - out.print("catching object not exist exception with mapping... "); - out.flush(); - - { - Ice.Identity id = communicator.stringToIdentity("does not exist"); - ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id)); - Callback_Thrower_throwAasAObjectNotExistI cb = new Callback_Thrower_throwAasAObjectNotExistI(communicator); - thrower2.begin_throwAasA(1, cb); - cb.check(); - } - - out.println("ok"); - - out.print("catching facet not exist exception with mapping... "); - out.flush(); - - { - ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower, "no such facet"); - Callback_Thrower_throwAasAFacetNotExistI cb = new Callback_Thrower_throwAasAFacetNotExistI(); - thrower2.begin_throwAasA(1, cb); - cb.check(); - } - - out.println("ok"); - - out.print("catching operation not exist exception with mapping... "); - out.flush(); - - { - Callback_WrongOperation_noSuchOperationI cb = new Callback_WrongOperation_noSuchOperationI(); - WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower); - thrower2.begin_noSuchOperation(cb); - cb.check(); - } - - out.println("ok"); - - out.print("catching unknown local exception with mapping... "); - out.flush(); - - { - Callback_Thrower_throwLocalExceptionI cb = new Callback_Thrower_throwLocalExceptionI(); - thrower.begin_throwLocalException(cb); - cb.check(); - } - - { - final Callback_Thrower_throwLocalExceptionI cb = new Callback_Thrower_throwLocalExceptionI(); - thrower.begin_throwLocalExceptionIdempotent(new Callback_Thrower_throwLocalExceptionIdempotent() - { - @Override - public void response() - { - cb.response(); - } - - @Override - public void exception(Ice.LocalException exc) - { - cb.exception(exc); - } - }); - cb.check(); - } - - out.println("ok"); - - out.print("catching unknown non-Ice exception with mapping... "); - out.flush(); - - { - Callback_Thrower_throwNonIceExceptionI cb = new Callback_Thrower_throwNonIceExceptionI(); - thrower.begin_throwNonIceException(cb); - cb.check(); - } - - out.println("ok"); - - return thrower; - } -} diff --git a/java/test/Ice/exceptions/Client.java b/java/test/Ice/exceptions/Client.java deleted file mode 100644 index ef66546fa26..00000000000 --- a/java/test/Ice/exceptions/Client.java +++ /dev/null @@ -1,43 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package test.Ice.exceptions; - -import test.Ice.exceptions.Test.ThrowerPrx; - -public class Client extends test.Util.Application -{ - @Override - public int run(String[] args) - { - Ice.Communicator communicator = communicator(); - ThrowerPrx thrower = AllTests.allTests(communicator, getWriter()); - thrower.shutdown(); - return 0; - } - - @Override - protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) - { - Ice.InitializationData initData = new Ice.InitializationData(); - initData.properties = Ice.Util.createProperties(argsH); - initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions"); - initData.properties.setProperty("Ice.Warn.Connections", "0"); - initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max - return initData; - } - - public static void main(String[] args) - { - Client app = new Client(); - int result = app.main("Client", args); - System.gc(); - System.exit(result); - } -} diff --git a/java/test/Ice/exceptions/Collocated.java b/java/test/Ice/exceptions/Collocated.java deleted file mode 100644 index b85ca002b94..00000000000 --- a/java/test/Ice/exceptions/Collocated.java +++ /dev/null @@ -1,55 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package test.Ice.exceptions; - -public class Collocated extends test.Util.Application -{ - @Override - public int - run(String[] args) - { - Ice.Communicator communicator = communicator(); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.Object object = new ThrowerI(); - adapter.add(object, communicator.stringToIdentity("thrower")); - - AllTests.allTests(communicator, getWriter()); - - return 0; - } - - @Override - protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) - { - Ice.InitializationData initData = new Ice.InitializationData(); - // - // For this test, we need a dummy logger, otherwise the - // assertion test will print an error message. - // - initData.logger = new DummyLogger(); - - initData.properties = Ice.Util.createProperties(argsH); - initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions"); - initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010"); - - return initData; - } - - public static void - main(String[] args) - { - Collocated app = new Collocated(); - int result = app.main("Collocated", args); - System.gc(); - System.exit(result); - } -} diff --git a/java/test/Ice/exceptions/DummyLogger.java b/java/test/Ice/exceptions/DummyLogger.java deleted file mode 100644 index 4230b744f94..00000000000 --- a/java/test/Ice/exceptions/DummyLogger.java +++ /dev/null @@ -1,66 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package test.Ice.exceptions; - - -public final class DummyLogger implements Ice.Logger -{ - @Override - public void - print(String message) - { - _logger.print(message); - } - - @Override - public void - trace(String category, String message) - { - _logger.trace(category, message); - } - - @Override - public void - warning(String message) - { - if(!message.contains("test.Ice.exceptions.ThrowerI.throwAssertException") && - !message.contains("test.Ice.exceptions.AMDThrowerI.throwAssertException_async")) - { - _logger.warning(message); - } - } - - @Override - public void - error(String message) - { - if(!message.contains("test.Ice.exceptions.ThrowerI.throwAssertException") && - !message.contains("test.Ice.exceptions.AMDThrowerI.throwAssertException_async")) - { - _logger.error(message); - } - } - - @Override - public String - getPrefix() - { - return ""; - } - - @Override - public Ice.Logger - cloneWithPrefix(String prefix) - { - return new DummyLogger(); - } - - private Ice.Logger _logger = new Ice.LoggerI("", ""); -} diff --git a/java/test/Ice/exceptions/EmptyI.java b/java/test/Ice/exceptions/EmptyI.java deleted file mode 100644 index f21f1bc484e..00000000000 --- a/java/test/Ice/exceptions/EmptyI.java +++ /dev/null @@ -1,17 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package test.Ice.exceptions; - -import test.Ice.exceptions.Test._EmptyDisp; - - -public final class EmptyI extends _EmptyDisp -{ -} diff --git a/java/test/Ice/exceptions/ObjectFactoryI.java b/java/test/Ice/exceptions/ObjectFactoryI.java deleted file mode 100644 index 87dd29b637b..00000000000 --- a/java/test/Ice/exceptions/ObjectFactoryI.java +++ /dev/null @@ -1,25 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package test.Ice.exceptions; - - -public final class ObjectFactoryI implements Ice.ObjectFactory -{ - @Override - public Ice.Object create(String s) - { - return null; - } - - @Override - public void destroy() - { - } -} diff --git a/java/test/Ice/exceptions/ServantLocatorI.java b/java/test/Ice/exceptions/ServantLocatorI.java deleted file mode 100644 index 6619cd8f40c..00000000000 --- a/java/test/Ice/exceptions/ServantLocatorI.java +++ /dev/null @@ -1,30 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package test.Ice.exceptions; - - -public final class ServantLocatorI implements Ice.ServantLocator -{ - @Override - public Ice.Object locate(Ice.Current curr, Ice.LocalObjectHolder cookie) - { - return null; - } - - @Override - public void finished(Ice.Current curr, Ice.Object servant, java.lang.Object cookie) - { - } - - @Override - public void deactivate(String category) - { - } -} diff --git a/java/test/Ice/exceptions/Server.java b/java/test/Ice/exceptions/Server.java deleted file mode 100644 index 539ac3bc304..00000000000 --- a/java/test/Ice/exceptions/Server.java +++ /dev/null @@ -1,51 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package test.Ice.exceptions; - -public class Server extends test.Util.Application -{ - @Override - public int run(String[] args) - { - Ice.Communicator communicator = communicator(); - Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); - Ice.Object object = new ThrowerI(); - adapter.add(object, communicator.stringToIdentity("thrower")); - adapter.activate(); - return WAIT; - } - - @Override - protected Ice.InitializationData getInitData(Ice.StringSeqHolder argsH) - { - Ice.InitializationData initData = new Ice.InitializationData(); - // - // For this test, we need a dummy logger, otherwise the - // assertion test will print an error message. - // - initData.logger = new DummyLogger(); - - initData.properties = Ice.Util.createProperties(argsH); - initData.properties.setProperty("Ice.Warn.Dispatch", "0"); - initData.properties.setProperty("Ice.Package.Test", "test.Ice.exceptions"); - initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp"); - initData.properties.setProperty("Ice.MessageSizeMax", "10"); // 10KB max - - return initData; - } - - public static void main(String[] args) - { - Server app = new Server(); - int result = app.main("Server", args); - System.gc(); - System.exit(result); - } -} diff --git a/java/test/Ice/exceptions/Test.ice b/java/test/Ice/exceptions/Test.ice deleted file mode 100644 index c1818494ad2..00000000000 --- a/java/test/Ice/exceptions/Test.ice +++ /dev/null @@ -1,77 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#pragma once - -#include <Ice/BuiltinSequences.ice> - -[["java:package:test.Ice.exceptions"]] -module Test -{ - -interface Empty -{ -}; - -interface Thrower; - -exception A -{ - int aMem; -}; - -exception B extends A -{ - int bMem; -}; - -exception C extends B -{ - int cMem; -}; - -exception D -{ - int dMem; -}; - -interface Thrower -{ - void shutdown(); - bool supportsUndeclaredExceptions(); - bool supportsAssertException(); - - void throwAasA(int a) throws A; - void throwAorDasAorD(int a) throws A, D; - void throwBasA(int a, int b) throws A; - void throwCasA(int a, int b, int c) throws A; - void throwBasB(int a, int b) throws B; - void throwCasB(int a, int b, int c) throws B; - void throwCasC(int a, int b, int c) throws C; - - void throwUndeclaredA(int a); - void throwUndeclaredB(int a, int b); - void throwUndeclaredC(int a, int b, int c); - void throwLocalException(); - void throwNonIceException(); - void throwAssertException(); - Ice::ByteSeq throwMemoryLimitException(Ice::ByteSeq seq); - - idempotent void throwLocalExceptionIdempotent(); - - void throwAfterResponse(); - void throwAfterException() throws A; -}; - -interface WrongOperation -{ - void noSuchOperation(); -}; - -}; diff --git a/java/test/Ice/exceptions/TestAMD.ice b/java/test/Ice/exceptions/TestAMD.ice deleted file mode 100644 index 4007abf0f52..00000000000 --- a/java/test/Ice/exceptions/TestAMD.ice +++ /dev/null @@ -1,72 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -#pragma once - -#include <Ice/BuiltinSequences.ice> - -[["java:package:test.Ice.exceptions.AMD"]] -module Test -{ - -interface Thrower; - -exception A -{ - int aMem; -}; - -exception B extends A -{ - int bMem; -}; - -exception C extends B -{ - int cMem; -}; - -exception D -{ - int dMem; -}; - -["amd"] interface Thrower -{ - void shutdown(); - bool supportsUndeclaredExceptions(); - bool supportsAssertException(); - - void throwAasA(int a) throws A; - void throwAorDasAorD(int a) throws A, D; - void throwBasA(int a, int b) throws A; - void throwCasA(int a, int b, int c) throws A; - void throwBasB(int a, int b) throws B; - void throwCasB(int a, int b, int c) throws B; - void throwCasC(int a, int b, int c) throws C; - void throwUndeclaredA(int a); - void throwUndeclaredB(int a, int b); - void throwUndeclaredC(int a, int b, int c); - void throwLocalException(); - void throwNonIceException(); - void throwAssertException(); - Ice::ByteSeq throwMemoryLimitException(Ice::ByteSeq seq); - - idempotent void throwLocalExceptionIdempotent(); - - void throwAfterResponse(); - void throwAfterException() throws A; -}; - -["amd"] interface WrongOperation -{ - void noSuchOperation(); -}; - -}; diff --git a/java/test/Ice/exceptions/ThrowerI.java b/java/test/Ice/exceptions/ThrowerI.java deleted file mode 100644 index 8859147bd36..00000000000 --- a/java/test/Ice/exceptions/ThrowerI.java +++ /dev/null @@ -1,201 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package test.Ice.exceptions; - -import test.Ice.exceptions.Test.A; -import test.Ice.exceptions.Test.B; -import test.Ice.exceptions.Test.C; -import test.Ice.exceptions.Test.D; -import test.Ice.exceptions.Test._ThrowerDisp; - -public final class ThrowerI extends _ThrowerDisp -{ - public - ThrowerI() - { - } - - @Override - public void - shutdown(Ice.Current current) - { - current.adapter.getCommunicator().shutdown(); - } - - @Override - public boolean - supportsUndeclaredExceptions(Ice.Current current) - { - return false; - } - - @Override - public boolean - supportsAssertException(Ice.Current current) - { - return true; - } - - @Override - public void - throwAasA(int a, Ice.Current current) - throws A - { - A ex = new A(); - ex.aMem = a; - throw ex; - } - - @Override - public void - throwAorDasAorD(int a, Ice.Current current) - throws A, - D - { - if(a > 0) - { - A ex = new A(); - ex.aMem = a; - throw ex; - } - else - { - D ex = new D(); - ex.dMem = a; - throw ex; - } - } - - @Override - public void - throwBasA(int a, int b, Ice.Current current) - throws A - { - throwBasB(a, b, current); - } - - @Override - public void - throwBasB(int a, int b, Ice.Current current) - throws B - { - B ex = new B(); - ex.aMem = a; - ex.bMem = b; - throw ex; - } - - @Override - public void - throwCasA(int a, int b, int c, Ice.Current current) - throws A - { - throwCasC(a, b, c, current); - } - - @Override - public void - throwCasB(int a, int b, int c, Ice.Current current) - throws B - { - throwCasC(a, b, c, current); - } - - @Override - public void - throwCasC(int a, int b, int c, Ice.Current current) - throws C - { - C ex = new C(); - ex.aMem = a; - ex.bMem = b; - ex.cMem = c; - throw ex; - } - - @Override - public void - throwUndeclaredA(int a, Ice.Current current) - { - // Not possible in Java. - throw new Ice.UnknownUserException(); - } - - @Override - public void - throwUndeclaredB(int a, int b, Ice.Current current) - { - // Not possible in Java. - throw new Ice.UnknownUserException(); - } - - @Override - public void - throwUndeclaredC(int a, int b, int c, Ice.Current current) - { - // Not possible in Java. - throw new Ice.UnknownUserException(); - } - - @Override - public void - throwLocalException(Ice.Current current) - { - throw new Ice.TimeoutException(); - } - - @Override - public void - throwLocalExceptionIdempotent(Ice.Current current) - { - throw new Ice.TimeoutException(); - } - - @Override - public void - throwNonIceException(Ice.Current current) - { - throw new RuntimeException(); - } - - @Override - public void - throwAssertException(Ice.Current current) - { - throw new java.lang.AssertionError(); - } - - @Override - public byte[] - throwMemoryLimitException(byte[] seq, Ice.Current current) - { - return new byte[1024 * 20]; // 20KB is over the configured 10KB message size max. - } - - @Override - public void - throwAfterResponse(Ice.Current current) - { - // - // Only relevant for AMD. - // - } - - @Override - public void - throwAfterException(Ice.Current current) - throws A - { - // - // Only relevant for AMD. - // - throw new A(); - } -} diff --git a/java/test/Ice/exceptions/run.py b/java/test/Ice/exceptions/run.py deleted file mode 100755 index 889f816c644..00000000000 --- a/java/test/Ice/exceptions/run.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python -# ********************************************************************** -# -# Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. -# -# This copy of Ice is licensed to you under the terms described in the -# ICE_LICENSE file included in this distribution. -# -# ********************************************************************** - -import os, sys - -path = [ ".", "..", "../..", "../../..", "../../../.." ] -head = os.path.dirname(sys.argv[0]) -if len(head) > 0: - path = [os.path.join(head, p) for p in path] -path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ] -if len(path) == 0: - raise RuntimeError("can't find toplevel directory!") -sys.path.append(os.path.join(path[0], "scripts")) -import TestUtil - -print("Running test with compact (default) format.") -TestUtil.clientServerTest() - -print("Running test with sliced format.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -print("Running test with 1.0 encoding.") -TestUtil.clientServerTest(additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -print("Running test with compact (default) format and AMD server.") -TestUtil.clientServerTest(server="test.Ice.exceptions.AMDServer") - -print("Running test with sliced format and AMD server.") -TestUtil.clientServerTest(server="test.Ice.exceptions.AMDServer", - additionalClientOptions="--Ice.Default.SlicedFormat", - additionalServerOptions="--Ice.Default.SlicedFormat") - -print("Running test with 1.0 encoding and AMD server.") -TestUtil.clientServerTest(server="test.Ice.exceptions.AMDServer", - additionalClientOptions="--Ice.Default.EncodingVersion=1.0", - additionalServerOptions="--Ice.Default.EncodingVersion=1.0") - -print("Running collocated test.") -TestUtil.collocatedTest() |