summaryrefslogtreecommitdiff
path: root/csharp/test/Ice/metrics/MetricsAMDI.cs
blob: 09a224792dae7bd971ab5e1374464cf510ed1ebd (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
// **********************************************************************
//
// Copyright (c) 2003-2017 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.Collections.Generic;
using Test;

public sealed class ControllerI : ControllerDisp_
{
    public ControllerI(Ice.ObjectAdapter adapter)
    {
        _adapter = adapter;
    }

    override public void hold(Ice.Current current)
    {
        _adapter.hold();
        _adapter.waitForHold();
    }

    override public void resume(Ice.Current current)
    {
        _adapter.activate();
    }

    readonly private Ice.ObjectAdapter _adapter;
};

public sealed class MetricsI : MetricsDisp_
{
    override public void op_async(Test.AMD_Metrics_op cb, Ice.Current current)
    {
        cb.ice_response();
    }

    override public void fail_async(Test.AMD_Metrics_fail cb, Ice.Current current)
    { 
        current.con.close(true);
        cb.ice_response();
    }

    override public void opWithUserException_async(Test.AMD_Metrics_opWithUserException cb, Ice.Current current)
    {
        cb.ice_exception(new UserEx());
    }

    override public void opWithRequestFailedException_async(Test.AMD_Metrics_opWithRequestFailedException cb,
                                                            Ice.Current current)
    {
        cb.ice_exception(new Ice.ObjectNotExistException());
    }

    override public void opWithLocalException_async(Test.AMD_Metrics_opWithLocalException cb, Ice.Current current)
    {
        cb.ice_exception(new Ice.SyscallException());
    }

    override public void opWithUnknownException_async(Test.AMD_Metrics_opWithUnknownException cb, Ice.Current current)
    {
        cb.ice_exception(new ArgumentOutOfRangeException());
    }

    override public void opByteS_async(Test.AMD_Metrics_opByteS cb, byte[] bs, Ice.Current current)
    {
        cb.ice_response();
    }

    override public Ice.ObjectPrx getAdmin(Ice.Current current)
    {
        return current.adapter.getCommunicator().getAdmin();
    }

    override public void shutdown(Ice.Current current)
    {
        current.adapter.getCommunicator().shutdown();
    }
}