1
1
// **********************************************************************
3
// Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved.
3
// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
5
5
// This copy of Ice-E is licensed to you under the terms described in the
6
6
// ICEE_LICENSE file included in this distribution.
26
26
out.print("testing facet registration exceptions... ");
27
27
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("FacetExceptionTestAdapter");
28
28
Ice.Object obj = new EmptyI();
29
adapter.add(obj, Ice.Util.stringToIdentity("d"));
30
adapter.addFacet(obj, Ice.Util.stringToIdentity("d"), "facetABCD");
29
adapter.add(obj, communicator.stringToIdentity("d"));
30
adapter.addFacet(obj, communicator.stringToIdentity("d"), "facetABCD");
33
adapter.addFacet(obj, Ice.Util.stringToIdentity("d"), "facetABCD");
33
adapter.addFacet(obj, communicator.stringToIdentity("d"), "facetABCD");
36
36
catch(Ice.AlreadyRegisteredException ex)
39
adapter.removeFacet(Ice.Util.stringToIdentity("d"), "facetABCD");
39
adapter.removeFacet(communicator.stringToIdentity("d"), "facetABCD");
42
adapter.removeFacet(Ice.Util.stringToIdentity("d"), "facetABCD");
42
adapter.removeFacet(communicator.stringToIdentity("d"), "facetABCD");
45
45
catch(Ice.NotRegisteredException ex)
50
50
out.print("testing removeAllFacets... ");
51
51
Ice.Object obj1 = new EmptyI();
52
52
Ice.Object obj2 = new EmptyI();
53
adapter.addFacet(obj1, Ice.Util.stringToIdentity("id1"), "f1");
54
adapter.addFacet(obj2, Ice.Util.stringToIdentity("id1"), "f2");
53
adapter.addFacet(obj1, communicator.stringToIdentity("id1"), "f1");
54
adapter.addFacet(obj2, communicator.stringToIdentity("id1"), "f2");
55
55
Ice.Object obj3 = new EmptyI();
56
adapter.addFacet(obj1, Ice.Util.stringToIdentity("id2"), "f1");
57
adapter.addFacet(obj2, Ice.Util.stringToIdentity("id2"), "f2");
58
adapter.addFacet(obj3, Ice.Util.stringToIdentity("id2"), "");
59
java.util.Hashtable fm = adapter.removeAllFacets(Ice.Util.stringToIdentity("id1"));
56
adapter.addFacet(obj1, communicator.stringToIdentity("id2"), "f1");
57
adapter.addFacet(obj2, communicator.stringToIdentity("id2"), "f2");
58
adapter.addFacet(obj3, communicator.stringToIdentity("id2"), "");
59
java.util.Hashtable fm = adapter.removeAllFacets(communicator.stringToIdentity("id1"));
60
60
test(fm.size() == 2);
61
61
test(fm.get("f1") == obj1);
62
62
test(fm.get("f2") == obj2);
65
adapter.removeAllFacets(Ice.Util.stringToIdentity("id1"));
65
adapter.removeAllFacets(communicator.stringToIdentity("id1"));
68
68
catch(Ice.NotRegisteredException ex)
71
fm = adapter.removeAllFacets(Ice.Util.stringToIdentity("id2"));
71
fm = adapter.removeAllFacets(communicator.stringToIdentity("id2"));
72
72
test(fm.size() == 3);
73
73
test(fm.get("f1") == obj1);
74
74
test(fm.get("f2") == obj2);