def setUp(self):
        self.ch = ConfigHolder()
        self.ch.set('serviceurl', endpoint)
        self.ch.set('verboseLevel', 3)

        self.client = Client(self.ch)
        self.client.login(username, password)
        self.ch.set('endpoint', endpoint)
        self.ch.set('session', self.client.get_session())
示例#2
0
def get_rtp_all(side_effect, no_block=False):
    ch = ConfigHolder()
    ch.set('noBlock', no_block)
    ch.set('timeout', 1)
    ch.set('verboseLevel', 3)
    ch.set('endpoint', 'https://foo.bar')
    Client._getRuntimeParameter = Mock(side_effect=side_effect)
    client = Client(ch)
    client.httpClient.getRuntimeParameter = Mock(side_effect=side_effect)
    return client.get_rtp_all('foo', 'bar')
示例#3
0
    def test_constructor(self):
        ch = ConfigHolder()
        ch.context = {}
        ch.options = {}
        ch.config = {}
        Client(ch)

        ch.context = {}
        ch.options = {}
        ch.config = {'endpoint': 'foo/bar'}
        c = Client(ch)
        assert c.ch.endpoint == c.ch.serviceurl == 'foo/bar'

        ch.context = {}
        ch.options = {}
        ch.config = {'serviceurl': 'bar/baz'}
        c = Client(ch)
        assert c.ch.serviceurl == 'bar/baz'
        assert not hasattr(c.ch, 'endpoint')
示例#4
0
    def doWork(self):
        ch = ConfigHolder(self.options)
        client = Client(ch)

        if self.options.cancel:
            client.cancel_abort()
        else:
            value = truncate_middle(Client.VALUE_LENGTH_LIMIT, self.reason,
                                    '\n(truncated)\n')
            client.setRuntimeParameter(NodeDecorator.ABORT_KEY, value)
示例#5
0
    def doWork(self):

        rvalue = ''.join([random.choice(string.ascii_letters + string.digits)
                          for _ in xrange(self.size)])

        if self.key is not None:
            ch = ConfigHolder(self.options)
            client = Client(ch)
            client.setRuntimeParameter(self.key, rvalue)

        print(rvalue)
示例#6
0
    def test_do_not_qualify_parameter(self):
        orch_node_name = NodeDecorator.orchestratorName + '-cloudX'
        orch_param = orch_node_name + \
                     NodeDecorator.NODE_PROPERTY_SEPARATOR + \
                     'foo'

        context = {NodeDecorator.NODE_INSTANCE_NAME_KEY: orch_node_name}
        ch = ConfigHolder(context=context,
                          config={
                              'bar': 'baz',
                              'endpoint': 'https://foo.bar'
                          })
        c = Client(ch)
        assert orch_param == c._qualifyKey(orch_param)
示例#7
0
 def doWork(self):
     ch = ConfigHolder(self.options,
                       context={'empty': None},
                       config={'empty': None})
     client = Client(ch)
     client.login(self.username, self.password)
示例#8
0
    def doWork(self):
        ch = ConfigHolder(self.options)
        client = Client(ch)

        client.cancel_abort()
示例#9
0
    def doWork(self):
        ch = ConfigHolder(self.options)
        client = Client(ch)

        client.terminateRun()
示例#10
0
 def _init_client(self):
     configHolder = ConfigHolder(self.options,
                                 context={'empty': None},
                                 config={'empty': None})
     configHolder.set('serviceurl', self.options.endpoint)
     self.client = Client(configHolder)
示例#11
0
 def doWork(self):
     ch = ConfigHolder(self.options)
     client = Client(ch)
     client.logout()
示例#12
0
 def _get_client(self):
     ch = ConfigHolder(self.options)
     return Client(ch)
示例#13
0
 def doWork(self):
     ch = ConfigHolder(self.options)
     client = Client(ch)
     value = client.getRuntimeParameter(self.key)
     print(value if value is not None else '')
示例#14
0
 def doWork(self):
     ch = ConfigHolder(self.options)
     client = Client(ch)
     client.setRuntimeParameter(self.key, self.value)
示例#15
0
 def _get_config_from_server(self):
     ch = ConfigHolder(options=self.options,
                       context={'foo': 'bar'},
                       config={'verboseLevel': self.verboseLevel})
     client = Client(ch)
     return client.get_server_configuration()