All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mockserver.maven.MockServerStopForkedMojo Maven / Gradle / Ivy

There is a newer version: 5.15.0
Show newest version
package org.mockserver.maven;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.mockserver.server.EmbeddedJettyRunner;


/**
 * Stop the a forked instance of the MockServer
 *
 * @author jamesdbloom
 */
@Mojo(name = "stopForked", requiresProject = false, threadSafe = false)
public class MockServerStopForkedMojo extends AbstractMojo {

    /**
     * Logging level
     */
    @Parameter(property = "mockserver.logLevel", defaultValue = "WARN")
    private String logLevel;

    /**
     * The port to stop MockServer
     */
    @Parameter(property = "mockserver.stopPort", defaultValue = "8081")
    private int stopPort;

    /**
     * Key to provide when stopping MockServer
     */
    @Parameter(property = "mockserver.stopKey", defaultValue = "STOP_KEY")
    protected String stopKey;

    /**
     * Max time in seconds to wait for the MockServer to stop
     */
    @Parameter(property = "mockserver.stopWait")
    protected int stopWait;


    public void execute() throws MojoExecutionException {
        EmbeddedJettyRunner.overrideLogLevel(logLevel);
        EmbeddedJettyRunner.stopRemote("127.0.0.1", stopPort, stopKey, stopWait);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy