Package org.apache.maven.surefire.suite

Examples of org.apache.maven.surefire.suite.RunResult


            new ThreadPoolExecutor( forkCount, forkCount, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>() );

        try
        {
            // Ask to the executorService to run all tasks
            RunResult globalResult = new RunResult( 0, 0, 0, 0 );
            final Iterator<Class<?>> suites = getSuitesIterator();
            while ( suites.hasNext() )
            {
                final Object testSet = suites.next();
                Callable<RunResult> pf = new Callable<RunResult>()
                {
                    public RunResult call()
                        throws Exception
                    {
                        ForkClient forkClient =
                            new ForkClient( defaultReporterFactory,
                                            startupReportConfiguration.getTestVmSystemProperties() );
                        return fork( testSet, new PropertiesWrapper( providerConfiguration.getProviderProperties() ),
                                     forkClient, effectiveSystemProperties, null );
                    }
                };
                results.add( executorService.submit( pf ) );

            }

            for ( Future<RunResult> result : results )
            {
                try
                {
                    RunResult cur = result.get();
                    if ( cur != null )
                    {
                        globalResult = globalResult.aggregate( cur );
                    }
                    else
View Full Code Here


        if ( forkConfiguration.isDebug() )
        {
            System.out.println( "Forking command line: " + cli );
        }

        RunResult runResult = null;

        try
        {
            final int timeout = forkedProcessTimeoutInSeconds > 0 ? forkedProcessTimeoutInSeconds : 0;
            final int result =
                CommandLineUtils.executeCommandLine( cli, testProvidingInputStream, threadedStreamConsumer,
                                                     threadedStreamConsumer, timeout, inputStreamCloser );
            if ( result != RunResult.SUCCESS )
            {
                throw new SurefireBooterForkException( "Error occurred in starting fork, check output in log" );
            }

        }
        catch ( CommandLineTimeOutException e )
        {
            runResult = RunResult.timeout( defaultReporterFactory.getGlobalRunStatistics().getRunResult() );
        }
        catch ( CommandLineException e )
        {
            runResult = RunResult.failure( defaultReporterFactory.getGlobalRunStatistics().getRunResult(), e );
            throw new SurefireBooterForkException( "Error while executing forked tests.", e.getCause() );
        }
        finally
        {
            threadedStreamConsumer.close();
            if ( inputStreamCloser != null )
            {
                inputStreamCloser.run();
                ShutdownHookUtils.removeShutdownHook( inputStreamCloserHook );
            }
            if ( runResult == null )
            {
                runResult = defaultReporterFactory.getGlobalRunStatistics().getRunResult();
            }
            if ( !runResult.isTimeout() )
            {
                StackTraceWriter errorInFork = forkClient.getErrorInFork();
                if ( errorInFork != null )
                {
                    // noinspection ThrowFromFinallyBlock
                    throw new RuntimeException( "There was an error in the forked process\n"
                        + errorInFork.writeTraceToString() );
                }
                if ( !forkClient.isSaidGoodBye() )
                {
                    // noinspection ThrowFromFinallyBlock
                    throw new RuntimeException(
                                                "The forked VM terminated without saying properly goodbye. VM crash or System.exit called ?"
                                                    + "\nCommand was" + cli.toString() );
                }

            }
            forkClient.close( runResult.isTimeout() );
        }

        return runResult;
    }
View Full Code Here

        return new ForkingRunListener( originalSystemOut, testSetChannelId++, isTrimstackTrace.booleanValue() );
    }

    public RunResult close()
    {
        return new RunResult( 17, 17, 17, 17 );
    }
View Full Code Here

        }
        final Integer getCompletedCount1 = (Integer) ReflectionUtils.invokeGetter( result, "getCompletedCount" );
        final Integer getErrors = (Integer) ReflectionUtils.invokeGetter( result, "getErrors" );
        final Integer getSkipped = (Integer) ReflectionUtils.invokeGetter( result, "getSkipped" );
        final Integer getFailures = (Integer) ReflectionUtils.invokeGetter( result, "getFailures" );
        return new RunResult( getCompletedCount1.intValue(), getErrors.intValue(), getFailures.intValue(),
                              getSkipped.intValue() );

    }
View Full Code Here

        throws MojoExecutionException, MojoFailureException
    {

        List<ProviderInfo> providers = createProviders();

        RunResult current = RunResult.noTestsRun();

        NestedCheckedException firstForkException = null;
        for ( ProviderInfo provider : providers )
        {
            try
            {
                current = current.aggregate( executeProvider( provider, scanResult ) );
            }
            catch ( SurefireBooterForkException e )
            {
                if ( firstForkException == null )
                {
View Full Code Here

        ClassLoaderConfiguration classLoaderConfiguration = getClassLoaderConfiguration( isForking() );

        RunOrderParameters runOrderParameters =
            new RunOrderParameters( getRunOrder(), getStatisticsFileName( getConfigChecksum() ) );

        final RunResult result;
        if ( isNotForking() )
        {
            createCopyAndReplaceForkNumPlaceholder( effectiveProperties, 1 ).copyToSystemProperties();

            InPluginVMSurefireStarter surefireStarter =
View Full Code Here

            new ArrayList<org.junit.runner.notification.RunListener>();
        customRunListeners.add( 0, jUnit4RunListener );

        JUnitCoreWrapper.execute( testsToRun, jUnitCoreParameters, customRunListeners, null );

        RunResult result = reporterFactory.close();

        Assert.assertEquals( "JUnit should report correctly number of test ran(Finished)", 1,
                             result.getCompletedCount() );

    }
View Full Code Here

   */
  @Override
  public RunResult invoke(Object forkTestSet) throws TestSetFailedException,
      ReporterException, InvocationTargetException {
    if (forkTestSet == null) {
      RunResult r = RunResult.noTestsRun();
      @SuppressWarnings("rawtypes")
      Iterator<Class> i = getSuites();
      while (i.hasNext()) {
        r = r.aggregate(invoke(i.next()));
      }
      return r;
    }
    ReporterFactory reporterFactory = providerParameters
        .getReporterFactory();
View Full Code Here

        try
        {
            RunOrderParameters runOrderParameters =
                new RunOrderParameters( getRunOrder(), getStatisticsFileName( getConfigChecksum() ) );

            final RunResult result;
            if ( isForkModeNever() )
            {
                effectiveProperties.copyToSystemProperties();
                InPluginVMSurefireStarter surefireStarter =
                    createInprocessStarter( provider, classLoaderConfiguration, runOrderParameters );
View Full Code Here

    }

    public RunResult run( SurefireProperties effectiveSystemProperties, DefaultScanResult scanResult, String requestedForkMode )
        throws SurefireBooterForkException, SurefireExecutionException
    {
        final RunResult result;
        try
        {
            Properties providerProperties = providerConfiguration.getProviderProperties();
            scanResult.writeTo( providerProperties );
            if ( ForkConfiguration.FORK_ONCE.equals( requestedForkMode ) )
View Full Code Here

TOP

Related Classes of org.apache.maven.surefire.suite.RunResult

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.