use of eu.stamp_project.dspot.common.configuration.UserInput in project dspot by STAMP-project.
the class GradleAutomaticBuilderWithDescartesTest method setUp.
@Before
public void setUp() throws Exception {
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();
}
use of eu.stamp_project.dspot.common.configuration.UserInput in project dspot by STAMP-project.
the class DSpotPOMCreatorTest method testOnPOMWithProfiles.
@Test
public void testOnPOMWithProfiles() throws Exception {
/*
Test the copy and the injection of the profile on a pom with an existing profiles tag
*/
// TODO system properties are not used in DSpotPOMCreator
UserInput configuration = new UserInput();
configuration.setFilter("fr.inria.sample.*");
configuration.setAbsolutePathToProjectRoot("src/test/resources/sample/");
configuration.setJVMArgs("-Xmx2048m,-Xms1024m");
configuration.setSystemProperties("-Dis.admin.user=admin,-Dis.admin.passwd=$2pRSid#");
configuration.setExcludedClasses("fr.inria.filter.failing.*");
DSpotPOMCreator.createNewPom(configuration);
try (BufferedReader reader = new BufferedReader(new FileReader(configuration.getAbsolutePathToProjectRoot() + DSpotPOMCreator.getPOMName()))) {
final String content = reader.lines().collect(Collectors.joining(AmplificationHelper.LINE_SEPARATOR));
assertTrue(content + AmplificationHelper.LINE_SEPARATOR + "should be ends with " + AmplificationHelper.LINE_SEPARATOR + PROFILE_ENDS_WITH, content.replaceAll(" ", "").endsWith(PROFILE_ENDS_WITH.replaceAll(" ", "")));
}
}
use of eu.stamp_project.dspot.common.configuration.UserInput in project dspot by STAMP-project.
the class DSpotPOMCreatorTest method test.
@Test
public void test() throws Exception {
/*
Test the copy and injection of the profile to run different foals in the origial pom.xml
*/
UserInput configuration = new UserInput();
configuration.setFilter("example.*");
configuration.setAbsolutePathToProjectRoot("src/test/resources/test-projects/");
configuration.setJVMArgs("-Xmx2048m,-Xms1024m");
DSpotPOMCreator.createNewPom(configuration);
try (BufferedReader reader = new BufferedReader(new FileReader(configuration.getAbsolutePathToProjectRoot() + DSpotPOMCreator.getPOMName()))) {
final String content = reader.lines().collect(Collectors.joining(AmplificationHelper.LINE_SEPARATOR));
assertTrue(content + AmplificationHelper.LINE_SEPARATOR + "must contain " + AmplificationHelper.LINE_SEPARATOR + MUST_CONTAIN, content.contains(MUST_CONTAIN));
assertTrue(content + AmplificationHelper.LINE_SEPARATOR + "should be ends with " + AmplificationHelper.LINE_SEPARATOR + ENDS_WITH, content.endsWith(ENDS_WITH));
}
}
use of eu.stamp_project.dspot.common.configuration.UserInput in project dspot by STAMP-project.
the class AssertionGeneratorTest method setUpClass.
@BeforeClass
public static void setUpClass() {
configuration = new UserInput();
configuration.setAbsolutePathToProjectRoot(new File("src/test/resources/sample/").getAbsolutePath());
AutomaticBuilder builder = AutomaticBuilderEnum.Maven.getAutomaticBuilder(configuration);
initializeDSpot = new InitializeDSpot();
dependencies = initializeDSpot.completeDependencies(configuration, builder);
}
use of eu.stamp_project.dspot.common.configuration.UserInput in project dspot by STAMP-project.
the class AssertionRemoverTest method testOnDifferentKindOfAssertions.
@Test
public void testOnDifferentKindOfAssertions() throws Exception {
/*
Test that the AssertionRemover remove all kind of assertions
*/
UserInput configuration = new UserInput();
configuration.setAbsolutePathToProjectRoot(new File(getPathToProjectRoot()).getAbsolutePath());
// new TestCompiler(0,
// false,
// configuration.getAbsolutePathToProjectRoot(),
// configuration.getClasspathClassesProject(),
// 10000,
// "",
// false
//
// );
AutomaticBuilder builder = AutomaticBuilderEnum.Maven.getAutomaticBuilder(configuration);
InitializeDSpot initializeDSpot = new InitializeDSpot();
String dependencies = initializeDSpot.completeDependencies(configuration, builder);
launcher = new Launcher();
launcher.addInputResource(getPathToProjectRoot());
launcher.getEnvironment().setOutputType(OutputType.CLASSES);
launcher.getModelBuilder().setSourceClasspath(dependencies.split(AmplificationHelper.PATH_SEPARATOR));
launcher.buildModel();
final CtClass<?> testClass = findClass("fr.inria.helper.TestWithMultipleAsserts");
final AssertionRemover assertionRemover = new AssertionRemover();
final CtMethod<?> testMethod = testClass.getMethodsByName("test").get(0);
final CtMethod<?> removedAssertion = assertionRemover.removeAssertions(testMethod, true);
assertEquals(4, removedAssertion.getBody().getStatements().size());
}
Aggregations