use of org.glassfish.embeddable.Deployer in project Payara by payara.
the class BasicPaaSServiceMetadataTest method runTests.
private void runTests(GlassFish glassfish) throws Exception {
// 2. Deploy the PaaS application.
File archive = new File(System.getProperty("basedir") + // TODO :: use mvn apis to
"/target/basic_paas_sample2.war");
// get the archive
// location.
Assert.assertTrue(archive.exists());
Deployer deployer = glassfish.getDeployer();
String appName = deployer.deploy(archive);
System.err.println("Deployed [" + appName + "]");
Assert.assertNotNull(appName);
CommandRunner commandRunner = glassfish.getCommandRunner();
CommandResult result = commandRunner.run("list-services");
System.out.println("\nlist-services command output [ " + result.getOutput() + "]");
// 3. Access the app to make sure PaaS app is correctly provisioned.
String HTTP_PORT = (System.getProperty("http.port") != null) ? System.getProperty("http.port") : "28080";
String instanceIP = getLBIPAddress(glassfish);
get("http://" + instanceIP + ":" + HTTP_PORT + "/basic_paas_sample2/BasicPaaSServlet", "Request headers from the request:");
// 4. Undeploy the PaaS application . TODO :: use cloud-undeploy??
deployer.undeploy(appName);
System.err.println("Undeployed [" + appName + "]");
try {
boolean undeployClean = false;
CommandResult commandResult = glassfish.getCommandRunner().run("list-services");
if (commandResult.getOutput().contains("Nothing to list.")) {
undeployClean = true;
}
Assert.assertTrue(undeployClean);
} catch (Exception e) {
System.err.println("Couldn't varify whether undeploy succeeded");
}
}
use of org.glassfish.embeddable.Deployer in project Payara by payara.
the class Util method undeploy.
public static void undeploy(String appName, String serverId) throws Exception {
GlassFish glassfish = gfMap.get(serverId);
if (glassfish == null) {
throw new Exception("Embedded GlassFish [" + serverId + "] not running");
}
if (appName == null) {
throw new Exception("Application name can not be null");
}
Deployer deployer = glassfish.getDeployer();
deployer.undeploy(appName);
System.out.println("Undeployed [" + appName + "]");
}
use of org.glassfish.embeddable.Deployer in project Payara by payara.
the class Util method deploy.
public static void deploy(String app, String serverId, List<String> deployParams) throws Exception {
GlassFish glassfish = gfMap.get(serverId);
if (glassfish == null) {
throw new Exception("Embedded GlassFish [" + serverId + "] not running");
}
if (app == null) {
throw new Exception("Application can not be null");
}
Deployer deployer = glassfish.getDeployer();
final int len = deployParams.size();
if (len > 0) {
deployer.deploy(new File(app).toURI(), deployParams.toArray(new String[len]));
System.out.println("Deployed [" + app + "] with parameters " + deployParams);
} else {
deployer.deploy(new File(app).toURI());
System.out.println("Deployed [" + app + "]");
}
}
Aggregations