Search in sources :

Example 31 with ChangeManager

use of de.dagere.peass.dependency.ChangeManager in project peass by DaGeRe.

the class DependencyDetectorNoUpdateIT method testClassRemoval.

@Test
public void testClassRemoval() throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException {
    final File secondVersion = new File(DependencyTestConstants.VERSIONS_FOLDER, "removed_class");
    final Map<ChangedEntity, ClazzChangeData> changes = new TreeMap<>();
    final ChangedEntity changedEntity = new ChangedEntity("defaultpackage.TestMe", "");
    changes.put(changedEntity, new ClazzChangeData(changedEntity, false));
    final ChangeManager changeManager = Mockito.mock(ChangeManager.class);
    Mockito.when(changeManager.getChanges(Mockito.any())).thenReturn(changes);
    final VersionIterator fakeIterator = new FakeFileIterator(DependencyTestConstants.CURRENT, Arrays.asList(secondVersion));
    final DependencyReader reader = DependencyDetectorTestUtil.readTwoVersions(changeManager, fakeIterator);
    DependencyDetectorIT.checkClassRemoved(reader);
}
Also used : ChangeManager(de.dagere.peass.dependency.ChangeManager) FakeFileIterator(de.dagere.peass.dependencytests.helper.FakeFileIterator) ClazzChangeData(de.dagere.peass.dependency.changesreading.ClazzChangeData) DependencyReader(de.dagere.peass.dependency.reader.DependencyReader) VersionIterator(de.dagere.peass.vcs.VersionIterator) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) TreeMap(java.util.TreeMap) File(java.io.File) Test(org.junit.jupiter.api.Test)

Example 32 with ChangeManager

use of de.dagere.peass.dependency.ChangeManager in project peass by DaGeRe.

the class DependencyDetectorParameterizedIT method changeManagerWithParameter.

public static ChangeManager changeManagerWithParameter() {
    final Map<ChangedEntity, ClazzChangeData> changes = DependencyDetectorTestUtil.buildChanges("", "defaultpackage.NormalDependency", "onlyCalledWithOne()");
    final ChangeManager changeManager = Mockito.mock(ChangeManager.class);
    Mockito.when(changeManager.getChanges(Mockito.any())).thenReturn(changes);
    return changeManager;
}
Also used : ChangeManager(de.dagere.peass.dependency.ChangeManager) ClazzChangeData(de.dagere.peass.dependency.changesreading.ClazzChangeData) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity)

Example 33 with ChangeManager

use of de.dagere.peass.dependency.ChangeManager in project peass by DaGeRe.

the class DependencyDetectorTestUtil method mockAddedChangeManager.

public static ChangeManager mockAddedChangeManager() {
    final Map<ChangedEntity, ClazzChangeData> changes = new TreeMap<>();
    changes.put(new ChangedEntity("defaultpackage.NormalDependency", ""), new ClazzChangeData("defaultpackage.NormalDependency", false));
    changes.put(new ChangedEntity("defaultpackage.TestMeAlso", ""), new ClazzChangeData("defaultpackage.TestMeAlso", false));
    final ChangeManager changeManager = Mockito.mock(ChangeManager.class);
    Mockito.when(changeManager.getChanges(Mockito.any())).thenReturn(changes);
    return changeManager;
}
Also used : ChangeManager(de.dagere.peass.dependency.ChangeManager) ClazzChangeData(de.dagere.peass.dependency.changesreading.ClazzChangeData) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) TreeMap(java.util.TreeMap)

Example 34 with ChangeManager

use of de.dagere.peass.dependency.ChangeManager in project peass by DaGeRe.

the class DependencyDetectorTestUtil method defaultChangeManager.

public static ChangeManager defaultChangeManager() {
    final Map<ChangedEntity, ClazzChangeData> changes = DependencyDetectorTestUtil.buildChanges("", "defaultpackage.NormalDependency", "executeThing");
    final ChangeManager changeManager = Mockito.mock(ChangeManager.class);
    Mockito.when(changeManager.getChanges(Mockito.any())).thenReturn(changes);
    return changeManager;
}
Also used : ChangeManager(de.dagere.peass.dependency.ChangeManager) ClazzChangeData(de.dagere.peass.dependency.changesreading.ClazzChangeData) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity)

Example 35 with ChangeManager

use of de.dagere.peass.dependency.ChangeManager in project peass by DaGeRe.

the class SuperclassDetectorIT method testSuperclassChange.

@Test
public void testSuperclassChange() throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
    final File secondVersion = new File(VERSIONS_FOLDER, "superclass_changed");
    final Map<ChangedEntity, ClazzChangeData> changes = new TreeMap<>();
    changes.put(new ChangedEntity("defaultpackage.NormalSuperclass", ""), new ClazzChangeData("defaultpackage.NormalSuperclass", false));
    final ChangeManager changeManager = Mockito.mock(ChangeManager.class);
    Mockito.when(changeManager.getChanges(Mockito.any())).thenReturn(changes);
    final VersionIterator fakeIterator = new FakeFileIterator(DependencyTestConstants.CURRENT, Arrays.asList(secondVersion));
    final DependencyReader reader = new DependencyReader(DependencyTestConstants.DEFAULT_CONFIG_NO_VIEWS, new PeassFolders(DependencyTestConstants.CURRENT), DependencyTestConstants.NULL_RESULTS_FOLDERS, null, fakeIterator, changeManager, new ExecutionConfig(5), new KiekerConfig(true), new EnvironmentVariables());
    reader.readInitialVersion();
    checkInitialDependencies(reader);
    fakeIterator.goToNextCommit();
    reader.analyseVersion(changeManager);
    checkFirstVersionDependencies(reader);
}
Also used : FakeFileIterator(de.dagere.peass.dependencytests.helper.FakeFileIterator) DependencyReader(de.dagere.peass.dependency.reader.DependencyReader) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) TreeMap(java.util.TreeMap) PeassFolders(de.dagere.peass.folders.PeassFolders) ChangeManager(de.dagere.peass.dependency.ChangeManager) ClazzChangeData(de.dagere.peass.dependency.changesreading.ClazzChangeData) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) VersionIterator(de.dagere.peass.vcs.VersionIterator) File(java.io.File) KiekerConfig(de.dagere.peass.config.KiekerConfig) Test(org.junit.jupiter.api.Test)

Aggregations

ChangeManager (de.dagere.peass.dependency.ChangeManager)36 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)26 Test (org.junit.jupiter.api.Test)26 FakeFileIterator (de.dagere.peass.dependencytests.helper.FakeFileIterator)23 VersionIterator (de.dagere.peass.vcs.VersionIterator)23 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)18 ClazzChangeData (de.dagere.peass.dependency.changesreading.ClazzChangeData)17 File (java.io.File)16 TreeMap (java.util.TreeMap)9 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)6 KiekerConfig (de.dagere.peass.config.KiekerConfig)5 TestSet (de.dagere.peass.dependency.analysis.data.TestSet)5 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)5 PeassFolders (de.dagere.peass.folders.PeassFolders)5 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)4 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)4 DependencyManager (de.dagere.peass.dependency.DependencyManager)2 HashMap (java.util.HashMap)2 OneReader (de.dagere.peass.dependency.parallel.OneReader)1 VersionStaticSelection (de.dagere.peass.dependency.persistence.VersionStaticSelection)1