def test_simple_edition_cell_with_container(self):
        virtual_cell = BlockCellName('user/block/path/file.h')
        simpleresource = SimpleCell("user/block/path/to/file.h")
        simpleresource.ID = BlockCellName("user/block/path/to/file.h")
        simpleresource.root = ID()
        simpleresource.dependencies.add_implicit(BlockCellName("user/block/path/file.h"))
        simpleresource.container = virtual_cell

        s = simpleresource.serialize()

        self.assertEqual(s[Deserializer.POLIMORPHIC_KEYWORD],
                         ClassTypedSerializer.getValue(SimpleCell))
        ob = CellDeserializer(BlockCellName).deserialize(s)
        self.assert_bii_equal(ob, simpleresource)
Example #2
0
    def test_simple_edition_cell_with_container(self):
        virtual_cell = BlockCellName('user/block/path/file.h')
        simpleresource = SimpleCell("user/block/path/to/file.h")
        simpleresource.ID = BlockCellName("user/block/path/to/file.h")
        simpleresource.root = ID()
        simpleresource.dependencies.add_implicit(
            BlockCellName("user/block/path/file.h"))
        simpleresource.container = virtual_cell

        s = simpleresource.serialize()

        self.assertEqual(s[Deserializer.POLIMORPHIC_KEYWORD],
                         ClassTypedSerializer.getValue(SimpleCell))
        ob = CellDeserializer(BlockCellName).deserialize(s)
        self.assert_bii_equal(ob, simpleresource)
Example #3
0
 def _process_leaves(self, virtual_cell, realizations, biiout):
     '''for a virtual cell, creates the leaves if they don't exist
     @param virtual_cell: the cell that serves as base
     @param realizations: a set to add the leaves BlockCellNames
     @param biiout: biiout
     '''
     block_cell_name = virtual_cell.name
     for leave in virtual_cell.resource_leaves:
         realizations.add(leave)
         try:
             cell = self.block_holder[leave.cell_name].cell
         except KeyError:
             #The leave it is pointing does not exist
             biiout.info('%s virtual realization not existing, creating it' % leave)
             cell = SimpleCell(leave)
             cell.type = virtual_cell.type
             content = Content(leave, Blob(""), created=True)
             content.parser = parser_factory(cell.type, cell.name.cell_name)
             self.block_holder.add_resource(Resource(cell, content))
         cell.container = block_cell_name