Search in sources :

Example 6 with TestTransformer

use of de.dagere.peass.testtransformation.TestTransformer in project peass by DaGeRe.

the class ExecutorCreator method createTestTransformer.

public static TestTransformer createTestTransformer(final PeassFolders folders, final ExecutionConfig executionConfig, final MeasurementConfig measurementConfig) {
    try {
        Class<?> testTransformerClass = Class.forName(executionConfig.getTestTransformer());
        if (!Arrays.asList(testTransformerClass.getInterfaces()).contains(TestTransformer.class)) {
            throw new RuntimeException("TestTransformer needs to be implemented by " + executionConfig.getTestTransformer());
        }
        Constructor<?> constructor = testTransformerClass.getConstructor(File.class, MeasurementConfig.class);
        TestTransformer transformer = (TestTransformer) constructor.newInstance(folders.getProjectFolder(), measurementConfig);
        return transformer;
    } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
        LOG.debug("Initialization was not possible; this should be thrown uncatched");
        e.printStackTrace();
        throw new RuntimeException(e);
    }
}
Also used : JUnitTestTransformer(de.dagere.peass.testtransformation.JUnitTestTransformer) TestTransformer(de.dagere.peass.testtransformation.TestTransformer) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Example 7 with TestTransformer

use of de.dagere.peass.testtransformation.TestTransformer in project peass by DaGeRe.

the class FirstRunningVersionFinder method searchFirstRunningCommit.

/**
 * Searches the first commit where a mvn clean packages runs correct, i.e. returns 1
 *
 * @param projectFolder
 */
public boolean searchFirstRunningCommit() {
    goToCommit(iterator);
    boolean isVersionRunning = false;
    // The local test transformer enables testing whether a version runs without full configuration
    TestTransformer transformer = ExecutorCreator.createTestTransformer(folders, executionConfig, new KiekerConfig(false));
    while (!isVersionRunning && iterator.hasNextCommit()) {
        if (ExecutorCreator.hasBuildfile(folders, transformer)) {
            isVersionRunning = tryCommit(iterator, transformer);
        } else {
            nonRunning.addVersion(iterator.getTag(), "Buildfile does not exist.");
            iterator.goToNextCommit();
        }
    }
    return isVersionRunning;
}
Also used : TestTransformer(de.dagere.peass.testtransformation.TestTransformer) KiekerConfig(de.dagere.peass.config.KiekerConfig)

Example 8 with TestTransformer

use of de.dagere.peass.testtransformation.TestTransformer in project peass by DaGeRe.

the class CauseTester method getExecutor.

@Override
protected synchronized TestExecutor getExecutor(final PeassFolders temporaryFolders, final String version) {
    final TestExecutor testExecutor = super.getExecutor(temporaryFolders, version);
    TestTransformer testTransformer = testExecutor.getTestTransformer();
    testTransformer.setIgnoreEOIs(causeConfig.isIgnoreEOIs());
    generatePatternSet(version);
    final HashSet<String> includedMethodPattern = new HashSet<>(includedPattern);
    testExecutor.setIncludedMethods(includedMethodPattern);
    return testExecutor;
}
Also used : TestExecutor(de.dagere.peass.execution.utils.TestExecutor) TestTransformer(de.dagere.peass.testtransformation.TestTransformer) HashSet(java.util.HashSet)

Example 9 with TestTransformer

use of de.dagere.peass.testtransformation.TestTransformer in project peass by DaGeRe.

the class TestExecutorCreation method testMavenExecutorCreationWithMeasurementConfig.

@Test
public void testMavenExecutorCreationWithMeasurementConfig() {
    MeasurementConfig measurementConfig = new MeasurementConfig(2);
    TestTransformer testTransformer = ExecutorCreator.createTestTransformer(Mockito.mock(PeassFolders.class), measurementConfig.getExecutionConfig(), measurementConfig);
    Assert.assertNotNull(testTransformer);
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) TestTransformer(de.dagere.peass.testtransformation.TestTransformer) PeassFolders(de.dagere.peass.folders.PeassFolders) Test(org.junit.jupiter.api.Test)

Example 10 with TestTransformer

use of de.dagere.peass.testtransformation.TestTransformer in project peass by DaGeRe.

the class IndirectSubclass method testJUnitTestTransformer.

@Test
public void testJUnitTestTransformer() {
    TestTransformer transformer = Mockito.mock(JUnitTestTransformer.class);
    MeasurementConfig value = new MeasurementConfig(2);
    value.getExecutionConfig().setTestExecutor("de.dagere.peass.dependency.JUnitTestTransformerSubclass");
    Mockito.when(transformer.getConfig()).thenReturn(value);
    TestExecutor executor = ExecutorCreator.createExecutor(null, transformer, new EnvironmentVariables());
    Assert.assertNotNull(executor);
}
Also used : MeasurementConfig(de.dagere.peass.config.MeasurementConfig) TestExecutor(de.dagere.peass.execution.utils.TestExecutor) JUnitTestTransformer(de.dagere.peass.testtransformation.JUnitTestTransformer) TestTransformer(de.dagere.peass.testtransformation.TestTransformer) EnvironmentVariables(de.dagere.peass.execution.utils.EnvironmentVariables) Test(org.junit.jupiter.api.Test)

Aggregations

TestTransformer (de.dagere.peass.testtransformation.TestTransformer)10 TestExecutor (de.dagere.peass.execution.utils.TestExecutor)5 JUnitTestTransformer (de.dagere.peass.testtransformation.JUnitTestTransformer)4 Test (org.junit.jupiter.api.Test)4 MeasurementConfig (de.dagere.peass.config.MeasurementConfig)3 KiekerConfig (de.dagere.peass.config.KiekerConfig)2 EnvironmentVariables (de.dagere.peass.execution.utils.EnvironmentVariables)2 PeassFolders (de.dagere.peass.folders.PeassFolders)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 AnalyseFullData (de.dagere.peass.analysis.measurement.AnalyseFullData)1 ProjectStatistics (de.dagere.peass.analysis.measurement.ProjectStatistics)1 ExecutionConfig (de.dagere.peass.config.ExecutionConfig)1 ModuleClassMapping (de.dagere.peass.dependency.analysis.ModuleClassMapping)1 HashSet (java.util.HashSet)1