Search in sources :

Example 11 with RouteConfiguration

use of com.vaadin.flow.router.RouteConfiguration in project flow by vaadin.

the class RouteRegistryInitializer method configureRoutes.

private void configureRoutes(Set<Class<? extends Component>> routes, ApplicationRouteRegistry routeRegistry) {
    RouteConfiguration routeConfiguration = RouteConfiguration.forRegistry(routeRegistry);
    routeConfiguration.update(() -> setAnnotatedRoutes(routeConfiguration, routes));
}
Also used : RouteConfiguration(com.vaadin.flow.router.RouteConfiguration)

Example 12 with RouteConfiguration

use of com.vaadin.flow.router.RouteConfiguration in project flow by vaadin.

the class BootstrapHandlerPushConfigurationTest method assertPushConfigurationForComponent.

private void assertPushConfigurationForComponent(Class<? extends Component> annotatedClazz, Class<? extends PushConnection> pushConnectionType) throws InvalidRouteConfigurationException {
    BootstrapHandler bootstrapHandler = new BootstrapHandler();
    VaadinResponse response = mock(VaadinResponse.class);
    RouteConfiguration routeConfiguration = RouteConfiguration.forRegistry(service.getRouteRegistry());
    routeConfiguration.update(() -> {
        routeConfiguration.getHandledRegistry().clean();
        routeConfiguration.setAnnotatedRoute(annotatedClazz);
    });
    final BootstrapHandler.BootstrapContext context = bootstrapHandler.createAndInitUI(UI.class, createVaadinRequest(), response, session);
    Push pushAnnotation = annotatedClazz.getAnnotation(Push.class);
    Assert.assertNotNull("Should have @Push annotated component", pushAnnotation);
    PushConfiguration pushConfiguration = context.getUI().getPushConfiguration();
    assertPushConfiguration(pushConfiguration, pushAnnotation);
    assertThat(context.getUI().getInternals().getPushConnection(), instanceOf(pushConnectionType));
}
Also used : PushConfiguration(com.vaadin.flow.component.PushConfiguration) RouteConfiguration(com.vaadin.flow.router.RouteConfiguration) Push(com.vaadin.flow.component.page.Push)

Aggregations

RouteConfiguration (com.vaadin.flow.router.RouteConfiguration)12 VaadinServletRequest (com.vaadin.flow.server.VaadinServletRequest)3 Lookup (com.vaadin.flow.di.Lookup)2 DeploymentConfiguration (com.vaadin.flow.function.DeploymentConfiguration)2 MockVaadinContext (com.vaadin.flow.server.MockVaadinContext)2 MockVaadinServletService (com.vaadin.flow.server.MockVaadinServletService)2 MockVaadinSession (com.vaadin.flow.server.MockVaadinSession)2 VaadinResponse (com.vaadin.flow.server.VaadinResponse)2 VaadinService (com.vaadin.flow.server.VaadinService)2 AlwaysLockedVaadinSession (com.vaadin.tests.util.AlwaysLockedVaadinSession)2 Test (org.junit.Test)2 Component (com.vaadin.flow.component.Component)1 PushConfiguration (com.vaadin.flow.component.PushConfiguration)1 UI (com.vaadin.flow.component.UI)1 Push (com.vaadin.flow.component.page.Push)1 AnnotationReader (com.vaadin.flow.internal.AnnotationReader)1 ParentLayout (com.vaadin.flow.router.ParentLayout)1 Route (com.vaadin.flow.router.Route)1 RouteAlias (com.vaadin.flow.router.RouteAlias)1 RoutePathProvider (com.vaadin.flow.router.RoutePathProvider)1