本文整理汇总了Python中ariane_clip3.mapping.SessionService.close_session方法的典型用法代码示例。如果您正苦于以下问题:Python SessionService.close_session方法的具体用法?Python SessionService.close_session怎么用?Python SessionService.close_session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ariane_clip3.mapping.SessionService
的用法示例。
在下文中一共展示了SessionService.close_session方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_transac_container_properties
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import close_session [as 别名]
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,代码行数:37,代码来源:container_rabbitmq_at.py
示例2: test_transac_get_endpoints
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import close_session [as 别名]
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,代码行数:27,代码来源:endpoint_rabbitmq_at.py
示例3: test_transac_replace_container_gate_1
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import close_session [as 别名]
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()
示例4: stop
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import close_session [as 别名]
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
示例5: test_transac_create_remove_transport
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import close_session [as 别名]
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()
示例6: test_session
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import close_session [as 别名]
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)
示例7: test_transac_create_remove_link_basic
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import close_session [as 别名]
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()
示例8: test_transac_get_transports
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import close_session [as 别名]
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()
示例9: test_transac_get_clusters
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import close_session [as 别名]
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,代码行数:14,代码来源:cluster_rabbitmq_at.py
示例10: test_transac_get_links
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import close_session [as 别名]
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()
示例11: test_transac_create_remove_node_basic
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import close_session [as 别名]
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()
示例12: test_transac_node_properties
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import close_session [as 别名]
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()
示例13: test_transac_create_remove_endpoint_basic
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import close_session [as 别名]
def test_transac_create_remove_endpoint_basic(self):
SessionService.open_session("test_transac_create_remove_endpoint_basic")
endpoint = Endpoint(url="mysql://test_transac_create_remove_endpoint_basic_container1:4385",
parent_node_id=self.node1.id)
endpoint.save()
SessionService.commit()
self.assertIsNotNone(endpoint.id)
self.node1.sync()
self.assertTrue(endpoint.id in self.node1.endpoints_id)
self.assertIsNone(endpoint.remove())
self.node1.sync()
self.assertFalse(endpoint.id in self.node1.endpoints_id)
SessionService.commit()
SessionService.close_session()
开发者ID:echinopsii,项目名称:net.echinopsii.ariane.community.cli.python3,代码行数:16,代码来源:endpoint_rabbitmq_at.py
示例14: test_transac_cluster_link_to_container
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import close_session [as 别名]
def test_transac_cluster_link_to_container(self):
args = {'type': DriverFactory.DRIVER_REST, 'base_url': 'http://localhost:6969/ariane/',
'user': 'yoda', 'password': 'secret'}
MappingService(args)
SessionService.open_session("test")
cluster = Cluster(name="test_transac_cluster_link_to_container")
container = Container(name="test_transac_cluster_link_to_container_container",
gate_uri="ssh://my_host/docker/test_transac_cluster_link_to_container_container",
primary_admin_gate_name="container name space (pid)", company="Docker",
product="Docker", c_type="container")
cluster.add_container(container, False)
self.assertTrue(container in cluster.containers_2_add)
self.assertIsNone(cluster.containers_id)
self.assertIsNone(container.cluster_id)
cluster.save()
self.assertTrue(cluster in ClusterService.get_clusters())
self.assertTrue(container in ContainerService.get_containers())
SessionService.commit()
self.assertTrue(cluster in ClusterService.get_clusters())
self.assertTrue(container in ContainerService.get_containers())
self.assertFalse(container in cluster.containers_2_add)
self.assertTrue(container.id in cluster.containers_id)
self.assertTrue(container.cluster_id == cluster.id)
cluster.del_container(container, False)
self.assertTrue(container in cluster.containers_2_rm)
self.assertTrue(container.id in cluster.containers_id)
self.assertTrue(container.cluster_id == cluster.id)
cluster.save()
SessionService.commit()
self.assertFalse(container in cluster.containers_2_rm)
self.assertTrue(cluster.containers_id.__len__() == 0)
self.assertIsNone(container.cluster_id)
cluster.add_container(container)
SessionService.commit()
self.assertTrue(container.id in cluster.containers_id)
self.assertTrue(container.cluster_id == cluster.id)
cluster.del_container(container)
SessionService.commit()
self.assertTrue(cluster.containers_id.__len__() == 0)
self.assertIsNone(container.cluster_id)
container.remove()
cluster.remove()
self.assertFalse(cluster in ClusterService.get_clusters())
self.assertFalse(container in ContainerService.get_containers())
SessionService.commit()
self.assertFalse(cluster in ClusterService.get_clusters())
self.assertFalse(container in ContainerService.get_containers())
SessionService.close_session()
示例15: test_transac_endpoint_properties
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import close_session [as 别名]
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,代码行数:51,代码来源:endpoint_rabbitmq_at.py