Search in sources :

Example 1 with Connector

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

the class UndertowEngineTestCase method getObfuscatedJvmRoute.

@Test
public void getObfuscatedJvmRoute() {
    // scenario 1, just create a service with obfuscated route but same config as this.service
    final TestUndertowService service1 = new TestUndertowService(null, "default-container", this.serverName, this.hostName, this.route, true, null);
    final Server server1 = new TestServer(this.serverName, this.hostName, service1, this.host, this.listener);
    final Engine engine1 = new UndertowEngine(this.serverName, server1, service1, this.connector);
    assertNotEquals(this.route, engine1.getJvmRoute());
    // after restart, recreate all objects, is the route still the same if config is kept unchanged?
    final Host host2 = new Host(null, null, null, null, null, this.hostName, Collections.emptyList(), "ROOT.war", StatusCodes.NOT_FOUND, false);
    final HttpsListenerService listener2 = new HttpsListenerService(null, PathAddress.pathAddress(Constants.HTTPS_LISTENER, "default"), "https", OptionMap.EMPTY, null, OptionMap.EMPTY, false);
    final UndertowService service2 = new TestUndertowService(null, "default-container", this.serverName, this.hostName, this.route, true, null);
    final Server server2 = new TestServer(this.serverName, this.hostName, service2, host2, listener2);
    final Connector connector2 = mock(Connector.class);
    final Engine engine2 = new UndertowEngine(this.serverName, server2, service2, connector2);
    assertEquals(engine1.getJvmRoute(), engine2.getJvmRoute());
    // with a different route, is the obfuscated route different from previous one?
    final TestUndertowService service3 = new TestUndertowService(null, "default-container", this.serverName, this.hostName, "adifferentroute", true, null);
    final Server server3 = new TestServer(this.serverName, this.hostName, service3, this.host, this.listener);
    final Engine engine3 = new UndertowEngine(this.serverName, server3, service3, this.connector);
    assertNotEquals(engine1.getJvmRoute(), engine3.getJvmRoute());
    // just double check it is obfuscated for engine3 as well
    assertNotEquals("adifferentroute", engine3.getJvmRoute());
    // with a different server name, is the obfuscated route different from previous one?
    final TestUndertowService service4 = new TestUndertowService(null, "default-container", "another.server", this.hostName, "this.route", true, null);
    final Server server4 = new TestServer("another.server", this.hostName, service4, this.host, this.listener);
    final Engine engine4 = new UndertowEngine(this.serverName, server4, service4, this.connector);
    assertNotEquals(engine1.getJvmRoute(), engine4.getJvmRoute());
    // just double check it is obfuscated for engine4 as well
    assertNotEquals(this.route, engine4.getJvmRoute());
}
Also used : Connector(org.jboss.modcluster.container.Connector) Server(org.wildfly.extension.undertow.Server) Host(org.wildfly.extension.undertow.Host) HttpsListenerService(org.wildfly.extension.undertow.HttpsListenerService) Engine(org.jboss.modcluster.container.Engine) UndertowService(org.wildfly.extension.undertow.UndertowService) Test(org.junit.Test)

Example 2 with Connector

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

the class UndertowEngineTestCase method getConnectors.

@Test
public void getConnectors() {
    Iterator<org.jboss.modcluster.container.Connector> results = this.engine.getConnectors().iterator();
    assertTrue(results.hasNext());
    org.jboss.modcluster.container.Connector connector = results.next();
    String listenerName = "default";
    assertSame(listenerName, connector.toString());
    assertFalse(results.hasNext());
}
Also used : Connector(org.jboss.modcluster.container.Connector) Connector(org.jboss.modcluster.container.Connector) Test(org.junit.Test)

Aggregations

Connector (org.jboss.modcluster.container.Connector)2 Test (org.junit.Test)2 Engine (org.jboss.modcluster.container.Engine)1 Host (org.wildfly.extension.undertow.Host)1 HttpsListenerService (org.wildfly.extension.undertow.HttpsListenerService)1 Server (org.wildfly.extension.undertow.Server)1 UndertowService (org.wildfly.extension.undertow.UndertowService)1