本文整理汇总了Python中ariane_clip3.mapping.Node.save方法的典型用法代码示例。如果您正苦于以下问题:Python Node.save方法的具体用法?Python Node.save怎么用?Python Node.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ariane_clip3.mapping.Node
的用法示例。
在下文中一共展示了Node.save方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_twin_nodes_link
# 需要导入模块: from ariane_clip3.mapping import Node [as 别名]
# 或者: from ariane_clip3.mapping.Node import save [as 别名]
def test_twin_nodes_link(self):
container2 = Container(name="test_twin_nodes_link_container2",
gate_uri="ssh://my_host/docker/test_twin_nodes_link_container2",
primary_admin_gate_name="container name space (pid)", company="Docker",
product="Docker", c_type="container")
node_mysql1 = Node(name="mysqld1", container=self.container1)
node_mysql2 = Node(name="mysqld2", container=container2)
node_mysql1.add_twin_node(node_mysql2, sync=False)
self.assertTrue(node_mysql2 in node_mysql1.twin_nodes_2_add)
node_mysql1.save()
self.assertFalse(node_mysql2 in node_mysql1.twin_nodes_2_add)
self.assertTrue(node_mysql2.id in node_mysql1.twin_nodes_id)
self.assertTrue(node_mysql1.id in node_mysql2.twin_nodes_id)
node_mysql2.del_twin_node(node_mysql1, sync=False)
self.assertTrue(node_mysql1 in node_mysql2.twin_nodes_2_rm)
self.assertTrue(node_mysql2.id in node_mysql1.twin_nodes_id)
self.assertTrue(node_mysql1.id in node_mysql2.twin_nodes_id)
node_mysql2.save()
self.assertFalse(node_mysql1 in node_mysql2.twin_nodes_2_rm)
self.assertFalse(node_mysql2.id in node_mysql1.twin_nodes_id)
self.assertFalse(node_mysql1.id in node_mysql2.twin_nodes_id)
node_mysql1.add_twin_node(node_mysql2)
self.assertTrue(node_mysql2.id in node_mysql1.twin_nodes_id)
self.assertTrue(node_mysql1.id in node_mysql2.twin_nodes_id)
node_mysql2.del_twin_node(node_mysql1)
self.assertFalse(node_mysql2.id in node_mysql1.twin_nodes_id)
self.assertFalse(node_mysql1.id in node_mysql2.twin_nodes_id)
node_mysql1.remove()
node_mysql2.remove()
container2.remove()
示例2: test_find_node_by_name_in_parent_node
# 需要导入模块: from ariane_clip3.mapping import Node [as 别名]
# 或者: from ariane_clip3.mapping.Node import save [as 别名]
def test_find_node_by_name_in_parent_node(self):
pnode = Node(name="mysqld", container_id=self.container1.id)
pnode.save()
node = Node(name="a_database", container_id=self.container1.id, parent_node_id=pnode.id)
node.save()
self.assertIsNotNone(NodeService.find_node(name=node.name, pnid=node.parent_node_id))
node.remove()
self.assertIsNone(NodeService.find_node(name=node.name, pnid=node.parent_node_id))
pnode.remove()
示例3: test_create_remove_node_basic
# 需要导入模块: from ariane_clip3.mapping import Node [as 别名]
# 或者: from ariane_clip3.mapping.Node import save [as 别名]
def test_create_remove_node_basic(self):
node = Node(name="mysqld", container_id=self.container1.id)
node.save()
self.assertIsNotNone(node.id)
self.container1.sync()
self.assertTrue(node.id in self.container1.nodes_id)
self.assertIsNone(node.remove())
self.container1.sync()
self.assertFalse(node.id in self.container1.nodes_id)
示例4: test_create_remove_node_parent_container
# 需要导入模块: from ariane_clip3.mapping import Node [as 别名]
# 或者: from ariane_clip3.mapping.Node import save [as 别名]
def test_create_remove_node_parent_container(self):
container2 = Container(name="test_create_remove_node_parent_container_container2",
gate_uri="ssh://my_host/docker/test_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()
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()
示例5: test_transac_create_remove_node_basic
# 需要导入模块: from ariane_clip3.mapping import Node [as 别名]
# 或者: from ariane_clip3.mapping.Node import save [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()
示例6: test_create_remove_endpoint_parent_node
# 需要导入模块: from ariane_clip3.mapping import Node [as 别名]
# 或者: from ariane_clip3.mapping.Node import save [as 别名]
def test_create_remove_endpoint_parent_node(self):
container2 = Container(name="test_create_remove_endpoint_parent_node_container2",
gate_uri="ssh://my_host/docker/test_create_remove_endpoint_parent_node_container2",
primary_admin_gate_name="container name space (pid)", company="Docker",
product="Docker", c_type="container")
node2 = Node(name="mysqld", container=container2)
node2.save()
endpoint2 = Endpoint(url="mysql://test_create_remove_endpoint_parent_node_container2:4385", parent_node=node2)
endpoint2.save()
self.assertIsNotNone(endpoint2.id)
self.assertTrue(endpoint2.id in node2.endpoints_id)
self.assertIsNone(endpoint2.remove())
self.assertFalse(endpoint2.id in node2.endpoints_id)
node2.remove()
container2.remove()
开发者ID:echinopsii,项目名称:net.echinopsii.ariane.community.cli.python3,代码行数:17,代码来源:endpoint_rabbitmq_at.py
示例7: test_transac_node_properties
# 需要导入模块: from ariane_clip3.mapping import Node [as 别名]
# 或者: from ariane_clip3.mapping.Node import save [as 别名]
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()
示例8: test_create_remove_node_parent_node
# 需要导入模块: from ariane_clip3.mapping import Node [as 别名]
# 或者: from ariane_clip3.mapping.Node import save [as 别名]
def test_create_remove_node_parent_node(self):
container2 = Container(name="test_create_remove_node_parent_node_container2",
gate_uri="ssh://my_host/docker/test_create_remove_node_parent_node_container2",
primary_admin_gate_name="container name space (pid)", company="Docker",
product="Docker", c_type="container")
node_mysql = Node(name="mysqld", container=container2)
node_db = Node(name="my_db", container=container2, parent_node=node_mysql)
node_db.save()
self.assertIsNotNone(node_db.id)
self.assertIsNotNone(node_mysql.id)
self.assertTrue(node_db.id in node_mysql.child_nodes_id)
self.assertTrue(node_db.parent_node_id == node_mysql.id)
node_db.remove()
self.assertFalse(node_db.id in node_mysql.child_nodes_id)
node_mysql.remove()
container2.remove()
示例9: test_get_nodes
# 需要导入模块: from ariane_clip3.mapping import Node [as 别名]
# 或者: from ariane_clip3.mapping.Node import save [as 别名]
def test_get_nodes(self):
node = Node(name="mysqld", container_id=self.container1.id)
node.save()
self.assertTrue(node in NodeService.get_nodes())
node.remove()
self.assertFalse(node in NodeService.get_nodes())
示例10: test_find_node_by_name_in_container
# 需要导入模块: from ariane_clip3.mapping import Node [as 别名]
# 或者: from ariane_clip3.mapping.Node import save [as 别名]
def test_find_node_by_name_in_container(self):
node = Node(name="mysqld", container_id=self.container1.id)
node.save()
self.assertIsNotNone(NodeService.find_node(name=node.name, cid=node.container_id))
node.remove()
self.assertIsNone(NodeService.find_node(name=node.name, cid=node.container_id))
示例11: test_find_node_by_selector
# 需要导入模块: from ariane_clip3.mapping import Node [as 别名]
# 或者: from ariane_clip3.mapping.Node import save [as 别名]
def test_find_node_by_selector(self):
node = Node(name="[pid] cmd", container_id=self.container1.id)
node.save()
self.assertTrue(node, NodeService.find_node(selector="nodeName =~ '.*pid.*cmd'"))
node.remove()
self.assertIsNone(NodeService.find_node(selector="nodeName =~ '.*pid.*cmd'"))
示例12: EndpointTest
# 需要导入模块: from ariane_clip3.mapping import Node [as 别名]
# 或者: from ariane_clip3.mapping.Node import save [as 别名]
class EndpointTest(unittest.TestCase):
def setUp(self):
args = {'type': 'REST', 'base_url': 'http://localhost:6969/ariane/', 'user': 'yoda', 'password': 'secret'}
MappingService(args)
self.container1 = Container(name="test_endpoint_container1",
gate_uri="ssh://my_host/docker/test_endpoint_container1",
primary_admin_gate_name="container name space (pid)", company="Docker",
product="Docker", c_type="container")
self.container1.save()
self.node1 = Node(name="mysqld", container_id=self.container1.id)
self.node1.save()
def tearDown(self):
self.node1.remove()
self.container1.remove()
def test_create_remove_endpoint_basic(self):
endpoint = Endpoint(url="mysql://test_create_remove_endpoint_basic:4385", parent_node_id=self.node1.id)
endpoint.save()
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)
def test_create_remove_endpoint_parent_node(self):
container2 = Container(name="test_create_remove_endpoint_parent_node_container2",
gate_uri="ssh://my_host/docker/test_create_remove_endpoint_parent_node_container2",
primary_admin_gate_name="container name space (pid)", company="Docker",
product="Docker", c_type="container")
node2 = Node(name="mysqld", container=container2)
node2.save()
endpoint2 = Endpoint(url="mysql://test_create_remove_endpoint_parent_node_container2:4385", parent_node=node2)
endpoint2.save()
self.assertIsNotNone(endpoint2.id)
self.assertTrue(endpoint2.id in node2.endpoints_id)
self.assertIsNone(endpoint2.remove())
self.assertFalse(endpoint2.id in node2.endpoints_id)
node2.remove()
container2.remove()
def test_find_endpoint_by_id(self):
endpoint = Endpoint(url="mysql://test_find_endpoint_by_id_container1:4385", parent_node_id=self.node1.id)
endpoint.save()
self.assertIsNotNone(EndpointService.find_endpoint(eid=endpoint.id))
endpoint.remove()
self.assertIsNone(EndpointService.find_endpoint(eid=endpoint.id))
def test_find_endpoint_by_url(self):
endpoint = Endpoint(url="mysql://test_find_endpoint_by_url_container1:4385", parent_node_id=self.node1.id)
endpoint.save()
self.assertIsNotNone(EndpointService.find_endpoint(url=endpoint.url))
endpoint.remove()
self.assertIsNone(EndpointService.find_endpoint(url=endpoint.url))
def test_find_endpoint_by_selector(self):
endpoint = Endpoint(url="mysql://test_find_endpoint_by_selector_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))
endpoint.remove()
self.assertIsNone(EndpointService.find_endpoint(selector="endpointURL =~ 'mysql:.*'"))
def test_get_endpoints(self):
endpoint = Endpoint(url="mysql://test_get_endpoints_container1:4385", parent_node_id=self.node1.id)
endpoint.save()
self.assertTrue(endpoint in EndpointService.get_endpoints())
endpoint.remove()
self.assertFalse(endpoint in EndpointService.get_endpoints())
def test_endpoint_properties(self):
endpoint = Endpoint(url="mysql://test_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()
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)
#.........这里部分代码省略.........
示例13: LinkTest
# 需要导入模块: from ariane_clip3.mapping import Node [as 别名]
# 或者: from ariane_clip3.mapping.Node import save [as 别名]
class LinkTest(unittest.TestCase):
def setUp(self):
args = {'type': 'REST', 'base_url': 'http://localhost:6969/ariane/', 'user': 'yoda', 'password': 'secret'}
MappingService(args)
self.container1 = Container(name="test_link_container1", gate_uri="ssh://my_host/docker/test_link_container1",
primary_admin_gate_name="container name space (pid)", company="Docker",
product="Docker", c_type="container")
self.container1.save()
self.node1 = Node(name="mysqld", container_id=self.container1.id)
self.node1.save()
self.endpoint1 = Endpoint(url="mysql://test_link_container1:4385", parent_node_id=self.node1.id)
self.endpoint1.save()
self.container2 = Container(name="test_link_container2", gate_uri="ssh://my_host/docker/test_link_container2",
primary_admin_gate_name="container name space (pid)", company="Docker",
product="Docker", c_type="container")
self.container2.save()
self.node2 = Node(name="mysql.cli", container_id=self.container2.id)
self.node2.save()
self.endpoint2 = Endpoint(url="mysql://test_link_container2:12385", parent_node_id=self.node1.id)
self.endpoint2.save()
self.transport = Transport(name="transport_link_test")
self.transport.save()
def tearDown(self):
self.endpoint1.remove()
self.endpoint2.remove()
self.node1.remove()
self.node2.remove()
self.container1.remove()
self.container2.remove()
self.transport.remove()
def test_create_remove_link_basic(self):
link = Link(source_endpoint_id=self.endpoint1.id, target_endpoint_id=self.endpoint2.id,
transport_id=self.transport.id)
link.save()
self.assertIsNotNone(link.id)
self.assertIsNone(link.remove())
def test_find_link_by_id(self):
link = Link(source_endpoint_id=self.endpoint1.id, target_endpoint_id=self.endpoint2.id,
transport_id=self.transport.id)
link.save()
self.assertIsNotNone(LinkService.find_link(lid=link.id))
link.remove()
self.assertIsNone(LinkService.find_link(lid=link.id))
def test_find_link_by_sourceEP(self):
link = Link(source_endpoint_id=self.endpoint1.id, target_endpoint_id=self.endpoint2.id,
transport_id=self.transport.id)
link.save()
self.assertTrue(link in LinkService.find_link(sep_id=self.endpoint1.id))
link.remove()
self.assertIsNone(LinkService.find_link(lid=link.id))
def test_find_link_by_targetEP(self):
link = Link(source_endpoint_id=self.endpoint1.id, target_endpoint_id=self.endpoint2.id,
transport_id=self.transport.id)
link.save()
self.assertTrue(link in LinkService.find_link(tep_id=self.endpoint2.id))
link.remove()
self.assertIsNone(LinkService.find_link(lid=link.id))
def test_find_link_by_sourceEP_targetEP(self):
link = Link(source_endpoint_id=self.endpoint1.id, target_endpoint_id=self.endpoint2.id,
transport_id=self.transport.id)
link.save()
self.assertIsNotNone(LinkService.find_link(sep_id=self.endpoint1.id, tep_id=self.endpoint2.id))
link.remove()
self.assertIsNone(LinkService.find_link(lid=link.id))
def test_get_links(self):
link = Link(source_endpoint_id=self.endpoint1.id, target_endpoint_id=self.endpoint2.id,
transport_id=self.transport.id)
link.save()
self.assertTrue(link in LinkService.get_links())
link.remove()
self.assertFalse(link in LinkService.get_links())
def test_transac_create_remove_link_basic(self):
SessionService.open_session("test")
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()
def test_transac_get_links(self):
SessionService.open_session("test")
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()
#.........这里部分代码省略.........