コード例 #1
0
ファイル: test_jms_wmq.py プロジェクト: barowski/zato
 def get_response_data(self):
     return Bunch({'id':rand_int(), 'name':self.name, 'host':rand_string(), 'port':rand_int(),
          'queue_manager':rand_int(), 'channel':rand_string(),
          'cache_open_send_queues':rand_bool(), 'cache_open_receive_queues':rand_bool(),
          'use_shared_connections':rand_bool(), 'ssl':rand_bool(),
          'needs_mcd':rand_bool(), 'max_chars_printed':rand_int(),
          'ssl_cipher_spec':rand_string(), 'ssl_key_repository':rand_string()})
コード例 #2
0
ファイル: test_service.py プロジェクト: dsuch/zato
 def test_response(self):
     request = {'cluster_id':rand_int(), 'name':rand_string()}
     
     expected_id = rand_int()
     expected_name = rand_string()
     expected_is_active = rand_bool()
     expected_impl_name = rand_string()
     expected_is_internal = rand_bool()
     
     service = Service()
     service.id = expected_id
     service.name = expected_name
     service.is_active = expected_is_active
     service.impl_name = expected_impl_name
     service.is_internal = expected_is_internal
     
     expected = Expected()
     expected.add(service)
     
     instance = self.invoke(GetByName, request, expected)
     response = Bunch(loads(instance.response.payload.getvalue())['response'])
     
     eq_(response.id, expected_id)
     eq_(response.name, expected_name)
     eq_(response.is_active, expected_is_active)
     eq_(response.impl_name, expected_impl_name)
     eq_(response.is_internal, expected_is_internal)
     eq_(response.usage, 0)
コード例 #3
0
ファイル: test_api_impl.py プロジェクト: azazel75/zato
    def test_topic_custom_attrs(self):
        name = rand_string()
        is_active = rand_bool()
        is_fifo = rand_bool()
        max_depth = rand_int()

        topic = self._get_object(Topic, {
            'name':name, 'is_active':is_active, 'is_fifo':is_fifo, 'max_depth':max_depth
        })

        self.assertEquals(topic.name, name)
        self.assertEquals(topic.is_active, is_active)
        self.assertEquals(topic.is_fifo, is_fifo)
        self.assertEquals(topic.max_depth, max_depth)
コード例 #4
0
ファイル: test_client.py プロジェクト: Aayush-Kasurde/zato
 def test_not_implemented_error(self):
     inner = FakeInnerResponse({}, rand_int(), rand_string(), rand_int())
     response_data = (inner, rand_bool(), rand_int(), rand_int(), None)
     
     self.assertRaises(NotImplementedError, _Response, *response_data)
     self.assertRaises(NotImplementedError, _StructuredResponse(*response_data).load_func)
     self.assertRaises(NotImplementedError, _StructuredResponse(*response_data).set_has_data)
コード例 #5
0
ファイル: test__init__.py プロジェクト: lucval/zato
 def get_response_data(self):
     return Bunch(
         {
             "id": rand_int(),
             "name": rand_string,
             "is_active": rand_bool(),
             "sec_type": rand_string(),
             "username": rand_string(),
             "realm": rand_string(),
             "password_type": rand_string(),
             "reject_empty_nonce_creat": rand_bool(),
             "reject_stale_tokens": rand_bool(),
             "reject_expiry_limit": rand_int(),
             "nonce_freshness_time": rand_int(),
         }
     )
コード例 #6
0
ファイル: test_sio.py プロジェクト: Aayush-Kasurde/zato
    def test_nested_from_json(self):

        n = Nested('elem', 'sub1', Bool('my_bool1'), 'sub2', 'sub3', Dict('my_dict1', 'key1', 'key2'))

        expected_sub1_1 = rand_string()
        expected_sub2_1 = rand_string()
        expected_sub3_1 = rand_string()
        expected_my_bool1_1 = rand_bool()
        expected_key1_1 = rand_string()
        expected_key2_1 = rand_string()

        value1 = {'elem': {
            'sub1': expected_sub1_1,
            'sub2': expected_sub2_1,
            'my_bool1': expected_my_bool1_1,
            'sub3': expected_sub3_1,
            'my_dict1' : {
                'key1': expected_key1_1,
                'key2': expected_key2_1,
            }
        }}

        ret_value = n.from_json(value1)

        eq_(ret_value,
            {'elem':
             {'my_bool1': expected_my_bool1_1, 'sub2': expected_sub2_1, 'sub3': expected_sub3_1,
              'my_dict1': {'key2': expected_key2_1, 'key1': expected_key1_1},
              'sub1': expected_sub1_1}}
        )
コード例 #7
0
ファイル: test_sio.py プロジェクト: Aayush-Kasurde/zato
    def test_nested_to_json(self):

        n = Nested('elem', 'sub1', Bool('my_bool1'), 'sub2', 'sub3', Dict('my_dict1', 'key1', 'key2'))

        expected_sub1_2 = rand_string()
        expected_sub2_2 = rand_string()
        expected_sub3_2 = rand_string()
        expected_my_bool1_2 = rand_bool()
        expected_key1_2 = rand_string()
        expected_key2_2 = rand_string()

        value2 = {'elem': {
            'sub1': expected_sub1_2,
            'sub2': expected_sub2_2,
            'my_bool1': expected_my_bool1_2,
            'sub3': expected_sub3_2,
            'my_dict1' : {
                'key1': expected_key1_2,
                'key2': expected_key2_2,
            }
        }}

        ret_value = n.to_json(value2)

        eq_(ret_value,
            {'elem':
             {'my_bool1': expected_my_bool1_2, 'sub2': expected_sub2_2, 'sub3': expected_sub3_2,
              'my_dict1': {'key2': expected_key2_2, 'key1': expected_key1_2},
              'sub1': expected_sub1_2}}
        )
コード例 #8
0
ファイル: test_api_impl.py プロジェクト: azazel75/zato
    def test_client_custom_attrs(self):
        id, name, is_active = rand_int(), rand_string(), rand_bool()
        client = Client(id, name, is_active)

        self.assertEquals(client.id, id)
        self.assertEquals(client.name, name)
        self.assertEquals(client.is_active, is_active)
コード例 #9
0
ファイル: test_http_soap.py プロジェクト: Aayush-Kasurde/zato
 def get_response_data(self):
     return Bunch({'id':rand_int(), 'name':self.name, 'is_active':rand_bool(), 'is_internal':rand_bool(),
         'url_path':rand_string(), 'service_id':rand_int(), 'service_name':rand_string(), 'security_id':rand_int(),
         'security_name':rand_int(), 'sec_type':rand_string(), 'method':rand_string(), 'soap_action':rand_string(),
         'soap_version':rand_string(), 'data_format':rand_string(), 'host':rand_string(), 'ping_method':rand_string(),
         'pool_size':rand_int()}
     )
コード例 #10
0
 def get_response_data(self):
     return Bunch(
         {'id':rand_int(), 'name':rand_string(), 'is_active':rand_bool(), 'def_id':rand_int(),
          'delivery_mode':rand_int(), 'priority':rand_int(), 'def_name':rand_string(),
          'content_type':rand_string(), 'content_encoding':rand_string(),
          'cexpiration':rand_int(), 'user_id':rand_string(),
          'app_id':rand_string()}
     )
コード例 #11
0
ファイル: test_client.py プロジェクト: Aayush-Kasurde/zato
 def setUp(self):
     self.url = rand_string()
     self.auth = None
     self.path = rand_string()
     self.session = FakeSession()
     self.to_bunch = rand_bool()
     self.max_response_repr = 10000
     self.max_cid_repr = rand_int()
     self.logger = rand_object()
コード例 #12
0
ファイル: test_zmq.py プロジェクト: pombredanne/zato
 def get_request_data(self):
     return {
         "cluster_id": rand_int(),
         "name": self.name,
         "is_active": rand_bool(),
         "address": rand_string(),
         "socket_type": rand_string(),
         "service": rand_string(),
         "sub_key": rand_string(),
         "data_format": rand_string(),
     }
コード例 #13
0
ファイル: test_api_impl.py プロジェクト: azazel75/zato
    def test_get_ctx_custom_attrs(self):
        sub_key = rand_string()
        max_batch_size = rand_int()
        is_fifo = rand_bool()
        get_format = rand_string()

        ctx = GetCtx(sub_key, max_batch_size, is_fifo, get_format)

        self.assertEquals(ctx.sub_key, sub_key)
        self.assertEquals(ctx.max_batch_size, max_batch_size)
        self.assertEquals(ctx.is_fifo, is_fifo)
        self.assertEquals(ctx.get_format, get_format)
コード例 #14
0
ファイル: test_api_impl.py プロジェクト: azazel75/zato
    def test_topic_add(self):
        name = rand_string()
        is_active = rand_bool()
        is_fifo = rand_bool()
        max_depth = rand_int()

        topic = Topic(name, is_active, is_fifo, max_depth)

        self.api.add_topic(topic)

        self.assertIn(name, self.api.impl.topics)
        self.assertEquals(len(self.api.impl.topics), 1)

        given = self.api.impl.topics[name]
        self.assertEquals(given.name, name)
        self.assertEquals(given.is_active, is_active)
        self.assertEquals(given.is_fifo, is_fifo)
        self.assertEquals(given.max_depth, max_depth)

        # Adding topic of the same name should not create a new topic because impl.topics is a dictionary
        self.api.add_topic(topic)
        self.assertEquals(len(self.api.impl.topics), 1)
コード例 #15
0
ファイル: test_zmq.py プロジェクト: pombredanne/zato
 def get_response_data(self):
     return Bunch(
         {
             "id": rand_int(),
             "name": rand_string(),
             "is_active": rand_bool(),
             "address": rand_string(),
             "socket_type": rand_string(),
             "sub_key": rand_string(),
             "service_name": rand_string(),
             "data_format": rand_string(),
         }
     )
コード例 #16
0
ファイル: test_api_impl.py プロジェクト: azazel75/zato
    def test_default_clients(self):
        # Initially, default clients are dummy ones.
        default_consumer = self.api.get_default_consumer()
        default_producer = self.api.get_default_producer()

        self.assertEquals(default_consumer.id, None)
        self.assertEquals(default_consumer.name, None)
        self.assertEquals(default_consumer.is_active, True)

        self.assertEquals(default_producer.id, None)
        self.assertEquals(default_producer.name, None)
        self.assertEquals(default_producer.is_active, True)

        cons_id = rand_int()
        cons_name = rand_string()
        cons_is_active = rand_bool()

        prod_name = rand_string()
        prod_id = rand_int()
        prod_is_active = rand_bool()

        cons = Client(cons_id, cons_name, cons_is_active)
        prod = Client(prod_id, prod_name, prod_is_active)

        self.api.set_default_consumer(cons)
        self.api.set_default_producer(prod)

        default_consumer = self.api.get_default_consumer()
        default_producer = self.api.get_default_producer()

        self.assertEquals(default_consumer.id, cons_id)
        self.assertEquals(default_consumer.name, cons_name)
        self.assertEquals(default_consumer.is_active, cons_is_active)

        self.assertEquals(default_producer.id, prod_id)
        self.assertEquals(default_producer.name, prod_name)
        self.assertEquals(default_producer.is_active, prod_is_active)
コード例 #17
0
ファイル: test_api_impl.py プロジェクト: azazel75/zato
    def test_consumer_custom_attrs(self):
        id = rand_int()
        name = rand_string()
        is_active = rand_bool()
        sub_key = rand_string()
        max_backlog = rand_int()
        delivery_mode = rand_string()
        callback_id = rand_int()
        consumer = Consumer(id, name, is_active, sub_key, max_backlog, delivery_mode, callback_id)

        self.assertEquals(consumer.id, id)
        self.assertEquals(consumer.name, name)
        self.assertEquals(consumer.is_active, is_active)
        self.assertEquals(consumer.sub_key, sub_key)
        self.assertEquals(consumer.max_backlog, max_backlog)
        self.assertEquals(consumer.delivery_mode, delivery_mode)
        self.assertEquals(consumer.callback_id, callback_id)
コード例 #18
0
ファイル: test_scheduler.py プロジェクト: Aayush-Kasurde/zato
    def test_get_context(self):

        id = rand_int()
        name = rand_string()
        start_time = rand_date_utc()
        interval_in_seconds = rand_int()
        max_repeats_reached = rand_bool()
        current_run, max_repeats = rand_int(count=2)
        cb_kwargs = {rand_string():rand_string()}

        for job_type in SCHEDULER.JOB_TYPE.INTERVAL_BASED, SCHEDULER.JOB_TYPE.CRON_STYLE:

            interval=Interval(in_seconds=interval_in_seconds) if \
                job_type == SCHEDULER.JOB_TYPE.INTERVAL_BASED else CronTab(DEFAULT_CRON_DEFINITION)

            job = Job(id, name, job_type, cb_kwargs=cb_kwargs, interval=interval)
            job.start_time = start_time
            job.current_run = current_run
            job.max_repeats = max_repeats
            job.max_repeats_reached = max_repeats_reached

            if job_type == SCHEDULER.JOB_TYPE.CRON_STYLE:
                job.cron_definition = DEFAULT_CRON_DEFINITION

            ctx = job.get_context()
            cid = ctx.pop('cid')

            self.assertTrue(is_like_cid(cid))

            expected = {
                'current_run': current_run,
                'id': id,
                'name': name,
                'start_time': start_time.isoformat(),
                'max_repeats': max_repeats,
                'max_repeats_reached': max_repeats_reached,
                'cb_kwargs': cb_kwargs,
                'type': job_type,
            }

            if job_type == SCHEDULER.JOB_TYPE.CRON_STYLE:
                expected['cron_definition'] = job.cron_definition
            else:
                expected['interval_in_seconds'] = job.interval.in_seconds

            self.assertDictEqual(ctx, expected)
コード例 #19
0
ファイル: test_wss.py プロジェクト: Aayush-Kasurde/zato
 def get_request_data(self):
     return ({'id':rand_int(), 'cluster_id':rand_int(), 'name':rand_string(), 'is_active':rand_bool(), 'username':rand_string(),
              'password_type':rand_string(), 'reject_empty_nonce_creat':rand_bool(), 'reject_stale_tokens':rand_bool(), 'reject_expiry_limit':rand_int(),
              'nonce_freshness_time':rand_int()}
             )
コード例 #20
0
 def get_response_data(self):
     return Bunch(
         {'id':rand_int(), 'name':rand_string(), 'is_active':rand_bool(), 'cluster_id':rand_int(), 'engine':rand_string(),
          'host':rand_string(), 'port':rand_int(), 'db_name':rand_string(), 'username':rand_string(), 'pool_size':rand_int(),
          'extra':rand_string()}
     )
コード例 #21
0
ファイル: test_zmq.py プロジェクト: barowski/zato
 def get_request_data(self):
     return {'id':rand_int(), 'cluste_id':rand_string(), 'name':rand_string(), 'is_active':rand_bool(), 'address':rand_inr(), 'socket_type':rand_string()}
コード例 #22
0
ファイル: test_wss.py プロジェクト: Aayush-Kasurde/zato
 def get_response_data(self):
     return Bunch({'id':rand_int(), 'name':self.name, 'is_active':rand_bool(), 'password_type':rand_string(), 'username':rand_string(),
                   'reject_empty_nonce_creat':rand_bool(), 'reject_stale_tokens':rand_bool(), 'reject_expiry_limit':rand_int(),
                   'nonce_freshness_time':rand_int()}
     )
コード例 #23
0
ファイル: test_ftp.py プロジェクト: Aayush-Kasurde/zato
 def get_request_data(self):
     return {'id':rand_int(), 'cluster_id':rand_int(), 'name':rand_string(), 'is_active':rand_bool(),
             'host':rand_string(),'port':rand_int(), 'dircache':rand_bool(), 'user':rand_string(), 'acct':rand_string(),
             'timeout':rand_int()}
コード例 #24
0
ファイル: test_ftp.py プロジェクト: Aayush-Kasurde/zato
 def get_response_data(self):
     return Bunch(
         {'id':rand_int(), 'name':rand_string(), 'is_active':rand_bool(), 'host':rand_string(), 
          'port':rand_int(), 'user':rand_string(), 'acct':rand_string(), 
          'timeout':rand_int(), 'dircache':rand_bool()}
     )
コード例 #25
0
ファイル: test_amqp.py プロジェクト: Adniel/zato
 def get_request_data(self):
     return {'cluster_id':rand_int(), 'name':self.name, 'is_active':rand_bool(), 'def_id':self.def_id,
             'queue':rand_string(), 'consumer_tag_prefix':rand_string(), 'service':rand_string(),
             'data_format':rand_string()}
コード例 #26
0
ファイル: test_amqp.py プロジェクト: Adniel/zato
 def get_response_data(self):
     return Bunch(
         {'id':rand_int(), 'name':rand_string(), 'is_active':rand_bool(), 'queue':rand_string(), 
          'consumer_tag_prefix':rand_string(), 'def_name':rand_string(), 'def_id':rand_int(), 
          'service_name':rand_string(), 'data_format':rand_string()}
     )
コード例 #27
0
 def get_request_data(self):
     return {'id':rand_int(), 'name':rand_string(), 'is_active':rand_bool(), 'cluste_id':rand_int(), 'engine':rand_string(),
             'host':rand_string(), 'port':rand_int(), 'db_name':rand_string(), 'username':rand_string(), 'pool_size':rand_int(), 'extra':rand_string()}
コード例 #28
0
ファイル: test_zmq.py プロジェクト: barowski/zato
 def get_response_data(self):
     return Bunch(
         {'id':rand_int(), 'name':rand_string(), 'is_active':rand_bool(), 'address':rand_string(), 'socket_type':rand_string()}
     )
コード例 #29
0
ファイル: test_sql.py プロジェクト: grenzi/ctakes_exploration
 def get_request_data(self):
     return {'id':rand_int(), 'name':rand_string(), 'is_active':rand_bool(), 'cluste_id':rand_int(), 'engine':rand_string(),
             'host':rand_string(), 'port':rand_int(), 'db_name':rand_string(), 'username':rand_string(), 'pool_size':rand_int(), 'extra':rand_string()}
コード例 #30
0
ファイル: test_sql.py プロジェクト: grenzi/ctakes_exploration
 def get_response_data(self):
     return Bunch(
         {'id':rand_int(), 'name':rand_string(), 'is_active':rand_bool(), 'cluster_id':rand_int(), 'engine':rand_string(),
          'host':rand_string(), 'port':rand_int(), 'db_name':rand_string(), 'username':rand_string(), 'pool_size':rand_int(),
          'extra':rand_string()}
     )
コード例 #31
0
 def get_request_data(self):
     return {'id':rand_int(), 'cluster_id':rand_int(), 'name':rand_string(), 'is_active':rand_bool(), 'def_id':rand_int(),
             'delivery_mode':rand_string(),'priority':rand_int(), 'content_type':rand_string(), 'content_encoding':rand_string(),
             'expiration':rand_int(), 'user_id':rand_string(), 'app_id':rand_string()}
コード例 #32
0
 def get_request_data(self):
     return ({
         'cluster_id': rand_int(),
         'name': rand_string(),
         'is_active': rand_bool()
     })
コード例 #33
0
ファイル: test_http_soap.py プロジェクト: Aayush-Kasurde/zato
 def get_request_data(self):
     return ({'cluster_id':rand_int(), 'name':rand_string(), 'is_active':rand_bool(), 'connection':rand_string(),
              'transport':rand_string(), 'url_path':rand_string(), 'service':rand_string(), 'security':rand_string(),
              'security_id':rand_int(), 'method':rand_string(), 'soap_action':rand_string(), 'soap_version':rand_string(),
              'data_format':rand_string(), 'host':rand_string(), 'content_type':rand_string()}
             )
コード例 #34
0
 def get_response_data(self):
     return Bunch({
         'id': rand_int(),
         'name': self.name,
         'is_active': rand_bool()
     })