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

org.mule.tools.muleesb.StopMojo Maven / Gradle / Ivy

Go to download

Maven plugin that helps control Mule ESB servers, including CE, EE Standalone and HA deployments. Main use is for running integration tests but can be used also for deploying an application to any environment after all tests were ran. Some of the features are: Download Mule Standalone from a Maven Repository and install it locally. Start Mule Standalone server. Deploy a Mule application to a server. Undeploy a Mule appliction. Stop a Mule Standalone server. Restart a Mule Standalone server. Assemble a Mule cluster and deploy applications.

The newest version!
/*
 * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 * The software in this package is published under the terms of the CPAL v1.0
 * license, a copy of which has been included with this distribution in the
 * LICENSE.txt file.
 */
package org.mule.tools.muleesb;

import org.mule.test.infrastructure.process.MuleProcessController;

import java.io.File;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;

/**
 * Stops a Mule ESB Standalone server, regardless of whether it was started using start or deploy goals.
 * Assumptions:
 * 
  • The plugin started only one Mule ESB server (otherwise the server that is stopped is undefined).
  • *
  • Mule ESB Standalone is running.
  • * * @author Ale Sequeira * @see org.mule.tools.muleesb.StartMojo * @see org.mule.tools.muleesb.DeployMojo * @since 1.0 */ @Mojo(name = "stop", requiresProject = false, defaultPhase = LifecyclePhase.POST_INTEGRATION_TEST) public class StopMojo extends AbstractMuleMojo { @Component private MavenProject mavenProject; /** * Absolute path for Mule ESB Standalone server (i.e. $MULE_HOME). * * @since 1.0 */ @Parameter(property = "mule.home") private File muleHome; public void doExecute() throws MojoExecutionException, MojoFailureException { if (muleHome == null) { muleHome = new File(mavenProject.getProperties().getProperty("mule.home")); if (muleHome == null) { throw new MojoFailureException("MULE_HOME is not defined."); } } MuleProcessController mule = new MuleProcessController(muleHome.getAbsolutePath(), timeout); new Stopper(mule, muleHome, getLog()).execute(); } }




    © 2015 - 2024 Weber Informatics LLC | Privacy Policy