System.setProperty("jboss.socket.binding.port-offset", Integer.toString(offset));
}
ConfigurationManager cm = new ConfigurationManager();
String jBossHome = cm.getProperty("pax.exam.wildfly80.home");
StandaloneServer server = EmbeddedServerFactory.create(jBossHome,
null, null, "org.jboss.logging");
server.start();
int port = 9990;
if (offset != null) {
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));
server.stop();
}