Search in sources :

Example 1 with VersionDiff

use of de.dagere.peass.dependency.analysis.data.VersionDiff in project peass by DaGeRe.

the class TestVersionDiff method testTestContainigPath.

@Test
public void testTestContainigPath() throws IOException {
    createFile(TOMCAT_EXAMPLE);
    createFile(NO_SOURCE_FOLDER);
    VersionDiff diff = createVersionDiff();
    ExecutionConfig config = new ExecutionConfig();
    config.getClazzFolders().clear();
    config.getClazzFolders().add("java");
    config.getTestClazzFolders().clear();
    config.getTestClazzFolders().add("test");
    diff.addChange(TOMCAT_EXAMPLE, config);
    diff.addChange(NO_SOURCE_FOLDER, config);
    MatcherAssert.assertThat(diff.getChangedClasses(), IsIterableContaining.hasItem(new ChangedEntity("de.dagere.peass.CoyoteAdapter")));
    MatcherAssert.assertThat(diff.getChangedClasses(), Matchers.not(IsIterableContaining.hasItem(new ChangedEntity("de.dagere.peass.Example2"))));
}
Also used : VersionDiff(de.dagere.peass.dependency.analysis.data.VersionDiff) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) Test(org.junit.jupiter.api.Test)

Example 2 with VersionDiff

use of de.dagere.peass.dependency.analysis.data.VersionDiff in project peass by DaGeRe.

the class TestVersionDiff method createVersionDiff.

private VersionDiff createVersionDiff() {
    List<File> modules = new LinkedList<>();
    modules.add(tempDir);
    VersionDiff diff = new VersionDiff(modules, tempDir);
    return diff;
}
Also used : VersionDiff(de.dagere.peass.dependency.analysis.data.VersionDiff) File(java.io.File) LinkedList(java.util.LinkedList)

Example 3 with VersionDiff

use of de.dagere.peass.dependency.analysis.data.VersionDiff in project peass by DaGeRe.

the class GitUtils method getDiffFromProcess.

private static VersionDiff getDiffFromProcess(final Process p, final List<File> modules, final File projectFolder, final ExecutionConfig config) {
    final VersionDiff diff = new VersionDiff(modules, projectFolder);
    final String output = StreamGobbler.getFullProcess(p, false);
    for (final String line : output.split("\n")) {
        diff.addChange(line, config);
    }
    return diff;
}
Also used : VersionDiff(de.dagere.peass.dependency.analysis.data.VersionDiff)

Example 4 with VersionDiff

use of de.dagere.peass.dependency.analysis.data.VersionDiff in project peass by DaGeRe.

the class PropertyReadHelper method identifyAffectedClasses.

private void identifyAffectedClasses(final ChangeProperty property, final Set<String> calls) throws FileNotFoundException, IOException {
    List<File> modules = testExecutor.getModules().getModules();
    final VersionDiff diff = GitUtils.getChangedFiles(projectFolder, modules, version, config);
    removeUncalledClasses(calls, diff);
    property.setAffectedClasses(diff.getChangedClasses().size());
    final int changedLines = GitUtils.getChangedLines(projectFolder, version, diff.getChangedClasses(), config);
    property.setAffectedLines(changedLines);
}
Also used : VersionDiff(de.dagere.peass.dependency.analysis.data.VersionDiff) File(java.io.File)

Example 5 with VersionDiff

use of de.dagere.peass.dependency.analysis.data.VersionDiff in project peass by DaGeRe.

the class JmhDependencyReaderMultiParamTest method mockIterator.

private FakeFileIterator mockIterator() {
    List<File> versionList = Arrays.asList(JmhTestConstants.MULTIPARAM_VERSION, JmhTestConstants.MULTIPARAM_VERSION_CHANGE);
    FakeFileIterator fakeIterator = new FakeFileIterator(TestConstants.CURRENT_FOLDER, versionList);
    fakeIterator.goToFirstCommit();
    FakeFileIterator iteratorspied = Mockito.spy(fakeIterator);
    VersionDiff fakedDiff = new VersionDiff(Arrays.asList(TestConstants.CURRENT_FOLDER), TestConstants.CURRENT_FOLDER);
    ExecutionConfig defaultConfig = new ExecutionConfig();
    fakedDiff.addChange("src/test/java/de/dagere/peass/ExampleBenchmark.java", defaultConfig);
    Mockito.doReturn(fakedDiff).when(iteratorspied).getChangedClasses(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
    return iteratorspied;
}
Also used : FakeFileIterator(de.dagere.peass.dependencytests.helper.FakeFileIterator) VersionDiff(de.dagere.peass.dependency.analysis.data.VersionDiff) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) File(java.io.File)

Aggregations

VersionDiff (de.dagere.peass.dependency.analysis.data.VersionDiff)10 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)6 File (java.io.File)6 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)3 FakeFileIterator (de.dagere.peass.dependencytests.helper.FakeFileIterator)3 Test (org.junit.jupiter.api.Test)3 LinkedList (java.util.LinkedList)1