Package net.sourceforge.clownfish.mojo.glassfish

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


     * Test execute success.
     */
    public void testExecuteSuccess() {
        try {
           
            StopMojo stopMojo = new StopMojo();
       
            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.stop()).andReturn(true);

            clownfish.destroy();


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


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

            stopMojo.execute();
           
            EasyMock.verify(log);
            EasyMock.verify(clownfish);
            EasyMock.verify(clownfishFactory);
            EasyMock.verify(clownfishHelper);
View Full Code Here


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

        StopMojo stopMojo = new StopMojo();

        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.stop()).andThrow(exception);

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

        clownfish.destroy();


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


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

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

TOP

Related Classes of net.sourceforge.clownfish.mojo.glassfish.StopMojo

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.