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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
// **********************************************************************
//
// Copyright (c) 2003-2009 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.
//
// **********************************************************************
using System;
using System.Diagnostics;
using System.Collections.Generic;
public class Server
{
private static void test(bool b)
{
if(!b)
{
throw new System.Exception();
}
}
public sealed class caseI : @abstract.caseDisp_
{
public override void catch_async(@abstract.AMD_case_catch cb__, int @checked, Ice.Current current__)
{
int @continue = 0;
cb__.ice_response(@continue);
}
}
public sealed class decimalI : @abstract.decimalDisp_
{
public override void @default(Ice.Current current__)
{
}
}
public sealed class delegateI : @abstract.@delegate
{
public override void foo(@abstract.casePrx @else, out int @event, Ice.Current current__)
{
@event = 0;
}
}
public sealed class explicitI : @abstract.@explicit
{
public override void catch_async(@abstract.AMD_case_catch cb__, int @checked, Ice.Current current__)
{
int @continue = 0;
cb__.ice_response(@continue);
}
public override void @default(Ice.Current current)
{
test(current.operation == "default");
}
public override void foo(@abstract.casePrx @else, out int @event, Ice.Current current__)
{
@event = 0;
}
}
public sealed class implicitI : @abstract.@implicit
{
public @abstract.@as @in(@abstract.@break @internal, @abstract.@delegate @is, @abstract.@explicit @lock,
@abstract.casePrx @namespace, @abstract.decimalPrx @new, @abstract.delegatePrx @null,
@abstract.explicitPrx @operator, int @override, int @params, int @private)
{
return @abstract.@as.@base;
}
}
static void
testtypes()
{
@abstract.@as a = @abstract.@as.@base;
test(a == @abstract.@as.@base);
@abstract.@break b = new @abstract.@break();
b.@readonly = 0;
test(b.@readonly == 0);
@abstract.@case c = new caseI();
test(c != null);
@abstract.@casePrx c1 = null;
test(c1 == null);
int c2 = 0;
if(c1 != null)
{
c1.@catch(0, out c2);
}
@abstract.@decimal d = new decimalI();
test(d != null);
@abstract.@decimalPrx d1 = null;
if(d1 != null)
{
d1.@default();
}
test(d1 == null);
@abstract.@delegate e = new delegateI();
test(e != null);
@abstract.@delegatePrx e1 = null;
test(e1 == null);
@abstract.@explicit f = new explicitI();
test(f != null);
@abstract.@explicitPrx f1 = null;
if(f1 != null)
{
f1.@catch(0, out c2);
f1.@default();
}
test(f1 == null);
@abstract.@extern l = new @abstract.@extern();
test(l != null);
@abstract.@finally g = new @abstract.@finally();
test(g != null);
Dictionary<string, @abstract.@break> g2 = new Dictionary<string, @abstract.@break>();
test(g2 != null);
@abstract.@fixed h = new @abstract.@fixed();
h.@for = 0;
test(h != null);
@abstract.@foreach i = new @abstract.@foreach();
i.@for = 0;
i.@goto = 1;
i.@if = 2;
test(i != null);
@abstract.@implicit j = new implicitI();
test(j != null);
int k = @abstract.@protected.value;
test(k == 0);
}
private static int run(string[] args, Ice.Communicator communicator)
{
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
adapter.add(new decimalI(), communicator.stringToIdentity("test"));
adapter.activate();
Console.Out.Write("testing operation name... ");
Console.Out.Flush();
@abstract.@decimalPrx p = @abstract.@decimalPrxHelper.uncheckedCast(
adapter.createProxy(communicator.stringToIdentity("test")));
p.@default();
Console.Out.WriteLine("ok");
Console.Out.Write("testing types... ");
Console.Out.Flush();
testtypes();
Console.Out.WriteLine("ok");
return 0;
}
public static void Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
Debug.Listeners.Add(new ConsoleTraceListener());
try
{
Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties(ref args);
communicator = Ice.Util.initialize(ref args, initData);
status = run(args, communicator);
}
catch(System.Exception ex)
{
Console.Error.WriteLine(ex);
status = 1;
}
if(communicator != null)
{
try
{
communicator.destroy();
}
catch(Ice.LocalException ex)
{
Console.Error.WriteLine(ex);
status = 1;
}
}
if(status != 0)
{
System.Environment.Exit(status);
}
}
}
|