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

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


     * 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


    }

    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

        DeploymentRepository repository = new DeploymentRepository();
        repository.setId( "localhost" );
        repository.setUrl( "http://localhost:8080" );
        distributionManagement.setRepository( repository );
        distributionManagement.setSnapshotRepository( repository );
        projectStub = new MavenProjectStub()
        {
            @Override
            public DistributionManagement getDistributionManagement()
            {
                return distributionManagement;
            }
        };

        final DistributionManagement distributionManagementSec = new DistributionManagement();
        DeploymentRepository repositorySec = new DeploymentRepository();
        repositorySec.setId( "localhost" );
        repositorySec.setUrl( "https://localhost:8443" );
        distributionManagementSec.setRepository( repositorySec );
        distributionManagementSec.setSnapshotRepository( repositorySec );
        projectStubSec = new MavenProjectStub()
        {
            @Override
            public DistributionManagement getDistributionManagement()
            {
                return distributionManagementSec;
View Full Code Here

        FileUtils.copyFileToFolder(new File("src/test/resources/update/doc2.txt"), tmp);

        LicenseFormatMojo updater = new LicenseFormatMojo();
        updater.basedir = tmp;
        updater.header = "src/test/resources/update/header.txt";
        updater.project = new MavenProjectStub();
        updater.execute();

        assertEquals(FileUtils.read(new File(tmp, "doc1.txt"), System.getProperty("file.encoding")), "====\r\n    My @Copyright license 2\r\n====\r\n\r\nsome data\r\n");
        assertEquals(FileUtils.read(new File(tmp, "doc2.txt"), System.getProperty("file.encoding")), "====\r\n    My @Copyright license 2\r\n====\r\n\r\nsome data\r\n");
    }
View Full Code Here

        LicenseFormatMojo updater = new LicenseFormatMojo();
        updater.basedir = tmp;
        updater.header = "src/test/resources/update/header.txt";
        updater.mapping = new HashMap<String, String>() {{put("properties", "SCRIPT_STYLE");}};
        updater.project = new MavenProjectStub();
        updater.execute();

        String test1 = FileUtils.read(new File(tmp, "test1.properties"), System.getProperty("file.encoding"));
        String test2 = FileUtils.read(new File(tmp, "test2.properties"), System.getProperty("file.encoding"));
        String test3 = FileUtils.read(new File(tmp, "test3.properties"), System.getProperty("file.encoding"));
View Full Code Here

        LicenseFormatMojo updater = new LicenseFormatMojo();
        updater.basedir = tmp;
        updater.header = "src/test/resources/update/header.txt";
        updater.mapping = new HashMap<String, String>() {{put("properties", "SCRIPT_STYLE");}};
        updater.project = new MavenProjectStub();
        updater.execute();

        assertEquals(FileUtils.read(new File(tmp, "test1.php"), System.getProperty("file.encoding")), "\r\n" +
                "\r\n" +
                "<?php\r\n" +
View Full Code Here

        FileUtils.copyFileToFolder(new File("src/test/resources/update/issue44/test.asp"), tmp);

        LicenseFormatMojo updater = new LicenseFormatMojo();
        updater.basedir = tmp;
        updater.header = "src/test/resources/update/header.txt";
        updater.project = new MavenProjectStub();
        updater.execute();

        assertEquals(FileUtils.read(new File(tmp, "issue44-3.rb"), System.getProperty("file.encoding")), "#\n" +
                "# My @Copyright license 2\n" +
                "#\n" +
View Full Code Here

        FileUtils.copyFileToFolder(new File("src/test/resources/remove/doc2.txt"), tmp);
       
        LicenseRemoveMojo remove = new LicenseRemoveMojo();
        remove.basedir = tmp;
        remove.header = "src/test/resources/remove/header.txt";
        remove.project = new MavenProjectStub();
        remove.execute();

        assertEquals(FileUtils.read(new File(tmp, "doc1.txt"), System.getProperty("file.encoding")), "some data\r\nand other data\r\n");
        assertEquals(FileUtils.read(new File(tmp, "doc2.txt"), System.getProperty("file.encoding")), "some data\r\nand other data\r\n");
    }
View Full Code Here

        FileUtils.copyFileToFolder(new File("src/test/resources/doc/doc3.txt"), tmp);

        LicenseRemoveMojo remove = new LicenseRemoveMojo();
        remove.basedir = tmp;
        remove.header = "src/test/resources/remove/header.txt";
        remove.project = new MavenProjectStub();
        remove.execute();

        assertEquals(FileUtils.read(new File(tmp, "doc9.xml"), System.getProperty("file.encoding")), "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n" +
                "<web-app>\r\n" +
                "\r\n" +
View Full Code Here

        FileUtils.copyFileToFolder(new File("src/test/resources/remove/issue44-3.rb"), tmp);

        LicenseRemoveMojo remove = new LicenseRemoveMojo();
        remove.basedir = tmp;
        remove.header = "src/test/resources/remove/header.txt";
        remove.project = new MavenProjectStub();
        remove.execute();

        assertEquals(FileUtils.read(new File(tmp, "issue44.rb"), System.getProperty("file.encoding")), "ruby code here\nand other data\n");
        assertEquals(FileUtils.read(new File(tmp, "issue44-2.rb"), System.getProperty("file.encoding")), "# code comment\nruby code here\nand other data\n");
        assertEquals(FileUtils.read(new File(tmp, "issue44-3.rb"), System.getProperty("file.encoding")), "# code comment\nruby code here\nand other data\n");
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.