use of de.dagere.peass.vcs.GitUtils in project peass by DaGeRe.
the class DependencyViewGeneratorTest method testTwoVersions.
@Test
public void testTwoVersions() throws Exception {
try (MockedStatic<GitUtils> gitUtilsMock = Mockito.mockStatic(GitUtils.class)) {
FakeGitUtil.prepareGitUtils(gitUtilsMock);
DependencyDetectorTestUtil.init(TraceGettingIT.BASIC);
ResultsFolders resultsFolders = new ResultsFolders(TraceGettingIT.VIEW_IT_PROJECTFOLDER, "test");
TestSelectionConfig dependencyConfig = new TestSelectionConfig(1, false, true, false);
FakeFileIterator iteratorspied = mockIterator();
DependencyReader reader = new DependencyReader(dependencyConfig, new PeassFolders(TestConstants.CURRENT_FOLDER), resultsFolders, "", iteratorspied, new VersionKeeper(new File("/dev/null")), new ExecutionConfig(), new KiekerConfig(true), new EnvironmentVariables());
reader.readInitialVersion();
try {
reader.readDependencies();
} catch (Throwable t) {
System.out.println();
for (StackTraceElement te : t.getStackTrace()) {
System.out.println(te);
}
System.out.println();
throw t;
}
File expectedDiff = new File(resultsFolders.getVersionDiffFolder("000002"), "TestMe#test.txt");
System.out.println(expectedDiff.getAbsolutePath());
Assert.assertTrue(expectedDiff.exists());
// TODO Test, that instrumentation sources are not added to the view
final ExecutionData tests = Constants.OBJECTMAPPER.readValue(resultsFolders.getTraceTestSelectionFile(), ExecutionData.class);
//
Assert.assertEquals(2, tests.getVersions().size());
Assert.assertEquals(1, tests.getVersions().get("000002").getTests().size());
}
}
use of de.dagere.peass.vcs.GitUtils in project peass by DaGeRe.
the class TestDependencyTester method testFiles.
@Test
public void testFiles() throws Exception {
try (MockedStatic<VersionControlSystem> mockedVCS = Mockito.mockStatic(VersionControlSystem.class);
MockedStatic<ExecutorCreator> mockedExecutor = Mockito.mockStatic(ExecutorCreator.class);
MockedStatic<GitUtils> utils = Mockito.mockStatic(GitUtils.class)) {
VCSTestUtils.mockGetVCS(mockedVCS);
final PeassFolders folders = new PeassFolders(folder.getRoot());
final MeasurementConfig configuration = new MeasurementConfig(4, "2", "1");
VCSTestUtils.mockExecutor(mockedExecutor, folders, configuration);
final DependencyTester tester = new DependencyTester(folders, configuration, new EnvironmentVariables());
tester.evaluate(EXAMPLE_TESTCASE);
checkResult(folders);
}
}
use of de.dagere.peass.vcs.GitUtils in project peass by DaGeRe.
the class CauseSearcherIT method testSlowerState.
@Test
public void testSlowerState() throws InterruptedException, IOException, IllegalStateException, XmlPullParserException, AnalysisConfigurationException, ViewNotFoundException, JAXBException {
try (MockedStatic<VersionControlSystem> mockedVCS = Mockito.mockStatic(VersionControlSystem.class);
MockedStatic<GitUtils> mockedGitUtils = Mockito.mockStatic(GitUtils.class)) {
mockEnvironment(mockedVCS, mockedGitUtils);
final MeasurementConfig measurementConfiguration = new MeasurementConfig(5, VERSION, "000001~1");
measurementConfiguration.setUseKieker(true);
final CauseSearcherConfig causeSearcherConfig = CAUSE_CONFIG_TESTME_COMPLETE;
final CauseSearchFolders folders = new CauseSearchFolders(DependencyTestConstants.CURRENT);
final BothTreeReader reader = new BothTreeReader(causeSearcherConfig, measurementConfiguration, folders, new EnvironmentVariables());
EnvironmentVariables emptyEnv = new EnvironmentVariables();
final CauseTester measurer = new CauseTester(folders, measurementConfiguration, causeSearcherConfig, emptyEnv);
final CauseSearcher searcher = new CauseSearcherComplete(reader, causeSearcherConfig, measurer, measurementConfiguration, folders, emptyEnv);
final Set<ChangedEntity> changedEntities = searcher.search();
checkChangelistContainsChild12(changedEntities);
File expectedResultLogFolder = folders.getExistingRCALogFolder(VERSION, TESTCASE, 0);
File expectedResultLogFile = new File(expectedResultLogFolder, "vm_0_" + VERSION);
Assert.assertTrue("File " + expectedResultLogFolder.getAbsolutePath() + " does not exist ", expectedResultLogFolder.exists());
Assert.assertTrue("File " + expectedResultLogFile.getAbsolutePath() + " does not exist ", expectedResultLogFile.exists());
}
}
use of de.dagere.peass.vcs.GitUtils in project peass by DaGeRe.
the class TestDependencyIteratorBuilder method testNightlyBuildWithoutRunningPrePredecessor.
@Test
public void testNightlyBuildWithoutRunningPrePredecessor() {
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(SIMPLE_PREDECESSOR);
dependencies.getVersions().get(SIMPLE_PREDECESSOR).setRunning(false);
DependencyIteratorBuilder builder = new DependencyIteratorBuilder(config, dependencies, new PeassFolders(TEMPORARY_FOLDER));
VersionIteratorGit iterator = builder.getIterator();
Assert.assertNull(iterator);
Assert.assertEquals(VERSION_2, builder.getVersion());
Assert.assertEquals(SIMPLE_PREDECESSOR, builder.getVersionOld());
}
}
use of de.dagere.peass.vcs.GitUtils in project peass by DaGeRe.
the class TestDependencyIteratorBuilder method testNightlyBuildWithPrePredecessor.
@Test
public void testNightlyBuildWithPrePredecessor() {
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(SIMPLE_PREDECESSOR, VERSION_2);
DependencyIteratorBuilder builder = new DependencyIteratorBuilder(config, dependencies, new PeassFolders(TEMPORARY_FOLDER));
VersionIteratorGit iterator = builder.getIterator();
Assert.assertNull(iterator);
Assert.assertEquals(VERSION_2, builder.getVersion());
Assert.assertEquals(SIMPLE_PREDECESSOR, builder.getVersionOld());
}
}
Aggregations