use of info.magnolia.module.ModuleRegistry in project magnolia-vanity-url by aperto.
the class VirtualVanityUriMappingTest method setUp.
@Before
public void setUp() throws Exception {
_uriMapping = new VirtualVanityUriMapping();
Provider moduleProvider = mock(Provider.class);
VanityUrlModule module = new VanityUrlModule();
Map<String, String> excludes = new HashMap<>();
excludes.put("pages", ".*\\..*");
module.setExcludes(excludes);
when(moduleProvider.get()).thenReturn(module);
_uriMapping.setVanityUrlModule(moduleProvider);
Provider serviceProvider = mock(Provider.class);
VanityUrlService vanityUrlService = mock(VanityUrlService.class);
when(vanityUrlService.queryForVanityUrlNode("/home", "default")).thenReturn(null);
MockNode mockNode = new MockNode("xmas");
when(vanityUrlService.queryForVanityUrlNode("/xmas", "default")).thenReturn(mockNode);
when(vanityUrlService.createRedirectUrl(mockNode)).thenReturn("redirect:/internal/page.html");
when(serviceProvider.get()).thenReturn(vanityUrlService);
_uriMapping.setVanityUrlService(serviceProvider);
Provider registryProvider = mock(Provider.class);
ModuleRegistry moduleRegistry = mock(ModuleRegistry.class);
when(registryProvider.get()).thenReturn(moduleRegistry);
_uriMapping.setModuleRegistry(registryProvider);
initWebContext();
initComponentProvider();
}
Aggregations