Search in sources :

Example 6 with GitUtils

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

the class JmhDependencyReaderTest method testVersionReading.

@ParameterizedTest
@ArgumentsSource(KiekerConfigurationProvider.class)
public void testVersionReading(final KiekerConfig kiekerConfig) throws IOException, InterruptedException, XmlPullParserException, ParseException, ViewNotFoundException, ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
    try (MockedStatic<GitUtils> gitUtilsMock = Mockito.mockStatic(GitUtils.class)) {
        FakeGitUtil.prepareGitUtils(gitUtilsMock);
        FakeFileIterator iterator = mockIterator();
        ResultsFolders resultsFolders = new ResultsFolders(TraceGettingIT.VIEW_IT_PROJECTFOLDER, "test");
        TestSelectionConfig dependencyConfig = new TestSelectionConfig(1, false, true, false);
        ExecutionConfig jmhConfig = new ExecutionConfig();
        jmhConfig.setTestTransformer("de.dagere.peass.dependency.jmh.JmhTestTransformer");
        jmhConfig.setTestExecutor("de.dagere.peass.dependency.jmh.JmhTestExecutor");
        DependencyReader reader = new DependencyReader(dependencyConfig, new PeassFolders(TestConstants.CURRENT_FOLDER), resultsFolders, "", iterator, new VersionKeeper(new File("/dev/null")), jmhConfig, kiekerConfig, new EnvironmentVariables());
        reader.readInitialVersion();
        checkInitialVersion(resultsFolders);
        reader.readDependencies();
        checkChangedVersion(resultsFolders);
    }
}
Also used : TestSelectionConfig(de.dagere.peass.config.TestSelectionConfig) VersionKeeper(de.dagere.peass.dependency.reader.VersionKeeper) FakeFileIterator(de.dagere.peass.dependencytests.helper.FakeFileIterator) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) GitUtils(de.dagere.peass.vcs.GitUtils) DependencyReader(de.dagere.peass.dependency.reader.DependencyReader) ExecutionConfig(de.dagere.peass.config.ExecutionConfig) ResultsFolders(de.dagere.peass.folders.ResultsFolders) File(java.io.File) PeassFolders(de.dagere.peass.folders.PeassFolders) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) ArgumentsSource(org.junit.jupiter.params.provider.ArgumentsSource)

Example 7 with GitUtils

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

the class AdaptiveExecutorMoreParameterIT method testOneMethodExecution.

@Test
public void testOneMethodExecution() throws IOException, XmlPullParserException, InterruptedException, ViewNotFoundException, AnalysisConfigurationException, JAXBException {
    try (MockedStatic<VersionControlSystem> mockedVCS = Mockito.mockStatic(VersionControlSystem.class);
        MockedStatic<GitUtils> mockedGitUtils = Mockito.mockStatic(GitUtils.class)) {
        VCSTestUtils.mockGetVCS(mockedVCS);
        VCSTestUtils.mockGoToTagAny(mockedGitUtils, SOURCE_DIR);
        CauseSearchFolders folders = new CauseSearchFolders(projectFolder);
        executor = new CauseTester(folders, TestConstants.SIMPLE_MEASUREMENT_CONFIG_KIEKER, TestConstants.SIMPLE_CAUSE_CONFIG_TESTME, new EnvironmentVariables());
        testSuccessfull();
    }
}
Also used : CauseSearchFolders(de.dagere.peass.folders.CauseSearchFolders) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) GitUtils(de.dagere.peass.vcs.GitUtils) VersionControlSystem(de.dagere.peass.vcs.VersionControlSystem) Test(org.junit.Test)

Example 8 with GitUtils

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

the class AdaptiveExecutorMoreParameterIT method testFullMethodExecution.

@Test
public void testFullMethodExecution() throws IOException, XmlPullParserException, InterruptedException, ViewNotFoundException, AnalysisConfigurationException, JAXBException {
    try (MockedStatic<VersionControlSystem> mockedVCS = Mockito.mockStatic(VersionControlSystem.class);
        MockedStatic<GitUtils> mockedGitUtils = Mockito.mockStatic(GitUtils.class)) {
        VCSTestUtils.mockGetVCS(mockedVCS);
        VCSTestUtils.mockGoToTagAny(mockedGitUtils, SOURCE_DIR);
        CauseSearchFolders folders = new CauseSearchFolders(projectFolder);
        executor = new CauseTester(folders, TestConstants.SIMPLE_MEASUREMENT_CONFIG_KIEKER, FULL_CASE_CONFIG, new EnvironmentVariables());
        testSuccessfull();
    }
}
Also used : CauseSearchFolders(de.dagere.peass.folders.CauseSearchFolders) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) GitUtils(de.dagere.peass.vcs.GitUtils) VersionControlSystem(de.dagere.peass.vcs.VersionControlSystem) Test(org.junit.Test)

Example 9 with GitUtils

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

the class AdaptiveExecutorTest method testOneMethodExecution.

@Test
public void testOneMethodExecution() throws IOException, XmlPullParserException, InterruptedException, ViewNotFoundException, AnalysisConfigurationException, JAXBException {
    try (MockedStatic<VersionControlSystem> mockedVCS = Mockito.mockStatic(VersionControlSystem.class);
        MockedStatic<GitUtils> mockedGitUtils = Mockito.mockStatic(GitUtils.class)) {
        VCSTestUtils.mockGetVCS(mockedVCS);
        VCSTestUtils.mockGoToTagAny(mockedGitUtils, SOURCE_DIR);
        final CallTreeNode nodeWithDuration = new CallTreeNode("defaultpackage.NormalDependency#child1", "public void defaultpackage.NormalDependency.child1()", "public void defaultpackage.NormalDependency.child1()", new MeasurementConfig(5));
        measureNode(nodeWithDuration);
        executor.getDurations(0);
        Assert.assertEquals(2, nodeWithDuration.getStatistics("000001").getN());
        Assert.assertEquals(2, nodeWithDuration.getStatistics("000001~1").getN());
        Assert.assertEquals(8, nodeWithDuration.getCallCount("000001"));
        Assert.assertEquals(8, nodeWithDuration.getCallCount("000001~1"));
    }
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) GitUtils(de.dagere.peass.vcs.GitUtils) CallTreeNode(de.dagere.peass.measurement.rca.data.CallTreeNode) VersionControlSystem(de.dagere.peass.vcs.VersionControlSystem) Test(org.junit.Test)

Example 10 with GitUtils

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

the class AdaptiveExecutorTest method testConstructorExecution.

@Test
public void testConstructorExecution() throws IOException, XmlPullParserException, InterruptedException, ViewNotFoundException, AnalysisConfigurationException, JAXBException {
    try (MockedStatic<VersionControlSystem> mockedVCS = Mockito.mockStatic(VersionControlSystem.class);
        MockedStatic<GitUtils> mockedGitUtils = Mockito.mockStatic(GitUtils.class)) {
        VCSTestUtils.mockGetVCS(mockedVCS);
        VCSTestUtils.mockGoToTagAny(mockedGitUtils, SOURCE_DIR);
        final CallTreeNode nodeWithDuration = new CallTreeNode("defaultpackage.NormalDependency#<init>", "public new defaultpackage.NormalDependency.<init>()", "public new defaultpackage.NormalDependency.<init>()", new MeasurementConfig(5));
        measureNode(nodeWithDuration);
        executor.getDurations(1);
        Assert.assertEquals(2, nodeWithDuration.getStatistics("000001").getN());
        Assert.assertEquals(2, nodeWithDuration.getStatistics("000001~1").getN());
    }
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) GitUtils(de.dagere.peass.vcs.GitUtils) CallTreeNode(de.dagere.peass.measurement.rca.data.CallTreeNode) VersionControlSystem(de.dagere.peass.vcs.VersionControlSystem) Test(org.junit.Test)

Aggregations

GitUtils (de.dagere.peass.vcs.GitUtils)17 PeassFolders (de.dagere.peass.folders.PeassFolders)11 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)10 Test (org.junit.jupiter.api.Test)9 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)7 VersionControlSystem (de.dagere.peass.vcs.VersionControlSystem)7 Test (org.junit.Test)7 VersionIteratorGit (de.dagere.peass.vcs.VersionIteratorGit)6 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)5 StaticTestSelection (de.dagere.peass.dependency.persistence.StaticTestSelection)5 DependencyReader (de.dagere.peass.dependency.reader.DependencyReader)4 FakeFileIterator (de.dagere.peass.dependencytests.helper.FakeFileIterator)4 File (java.io.File)4 TestSelectionConfig (de.dagere.peass.config.TestSelectionConfig)3 VersionKeeper (de.dagere.peass.dependency.reader.VersionKeeper)3 CauseSearchFolders (de.dagere.peass.folders.CauseSearchFolders)3 ResultsFolders (de.dagere.peass.folders.ResultsFolders)3 KiekerConfig (de.dagere.peass.config.KiekerConfig)2 ExecutorCreator (de.dagere.peass.dependency.ExecutorCreator)2 DependencyTester (de.dagere.peass.measurement.dependencyprocessors.DependencyTester)2