本文整理汇总了Python中ariane_clip3.mapping.Node类的典型用法代码示例。如果您正苦于以下问题:Python Node类的具体用法?Python Node怎么用?Python Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Node类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_twin_endpoints_link
def test_twin_endpoints_link(self):
container2 = Container(name="test_twin_endpoints_link_container2",
gate_uri="ssh://my_host/docker/test_twin_endpoints_link_container2",
primary_admin_gate_name="container name space (pid)", company="Docker",
product="Docker", c_type="container")
node2 = Node(name="mysqld2", container=container2)
endpoint1 = Endpoint(url="mysql://test_twin_endpoints_link_container1:4385", parent_node_id=self.node1.id)
endpoint2 = Endpoint(url="mysql://test_twin_endpoints_link_container2:4385", parent_node=node2)
endpoint1.add_twin_endpoint(endpoint2, sync=False)
self.assertTrue(endpoint2 in endpoint1.twin_endpoints_2_add)
endpoint1.save()
self.assertFalse(endpoint2 in endpoint1.twin_endpoints_2_add)
self.assertTrue(endpoint2.id in endpoint1.twin_endpoints_id)
self.assertTrue(endpoint1.id in endpoint2.twin_endpoints_id)
endpoint2.del_twin_endpoint(endpoint1, sync=False)
self.assertTrue(endpoint1 in endpoint2.twin_endpoints_2_rm)
self.assertTrue(endpoint2.id in endpoint1.twin_endpoints_id)
self.assertTrue(endpoint1.id in endpoint2.twin_endpoints_id)
endpoint2.save()
self.assertFalse(endpoint1 in endpoint2.twin_endpoints_2_rm)
self.assertFalse(endpoint2.id in endpoint1.twin_endpoints_id)
self.assertFalse(endpoint1.id in endpoint2.twin_endpoints_id)
endpoint1.add_twin_endpoint(endpoint2)
self.assertTrue(endpoint2.id in endpoint1.twin_endpoints_id)
self.assertTrue(endpoint1.id in endpoint2.twin_endpoints_id)
endpoint2.del_twin_endpoint(endpoint1)
self.assertFalse(endpoint2.id in endpoint1.twin_endpoints_id)
self.assertFalse(endpoint1.id in endpoint2.twin_endpoints_id)
endpoint1.remove()
endpoint2.remove()
node2.remove()
container2.remove()
开发者ID:echinopsii,项目名称:net.echinopsii.ariane.community.cli.python3,代码行数:32,代码来源:endpoint_rabbitmq_at.py
示例2: test_find_node_by_name_in_parent_node
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
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
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
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
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,代码行数:15,代码来源:endpoint_rabbitmq_at.py
示例7: setUp
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()
示例8: setUp
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()
示例9: test_create_remove_node_parent_node
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()
示例10: test_twin_nodes_link
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()
示例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()
示例12: test_get_nodes
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())
示例13: test_find_node_by_name_in_container
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))
示例14: test_find_node_by_selector
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'"))
示例15: EndpointTest
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)
#.........这里部分代码省略.........