use of org.benchmarx.examples.familiestopersons.testsuite.Decisions in project benchmarx by eMoflon.
the class FunnyQTFamiliesToPerson method initiateSynchronisationDialogue.
@Override
public void initiateSynchronisationDialogue() {
srcModel = new XMIResourceImpl();
trgModel = new XMIResourceImpl();
FamilyRegister familiesRoot = FamiliesFactory.eINSTANCE.createFamilyRegister();
srcModel.getContents().add(familiesRoot);
setConfigurator(new Configurator<Decisions>().makeDecision(Decisions.PREFER_CREATING_PARENT_TO_CHILD, true).makeDecision(Decisions.PREFER_EXISTING_FAMILY_TO_NEW, true));
transform(RIGHT);
}
use of org.benchmarx.examples.familiestopersons.testsuite.Decisions in project benchmarx by eMoflon.
the class UbtXtendFamiliesToPersons method initiateSynchronisationDialogue.
/**
* Initiates a synchronization between a source and a target model. The BXtend Transformation is
* initialized and empty source, target and correspondence models are created.
* Finally a FamilyRegister is added to the source model and an initial forward transformation is issued
* to create a corresponding PersonRegister.
*/
@Override
public void initiateSynchronisationDialogue() {
// Fix default preferences (which can be overwritten)
setConfigurator(new Configurator<Decisions>().makeDecision(Decisions.PREFER_CREATING_PARENT_TO_CHILD, true).makeDecision(Decisions.PREFER_EXISTING_FAMILY_TO_NEW, true));
set.getResourceFactoryRegistry().getExtensionToFactoryMap().put("family", new XMIResourceFactoryImpl());
set.getResourceFactoryRegistry().getExtensionToFactoryMap().put("person", new XMIResourceFactoryImpl());
set.getResourceFactoryRegistry().getExtensionToFactoryMap().put("corr", new XMIResourceFactoryImpl());
source = set.createResource(URI.createURI("sourceModel.family"));
target = set.createResource(URI.createURI("targetModel.person"));
corr = set.createResource(URI.createURI("corrModel.corr"));
FamilyRegister familiesRoot = FamiliesFactory.eINSTANCE.createFamilyRegister();
source.getContents().add(familiesRoot);
f2pt = new Family2PersonTransformation(source, target, corr);
// Fix default preferences (which can be overwritten)
setConfigurator(new Configurator<Decisions>().makeDecision(Decisions.PREFER_CREATING_PARENT_TO_CHILD, true).makeDecision(Decisions.PREFER_EXISTING_FAMILY_TO_NEW, true));
// perform batch to establish consistent starting state
f2pt.Family2Person();
}
use of org.benchmarx.examples.familiestopersons.testsuite.Decisions in project benchmarx by eMoflon.
the class MediniQVTFamiliesToPersonsConfig method initiateSynchronisationDialogue.
/**
* Initiates a synchronization between a source and a target model. The medini QVT engine is initialized,
* the required metamodels are registered and empty source, target and configuration models are created.
* Finally a FamilyRegister is added to the source model and an initial forward transformation is issued
* to create a corresponding PersonRegister.
*/
@Override
public void initiateSynchronisationDialogue() {
// delete content of traces folder
File tracesFolder = new File("./src/org/benchmarx/examples/familiestopersons/implementations/medini/base/traces");
final File[] files = tracesFolder.listFiles();
if (files != null) {
for (File f : files) {
if (f != null)
f.delete();
}
}
// in case, no configuration is set, switch to default
checkConfiguration();
// Initialise resource set of models
this.resourceSet = new ResourceSetImpl();
this.resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(Resource.Factory.Registry.DEFAULT_EXTENSION, new XMIResourceFactoryImpl());
// Collect all necessary packages from the metamodel(s)
Collection<EPackage> metaPackages = new ArrayList<EPackage>();
this.collectMetaModels(metaPackages);
// Make these packages known to the QVT engine
init(metaPackages);
// Create resources for models
source = resourceSet.createResource(URI.createURI(RESULTPATH + "/source.xmi"));
config = resourceSet.createResource(URI.createURI(RESULTPATH + "/config.xmi"));
target = resourceSet.createResource(URI.createURI(RESULTPATH + "/target.xmi"));
// Collect the models, which should participate in the transformation.
// You can provide a list of models for each direction.
// The models must be added in the same order as defined in your transformation!
Collection<Collection<Resource>> modelResources = new ArrayList<Collection<Resource>>();
Collection<Resource> firstSetOfModels = new ArrayList<Resource>();
Collection<Resource> secondSetOfModels = new ArrayList<Resource>();
Collection<Resource> thirdSetOfModels = new ArrayList<Resource>();
modelResources.add(firstSetOfModels);
modelResources.add(secondSetOfModels);
modelResources.add(thirdSetOfModels);
firstSetOfModels.add(source);
secondSetOfModels.add(config);
thirdSetOfModels.add(target);
URI directory = URI.createFileURI(basePath + "traces");
this.preExecution(modelResources, directory);
// Call setConfigurator, which will initialize the configurator with default decisions
setConfigurator(new Configurator<Decisions>());
source.getContents().add(FamiliesFactory.eINSTANCE.createFamilyRegister());
config.getContents().add(ConfigFactory.eINSTANCE.createConfiguration());
launchFWD();
}
use of org.benchmarx.examples.familiestopersons.testsuite.Decisions in project benchmarx by eMoflon.
the class EMoflonFamiliesToPersons method initiateSynchronisationDialogue.
@Override
public void initiateSynchronisationDialogue() {
BasicConfigurator.configure();
helper = new F2PSyncHelper();
Resource r = helper.getResourceSet().createResource(URI.createURI("sourceModel"));
FamilyRegister familiesRoot = FamiliesFactory.eINSTANCE.createFamilyRegister();
r.getContents().add(familiesRoot);
// Fix default preferences (which can be overwritten)
setConfigurator(new Configurator<Decisions>().makeDecision(Decisions.PREFER_CREATING_PARENT_TO_CHILD, true).makeDecision(Decisions.PREFER_EXISTING_FAMILY_TO_NEW, true));
// perform batch to establish consistent starting state
helper.setSrc(familiesRoot);
helper.integrateForward();
helper.setMute(true);
}
Aggregations