コード例 #1
0
 def test_serialize_deserialize_packed_resource_graph(self):
     serialized_resource_graph = graph.serialize_resource_graph(
         resource_graph)
     deserialized_resource_graph = graph.deserialize_resource_graph(
         serialized_resource_graph)
     self.assertEqual(len(resource_graph), len(deserialized_resource_graph))
     for start_node in resource_graph:
         self.assertIn(start_node, deserialized_resource_graph)
コード例 #2
0
 def test_graph_serialize(self):
     resource_a = resource.Resource('server', 0, 'a', {'name': 'a'})
     resource_b = resource.Resource('volume', 1, 'b', {'name': 'b'})
     test_base = {resource_a: [resource_b], resource_b: []}
     test_graph = graph.build_graph(test_base.keys(), test_base.__getitem__)
     self.assertIn(graph.serialize_resource_graph(test_graph), [
         '[{"0x1": ["server", 0, "a", {"name": "a"}], '
         '"0x0": ["volume", 1, "b", {"name": "b"}]}, '
         '[["0x1", ["0x0"]]]]',
         '[{"0x0": ["volume", 1, "b", {"name": "b"}], '
         '"0x1": ["server", 0, "a", {"name": "a"}]}, '
         '[["0x1", ["0x0"]]]]'
     ])
コード例 #3
0
 def resource_graph(self, resource_graph):
     serialized_resource_graph = graph.serialize_resource_graph(
         resource_graph)
     self._md_cache["resource_graph"] = serialized_resource_graph
コード例 #4
0
ファイル: checkpoint.py プロジェクト: openstack/smaug
 def resource_graph(self, resource_graph):
     serialized_resource_graph = graph.serialize_resource_graph(
         resource_graph)
     self._md_cache["resource_graph"] = serialized_resource_graph