use of de.dagere.peass.analysis.changes.ChangeReader in project peass by DaGeRe.
the class GetChanges method createReader.
private ChangeReader createReader(final ResultsFolders resultsFolders, final SelectedTests selectedTests) throws FileNotFoundException {
RunCommandWriterRCA runCommandWriter = null;
RunCommandWriterSlurmRCA runCommandWriterSlurm = null;
if (selectedTests.getUrl() != null && !selectedTests.getUrl().isEmpty()) {
final PrintStream runCommandPrinter = new PrintStream(new File(resultsFolders.getStatisticsFile().getParentFile(), "run-rca-" + selectedTests.getName() + ".sh"));
runCommandWriter = new RunCommandWriterRCA(runCommandPrinter, "default", selectedTests);
final PrintStream runCommandPrinterRCA = new PrintStream(new File(resultsFolders.getStatisticsFile().getParentFile(), "run-rca-slurm-" + selectedTests.getName() + ".sh"));
runCommandWriterSlurm = new RunCommandWriterSlurmRCA(runCommandPrinterRCA, "default", selectedTests);
}
final ChangeReader reader = new ChangeReader(resultsFolders, runCommandWriter, runCommandWriterSlurm, selectedTests);
reader.setConfig(statisticConfigMixin.getStasticsConfig());
return reader;
}
use of de.dagere.peass.analysis.changes.ChangeReader in project peass by DaGeRe.
the class TestChangeReader method testBasicUsage.
@Test
public void testBasicUsage() throws JAXBException, JsonProcessingException {
ChangeReader reader = new ChangeReader("android-example-correct", new ExecutionData());
ProjectChanges changes = reader.readFile(TestAnalyseFullData.REGULAR_DATA_FOLDER.getParentFile());
System.out.println(Constants.OBJECTMAPPER.writeValueAsString(changes));
List<Change> methodChanges = changes.getVersionChanges().get("946e4318267b56838aa35da0a2a4e5c0528bfe04").getTestcaseChanges().get("com.example.android_example.ExampleUnitTest");
Assert.assertEquals(1, methodChanges.size());
Assert.assertEquals("test_TestMe", methodChanges.get(0).getMethod());
Assert.assertEquals(15087.66, methodChanges.get(0).getOldTime(), 0.1);
}
use of de.dagere.peass.analysis.changes.ChangeReader in project peass by DaGeRe.
the class GetChanges method call.
@Override
public Void call() throws Exception {
SelectedTests selectedTests = VersionSorter.getSelectedTests(staticSelectionFile, executionFile);
if (!out.exists()) {
out.mkdirs();
}
LOG.info("Errors: 1: {} 2: {}", statisticConfigMixin.getType1error(), statisticConfigMixin.getType2error());
ResultsFolders folders = new ResultsFolders(out, "out");
final ChangeReader reader = createReader(folders, selectedTests);
if (staticSelectionFile != null) {
StaticTestSelection dependencies = Constants.OBJECTMAPPER.readValue(staticSelectionFile, StaticTestSelection.class);
reader.setTests(dependencies.toExecutionData().getVersions());
}
if (executionFile != null) {
ExecutionData executions = Constants.OBJECTMAPPER.readValue(executionFile, ExecutionData.class);
reader.setTests(executions.getVersions());
}
for (final File dataFile : data) {
reader.readFile(dataFile);
}
return null;
}
use of de.dagere.peass.analysis.changes.ChangeReader in project peass by DaGeRe.
the class GetAllChanges method getChangesForMeasurementfolder.
public static void getChangesForMeasurementfolder(final RepoFolders folders, final String project, final File cleanFolder, final StaticTestSelection dependencies) throws JAXBException, FileNotFoundException {
ResultsFolders resultsFolders = new ResultsFolders(folders.getProjectStatisticsFolder(project), project);
final ChangeReader reader = new ChangeReader(resultsFolders, project, dependencies);
final ProjectChanges changes = reader.readFile(cleanFolder);
if (changes != null) {
final File allPropertyFile = new File(folders.getPropertiesFolder(), project + File.separator + "properties_alltests.json");
if (allPropertyFile.exists()) {
final VersionChangeProperties properties = ReadProperties.readVersionProperties(changes, allPropertyFile);
try {
// final ProjectChanges oldKnowledge = ProjectChanges.getOldChanges();
// ProjectChanges.mergeKnowledge(oldKnowledge, knowledge);
// ReadProperties.writeOnlySource(properties, oldKnowledge);
Constants.OBJECTMAPPER.writeValue(folders.getProjectPropertyFile(project), properties);
} catch (final IOException e) {
e.printStackTrace();
}
}
}
}
use of de.dagere.peass.analysis.changes.ChangeReader in project peass by DaGeRe.
the class MissingExecutionFinder method removeSlurmExecutions.
private void removeSlurmExecutions(final File folder) throws JAXBException {
ChangeReader reader = new ChangeReader(folder.getName(), tests);
reader.readFile(folder);
for (Entry<String, TestcaseData> entry : reader.getAllData().getData().entrySet()) {
String version = entry.getKey();
TestSet versionsTests = tests.getVersions().get(version);
LOG.debug("Removing from: {}", version);
for (TestCase test : entry.getValue().getTestcaseData().keySet()) {
removeTestFromTestSet(test.getClazz(), test.getMethod(), versionsTests);
}
}
}
Aggregations