Search in sources :

Example 1 with UserInput

use of eu.stamp_project.dspot.common.configuration.UserInput in project dspot by STAMP-project.

the class Main method parse.

public static UserInput parse(String[] args) {
    UserInput userInput = new UserInput();
    final CommandLine commandLine = new CommandLine(userInput);
    commandLine.setUsageHelpWidth(120);
    try {
        commandLine.parseArgs(args);
    } catch (Exception e) {
        e.printStackTrace();
        commandLine.usage(System.err);
        return null;
    }
    if (commandLine.isUsageHelpRequested()) {
        commandLine.usage(System.out);
        return null;
    }
    if (commandLine.isVersionHelpRequested()) {
        commandLine.printVersionHelp(System.out);
        return null;
    }
    if (userInput.shouldRunExample()) {
        userInput.configureExample();
    }
    try {
        Checker.preChecking(userInput);
    } catch (InputErrorException e) {
        e.printStackTrace();
        commandLine.usage(System.err);
        return null;
    }
    return userInput;
}
Also used : CommandLine(picocli.CommandLine) UserInput(eu.stamp_project.dspot.common.configuration.UserInput) InputErrorException(eu.stamp_project.dspot.common.configuration.check.InputErrorException) InputErrorException(eu.stamp_project.dspot.common.configuration.check.InputErrorException)

Example 2 with UserInput

use of eu.stamp_project.dspot.common.configuration.UserInput in project dspot by STAMP-project.

the class Main method main.

public static void main(String[] args) {
    UserInput userInput = parse(args);
    if (userInput == null) {
        return;
    }
    final DSpot dspot = new DSpot(userInput);
    dspot.run();
}
Also used : DSpot(eu.stamp_project.dspot.DSpot) UserInput(eu.stamp_project.dspot.common.configuration.UserInput)

Example 3 with UserInput

use of eu.stamp_project.dspot.common.configuration.UserInput in project dspot by STAMP-project.

the class ProjectJSONTest method setUp.

@Before
public void setUp() {
    super.setUp();
    this.configuration = new UserInput();
    this.configuration.setAbsolutePathToProjectRoot(getPathToProjectRoot());
    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.getPathToProjectRoot());
    this.compiler = DSpotCompiler.createDSpotCompiler(configuration, dependencies);
    DSpotCache.init(10000);
    Launcher launcher = new Launcher();
    launcher.getEnvironment().setNoClasspath(true);
    launcher.addInputResource(this.getPathToProjectRoot());
    launcher.buildModel();
    this.factory = launcher.getFactory();
    TestFramework.init(this.factory);
    testCompiler = new TestCompiler(0, false, this.getPathToProjectRoot(), this.configuration.getClasspathClassesProject(), 10000, "", false);
    AssertionGeneratorUtils.init(false);
    DSpotPOMCreator.createNewPom(configuration);
    RandomHelper.setSeedRandom(72L);
    ValueCreator.count = 0;
    this.testSelector = new JacocoCoverageSelector(builder, configuration);
    try {
        FileUtils.forceDelete(new File(outputDirectory));
    } catch (Exception ignored) {
    }
}
Also used : TestCompiler(eu.stamp_project.dspot.common.compilation.TestCompiler) JacocoCoverageSelector(eu.stamp_project.dspot.selector.JacocoCoverageSelector) UserInput(eu.stamp_project.dspot.common.configuration.UserInput) Launcher(spoon.Launcher) InitializeDSpot(eu.stamp_project.dspot.common.configuration.InitializeDSpot) Before(org.junit.Before)

Example 4 with UserInput

use of eu.stamp_project.dspot.common.configuration.UserInput in project dspot by STAMP-project.

the class MavenAutomaticBuilderTest method testGetDependenciesOf.

@Test
public void testGetDependenciesOf() throws Exception {
    UserInput configuration = new UserInput();
    configuration.setAbsolutePathToProjectRoot(new File("src/test/resources/test-projects/").getAbsolutePath());
    AutomaticBuilder builder = AutomaticBuilderEnum.Maven.getAutomaticBuilder(configuration);
    final String dependenciesOf = builder.buildClasspath();
    assertTrue(dependenciesOf.contains("org" + System.getProperty("file.separator") + "hamcrest" + System.getProperty("file.separator") + "hamcrest-core" + System.getProperty("file.separator") + "1.3" + System.getProperty("file.separator") + "hamcrest-core-1.3.jar"));
    assertTrue(dependenciesOf.contains("junit" + System.getProperty("file.separator") + "junit" + System.getProperty("file.separator") + "4.11" + System.getProperty("file.separator") + "junit-4.11.jar"));
}
Also used : AutomaticBuilder(eu.stamp_project.dspot.common.automaticbuilder.AutomaticBuilder) UserInput(eu.stamp_project.dspot.common.configuration.UserInput) File(java.io.File) Test(org.junit.Test)

Example 5 with UserInput

use of eu.stamp_project.dspot.common.configuration.UserInput in project dspot by STAMP-project.

the class DSpotUtilsTest method setUp.

@Override
@Before
public void setUp() {
    super.setUp();
    super.setUp();
    this.configuration = new UserInput();
    this.configuration.setAbsolutePathToProjectRoot(getPathToProjectRoot());
    this.configuration.setOutputDirectory(outputDirectory.getAbsolutePath());
    this.builder = AutomaticBuilderEnum.Maven.getAutomaticBuilder(configuration);
    this.initializeDSpot = new InitializeDSpot();
    String dependencies = initializeDSpot.completeDependencies(configuration, this.builder);
    DSpotUtils.init(CommentEnum.None, outputDirectory.getAbsolutePath(), this.configuration.getFullClassPathWithExtraDependencies(), this.getPathToProjectRoot());
    this.compiler = DSpotCompiler.createDSpotCompiler(configuration, dependencies);
}
Also used : UserInput(eu.stamp_project.dspot.common.configuration.UserInput) InitializeDSpot(eu.stamp_project.dspot.common.configuration.InitializeDSpot) Before(org.junit.Before)

Aggregations

UserInput (eu.stamp_project.dspot.common.configuration.UserInput)26 Before (org.junit.Before)11 Test (org.junit.Test)10 InitializeDSpot (eu.stamp_project.dspot.common.configuration.InitializeDSpot)8 Launcher (spoon.Launcher)8 File (java.io.File)7 AutomaticBuilder (eu.stamp_project.dspot.common.automaticbuilder.AutomaticBuilder)5 TestCompiler (eu.stamp_project.dspot.common.compilation.TestCompiler)4 PitXMLResultParser (eu.stamp_project.dspot.selector.pitmutantscoreselector.PitXMLResultParser)3 BufferedReader (java.io.BufferedReader)3 FileReader (java.io.FileReader)3 TestRunner (eu.stamp_project.dspot.common.execution.TestRunner)2 ArrayList (java.util.ArrayList)2 CtMethod (spoon.reflect.declaration.CtMethod)2 DSpot (eu.stamp_project.dspot.DSpot)1 DSpotState (eu.stamp_project.dspot.common.configuration.DSpotState)1 InputErrorException (eu.stamp_project.dspot.common.configuration.check.InputErrorException)1 DSpotUtils (eu.stamp_project.dspot.common.miscellaneous.DSpotUtils)1 JacocoCoverageSelector (eu.stamp_project.dspot.selector.JacocoCoverageSelector)1 IOException (java.io.IOException)1