Beispiel #1
0
def exec(model):
    # Create the manager
    dm = DiscoverMetamodels()
    # Read the model
    fm = dm.use_transformation_t2m(src=model, dst='fm')
    # Print the model
    #print(fm)
    # Transform to Python-sat metamodel
    pysatm = dm.use_transformation_m2m(src=fm, dst='pysat')
    # Operation execute return the object instance
    operation = dm.use_operation(src=pysatm, operation='DeadFeatures')
    # Print the result
    print("Result:", str(operation.get_result()))
Beispiel #2
0
    def test_discover_apply_functions(self, mocker):
        mocker.return_value = [one_plugin]
        search = DiscoverMetamodels()

        with raises(PluginNotFound) as error:
            search.use_transformation_t2m(src='file.ext', dst='foo')
        assert error.typename == 'PluginNotFound'

        variability_model = search.use_transformation_t2m(src='file.ext',
                                                          dst='ext')
        assert isinstance(variability_model, VariabilityModel)

        operation = search.use_operation(src=variability_model,
                                         operation_name='Operation1')

        assert operation.get_result() == '123456'
Beispiel #3
0
from famapy.core.discover import DiscoverMetamodels

# create the manager
dm = DiscoverMetamodels()

# Example t2m
fm = dm.use_transformation_t2m(src='example.xml', dst='fm')
print(fm)

# Example m2t
dm.use_transformation_m2t(src=fm, dst='output.json')

# Example m2m
# TODO: create VariabilityModel and get src extension
# todo debe haber alguna forma de pasarle el modelo cargado a la transformacion
# y que te lo devuelva en pysast
# dm.use_transformation_m2m(src=VariabilityModel, dst='pysat')
pysatm = dm.use_transformation_m2m(src=fm, dst='pysat')
print(pysatm)

# operation execute return the object instance
operation = dm.use_operation(src=pysatm, operation='Valid')
print("Result operation valid:", operation.is_valid())