1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
// **********************************************************************
//
// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
package test.Ice.operations;
import java.io.PrintWriter;
import test.Ice.operations.Test.MyClassPrx;
import test.Ice.operations.Test.MyClassPrxHelper;
import test.Ice.operations.Test.MyDerivedClassPrx;
import test.Ice.operations.Test.MyDerivedClassPrxHelper;
public class AllTests
{
public static MyClassPrx
allTests(test.Util.Application app)
{
Ice.Communicator communicator = app.communicator();
PrintWriter out = app.getWriter();
String ref = "test:" + app.getTestEndpoint(0);
Ice.ObjectPrx base = communicator.stringToProxy(ref);
MyClassPrx cl = MyClassPrxHelper.checkedCast(base);
MyDerivedClassPrx derived = MyDerivedClassPrxHelper.checkedCast(cl);
out.print("testing twoway operations... ");
out.flush();
Twoways.twoways(app, cl);
Twoways.twoways(app, derived);
derived.opDerived();
out.println("ok");
out.print("testing oneway operations... ");
out.flush();
Oneways.oneways(app, cl);
out.println("ok");
out.print("testing twoway operations with AMI... ");
out.flush();
TwowaysAMI.twowaysAMI(app, cl);
TwowaysAMI.twowaysAMI(app, derived);
out.println("ok");
//
// Use reflection to load TwowaysLambdaAMI as that is only supported with Java >= 1.8
//
try
{
Class<?> cls = IceInternal.Util.findClass("test.Ice.operations.lambda.TwowaysLambdaAMI", null);
if(cls != null)
{
java.lang.reflect.Method twowaysLambdaAMI =
cls.getDeclaredMethod("twowaysLambdaAMI",
new Class<?>[]{test.Util.Application.class, MyClassPrx.class});
out.print("testing twoway operations with lambda AMI mapping... ");
out.flush();
twowaysLambdaAMI.invoke(null, app, cl);
twowaysLambdaAMI.invoke(null, app, derived);
out.println("ok");
}
}
catch(java.lang.NoSuchMethodException ex)
{
throw new RuntimeException(ex);
}
catch(java.lang.IllegalAccessException ex)
{
throw new RuntimeException(ex);
}
catch(java.lang.reflect.InvocationTargetException ex)
{
throw new RuntimeException(ex);
}
out.print("testing oneway operations with AMI... ");
out.flush();
OnewaysAMI.onewaysAMI(app, cl);
out.println("ok");
//
// Use reflection to load OnewaysLambdaAMI as that is only supported with Java >= 1.8
//
try
{
Class<?> cls = IceInternal.Util.findClass("test.Ice.operations.lambda.OnewaysLambdaAMI", null);
if(cls != null)
{
java.lang.reflect.Method onewaysLambdaAMI =
cls.getDeclaredMethod("onewaysLambdaAMI",
new Class<?>[]{test.Util.Application.class, MyClassPrx.class});
out.print("testing twoway operations with lambda AMI mapping... ");
out.flush();
onewaysLambdaAMI.invoke(null, app, cl);
onewaysLambdaAMI.invoke(null, app, derived);
out.println("ok");
}
}
catch(java.lang.NoSuchMethodException ex)
{
throw new RuntimeException(ex);
}
catch(java.lang.IllegalAccessException ex)
{
throw new RuntimeException(ex);
}
catch(java.lang.reflect.InvocationTargetException ex)
{
throw new RuntimeException(ex);
}
out.print("testing batch oneway operations... ");
out.flush();
BatchOneways.batchOneways(app, cl, out);
BatchOneways.batchOneways(app, derived, out);
out.println("ok");
out.print("testing batch AMI oneway operations... ");
out.flush();
BatchOnewaysAMI.batchOneways(cl, out);
BatchOnewaysAMI.batchOneways(derived, out);
out.println("ok");
return cl;
}
}
|