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

« back to all changes in this revision

Viewing changes to java/test/Ice/slicing/objects/ssrc/TestI.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
 
// **********************************************************************
2
 
//
3
 
// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
4
 
//
5
 
// This copy of Ice is licensed to you under the terms described in the
6
 
// ICE_LICENSE file included in this distribution.
7
 
//
8
 
// **********************************************************************
9
 
 
10
 
import Test.*;
11
 
 
12
 
public final class TestI extends _TestIntfDisp
13
 
{
14
 
    public
15
 
    TestI(Ice.ObjectAdapter adapter)
16
 
    {
17
 
        _adapter = adapter;
18
 
    }
19
 
 
20
 
    public void
21
 
    shutdown(Ice.Current current)
22
 
    {
23
 
        _adapter.getCommunicator().shutdown();
24
 
    }
25
 
 
26
 
    public Ice.Object
27
 
    SBaseAsObject(Ice.Current current)
28
 
    {
29
 
        SBase sb = new SBase();
30
 
        sb.sb = "SBase.sb";
31
 
        return sb;
32
 
    }
33
 
 
34
 
    public SBase
35
 
    SBaseAsSBase(Ice.Current current)
36
 
    {
37
 
        SBase sb = new SBase();
38
 
        sb.sb = "SBase.sb";
39
 
        return sb;
40
 
    }
41
 
 
42
 
    public SBase
43
 
    SBSKnownDerivedAsSBase(Ice.Current current)
44
 
    {
45
 
        SBSKnownDerived sbskd = new SBSKnownDerived();
46
 
        sbskd.sb = "SBSKnownDerived.sb";
47
 
        sbskd.sbskd = "SBSKnownDerived.sbskd";
48
 
        return sbskd;
49
 
    }
50
 
 
51
 
    public SBSKnownDerived
52
 
    SBSKnownDerivedAsSBSKnownDerived(Ice.Current current)
53
 
    {
54
 
        SBSKnownDerived sbskd = new SBSKnownDerived();
55
 
        sbskd.sb = "SBSKnownDerived.sb";
56
 
        sbskd.sbskd = "SBSKnownDerived.sbskd";
57
 
        return sbskd;
58
 
    }
59
 
 
60
 
    public SBase
61
 
    SBSUnknownDerivedAsSBase(Ice.Current current)
62
 
    {
63
 
        SBSUnknownDerived sbsud = new SBSUnknownDerived();
64
 
        sbsud.sb = "SBSUnknownDerived.sb";
65
 
        sbsud.sbsud = "SBSUnknownDerived.sbsud";
66
 
        return sbsud;
67
 
    }
68
 
 
69
 
    public Ice.Object
70
 
    SUnknownAsObject(Ice.Current current)
71
 
    {
72
 
        SUnknown su = new SUnknown();
73
 
        su.su = "SUnknown.su";
74
 
        return su;
75
 
    }
76
 
 
77
 
    public B
78
 
    oneElementCycle(Ice.Current current)
79
 
    {
80
 
        B b = new B();
81
 
        b.sb = "B1.sb";
82
 
        b.pb = b;
83
 
        return b;
84
 
    }
85
 
 
86
 
    public B
87
 
    twoElementCycle(Ice.Current current)
88
 
    {
89
 
        B b1 = new B();
90
 
        b1.sb = "B1.sb";
91
 
        B b2 = new B();
92
 
        b2.sb = "B2.sb";
93
 
        b2.pb = b1;
94
 
        b1.pb = b2;
95
 
        return b1;
96
 
    }
97
 
 
98
 
    public B
99
 
    D1AsB(Ice.Current current)
100
 
    {
101
 
        D1 d1 = new D1();
102
 
        d1.sb = "D1.sb";
103
 
        d1.sd1 = "D1.sd1";
104
 
        D2 d2 = new D2();
105
 
        d2.pb = d1;
106
 
        d2.sb = "D2.sb";
107
 
        d2.sd2 = "D2.sd2";
108
 
        d2.pd2 = d1;
109
 
        d1.pb = d2;
110
 
        d1.pd1 = d2;
111
 
        return d1;
112
 
    }
113
 
 
114
 
    public D1
115
 
    D1AsD1(Ice.Current current)
116
 
    {
117
 
        D1 d1 = new D1();
118
 
        d1.sb = "D1.sb";
119
 
        d1.sd1 = "D1.sd1";
120
 
        D2 d2 = new D2();
121
 
        d2.pb = d1;
122
 
        d2.sb = "D2.sb";
123
 
        d2.sd2 = "D2.sd2";
124
 
        d2.pd2 = d1;
125
 
        d1.pb = d2;
126
 
        d1.pd1 = d2;
127
 
        return d1;
128
 
    }
129
 
 
130
 
    public B
131
 
    D2AsB(Ice.Current current)
132
 
    {
133
 
        D2 d2 = new D2();
134
 
        d2.sb = "D2.sb";
135
 
        d2.sd2 = "D2.sd2";
136
 
        D1 d1 = new D1();
137
 
        d1.pb = d2;
138
 
        d1.sb = "D1.sb";
139
 
        d1.sd1 = "D1.sd1";
140
 
        d1.pd1 = d2;
141
 
        d2.pb = d1;
142
 
        d2.pd2 = d1;
143
 
        return d2;
144
 
    }
145
 
 
146
 
    public void
147
 
    paramTest1(BHolder p1, BHolder p2, Ice.Current current)
148
 
    {
149
 
        D1 d1 = new D1();
150
 
        d1.sb = "D1.sb";
151
 
        d1.sd1 = "D1.sd1";
152
 
        D2 d2 = new D2();
153
 
        d2.pb = d1;
154
 
        d2.sb = "D2.sb";
155
 
        d2.sd2 = "D2.sd2";
156
 
        d2.pd2 = d1;
157
 
        d1.pb = d2;
158
 
        d1.pd1 = d2;
159
 
        p1.value = d1;
160
 
        p2.value = d2;
161
 
    }
162
 
 
163
 
    public void
164
 
    paramTest2(BHolder p1, BHolder p2, Ice.Current current)
165
 
    {
166
 
        paramTest1(p2, p1, current);
167
 
    }
168
 
 
169
 
    public B
170
 
    paramTest3(BHolder p1, BHolder p2, Ice.Current current)
171
 
    {
172
 
        D2 d2 = new D2();
173
 
        d2.sb = "D2.sb (p1 1)";
174
 
        d2.pb = null;
175
 
        d2.sd2 = "D2.sd2 (p1 1)";
176
 
        p1.value = d2;
177
 
 
178
 
        D1 d1 = new D1();
179
 
        d1.sb = "D1.sb (p1 2)";
180
 
        d1.pb = null;
181
 
        d1.sd1 = "D1.sd2 (p1 2)";
182
 
        d1.pd1 = null;
183
 
        d2.pd2 = d1;
184
 
 
185
 
        D2 d4 = new D2();
186
 
        d4.sb = "D2.sb (p2 1)";
187
 
        d4.pb = null;
188
 
        d4.sd2 = "D2.sd2 (p2 1)";
189
 
        p2.value = d4;
190
 
 
191
 
        D1 d3 = new D1();
192
 
        d3.sb = "D1.sb (p2 2)";
193
 
        d3.pb = null;
194
 
        d3.sd1 = "D1.sd2 (p2 2)";
195
 
        d3.pd1 = null;
196
 
        d4.pd2 = d3;
197
 
 
198
 
        return d3;
199
 
    }
200
 
 
201
 
    public B
202
 
    paramTest4(BHolder p1, Ice.Current current)
203
 
    {
204
 
        D4 d4 = new D4();
205
 
        d4.sb = "D4.sb (1)";
206
 
        d4.pb = null;
207
 
        d4.p1 = new B();
208
 
        d4.p1.sb = "B.sb (1)";
209
 
        d4.p2 = new B();
210
 
        d4.p2.sb = "B.sb (2)";
211
 
        p1.value = d4;
212
 
        return d4.p2;
213
 
    }
214
 
 
215
 
    public B
216
 
    returnTest1(BHolder p1, BHolder p2, Ice.Current current)
217
 
    {
218
 
        Ice.Current c;
219
 
        paramTest1(p1, p2, current);
220
 
        return p1.value;
221
 
    }
222
 
 
223
 
    public B
224
 
    returnTest2(BHolder p1, BHolder p2, Ice.Current current)
225
 
    {
226
 
        Ice.Current c;
227
 
        paramTest1(p2, p1, current);
228
 
        return p1.value;
229
 
    }
230
 
 
231
 
    public B
232
 
    returnTest3(B p1, B p2, Ice.Current current)
233
 
    {
234
 
        return p1;
235
 
    }
236
 
 
237
 
    public SS
238
 
    sequenceTest(SS1 p1, SS2 p2, Ice.Current current)
239
 
    {
240
 
        SS ss = new SS();
241
 
        ss.c1 = p1;
242
 
        ss.c2 = p2;
243
 
        return ss;
244
 
    }
245
 
 
246
 
    public java.util.Map<Integer, B>
247
 
    dictionaryTest(java.util.Map _bin, BDictHolder bout, Ice.Current current)
248
 
    {
249
 
        // TODO: Fix the parameters and remove the cast below when the Java2 mapping is removed.
250
 
        java.util.Map<Integer, B> bin = (java.util.Map<Integer, B>)_bin;
251
 
        bout.value = new java.util.HashMap<Integer, B>();
252
 
        int i;
253
 
        for(i = 0; i < 10; ++i)
254
 
        {
255
 
            B b = bin.get(i);
256
 
            D2 d2 = new D2();
257
 
            d2.sb = b.sb;
258
 
            d2.pb = b.pb;
259
 
            d2.sd2 = "D2";
260
 
            d2.pd2 = d2;
261
 
            bout.value.put(i * 10, d2);
262
 
        }
263
 
        java.util.Map<Integer, B> r = new java.util.HashMap<Integer, B>();
264
 
        for(i = 0; i < 10; ++i)
265
 
        {
266
 
            String s = "D1." + new Integer(i * 20).toString();
267
 
            D1 d1 = new D1();
268
 
            d1.sb = s;
269
 
            d1.pb = (i == 0 ? null : r.get((i - 1) * 20));
270
 
            d1.sd1 = s;
271
 
            d1.pd1 = d1;
272
 
            r.put(i * 20, d1);
273
 
        }
274
 
        return r;
275
 
    }
276
 
 
277
 
    public void
278
 
    throwBaseAsBase(Ice.Current current)
279
 
        throws BaseException
280
 
    {
281
 
        BaseException be = new BaseException();
282
 
        be.sbe = "sbe";
283
 
        be.pb = new B();
284
 
        be.pb.sb = "sb";
285
 
        be.pb.pb = be.pb;
286
 
        throw be;
287
 
    }
288
 
 
289
 
    public void
290
 
    throwDerivedAsBase(Ice.Current current)
291
 
        throws BaseException
292
 
    {
293
 
        DerivedException de = new DerivedException();
294
 
        de.sbe = "sbe";
295
 
        de.pb = new B();
296
 
        de.pb.sb = "sb1";
297
 
        de.pb.pb = de.pb;
298
 
        de.sde = "sde1";
299
 
        de.pd1 = new D1();
300
 
        de.pd1.sb = "sb2";
301
 
        de.pd1.pb = de.pd1;
302
 
        de.pd1.sd1 = "sd2";
303
 
        de.pd1.pd1 = de.pd1;
304
 
        throw de;
305
 
    }
306
 
 
307
 
    public void
308
 
    throwDerivedAsDerived(Ice.Current current)
309
 
        throws DerivedException
310
 
    {
311
 
        DerivedException de = new DerivedException();
312
 
        de.sbe = "sbe";
313
 
        de.pb = new B();
314
 
        de.pb.sb = "sb1";
315
 
        de.pb.pb = de.pb;
316
 
        de.sde = "sde1";
317
 
        de.pd1 = new D1();
318
 
        de.pd1.sb = "sb2";
319
 
        de.pd1.pb = de.pd1;
320
 
        de.pd1.sd1 = "sd2";
321
 
        de.pd1.pd1 = de.pd1;
322
 
        throw de;
323
 
    }
324
 
 
325
 
    public void
326
 
    throwUnknownDerivedAsBase(Ice.Current current)
327
 
        throws BaseException
328
 
    {
329
 
        D2 d2 = new D2();
330
 
        d2.sb = "sb d2";
331
 
        d2.pb = d2;
332
 
        d2.sd2 = "sd2 d2";
333
 
        d2.pd2 = d2;
334
 
 
335
 
        UnknownDerivedException ude = new UnknownDerivedException();
336
 
        ude.sbe = "sbe";
337
 
        ude.pb = d2;
338
 
        ude.sude = "sude";
339
 
        ude.pd2 = d2;
340
 
        throw ude;
341
 
    }
342
 
 
343
 
    public void
344
 
    useForward(ForwardHolder f, Ice.Current current)
345
 
    {
346
 
        f.value = new Forward();
347
 
        f.value.h = new Hidden();
348
 
        f.value.h.f = f.value;
349
 
    }
350
 
 
351
 
    private Ice.ObjectAdapter _adapter;
352
 
}