Examples of DeployMojo


Examples of net.sourceforge.clownfish.mojo.glassfish.DeployMojo

     * Test execute success.
     */
    public void testExecuteSuccess() {
        try {
           
            DeployMojo deployMojo = new DeployMojo();
       
            Command command = new Command(null);
            command.setVerbose(true);

            EasyMock.expect(log.isInfoEnabled()).andReturn(false).times(2);

            EasyMock.expect(clownfishFactory.createClownfish(
                    command, clownfishHelper, progressListenerFactory,
                    maven2WrapperLog))
                    .andReturn(clownfish);

            EasyMock.expect(clownfish.deploy()).andReturn(true);

            clownfish.destroy();


            EasyMock.replay(log);
            EasyMock.replay(maven2WrapperLog);
            EasyMock.replay(clownfish);
            EasyMock.replay(clownfishFactory);
            EasyMock.replay(clownfishHelper);


            deployMojo.setClownfishFactory(clownfishFactory);
            deployMojo.setClownfishHelper(clownfishHelper);
            deployMojo.setProgressListenerFactory(progressListenerFactory);
            deployMojo.setCommand(command);
            deployMojo.setMaven2WrapperLog(maven2WrapperLog);
            deployMojo.setLog(log);
           
            deployMojo.execute();
           
            EasyMock.verify(log);
            EasyMock.verify(clownfish);
            EasyMock.verify(clownfishFactory);
            EasyMock.verify(clownfishHelper);
           
            // test properties
            assertFalse(deployMojo.isAutostart());
            assertEquals(progressListenerFactory,
                    deployMojo.getProgressListenerFactory());
            assertEquals(maven2WrapperLog,
                    deployMojo.getMaven2WrapperLog());
            assertEquals(clownfish, deployMojo.getClownfish());
            assertEquals(clownfishFactory, deployMojo.getClownfishFactory());
            assertEquals(clownfishHelper, deployMojo.getClownfishHelper());
           
            deployMojo.setAutostart(true);
            deployMojo.setProgressListenerFactory(null);
            deployMojo.setMaven2WrapperLog(null);
            deployMojo.setClownfish(null);
            deployMojo.setClownfishFactory(null);
            deployMojo.setClownfishHelper(null);
           
            assertTrue(deployMojo.isAutostart());
            assertNull(deployMojo.getProgressListenerFactory());
            assertNull(deployMojo.getMaven2WrapperLog());
            assertNull(deployMojo.getClownfish());
            assertNull(deployMojo.getClownfishFactory());
            assertNull(deployMojo.getClownfishHelper());
           
        } catch (MojoExecutionException e) {
            fail(e.getMessage());
        }
    }
View Full Code Here

Examples of net.sourceforge.clownfish.mojo.glassfish.DeployMojo

     * Test execute fail.
     */
    public void testExecuteFail() {


        DeployMojo deployMojo = new DeployMojo();

        Command command = new Command(null);
        command.setVerbose(true);
       
        Exception exception = new RuntimeException("test mock exception");

        EasyMock.expect(log.isInfoEnabled()).andReturn(false).once();

        EasyMock.expect(clownfishFactory.createClownfish(
                command, clownfishHelper, progressListenerFactory,
                maven2WrapperLog))
                .andReturn(clownfish);

        EasyMock.expect(clownfish.deploy()).andThrow(exception);

        log.error("Exception thrown while deploying", exception);

        clownfish.destroy();


        EasyMock.replay(log);
        EasyMock.replay(maven2WrapperLog);
        EasyMock.replay(clownfish);
        EasyMock.replay(clownfishFactory);
        EasyMock.replay(clownfishHelper);


        deployMojo.setClownfishFactory(clownfishFactory);
        deployMojo.setClownfishHelper(clownfishHelper);
        deployMojo.setProgressListenerFactory(progressListenerFactory);
        deployMojo.setCommand(command);
        deployMojo.setMaven2WrapperLog(maven2WrapperLog);
        deployMojo.setLog(log);

        try {
            deployMojo.execute();
            fail("execute should fail "
                    + "- should throw MojoExecutionException");
        } catch (MojoExecutionException e) {
            // do-nothing
        }
View Full Code Here

Examples of net.sourceforge.clownfish.mojo.glassfish.DeployMojo

     *
     * @return mojo
     */
    private AbstractBaseMojo createTestMojo() {
       
        DeployMojo baseMojo = new DeployMojo();
       
        baseMojo.setArtifact("artifact");
        baseMojo.setDeploymentFactoryManagerClassName(
                "deploymentFactoryManagerClassName");
        baseMojo.setDeploymentManagerUri("deploymentManagerUri");
        baseMojo.setPassword("password");
        baseMojo.setUsername("username");
        baseMojo.setVerbose(true);
        baseMojo.setTargets(" server1, server2,server3 ");
        baseMojo.setModuleType("ear");
       
        return baseMojo;
    }
View Full Code Here

Examples of net.sourceforge.clownfish.mojo.glassfish.DeployMojo

     */
    public void testConfigurationProperties() {
       
        org.apache.maven.plugin.logging.Log log = new SystemStreamLog();
       
        DeployMojo deployMojo = new DeployMojo();
        deployMojo.setLog(log);
        deployMojo.setConfigurationFile(
                "src/test/resources/testConfiguration.properties");
       
       
        Log wrapperLog = new Maven2Logger(log);
        CommandFactoryImpl commandFactory = new CommandFactoryImpl();
        Properties props  = commandFactory.getConfigurationProperties(
                deployMojo, wrapperLog);
       
        assertEquals("classname1", props.get("clownfish.deploy.dfmclassname"));
       
       
        // test null
        deployMojo.setConfigurationFile(null);
        props = commandFactory.getConfigurationProperties(deployMojo,
                wrapperLog);
        assertNotNull(props);
        assertEquals(0, props.size());
       
        // test empty string
        deployMojo.setConfigurationFile("");
        props = commandFactory.getConfigurationProperties(deployMojo,
                wrapperLog);
        assertNotNull(props);
        assertEquals(0, props.size());
       
       
        // test io exception failure
        deployMojo.setConfigurationFile("nofile");
       
        try {
            commandFactory.getConfigurationProperties(deployMojo,
                    wrapperLog);
            fail("configurationFile is null - should throw IOException");
View Full Code Here

Examples of net.sourceforge.clownfish.mojo.glassfish.DeployMojo

     * @return mojo
     */
    @Before
    public void createTestMojo() {
       
        baseMojo = new DeployMojo();
       
        baseMojo.setArtifact("artifact");
        baseMojo.setDeploymentFactoryManagerClassName(
                "deploymentFactoryManagerClassName");
        baseMojo.setDeploymentManagerUri("deploymentManagerUri");
View Full Code Here

Examples of net.sourceforge.clownfish.mojo.glassfish.DeployMojo

    @Test(expected = InitializationException.class)
    public void testConfigurationProperties() {
       
        org.apache.maven.plugin.logging.Log log = new SystemStreamLog();
       
        DeployMojo deployMojo = new DeployMojo();
        deployMojo.setLog(log);
        deployMojo.setConfigurationFile(
                "src/test/resources/testConfiguration.properties");
       
       
        Log wrapperLog = new Maven2Logger(log);
        CommandFactoryImpl commandFactory = new CommandFactoryImpl();
        Properties props  = commandFactory.getConfigurationProperties(
                deployMojo, wrapperLog);
       
        Assert.assertEquals("classname1", props.get("clownfish.deploy.dfmclassname"));
        Assert.assertEquals("deployer", props.get("clownfish.deploy.uri"));
        Assert.assertEquals("username", props.get("clownfish.username"));
        Assert.assertEquals("password", props.get("clownfish.password"));
        Assert.assertEquals("target1,target2, target3",
                props.get("clownfish.targets"));
        Assert.assertEquals("artifactType1, artifactType2 ",
                props.get("clownfish.artifactTypes"));
        Assert.assertEquals("false", props.get("clownfish.verbose"));
        Assert.assertEquals("moduleType", props.get("clownfish.moduleType"));
       
       
        // test null
        deployMojo.setConfigurationFile(null);
        props = commandFactory.getConfigurationProperties(deployMojo,
                wrapperLog);
        Assert.assertNotNull(props);
        Assert.assertEquals(0, props.size());
       
        // test empty string
        deployMojo.setConfigurationFile("");
        props = commandFactory.getConfigurationProperties(deployMojo,
                wrapperLog);
        Assert.assertNotNull(props);
        Assert.assertEquals(0, props.size());
       
       
        // test io exception failure
        deployMojo.setConfigurationFile("nofile");
       
        commandFactory.getConfigurationProperties(deployMojo, wrapperLog);
    }
View Full Code Here

Examples of net.sourceforge.clownfish.mojo.glassfish.DeployMojo

     *
     * @return mojo
     */
    private AbstractBaseMojo createTestMojo() {
       
        DeployMojo baseMojo = new DeployMojo();
       
        baseMojo.setArtifact("artifact");
        baseMojo.setDeploymentFactoryManagerClassName(
                "deploymentFactoryManagerClassName");
        baseMojo.setDeploymentManagerUri("deploymentManagerUri");
        baseMojo.setPassword("password");
        baseMojo.setUsername("username");
        baseMojo.setVerbose(true);
        baseMojo.setTargets(" server1, server2,server3 ");
        baseMojo.setModuleType("ear");
       
        return baseMojo;
    }
View Full Code Here

Examples of net.sourceforge.clownfish.mojo.glassfish.DeployMojo

     */
    public void testConfigurationProperties() {
       
        org.apache.maven.plugin.logging.Log log = new SystemStreamLog();
       
        DeployMojo deployMojo = new DeployMojo();
        deployMojo.setLog(log);
        deployMojo.setConfigurationFile(
                "src/test/resources/testConfiguration.properties");
       
       
        Log wrapperLog = new Maven2Logger(log);
        CommandFactoryImpl commandFactory = new CommandFactoryImpl();
        Properties props  = commandFactory.getConfigurationProperties(
                deployMojo, wrapperLog);
       
        assertEquals("classname1", props.get("clownfish.deploy.dfmclassname"));
        assertEquals("deployer", props.get("clownfish.deploy.uri"));
        assertEquals("username", props.get("clownfish.username"));
        assertEquals("password", props.get("clownfish.password"));
        assertEquals("target1,target2, target3",
                props.get("clownfish.targets"));
        assertEquals("artifactType1, artifactType2 ",
                props.get("clownfish.artifactTypes"));
        assertEquals("false", props.get("clownfish.verbose"));
        assertEquals("moduleType", props.get("clownfish.moduleType"));
       
       
        // test null
        deployMojo.setConfigurationFile(null);
        props = commandFactory.getConfigurationProperties(deployMojo,
                wrapperLog);
        assertNotNull(props);
        assertEquals(0, props.size());
       
        // test empty string
        deployMojo.setConfigurationFile("");
        props = commandFactory.getConfigurationProperties(deployMojo,
                wrapperLog);
        assertNotNull(props);
        assertEquals(0, props.size());
       
       
        // test io exception failure
        deployMojo.setConfigurationFile("nofile");
       
        try {
            commandFactory.getConfigurationProperties(deployMojo,
                    wrapperLog);
            fail("configurationFile is null - should throw IOException");
View Full Code Here

Examples of org.apache.maven.plugin.deploy.DeployMojo

        throws Exception
    {
        File testPom = new File( getBasedir(),
                                 "target/test-classes/unit/basic-deploy-test/plugin-config.xml" );
   
        DeployMojo mojo = ( DeployMojo ) lookupMojo( "deploy", testPom );
   
        assertNotNull( mojo );
    }
View Full Code Here

Examples of org.apache.maven.plugin.deploy.DeployMojo

        throws Exception
    {
        File testPom = new File( getBasedir(),
                                 "target/test-classes/unit/basic-deploy-test/plugin-config.xml" );

        DeployMojo mojo = ( DeployMojo ) lookupMojo( "deploy", testPom );
       
        assertNotNull( mojo );
       
        File file = new File( getBasedir(),
                              "target/test-classes/unit/basic-deploy-test/target/" +
                              "deploy-test-file-1.0-SNAPSHOT.jar" );

        assertTrue( file.exists() );

        artifact = ( DeployArtifactStub ) getVariableValueFromObject( mojo, "artifact" );

        String packaging = ( String ) getVariableValueFromObject( mojo, "packaging" );
       
        assertEquals( "jar", packaging );
       
        artifact.setFile( file );       
       
        ArtifactRepositoryStub repo = getRepoStub( mojo );

        assertNotNull( repo );
       
        repo.setAppendToUrl( "basic-deploy-test" );
       
        assertEquals( "deploy-test", repo.getId() );
        assertEquals( "deploy-test", repo.getKey() );
        assertEquals( "file", repo.getProtocol() );
        assertEquals( "file://" + getBasedir() + "/target/remote-repo/basic-deploy-test", repo.getUrl() );
       
        mojo.execute();

        //check the artifact in local repository
        List expectedFiles = new ArrayList();
        List fileList = new ArrayList();
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.