File: Client.py

package info (click to toggle)
zeroc-ice 3.7.10-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 75,704 kB
  • sloc: cpp: 356,894; java: 226,081; cs: 98,312; javascript: 35,027; python: 28,716; objc: 27,050; php: 7,526; ruby: 7,190; yacc: 2,949; ansic: 2,469; xml: 1,589; lex: 1,241; makefile: 472; sh: 52
file content (92 lines) | stat: -rwxr-xr-x 2,337 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/env python3
#
# Copyright (c) ZeroC, Inc. All rights reserved.
#

from TestHelper import TestHelper
TestHelper.loadSlice("Key.ice Clash.ice")
import sys
import Ice
import _and


class delI(_and._del):
    def _elifAsync(self, _else, current=None):
        pass


class execI(_and._exec):
    def _finally(self, current=None):
        assert current.operation == "finally"


class ifI(_and._if):
    def _elifAsync(self, _else, current=None):
        pass

    def _finally(self, current=None):
        pass

    def foo(self, _from, current=None):
        pass


class printI(_and._print):
    def _raise(self, _else, _return, _try, _while, _yield, _lambda, _or, _global):
        pass


def testtypes():
    sys.stdout.write("Testing generated type names... ")
    sys.stdout.flush()
    a = _and._assert._break
    b = _and._continue
    b._def = 0
    c = _and.delPrx.uncheckedCast(None)
    assert "_elif" in dir(_and.delPrx)
    c1 = delI()
    d = _and.execPrx.uncheckedCast(None)
    assert "_finally" in dir(_and.execPrx)
    d1 = execI()

    e1 = _and._for()
    f = _and.ifPrx.uncheckedCast(None)

    assert "_finally" in dir(_and.ifPrx)
    assert "_elif" in dir(_and.ifPrx)
    f1 = ifI()
    g =  _and._is()
    g._lamba = 0
    h = _and._not()
    h._lamba = 0
    h._or = 1
    h._pass = 2
    i = printI()
    j = _and._lambda;
    en = _and.EnumNone._None
    print("ok")


class Client(TestHelper):

    def run(self, args):
        properties = self.createTestProperties(args)
        #
        # Its possible to have batch oneway requests dispatched after the
        # adapter is deactivated due to thread scheduling so we supress
        # this warning.
        #
        properties.setProperty("Ice.Warn.Dispatch", "0")
        with self.initialize(properties=properties) as communicator:
            communicator.getProperties().setProperty("TestAdapter.Endpoints", "default")
            adapter = communicator.createObjectAdapter("TestAdapter")
            adapter.add(execI(), Ice.stringToIdentity("test"))
            adapter.activate()

            sys.stdout.write("Testing operation name... ")
            sys.stdout.flush()
            p = _and.execPrx.uncheckedCast(adapter.createProxy(Ice.stringToIdentity("test")))
            p._finally()
            print("ok")

            testtypes()