use of eu.stamp_project.dspot.common.configuration.UserInput in project dspot by STAMP-project.
the class GradleInjectorTest method testOnGradleFromActiveonWithoutMavenRepositoryPluginsGradle.
@Test
public void testOnGradleFromActiveonWithoutMavenRepositoryPluginsGradle() {
/*
test the injection of what we need in the build.gradle when we removed the
maven {
url "https://plugins.gradle.org/m2/"
}
*/
UserInput configuration = new UserInput();
configuration.setAbsolutePathToProjectRoot("src/test/");
configuration.setExcludedClasses("fr.inria.filter.failing.*");
configuration.setJVMArgs("-Xmx2048m,-Xms1024m");
configuration.setFilter("fr.inria.sample.*");
final GradleInjector gradleInjector = new GradleInjector("src/test/resources/no_repository_build.gradle", !configuration.isGregorMode(), configuration.getFilter(), configuration.getPitVersion(), configuration.getTimeOutInMs(), configuration.getJVMArgs(), configuration.getExcludedClasses(), configuration.getAdditionalClasspathElements());
final String pitTask = gradleInjector.getPitTask();
assertTrue(pitTask, pitTask.startsWith(expectedStarts));
assertTrue(pitTask, pitTask.endsWith(expectedEnd));
}
use of eu.stamp_project.dspot.common.configuration.UserInput in project dspot by STAMP-project.
the class MavenAutomaticBuilderTest method setUp.
public void setUp(String path, String filter, boolean isDescartesMode, String additionalClasspathElements) {
this.parser = new PitXMLResultParser();
this.configuration = new UserInput();
this.configuration.setAbsolutePathToProjectRoot(new File(path).getAbsolutePath());
this.configuration.setGregorMode(!isDescartesMode);
this.configuration.setFilter(filter);
this.configuration.setAdditionalClasspathElements(additionalClasspathElements);
this.builder = AutomaticBuilderEnum.Maven.getAutomaticBuilder(this.configuration);
DSpotPOMCreator.createNewPom(this.configuration);
this.launcher = new Launcher();
this.launcher.addInputResource(path + "/src/");
this.launcher.getEnvironment().setNoClasspath(true);
this.launcher.buildModel();
DSpotState.verbose = true;
try {
FileUtils.deleteDirectory(new File(path + "/target/"));
} catch (IOException ignored) {
// ignored
}
builder.compileAndBuildClasspath();
}
use of eu.stamp_project.dspot.common.configuration.UserInput in project dspot by STAMP-project.
the class DSpotCompilerTest method testDSpotCompiler.
// TODO update with configuration
@Test
public void testDSpotCompiler() throws Exception {
final UserInput configuration = new UserInput();
configuration.setAbsolutePathToProjectRoot("src/test/resources/test-projects/");
final DSpotCompiler compiler = DSpotCompiler.createDSpotCompiler(configuration, "");
TestCompiler testCompiler = new TestCompiler(0, false, configuration.getAbsolutePathToProjectRoot(), configuration.getClasspathClassesProject(), 10000, "", false);
final CtClass<?> aClass = getClass(compiler.getLauncher().getFactory());
final List<CtMethod<?>> method = aClass.getMethodsByName("method");
final List<CtMethod<?>> compile = testCompiler.compileAndDiscardUncompilableMethods(compiler, aClass, method);
assertEquals(1, compile.size());
assertEquals(1, aClass.getMethods().size());
final List<CtMethod<?>> tests = new UncompilableAmplifier().amplify(method.get(0), 0).collect(Collectors.toList());
tests.forEach(aClass::addMethod);
assertEquals(3, aClass.getMethods().size());
final CtMethod uncompilableTest = tests.stream().filter(ctMethod -> ctMethod.getSimpleName().equals("compilableTest")).findFirst().get();
final List<CtMethod<?>> results = testCompiler.compileAndDiscardUncompilableMethods(compiler, aClass, new ArrayList(aClass.getMethods()));
assertEquals(2, results.size());
assertEquals("compilableTest", results.get(0).getSimpleName());
assertEquals(uncompilableTest, results.get(0));
assertEquals(2, aClass.getMethods().size());
}
use of eu.stamp_project.dspot.common.configuration.UserInput in project dspot by STAMP-project.
the class AbstractSelectorRemoveOverlapTest method setUp.
@Before
public void setUp() {
DSpotState.verbose = true;
this.configuration = new UserInput();
this.configuration.setAbsolutePathToProjectRoot(getPathToAbsoluteProjectRoot());
this.configuration.setOutputDirectory(outputDirectory);
this.builder = AutomaticBuilderEnum.Maven.getAutomaticBuilder(configuration);
this.initializeDSpot = new InitializeDSpot();
String dependencies = initializeDSpot.completeDependencies(configuration, this.builder);
DSpotUtils.init(CommentEnum.None, outputDirectory, this.configuration.getFullClassPathWithExtraDependencies(), this.getPathToAbsoluteProjectRoot());
this.compiler = DSpotCompiler.createDSpotCompiler(configuration, dependencies);
DSpotCache.init(10000);
Launcher launcher = new Launcher();
launcher.getEnvironment().setNoClasspath(true);
launcher.addInputResource(this.getPathToAbsoluteProjectRoot());
launcher.buildModel();
this.factory = launcher.getFactory();
TestFramework.init(this.factory);
this.testCompiler = new TestCompiler(0, false, this.getPathToAbsoluteProjectRoot(), this.configuration.getClasspathClassesProject(), 10000, "", false);
AssertionGeneratorUtils.init(false);
DSpotPOMCreator.createNewPom(configuration);
RandomHelper.setSeedRandom(72L);
ValueCreator.count = 0;
this.testSelectorUnderTest = this.getTestSelector();
}
use of eu.stamp_project.dspot.common.configuration.UserInput in project dspot by STAMP-project.
the class GradleAutomaticBuilderTest method setUp.
@Before
public void setUp() throws Exception {
// assumeTrue("true".equals(System.getProperty("doIntegrationTests")));
DSpotState.verbose = true;
cleanTestEnv();
LOGGER.debug("Test Set-up - Reading input parameters...");
LOGGER.debug("Test Set-up - instantiating Automatic Builder (SUT)...");
final UserInput configuration = new UserInput();
configuration.setAbsolutePathToProjectRoot(this.pathToProjectRoot);
configuration.setGregorMode(true);
configuration.setFilter("example.*");
launcher = new Launcher();
launcher.addInputResource(pathToProjectRoot + "src/");
launcher.getEnvironment().setNoClasspath(true);
launcher.buildModel();
sut = AutomaticBuilderEnum.Gradle.getAutomaticBuilder(configuration);
sut.compile();
LOGGER.debug("Test Set-up complete.");
parser = new PitXMLResultParser();
}
Aggregations