summaryrefslogtreecommitdiff
path: root/matlab/test/Ice/operations/OnewaysAMI.m
blob: 2db74d9fb5b0c8d87bc974d39675835c1f7536c1 (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
%
% Copyright (c) ZeroC, Inc. All rights reserved.
%

classdef OnewaysAMI
    methods(Static)
        function onewaysAMI(p)
            import Test.*;

            p = p.ice_oneway();

            call(p, 'ice_ping');

            try
                p.ice_isAAsync(MyClassPrx.ice_staticId());
            catch ex
                assert(isa(ex, 'Ice.TwowayOnlyException'));
            end

            try
                p.ice_idAsync();
            catch ex
                assert(isa(ex, 'Ice.TwowayOnlyException'));
            end

            try
                p.ice_idsAsync();
            catch ex
                assert(isa(ex, 'Ice.TwowayOnlyException'));
            end

            call(p, 'opVoid');

            call(p, 'opIdempotent');

            call(p, 'opNonmutating');

            try
                p.opByteAsync(hex2dec('ff'), hex2dec('0f'));
            catch ex
                assert(isa(ex, 'Ice.TwowayOnlyException'));
            end
        end
    end
end

function varargout = call(p, op, varargin)
    try
        name = [op, 'Async'];
        future = p.(name)(varargin{:});
        assert(strcmp(future.Operation, op));
        assert(future.wait());
        assert(strcmp(future.State, 'finished'));
    catch ex
        disp(getReport(ex, 'extended'));
        assert(false);
    end
end