Search in sources :

Example 21 with StaticTestSelection

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

the class TestContinuousDependencyReader method testNoChangeHappened.

@Test
public void testNoChangeHappened() throws JsonGenerationException, JsonMappingException, IOException {
    ResultsFolders resultsFolders = new ResultsFolders(new File("target/current_results"), "current");
    StaticTestSelection value = new StaticTestSelection();
    value.setInitialversion(new InitialVersion());
    value.getVersions().put("A", new VersionStaticSelection());
    Constants.OBJECTMAPPER.writeValue(resultsFolders.getStaticTestSelectionFile(), value);
    ContinuousDependencyReader reader = new ContinuousDependencyReader(new TestSelectionConfig(1, false), new ExecutionConfig(), new KiekerConfig(), new PeassFolders(new File("target/current")), resultsFolders, new EnvironmentVariables());
    reader.getDependencies(null, "git:dummyUrl");
}
Also used : TestSelectionConfig(de.dagere.peass.config.TestSelectionConfig) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) InitialVersion(de.dagere.peass.dependency.persistence.InitialVersion) VersionStaticSelection(de.dagere.peass.dependency.persistence.VersionStaticSelection) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) ResultsFolders(de.dagere.peass.folders.ResultsFolders) File(java.io.File) KiekerConfig(de.dagere.peass.config.KiekerConfig) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) PeassFolders(de.dagere.peass.folders.PeassFolders) Test(org.junit.jupiter.api.Test)

Example 22 with StaticTestSelection

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

the class TestDependencyIteratorBuilder method testNightlyBuildIteratorCreation.

@Test
public void testNightlyBuildIteratorCreation() {
    try (MockedStatic<GitUtils> gitUtil = Mockito.mockStatic(GitUtils.class)) {
        gitUtil.when(() -> GitUtils.getName(Mockito.any(), Mockito.any())).thenReturn(VERSION_2);
        ExecutionConfig config = new ExecutionConfig();
        config.setVersionOld(null);
        config.setVersion("HEAD");
        StaticTestSelection dependencies = buildVersionDependencies(LAST_RUNNING_VERSION);
        VersionIteratorGit iterator = new DependencyIteratorBuilder(config, dependencies, new PeassFolders(TEMPORARY_FOLDER)).getIterator();
        Assert.assertEquals(2, iterator.getSize());
        Assert.assertEquals(VERSION_2, iterator.getTag());
        Assert.assertEquals(LAST_RUNNING_VERSION, iterator.getPredecessor());
    }
}
Also used : VersionIteratorGit(de.dagere.peass.vcs.VersionIteratorGit) GitUtils(de.dagere.peass.vcs.GitUtils) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) PeassFolders(de.dagere.peass.folders.PeassFolders) Test(org.junit.jupiter.api.Test)

Example 23 with StaticTestSelection

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

the class TestDependencyIteratorBuilder method testRegularIteratorCreation.

@Test
public void testRegularIteratorCreation() {
    try (MockedStatic<GitUtils> gitUtil = Mockito.mockStatic(GitUtils.class)) {
        gitUtil.when(() -> GitUtils.getName(Mockito.any(), Mockito.any())).thenReturn(VERSION_2);
        ExecutionConfig config = new ExecutionConfig();
        config.setVersionOld(SIMPLE_PREDECESSOR);
        config.setVersion("HEAD");
        StaticTestSelection dependencies = buildVersionDependencies(LAST_RUNNING_VERSION);
        VersionIteratorGit iterator = new DependencyIteratorBuilder(config, dependencies, new PeassFolders(TEMPORARY_FOLDER)).getIterator();
        Assert.assertEquals(2, iterator.getSize());
        Assert.assertEquals(VERSION_2, iterator.getTag());
        Assert.assertEquals(SIMPLE_PREDECESSOR, iterator.getPredecessor());
    }
}
Also used : VersionIteratorGit(de.dagere.peass.vcs.VersionIteratorGit) GitUtils(de.dagere.peass.vcs.GitUtils) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) PeassFolders(de.dagere.peass.folders.PeassFolders) Test(org.junit.jupiter.api.Test)

Example 24 with StaticTestSelection

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

the class RegressionTestSelectionStarter method readExecutions.

public void readExecutions(final String project, final List<GitCommit> commits) throws InterruptedException, IOException, JsonGenerationException, JsonMappingException, JAXBException {
    KiekerConfig kiekerConfig = kiekerConfigMixin.getKiekerConfig();
    ExecutionConfig executionConfig = executionConfigMixin.getExecutionConfig();
    final DependencyParallelReader reader = new DependencyParallelReader(config.getProjectFolder(), config.getResultBaseFolder(), project, commits, config.getDependencyConfig(), executionConfig, kiekerConfig, new EnvironmentVariables());
    final ResultsFolders[] outFiles = reader.readDependencies();
    LOG.debug("Files: {}", outFiles);
    ResultsFolders mergedFolders = new ResultsFolders(config.getResultBaseFolder(), project);
    final File out = mergedFolders.getStaticTestSelectionFile();
    final StaticTestSelection all = PartialDependenciesMerger.mergeVersions(out, outFiles);
    final PeassFolders folders = new PeassFolders(config.getProjectFolder());
    final File dependencyTempFiles = new File(folders.getTempProjectFolder().getParentFile(), "dependencyTempFiles");
    FileUtils.moveDirectory(folders.getTempProjectFolder(), dependencyTempFiles);
    ExecutionData executionData = PartialDependenciesMerger.mergeExecutions(mergedFolders, outFiles);
    mergeViews(outFiles, mergedFolders);
    if (!config.isDoNotGenerateProperties()) {
        ResultsFolders resultsFolders = new ResultsFolders(config.getResultBaseFolder(), project);
        final PropertyReader propertyReader = new PropertyReader(resultsFolders, config.getProjectFolder(), executionData, executionConfig);
        propertyReader.readAllTestsProperties();
    }
}
Also used : EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) DependencyParallelReader(de.dagere.peass.dependency.reader.DependencyParallelReader) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) ResultsFolders(de.dagere.peass.folders.ResultsFolders) PropertyReader(de.dagere.peass.analysis.properties.PropertyReader) KiekerConfig(de.dagere.peass.config.KiekerConfig) File(java.io.File) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) PeassFolders(de.dagere.peass.folders.PeassFolders) ExecutionData(de.dagere.peass.dependency.persistence.ExecutionData)

Example 25 with StaticTestSelection

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

the class JmhDependencyReaderTest method checkInitialVersion.

private void checkInitialVersion(final ResultsFolders resultsFolders) throws IOException, JsonParseException, JsonMappingException {
    StaticTestSelection dependencies = Constants.OBJECTMAPPER.readValue(resultsFolders.getStaticTestSelectionFile(), StaticTestSelection.class);
    Map<TestCase, InitialDependency> initialDependencies = dependencies.getInitialversion().getInitialDependencies();
    MatcherAssert.assertThat(initialDependencies.keySet(), Matchers.hasSize(1));
    InitialDependency initial = initialDependencies.get(new TestCase("de.dagere.peass.ExampleBenchmark", "testMethod", null));
    MatcherAssert.assertThat(initial.getEntities(), Matchers.hasSize(2));
}
Also used : TestCase(de.dagere.peass.dependency.analysis.data.TestCase) InitialDependency(de.dagere.peass.dependency.persistence.InitialDependency) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection)

Aggregations

StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)56 File (java.io.File)24 Test (org.junit.jupiter.api.Test)22 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)14 PeassFolders (de.dagere.peass.folders.PeassFolders)14 ExecutionData (de.dagere.peass.dependency.persistence.ExecutionData)12 VersionStaticSelection (de.dagere.peass.dependency.persistence.VersionStaticSelection)12 LinkedList (java.util.LinkedList)9 TestCase (de.dagere.peass.dependency.analysis.data.TestCase)8 KiekerConfig (de.dagere.peass.config.KiekerConfig)7 InitialVersion (de.dagere.peass.dependency.persistence.InitialVersion)7 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)7 VersionIteratorGit (de.dagere.peass.vcs.VersionIteratorGit)7 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)6 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)6 GitCommit (de.dagere.peass.vcs.GitCommit)6 TestSet (de.dagere.peass.dependency.analysis.data.TestSet)5 ResultsFolders (de.dagere.peass.folders.ResultsFolders)5 GitUtils (de.dagere.peass.vcs.GitUtils)5 ChangeManager (de.dagere.peass.dependency.ChangeManager)4