Search in sources :

Example 6 with VersionControlSystem

use of de.dagere.peass.vcs.VersionControlSystem in project peass by DaGeRe.

the class RegressionTestSelectionContinueStarter method call.

@Override
public Void call() throws Exception {
    final File projectFolder = config.getProjectFolder();
    if (!projectFolder.exists()) {
        throw new RuntimeException("Folder " + projectFolder.getAbsolutePath() + " does not exist.");
    }
    final File dependencyFileIn = getDependencyInFile();
    final StaticTestSelection dependencies = Constants.OBJECTMAPPER.readValue(dependencyFileIn, StaticTestSelection.class);
    VersionComparator.setVersions(GitUtils.getCommits(projectFolder, false));
    String previousVersion = getPreviousVersion(executionConfigMixin.getStartversion(), projectFolder, dependencies);
    final int timeout = executionConfigMixin.getTimeout();
    LOG.debug("Lese {}", projectFolder.getAbsolutePath());
    final VersionControlSystem vcs = VersionControlSystem.getVersionControlSystem(projectFolder);
    ResultsFolders resultsFolders = new ResultsFolders(config.getResultBaseFolder(), config.getProjectFolder().getName() + "_out");
    final DependencyReader reader = createReader(config, resultsFolders, dependencies, previousVersion, timeout, vcs);
    reader.readCompletedVersions(dependencies);
    reader.readDependencies();
    return null;
}
Also used : DependencyReader(de.dagere.peass.dependency.reader.DependencyReader) ResultsFolders(de.dagere.peass.folders.ResultsFolders) File(java.io.File) StaticTestSelection(de.dagere.peass.dependency.persistence.StaticTestSelection) VersionControlSystem(de.dagere.peass.vcs.VersionControlSystem)

Example 7 with VersionControlSystem

use of de.dagere.peass.vcs.VersionControlSystem 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);
    }
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) DependencyTester(de.dagere.peass.measurement.dependencyprocessors.DependencyTester) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) GitUtils(de.dagere.peass.vcs.GitUtils) ExecutorCreator(de.dagere.peass.dependency.ExecutorCreator) VersionControlSystem(de.dagere.peass.vcs.VersionControlSystem) PeassFolders(de.dagere.peass.folders.PeassFolders) Test(org.junit.Test)

Example 8 with VersionControlSystem

use of de.dagere.peass.vcs.VersionControlSystem in project peass by DaGeRe.

the class AdaptiveTesterTest method testIterationUpdate.

@Test
public void testIterationUpdate() throws IOException, InterruptedException, JAXBException, XmlPullParserException {
    try (MockedStatic<VersionControlSystem> mockedVCS = Mockito.mockStatic(VersionControlSystem.class);
        MockedStatic<ExecutorCreator> mockedExecutor = Mockito.mockStatic(ExecutorCreator.class)) {
        VCSTestUtils.mockGetVCS(mockedVCS);
        VCSTestUtils.mockExecutor(mockedExecutor);
        final int vms = 10;
        final MeasurementConfig config = new MeasurementConfig(vms, "A", "B");
        config.setIterations(1000);
        MeasurementConfig config2 = Mockito.spy(config);
        Mockito.when(testGenerator.getConfig()).thenReturn(config2);
        AdaptiveTester tester2 = prepareTester();
        Mockito.doReturn(false).when(tester2).checkIsDecidable(Mockito.eq(testcase), Mockito.anyInt());
        for (int i = 0; i < vms; i++) {
            final Result result1 = new Result();
            result1.setValue(15);
            result1.setIterations(40);
            Mockito.doReturn(result1).when(tester2).getLastResult("A", testcase, i);
            final Result result2 = new Result();
            result2.setValue(17);
            result2.setIterations(40);
            Mockito.doReturn(result2).when(tester2).getLastResult("B", testcase, i);
        }
        tester2.evaluate(testcase);
        Assert.assertEquals(vms, tester2.getFinishedVMs());
        Mockito.verify(config2).setIterations(38);
    }
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) AdaptiveTester(de.dagere.peass.measurement.dependencyprocessors.AdaptiveTester) ExecutorCreator(de.dagere.peass.dependency.ExecutorCreator) VersionControlSystem(de.dagere.peass.vcs.VersionControlSystem) Result(de.dagere.kopeme.generated.Result) Test(org.junit.Test)

Example 9 with VersionControlSystem

use of de.dagere.peass.vcs.VersionControlSystem 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());
    }
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) CauseSearcherComplete(de.dagere.peass.measurement.rca.searcher.CauseSearcherComplete) GitUtils(de.dagere.peass.vcs.GitUtils) ChangedEntity(de.dagere.peass.dependency.analysis.data.ChangedEntity) BothTreeReader(de.dagere.peass.measurement.rca.kieker.BothTreeReader) VersionControlSystem(de.dagere.peass.vcs.VersionControlSystem) CauseSearchFolders(de.dagere.peass.folders.CauseSearchFolders) CauseSearcher(de.dagere.peass.measurement.rca.searcher.CauseSearcher) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) File(java.io.File) Test(org.junit.Test)

Aggregations

VersionControlSystem (de.dagere.peass.vcs.VersionControlSystem)9 Test (org.junit.Test)8 GitUtils (de.dagere.peass.vcs.GitUtils)7 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)6 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)4 ExecutorCreator (de.dagere.peass.dependency.ExecutorCreator)3 CauseSearchFolders (de.dagere.peass.folders.CauseSearchFolders)3 PeassFolders (de.dagere.peass.folders.PeassFolders)2 DependencyTester (de.dagere.peass.measurement.dependencyprocessors.DependencyTester)2 CallTreeNode (de.dagere.peass.measurement.rca.data.CallTreeNode)2 File (java.io.File)2 Result (de.dagere.kopeme.generated.Result)1 ChangedEntity (de.dagere.peass.dependency.analysis.data.ChangedEntity)1 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)1 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)1 ResultsFolders (de.dagere.peass.folders.ResultsFolders)1 TestDependencyTester (de.dagere.peass.measurement.analysis.TestDependencyTester)1 AdaptiveTester (de.dagere.peass.measurement.dependencyprocessors.AdaptiveTester)1 BothTreeReader (de.dagere.peass.measurement.rca.kieker.BothTreeReader)1 CauseSearcher (de.dagere.peass.measurement.rca.searcher.CauseSearcher)1