Package org.apache.maven.plugin.testing.stubs

Examples of org.apache.maven.plugin.testing.stubs.MavenProjectStub


        final Build build = new Build();
        build.setDirectory("target");
        build.setOutputDirectory("target/classes");
        build.setTestOutputDirectory("target/test-classes");

        return new MavenProjectStub() {
            String daoFramework = "hibernate";
            String webFramework = "struts";
            Properties props;
           
            public Build getBuild() {
View Full Code Here


        ArtifactStub artifact = new ArtifactStub();
        artifact.setGroupId( "group" );
        artifact.setArtifactId( "artifact" );
        artifact.setVersion( "1.0.0.0" );

        MavenProject project = new MavenProjectStub();
        project.setGroupId( artifact.getGroupId() );
        project.setArtifactId( artifact.getArtifactId() );
        project.setVersion( artifact.getVersion() );
        project.setArtifact( artifact );
        project.setArtifacts( Collections.EMPTY_SET );
        project.setDependencyArtifacts( Collections.EMPTY_SET );
        File bundleFile = getTestFile( "src/test/resources/org.apache.maven.maven-model_2.1.0.SNAPSHOT.jar" );
        artifact.setFile( bundleFile );

        BundleInfo bundleInfo = plugin.bundle( project );
View Full Code Here

        test( "generic" );
    }

    protected void test(String mode) throws Exception
    {
        MavenProjectStub project = new MavenProjectStub()
        {
            private final List resources = new ArrayList();


            @Override
            public void addResource( Resource resource )
            {
                resources.add( resource );
            }


            @Override
            public List getResources()
            {
                return resources;
            }


            @Override
            public File getBasedir()
            {
                return new File( "target/tmp/basedir" );
            }
        };
        project.setGroupId( "group" );
        project.setArtifactId( "artifact" );
        project.setVersion( "1.1.0.0" );
        Resource r = new Resource();
        r.setDirectory( new File( "src/test/resources" ).getAbsoluteFile().getCanonicalPath() );
        r.setIncludes( Arrays.asList( "**/*.*" ) );
        project.addResource( r );
        project.addCompileSourceRoot( new File( "src/test/resources" ).getAbsoluteFile().getCanonicalPath() );

        ManifestPlugin plugin = new ManifestPlugin();
        plugin.setBuildDirectory( "target/tmp/basedir/target" );
        plugin.setOutputDirectory( new File( "target/tmp/basedir/target/classes" ) );

View Full Code Here

public abstract class AbstractBundlePluginTest extends PlexusTestCase
{

    protected MavenProjectStub getMavenProjectStub()
    {
        MavenProjectStub project = new MavenProjectStub();
        project.setGroupId( "group" );
        project.setArtifactId( "project" );
        project.setVersion( "1.2.3.4" );
        return project;
    }
View Full Code Here

        final Organization organization = new Organization();
        organization.setName( "Example Organization" );
        organization.setUrl( "http://example.org" );

        // MavenProjectStub.setOrganization(Organization) doesn't do anything, so we have to make it work this way
        MavenProject project = new MavenProjectStub()
        {
            @Override
            public Organization getOrganization()
            {
                return organization;
            }
        };
        project.setGroupId( "group" );
        project.setArtifactId( "project" );
        project.setVersion( "1.2.3.4" );

        Properties properties = plugin.getDefaultProperties( project );
        assertEquals( organization.getName(), properties.getProperty( "project.organization.name" ) );
        assertEquals( organization.getName(), properties.getProperty( "pom.organization.name" ) );
        assertEquals( organization.getUrl(), properties.getProperty( "project.organization.url" ) );
View Full Code Here

        setVariableValueToObject( mojo, "useMavenDefaultExcludes", Boolean.TRUE );
        setVariableValueToObject( mojo, "useEclipseDefaultExcludes", Boolean.TRUE );
        setVariableValueToObject( mojo, "addLicenseHeaders", "false" );
        final Build build = new Build();
        build.setDirectory( buildDirectory.getPath() );
        final MavenProjectStub project = new MavenProjectStub(){
            public Build getBuild()
            {
                return build;
            }
        };
View Full Code Here

    }

    protected MavenProject getMavenProject()
    {
        MavenProjectStub mavenProjectStub = new MavenProjectStub()
        {
            @Override
            public List<RemoteRepository> getRemotePluginRepositories()
            {
                if ( super.getRemotePluginRepositories() == null )
                {
                    return RepositoryUtils.toRepos( request.getRemoteRepositories() );
                }
                return super.getRemotePluginRepositories();
            }

            @Override
            public List<ArtifactRepository> getRemoteArtifactRepositories()
            {
                if ( super.getRemotePluginRepositories() == null )
                {
                    return request.getRemoteRepositories();
                }
                return super.getRemoteArtifactRepositories();
            }

            @Override
            public String getName()
            {
                return "foo";
            }

            @Override
            public String getVersion()
            {
                return "1.0-SNAPSHOT";
            }

            @Override
            public boolean isExecutionRoot()
            {
                return true;
            }

            @Override
            public List<String> getCompileSourceRoots()
            {
                return Lists.newArrayList( "src/main/java" );
            }

            @Override
            public List<String> getTestCompileSourceRoots()
            {
                return Lists.newArrayList( "src/test/java" );
            }
        };

        mavenProjectStub.setPackaging( "jar" );

        Build build = new Build();

        build.setOutputDirectory( "target" );

        build.setSourceDirectory( "src/main/java" );

        build.setTestSourceDirectory( "src/test/java" );

        mavenProjectStub.setBuild( build );

        return mavenProjectStub;
    }
View Full Code Here

     * test reading goals from a file
     */
    public void testReadGoalsFromFile()
        throws Exception
    {
        MavenProjectStub project = new MavenProjectStub();
        project.setTestClasspathElements( Collections.EMPTY_LIST );

        InvokerMojo invokerMojo = new InvokerMojo();
        setVariableValueToObject( invokerMojo, "goalsFile", "goals.txt" );
        setVariableValueToObject( invokerMojo, "project", project );
        setVariableValueToObject( invokerMojo, "settings", new Settings() );
View Full Code Here

        DeploymentRepository repository = new DeploymentRepository();
        repository.setId( "localhost" );
        repository.setUrl( ( https ? "https" : "http" ) + "://localhost:" + port );
        distributionManagement.setRepository( repository );
        distributionManagement.setSnapshotRepository( repository );
        return new MavenProjectStub()
        {
            @Override
            public DistributionManagement getDistributionManagement()
            {
                return distributionManagement;
View Full Code Here

public abstract class AbstractBundlePluginTest extends PlexusTestCase
{

    protected MavenProjectStub getMavenProjectStub()
    {
        MavenProjectStub project = new MavenProjectStub();
        project.setGroupId( "group" );
        project.setArtifactId( "project" );
        project.setVersion( "1.2.3.4" );
        return project;
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.plugin.testing.stubs.MavenProjectStub

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.