Search in sources :

Example 6 with ProjectChanges

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);
        }
    }
}
Also used : ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) File(java.io.File) RepoFolders(de.dagere.peass.analysis.all.RepoFolders)

Example 7 with ProjectChanges

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);
}
Also used : ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) ChangeReader(de.dagere.peass.analysis.changes.ChangeReader) Change(de.dagere.peass.analysis.changes.Change) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData) Test(org.junit.jupiter.api.Test)

Example 8 with ProjectChanges

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());
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) File(java.io.File) ZipFile(net.lingala.zip4j.ZipFile)

Example 9 with ProjectChanges

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"));
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) MeasureVersionAction(de.dagere.peass.ci.MeasureVersionAction) HashMap(java.util.HashMap) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) ProjectStatistics(de.dagere.peass.analysis.measurement.ProjectStatistics) HistogramValues(de.dagere.peass.ci.helper.HistogramValues) Test(org.junit.Test)

Example 10 with ProjectChanges

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;
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) ProjectChanges(de.dagere.peass.analysis.changes.ProjectChanges) Change(de.dagere.peass.analysis.changes.Change)

Aggregations

ProjectChanges (de.dagere.peass.analysis.changes.ProjectChanges)23 File (java.io.File)14 Change (de.dagere.peass.analysis.changes.Change)7 VersionChangeProperties (de.dagere.peass.analysis.properties.VersionChangeProperties)6 Changes (de.dagere.peass.analysis.changes.Changes)5 Test (org.junit.Test)5 ExecutionData (de.dagere.peass.dependency.persistence.ExecutionData)4 LinkedList (java.util.LinkedList)4 RepoFolders (de.dagere.peass.analysis.all.RepoFolders)3 ChangeReader (de.dagere.peass.analysis.changes.ChangeReader)3 ProjectStatistics (de.dagere.peass.analysis.measurement.ProjectStatistics)3 MeasureVersionAction (de.dagere.peass.ci.MeasureVersionAction)3 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)3 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)3 ChangeProperties (de.dagere.peass.analysis.properties.ChangeProperties)2 ChangeProperty (de.dagere.peass.analysis.properties.ChangeProperty)2 HistogramValues (de.dagere.peass.ci.helper.HistogramValues)2 RCAVisualizer (de.dagere.peass.ci.helper.RCAVisualizer)2 StatisticsConfig (de.dagere.peass.config.StatisticsConfig)2 ModuleClassMapping (de.dagere.peass.dependency.analysis.ModuleClassMapping)2