Search in sources :

Example 6 with HTMLActionReporter

use of com.sun.enterprise.admin.report.HTMLActionReporter in project Payara by payara.

the class ApplicationLoaderService method stopApplication.

private void stopApplication(Application app, ApplicationInfo appInfo) {
    final ActionReport dummy = new HTMLActionReporter();
    if (appInfo != null) {
        UndeployCommandParameters parameters = new UndeployCommandParameters(appInfo.getName());
        parameters.origin = UndeployCommandParameters.Origin.unload;
        parameters.command = UndeployCommandParameters.Command.shutdown_server;
        try {
            deployment.disable(parameters, app, appInfo, dummy, logger);
        } catch (Exception e) {
            logger.log(Level.SEVERE, KernelLoggerInfo.loadingApplicationErrorDisable, e);
        }
        unloadApplicationForTenants(app, dummy);
        appRegistry.remove(appInfo.getName());
    }
}
Also used : UndeployCommandParameters(org.glassfish.api.deployment.UndeployCommandParameters) HTMLActionReporter(com.sun.enterprise.admin.report.HTMLActionReporter) ActionReport(org.glassfish.api.ActionReport) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException)

Example 7 with HTMLActionReporter

use of com.sun.enterprise.admin.report.HTMLActionReporter in project Payara by payara.

the class ConfigAttributeSetTest method simpleAttributeSetTest.

@Test
public void simpleAttributeSetTest() {
    CommandRunnerImpl runner = habitat.getService(CommandRunnerImpl.class);
    assertNotNull(runner);
    // let's find our target
    NetworkListener listener = null;
    NetworkListeners service = habitat.getService(NetworkListeners.class);
    for (NetworkListener l : service.getNetworkListener()) {
        if ("http-listener-1".equals(l.getName())) {
            listener = l;
            break;
        }
    }
    assertNotNull(listener);
    // Let's register a listener
    ObservableBean bean = (ObservableBean) ConfigSupport.getImpl(listener);
    bean.addListener(this);
    // parameters to the command
    ParameterMap parameters = new ParameterMap();
    parameters.set("value", "8090");
    parameters.set("DEFAULT", "configs.config.server-config.http-service.http-listener.http-listener-1.port");
    // execute the set command.
    runner.getCommandInvocation("set", new HTMLActionReporter(), adminSubject()).parameters(parameters).execute();
    // check the result.
    String port = listener.getPort();
    assertEquals(port, "8090");
    // ensure events are delivered.
    habitat.<Transactions>getService(Transactions.class).waitForDrain();
    // finally
    bean.removeListener(this);
    // check we recevied the event
    assertNotNull(event);
    assertEquals("8080", event.getOldValue());
    assertEquals("8090", event.getNewValue());
    assertEquals("port", event.getPropertyName());
}
Also used : Transactions(org.jvnet.hk2.config.Transactions) HTMLActionReporter(com.sun.enterprise.admin.report.HTMLActionReporter) NetworkListeners(org.glassfish.grizzly.config.dom.NetworkListeners) ObservableBean(org.jvnet.hk2.config.ObservableBean) NetworkListener(org.glassfish.grizzly.config.dom.NetworkListener) Test(org.junit.Test) ConfigApiTest(org.glassfish.tests.utils.ConfigApiTest)

Aggregations

HTMLActionReporter (com.sun.enterprise.admin.report.HTMLActionReporter)7 ActionReport (org.glassfish.api.ActionReport)6 IOException (java.io.IOException)4 File (java.io.File)3 URISyntaxException (java.net.URISyntaxException)3 DeployCommandParameters (org.glassfish.api.deployment.DeployCommandParameters)3 Application (com.sun.enterprise.config.serverbeans.Application)2 ApplicationRef (com.sun.enterprise.config.serverbeans.ApplicationRef)2 UndeployCommandParameters (org.glassfish.api.deployment.UndeployCommandParameters)2 ArchiveHandler (org.glassfish.api.deployment.archive.ArchiveHandler)2 ReadableArchive (org.glassfish.api.deployment.archive.ReadableArchive)2 ApplicationInfo (org.glassfish.internal.data.ApplicationInfo)2 FileArchive (com.sun.enterprise.deploy.shared.FileArchive)1 InputJarArchive (com.sun.enterprise.deployment.deploy.shared.InputJarArchive)1 URI (java.net.URI)1 Logger (java.util.logging.Logger)1 Event (org.glassfish.api.event.EventListener.Event)1 ApplicationConfigInfo (org.glassfish.deployment.common.ApplicationConfigInfo)1 DeploymentContextImpl (org.glassfish.deployment.common.DeploymentContextImpl)1 DeploymentLifecycleStatsProvider (org.glassfish.deployment.monitor.DeploymentLifecycleStatsProvider)1