~ubuntu-branches/ubuntu/quantal/zeroc-ice/quantal

« back to all changes in this revision

Viewing changes to java/test/Ice/objects/AllTests.java

  • Committer: Bazaar Package Importer
  • Author(s): Cleto Martin Angelina
  • Date: 2011-04-25 18:44:24 UTC
  • mfrom: (6.1.14 sid)
  • Revision ID: james.westby@ubuntu.com-20110425184424-sep9i9euu434vq4c
Tags: 3.4.1-7
* Bug fix: "libdb5.1-java.jar was renamed to db.jar", thanks to Ondřej
  Surý (Closes: #623555).
* Bug fix: "causes noise in php5", thanks to Jayen Ashar (Closes:
  #623533).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
// **********************************************************************
2
2
//
3
 
// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
 
3
// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
4
4
//
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.
7
7
//
8
8
// **********************************************************************
9
9
 
10
 
import Test.*;
 
10
package test.Ice.objects;
 
11
 
 
12
import java.io.PrintWriter;
 
13
 
 
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;
11
29
 
12
30
public class AllTests
13
31
{
21
39
    }
22
40
 
23
41
    public static InitialPrx
24
 
    allTests(Ice.Communicator communicator, boolean collocated)
 
42
    allTests(Ice.Communicator communicator, boolean collocated, PrintWriter out)
25
43
    {
26
 
        System.out.print("testing stringToProxy... ");
27
 
        System.out.flush();
28
 
        String ref = "initial:default -p 12010 -t 10000";
 
44
                out.print("testing stringToProxy... ");
 
45
        out.flush();
 
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");
 
49
        out.println("ok");
32
50
 
33
 
        System.out.print("testing checked cast... ");
34
 
        System.out.flush();
 
51
        out.print("testing checked cast... ");
 
52
        out.flush();
35
53
        InitialPrx initial = InitialPrxHelper.checkedCast(base);
36
54
        test(initial != null);
37
55
        test(initial.equals(base));
38
 
        System.out.println("ok");
 
56
        out.println("ok");
39
57
 
40
 
        System.out.print("getting B1... ");
41
 
        System.out.flush();
 
58
        out.print("getting B1... ");
 
59
        out.flush();
42
60
        B b1 = initial.getB1();
43
61
        test(b1 != null);
44
 
        System.out.println("ok");
 
62
        out.println("ok");
45
63
 
46
 
        System.out.print("getting B2... ");
47
 
        System.out.flush();
 
64
        out.print("getting B2... ");
 
65
        out.flush();
48
66
        B b2 = initial.getB2();
49
67
        test(b2 != null);
50
 
        System.out.println("ok");
 
68
        out.println("ok");
51
69
 
52
 
        System.out.print("getting C... ");
53
 
        System.out.flush();
 
70
        out.print("getting C... ");
 
71
        out.flush();
54
72
        C c = initial.getC();
55
73
        test(c != null);
56
 
        System.out.println("ok");
 
74
        out.println("ok");
57
75
 
58
 
        System.out.print("getting D... ");
59
 
        System.out.flush();
 
76
        out.print("getting D... ");
 
77
        out.flush();
60
78
        D d = initial.getD();
61
79
        test(d != null);
62
 
        System.out.println("ok");
 
80
        out.println("ok");
63
81
 
64
 
        System.out.print("checking consistency... ");
65
 
        System.out.flush();
 
82
        out.print("checking consistency... ");
 
83
        out.flush();
66
84
        test(b1 != b2);
67
85
        //test(b1 != c);
68
86
        //test(b1 != d);
89
107
        // sufficient.
90
108
        test(b2.theA == b2);
91
109
        test(d.theC == null);
92
 
        System.out.println("ok");
 
110
        out.println("ok");
93
111
 
94
 
        System.out.print("getting B1, B2, C, and D all at once... ");
95
 
        System.out.flush();
 
112
        out.print("getting B1, B2, C, and D all at once... ");
 
113
        out.flush();
96
114
        BHolder b1H = new BHolder();
97
115
        BHolder b2H = new BHolder();
98
116
        CHolder cH = new CHolder();
106
124
        test(b2 != null);
107
125
        test(c != null);
108
126
        test(d != null);
109
 
        System.out.println("ok");
 
127
        out.println("ok");
110
128
 
111
 
        System.out.print("checking consistency... ");
112
 
        System.out.flush();
 
129
        out.print("checking consistency... ");
 
130
        out.flush();
113
131
        test(b1 != b2);
114
132
        //test(b1 != c);
115
133
        //test(b1 != d);
137
155
            test(d.theB.theC.preMarshalInvoked);
138
156
            test(d.theB.theC.postUnmarshalInvoked(null));
139
157
        }
140
 
        System.out.println("ok");
 
158
        out.println("ok");
141
159
 
142
 
        System.out.print("testing protected members... ");
143
 
        System.out.flush();
 
160
        out.print("testing protected members... ");
 
161
        out.flush();
144
162
        E e = initial.getE();
145
163
        test(e.checkValues());
146
164
        try
164
182
        {
165
183
            test(false);
166
184
        }
167
 
        System.out.println("ok");
 
185
        out.println("ok");
168
186
 
169
 
        System.out.print("getting I, J and H... ");
170
 
        System.out.flush();
 
187
        out.print("getting I, J and H... ");
 
188
        out.flush();
171
189
        I i = initial.getI();
172
190
        test(i != null);
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");
 
195
        out.println("ok");
178
196
 
179
 
        System.out.print("setting I... ");
180
 
        System.out.flush();
 
197
        out.print("setting I... ");
 
198
        out.flush();
181
199
        initial.setI(i);
182
200
        initial.setI(j);
183
201
        initial.setI(h);
184
 
        System.out.println("ok");
 
202
        out.println("ok");
185
203
 
186
204
        if(!collocated)
187
205
        {
188
 
            System.out.print("testing UnexpectedObjectException...");
189
 
            System.out.flush();
190
 
            ref = "uoet:default -p 12010 -t 10000";
 
206
            out.print("testing UnexpectedObjectException...");
 
207
            out.flush();
 
208
            ref = "uoet:default -p 12010";
191
209
            base = communicator.stringToProxy(ref);
192
210
            test(base != null);
193
211
            UnexpectedObjectExceptionTestPrx uoet = UnexpectedObjectExceptionTestPrxHelper.uncheckedCast(base);
204
222
            }
205
223
            catch(java.lang.Exception ex)
206
224
            {
207
 
                System.out.println(ex);
 
225
                out.println(ex);
208
226
                test(false);
209
227
            }
210
 
            System.out.println("ok");
 
228
            out.println("ok");
211
229
        }
212
230
 
213
231
        return initial;