Package org.jbehave.mojo

Source Code of org.jbehave.mojo.StoryPrinterMojo

package org.jbehave.mojo;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.jbehave.core.story.StoryLoader;
import org.jbehave.core.story.StoryPrinter;
import org.jbehave.core.story.codegen.parser.StoryParser;
import org.jbehave.core.story.codegen.parser.TextStoryParser;
import org.jbehave.core.story.renderer.PlainTextRenderer;

/**
* Mojo to print a story
*
* @author Mauro Talevi
* @goal print-story
*/
public class StoryPrinterMojo  extends AbstractJBehaveMojo {
     
    /**
     * @parameter
     * @required true
     */
    String storyPath;

    /**
     * @parameter
     * @required true
     */
    String storyPackage;

    /** The story parser */
    private StoryParser storyParser = new TextStoryParser();

    public void execute() throws MojoExecutionException, MojoFailureException {
        try {
            getLog().debug("Printing story "+ storyPath);
            StoryLoader loader = new StoryLoader(storyParser, new BehavioursClassLoader(classpathElements));
            StoryPrinter storyPrinter = new StoryPrinter(loader, new PlainTextRenderer(System.out));           
            storyPrinter.print(storyPath, storyPackage);
        } catch (Exception e) {
            throw new MojoExecutionException("Failed to print story "+storyPath+" with package "+storyPackage, e);
        }
    }
 
}
TOP

Related Classes of org.jbehave.mojo.StoryPrinterMojo

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.