use of de.dagere.peass.analysis.changes.ProjectChanges in project peass by DaGeRe.
the class CreateClassificationDataAll method main.
public static void main(final String[] args) throws JsonParseException, JsonMappingException, IOException {
RepoFolders folders = new RepoFolders();
for (final File projectFile : folders.getResultsFolder().listFiles()) {
final String project = projectFile.getName();
final File changeFile = new File(projectFile, project + ".json");
final File goalFile = new File(folders.getClassificationFolder(), project + ".json");
if (changeFile.exists()) {
final ProjectChanges changes = Constants.OBJECTMAPPER.readValue(changeFile, ProjectChanges.class);
CreateClassificationData.createClassificationData(changes, goalFile, project);
} else {
LOG.error("No Change File: " + project);
}
}
}
use of de.dagere.peass.analysis.changes.ProjectChanges 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.ProjectChanges in project peass by DaGeRe.
the class TestContinuousExecutor method checkChangesJson.
private void checkChangesJson() throws IOException, JsonParseException, JsonMappingException {
File changeFile = new File(fullPeassFolder, "changes.json");
ProjectChanges changes = Constants.OBJECTMAPPER.readValue(changeFile, ProjectChanges.class);
String changedTestClass = changes.getVersion("a23e385264c31def8dcda86c3cf64faa698c62d8").getTestcaseChanges().keySet().iterator().next();
TestCase tc = new TestCase(changedTestClass);
Assert.assertEquals("de.test.CalleeTest", tc.getClazz());
}
use of de.dagere.peass.analysis.changes.ProjectChanges in project peass-ci-plugin by jenkinsci.
the class TestMeasureVersionAction method testPrefix.
@Test
public void testPrefix() {
final ProjectChanges changes = getChanges();
HashMap<String, HistogramValues> measurements = new HashMap<String, HistogramValues>();
measurements.put("de.package.ClassA#method1", null);
measurements.put("de.package.ClassA#method2", null);
measurements.put("de.package.ClassB#method2", null);
measurements.put("de.package.otherpackage.ClassC#method2", null);
MeasureVersionAction action = new MeasureVersionAction(new MeasurementConfig(5), changes.getVersion("1"), new ProjectStatistics(), new HashMap<>(), measurements, new HashMap<>());
Assert.assertEquals("ClassA", action.getReducedName("de.package.ClassA"));
Assert.assertEquals("otherpackage.ClassC", action.getReducedName("de.package.otherpackage.ClassC"));
}
use of de.dagere.peass.analysis.changes.ProjectChanges in project peass-ci-plugin by jenkinsci.
the class TestMeasureVersionAction method getChanges.
private ProjectChanges getChanges() {
final ProjectChanges changes = new ProjectChanges();
changes.addChange(new TestCase("de.package.ClassA", "method1"), "1", new Change("dummy", "method1"));
changes.addChange(new TestCase("de.package.ClassA", "method2"), "1", new Change("dummy", "method2"));
changes.addChange(new TestCase("de.package.ClassB", "method2"), "1", new Change("dummy", "method2"));
changes.addChange(new TestCase("de.package.otherpackage.ClassC", "method2"), "1", new Change("dummy", "method2"));
return changes;
}
Aggregations