port += offset;
}
final ModelControllerClient client = ModelControllerClient.Factory
.create("localhost", port);
ServerDeploymentManager deploymentManager = ServerDeploymentManager.Factory.create(client);
InitialDeploymentPlanBuilder builder = deploymentManager.newDeploymentPlan();
String applName = "wicket-examples1";
URL applUrl = new URL("mvn:org.apache.wicket/wicket-examples/1.5.3/war");
DeploymentPlan plan = builder.add(applName, applUrl).andDeploy().build();
ServerDeploymentPlanResult result = deploymentManager.execute(plan).get();
UUID actionId = plan.getDeploymentActions().get(0).getId();
ServerDeploymentActionResult actionResult = result.getDeploymentActionResult(actionId);
assertThat(actionResult.getResult(), is(Result.EXECUTED));
builder = deploymentManager.newDeploymentPlan();
plan = builder.undeploy(applName).andRemoveUndeployed().build();
result = deploymentManager.execute(plan).get();
actionId = plan.getDeploymentActions().get(0).getId();
actionResult = result.getDeploymentActionResult(actionId);
assertThat(actionResult.getResult(), is(Result.EXECUTED));