Search in sources :

Example 1 with EmailSender

use of eu.stamp_project.dspot.common.collector.smtp.EmailSender in project dspot by STAMP-project.

the class InitializeDSpot method init.

public void init(UserInput userInput) {
    this.DSpotState = new DSpotState();
    DSpotState.setUserInput(userInput);
    DSpotState.setOnlyInputAmplification(userInput.isOnlyInputAmplification());
    DSpotState.setDevFriendlyAmplification(userInput.isDevFriendlyAmplification());
    DSpotState.verbose = userInput.isVerbose();
    DSpotState.setStartTime(System.currentTimeMillis());
    DSpotState.setTestFinder(new TestFinder(Arrays.stream(userInput.getExcludedClasses().split(",")).collect(Collectors.toList()), Arrays.stream(userInput.getExcludedTestCases().split(",")).collect(Collectors.toList())));
    DSpotState.setAutomaticBuilder(userInput.getBuilderEnum().getAutomaticBuilder(userInput));
    final String dependencies = completeDependencies(userInput, DSpotState.getAutomaticBuilder());
    DSpotState.setCompiler(DSpotCompiler.createDSpotCompiler(userInput, dependencies));
    userInput.setFactory(DSpotState.getCompiler().getLauncher().getFactory());
    initHelpers(userInput);
    DSpotState.setTestCompiler(new TestCompiler(userInput.getNumberParallelExecutionProcessors(), userInput.shouldExecuteTestsInParallel(), userInput.getAbsolutePathToProjectRoot(), userInput.getClasspathClassesProject(), userInput.getTimeOutInMs(), userInput.getPreGoalsTestExecution(), userInput.shouldUseMavenToExecuteTest()));
    final EmailSender emailSender = new EmailSender(userInput.getSmtpUsername(), userInput.getSmtpPassword(), userInput.getSmtpHost(), userInput.getSmtpPort(), userInput.isSmtpAuth(), userInput.getSmtpTls());
    DSpotState.setCollector(CollectorFactory.build(userInput, emailSender));
    DSpotState.getCollector().reportInitInformation(userInput.getAmplifiers(), userInput.getSelector(), userInput.getNbIteration(), userInput.isGregorMode(), !userInput.isGregorMode(), userInput.getNumberParallelExecutionProcessors());
    DSpotState.setTestClassesToBeAmplified(DSpotState.getTestFinder().findTestClasses(userInput.getTestClasses()));
    DSpotState.setTestMethodsToBeAmplifiedNames(userInput.getTestCases());
    if (DSpotState.getTestMethodsToBeAmplifiedNames().size() == 1 && DSpotState.getTestMethodsToBeAmplifiedNames().get(0).isEmpty()) {
        DSpotState.getTestMethodsToBeAmplifiedNames().clear();
    }
    DSpotState.setTestSelector(userInput.getSelector().buildSelector(DSpotState.getAutomaticBuilder(), userInput));
    final List<Amplifier> amplifiers = userInput.getAmplifiers().stream().map(AmplifierEnum::getAmplifier).filter(Objects::nonNull).collect(Collectors.toList());
    DSpotState.setInputAmplDistributor(userInput.getInputAmplDistributor().getInputAmplDistributor(userInput.getMaxTestAmplified(), amplifiers));
    DSpotState.setOutput(new Output(userInput.getAbsolutePathToProjectRoot(), userInput.getOutputDirectory(), DSpotState.getCollector()));
    DSpotState.setAssertionGenerator(new AssertionGenerator(userInput.getDelta(), DSpotState.getCompiler(), DSpotState.getTestCompiler(), DSpotState.isDevFriendlyAmplification()));
    Checker.postChecking(userInput);
    DSpotState.setCollectData(true);
    DSpotState.setDelta(userInput.getDelta());
    DSpotState.setNbIteration(userInput.getNbIteration());
    DSpotState.verbose = userInput.isVerbose();
}
Also used : TestCompiler(eu.stamp_project.dspot.common.compilation.TestCompiler) AssertionGenerator(eu.stamp_project.dspot.assertiongenerator.AssertionGenerator) Output(eu.stamp_project.dspot.common.report.output.Output) AmplifierEnum(eu.stamp_project.dspot.common.configuration.options.AmplifierEnum) TestFinder(eu.stamp_project.dspot.common.configuration.test_finder.TestFinder) EmailSender(eu.stamp_project.dspot.common.collector.smtp.EmailSender) Amplifier(eu.stamp_project.dspot.amplifier.amplifiers.Amplifier)

Aggregations

Amplifier (eu.stamp_project.dspot.amplifier.amplifiers.Amplifier)1 AssertionGenerator (eu.stamp_project.dspot.assertiongenerator.AssertionGenerator)1 EmailSender (eu.stamp_project.dspot.common.collector.smtp.EmailSender)1 TestCompiler (eu.stamp_project.dspot.common.compilation.TestCompiler)1 AmplifierEnum (eu.stamp_project.dspot.common.configuration.options.AmplifierEnum)1 TestFinder (eu.stamp_project.dspot.common.configuration.test_finder.TestFinder)1 Output (eu.stamp_project.dspot.common.report.output.Output)1