本文整理汇总了Python中ariane_clip3.mapping.SessionService.commit方法的典型用法代码示例。如果您正苦于以下问题:Python SessionService.commit方法的具体用法?Python SessionService.commit怎么用?Python SessionService.commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ariane_clip3.mapping.SessionService
的用法示例。
在下文中一共展示了SessionService.commit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_transac_get_endpoints
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import commit [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
示例2: test_transac_create_remove_transport
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import commit [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()
示例3: test_transac_create_remove_link_basic
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import commit [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()
示例4: test_transac_get_clusters
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import commit [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
示例5: test_transac_create_remove_endpoint_basic
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import commit [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
示例6: test_transac_cluster_link_to_container
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import commit [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()
示例7: test_transac_get_clusters
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import commit [as 别名]
def test_transac_get_clusters(self):
args = {'type': DriverFactory.DRIVER_REST, 'base_url': 'http://localhost:6969/ariane/',
'user': 'yoda', 'password': 'secret'}
MappingService(args)
SessionService.open_session("test")
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()
示例8: test_transac_create_remove_node_parent_container
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import commit [as 别名]
def test_transac_create_remove_node_parent_container(self):
SessionService.open_session("test_transac_create_remove_node_parent_container")
container2 = Container(name="test_transac_create_remove_node_parent_container_container2",
gate_uri="ssh://my_host/docker/test_transac_create_remove_node_parent_container_container2",
primary_admin_gate_name="container name space (pid)", company="Docker",
product="Docker", c_type="container")
node = Node(name="mysqld", container=container2)
node.save()
SessionService.commit()
self.assertIsNotNone(node.id)
self.assertTrue(node.id in container2.nodes_id)
self.assertIsNone(node.remove())
self.assertFalse(node.id in container2.nodes_id)
container2.remove()
SessionService.commit()
SessionService.close_session()
示例9: test_transac_get_containers
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import commit [as 别名]
def test_transac_get_containers(self):
SessionService.open_session("test_transac_get_containers")
new_container = Container(name="test_transac_get_containers",
gate_uri="ssh://my_host/docker/test_transac_get_containers",
primary_admin_gate_name="container name space (pid)", company="Docker",
product="Docker", c_type="container")
new_container.save()
self.assertTrue(new_container in ContainerService.get_containers())
SessionService.commit()
self.assertTrue(new_container in ContainerService.get_containers())
new_container.remove()
self.assertFalse(new_container in ContainerService.get_containers())
SessionService.commit()
self.assertFalse(new_container in ContainerService.get_containers())
SessionService.close_session()
开发者ID:echinopsii,项目名称:net.echinopsii.ariane.community.cli.python3,代码行数:18,代码来源:container_rabbitmq_at.py
示例10: test_transac_create_remove_gate_basic
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import commit [as 别名]
def test_transac_create_remove_gate_basic(self):
SessionService.open_session("test")
gate = Gate(name="sshd", url="ssh://test_transac_create_remove_gate_basic_ugly_docker_admin_endpoint",
is_primary_admin=True,
container_id=self.container1.id)
gate.save()
SessionService.commit()
self.assertIsNotNone(gate.id)
self.container1.sync()
self.assertTrue(gate.id in self.container1.nodes_id)
self.assertTrue(gate.id in self.container1.gates_id)
self.assertIsNotNone(gate.remove())
self.container1.sync()
self.assertTrue(gate.id in self.container1.nodes_id)
self.assertTrue(gate.id in self.container1.gates_id)
SessionService.commit()
SessionService.close_session()
示例11: test_transac_cluster_link_to_container
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import commit [as 别名]
def test_transac_cluster_link_to_container(self):
SessionService.open_session("test_transac_cluster_link_to_container")
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()
开发者ID:echinopsii,项目名称:net.echinopsii.ariane.community.cli.python3,代码行数:48,代码来源:cluster_rabbitmq_at.py
示例12: test_transac_get_containers
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import commit [as 别名]
def test_transac_get_containers(self):
args = {'type': 'REST', 'base_url': 'http://localhost:6969/ariane/', 'user': 'yoda', 'password': 'secret'}
MappingService(args)
SessionService.open_session("test")
new_container = Container(name="test_transac_get_containers",
gate_uri="ssh://my_host/docker/test_transac_get_containers",
primary_admin_gate_name="container name space (pid)", company="Docker",
product="Docker", c_type="container")
new_container.save()
self.assertTrue(new_container in ContainerService.get_containers())
SessionService.commit()
self.assertTrue(new_container in ContainerService.get_containers())
new_container.remove()
self.assertFalse(new_container in ContainerService.get_containers())
SessionService.commit()
self.assertFalse(new_container in ContainerService.get_containers())
SessionService.close_session()
示例13: test_session_commit
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import commit [as 别名]
def test_session_commit(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.commit()
SessionService.close_session()
self.assertNotIn(thread_id, SessionService.session_registry)
self.assertEqual(ClusterService.get_clusters().__len__(), init_cluster_count + 1)
new_cluster.remove()
self.assertEqual(ClusterService.get_clusters().__len__(), init_cluster_count)
示例14: test_transac_create_remove_node_parent_container_1
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import commit [as 别名]
def test_transac_create_remove_node_parent_container_1(self):
SessionService.open_session("test_transac_create_remove_node_parent_container_1")
container2 = Container(name="test_transac_create_remove_node_parent_container_1_container2",
gate_uri="ssh://my_host/docker/test_transac_create_remove_node_parent_container_1_container2",
primary_admin_gate_name="container name space (pid)", company="Docker",
product="Docker", c_type="container")
gate = Gate(name="sshd", url="ssh://test_transac_create_remove_node_parent_container_1_ugly_docker_admin_endpoint2",
is_primary_admin=True,
container=container2)
gate.save()
SessionService.commit()
self.assertIsNotNone(gate.id)
self.assertTrue(gate.id in container2.nodes_id)
self.assertTrue(gate.id in container2.gates_id)
self.assertIsNotNone(gate.remove())
self.assertTrue(gate.id in container2.nodes_id)
self.assertTrue(gate.id in container2.gates_id)
container2.remove()
SessionService.commit()
SessionService.close_session()
示例15: test_transac_twin_nodes_link
# 需要导入模块: from ariane_clip3.mapping import SessionService [as 别名]
# 或者: from ariane_clip3.mapping.SessionService import commit [as 别名]
def test_transac_twin_nodes_link(self):
SessionService.open_session("test_transac_twin_nodes_link")
container2 = Container(name="test_transac_twin_nodes_link_container2",
gate_uri="ssh://my_host/docker/test_transac_twin_nodes_link_container2",
primary_admin_gate_name="container name space (pid)", company="Docker",
product="Docker", c_type="container")
gate1 = Gate(name="sshd", url="ssh://test_transac_twin_nodes_link_ugly_docker_admin_endpoint",
is_primary_admin=False,
container=self.container1)
gate2 = Gate(name="sshd", url="ssh://test_transac_twin_nodes_link_ugly_docker_admin_endpoint2",
is_primary_admin=False,
container=container2)
gate1.add_twin_node(gate2, sync=False)
self.assertTrue(gate2 in gate1.twin_nodes_2_add)
gate1.save()
SessionService.commit()
self.assertFalse(gate2 in gate1.twin_nodes_2_add)
self.assertTrue(gate2.id in gate1.twin_nodes_id)
self.assertTrue(gate1.id in gate2.twin_nodes_id)
gate2.del_twin_node(gate1, sync=False)
self.assertTrue(gate1 in gate2.twin_nodes_2_rm)
self.assertTrue(gate2.id in gate1.twin_nodes_id)
self.assertTrue(gate1.id in gate2.twin_nodes_id)
gate2.save()
SessionService.commit()
self.assertFalse(gate1 in gate2.twin_nodes_2_rm)
self.assertFalse(gate2.id in gate1.twin_nodes_id)
self.assertFalse(gate1.id in gate2.twin_nodes_id)
gate1.add_twin_node(gate2)
SessionService.commit()
self.assertTrue(gate2.id in gate1.twin_nodes_id)
self.assertTrue(gate1.id in gate2.twin_nodes_id)
gate2.del_twin_node(gate1)
SessionService.commit()
self.assertFalse(gate2.id in gate1.twin_nodes_id)
self.assertFalse(gate1.id in gate2.twin_nodes_id)
gate1.remove()
gate2.remove()
container2.remove()
SessionService.commit()
SessionService.close_session()