summaryrefslogtreecommitdiff
path: root/java/test/Slice/keyword/Client.java
blob: e79338a3d2b754887752b6dd5cee2c4ebeeb4ad0 (plain)
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
// **********************************************************************
//
// Copyright (c) 2003-2014 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.Slice.keyword;
import test.Slice.keyword._abstract.AMD_catch_checkedCast;
import test.Slice.keyword._abstract._assert;
import test.Slice.keyword._abstract._break;
import test.Slice.keyword._abstract._catch;
import test.Slice.keyword._abstract._catchDisp;
import test.Slice.keyword._abstract._default;
import test.Slice.keyword._abstract._defaultDisp;
import test.Slice.keyword._abstract._else;
import test.Slice.keyword._abstract._finalize;
import test.Slice.keyword._abstract._hashCode;
import test.Slice.keyword._abstract._import;
import test.Slice.keyword._abstract._new;
import test.Slice.keyword._abstract._switch;
import test.Slice.keyword._abstract.catchPrx;
import test.Slice.keyword._abstract.defaultPrx;
import test.Slice.keyword._abstract.defaultPrxHelper;
import test.Slice.keyword._abstract.elsePrx;
import test.Slice.keyword._abstract.finalizePrx;
import test.Slice.keyword._abstract.forHolder;
import test.Slice.keyword._abstract.gotoHolder;

public class Client
{
    static public class catchI extends _catchDisp
    {
        public
        catchI()
        {
        }
        
        public void
        checkedCast_async(AMD_catch_checkedCast __cb, int _clone, Ice.Current __current)
        {
            int _continue = 0;
            __cb.ice_response(_continue);
        }
    }

    static public class defaultI extends _defaultDisp
    {
        public
        defaultI()
        {
        }

        public void
        _do(Ice.Current __current)
        {
            assert __current.operation.equals("do");
        }
    }

    static public class elseI extends _else
    {
        public
        elseI()
        {
        }

        public void
        foo(defaultPrx _equals, Ice.IntHolder _final, Ice.Current __current)
        {
        }
    }

    static public class newI implements _new
    {
        public
        newI()
        {
        }

        public _assert
        _notify(_break _notifyAll, _else _null, _finalize _package,
                elsePrx _private, finalizePrx _protected,
                catchPrx _public, defaultPrx _return, int _static, int _strictfp, int _super)
            throws _hashCode, _import
        {
            return null;
        }
    }

    static public class finalizeI extends _finalize
    {
        public
        finalizeI()
        {
        }

        public void
        checkedCast_async(AMD_catch_checkedCast __cb, int _clone, Ice.Current __current)
        {
            int _continue = 0;
            __cb.ice_response(_continue);
        }

        public void
        _do(Ice.Current __current)
        {
        }

        public void
        foo(defaultPrx _equals, Ice.IntHolder _final, Ice.Current __current)
        {
        }
    }

    //
    // This section of the test is present to ensure that the C++ types
    // are named correctly. It is not expected to run.
    //
    private static void
    testtypes()
    {
        _assert v = _assert._boolean;
        _break b = new _break();
        b._case = 0;
        catchPrx c = null;
        c._checkedCast(0, new Ice.IntHolder());
        _catch c1 = new catchI();
        defaultPrx d = null;
        d._do();
        _default d1 = new defaultI();
        elsePrx e;
        _else e1 = new elseI();
        finalizePrx f = null;
        f._checkedCast(0, new Ice.IntHolder());
        f._do();
        _finalize f1 = new finalizeI();
        forHolder g;
        gotoHolder h;
        _hashCode i = new _hashCode();
        i._if = 0;
        _import j = new _import();
        j._if = 0;
        j._instanceof = 1;
        j._native = 2;
        _new k = new newI();
        assert _switch.value == 0;
    }

    private static int
    run(String[] args, Ice.Communicator communicator)
    {
        Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
        adapter.add(new defaultI(), communicator.stringToIdentity("test"));
        adapter.activate();

        System.out.print("Testing operation name... ");
        System.out.flush();
        defaultPrx p = defaultPrxHelper.uncheckedCast(
            adapter.createProxy(communicator.stringToIdentity("test")));
        p._do();
        System.out.println("ok");

        return 0;
    }

    public static void
    main(String[] args)
    {
        int status = 0;
        Ice.Communicator communicator = null;

        try
        {
            //
            // In this test, we need at least two threads in the
            // client side thread pool for nested AMI.
            //
            Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
            Ice.InitializationData initData = new Ice.InitializationData();
            initData.properties = Ice.Util.createProperties(argsH);
            initData.properties.setProperty("Ice.Package._abstract", "test.Slice.keyword");
            initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2");
            initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0");
            initData.properties.setProperty("TestAdapter.Endpoints", "default -p 12010:udp");

            //
            // We must set MessageSizeMax to an explicit values,
            // because we run tests to check whether
            // Ice.MemoryLimitException is raised as expected.
            //
            initData.properties.setProperty("Ice.MessageSizeMax", "100");

            communicator = Ice.Util.initialize(argsH, initData);
            status = run(argsH.value, communicator);
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
            status = 1;
        }

        if(communicator != null)
        {
            try
            {
                communicator.destroy();
            }
            catch(Ice.LocalException ex)
            {
                ex.printStackTrace();
                status = 1;
            }
        }

        System.gc();
        System.exit(status);
    }
}