Search in sources :

Example 6 with VersionDiff

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

the class JmhDependencyReaderTest method mockIterator.

private FakeFileIterator mockIterator() {
    List<File> versionList = Arrays.asList(JmhTestConstants.BASIC_VERSION, JmhTestConstants.SLOWER_VERSION);
    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)

Example 7 with VersionDiff

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

the class ChangeManager method getChangedClasses.

/**
 * Returns a set of the full qualified names of all classes that have been changed in the current revision.
 *
 * @return full qualified names of all classes that have been changed in the current revision.
 * @throws XmlPullParserException
 * @throws IOException
 * @throws FileNotFoundException
 */
private List<ChangedEntity> getChangedClasses(final String lastVersion) throws FileNotFoundException, IOException, XmlPullParserException {
    List<File> moduleFiles = testExecutor.getModules().getModules();
    final VersionDiff diff = iterator.getChangedClasses(folders.getProjectFolder(), moduleFiles, lastVersion, config);
    LOG.info("Changed classes: " + diff.getChangedClasses().size());
    return diff.getChangedClasses();
}
Also used : VersionDiff(de.dagere.peass.dependency.analysis.data.VersionDiff) File(java.io.File)

Example 8 with VersionDiff

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

the class DependencyViewGeneratorTest method mockIterator.

private FakeFileIterator mockIterator() {
    List<File> versionList = Arrays.asList(TraceGettingIT.BASIC, TraceGettingIT.REPETITION);
    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/viewtest/TestMe.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)

Example 9 with VersionDiff

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

the class TestVersionDiff method testJavaContainigPath.

@Test
public void testJavaContainigPath() throws IOException {
    createFile(JAVA_PATH_FILE);
    createFile(NO_SOURCE_FOLDER);
    VersionDiff diff = createVersionDiff();
    ExecutionConfig config = new ExecutionConfig();
    config.getClazzFolders().clear();
    config.getClazzFolders().add("java");
    diff.addChange(JAVA_PATH_FILE, config);
    diff.addChange(NO_SOURCE_FOLDER, config);
    MatcherAssert.assertThat(diff.getChangedClasses(), IsIterableContaining.hasItem(new ChangedEntity("de.dagere.peass.Example")));
    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 10 with VersionDiff

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

the class TestVersionDiff method testRegularMavenPath.

@Test
public void testRegularMavenPath() throws IOException {
    createFile(MAVEN_PATH_FILE);
    createFile(NO_SOURCE_FOLDER);
    VersionDiff diff = createVersionDiff();
    ExecutionConfig config = new ExecutionConfig();
    diff.addChange(MAVEN_PATH_FILE, config);
    diff.addChange(NO_SOURCE_FOLDER, config);
    MatcherAssert.assertThat(diff.getChangedClasses(), IsIterableContaining.hasItem(new ChangedEntity("de.dagere.peass.Example")));
}
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)

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