Search in sources :

Example 1 with TestTransformer

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

the class ContinuousExecutor method analyzeMeasurements.

private void analyzeMeasurements(final File measurementFolder) throws InterruptedException, IOException, JsonGenerationException, JsonMappingException, XmlPullParserException {
    final ProjectStatistics statistics = new ProjectStatistics();
    TestTransformer testTransformer = ExecutorCreator.createTestTransformer(folders, measurementConfig.getExecutionConfig(), measurementConfig);
    TestExecutor executor = ExecutorCreator.createExecutor(folders, testTransformer, env);
    ModuleClassMapping mapping = new ModuleClassMapping(folders.getProjectFolder(), executor.getModules(), measurementConfig.getExecutionConfig());
    final AnalyseFullData afd = new AnalyseFullData(resultsFolders.getChangeFile(), statistics, mapping, measurementConfig.getStatisticsConfig());
    afd.analyseFolder(measurementFolder);
    Constants.OBJECTMAPPER.writeValue(resultsFolders.getStatisticsFile(), statistics);
}
Also used : TestExecutor(de.dagere.peass.execution.utils.TestExecutor) TestTransformer(de.dagere.peass.testtransformation.TestTransformer) AnalyseFullData(de.dagere.peass.analysis.measurement.AnalyseFullData) ModuleClassMapping(de.dagere.peass.dependency.analysis.ModuleClassMapping) ProjectStatistics(de.dagere.peass.analysis.measurement.ProjectStatistics)

Example 2 with TestTransformer

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

the class DependencyTester method getExecutor.

protected synchronized TestExecutor getExecutor(final PeassFolders currentFolders, final String version) {
    TestTransformer transformer = ExecutorCreator.createTestTransformer(currentFolders, configuration.getExecutionConfig(), configuration);
    final TestExecutor testExecutor = ExecutorCreator.createExecutor(currentFolders, transformer, env);
    return testExecutor;
}
Also used : TestExecutor(de.dagere.peass.execution.utils.TestExecutor) TestTransformer(de.dagere.peass.testtransformation.TestTransformer)

Example 3 with TestTransformer

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

the class TestExecutorCreation method testMavenExecutorCreation.

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

Example 4 with TestTransformer

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

the class IndirectSubclass method testSubsubclass.

@Test
public void testSubsubclass() {
    TestTransformer transformer = Mockito.mock(TestTransformer.class);
    MeasurementConfig value = new MeasurementConfig(2);
    value.getExecutionConfig().setTestExecutor("de.dagere.peass.dependency.IndirectSubclass");
    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)

Example 5 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 KiekerConfig kiekerConfig) {
    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, ExecutionConfig.class, KiekerConfig.class);
        TestTransformer transformer = (TestTransformer) constructor.newInstance(folders.getProjectFolder(), executionConfig, kiekerConfig);
        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)

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