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");
}
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());
}
}
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());
}
}
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();
}
}
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));
}
Aggregations