1 //
2 // Copyright (c) ZeroC, Inc. All rights reserved.
3 //
4 
5 package test.Ice.optional.lambda;
6 import java.io.PrintWriter;
7 
8 import test.Ice.optional.Test.*;
9 import test.Ice.optional.SerializableClass;
10 
11 public class AllTests
12 {
13     private static void
test(boolean b)14     test(boolean b)
15     {
16         if(!b)
17         {
18             throw new RuntimeException();
19         }
20     }
21 
22     private static class CallbackBase
23     {
CallbackBase()24         CallbackBase()
25         {
26             _called = false;
27         }
28 
check()29         public synchronized void check()
30         {
31             while(!_called)
32             {
33                 try
34                 {
35                     wait();
36                 }
37                 catch(InterruptedException ex)
38                 {
39                 }
40             }
41 
42             _called = false;
43             test(_value);
44             _value = false;
45         }
46 
called(boolean value)47         public synchronized void called(boolean value)
48         {
49             assert(!_called);
50             _value = value;
51             _called = true;
52             notify();
53         }
54 
55         private boolean _value;
56         private boolean _called;
57     }
58 
59     public static InitialPrx
allTests(test.TestHelper helper)60     allTests(test.TestHelper helper)
61     {
62         Ice.Communicator communicator = helper.communicator();
63         PrintWriter out = helper.getWriter();
64 
65         String ref = "initial:" + helper.getTestEndpoint(0);
66         Ice.ObjectPrx base = communicator.stringToProxy(ref);
67 
68         InitialPrx initial = InitialPrxHelper.uncheckedCast(base);
69 
70         out.print("testing optional parameters with async lambda callbacks... ");
71         out.flush();
72         final boolean reqParams = initial.supportsRequiredParams();
73 
74         final boolean supportsJavaSerializable = initial.supportsJavaSerializable();
75 
76         {
77             Ice.ByteOptional p1 = new Ice.ByteOptional((byte)56);
78             {
79                 final CallbackBase cb = new CallbackBase();
80                 initial.begin_opByte(p1.get(),
81                     (Ice.ByteOptional ret, Ice.ByteOptional p2) ->
82                         cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
83                     (Ice.Exception ex) -> cb.called(false));
84                 cb.check();
85             }
86 
87             {
88                 final CallbackBase cb = new CallbackBase();
89                 initial.begin_opByte(p1,
90                     (Ice.ByteOptional ret, Ice.ByteOptional p2) ->
91                         cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
92                     (Ice.Exception ex) -> cb.called(false));
93                 cb.check();
94             }
95         }
96 
97         {
98             Ice.BooleanOptional p1 = new Ice.BooleanOptional(true);
99             {
100                 final CallbackBase cb = new CallbackBase();
101                 initial.begin_opBool(p1.get(),
102                     (Ice.BooleanOptional ret, Ice.BooleanOptional p2) ->
103                         cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
104                     (Ice.Exception ex) -> cb.called(false));
105                 cb.check();
106             }
107 
108             {
109                 final CallbackBase cb = new CallbackBase();
110                 initial.begin_opBool(p1,
111                     (Ice.BooleanOptional ret, Ice.BooleanOptional p2) ->
112                         cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
113                     (Ice.Exception ex) -> cb.called(false));
114                 cb.check();
115             }
116         }
117 
118         {
119             Ice.ShortOptional p1 = new Ice.ShortOptional((short)56);
120             {
121                 final CallbackBase cb = new CallbackBase();
122                 initial.begin_opShort(p1.get(),
123                     (Ice.ShortOptional ret, Ice.ShortOptional p2) ->
124                         cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
125                     (Ice.Exception ex) -> cb.called(false));
126                 cb.check();
127             }
128             {
129                 final CallbackBase cb = new CallbackBase();
130                 initial.begin_opShort(p1,
131                     (Ice.ShortOptional ret, Ice.ShortOptional p2) ->
132                         cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
133                     (Ice.Exception ex) -> cb.called(false));
134                 cb.check();
135             }
136         }
137 
138         {
139             Ice.IntOptional p1 = new Ice.IntOptional(56);
140             {
141                 final CallbackBase cb = new CallbackBase();
142                 initial.begin_opInt(p1.get(),
143                     (Ice.IntOptional ret, Ice.IntOptional p2) ->
144                         cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
145                     (Ice.Exception ex) -> cb.called(false));
146                 cb.check();
147             }
148 
149             {
150                 final CallbackBase cb = new CallbackBase();
151                 initial.begin_opInt(p1,
152                     (Ice.IntOptional ret, Ice.IntOptional p2) ->
153                         cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
154                     (Ice.Exception ex) -> cb.called(false));
155                 cb.check();
156             }
157         }
158 
159         {
160             Ice.LongOptional p1 = new Ice.LongOptional(56);
161             {
162                 final CallbackBase cb = new CallbackBase();
163                 initial.begin_opLong(p1.get(),
164                     (Ice.LongOptional ret, Ice.LongOptional p2) ->
165                         cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
166                     (Ice.Exception ex) -> cb.called(false));
167                 cb.check();
168             }
169 
170             {
171                 final CallbackBase cb = new CallbackBase();
172                 initial.begin_opLong(p1,
173                     (Ice.LongOptional ret, Ice.LongOptional p2) ->
174                         cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
175                     (Ice.Exception ex) -> cb.called(false));
176                 cb.check();
177             }
178         }
179 
180         {
181             Ice.FloatOptional p1 = new Ice.FloatOptional(1.0f);
182             {
183                 final CallbackBase cb = new CallbackBase();
184                 initial.begin_opFloat(p1.get(),
185                     (Ice.FloatOptional ret, Ice.FloatOptional p2) ->
186                         cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
187                     (Ice.Exception ex) -> cb.called(false));
188                 cb.check();
189             }
190 
191             {
192                 final CallbackBase cb = new CallbackBase();
193                 initial.begin_opFloat(p1,
194                     (Ice.FloatOptional ret, Ice.FloatOptional p2) ->
195                         cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
196                     (Ice.Exception ex) -> cb.called(false));
197                 cb.check();
198             }
199         }
200 
201         {
202             Ice.DoubleOptional p1 = new Ice.DoubleOptional(1.0);
203             {
204                 final CallbackBase cb = new CallbackBase();
205                 initial.begin_opDouble(p1.get(),
206                     (Ice.DoubleOptional ret, Ice.DoubleOptional p2) ->
207                         cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
208                     (Ice.Exception ex) -> cb.called(false));
209                 cb.check();
210             }
211 
212             {
213                 final CallbackBase cb = new CallbackBase();
214                 initial.begin_opDouble(p1,
215                     (Ice.DoubleOptional ret, Ice.DoubleOptional p2) ->
216                         cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
217                     (Ice.Exception ex) -> cb.called(false));
218                 cb.check();
219             }
220         }
221 
222         {
223             Ice.Optional<String> p1 = new Ice.Optional<String>("test");
224             {
225                 final CallbackBase cb = new CallbackBase();
226                 initial.begin_opString(p1.get(),
227                     (Ice.Optional<String> ret, Ice.Optional<String> p2) ->
228                         cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
229                     (Ice.Exception ex) -> cb.called(false));
230                 cb.check();
231             }
232 
233             {
234                 final CallbackBase cb = new CallbackBase();
235                 initial.begin_opString(p1,
236                     (Ice.Optional<String> ret, Ice.Optional<String> p2) ->
237                         cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
238                     (Ice.Exception ex) -> cb.called(false));
239                 cb.check();
240             }
241         }
242 
243         {
244             Ice.Optional<MyEnum> p1 = new Ice.Optional<MyEnum>(MyEnum.MyEnumMember);
245             {
246                 final CallbackBase cb = new CallbackBase();
247                 initial.begin_opMyEnum(p1.get(),
248                     (Ice.Optional<MyEnum> ret, Ice.Optional<MyEnum> p2) ->
249                         cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
250                     (Ice.Exception ex) -> cb.called(false));
251                 cb.check();
252             }
253 
254             {
255                 final CallbackBase cb = new CallbackBase();
256                 initial.begin_opMyEnum(p1,
257                     (Ice.Optional<MyEnum> ret, Ice.Optional<MyEnum> p2) ->
258                         cb.called(ret.isSet() && p2.isSet() && ret.get() == p2.get() && ret.get() == p1.get()),
259                     (Ice.Exception ex) -> cb.called(false));
260                 cb.check();
261             }
262         }
263 
264         {
265             Ice.Optional<SmallStruct> p1 = new Ice.Optional<SmallStruct>(new SmallStruct((byte)56));
266             {
267                 final CallbackBase cb = new CallbackBase();
268                 initial.begin_opSmallStruct(p1.get(),
269                     (Ice.Optional<SmallStruct> ret, Ice.Optional<SmallStruct> p2) ->
270                         cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
271                     (Ice.Exception ex) -> cb.called(false));
272                 cb.check();
273             }
274 
275             {
276                 final CallbackBase cb = new CallbackBase();
277                 initial.begin_opSmallStruct(p1,
278                     (Ice.Optional<SmallStruct> ret, Ice.Optional<SmallStruct> p2) ->
279                         cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
280                     (Ice.Exception ex) -> cb.called(false));
281                 cb.check();
282             }
283         }
284 
285         {
286             Ice.Optional<FixedStruct> p1 = new Ice.Optional<FixedStruct>(new FixedStruct((byte)56));
287             {
288                 final CallbackBase cb = new CallbackBase();
289                 initial.begin_opFixedStruct(p1.get(),
290                     (Ice.Optional<FixedStruct> ret, Ice.Optional<FixedStruct> p2) ->
291                         cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
292                     (Ice.Exception ex) -> cb.called(false));
293                 cb.check();
294             }
295 
296             {
297                 final CallbackBase cb = new CallbackBase();
298                 initial.begin_opFixedStruct(p1,
299                     (Ice.Optional<FixedStruct> ret, Ice.Optional<FixedStruct> p2) ->
300                         cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
301                     (Ice.Exception ex) -> cb.called(false));
302                 cb.check();
303             }
304         }
305 
306         {
307             Ice.Optional<VarStruct> p1 = new Ice.Optional<VarStruct>(new VarStruct("test"));
308             {
309                 final CallbackBase cb = new CallbackBase();
310                 initial.begin_opVarStruct(p1.get(),
311                     (Ice.Optional<VarStruct> ret, Ice.Optional<VarStruct> p2) ->
312                         cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
313                     (Ice.Exception ex) -> cb.called(false));
314                 cb.check();
315             }
316 
317             {
318                 final CallbackBase cb = new CallbackBase();
319                 initial.begin_opVarStruct(p1,
320                     (Ice.Optional<VarStruct> ret, Ice.Optional<VarStruct> p2) ->
321                         cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
322                     (Ice.Exception ex) -> cb.called(false));
323                 cb.check();
324             }
325         }
326 
327         {
328             Ice.Optional<OneOptional> p1 = new Ice.Optional<OneOptional>(new OneOptional(58));
329             {
330                 final CallbackBase cb = new CallbackBase();
331                 initial.begin_opOneOptional(p1.get(),
332                     (Ice.Optional<OneOptional> ret, Ice.Optional<OneOptional> p2) ->
333                         cb.called(ret.isSet() && p2.isSet() && ret.get().getA() == p2.get().getA() &&
334                                 ret.get().getA() == p1.get().getA()),
335                     (Ice.Exception ex) -> cb.called(false));
336                 cb.check();
337             }
338 
339             {
340                 final CallbackBase cb = new CallbackBase();
341                 initial.begin_opOneOptional(p1,
342                     (Ice.Optional<OneOptional> ret, Ice.Optional<OneOptional> p2) ->
343                         cb.called(ret.isSet() && p2.isSet() && ret.get().getA() == p2.get().getA() &&
344                                 ret.get().getA() == p1.get().getA()),
345                     (Ice.Exception ex) -> cb.called(false));
346                 cb.check();
347             }
348         }
349 
350         {
351             Ice.Optional<OneOptionalPrx> p1 = new Ice.Optional<OneOptionalPrx>(
352                 OneOptionalPrxHelper.uncheckedCast(communicator.stringToProxy("test")));
353             {
354                 final CallbackBase cb = new CallbackBase();
355                 initial.begin_opOneOptionalProxy(p1.get(),
356                     (Ice.Optional<OneOptionalPrx> ret, Ice.Optional<OneOptionalPrx> p2) ->
357                         cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
358                     (Ice.Exception ex) -> cb.called(false));
359                 cb.check();
360             }
361 
362             {
363                 final CallbackBase cb = new CallbackBase();
364                 initial.begin_opOneOptionalProxy(p1,
365                     (Ice.Optional<OneOptionalPrx> ret, Ice.Optional<OneOptionalPrx> p2) ->
366                         cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
367                     (Ice.Exception ex) -> cb.called(false));
368                 cb.check();
369             }
370         }
371 
372         {
373             Ice.Optional<byte[]> p1 = new Ice.Optional<byte[]>(new byte[100]);
374             java.util.Arrays.fill(p1.get(), (byte)56);
375 
376             {
377                 final CallbackBase cb = new CallbackBase();
378                 initial.begin_opByteSeq(p1.get(),
379                     (Ice.Optional<byte[]> ret, Ice.Optional<byte[]> p2) ->
380                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
381                                 java.util.Arrays.equals(ret.get(), p1.get())),
382                     (Ice.Exception ex) -> cb.called(false));
383                 cb.check();
384             }
385 
386             {
387                 final CallbackBase cb = new CallbackBase();
388                 initial.begin_opByteSeq(p1,
389                     (Ice.Optional<byte[]> ret, Ice.Optional<byte[]> p2) ->
390                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
391                                 java.util.Arrays.equals(ret.get(), p1.get())),
392                     (Ice.Exception ex) -> cb.called(false));
393                 cb.check();
394             }
395         }
396 
397         {
398             Ice.Optional<boolean[]> p1 = new Ice.Optional<boolean[]>(new boolean[100]);
399             java.util.Arrays.fill(p1.get(), true);
400             {
401                 final CallbackBase cb = new CallbackBase();
402                 initial.begin_opBoolSeq(p1.get(),
403                     (Ice.Optional<boolean[]> ret, Ice.Optional<boolean[]> p2) ->
404                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
405                                 java.util.Arrays.equals(ret.get(), p1.get())),
406                     (Ice.Exception ex) -> cb.called(false));
407                 cb.check();
408             }
409 
410             {
411                 final CallbackBase cb = new CallbackBase();
412                 initial.begin_opBoolSeq(p1,
413                     (Ice.Optional<boolean[]> ret, Ice.Optional<boolean[]> p2) ->
414                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
415                                 java.util.Arrays.equals(ret.get(), p1.get())),
416                     (Ice.Exception ex) -> cb.called(false));
417                 cb.check();
418             }
419         }
420 
421         {
422             Ice.Optional<short[]> p1 = new Ice.Optional<short[]>(new short[100]);
423             java.util.Arrays.fill(p1.get(), (short)56);
424             {
425                 final CallbackBase cb = new CallbackBase();
426                 initial.begin_opShortSeq(p1.get(),
427                     (Ice.Optional<short[]> ret, Ice.Optional<short[]> p2) ->
428                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
429                                 java.util.Arrays.equals(ret.get(), p1.get())),
430                     (Ice.Exception ex) -> cb.called(false));
431                 cb.check();
432             }
433 
434             {
435                 final CallbackBase cb = new CallbackBase();
436                 initial.begin_opShortSeq(p1,
437                     (Ice.Optional<short[]> ret, Ice.Optional<short[]> p2) ->
438                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
439                                 java.util.Arrays.equals(ret.get(), p1.get())),
440                     (Ice.Exception ex) -> cb.called(false));
441                 cb.check();
442             }
443         }
444 
445         {
446             Ice.Optional<int[]> p1 = new Ice.Optional<int[]>(new int[100]);
447             java.util.Arrays.fill(p1.get(), 56);
448             {
449                 final CallbackBase cb = new CallbackBase();
450                 initial.begin_opIntSeq(p1.get(),
451                     (Ice.Optional<int[]> ret, Ice.Optional<int[]> p2) ->
452                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
453                                 java.util.Arrays.equals(ret.get(), p1.get())),
454                     (Ice.Exception ex) -> cb.called(false));
455                 cb.check();
456             }
457 
458             {
459                 final CallbackBase cb = new CallbackBase();
460                 initial.begin_opIntSeq(p1,
461                     (Ice.Optional<int[]> ret, Ice.Optional<int[]> p2) ->
462                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
463                             java.util.Arrays.equals(ret.get(), p1.get())),
464                     (Ice.Exception ex) -> cb.called(false));
465                 cb.check();
466             }
467         }
468 
469         {
470             Ice.Optional<long[]> p1 = new Ice.Optional<long[]>(new long[100]);
471             java.util.Arrays.fill(p1.get(), 56);
472             {
473                 final CallbackBase cb = new CallbackBase();
474                 initial.begin_opLongSeq(p1.get(),
475                     (Ice.Optional<long[]> ret, Ice.Optional<long[]> p2) ->
476                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
477                             java.util.Arrays.equals(ret.get(), p1.get())),
478                     (Ice.Exception ex) -> cb.called(false));
479                 cb.check();
480             }
481 
482             {
483                 final CallbackBase cb = new CallbackBase();
484                 initial.begin_opLongSeq(p1,
485                     (Ice.Optional<long[]> ret, Ice.Optional<long[]> p2) ->
486                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
487                             java.util.Arrays.equals(ret.get(), p1.get())),
488                     (Ice.Exception ex) -> cb.called(false));
489                 cb.check();
490             }
491         }
492 
493         {
494             Ice.Optional<float[]> p1 = new Ice.Optional<float[]>(new float[100]);
495             java.util.Arrays.fill(p1.get(), 1.0f);
496             {
497                 final CallbackBase cb = new CallbackBase();
498                 initial.begin_opFloatSeq(p1.get(),
499                     (Ice.Optional<float[]> ret, Ice.Optional<float[]> p2) ->
500                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
501                             java.util.Arrays.equals(ret.get(), p1.get())),
502                     (Ice.Exception ex) -> cb.called(false));
503                 cb.check();
504             }
505 
506             {
507                 CallbackBase cb = new CallbackBase();
508                 initial.begin_opFloatSeq(p1,
509                     (Ice.Optional<float[]> ret, Ice.Optional<float[]> p2) ->
510                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
511                             java.util.Arrays.equals(ret.get(), p1.get())),
512                     (Ice.Exception ex) -> cb.called(false));
513                 cb.check();
514             }
515         }
516 
517         {
518             Ice.Optional<double[]> p1 = new Ice.Optional<double[]>(new double[100]);
519             java.util.Arrays.fill(p1.get(), 1.0);
520             {
521                 final CallbackBase cb = new CallbackBase();
522                 initial.begin_opDoubleSeq(p1.get(),
523                     (Ice.Optional<double[]> ret, Ice.Optional<double[]> p2) ->
524                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
525                             java.util.Arrays.equals(ret.get(), p1.get())),
526                     (Ice.Exception ex) -> cb.called(false));
527                 cb.check();
528             }
529 
530             {
531                 CallbackBase cb = new CallbackBase();
532                 initial.begin_opDoubleSeq(p1,
533                     (Ice.Optional<double[]> ret, Ice.Optional<double[]> p2) ->
534                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
535                             java.util.Arrays.equals(ret.get(), p1.get())),
536                     (Ice.Exception ex) -> cb.called(false));
537                 cb.check();
538             }
539         }
540 
541         {
542             Ice.Optional<String[]> p1 = new Ice.Optional<String[]>(new String[10]);
543             java.util.Arrays.fill(p1.get(), "test");
544             {
545                 final CallbackBase cb = new CallbackBase();
546                 initial.begin_opStringSeq(p1.get(),
547                     (Ice.Optional<String[]> ret, Ice.Optional<String[]> p2) ->
548                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
549                             java.util.Arrays.equals(ret.get(), p1.get())),
550                     (Ice.Exception ex) -> cb.called(false));
551                 cb.check();
552             }
553 
554             {
555                 final CallbackBase cb = new CallbackBase();
556                 initial.begin_opStringSeq(p1,
557                     (Ice.Optional<String[]> ret, Ice.Optional<String[]> p2) ->
558                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
559                             java.util.Arrays.equals(ret.get(), p1.get())),
560                     (Ice.Exception ex) -> cb.called(false));
561                 cb.check();
562             }
563         }
564 
565         {
566             Ice.Optional<SmallStruct[]> p1 = new Ice.Optional<SmallStruct[]>();
567             p1.set(new SmallStruct[10]);
568             for(int i = 0; i < p1.get().length; ++i)
569             {
570                 p1.get()[i] = new SmallStruct();
571             }
572 
573             {
574                 final CallbackBase cb = new CallbackBase();
575                 initial.begin_opSmallStructSeq(p1.get(),
576                     (Ice.Optional<SmallStruct[]> ret, Ice.Optional<SmallStruct[]> p2) ->
577                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
578                             java.util.Arrays.equals(ret.get(), p1.get())),
579                     (Ice.Exception ex) -> cb.called(false));
580                 cb.check();
581             }
582 
583             {
584                 final CallbackBase cb = new CallbackBase();
585                 initial.begin_opSmallStructSeq(p1,
586                     (Ice.Optional<SmallStruct[]> ret, Ice.Optional<SmallStruct[]> p2) ->
587                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
588                             java.util.Arrays.equals(ret.get(), p1.get())),
589                     (Ice.Exception ex) -> cb.called(false));
590                 cb.check();
591             }
592         }
593 
594         {
595             Ice.Optional<java.util.List<SmallStruct>> p1 = new Ice.Optional<java.util.List<SmallStruct>>();
596             p1.set(new java.util.ArrayList<SmallStruct>());
597             for(int i = 0; i < 10; ++i)
598             {
599                 p1.get().add(new SmallStruct());
600             }
601 
602             {
603                 final CallbackBase cb = new CallbackBase();
604                 initial.begin_opSmallStructList(p1.get(),
605                     (Ice.Optional<java.util.List<SmallStruct>> ret, Ice.Optional<java.util.List<SmallStruct>> p2) ->
606                         cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
607                     (Ice.Exception ex) -> cb.called(false));
608                 cb.check();
609             }
610 
611             {
612                 CallbackBase cb = new CallbackBase();
613                 initial.begin_opSmallStructList(p1,
614                     (Ice.Optional<java.util.List<SmallStruct>> ret, Ice.Optional<java.util.List<SmallStruct>> p2) ->
615                         cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
616                     (Ice.Exception ex) -> cb.called(false));
617                 cb.check();
618             }
619         }
620 
621         {
622             Ice.Optional<FixedStruct[]> p1 = new Ice.Optional<FixedStruct[]>();
623             p1.set(new FixedStruct[10]);
624             for(int i = 0; i < p1.get().length; ++i)
625             {
626                 p1.get()[i] = new FixedStruct();
627             }
628 
629             {
630                 final CallbackBase cb = new CallbackBase();
631                 initial.begin_opFixedStructSeq(p1.get(),
632                     (Ice.Optional<FixedStruct[]> ret, Ice.Optional<FixedStruct[]> p2) ->
633                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
634                             java.util.Arrays.equals(ret.get(), p1.get())),
635                     (Ice.Exception ex) -> cb.called(false));
636                 cb.check();
637             }
638 
639             {
640                 final CallbackBase cb = new CallbackBase();
641                 initial.begin_opFixedStructSeq(p1,
642                     (Ice.Optional<FixedStruct[]> ret, Ice.Optional<FixedStruct[]> p2) ->
643                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
644                             java.util.Arrays.equals(ret.get(), p1.get())),
645                     (Ice.Exception ex) -> cb.called(false));
646                 cb.check();
647             }
648         }
649 
650         {
651             Ice.Optional<java.util.List<FixedStruct>> p1 = new Ice.Optional<java.util.List<FixedStruct>>();
652             p1.set(new java.util.ArrayList<FixedStruct>());
653             for(int i = 0; i < 10; ++i)
654             {
655                 p1.get().add(new FixedStruct());
656             }
657 
658             {
659                 final CallbackBase cb = new CallbackBase();
660                 initial.begin_opFixedStructList(p1.get(),
661                     (Ice.Optional<java.util.List<FixedStruct>> ret, Ice.Optional<java.util.List<FixedStruct>> p2) ->
662                         cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
663                     (Ice.Exception ex) -> cb.called(false));
664                 cb.check();
665             }
666 
667             {
668                 final CallbackBase cb = new CallbackBase();
669                 initial.begin_opFixedStructList(p1,
670                     (Ice.Optional<java.util.List<FixedStruct>> ret, Ice.Optional<java.util.List<FixedStruct>> p2) ->
671                         cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
672                     (Ice.Exception ex) -> cb.called(false));
673                 cb.check();
674             }
675         }
676 
677         {
678             Ice.Optional<VarStruct[]> p1 = new Ice.Optional<VarStruct[]>();
679             p1.set(new VarStruct[10]);
680             for(int i = 0; i < p1.get().length; ++i)
681             {
682                 p1.get()[i] = new VarStruct("");
683             }
684 
685             {
686                 final CallbackBase cb = new CallbackBase();
687                 initial.begin_opVarStructSeq(p1.get(),
688                     (Ice.Optional<VarStruct[]> ret, Ice.Optional<VarStruct[]> p2) ->
689                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
690                             java.util.Arrays.equals(ret.get(), p1.get())),
691                     (Ice.Exception ex) -> cb.called(false));
692                 cb.check();
693             }
694 
695             {
696                 final CallbackBase cb = new CallbackBase();
697                 initial.begin_opVarStructSeq(p1,
698                     (Ice.Optional<VarStruct[]> ret, Ice.Optional<VarStruct[]> p2) ->
699                         cb.called(ret.isSet() && p2.isSet() && java.util.Arrays.equals(ret.get(), p2.get()) &&
700                             java.util.Arrays.equals(ret.get(), p1.get())),
701                     (Ice.Exception ex) -> cb.called(false));
702                 cb.check();
703             }
704         }
705 
706         if(supportsJavaSerializable)
707         {
708             Ice.Optional<SerializableClass> p1 = new Ice.Optional<SerializableClass>(new SerializableClass(58));
709             {
710                 final CallbackBase cb = new CallbackBase();
711                 initial.begin_opSerializable(p1.get(),
712                     (Ice.Optional<SerializableClass> ret, Ice.Optional<SerializableClass> p2) ->
713                         cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
714                     (Ice.Exception ex) -> cb.called(false));
715                 cb.check();
716             }
717 
718             {
719                 final CallbackBase cb = new CallbackBase();
720                 initial.begin_opSerializable(p1,
721                     (Ice.Optional<SerializableClass> ret, Ice.Optional<SerializableClass> p2) ->
722                         cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
723                     (Ice.Exception ex) -> cb.called(false));
724                 cb.check();
725             }
726         }
727 
728         {
729             Ice.Optional<java.util.Map<Integer, Integer>> p1 = new Ice.Optional<java.util.Map<Integer, Integer>>();
730             p1.set(new java.util.HashMap<Integer, Integer>());
731             p1.get().put(1, 2);
732             p1.get().put(2, 3);
733 
734             {
735                 final CallbackBase cb = new CallbackBase();
736                 initial.begin_opIntIntDict(p1.get(),
737                     (Ice.Optional<java.util.Map<Integer, Integer>> ret,
738                     Ice.Optional<java.util.Map<Integer, Integer>> p2) ->
739                         cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
740                     (Ice.Exception ex) -> cb.called(false));
741                 cb.check();
742             }
743 
744             {
745                 final CallbackBase cb = new CallbackBase();
746                 initial.begin_opIntIntDict(p1,
747                     (Ice.Optional<java.util.Map<Integer, Integer>> ret,
748                     Ice.Optional<java.util.Map<Integer, Integer>> p2) ->
749                         cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
750                     (Ice.Exception ex) -> cb.called(false));
751                 cb.check();
752             }
753         }
754 
755         {
756             Ice.Optional<java.util.Map<String, Integer>> p1 = new Ice.Optional<java.util.Map<String, Integer>>();
757             p1.set(new java.util.HashMap<String, Integer>());
758             p1.get().put("1", 1);
759             p1.get().put("2", 2);
760 
761             {
762                 final CallbackBase cb = new CallbackBase();
763                 initial.begin_opStringIntDict(p1.get(),
764                     (Ice.Optional<java.util.Map<String, Integer>> ret,
765                     Ice.Optional<java.util.Map<String, Integer>> p2) ->
766                         cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
767                     (Ice.Exception ex) -> cb.called(false));
768                 cb.check();
769             }
770 
771             {
772                 final CallbackBase cb = new CallbackBase();
773                 initial.begin_opStringIntDict(p1,
774                     (Ice.Optional<java.util.Map<String, Integer>> ret,
775                     Ice.Optional<java.util.Map<String, Integer>> p2) ->
776                         cb.called(ret.isSet() && p2.isSet() && ret.get().equals(p2.get()) && ret.get().equals(p1.get())),
777                     (Ice.Exception ex) -> cb.called(false));
778                 cb.check();
779             }
780         }
781 
782         out.println("ok");
783 
784         return initial;
785     }
786 }
787