当前位置: 首页>>代码示例>>Python>>正文


Python mapping.SessionService类代码示例

本文整理汇总了Python中ariane_clip3.mapping.SessionService的典型用法代码示例。如果您正苦于以下问题:Python SessionService类的具体用法?Python SessionService怎么用?Python SessionService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SessionService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_transac_container_properties

    def test_transac_container_properties(self):
        SessionService.open_session("test_transac_container_properties")
        container = Container(name="test_transac_container_properties",
                              gate_uri="ssh://my_host/docker/test_transac_container_properties",
                              primary_admin_gate_name="container name space (pid)", company="Docker",
                              product="Docker", c_type="container")
        container.save()
        SessionService.commit()
        container2 = ContainerService.find_container(cid=container.id)
        self.assertEqual(container2.properties.__len__(), 0)

        container.add_property(('int_prop', 10), sync=False)
        container.add_property(('long_prop', 10000000), sync=False)
        container.add_property(('double_prop', 3.1414), sync=False)
        container.add_property(('boolean_prop', True), sync=False)
        container.add_property(('string_prop', "value"), sync=False)
        datacenter = {"dc": "Sagittarius", "gpsLng": 2.251088, "address": "2 rue Baudin", "gpsLat": 48.895345,
                      "town": "Courbevoie", "country": "France"}
        container.add_property(('map_prop_datacenter', datacenter), sync=False)
        container.add_property(('array_prop', [1, 2, 3, 4, 5]), sync=False)
        self.assertEqual(container.properties.__len__(), 0)
        container.save()
        SessionService.commit()
        container2 = ContainerService.find_container(cid=container.id)
        self.assertTrue('boolean_prop' in container2.properties)
        self.assertTrue('double_prop' in container2.properties)
        self.assertTrue('int_prop' in container2.properties)
        self.assertTrue('long_prop' in container2.properties)
        self.assertTrue('map_prop_datacenter' in container2.properties)
        self.assertTrue('string_prop' in container2.properties)
        self.assertTrue('array_prop' in container2.properties)

        container.remove()
        SessionService.commit()
        SessionService.close_session()
开发者ID:echinopsii,项目名称:net.echinopsii.ariane.community.cli.python3,代码行数:35,代码来源:container_rabbitmq_at.py

示例2: test_transac_replace_container_gate_1

 def test_transac_replace_container_gate_1(self):
     SessionService.open_session("test_transac_replace_container_gate_1")
     container2 = Container(name="test_transac_replace_container_gate_1",
                            gate_uri="ssh://my_host/docker/test_transac_replace_container_gate_1_container2",
                            primary_admin_gate_name="container name space (pid)", company="Docker",
                            product="Docker", c_type="container")
     container2.save()
     gate = Gate(name="sshd", url="ssh://test_transac_replace_container_gate_1_ugly_docker_admin_endpoint",
                 is_primary_admin=False,
                 container=container2)
     prim_adm_ep = EndpointService.find_endpoint(
         url="ssh://my_host/docker/test_transac_replace_container_gate_1_container2"
     )
     previous_prim_gate = GateService.find_gate(
         nid=prim_adm_ep.parent_node_id
     )
     gate.save()
     SessionService.commit()
     self.assertIsNotNone(gate.id)
     self.assertNotEqual(container2.primary_admin_gate_id, gate.id)
     self.assertTrue(gate.id in container2.nodes_id)
     self.assertTrue(gate.id in container2.gates_id)
     gate.url = "ssh://my_host/docker/test_transac_replace_container_gate_1_container2"
     gate.is_primary_admin = True
     gate.save()
     previous_prim_gate.remove()
     SessionService.commit()
     self.assertEqual(container2.primary_admin_gate_id, gate.id)
     self.assertEqual(container2.gate_uri, gate.url)
     container2.remove()
     SessionService.commit()
     SessionService.close_session()
开发者ID:echinopsii,项目名称:net.echinopsii.ariane.community.cli.python3,代码行数:32,代码来源:gate_nats_at.py

示例3: stop

 def stop(self):
     if self.ready:
         if InjectorCachedGearService.get_gears_cache_size() == 0 and \
                 InjectorCachedComponentService.get_components_cache_size() == 0:
             self.injector_ui_procos_entity.remove()
         self.injector_service.stop()
         SessionService.close_session()
         self.ready = False
开发者ID:echinopsii,项目名称:net.echinopsii.ariane.community.plugin.docker,代码行数:8,代码来源:connector.py

示例4: test_session

 def test_session(self):
     args = {'type': 'REST', 'base_url': 'http://localhost:6969/ariane/', 'user': 'yoda', 'password': 'secret'}
     MappingService(args)
     session_id = SessionService.open_session("test")
     thread_id = threading.current_thread().ident
     self.assertIn(thread_id, SessionService.session_registry)
     self.assertEqual(SessionService.session_registry[thread_id], session_id)
     SessionService.close_session()
     self.assertNotIn(thread_id, SessionService.session_registry)
开发者ID:echinopsii,项目名称:net.echinopsii.ariane.community.cli.python3,代码行数:9,代码来源:session_rest_at.py

示例5: test_transac_get_transports

 def test_transac_get_transports(self):
     SessionService.open_session("test")
     transport = Transport(name="test_transac_get_transports")
     transport.save()
     SessionService.commit()
     self.assertTrue(transport in TransportService.get_transports())
     transport.remove()
     SessionService.commit()
     self.assertFalse(transport in TransportService.get_transports())
     SessionService.commit()
     SessionService.close_session()
开发者ID:echinopsii,项目名称:net.echinopsii.ariane.community.cli.python3,代码行数:11,代码来源:transport_rest_at.py

示例6: test_transac_get_links

 def test_transac_get_links(self):
     SessionService.open_session("test_transac_get_links")
     link = Link(source_endpoint_id=self.endpoint1.id, target_endpoint_id=self.endpoint2.id,
                 transport_id=self.transport.id)
     link.save()
     SessionService.commit()
     self.assertTrue(link in LinkService.get_links())
     link.remove()
     SessionService.commit()
     self.assertFalse(link in LinkService.get_links())
     SessionService.commit()
     SessionService.close_session()
开发者ID:echinopsii,项目名称:net.echinopsii.ariane.community.cli.python3,代码行数:12,代码来源:link_nats_at.py

示例7: test_transac_node_properties

 def test_transac_node_properties(self):
     SessionService.open_session("test_transac_node_properties")
     gate = Gate(name="sshd", url="ssh://test_transac_node_properties_ugly_docker_admin_endpoint",
                 is_primary_admin=False,
                 container=self.container1)
     gate.add_property(('int_prop', 10), sync=False)
     gate.add_property(('long_prop', 10000000), sync=False)
     gate.add_property(('double_prop', 3.1414), sync=False)
     gate.add_property(('boolean_prop', True), sync=False)
     gate.add_property(('string_prop', "value"), sync=False)
     datacenter = {"dc": "Sagittarius", "gpsLng": 2.251088, "address": "2 rue Baudin", "gpsLat": 48.895345,
                   "town": "Courbevoie", "country": "France"}
     gate.add_property(('map_prop_datacenter', datacenter), sync=False)
     gate.add_property(('array_prop', [1, 2, 3, 4, 5]), sync=False)
     self.assertIsNone(gate.properties)
     gate.save()
     SessionService.commit()
     self.assertTrue('boolean_prop' in gate.properties)
     self.assertTrue('double_prop' in gate.properties)
     self.assertTrue('int_prop' in gate.properties)
     self.assertTrue('long_prop' in gate.properties)
     self.assertTrue('map_prop_datacenter' in gate.properties)
     self.assertTrue('string_prop' in gate.properties)
     self.assertTrue('array_prop' in gate.properties)
     gate.del_property('int_prop', sync=False)
     gate.del_property('long_prop', sync=False)
     gate.del_property('double_prop', sync=False)
     gate.del_property('boolean_prop', sync=False)
     gate.del_property('string_prop', sync=False)
     gate.del_property('map_prop_datacenter', sync=False)
     gate.del_property('array_prop', sync=False)
     self.assertTrue('boolean_prop' in gate.properties)
     self.assertTrue('double_prop' in gate.properties)
     self.assertTrue('int_prop' in gate.properties)
     self.assertTrue('long_prop' in gate.properties)
     self.assertTrue('map_prop_datacenter' in gate.properties)
     self.assertTrue('string_prop' in gate.properties)
     self.assertTrue('array_prop' in gate.properties)
     gate.save()
     SessionService.commit()
     self.assertFalse(gate.properties is not None and 'boolean_prop' in gate.properties)
     self.assertFalse(gate.properties is not None and 'double_prop' in gate.properties)
     self.assertFalse(gate.properties is not None and 'int_prop' in gate.properties)
     self.assertFalse(gate.properties is not None and 'long_prop' in gate.properties)
     self.assertFalse(gate.properties is not None and 'map_prop_datacenter' in gate.properties)
     self.assertFalse(gate.properties is not None and 'string_prop' in gate.properties)
     self.assertFalse(gate.properties is not None and 'array_prop' in gate.properties)
     gate.remove()
     SessionService.commit()
     SessionService.close_session()
开发者ID:echinopsii,项目名称:net.echinopsii.ariane.community.cli.python3,代码行数:50,代码来源:gate_nats_at.py

示例8: test_transac_create_remove_node_basic

 def test_transac_create_remove_node_basic(self):
     SessionService.open_session("test_transac_create_remove_node_basic")
     node = Node(name="mysqld", container_id=self.container1.id)
     node.save()
     SessionService.commit()
     self.assertIsNotNone(node.id)
     self.container1.sync()
     self.assertTrue(node.id in self.container1.nodes_id)
     self.assertIsNone(node.remove())
     self.container1.sync()
     SessionService.commit()
     self.assertFalse(node.id in self.container1.nodes_id)
     SessionService.commit()
     SessionService.close_session()
开发者ID:echinopsii,项目名称:net.echinopsii.ariane.community.cli.python3,代码行数:14,代码来源:node_nats_at.py

示例9: test_transac_get_endpoints

 def test_transac_get_endpoints(self):
     SessionService.open_session("test_transac_get_endpoints")
     endpoint = Endpoint(url="mysql://test_transac_get_endpoints_container1:4385",
                         parent_node_id=self.node1.id)
     endpoint.save()
     self.assertTrue(endpoint in EndpointService.find_endpoint(selector="endpointURL =~ 'mysql:.*'"))
     self.assertTrue(endpoint in EndpointService.find_endpoint(selector="endpointURL =~ 'mysql:.*'", cid=self.container1.id))
     self.assertTrue(endpoint in EndpointService.find_endpoint(selector="endpointURL =~ 'mysql:.*'", nid=self.node1.id))
     self.assertTrue(endpoint in EndpointService.get_endpoints())
     SessionService.commit()
     self.assertTrue(endpoint in EndpointService.find_endpoint(selector="endpointURL =~ 'mysql:.*'"))
     self.assertTrue(endpoint in EndpointService.find_endpoint(selector="endpointURL =~ 'mysql:.*'", cid=self.container1.id))
     self.assertTrue(endpoint in EndpointService.find_endpoint(selector="endpointURL =~ 'mysql:.*'", nid=self.node1.id))
     self.assertTrue(endpoint in EndpointService.get_endpoints())
     endpoint.remove()
     self.assertFalse(EndpointService.find_endpoint(selector="endpointURL =~ 'mysql:.*'") is not None and
                      endpoint in EndpointService.find_endpoint(selector="endpointURL =~ 'mysql:.*'"))
     self.assertFalse(EndpointService.find_endpoint(selector="endpointURL =~ 'mysql:.*'") is not None and
                      endpoint in EndpointService.find_endpoint(selector="endpointURL =~ 'mysql:.*'", cid=self.container1.id))
     self.assertFalse(EndpointService.find_endpoint(selector="endpointURL =~ 'mysql:.*'") is not None and
                      endpoint in EndpointService.find_endpoint(selector="endpointURL =~ 'mysql:.*'", nid=self.node1.id))
     self.assertFalse(endpoint in EndpointService.get_endpoints())
     SessionService.commit()
     self.assertFalse(endpoint in EndpointService.get_endpoints())
     SessionService.close_session()
开发者ID:echinopsii,项目名称:net.echinopsii.ariane.community.cli.python3,代码行数:25,代码来源:endpoint_rabbitmq_at.py

示例10: test_transac_endpoint_properties

 def test_transac_endpoint_properties(self):
     SessionService.open_session("test_transac_endpoint_properties")
     endpoint = Endpoint(url="mysql://test_transac_endpoint_properties_container1:4385",
                         parent_node_id=self.node1.id)
     endpoint.add_property(('int_prop', 10), sync=False)
     endpoint.add_property(('long_prop', 10000000), sync=False)
     endpoint.add_property(('double_prop', 3.1414), sync=False)
     endpoint.add_property(('boolean_prop', True), sync=False)
     endpoint.add_property(('string_prop', "value"), sync=False)
     datacenter = {"dc": "Sagittarius", "gpsLng": 2.251088, "address": "2 rue Baudin", "gpsLat": 48.895345,
                   "town": "Courbevoie", "country": "France"}
     endpoint.add_property(('map_prop_datacenter', datacenter), sync=False)
     endpoint.add_property(('array_prop', [1, 2, 3, 4, 5]), sync=False)
     self.assertIsNone(endpoint.properties)
     endpoint.save()
     SessionService.commit()
     self.assertTrue('boolean_prop' in endpoint.properties)
     self.assertTrue('double_prop' in endpoint.properties)
     self.assertTrue('int_prop' in endpoint.properties)
     self.assertTrue('long_prop' in endpoint.properties)
     self.assertTrue('map_prop_datacenter' in endpoint.properties)
     self.assertTrue('string_prop' in endpoint.properties)
     self.assertTrue('array_prop' in endpoint.properties)
     endpoint.del_property('int_prop', sync=False)
     endpoint.del_property('long_prop', sync=False)
     endpoint.del_property('double_prop', sync=False)
     endpoint.del_property('boolean_prop', sync=False)
     endpoint.del_property('string_prop', sync=False)
     endpoint.del_property('map_prop_datacenter', sync=False)
     endpoint.del_property('array_prop', sync=False)
     self.assertTrue('boolean_prop' in endpoint.properties)
     self.assertTrue('double_prop' in endpoint.properties)
     self.assertTrue('int_prop' in endpoint.properties)
     self.assertTrue('long_prop' in endpoint.properties)
     self.assertTrue('map_prop_datacenter' in endpoint.properties)
     self.assertTrue('string_prop' in endpoint.properties)
     self.assertTrue('array_prop' in endpoint.properties)
     endpoint.save()
     SessionService.commit()
     self.assertFalse(endpoint.properties is not None and 'boolean_prop' in endpoint.properties)
     self.assertFalse(endpoint.properties is not None and 'double_prop' in endpoint.properties)
     self.assertFalse(endpoint.properties is not None and 'int_prop' in endpoint.properties)
     self.assertFalse(endpoint.properties is not None and 'long_prop' in endpoint.properties)
     self.assertFalse(endpoint.properties is not None and 'map_prop_datacenter' in endpoint.properties)
     self.assertFalse(endpoint.properties is not None and 'string_prop' in endpoint.properties)
     self.assertFalse(endpoint.properties is not None and 'array_prop' in endpoint.properties)
     endpoint.remove()
     SessionService.commit()
     SessionService.close_session()
开发者ID:echinopsii,项目名称:net.echinopsii.ariane.community.cli.python3,代码行数:49,代码来源:endpoint_rabbitmq_at.py

示例11: test_transac_node_properties

 def test_transac_node_properties(self):
     SessionService.open_session("test_transac_node_properties")
     node = Node(name="mysqld1", container=self.container1)
     node.add_property(('int_prop', 10), sync=False)
     node.add_property(('long_prop', 10000000), sync=False)
     node.add_property(('double_prop', 3.1414), sync=False)
     node.add_property(('boolean_prop', True), sync=False)
     node.add_property(('string_prop', "value"), sync=False)
     datacenter = {"dc": "Sagittarius", "gpsLng": 2.251088, "address": "2 rue Baudin", "gpsLat": 48.895345,
                   "town": "Courbevoie", "country": "France"}
     node.add_property(('map_prop_datacenter', datacenter), sync=False)
     node.add_property(('array_prop', [1, 2, 3, 4, 5]), sync=False)
     self.assertIsNone(node.properties)
     node.save()
     SessionService.commit()
     self.assertTrue('boolean_prop' in node.properties)
     self.assertTrue('double_prop' in node.properties)
     self.assertTrue('int_prop' in node.properties)
     self.assertTrue('long_prop' in node.properties)
     self.assertTrue('map_prop_datacenter' in node.properties)
     self.assertTrue('string_prop' in node.properties)
     self.assertTrue('array_prop' in node.properties)
     node.del_property('int_prop', sync=False)
     node.del_property('long_prop', sync=False)
     node.del_property('double_prop', sync=False)
     node.del_property('boolean_prop', sync=False)
     node.del_property('string_prop', sync=False)
     node.del_property('map_prop_datacenter', sync=False)
     node.del_property('array_prop', sync=False)
     self.assertTrue('boolean_prop' in node.properties)
     self.assertTrue('double_prop' in node.properties)
     self.assertTrue('int_prop' in node.properties)
     self.assertTrue('long_prop' in node.properties)
     self.assertTrue('map_prop_datacenter' in node.properties)
     self.assertTrue('string_prop' in node.properties)
     self.assertTrue('array_prop' in node.properties)
     node.save()
     SessionService.commit()
     self.assertFalse(node.properties is not None and 'boolean_prop' in node.properties)
     self.assertFalse(node.properties is not None and 'double_prop' in node.properties)
     self.assertFalse(node.properties is not None and 'int_prop' in node.properties)
     self.assertFalse(node.properties is not None and 'long_prop' in node.properties)
     self.assertFalse(node.properties is not None and 'map_prop_datacenter' in node.properties)
     self.assertFalse(node.properties is not None and 'string_prop' in node.properties)
     self.assertFalse(node.properties is not None and 'array_prop' in node.properties)
     node.remove()
     SessionService.commit()
     SessionService.close_session()
开发者ID:echinopsii,项目名称:net.echinopsii.ariane.community.cli.python3,代码行数:48,代码来源:node_nats_at.py

示例12: test_transac_create_remove_transport

 def test_transac_create_remove_transport(self):
     SessionService.open_session("test")
     transport = Transport(name="test_transac_create_remove_transport")
     transport.save()
     SessionService.commit()
     self.assertIsNotNone(transport.id)
     self.assertIsNone(transport.remove())
     SessionService.commit()
     SessionService.close_session()
开发者ID:echinopsii,项目名称:net.echinopsii.ariane.community.cli.python3,代码行数:9,代码来源:transport_rest_at.py

示例13: test_session_rollback

    def test_session_rollback(self):
        args = {'type': 'REST', 'base_url': 'http://localhost:6969/ariane/', 'user': 'yoda', 'password': 'secret'}
        MappingService(args)

        session_id = SessionService.open_session("test")
        thread_id = threading.current_thread().ident
        self.assertIn(thread_id, SessionService.session_registry)
        self.assertEqual(SessionService.session_registry[thread_id], session_id)

        init_cluster_count = ClusterService.get_clusters().__len__()
        new_cluster = Cluster(name="test_cluster")
        new_cluster.save()
        SessionService.rollback()
        SessionService.close_session()
        self.assertNotIn(thread_id, SessionService.session_registry)

        self.assertEqual(ClusterService.get_clusters().__len__(), init_cluster_count)
开发者ID:echinopsii,项目名称:net.echinopsii.ariane.community.cli.python3,代码行数:17,代码来源:session_rest_at.py

示例14: test_transac_create_remove_link_basic

 def test_transac_create_remove_link_basic(self):
     SessionService.open_session("test_transac_create_remove_link_basic")
     link = Link(source_endpoint_id=self.endpoint1.id, target_endpoint_id=self.endpoint2.id,
                 transport_id=self.transport.id)
     link.save()
     SessionService.commit()
     self.assertIsNotNone(link.id)
     self.assertIsNone(link.remove())
     SessionService.commit()
     SessionService.close_session()
开发者ID:echinopsii,项目名称:net.echinopsii.ariane.community.cli.python3,代码行数:10,代码来源:link_nats_at.py

示例15: test_transac_get_clusters

 def test_transac_get_clusters(self):
     SessionService.open_session("test_transac_get_clusters")
     new_cluster = Cluster(name="test_transac_get_clusters")
     new_cluster.save()
     self.assertTrue(new_cluster in ClusterService.get_clusters())
     SessionService.commit()
     self.assertTrue(new_cluster in ClusterService.get_clusters())
     new_cluster.remove()
     self.assertTrue(new_cluster not in ClusterService.get_clusters())
     SessionService.commit()
     self.assertTrue(new_cluster not in ClusterService.get_clusters())
     SessionService.close_session()
开发者ID:echinopsii,项目名称:net.echinopsii.ariane.community.cli.python3,代码行数:12,代码来源:cluster_rabbitmq_at.py


注:本文中的ariane_clip3.mapping.SessionService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。