Search in sources :

Example 1 with StandardHost

use of org.apache.catalina.core.StandardHost in project pinpoint by naver.

the class StandardHostValveInvokeModifierTest method setUp.

/**
     * Sets the up.
     *
     * @throws Exception the exception
     */
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    initMockRequest();
    // StandardHost's default constructor sets StandardHostValve as the first item in the pipeline.
    host = new StandardHost();
}
Also used : StandardHost(org.apache.catalina.core.StandardHost) Before(org.junit.Before)

Example 2 with StandardHost

use of org.apache.catalina.core.StandardHost in project pinpoint by naver.

the class StandardHostValveInvokeModifierTest method setUp.

@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    initMockRequest();
    // StandardHost's default constructor sets StandardHostValve as the first item in the pipeline.
    host = new StandardHost();
}
Also used : StandardHost(org.apache.catalina.core.StandardHost) Before(org.junit.Before)

Example 3 with StandardHost

use of org.apache.catalina.core.StandardHost in project micrometer by micrometer-metrics.

the class TomcatMetricsTest method mbeansAvailableAfterBinder.

@Test
void mbeansAvailableAfterBinder() throws LifecycleException, InterruptedException {
    TomcatMetrics.monitor(registry, null);
    CountDownLatch latch = new CountDownLatch(1);
    registry.config().onMeterAdded(m -> {
        if (m.getId().getName().equals("tomcat.global.received"))
            latch.countDown();
    });
    Tomcat server = new Tomcat();
    try {
        StandardHost host = new StandardHost();
        host.setName("localhost");
        server.setHost(host);
        server.setPort(61000);
        server.start();
        assertThat(latch.await(10, TimeUnit.SECONDS)).isTrue();
        registry.find("tomcat.global.received").functionCounter();
    } finally {
        server.stop();
        server.destroy();
    }
}
Also used : Tomcat(org.apache.catalina.startup.Tomcat) StandardHost(org.apache.catalina.core.StandardHost) CountDownLatch(java.util.concurrent.CountDownLatch) Test(org.junit.jupiter.api.Test)

Example 4 with StandardHost

use of org.apache.catalina.core.StandardHost in project micrometer by micrometer-metrics.

the class TomcatMetricsTest method mbeansAvailableBeforeBinder.

@Test
void mbeansAvailableBeforeBinder() throws LifecycleException {
    Tomcat server = new Tomcat();
    try {
        StandardHost host = new StandardHost();
        host.setName("localhost");
        server.setHost(host);
        server.setPort(61000);
        server.start();
        TomcatMetrics.monitor(registry, null);
        registry.find("tomcat.global.received").functionCounter();
    } finally {
        server.stop();
        server.destroy();
    }
}
Also used : Tomcat(org.apache.catalina.startup.Tomcat) StandardHost(org.apache.catalina.core.StandardHost) Test(org.junit.jupiter.api.Test)

Example 5 with StandardHost

use of org.apache.catalina.core.StandardHost in project ofbiz-framework by apache.

the class CatalinaContainer method prepareHost.

private Host prepareHost(Tomcat tomcat, List<String> virtualHosts) {
    Host host;
    if (UtilValidate.isEmpty(virtualHosts)) {
        host = tomcat.getHost();
    } else {
        host = prepareVirtualHost(tomcat, virtualHosts);
    }
    host.setAppBase(System.getProperty("ofbiz.home") + "/framework/catalina/hosts");
    host.setDeployOnStartup(false);
    host.setBackgroundProcessorDelay(5);
    host.setAutoDeploy(false);
    ((StandardHost) host).setWorkDir(new File(System.getProperty(Globals.CATALINA_HOME_PROP), "work" + File.separator + host.getName()).getAbsolutePath());
    return host;
}
Also used : StandardHost(org.apache.catalina.core.StandardHost) Host(org.apache.catalina.Host) StandardHost(org.apache.catalina.core.StandardHost) File(java.io.File)

Aggregations

StandardHost (org.apache.catalina.core.StandardHost)90 File (java.io.File)48 Context (org.apache.catalina.Context)38 StandardContext (org.apache.catalina.core.StandardContext)36 Host (org.apache.catalina.Host)29 Test (org.junit.Test)26 Tomcat (org.apache.catalina.startup.Tomcat)16 Container (org.apache.catalina.Container)12 StandardEngine (org.apache.catalina.core.StandardEngine)12 TomcatBaseTest (org.apache.catalina.startup.TomcatBaseTest)12 IOException (java.io.IOException)10 URL (java.net.URL)8 Service (org.apache.catalina.Service)8 HostConfig (org.apache.catalina.startup.HostConfig)8 InitialContext (javax.naming.InitialContext)7 Engine (org.apache.catalina.Engine)7 InputStream (java.io.InputStream)6 ObjectName (javax.management.ObjectName)6 ReplicatedContext (org.apache.catalina.ha.context.ReplicatedContext)6 ArrayList (java.util.ArrayList)5