Search in sources :

Example 1 with Context

use of org.jboss.modcluster.container.Context in project wildfly by wildfly.

the class UndertowHostTestCase method findContext.

@Test
public void findContext() {
    Deployment deployment = mock(Deployment.class);
    DeploymentInfo info = new DeploymentInfo();
    String expectedPath = "";
    info.setContextPath(expectedPath);
    HttpHandler handler = mock(HttpHandler.class);
    when(deployment.getDeploymentInfo()).thenReturn(info);
    this.undertowHost.registerDeployment(deployment, handler);
    Context result = this.host.findContext(expectedPath);
    assertSame(this.host, result.getHost());
    assertSame(expectedPath, result.getPath());
    result = this.host.findContext("unknown");
    assertNull(result);
}
Also used : Context(org.jboss.modcluster.container.Context) HttpHandler(io.undertow.server.HttpHandler) Deployment(io.undertow.servlet.api.Deployment) DeploymentInfo(io.undertow.servlet.api.DeploymentInfo) Test(org.junit.Test)

Example 2 with Context

use of org.jboss.modcluster.container.Context in project wildfly by wildfly.

the class UndertowHostTestCase method getContexts.

@Test
public void getContexts() {
    Deployment deployment = mock(Deployment.class);
    DeploymentInfo info = new DeploymentInfo();
    String expectedPath = "";
    info.setContextPath(expectedPath);
    HttpHandler handler = mock(HttpHandler.class);
    when(deployment.getDeploymentInfo()).thenReturn(info);
    this.undertowHost.registerDeployment(deployment, handler);
    Iterator<Context> result = this.host.getContexts().iterator();
    assertTrue(result.hasNext());
    Context context = result.next();
    assertSame(this.host, context.getHost());
    assertSame(expectedPath, context.getPath());
    assertFalse(result.hasNext());
}
Also used : Context(org.jboss.modcluster.container.Context) HttpHandler(io.undertow.server.HttpHandler) Deployment(io.undertow.servlet.api.Deployment) DeploymentInfo(io.undertow.servlet.api.DeploymentInfo) Test(org.junit.Test)

Example 3 with Context

use of org.jboss.modcluster.container.Context in project wildfly by wildfly.

the class UndertowEventHandlerAdapter method onDeploymentStart.

@Override
public synchronized void onDeploymentStart(Deployment deployment, Host host) {
    Context context = this.createContext(deployment, host);
    this.eventHandler.getValue().add(context);
    // TODO break into onDeploymentAdd once implemented in Undertow
    this.eventHandler.getValue().start(context);
    contexts.add(context);
}
Also used : StopContext(org.jboss.msc.service.StopContext) Context(org.jboss.modcluster.container.Context) StartContext(org.jboss.msc.service.StartContext)

Example 4 with Context

use of org.jboss.modcluster.container.Context in project wildfly by wildfly.

the class UndertowEventHandlerAdapter method onDeploymentStop.

@Override
public synchronized void onDeploymentStop(String deployment, Host host) {
    Context context = this.createContext(deployment, host);
    this.eventHandler.getValue().stop(context);
    // TODO break into onDeploymentRemove once implemented in Undertow
    this.eventHandler.getValue().remove(context);
    contexts.remove(context);
}
Also used : StopContext(org.jboss.msc.service.StopContext) Context(org.jboss.modcluster.container.Context) StartContext(org.jboss.msc.service.StartContext)

Example 5 with Context

use of org.jboss.modcluster.container.Context in project wildfly by wildfly.

the class UndertowEventHandlerAdapter method onDeploymentStart.

@Override
public synchronized void onDeploymentStart(String deployment, Host host) {
    Context context = this.createContext(deployment, host);
    this.eventHandler.getValue().add(context);
    // TODO break into onDeploymentAdd once implemented in Undertow
    this.eventHandler.getValue().start(context);
    contexts.add(context);
}
Also used : StopContext(org.jboss.msc.service.StopContext) Context(org.jboss.modcluster.container.Context) StartContext(org.jboss.msc.service.StartContext)

Aggregations

Context (org.jboss.modcluster.container.Context)6 StartContext (org.jboss.msc.service.StartContext)4 StopContext (org.jboss.msc.service.StopContext)4 HttpHandler (io.undertow.server.HttpHandler)2 Deployment (io.undertow.servlet.api.Deployment)2 DeploymentInfo (io.undertow.servlet.api.DeploymentInfo)2 Test (org.junit.Test)2