summaryrefslogtreecommitdiff
path: root/swift/test/Ice/slicing/exceptions/TestI.swift
blob: ac4bf2b25c70b5805e52515a513c5e019efe6b37 (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
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//

import Ice
import TestCommon

class TestI: TestIntf {
    var _helper: TestHelper

    init(_ helper: TestHelper) {
        _helper = helper
    }

    func baseAsBase(current _: Current) throws {
        throw Base(b: "Base.b")
    }

    func unknownDerivedAsBase(current _: Current) throws {
        throw UnknownDerived(b: "UnknownDerived.b", ud: "UnknownDerived.ud")
    }

    func knownDerivedAsBase(current _: Current) throws {
        throw KnownDerived(b: "KnownDerived.b", kd: "KnownDerived.kd")
    }

    func knownDerivedAsKnownDerived(current _: Current) throws {
        throw KnownDerived(b: "KnownDerived.b", kd: "KnownDerived.kd")
    }

    func unknownIntermediateAsBase(current _: Current) throws {
        throw UnknownIntermediate(b: "UnknownIntermediate.b", ui: "UnknownIntermediate.ui")
    }

    func knownIntermediateAsBase(current _: Current) throws {
        throw KnownIntermediate(b: "KnownIntermediate.b", ki: "KnownIntermediate.ki")
    }

    func knownMostDerivedAsBase(current _: Current) throws {
        throw KnownMostDerived(b: "KnownMostDerived.b", ki: "KnownMostDerived.ki", kmd: "KnownMostDerived.kmd")
    }

    func knownIntermediateAsKnownIntermediate(current _: Current) throws {
        throw KnownIntermediate(b: "KnownIntermediate.b", ki: "KnownIntermediate.ki")
    }

    func knownMostDerivedAsKnownIntermediate(current _: Current) throws {
        throw KnownMostDerived(b: "KnownMostDerived.b", ki: "KnownMostDerived.ki", kmd: "KnownMostDerived.kmd")
    }

    func knownMostDerivedAsKnownMostDerived(current _: Current) throws {
        throw KnownMostDerived(b: "KnownMostDerived.b",
                               ki: "KnownMostDerived.ki",
                               kmd: "KnownMostDerived.kmd")
    }

    func unknownMostDerived1AsBase(current _: Current) throws {
        throw UnknownMostDerived1(b: "UnknownMostDerived1.b",
                                  ki: "UnknownMostDerived1.ki",
                                  umd1: "UnknownMostDerived1.umd1")
    }

    func unknownMostDerived1AsKnownIntermediate(current _: Current) throws {
        throw UnknownMostDerived1(b: "UnknownMostDerived1.b",
                                  ki: "UnknownMostDerived1.ki",
                                  umd1: "UnknownMostDerived1.umd1")
    }

    func unknownMostDerived2AsBase(current _: Current) throws {
        throw UnknownMostDerived2(b: "UnknownMostDerived2.b",
                                  ui: "UnknownMostDerived2.ui",
                                  umd2: "UnknownMostDerived2.umd2")
    }

    func unknownMostDerived2AsBaseCompact(current _: Current) throws {
        throw UnknownMostDerived2(b: "UnknownMostDerived2.b",
                                  ui: "UnknownMostDerived2.ui",
                                  umd2: "UnknownMostDerived2.umd2")
    }

    func knownPreservedAsBase(current _: Current) throws {
        throw KnownPreservedDerived(b: "base",
                                    kp: "preserved",
                                    kpd: "derived")
    }

    func knownPreservedAsKnownPreserved(current _: Current) throws {
        throw KnownPreservedDerived(b: "base",
                                    kp: "preserved",
                                    kpd: "derived")
    }

    func relayKnownPreservedAsBase(r: RelayPrx?, current: Current) throws {
        let p = try uncheckedCast(prx: current.con!.createProxy(r!.ice_getIdentity()),
                                  type: RelayPrx.self)
        try p.knownPreservedAsBase()
        try _helper.test(false)
    }

    func relayKnownPreservedAsKnownPreserved(r: RelayPrx?, current: Current) throws {
        let p = try uncheckedCast(prx: current.con!.createProxy(r!.ice_getIdentity()),
                                  type: RelayPrx.self)
        try p.knownPreservedAsKnownPreserved()
        try _helper.test(false)
    }

    func unknownPreservedAsBase(current _: Current) throws {
        let ex = SPreserved2()
        ex.b = "base"
        ex.kp = "preserved"
        ex.kpd = "derived"
        ex.p1 = SPreservedClass(bc: "bc", spc: "spc")
        ex.p2 = ex.p1
        throw ex
    }

    func unknownPreservedAsKnownPreserved(current _: Current) throws {
        let ex = SPreserved2()
        ex.b = "base"
        ex.kp = "preserved"
        ex.kpd = "derived"
        ex.p1 = SPreservedClass(bc: "bc", spc: "spc")
        ex.p2 = ex.p1
        throw ex
    }

    func relayUnknownPreservedAsBase(r: RelayPrx?, current: Current) throws {
        let p = try uncheckedCast(prx: current.con!.createProxy(r!.ice_getIdentity()),
                                  type: RelayPrx.self)
        try p.unknownPreservedAsBase()
        try _helper.test(false)
    }

    func relayUnknownPreservedAsKnownPreserved(r: RelayPrx?, current: Current) throws {
        let p = try uncheckedCast(prx: current.con!.createProxy(r!.ice_getIdentity()),
                                  type: RelayPrx.self)
        try p.unknownPreservedAsKnownPreserved()
        try _helper.test(false)
    }

    func shutdown(current: Current) throws {
        current.adapter!.getCommunicator().shutdown()
    }
}