//build cli archive
EnterpriseArchive cliArchive = ShrinkWrap.create(EnterpriseArchive.class, "archive.cli");
String deploy = "deploy deployment0.war\ndeploy deployment1.war";
String undeploy = "undeploy deployment0.war\nundeploy deployment1.war";
cliArchive.add(new StringAsset(deploy), new BasicPath("/", "install.scr"));
// add the default script which shouldn't be picked up
cliArchive.add(new StringAsset("deploy deployment0.war\ndeploy deployment1.war\ndeploy deployment2.war"), new BasicPath("/", "deploy.scr"));
cliArchive.add(new StringAsset(undeploy), new BasicPath("/", "uninstall.scr"));
cliArchive.add(new StringAsset("undeploy deployment0.war\nundeploy deployment1.war\nundeploy deployment2.war"), new BasicPath("/", "undeploy.scr"));
for (WebArchive war : wars) {
cliArchive.add(war, new BasicPath("/"), ZipExporter.class);
}
cliArchiveFile = new File(tempDir + File.separator + "archive.cli");
new ZipExporterImpl(cliArchive).exportTo(cliArchiveFile, true);
}