Search in sources :

Example 6 with InitialVersion

use of de.dagere.peass.dependency.persistence.InitialVersion in project peass by DaGeRe.

the class InitialVersionReader method createInitialVersion.

private InitialVersion createInitialVersion() {
    int jdkversion = dependencyManager.getExecutor().getJDKVersion();
    final InitialVersion initialversion = new InitialVersion();
    initialversion.setVersion(iterator.getTag());
    initialversion.setJdk(jdkversion);
    LOG.debug("Starting writing: {}", dependencyMap.getDependencyMap().size());
    for (final Entry<TestCase, CalledMethods> dependencyEntry : dependencyMap.getDependencyMap().entrySet()) {
        final TestCase testcase = dependencyEntry.getKey();
        for (final Map.Entry<ChangedEntity, Set<String>> calledClassEntry : dependencyEntry.getValue().getCalledMethods().entrySet()) {
            final ChangedEntity dependentclass = calledClassEntry.getKey();
            if (!dependentclass.getJavaClazzName().contains("junit") && !dependentclass.getJavaClazzName().contains("log4j")) {
                for (final String dependentmethod : calledClassEntry.getValue()) {
                    final ChangedEntity callee = new ChangedEntity(dependentclass.getClazz(), dependentclass.getModule(), dependentmethod);
                    initialversion.addDependency(testcase, callee);
                }
            }
        }
        initialversion.sort(testcase);
    }
    return initialversion;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) TestSet(de.dagere.peass.dependency.analysis.data.TestSet) TestCase(de.dagere.peass.dependency.analysis.data.TestCase) CalledMethods(de.dagere.peass.dependency.analysis.data.CalledMethods) InitialVersion(de.dagere.peass.dependency.persistence.InitialVersion) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) HashMap(java.util.HashMap) Map(java.util.Map)

Example 7 with InitialVersion

use of de.dagere.peass.dependency.persistence.InitialVersion in project peass by DaGeRe.

the class InitialVersionReader method readInitialVersion.

public boolean readInitialVersion() throws IOException, InterruptedException, XmlPullParserException {
    if (!dependencyManager.initialyGetTraces(iterator.getTag())) {
        return false;
    }
    final InitialVersion initialversion = createInitialVersion();
    dependencyResult.setInitialversion(initialversion);
    return true;
}
Also used : InitialVersion(de.dagere.peass.dependency.persistence.InitialVersion)

Example 8 with InitialVersion

use of de.dagere.peass.dependency.persistence.InitialVersion in project peass by DaGeRe.

the class InitialVersionReader method readCompletedVersions.

public void readCompletedVersions() {
    fillInitialTestDependencies();
    checkCorrectness();
    final InitialVersion initialversion = createInitialVersion();
    dependencyResult.setInitialversion(initialversion);
    if (dependencyResult.getVersions().size() > 0) {
        for (final Map.Entry<String, VersionStaticSelection> version : dependencyResult.getVersions().entrySet()) {
            String tag = version.getKey();
            String startTag = iterator.getTag();
            if (VersionComparator.isBefore(tag, startTag) || tag.equals(startTag)) {
                addVersionTestDependencies(version.getValue());
            }
        }
    }
    checkCorrectness();
    LOG.debug("Analyzing {} commits", iterator.getRemainingSize());
}
Also used : InitialVersion(de.dagere.peass.dependency.persistence.InitialVersion) VersionStaticSelection(de.dagere.peass.dependency.persistence.VersionStaticSelection) HashMap(java.util.HashMap) Map(java.util.Map)

Example 9 with InitialVersion

use of de.dagere.peass.dependency.persistence.InitialVersion in project peass by DaGeRe.

the class TestDependencies method testOnlyStartversion.

@Test
public void testOnlyStartversion() {
    StaticTestSelection dependencies = new StaticTestSelection();
    dependencies.setInitialversion(new InitialVersion());
    dependencies.getInitialversion().setVersion("0");
    String[] versionNames = dependencies.getVersionNames();
    Assert.assertEquals("0", versionNames[0]);
    Assert.assertEquals("0", dependencies.getNewestVersion());
}
Also used : InitialVersion(de.dagere.peass.dependency.persistence.InitialVersion) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) Test(org.junit.jupiter.api.Test)

Example 10 with InitialVersion

use of de.dagere.peass.dependency.persistence.InitialVersion in project peass by DaGeRe.

the class TestDependencies method testWithVersions.

@Test
public void testWithVersions() {
    StaticTestSelection dependencies = new StaticTestSelection();
    dependencies.setInitialversion(new InitialVersion());
    dependencies.getInitialversion().setVersion("0");
    dependencies.getVersions().put("1", new VersionStaticSelection());
    dependencies.getVersions().put("2", new VersionStaticSelection());
    dependencies.getVersions().put("3", new VersionStaticSelection());
    String[] versionNames = dependencies.getVersionNames();
    Assert.assertEquals("0", versionNames[0]);
    Assert.assertEquals("1", versionNames[1]);
    Assert.assertEquals("2", versionNames[2]);
    Assert.assertEquals("3", versionNames[3]);
    Assert.assertEquals("3", dependencies.getNewestVersion());
}
Also used : InitialVersion(de.dagere.peass.dependency.persistence.InitialVersion) VersionStaticSelection(de.dagere.peass.dependency.persistence.VersionStaticSelection) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) Test(org.junit.jupiter.api.Test)

Aggregations

InitialVersion (de.dagere.peass.dependency.persistence.InitialVersion)10 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)7 Test (org.junit.jupiter.api.Test)7 VersionStaticSelection (de.dagere.peass.dependency.persistence.VersionStaticSelection)4 GitCommit (de.dagere.peass.vcs.GitCommit)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)1 KiekerConfig (de.dagere.peass.config.KiekerConfig)1 TestSelectionConfig (de.dagere.peass.config.TestSelectionConfig)1 CalledMethods (de.dagere.peass.dependency.analysis.data.CalledMethods)1 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)1 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)1 TestSet (de.dagere.peass.dependency.analysis.data.TestSet)1 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)1 PeassFolders (de.dagere.peass.folders.PeassFolders)1 ResultsFolders (de.dagere.peass.folders.ResultsFolders)1 File (java.io.File)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1