Package org.apache.maven.surefire.booter

Examples of org.apache.maven.surefire.booter.Classpath


        assertEquals( current, saveAndReload( testStartupConfiguration ).isManifestOnlyJarRequestedAndUsable() );
    }

    private ClasspathConfiguration createClasspathConfiguration()
    {
        Classpath testClassPath = new Classpath( Arrays.asList( "CP1", "CP2" ) );
        Classpath providerClasspath = new Classpath( Arrays.asList( "SP1", "SP2" ) );
        return new ClasspathConfiguration( testClassPath, providerClasspath, Classpath.emptyClasspath(), true, true );
    }
View Full Code Here


        try
        {
            provider.addProviderProperties();
            // cache the provider lookup
            String providerName = provider.getProviderName();
            Classpath providerClasspath = ClasspathCache.getCachedClassPath( providerName );
            if ( providerClasspath == null )
            {
                providerClasspath = provider.getProviderClasspath();
                ClasspathCache.setCachedClasspath( providerName, providerClasspath );

            }
            Artifact surefireArtifact = getCommonArtifact();
            Classpath inprocClassPath = providerClasspath.addClassPathElementUrl( surefireArtifact.getFile().getAbsolutePath() );

            final Classpath testClasspath = generateTestClasspath();

            getLog().debug( testClasspath.getLogMessage( "test" ) );
            getLog().debug( providerClasspath.getLogMessage( "provider" ) );

            getLog().debug( testClasspath.getCompactLogMessage( "test(compact)" ) );
            getLog().debug( providerClasspath.getCompactLogMessage( "provider(compact)" ) );

            final ClasspathConfiguration classpathConfiguration =
                new ClasspathConfiguration( testClasspath, providerClasspath, inprocClassPath,
                                            effectiveIsEnableAssertions(), isChildDelegation() );
View Full Code Here

        //noinspection ResultOfMethodCallIgnored
        tmpDir.mkdirs();

        Artifact shadeFire = getPluginArtifactMap().get( "org.apache.maven.surefire:surefire-shadefire" );

        final Classpath bootClasspathConfiguration =
            getArtifactClasspath( shadeFire != null ? shadeFire : surefireBooterArtifact );

        return new ForkConfiguration( bootClasspathConfiguration, tmpDir, getEffectiveDebugForkedProcess(),
                                      getEffectiveJvm(),
                                      getWorkingDirectory() != null ? getWorkingDirectory() : getBasedir(),
View Full Code Here

        if ( getTestNgArtifact() != null )
        {
            addTestNgUtilsArtifacts( classpath );
        }

        return new Classpath( classpath );
    }
View Full Code Here

        }
    }

    private Classpath getArtifactClasspath( Artifact surefireArtifact )
    {
        Classpath existing = ClasspathCache.getCachedClassPath( surefireArtifact.getArtifactId() );
        if ( existing == null )
        {
            ArtifactResolutionResult result = resolveArtifact( null, surefireArtifact );

            List<String> items = new ArrayList<String>();
            for ( Object o : result.getArtifacts() )
            {
                Artifact artifact = (Artifact) o;

                getLog().debug(
                    "Adding to " + getPluginName() + " booter test classpath: " + artifact.getFile().getAbsolutePath() +
                        " Scope: " + artifact.getScope() );

                items.add( artifact.getFile().getAbsolutePath() );
            }
            existing = new Classpath( items );
            ClasspathCache.setCachedClasspath( surefireArtifact.getArtifactId(), existing );
        }
        return existing;
    }
View Full Code Here

    }

    public Classpath getProviderClasspath( String provider, String version, Artifact filteredArtifact )
        throws ArtifactNotFoundException, ArtifactResolutionException
    {
        Classpath classPath = ClasspathCache.getCachedClassPath( provider );
        if ( classPath == null )
        {
            Artifact providerArtifact = artifactFactory.createDependencyArtifact( "org.apache.maven.surefire", provider,
                                                                                  VersionRange.createFromVersion(
                                                                                      version ), "jar", null,
                                                                                  Artifact.SCOPE_TEST );
            ArtifactResolutionResult result = resolveArtifact( filteredArtifact, providerArtifact );
            List<String> files = new ArrayList<String>();

            for ( Object o : result.getArtifacts() )
            {
                Artifact artifact = (Artifact) o;

                log.debug(
                    "Adding to " + pluginName + " test classpath: " + artifact.getFile().getAbsolutePath() + " Scope: "
                        + artifact.getScope() );

                files.add( artifact.getFile().getAbsolutePath() );
            }
            classPath = new Classpath( files );
            ClasspathCache.setCachedClasspath( provider, classPath );
        }
        return classPath;
    }
View Full Code Here

            for ( Artifact artifact : pluginArtifactMap.values() )
            {
                files.add( artifact.getFile().getPath() );
            }
        }
        return new Classpath( files );
    }
View Full Code Here

        {
            throw new SurefireBooterForkException( "Error creating properties files for forking", e );
        }

        // this could probably be simplified further
        final Classpath bootClasspathConfiguration = startupConfiguration.isProviderMainClass()
            ? startupConfiguration.getClasspathConfiguration().getProviderClasspath()
            : forkConfiguration.getBootClasspath();

        Classpath bootClasspath = join(
            join( bootClasspathConfiguration, startupConfiguration.getClasspathConfiguration().getTestClasspath() ),
            startupConfiguration.getClasspathConfiguration().getProviderClasspath() );

        if ( log.isDebugEnabled() )
        {
            log.debug( bootClasspath.getLogMessage( "boot" ) );
            log.debug( bootClasspath.getCompactLogMessage( "boot(compact)" ) );
        }
        OutputStreamFlushableCommandline cli =
            forkConfiguration.createCommandLine( bootClasspath.getClassPath(), startupConfiguration, forkNumber );

        final InputStreamCloser inputStreamCloser;
        final Thread inputStreamCloserHook;
        if ( testProvidingInputStream != null )
        {
View Full Code Here

        try
        {
            provider.addProviderProperties();
            // cache the provider lookup
            String providerName = provider.getProviderName();
            Classpath providerClasspath = ClasspathCache.getCachedClassPath( providerName );
            if ( providerClasspath == null )
            {
                providerClasspath = provider.getProviderClasspath();
                ClasspathCache.setCachedClasspath( providerName, providerClasspath );

            }
            Artifact surefireArtifact = getCommonArtifact();
            Classpath inprocClassPath = providerClasspath.
                    addClassPathElementUrl( surefireArtifact.getFile().getAbsolutePath() )
                    .addClassPathElementUrl( getApiArtifact().getFile().getAbsolutePath());

            final Classpath testClasspath = generateTestClasspath();

            getLog().debug( testClasspath.getLogMessage( "test" ) );
            getLog().debug( providerClasspath.getLogMessage( "provider" ) );

            getLog().debug( testClasspath.getCompactLogMessage( "test(compact)" ) );
            getLog().debug( providerClasspath.getCompactLogMessage( "provider(compact)" ) );

            final ClasspathConfiguration classpathConfiguration =
                new ClasspathConfiguration( testClasspath, providerClasspath, inprocClassPath,
                                            effectiveIsEnableAssertions(), isChildDelegation() );
View Full Code Here

        //noinspection ResultOfMethodCallIgnored
        tmpDir.mkdirs();

        Artifact shadeFire = getPluginArtifactMap().get( "org.apache.maven.surefire:surefire-shadefire" );

        final Classpath bootClasspathConfiguration =
            getArtifactClasspath( shadeFire != null ? shadeFire : surefireBooterArtifact );

        return new ForkConfiguration( bootClasspathConfiguration, tmpDir, getEffectiveDebugForkedProcess(),
                                      getEffectiveJvm(),
                                      getWorkingDirectory() != null ? getWorkingDirectory() : getBasedir(),
View Full Code Here

TOP

Related Classes of org.apache.maven.surefire.booter.Classpath

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.