use of de.dagere.peass.analysis.changes.ProjectChanges in project peass by DaGeRe.
the class ExperimentSelector method findMeasuredChange.
private Change findMeasuredChange(final ProjectChanges changes, final String version, final String testcase, final ChangeProperty change) {
Change statChange = null;
final Changes versionChanges = changes.getVersionChanges().get(version);
if (versionChanges != null) {
final List<Change> testcaseChanges = versionChanges.getTestcaseChanges().get(testcase);
if (testcaseChanges != null) {
statChange = findStatChange(change, testcaseChanges);
}
}
return statChange;
}
use of de.dagere.peass.analysis.changes.ProjectChanges 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.ProjectChanges in project peass by DaGeRe.
the class FindChangeExecutions method writeExecutions.
public static void writeExecutions(final File projectChangeFile, final ExecutionData executions, final RunCommandWriter writer) throws IOException, JsonParseException, JsonMappingException {
final List<String> versions = new LinkedList<String>(executions.getVersions().keySet());
final ProjectChanges changes = Constants.OBJECTMAPPER.readValue(projectChangeFile, ProjectChanges.class);
changes.executeProcessor((version, testclazz, change) -> {
final int versionIndex = versions.indexOf(version);
if (versionIndex != -1) {
writer.createSingleMethodCommand(versionIndex, version, testclazz + "#" + change.getMethod());
}
});
}
use of de.dagere.peass.analysis.changes.ProjectChanges in project peass by DaGeRe.
the class TestAnalyseFullData method testReading.
@Test
public void testReading() throws InterruptedException {
LinkedList<GitCommit> versions = new LinkedList<GitCommit>();
versions.add(new GitCommit("946e4318267b56838aa35da0a2a4e5c0528bfe04", "", "", ""));
versions.add(new GitCommit("fd79b2039667c09167c721b2823425629fad6d11", "", "", ""));
VersionComparator.setVersions(versions);
File baseFolder = new File(DATA_READING_FOLDER, "android-example-correct");
ModuleClassMapping mapping = new ModuleClassMapping(baseFolder, new ProjectModules(new File(baseFolder, "app")), new ExecutionConfig());
AnalyseFullData afd = new AnalyseFullData(new File("target/test.json"), new ProjectStatistics(), mapping, new StatisticsConfig());
afd.analyseFolder(REGULAR_DATA_FOLDER);
ProjectChanges changes = afd.getProjectChanges();
Set<String> changedTests = changes.getVersion("946e4318267b56838aa35da0a2a4e5c0528bfe04").getTestcaseChanges().keySet();
MatcherAssert.assertThat(changedTests, Matchers.contains("appĀ§com.example.android_example.ExampleUnitTest"));
}
use of de.dagere.peass.analysis.changes.ProjectChanges in project peass by DaGeRe.
the class TestAnalyseFullData method testReadingWithParams.
@Test
public void testReadingWithParams() throws InterruptedException {
LinkedList<GitCommit> versions = new LinkedList<GitCommit>();
versions.add(new GitCommit("49f75e8877c2e9b7cf6b56087121a35fdd73ff8b", "", "", ""));
versions.add(new GitCommit("a12a0b7f4c162794fca0e7e3fcc6ea3b3a2cbc2b", "", "", ""));
VersionComparator.setVersions(versions);
ModuleClassMapping mapping = Mockito.mock(ModuleClassMapping.class);
ProjectStatistics statistics = new ProjectStatistics();
AnalyseFullData afd = new AnalyseFullData(new File("target/test.json"), statistics, mapping, new StatisticsConfig());
afd.analyseFolder(new File(PARAM_DATA_FOLDER, "measurements"));
ProjectChanges changes = afd.getProjectChanges();
Set<String> changedTests = changes.getVersion("a12a0b7f4c162794fca0e7e3fcc6ea3b3a2cbc2b").getTestcaseChanges().keySet();
try {
System.out.println(Constants.OBJECTMAPPER.writeValueAsString(statistics));
System.out.println(Constants.OBJECTMAPPER.writeValueAsString(changes));
} catch (JsonProcessingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
MatcherAssert.assertThat(changedTests, Matchers.contains("de.dagere.peass.ExampleTest"));
List<Change> methodChanges = TestChangeReader.checkParameterizedResult(changes);
Assert.assertEquals(4152486.88, methodChanges.get(0).getOldTime(), 0.1);
}
Aggregations