Skip to content

Commit

Permalink
chore: Make compatible with latest Flow (#920)
Browse files Browse the repository at this point in the history
vaadin/flow#12037 removed an unnecessary method
  • Loading branch information
Artur- authored Oct 14, 2021
1 parent c10bbd6 commit 51dabeb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,6 @@ public void failFastContextInitialized(ServletContextEvent event)
+ "run the build-frontend maven goal) or "
+ "include the vaadin-dev-server dependency");
}
if (isDevModeAlreadyStarted(event.getServletContext())) {
return;
}

Set<String> basePackages;
if (isScanOnlySet()) {
Expand Down Expand Up @@ -490,21 +487,6 @@ private boolean isScanOnlySet() {
return customScanOnly != null && !customScanOnly.isEmpty();
}

private boolean isDevModeAlreadyStarted(ServletContext servletContext) {
if (devModeHandlerManager != null) {
VaadinServletContext vaadinContext = new VaadinServletContext(
servletContext);
if (devModeHandlerManager
.isDevModeAlreadyStarted(vaadinContext)) {
if (getLogger().isDebugEnabled()) {
getLogger().debug(
"Skipped DevModeHandler initialization as it has been already initialized");
}
return true;
}
}
return false;
}
}

private class WebComponentServletContextListener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ public void onStartup_devModeNotInitialized_devModeInitialized()
throws Exception {
initDefaultMocks();

Mockito.when(
devModeHandlerManager.isDevModeAlreadyStarted(Mockito.any()))
.thenReturn(false);
Mockito.when(devModeHandlerManager.getHandlesTypes())
.thenReturn(new Class<?>[0]);

Expand All @@ -107,32 +104,6 @@ public void onStartup_devModeNotInitialized_devModeInitialized()
Mockito.any(VaadinContext.class));
}

@Test
public void onStartup_devModeAlreadyInitialized_devModeInitializationSkipped()
throws Exception {
initDefaultMocks();

Mockito.when(
devModeHandlerManager.isDevModeAlreadyStarted(Mockito.any()))
.thenReturn(true);
Mockito.when(devModeHandlerManager.getHandlesTypes())
.thenReturn(new Class<?>[0]);

Mockito.when(appConfig.enableDevServer()).thenReturn(true);

VaadinServletContextInitializer vaadinServletContextInitializer = getStubbedVaadinServletContextInitializer();

// Simulate Spring context start only
vaadinServletContextInitializer.onStartup(servletContext);

// In our case, we want to check if Dev Mode has been started within
// onStartup() call, that means DevModeInitializer.initDevModeHandler()
// should not have been called.
Mockito.verify(devModeHandlerManager, Mockito.never())
.initDevModeHandler(Mockito.any(),
Mockito.any(VaadinContext.class));
}

@Test
public void errorParameterServletContextListenerEvent_defaultRouteNotFoundView_defaultRouteNotFoundViewIsRegistered()
throws Exception {
Expand Down

0 comments on commit 51dabeb

Please sign in to comment.