Commit ffdbe0d3 authored by Lydia's avatar Lydia
Browse files

test commit

parent 361d9be2
package tools.descartes.dml.empirical.extract.dependencies;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.junit.Test;
import tools.descartes.dml.empirical.extract.dependencies.identification.RandomForestImpurityExtractor;
import tools.descartes.dml.empirical.variablemapping.AbstractDataSource;
import tools.descartes.dml.empirical.variablemapping.KiekerDataSource;
import tools.descartes.dml.empirical.variablemapping.OperationExecutionRecordFilter;
import tools.descartes.dml.empirical.variablemapping.VariablemappingFactory;
public class DependencyTeaStore {
private ResourceSet resourceSet;
@SuppressWarnings("unchecked")
protected <T extends EObject> T loadModel(String fileName, Class<T> class1) {
try {
File f = new File(fileName);
org.eclipse.emf.ecore.resource.Resource res = this.getResourceSet()
.getResource(URI.createFileURI(f.getAbsolutePath()), true);
T model = (T) res.getContents().get(0);
if (model == null)
throw new IllegalStateException("Unable to load test file!");
return model;
} catch (Exception e) {
throw new IllegalStateException(e);
}
}
private ResourceSet getResourceSet() {
if (null == resourceSet)
this.resourceSet = new ResourceSetImpl();
return resourceSet;
}
public List<KiekerDataSource> getMultiEntityData() {
ArrayList<KiekerDataSource> results = new ArrayList<KiekerDataSource>();
List<String> sources = getKiekerDatasourcePaths();
for (String source : sources) {
KiekerDataSource kiekerDs = loadModel(source, KiekerDataSource.class);
kiekerDs.setHandlerType(
"tools.descartes.dml.empirical.datasourceloader.kieker.multientityhandlers.TraceOperationExecutionWithParametersRecordHandler");
kiekerDs.setRecordID(3);
OperationExecutionRecordFilter filter = VariablemappingFactory.eINSTANCE
.createOperationExecutionRecordFilter();
kiekerDs.setRecordFilter(filter);
results.add(kiekerDs);
}
System.out.print(results);
return results;
}
protected List<String> getKiekerDatasourcePaths() {
ArrayList<String> list = new ArrayList<String>();
list.add(
"testfiles/kieker/manualKiekerOperationExecutionWithParameterRecord/validManualKiekerOperationExecutionWithParameterRecord.variablemapping");
return list;
}
@Test
public void getResults() {
DependencyExtractor dcp = new DependencyExtractor();
boolean runAnomalyDetectiona = false;
boolean postProcessDependencies = false;
dcp.extract((AbstractDataSource) getMultiEntityData(), new RandomForestImpurityExtractor(),
runAnomalyDetectiona, postProcessDependencies);
System.out.println(dcp.getModelParameterDependencies());
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment