Package org.glassfish.embeddable

Examples of org.glassfish.embeddable.Deployer


                /*
                DeployCommandParameters deployCommandParameters = new DeployCommandParameters();
                deployCommandParameters.contextroot = this.appDescriptor.getContextPath();
                String name = server.getDeployer().deploy(war, deployCommandParameters);
                */
                Deployer deployer = glassfish.getDeployer();
                // Deploy my scattered web application
                //deployer.deploy(archive.toURI());
                if (warArchive == null) {
                    LOGGER.info("warArchive is null, nothing deployed");
                } else {
                    LOGGER.info("About to deploy [" + warArchive.toURI().toString() + "] from path ["+warArchive.toURI().getPath()+ "]  to EmbeddedGlassFish instance [" + deployer.toString() + "] with context-root set to [" + this.appDescriptor.getContextPath() + "]");
                    String deployedApp = deployer.deploy(warArchive.toURI());
                    LOGGER.info("Deployed [" + deployedApp + "] to EmbeddedGlassFish instance [" + deployer.toString() + "] with context-root set to [" + this.appDescriptor.getContextPath() + "]");
                }
            } catch (org.glassfish.embeddable.GlassFishException ex) {
                LOGGER.info("Caught GlassFishException ["+ex.getMessage()+ "] trying to start the embedded server instance");
                throw new TestContainerException(ex);
            } catch (java.io.IOException ioe) {
View Full Code Here


            }
        }

        private void undeployAllApplications() {
            java.util.Collection<java.lang.String> deployedApps;
            Deployer deployer;
            try {
                deployer = glassfish.getDeployer();
                // Return names of all the deployed applications.               
                deployedApps = deployer.getDeployedApplications();
              
            } catch (GlassFishException glassFishException) {
                throw new TestContainerException(glassFishException);
            }

            //  undeploy each app in for-each loop
            for (String deployedApp : deployedApps) {
                try {
                    //see http://java.net/jira/browse/EMBEDDED_GLASSFISH-123                   
                    deployer.undeploy(deployedApp, "--droptables", "true");                   
                } catch (GlassFishException glassFishException) {
                    throw new TestContainerException(glassFishException);
                }
                LOGGER.info("Undeployed = " + deployedApp);
            }
View Full Code Here

            throw new Exception("Embedded GlassFish [" + serverId + "] not running");
        }
        if (app == null) {
            throw new Exception("Application can not be null");
        }
        Deployer deployer = glassfish.getDeployer();
        if (deployParams.size() > 0) {
            deployer.deploy(new File(app).toURI(), deployParams.toArray(new String[0]));
            System.out.println("Deployed [" + app + "] with parameters " + deployParams);
        } else {
            deployer.deploy(new File(app).toURI());
            System.out.println("Deployed [" + app + "]");
        }
    }
View Full Code Here

            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 + "]");
    }
View Full Code Here

            throw new Exception("Embedded GlassFish [" + serverId + "] not running");
        }
        if (app == null) {
            throw new Exception("Application can not be null");
        }
        Deployer deployer = glassfish.getDeployer();
        if (deployParams.size() > 0) {
            deployer.deploy(new File(app).toURI(), deployParams.toArray(new String[0]));
            System.out.println("Deployed [" + app + "] with parameters " + deployParams);
        } else {
            deployer.deploy(new File(app).toURI());
            System.out.println("Deployed [" + app + "]");
        }
    }
View Full Code Here

            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 + "]");
    }
View Full Code Here

        GlassFishProperties gfProps = new GlassFishProperties();
        GlassFish gf = GlassFishRuntime.bootstrap().newGlassFish(gfProps);
        gf.start();

        Deployer deployer = gf.getDeployer();
        for (String appName : deployer.getDeployedApplications()) {
            log.info("undeploying " + appName);
            deployer.undeploy(appName);
        }

        URI sampleWarUri = new URI("mvn:org.apache.wicket/wicket-examples/1.5.3/war");
        String sampleAppName = "wicket-examples";

        log.info("deploying " + sampleAppName);
        deployer.deploy(sampleWarUri, "--name", sampleAppName, "--contextroot", sampleAppName);

        log.info("undeploying " + sampleAppName);
        deployer.undeploy(sampleAppName);

        log.info("stopping GlassFish");
        gf.stop();
    }
View Full Code Here

        try {
            // just make sure we don't get an "option not recognized" warning
            system.getOptions(WarProbeOption.class);

            LOG.info("deploying probe");
            Deployer deployer = glassFish.getDeployer();

            /*
             * FIXME The following should work, but does not. For some reason, we cannot directly
             * deploy from a stream. As a workaround, we copy the stream to a temp file and deploy
             * the file.
             *
             * deployer.deploy( stream, "--name", "Pax-Exam-Probe", "--contextroot",
             * "Pax-Exam-Probe" );
             */

            File tempFile = File.createTempFile("pax-exam", ".war");
            tempFile.deleteOnExit();
            StreamUtils.copyStream(stream, new FileOutputStream(tempFile), true);
            deployer.deploy(tempFile, "--name", PROBE_APPLICATION_NAME, "--contextroot",
                PROBE_APPLICATION_NAME);
            deployed.push(PROBE_APPLICATION_NAME);
        }
        catch (GlassFishException exc) {
            throw new TestContainerException(exc);
View Full Code Here

            String applicationName = option.getName();
            String contextRoot = option.getContextRoot();
            if (contextRoot == null) {
                contextRoot = applicationName;
            }
            Deployer deployer = glassFish.getDeployer();
            deployer.deploy(uri, "--name", applicationName, "--contextroot", applicationName);
            deployed.push(applicationName);
            LOG.info("deployed module {}", url);
        }
        catch (IOException exc) {
            throw new TestContainerException(exc);
View Full Code Here

    /**
     * Undeploys all deployed modules in reverse order.
     */
    private void undeployModules() {
        try {
            Deployer deployer = glassFish.getDeployer();
            while (!deployed.isEmpty()) {
                String applicationName = deployed.pop();
                deployer.undeploy(applicationName);
            }
        }
        catch (GlassFishException exc) {
            throw new TestContainerException(exc);
        }
View Full Code Here

TOP

Related Classes of org.glassfish.embeddable.Deployer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.