Search in sources :

Example 1 with SessionRouteRegistry

use of com.vaadin.flow.server.SessionRouteRegistry in project flow by vaadin.

the class RouteConfigurationTest method configurationForSessionRegistry_buildsWithCorrectRegistry.

@Test
public void configurationForSessionRegistry_buildsWithCorrectRegistry() {
    SessionRouteRegistry registry = getRegistry(session);
    registry.update(() -> {
        registry.setRoute("", MyRoute.class, Collections.emptyList());
        registry.setRoute("path", Secondary.class, Collections.emptyList());
    });
    try {
        VaadinSession.setCurrent(session);
        session.lock();
        RouteConfiguration routeConfiguration = RouteConfiguration.forSessionScope();
        Assert.assertEquals("After unlock registry should be updated for others to configure with new data", 2, routeConfiguration.getAvailableRoutes().size());
    } finally {
        session.unlock();
        CurrentInstance.clearAll();
    }
}
Also used : SessionRouteRegistry(com.vaadin.flow.server.SessionRouteRegistry) Test(org.junit.Test)

Aggregations

SessionRouteRegistry (com.vaadin.flow.server.SessionRouteRegistry)1 Test (org.junit.Test)1