Examples of StartMojo


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

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

            clownfish.destroy();


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


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

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

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

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

        StartMojo startMojo = new StartMojo();

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

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

        clownfish.destroy();


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


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

        try {
            startMojo.execute();
            fail("execute should fail "
                    + "- should throw MojoExecutionException");
        } catch (MojoExecutionException e) {
            // do-nothing
        }
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.