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);
}
}
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;
}
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;
}
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);
}
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);
}
Aggregations