summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2005-05-19 01:35:24 +0000
committerMichi Henning <michi@zeroc.com>2005-05-19 01:35:24 +0000
commit74237da6b56ff3f38351d791fe402f6f6d9bbe9d (patch)
treef5d8d805ec55abe614bbde51ecf5f818068e81ca /java
parentixed bug in initializeWithProperties() introduced by merge from (diff)
downloadice-74237da6b56ff3f38351d791fe402f6f6d9bbe9d.tar.bz2
ice-74237da6b56ff3f38351d791fe402f6f6d9bbe9d.tar.xz
ice-74237da6b56ff3f38351d791fe402f6f6d9bbe9d.zip
Fixed http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=324.
Diffstat (limited to 'java')
-rw-r--r--java/demo/Ice/value/Client.java4
-rw-r--r--java/test/Ice/exceptions/AllTests.java20
-rw-r--r--java/test/Ice/facets/AllTests.java12
-rw-r--r--java/test/Ice/slicing/exceptions/csrc/AllTests.java52
-rw-r--r--java/test/Ice/slicing/objects/csrc/AllTests.java16
5 files changed, 27 insertions, 77 deletions
diff --git a/java/demo/Ice/value/Client.java b/java/demo/Ice/value/Client.java
index fb05e64c73c..768ad9ea275 100644
--- a/java/demo/Ice/value/Client.java
+++ b/java/demo/Ice/value/Client.java
@@ -80,13 +80,13 @@ public class Client
try
{
initial.getPrinter(printer, printerProxy);
+ System.err.println("Did not get the expected NoObjectFactoryException!");
+ System.exit(1);
}
catch(Ice.NoObjectFactoryException ex)
{
System.out.println("==> " + ex);
- gotException = true;
}
- assert(gotException);
System.out.println();
System.out.println("Yep, that's what we expected. Now let's try again, but with");
diff --git a/java/test/Ice/exceptions/AllTests.java b/java/test/Ice/exceptions/AllTests.java
index ec777e6bf91..a45f8a33430 100644
--- a/java/test/Ice/exceptions/AllTests.java
+++ b/java/test/Ice/exceptions/AllTests.java
@@ -691,28 +691,24 @@ public class AllTests
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter1");
Ice.Object obj = new EmptyI();
adapter.add(obj, Ice.Util.stringToIdentity("x"));
- boolean gotException = false;
try
{
adapter.add(obj, Ice.Util.stringToIdentity("x"));
+ test(false);
}
catch(Ice.AlreadyRegisteredException ex)
{
- gotException = true;
}
- test(gotException);
- gotException = false;
adapter.remove(Ice.Util.stringToIdentity("x"));
try
{
adapter.remove(Ice.Util.stringToIdentity("x"));
+ test(false);
}
catch(Ice.NotRegisteredException ex)
{
- gotException = true;
}
- test(gotException);
adapter.deactivate();
System.out.println("ok");
}
@@ -722,16 +718,14 @@ public class AllTests
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter2");
Ice.ServantLocator loc = new ServantLocatorI();
adapter.addServantLocator(loc, "x");
- boolean gotException = false;
try
{
adapter.addServantLocator(loc, "x");
+ test(false);
}
catch(Ice.AlreadyRegisteredException ex)
{
- gotException = true;
}
- test(gotException);
adapter.deactivate();
System.out.println("ok");
@@ -741,28 +735,24 @@ public class AllTests
System.out.print("testing object factory registration exceptions... ");
Ice.ObjectFactory of = new ObjectFactoryI();
communicator.addObjectFactory(of, "::x");
- boolean gotException = false;
try
{
communicator.addObjectFactory(of, "::x");
+ test(false);
}
catch(Ice.AlreadyRegisteredException ex)
{
- gotException = true;
}
- test(gotException);
- gotException = false;
communicator.removeObjectFactory("::x");
try
{
communicator.removeObjectFactory("::x");
+ test(false);
}
catch(Ice.NotRegisteredException ex)
{
- gotException = true;
}
- test(gotException);
System.out.println("ok");
}
diff --git a/java/test/Ice/facets/AllTests.java b/java/test/Ice/facets/AllTests.java
index 90a1595cc97..c4ff8bedb86 100644
--- a/java/test/Ice/facets/AllTests.java
+++ b/java/test/Ice/facets/AllTests.java
@@ -28,27 +28,23 @@ public class AllTests
Ice.Object obj = new EmptyI();
adapter.add(obj, Ice.Util.stringToIdentity("d"));
adapter.addFacet(obj, Ice.Util.stringToIdentity("d"), "facetABCD");
- boolean gotException = false;
try
{
adapter.addFacet(obj, Ice.Util.stringToIdentity("d"), "facetABCD");
+ test(false);
}
catch(Ice.AlreadyRegisteredException ex)
{
- gotException = true;
}
- test(gotException);
adapter.removeFacet(Ice.Util.stringToIdentity("d"), "facetABCD");
- gotException = false;
try
{
adapter.removeFacet(Ice.Util.stringToIdentity("d"), "facetABCD");
+ test(false);
}
catch(Ice.NotRegisteredException ex)
{
- gotException = true;
}
- test(gotException);
System.out.println("ok");
System.out.print("testing removeAllFacets... ");
@@ -64,16 +60,14 @@ public class AllTests
test(fm.size() == 2);
test(fm.get("f1") == obj1);
test(fm.get("f2") == obj2);
- gotException = false;
try
{
adapter.removeAllFacets(Ice.Util.stringToIdentity("id1"));
+ test(false);
}
catch(Ice.NotRegisteredException ex)
{
- gotException = true;
}
- test(gotException);
fm = adapter.removeAllFacets(Ice.Util.stringToIdentity("id2"));
test(fm.size() == 3);
test(fm.get("f1") == obj1);
diff --git a/java/test/Ice/slicing/exceptions/csrc/AllTests.java b/java/test/Ice/slicing/exceptions/csrc/AllTests.java
index dff102d48c9..5ba4d44cc87 100644
--- a/java/test/Ice/slicing/exceptions/csrc/AllTests.java
+++ b/java/test/Ice/slicing/exceptions/csrc/AllTests.java
@@ -644,22 +644,20 @@ public class AllTests
System.out.print("base... ");
System.out.flush();
{
- boolean gotException = false;
try
{
test.baseAsBase();
+ test(false);
}
catch(Base b)
{
test(b.b.equals("Base.b"));
test(b.ice_name().equals("Test::Base"));
- gotException = true;
}
catch(Exception ex)
{
test(false);
}
- test(gotException);
}
System.out.println("ok");
@@ -675,22 +673,20 @@ public class AllTests
System.out.print("slicing of unknown derived... ");
System.out.flush();
{
- boolean gotException = false;
try
{
test.unknownDerivedAsBase();
+ test(false);
}
catch(Base b)
{
test(b.b.equals("UnknownDerived.b"));
test(b.ice_name().equals("Test::Base"));
- gotException = true;
}
catch(Exception ex)
{
test(false);
}
- test(gotException);
}
System.out.println("ok");
@@ -706,23 +702,21 @@ public class AllTests
System.out.print("non-slicing of known derived as base... ");
System.out.flush();
{
- boolean gotException = false;
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"));
- gotException = true;
}
catch(Exception ex)
{
test(false);
}
- test(gotException);
}
System.out.println("ok");
@@ -738,23 +732,21 @@ public class AllTests
System.out.print("non-slicing of known derived as derived... ");
System.out.flush();
{
- boolean gotException = false;
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"));
- gotException = true;
}
catch(Exception ex)
{
test(false);
}
- test(gotException);
}
System.out.println("ok");
@@ -770,22 +762,20 @@ public class AllTests
System.out.print("slicing of unknown intermediate as base... ");
System.out.flush();
{
- boolean gotException = false;
try
{
test.unknownIntermediateAsBase();
+ test(false);
}
catch(Base b)
{
test(b.b.equals("UnknownIntermediate.b"));
test(b.ice_name().equals("Test::Base"));
- gotException = true;
}
catch(Exception ex)
{
test(false);
}
- test(gotException);
}
System.out.println("ok");
@@ -801,23 +791,21 @@ public class AllTests
System.out.print("slicing of known intermediate as base... ");
System.out.flush();
{
- boolean gotException = false;
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"));
- gotException = true;
}
catch(Exception ex)
{
test(false);
}
- test(gotException);
}
System.out.println("ok");
@@ -833,10 +821,10 @@ public class AllTests
System.out.print("slicing of known most derived as base... ");
System.out.flush();
{
- boolean gotException = false;
try
{
test.knownMostDerivedAsBase();
+ test(false);
}
catch(KnownMostDerived kmd)
{
@@ -844,13 +832,11 @@ public class AllTests
test(kmd.ki.equals("KnownMostDerived.ki"));
test(kmd.kmd.equals("KnownMostDerived.kmd"));
test(kmd.ice_name().equals("Test::KnownMostDerived"));
- gotException = true;
}
catch(Exception ex)
{
test(false);
}
- test(gotException);
}
System.out.println("ok");
@@ -866,23 +852,21 @@ public class AllTests
System.out.print("non-slicing of known intermediate as intermediate... ");
System.out.flush();
{
- boolean gotException = false;
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"));
- gotException = true;
}
catch(Exception ex)
{
test(false);
}
- test(gotException);
}
System.out.println("ok");
@@ -898,10 +882,10 @@ public class AllTests
System.out.print("non-slicing of known most derived as intermediate... ");
System.out.flush();
{
- boolean gotException = false;
try
{
test.knownMostDerivedAsKnownIntermediate();
+ test(false);
}
catch(KnownMostDerived kmd)
{
@@ -909,13 +893,11 @@ public class AllTests
test(kmd.ki.equals("KnownMostDerived.ki"));
test(kmd.kmd.equals("KnownMostDerived.kmd"));
test(kmd.ice_name().equals("Test::KnownMostDerived"));
- gotException = true;
}
catch(Exception ex)
{
test(false);
}
- test(gotException);
}
System.out.println("ok");
@@ -931,10 +913,10 @@ public class AllTests
System.out.print("non-slicing of known most derived as most derived... ");
System.out.flush();
{
- boolean gotException = false;
try
{
test.knownMostDerivedAsKnownMostDerived();
+ test(false);
}
catch(KnownMostDerived kmd)
{
@@ -942,13 +924,11 @@ public class AllTests
test(kmd.ki.equals("KnownMostDerived.ki"));
test(kmd.kmd.equals("KnownMostDerived.kmd"));
test(kmd.ice_name().equals("Test::KnownMostDerived"));
- gotException = true;
}
catch(Exception ex)
{
test(false);
}
- test(gotException);
}
System.out.println("ok");
@@ -964,23 +944,21 @@ public class AllTests
System.out.print("slicing of unknown most derived, known intermediate as base... ");
System.out.flush();
{
- boolean gotException = false;
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"));
- gotException = true;
}
catch(Exception ex)
{
test(false);
}
- test(gotException);
}
System.out.println("ok");
@@ -996,23 +974,21 @@ public class AllTests
System.out.print("slicing of unknown most derived, known intermediate as intermediate... ");
System.out.flush();
{
- boolean gotException = false;
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"));
- gotException = true;
}
catch(Exception ex)
{
test(false);
}
- test(gotException);
}
System.out.println("ok");
@@ -1029,22 +1005,20 @@ public class AllTests
System.out.print("slicing of unknown most derived, unknown intermediate thrown as base... ");
System.out.flush();
{
- boolean gotException = false;
try
{
test.unknownMostDerived2AsBase();
+ test(false);
}
catch(Base b)
{
test(b.b.equals("UnknownMostDerived2.b"));
test(b.ice_name().equals("Test::Base"));
- gotException = true;
}
catch(Exception ex)
{
test(false);
}
- test(gotException);
}
System.out.println("ok");
diff --git a/java/test/Ice/slicing/objects/csrc/AllTests.java b/java/test/Ice/slicing/objects/csrc/AllTests.java
index 8f7627ea871..98352ac238d 100644
--- a/java/test/Ice/slicing/objects/csrc/AllTests.java
+++ b/java/test/Ice/slicing/objects/csrc/AllTests.java
@@ -1495,16 +1495,14 @@ public class AllTests
test(b2.sb.equals("D3.sb"));
test(b2.ice_id().equals("::Test::B")); // Sliced by server
test(b2.pb == b1);
- boolean gotException = false;
try
{
D3 p3 = (D3)b2;
+ test(false);
}
catch(ClassCastException ex)
{
- gotException = true;
}
- test(gotException);
test(b1 != d1);
test(b1 != d3);
@@ -1550,16 +1548,14 @@ public class AllTests
test(b2.sb.equals("D3.sb"));
test(b2.ice_id().equals("::Test::B")); // Sliced by server
test(b2.pb == b1);
- boolean gotException = false;
try
{
D3 p3 = (D3)b2;
+ test(false);
}
catch(ClassCastException ex)
{
- gotException = true;
}
- test(gotException);
test(b1 != d1);
test(b1 != d3);
@@ -1590,16 +1586,14 @@ public class AllTests
test(b1.sb.equals("D3.sb"));
test(b1.ice_id().equals("::Test::B")); // Sliced by server
- boolean gotException = false;
try
{
D3 p1 = (D3)b1;
+ test(false);
}
catch(ClassCastException ex)
{
- gotException = true;
}
- test(gotException);
B b2 = b1.pb;
test(b2 != null);
@@ -1646,16 +1640,14 @@ public class AllTests
test(b1.sb.equals("D3.sb"));
test(b1.ice_id().equals("::Test::B")); // Sliced by server
- boolean gotException = false;
try
{
D3 p1 = (D3)b1;
+ test(false);
}
catch(ClassCastException ex)
{
- gotException = true;
}
- test(gotException);
B b2 = b1.pb;
test(b2 != null);