1
1
// **********************************************************************
3
// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
3
// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
5
5
// This copy of Ice is licensed to you under the terms described in the
6
6
// ICE_LICENSE file included in this distribution.
8
8
// **********************************************************************
10
package test.Ice.objects;
12
import java.io.PrintWriter;
14
import test.Ice.objects.Test.B;
15
import test.Ice.objects.Test.BHolder;
16
import test.Ice.objects.Test.C;
17
import test.Ice.objects.Test.CHolder;
18
import test.Ice.objects.Test.D;
19
import test.Ice.objects.Test.DHolder;
20
import test.Ice.objects.Test.E;
21
import test.Ice.objects.Test.F;
22
import test.Ice.objects.Test.H;
23
import test.Ice.objects.Test.I;
24
import test.Ice.objects.Test.InitialPrx;
25
import test.Ice.objects.Test.InitialPrxHelper;
26
import test.Ice.objects.Test.J;
27
import test.Ice.objects.Test.UnexpectedObjectExceptionTestPrx;
28
import test.Ice.objects.Test.UnexpectedObjectExceptionTestPrxHelper;
12
30
public class AllTests
23
41
public static InitialPrx
24
allTests(Ice.Communicator communicator, boolean collocated)
42
allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out)
26
System.out.print("testing stringToProxy... ");
28
String ref = "initial:default -p 12010 -t 10000";
44
out.print("testing stringToProxy... ");
46
String ref = "initial:default -p 12010";
29
47
Ice.ObjectPrx base = communicator.stringToProxy(ref);
30
48
test(base != null);
31
System.out.println("ok");
33
System.out.print("testing checked cast... ");
51
out.print("testing checked cast... ");
35
53
InitialPrx initial = InitialPrxHelper.checkedCast(base);
36
54
test(initial != null);
37
55
test(initial.equals(base));
38
System.out.println("ok");
40
System.out.print("getting B1... ");
58
out.print("getting B1... ");
42
60
B b1 = initial.getB1();
44
System.out.println("ok");
46
System.out.print("getting B2... ");
64
out.print("getting B2... ");
48
66
B b2 = initial.getB2();
50
System.out.println("ok");
52
System.out.print("getting C... ");
70
out.print("getting C... ");
54
72
C c = initial.getC();
56
System.out.println("ok");
58
System.out.print("getting D... ");
76
out.print("getting D... ");
60
78
D d = initial.getD();
62
System.out.println("ok");
64
System.out.print("checking consistency... ");
82
out.print("checking consistency... ");
90
108
test(b2.theA == b2);
91
109
test(d.theC == null);
92
System.out.println("ok");
94
System.out.print("getting B1, B2, C, and D all at once... ");
112
out.print("getting B1, B2, C, and D all at once... ");
96
114
BHolder b1H = new BHolder();
97
115
BHolder b2H = new BHolder();
98
116
CHolder cH = new CHolder();
137
155
test(d.theB.theC.preMarshalInvoked);
138
156
test(d.theB.theC.postUnmarshalInvoked(null));
140
System.out.println("ok");
142
System.out.print("testing protected members... ");
160
out.print("testing protected members... ");
144
162
E e = initial.getE();
145
163
test(e.checkValues());
167
System.out.println("ok");
169
System.out.print("getting I, J and H... ");
187
out.print("getting I, J and H... ");
171
189
I i = initial.getI();
173
191
I j = initial.getJ();
174
192
test(j != null && ((J)j) != null);
175
193
I h = initial.getH();
176
194
test(h != null && ((H)h) != null);
177
System.out.println("ok");
179
System.out.print("setting I... ");
197
out.print("setting I... ");
184
System.out.println("ok");
188
System.out.print("testing UnexpectedObjectException...");
190
ref = "uoet:default -p 12010 -t 10000";
206
out.print("testing UnexpectedObjectException...");
208
ref = "uoet:default -p 12010";
191
209
base = communicator.stringToProxy(ref);
192
210
test(base != null);
193
211
UnexpectedObjectExceptionTestPrx uoet = UnexpectedObjectExceptionTestPrxHelper.uncheckedCast(base);