Search in sources :

Example 6 with VirtualHostServiceImpl

use of com.enonic.xp.web.vhost.impl.config.VirtualHostServiceImpl in project xp by enonic.

the class VirtualHostServiceImplTest method testLoadedConfig_disable.

@Test
public void testLoadedConfig_disable() throws Exception {
    final VirtualHostServiceImpl virtualHostService = new VirtualHostServiceImpl(loadConfig("disable"));
    assertFalse(virtualHostService.isEnabled());
}
Also used : VirtualHostServiceImpl(com.enonic.xp.web.vhost.impl.config.VirtualHostServiceImpl) Test(org.junit.jupiter.api.Test)

Example 7 with VirtualHostServiceImpl

use of com.enonic.xp.web.vhost.impl.config.VirtualHostServiceImpl 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 8 with VirtualHostServiceImpl

use of com.enonic.xp.web.vhost.impl.config.VirtualHostServiceImpl 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

VirtualHostServiceImpl (com.enonic.xp.web.vhost.impl.config.VirtualHostServiceImpl)8 Test (org.junit.jupiter.api.Test)8 VirtualHost (com.enonic.xp.web.vhost.VirtualHost)6 HashMap (java.util.HashMap)2