Search in sources :

Example 26 with ChangedEntity

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

the class TestTestDependencies method buildTestDependencies.

private TestDependencies buildTestDependencies() {
    TestDependencies dependencies = new TestDependencies();
    HashMap<ChangedEntity, Set<String>> calledClasses = new HashMap<>();
    Set<String> methods = new HashSet<>();
    methods.add("testA");
    calledClasses.put(new ChangedEntity("package.ClazzA", "moduleA"), methods);
    Set<String> methodsB = new HashSet<>();
    methodsB.add("methodB");
    methodsB.add("methodC(int)");
    calledClasses.put(new ChangedEntity("package.ClazzB", "moduleA"), methodsB);
    dependencies.addDependencies(testEntity, calledClasses);
    return dependencies;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) TestDependencies(de.dagere.peass.dependency.analysis.data.TestDependencies) HashSet(java.util.HashSet)

Example 27 with ChangedEntity

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

the class TestTestDependencies method testParameterChange.

private void testParameterChange(final TestDependencies dependencies, final String parameterizedMethod) {
    HashMap<ChangedEntity, ClazzChangeData> changeTestMap = new HashMap<ChangedEntity, ClazzChangeData>();
    ClazzChangeData classChangeData = new ClazzChangeData(new ChangedEntity("package.ClazzB", "moduleA"), true);
    classChangeData.addChange("ClazzB", parameterizedMethod);
    changeTestMap.put(new ChangedEntity("package.ClazzB", "moduleA"), classChangeData);
    ChangeTestMapping changes = dependencies.getChangeTestMap(changeTestMap);
    Assert.assertEquals(1, changes.getChanges().size());
}
Also used : ClazzChangeData(de.dagere.peass.dependency.changesreading.ClazzChangeData) HashMap(java.util.HashMap) ChangeTestMapping(de.dagere.peass.dependency.analysis.data.ChangeTestMapping) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity)

Example 28 with ChangedEntity

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

the class TestTestDependencies method testAddingFQNParameter.

@Test
public void testAddingFQNParameter() {
    TestDependencies dependencies = buildTestDependenciesFQN();
    Set<String> calledMethods = dependencies.getDependencyMap().get(testEntity).getCalledMethods().get(new ChangedEntity("package.ClazzB", "moduleA"));
    MatcherAssert.assertThat(calledMethods, IsIterableContaining.hasItem("methodC(java.lang.Integer)"));
    MatcherAssert.assertThat(calledMethods, IsIterableContaining.hasItem("methodB"));
    testNonParameterChange(dependencies);
    testParameterChange(dependencies, "methodC(java.lang.Integer)");
}
Also used : ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) TestDependencies(de.dagere.peass.dependency.analysis.data.TestDependencies) Test(org.junit.jupiter.api.Test)

Example 29 with ChangedEntity

use of de.dagere.peass.dependency.analysis.data.ChangedEntity 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 30 with ChangedEntity

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

the class TestMethodChangeLongMethodName method writeLongMethod.

public static ChangedEntity writeLongMethod(final File sourceFolder, final File methodSourceFolder) throws FileNotFoundException, IOException {
    ChangedEntity longMethodEntity = new ChangedEntity("de.dagere.peass.analysis.properties.TestMethodChangeLongMethodName", "", "method");
    longMethodEntity.createParameters("java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String," + "java.lang.String,java.lang.String,java.lang.String,java.lang.String");
    MethodChangeReader reader = new MethodChangeReader(methodSourceFolder, sourceFolder, new File("."), longMethodEntity, VERSION, TEST_CONFIG);
    reader.readMethodChangeData();
    return longMethodEntity;
}
Also used : ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) File(java.io.File)

Aggregations

ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)136 Test (org.junit.jupiter.api.Test)58 File (java.io.File)57 ClazzChangeData (de.dagere.peass.dependency.changesreading.ClazzChangeData)41 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)23 TestSet (de.dagere.peass.dependency.analysis.data.TestSet)20 ChangeManager (de.dagere.peass.dependency.ChangeManager)18 Set (java.util.Set)17 HashSet (java.util.HashSet)16 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)14 HashMap (java.util.HashMap)14 Map (java.util.Map)12 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)11 FakeFileIterator (de.dagere.peass.dependencytests.helper.FakeFileIterator)11 VersionIterator (de.dagere.peass.vcs.VersionIterator)10 TreeMap (java.util.TreeMap)9 VersionStaticSelection (de.dagere.peass.dependency.persistence.VersionStaticSelection)8 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)6 Node (com.github.javaparser.ast.Node)5 Change (de.dagere.peass.analysis.changes.Change)5