diff --git a/README.md b/README.md
index f514412..239f219 100644
--- a/README.md
+++ b/README.md
@@ -61,6 +61,13 @@ In order to post to the Mule Repository, you need only these permissions:
What to name the application when it is uploaded to the repository
version
diff --git a/src/main/java/org/mule/tools/maven/rest/Deploy.java b/src/main/java/org/mule/tools/maven/rest/Deploy.java
index 8b7c756..85a4b89 100644
--- a/src/main/java/org/mule/tools/maven/rest/Deploy.java
+++ b/src/main/java/org/mule/tools/maven/rest/Deploy.java
@@ -48,6 +48,14 @@ public class Deploy extends AbstractMojo {
*/
protected String name;
+ /**
+ * The name that the application will be deployed as. Default is
+ * same as ${name}
+ *
+ * @parameter expression="${deploymentName}"
+ */
+ protected String deploymentName;
+
/**
* The version that the application will be deployed as. Default is the
* current time in milliseconds.
@@ -102,6 +110,10 @@ public void execute() throws MojoExecutionException, MojoFailureException {
logger.info("Name is not set, using default \"{}\"", DEFAULT_NAME);
name = DEFAULT_NAME;
}
+ if (deploymentName == null) {
+ logger.info("DeploymentName is not set, using application name \"{}\"", name);
+ deploymentName = name;
+ }
if (version == null) {
version = new SimpleDateFormat("MM-dd-yyyy-HH:mm:ss").format(Calendar.getInstance()
.getTime());
@@ -123,7 +135,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
validateProject(appDirectory);
muleRest = buildMuleRest();
String versionId = muleRest.restfullyUploadRepository(name, version, getMuleZipFile(outputDirectory, finalName));
- String deploymentId = muleRest.restfullyCreateDeployment(serverGroup, name, versionId);
+ String deploymentId = muleRest.restfullyCreateDeployment(serverGroup, deploymentName, versionId);
muleRest.restfullyDeployDeploymentById(deploymentId);
} catch (Exception e) {
throw new MojoFailureException("Error in attempting to deploy archive: " + e.toString(), e);
diff --git a/src/test/java/org/mule/tools/maven/rest/DeployTest.java b/src/test/java/org/mule/tools/maven/rest/DeployTest.java
index 5dae7f4..bc378f5 100644
--- a/src/test/java/org/mule/tools/maven/rest/DeployTest.java
+++ b/src/test/java/org/mule/tools/maven/rest/DeployTest.java
@@ -83,11 +83,18 @@ public void testFinalNameNull() throws MojoExecutionException, MojoFailureExcept
}
@Test(expected = MojoFailureException.class)
- public void testServerGRoupNull() throws MojoExecutionException, MojoFailureException {
+ public void testServerGroupNull() throws MojoExecutionException, MojoFailureException {
deploy.serverGroup = null;
deploy.execute();
Assert.fail("Exception should have been thrown before this is called");
}
+
+ @Test
+ public void testDeploymentNameNull() throws MojoExecutionException, MojoFailureException {
+ deploy.deploymentName = null;
+ deploy.execute();
+ Assert.assertEquals("When null, deploymentName should be same as name", deploy.name, deploy.deploymentName);
+ }
@Test
public void testHappyPath() throws Exception{
|