Search in sources :

Example 31 with VirtualHost

use of com.enonic.xp.web.vhost.VirtualHost in project xp by enonic.

the class VirtualHostServiceImplTest method testLoadedConfig_complete.

@Test
public void testLoadedConfig_complete() throws Exception {
    final VirtualHostServiceImpl virtualHostService = new VirtualHostServiceImpl(loadConfig("complete"));
    assertTrue(virtualHostService.isEnabled());
    final List<VirtualHost> mappings = virtualHostService.getVirtualHosts();
    assertNotNull(mappings);
    assertEquals(4, mappings.size());
    assertMapping(mappings.get(0), "b", "enonic.com", "/status/b", "/full/path/status/b", IdProviderKeys.from("enonic"), null);
    assertMapping(mappings.get(1), "a", "localhost", "/status/a", "/full/path/status/a", IdProviderKeys.from(IdProviderKey.system()), null);
    assertMapping(mappings.get(2), "c", "localhost", "/status/c", "/full/path/status/c", null, null);
    assertMapping(mappings.get(3), "d", "localhost", "/status/d", "/full/path/status/d", IdProviderKeys.from("enonic.with.a.dot"), IdProviderKeys.from("enonic_disabled", "notSpecifiedProvider"));
}
Also used : VirtualHostServiceImpl(com.enonic.xp.web.vhost.impl.config.VirtualHostServiceImpl) VirtualHost(com.enonic.xp.web.vhost.VirtualHost) Test(org.junit.jupiter.api.Test)

Example 32 with VirtualHost

use of com.enonic.xp.web.vhost.VirtualHost in project xp by enonic.

the class VirtualHostServiceImplTest method testLoadedConfig_simple.

@Test
public void testLoadedConfig_simple() throws Exception {
    final VirtualHostServiceImpl virtualHostService = new VirtualHostServiceImpl(loadConfig("simple"));
    assertTrue(virtualHostService.isEnabled());
    final List<VirtualHost> mappings = virtualHostService.getVirtualHosts();
    assertNotNull(mappings);
    assertEquals(1, mappings.size());
    assertMapping(mappings.get(0), "a", "localhost", "/status", "/full/path/status", null, null);
}
Also used : VirtualHostServiceImpl(com.enonic.xp.web.vhost.impl.config.VirtualHostServiceImpl) VirtualHost(com.enonic.xp.web.vhost.VirtualHost) Test(org.junit.jupiter.api.Test)

Aggregations

VirtualHost (com.enonic.xp.web.vhost.VirtualHost)32 Test (org.junit.jupiter.api.Test)27 HttpServletRequest (javax.servlet.http.HttpServletRequest)12 VirtualHostResolver (com.enonic.xp.web.vhost.VirtualHostResolver)8 ArrayList (java.util.ArrayList)8 VirtualHostServiceImpl (com.enonic.xp.web.vhost.impl.config.VirtualHostServiceImpl)6 BaseHandlerTest (com.enonic.xp.web.handler.BaseHandlerTest)3 PortalResponse (com.enonic.xp.portal.PortalResponse)2 IdProviderKey (com.enonic.xp.security.IdProviderKey)2 WebResponse (com.enonic.xp.web.WebResponse)2 HashMap (java.util.HashMap)2 RequestDispatcher (javax.servlet.RequestDispatcher)2 PortalRequest (com.enonic.xp.portal.PortalRequest)1 IdProviderControllerExecutionParams (com.enonic.xp.portal.idprovider.IdProviderControllerExecutionParams)1 ContentResolver (com.enonic.xp.portal.impl.ContentResolver)1 AbstractControllerTest (com.enonic.xp.portal.impl.controller.AbstractControllerTest)1 AssetUrlParams (com.enonic.xp.portal.url.AssetUrlParams)1 GenerateUrlParams (com.enonic.xp.portal.url.GenerateUrlParams)1 IdentityUrlParams (com.enonic.xp.portal.url.IdentityUrlParams)1 ResourceKey (com.enonic.xp.resource.ResourceKey)1