summaryrefslogtreecommitdiff
path: root/swift/test/Ice/proxy/TestAMDI.swift
blob: 8bf76da8809606d2d706b4ad8b0903887d0c2c23 (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
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
import Ice
import PromiseKit

final class MyDerivedClassI: ObjectI<MyDerivedClassTraits>, MyDerivedClass {
    var _ctx: [String: String]

    override init() {
        _ctx = [String: String]()
    }

    func echoAsync(obj: Ice.ObjectPrx?, current _: Ice.Current) -> PromiseKit.Promise<Ice.ObjectPrx?> {
        return Promise.value(obj)
    }

    func shutdownAsync(current: Ice.Current) -> PromiseKit.Promise<Void> {
        guard let adapter = current.adapter else {
            fatalError()
        }
        adapter.getCommunicator().shutdown()
        return Promise.value(())
    }

    func getContextAsync(current _: Ice.Current) -> PromiseKit.Promise<[String: String]> {
        return Promise.value(_ctx)
    }

    override func ice_isA(id: String, current: Ice.Current) throws -> Bool {
        _ctx = current.ctx
        return try super.ice_isA(id: id, current: current)
    }

    override func ice_ids(current: Ice.Current) throws -> [String] {
        _ctx = current.ctx
        return try super.ice_ids(current: current)
    }

    override func ice_id(current: Ice.Current) throws -> String {
        _ctx = current.ctx
        return try super.ice_id(current: current)
    }

    override func ice_ping(current: Ice.Current) {
        _ctx = current.ctx
    }
}