diff --git a/flow-plugins/flow-plugin-base/src/test/java/com/vaadin/flow/plugin/base/BuildFrontendUtilTest.java b/flow-plugins/flow-plugin-base/src/test/java/com/vaadin/flow/plugin/base/BuildFrontendUtilTest.java index 2f0858165ac..8e1e2166d56 100644 --- a/flow-plugins/flow-plugin-base/src/test/java/com/vaadin/flow/plugin/base/BuildFrontendUtilTest.java +++ b/flow-plugins/flow-plugin-base/src/test/java/com/vaadin/flow/plugin/base/BuildFrontendUtilTest.java @@ -35,7 +35,6 @@ import com.vaadin.experimental.FeatureFlags; import com.vaadin.flow.di.Lookup; -import com.vaadin.flow.internal.hilla.EndpointRequestUtil; import com.vaadin.flow.server.Constants; import com.vaadin.flow.server.ExecutionFailedException; import com.vaadin.flow.server.InitParameters; @@ -152,10 +151,10 @@ public void should_useHillaEngine_withNodeUpdater() .when(endpointGeneratorTaskFactory) .createTaskGenerateEndpoint(Mockito.any()); - try (MockedStatic util = Mockito.mockStatic( - EndpointRequestUtil.class, Mockito.CALLS_REAL_METHODS)) { - util.when(() -> EndpointRequestUtil.isHillaAvailable(Mockito.any())) - .thenReturn(true); + try (MockedStatic util = Mockito + .mockStatic(FrontendUtils.class, Mockito.CALLS_REAL_METHODS)) { + util.when(() -> FrontendUtils.isHillaUsed(Mockito.any(), + Mockito.any())).thenReturn(true); BuildFrontendUtil.runNodeUpdater(adapter); } diff --git a/flow-server/src/main/java/com/vaadin/flow/server/frontend/NodeTasks.java b/flow-server/src/main/java/com/vaadin/flow/server/frontend/NodeTasks.java index fc23962ddca..3c9e38a2522 100644 --- a/flow-server/src/main/java/com/vaadin/flow/server/frontend/NodeTasks.java +++ b/flow-server/src/main/java/com/vaadin/flow/server/frontend/NodeTasks.java @@ -37,7 +37,6 @@ import com.vaadin.flow.di.Lookup; import com.vaadin.flow.internal.UsageStatistics; -import com.vaadin.flow.internal.hilla.EndpointRequestUtil; import com.vaadin.flow.server.Constants; import com.vaadin.flow.server.ExecutionFailedException; import com.vaadin.flow.server.Mode; @@ -316,7 +315,8 @@ private void addGenerateServiceWorkerTask(Options options, } private void addEndpointServicesTasks(Options options) { - if (!EndpointRequestUtil.isHillaAvailable(options.getClassFinder())) { + if (!FrontendUtils.isHillaUsed(options.getFrontendDirectory(), + options.getClassFinder())) { return; } Lookup lookup = options.getLookup(); diff --git a/flow-server/src/test/java/com/vaadin/flow/server/frontend/NodeTasksHillaTest.java b/flow-server/src/test/java/com/vaadin/flow/server/frontend/NodeTasksHillaTest.java index 65dfbd75839..49ffe3d0766 100644 --- a/flow-server/src/test/java/com/vaadin/flow/server/frontend/NodeTasksHillaTest.java +++ b/flow-server/src/test/java/com/vaadin/flow/server/frontend/NodeTasksHillaTest.java @@ -31,7 +31,6 @@ import org.mockito.junit.MockitoRule; import com.vaadin.flow.di.Lookup; -import com.vaadin.flow.internal.hilla.EndpointRequestUtil; import com.vaadin.flow.server.ExecutionFailedException; import com.vaadin.flow.server.frontend.scanner.ClassFinder; import com.vaadin.flow.server.frontend.scanner.ClassFinder.DefaultClassFinder; @@ -118,10 +117,10 @@ public void should_useHillaEngine_whenEnabled() Mockito.doReturn(endpointGeneratorTaskFactory).when(options.getLookup()) .lookup(EndpointGeneratorTaskFactory.class); - try (MockedStatic util = Mockito.mockStatic( - EndpointRequestUtil.class, Mockito.CALLS_REAL_METHODS)) { - util.when(() -> EndpointRequestUtil.isHillaAvailable(Mockito.any())) - .thenReturn(true); + try (MockedStatic util = Mockito + .mockStatic(FrontendUtils.class, Mockito.CALLS_REAL_METHODS)) { + util.when(() -> FrontendUtils.isHillaUsed(Mockito.any(), + Mockito.any())).thenReturn(true); new NodeTasks(options).execute(); } diff --git a/vaadin-dev-server/src/test/java/com/vaadin/base/devserver/DevModeEndpointTest.java b/vaadin-dev-server/src/test/java/com/vaadin/base/devserver/DevModeEndpointTest.java index 0ec719b9931..8f5ba6fa5b9 100644 --- a/vaadin-dev-server/src/test/java/com/vaadin/base/devserver/DevModeEndpointTest.java +++ b/vaadin-dev-server/src/test/java/com/vaadin/base/devserver/DevModeEndpointTest.java @@ -22,7 +22,6 @@ import com.vaadin.base.devserver.startup.DevModeStartupListener; import com.vaadin.flow.di.ResourceProvider; import com.vaadin.flow.internal.DevModeHandlerManager; -import com.vaadin.flow.internal.hilla.EndpointRequestUtil; import com.vaadin.flow.server.VaadinServlet; import com.vaadin.flow.server.VaadinServletContext; import com.vaadin.flow.server.frontend.EndpointGeneratorTaskFactory; @@ -108,10 +107,10 @@ public void should_generateOpenApi() throws Exception { .toFile(); Assert.assertFalse(generatedOpenApiJson.exists()); - try (MockedStatic util = Mockito.mockStatic( - EndpointRequestUtil.class, Mockito.CALLS_REAL_METHODS)) { - util.when(() -> EndpointRequestUtil.isHillaAvailable(Mockito.any())) - .thenReturn(true); + try (MockedStatic util = Mockito + .mockStatic(FrontendUtils.class, Mockito.CALLS_REAL_METHODS)) { + util.when(() -> FrontendUtils.isHillaUsed(Mockito.any(), + Mockito.any())).thenReturn(true); devModeStartupListener.onStartup(classes, servletContext); handler = getDevModeHandler(); waitForDevServer(); @@ -140,10 +139,10 @@ public void should_generateTs_files() throws Exception { assertFalse(ts1.exists()); assertFalse(ts2.exists()); - try (MockedStatic util = Mockito.mockStatic( - EndpointRequestUtil.class, Mockito.CALLS_REAL_METHODS)) { - util.when(() -> EndpointRequestUtil.isHillaAvailable(Mockito.any())) - .thenReturn(true); + try (MockedStatic util = Mockito + .mockStatic(FrontendUtils.class, Mockito.CALLS_REAL_METHODS)) { + util.when(() -> FrontendUtils.isHillaUsed(Mockito.any(), + Mockito.any())).thenReturn(true); devModeStartupListener.onStartup(classes, servletContext); handler = getDevModeHandler(); waitForDevServer(); diff --git a/vaadin-dev-server/src/test/java/com/vaadin/base/devserver/startup/DevModeInitializerTest.java b/vaadin-dev-server/src/test/java/com/vaadin/base/devserver/startup/DevModeInitializerTest.java index ea8a2cbbbf0..b142e5d8a77 100644 --- a/vaadin-dev-server/src/test/java/com/vaadin/base/devserver/startup/DevModeInitializerTest.java +++ b/vaadin-dev-server/src/test/java/com/vaadin/base/devserver/startup/DevModeInitializerTest.java @@ -36,7 +36,6 @@ import com.vaadin.flow.component.dependency.JsModule; import com.vaadin.flow.component.page.AppShellConfigurator; import com.vaadin.flow.di.Lookup; -import com.vaadin.flow.internal.hilla.EndpointRequestUtil; import com.vaadin.flow.router.Route; import com.vaadin.flow.server.InitParameters; import com.vaadin.flow.server.LoadDependenciesOnStartup; @@ -353,10 +352,10 @@ public void should_generateOpenApi_when_EndpointPresents() javaSourceFolder.getRoot().getAbsolutePath()); Assert.assertFalse(generatedOpenApiJson.exists()); - try (MockedStatic util = Mockito.mockStatic( - EndpointRequestUtil.class, Mockito.CALLS_REAL_METHODS)) { - util.when(() -> EndpointRequestUtil - .isHillaAvailable(Mockito.any())).thenReturn(true); + try (MockedStatic util = Mockito.mockStatic( + FrontendUtils.class, Mockito.CALLS_REAL_METHODS)) { + util.when(() -> FrontendUtils.isHillaUsed(Mockito.any(), + Mockito.any())).thenReturn(true); devModeStartupListener.onStartup(classes, servletContext); handler = getDevModeHandler(); waitForDevServer(); @@ -421,10 +420,10 @@ public void should_generateTs_files() throws Exception { System.setProperty("vaadin." + CONNECT_JAVA_SOURCE_FOLDER_TOKEN, javaSourceFolder.getRoot().getAbsolutePath()); - try (MockedStatic util = Mockito.mockStatic( - EndpointRequestUtil.class, Mockito.CALLS_REAL_METHODS)) { - util.when(() -> EndpointRequestUtil - .isHillaAvailable(Mockito.any())).thenReturn(true); + try (MockedStatic util = Mockito.mockStatic( + FrontendUtils.class, Mockito.CALLS_REAL_METHODS)) { + util.when(() -> FrontendUtils.isHillaUsed(Mockito.any(), + Mockito.any())).thenReturn(true); devModeStartupListener.onStartup(classes, servletContext); handler = getDevModeHandler(); waitForDevServer();