use of org.kanonizo.Framework in project kanonizo by kanonizo.
the class KanonizoFrame method load.
@FXML
public void load() {
try {
FileChooser fc = new FileChooser();
File loadLocation = new File(System.getProperty("user.home") + File.separator + ".kanonizo");
if (!loadLocation.exists()) {
loadLocation.mkdir();
}
fc.setInitialDirectory(loadLocation);
File toRead = fc.showOpenDialog(KanonizoFxApplication.stage);
if (toRead != null) {
new Thread(() -> {
try {
Framework read = fw.read(toRead);
this.fw.setSourceFolder(read.getSourceFolder());
this.fw.setRootFolder(read.getRootFolder());
this.fw.setTestFolder(read.getTestFolder());
this.fw.setAlgorithm(read.getAlgorithm());
this.fw.setInstrumenter(read.getInstrumenter());
read.getLibraries().forEach(lib -> this.fw.addLibrary(lib));
Platform.runLater(() -> {
File root = fw.getRootFolder();
rootFolderTextField.setText(root.getAbsolutePath());
sourceTree.setRoot(GuiUtils.createDynamicFileTree(root));
sourceTree.scrollTo(findIndexOfChild(fw.getSourceFolder(), sourceTree));
testTree.setRoot(GuiUtils.createDynamicFileTree(root));
testTree.scrollTo(findIndexOfChild(fw.getTestFolder(), testTree));
libs.getItems().addAll(fw.getLibraries());
algorithmChoices.getSelectionModel().select(fw.getAlgorithm());
instrumenterChoices.getSelectionModel().select(fw.getInstrumenter());
});
} catch (Exception e) {
e.printStackTrace();
}
}).start();
}
} catch (Exception e) {
AlertUtils.alert(AlertType.ERROR, e.getClass().getName(), e.getMessage());
}
}
use of org.kanonizo.Framework in project kanonizo by kanonizo.
the class SearchAlgorithmTest method setup.
@Before
public void setup() {
Framework f = Framework.getInstance();
f.setInstrumenter(scytheInst);
f.setSourceFolder(new File("./testing/src"));
f.setTestFolder(new File("./testing/test"));
try {
InstrumentationProperties.WRITE_CLASS_IF_MODIFIED = true;
Thread.currentThread().setContextClassLoader(InstrumentingClassLoader.getInstance());
scytheInst.loadClass("sample_classes.Stack");
scytheInst.loadClass("sample_tests.StackTest");
} catch (ClassNotFoundException e) {
fail("Couldn't find class sample_classes.Stack");
}
f.setAlgorithm(algorithm);
try {
f.run();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations