.addPackage(Simple.class.getPackage())
.addAsManifestResource(ServerInModuleDeploymentTestCase.class.getPackage(), "jboss-service.xml", "jboss-service.xml");
archive2.addAsManifestResource(ServerInModuleDeploymentTestCase.class.getPackage(), "marker.txt", "marker.txt");
final ModelControllerClient client = managementClient.getControllerClient();
final ServerDeploymentManager manager = ServerDeploymentManager.Factory.create(client);
testDeployments(client, false, new DeploymentExecutor() {
@Override
public void initialDeploy() {
final InputStream is = archive.as(ZipExporter.class).exportAsInputStream();
try {
Future<?> future = manager.execute(manager.newDeploymentPlan()
.add("test-deployment.sar", is).deploy("test-deployment.sar").build());
awaitDeploymentExecution(future);
} finally {
if (is != null) try {
is.close();
} catch (IOException ignore) {
//
}
}
}
@Override
public void fullReplace() {
final InputStream is = archive2.as(ZipExporter.class).exportAsInputStream();
try {
Future<?> future = manager.execute(manager.newDeploymentPlan()
.replace("test-deployment.sar", is).build());
awaitDeploymentExecution(future);
} finally {
if (is != null) try {
is.close();
} catch (IOException ignore) {
//
}
}
}
@Override
public void undeploy() {
Future<?> future = manager.execute(manager.newDeploymentPlan().undeploy("test-deployment.sar")
.remove("test-deployment.sar").build());
awaitDeploymentExecution(future);
}
});
}