use of com.enonic.xp.web.vhost.impl.config.VirtualHostServiceImpl in project xp by enonic.
the class VirtualHostServiceImplTest method testEnabled.
@Test
public void testEnabled() {
final VirtualHostServiceImpl virtualHostService = new VirtualHostServiceImpl(Collections.singletonMap("enabled", "true"));
assertTrue(virtualHostService.isEnabled());
}
use of com.enonic.xp.web.vhost.impl.config.VirtualHostServiceImpl in project xp by enonic.
the class VirtualHostServiceImplTest method testOrder.
@Test
public void testOrder() {
final Map<String, String> configurationMap = new HashMap<>();
configurationMap.put("enabled", "true");
configurationMap.put("mapping.a.host", "localhost");
configurationMap.put("mapping.a.source", "/a");
configurationMap.put("mapping.a.target", "/other/a");
configurationMap.put("mapping.b.host", "localhost");
configurationMap.put("mapping.b.source", "/b");
configurationMap.put("mapping.b.target", "/other/b");
configurationMap.put("mapping.c.host", "~localhost");
configurationMap.put("mapping.c.source", "/a/c");
configurationMap.put("mapping.c.target", "/other/a/c");
configurationMap.put("mapping.d.host", "enonic.com");
configurationMap.put("mapping.d.source", "/d");
configurationMap.put("mapping.d.target", "/other/d");
configurationMap.put("mapping.d.order", "1");
final VirtualHostServiceImpl virtualHostService = new VirtualHostServiceImpl(configurationMap);
final List<VirtualHost> virtualHosts = virtualHostService.getVirtualHosts();
assertThat(virtualHosts.stream().map(VirtualHost::getName)).containsExactly("d", "c", "a", "b");
}
use of com.enonic.xp.web.vhost.impl.config.VirtualHostServiceImpl in project xp by enonic.
the class VirtualHostServiceImplTest method testGetVirtualHosts.
@Test
public void testGetVirtualHosts() {
final Map<String, String> configurationMap = new HashMap<>();
configurationMap.put("enabled", "true");
configurationMap.put("mapping.a.host", "localhost");
configurationMap.put("mapping.a.source", "/a");
configurationMap.put("mapping.a.target", "/other/a");
final VirtualHostServiceImpl virtualHostService = new VirtualHostServiceImpl(configurationMap);
final List<VirtualHost> virtualHosts = virtualHostService.getVirtualHosts();
assertNotNull(virtualHosts);
assertFalse(virtualHosts.isEmpty());
assertEquals("a", virtualHosts.get(0).getName());
}
use of com.enonic.xp.web.vhost.impl.config.VirtualHostServiceImpl in project xp by enonic.
the class VirtualHostServiceImplTest method testLoadedConfig_none.
@Test
public void testLoadedConfig_none() throws Exception {
final VirtualHostServiceImpl virtualHostService = new VirtualHostServiceImpl(loadConfig("none"));
assertFalse(virtualHostService.isEnabled());
assertNotNull(virtualHostService.getVirtualHosts());
final List<VirtualHost> mappings = virtualHostService.getVirtualHosts();
assertEquals(0, mappings.size());
}
use of com.enonic.xp.web.vhost.impl.config.VirtualHostServiceImpl in project xp by enonic.
the class VirtualHostServiceImplTest method testNoConfig.
@Test
public void testNoConfig() {
final VirtualHostServiceImpl virtualHostService = new VirtualHostServiceImpl(Map.of());
assertFalse(virtualHostService.isEnabled());
assertNotNull(virtualHostService.getVirtualHosts());
final List<VirtualHost> mappings = virtualHostService.getVirtualHosts();
assertEquals(0, mappings.size());
}
Aggregations