Package com.github.timurstrekalov.saga.core

Examples of com.github.timurstrekalov.saga.core.CoverageGenerator


            final String baseDir = line.getOptionValue(baseDirOpt.getLongOpt());
            final String includes = line.getOptionValue(includeOpt.getLongOpt());
            final String excludes = line.getOptionValue(excludeOpt.getLongOpt());
            final File outputDir = new File(line.getOptionValue(outputDirOpt.getLongOpt()));

            final CoverageGenerator gen = CoverageGeneratorFactory.newInstance(baseDir, outputDir);
            final Config config = gen.getConfig();
            config.setIncludes(includes);
            config.setExcludes(excludes);

            if (line.hasOption(outputInstrumentedFilesOpt.getLongOpt())) {
                config.setOutputInstrumentedFiles(true);
            }

            config.setNoInstrumentPatterns(line.getOptionValues(noInstrumentPatternOpt.getLongOpt()));
            config.setSourcesToPreload(line.getOptionValue(sourcesToPreloadOpt.getLongOpt()));
            config.setOutputStrategy(line.getOptionValue(outputStrategyOpt.getLongOpt()));

            final String threadCount = line.getOptionValue(threadCountOpt.getLongOpt());
            if (threadCount != null) {
                try {
                    config.setThreadCount(Integer.parseInt(threadCount));
                } catch (final Exception e) {
                    System.err.println("Invalid thread count");
                    printHelpAndExit(options);
                }
            }

            if (line.hasOption(includeInlineScriptsOpt.getLongOpt())) {
                config.setIncludeInlineScripts(true);
            }

            final String backgroundJavaScriptTimeout = line.getOptionValue(backgroundJavaScriptTimeoutOpt.getLongOpt());
            if (backgroundJavaScriptTimeout != null) {
                try {
                    config.setBackgroundJavaScriptTimeout(Long.valueOf(backgroundJavaScriptTimeout));
                } catch (final Exception e) {
                    System.err.println("Invalid timeout");
                    printHelpAndExit(options);
                }
            }

            config.setBrowserVersion(line.getOptionValue(browserVersionOpt.getLongOpt()));
            config.setReportFormats(line.getOptionValue(reportFormatsOpt.getLongOpt()));
            config.setSortBy(line.getOptionValue(sortByOpt.getLongOpt()));
            config.setOrder(line.getOptionValue(orderOpt.getLongOpt()));

            logger.debug("Configured the coverage generator, running");

            gen.instrumentAndGenerateReports();
        } catch (final MissingOptionException e) {
            System.err.println(e.getMessage());
            printHelpAndExit(options);
        } catch (final UnrecognizedOptionException e) {
            System.err.println(e.getMessage());
View Full Code Here


            getLog().info("Coverage reporting is skipped.");
            return;
        }

        try {
            final CoverageGenerator gen = CoverageGeneratorFactory.newInstance(baseDir, outputDir);
            final Config config = gen.getConfig();

            config.setIncludes(includes);
            config.setExcludes(excludes);
            config.setOutputInstrumentedFiles(outputInstrumentedFiles);
            config.setCacheInstrumentedCode(cacheInstrumentedCode);
            config.setNoInstrumentPatterns(noInstrumentPatterns);
            config.setOutputStrategy(outputStrategy);
            config.setThreadCount(threadCount);
            config.setIncludeInlineScripts(includeInlineScripts);
            config.setBackgroundJavaScriptTimeout(backgroundJavaScriptTimeout);
            config.setSourcesToPreload(sourcesToPreload);
            config.setSourcesToPreloadEncoding(sourcesToPreloadEncoding);
            config.setBrowserVersion(browserVersion);
            config.setReportFormats(reportFormats);
            config.setSortBy(sortBy);
            config.setOrder(order);
            config.setWebDriverCapabilities(webDriverCapabilities);
            config.setWebDriverClassName(webDriverClassName);

            if (sourceDirs == null) {
              sourceDirs = Lists.newArrayList(defaultSourceDir);
            } else if (sourceDirs.isEmpty()) {
              sourceDirs.add(defaultSourceDir);
            }
            config.setSourceDir(sourceDirs);

            gen.instrumentAndGenerateReports();
        } catch (final IllegalArgumentException e) {
            throw new MojoExecutionException("Caught IllegalArgumentException: illegal parameters?", e);
        } catch (final Exception e) {
            throw new MojoExecutionException("Error generating coverage", e);
        }
View Full Code Here

TOP

Related Classes of com.github.timurstrekalov.saga.core.CoverageGenerator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.