-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix queued message send timing.
- Loading branch information
Showing
10 changed files
with
473 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>flow-tests</artifactId> | ||
<groupId>com.vaadin</groupId> | ||
<version>24.7-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>flow-client-queue-test</artifactId> | ||
<name>Test Flow client queue</name> | ||
|
||
<packaging>war</packaging> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.vaadin</groupId> | ||
<artifactId>flow-test-resources</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.vaadin</groupId> | ||
<artifactId>vaadin-dev-server</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.vaadin</groupId> | ||
<artifactId>flow-html-components-testbench</artifactId> | ||
<version>${project.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<!-- Auto run clean to remove previous mode compilation --> | ||
<plugin> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>auto-clean</id> | ||
<phase>initialize</phase> | ||
<goals> | ||
<goal>clean</goal> | ||
</goals> | ||
<!-- <configuration>--> | ||
<!-- <filesets>--> | ||
<!-- <fileset>--> | ||
<!-- <directory>${project.basedir}</directory>--> | ||
<!-- <includes>--> | ||
<!-- <include>package*.json</include>--> | ||
<!-- <include>types.d.ts</include>--> | ||
<!-- <include>tsconfig.json</include>--> | ||
<!-- <include>pnpm-lock.yaml</include>--> | ||
<!-- <include>bun.lockb</include>--> | ||
<!-- <include>node_modules/**</include>--> | ||
<!-- </includes>--> | ||
<!-- </fileset>--> | ||
<!-- </filesets>--> | ||
<!-- </configuration>--> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-enforcer-plugin</artifactId> | ||
<configuration> | ||
<skip>true</skip> | ||
</configuration> | ||
</plugin> | ||
<!-- Run flow plugin to build frontend --> | ||
<plugin> | ||
<groupId>com.vaadin</groupId> | ||
<artifactId>flow-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>prepare-frontend</goal> | ||
<!-- <goal>build-frontend</goal>--> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<frontendHotdeploy>true</frontendHotdeploy> | ||
</configuration> | ||
</plugin> | ||
<!-- Run jetty before integration tests, and stop after --> | ||
<plugin> | ||
<groupId>org.eclipse.jetty.ee10</groupId> | ||
<artifactId>jetty-ee10-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
107 changes: 107 additions & 0 deletions
107
flow-tests/test-client-queue/src/main/java/com/vaadin/flow/misc/ui/CustomService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
/* | ||
* Copyright 2000-2025 Vaadin Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
package com.vaadin.flow.misc.ui; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import com.vaadin.flow.function.DeploymentConfiguration; | ||
import com.vaadin.flow.i18n.TranslationFileRequestHandler; | ||
import com.vaadin.flow.internal.DevModeHandler; | ||
import com.vaadin.flow.internal.DevModeHandlerManager; | ||
import com.vaadin.flow.server.Mode; | ||
import com.vaadin.flow.server.RequestHandler; | ||
import com.vaadin.flow.server.ServiceException; | ||
import com.vaadin.flow.server.UnsupportedBrowserHandler; | ||
import com.vaadin.flow.server.VaadinServlet; | ||
import com.vaadin.flow.server.VaadinServletService; | ||
import com.vaadin.flow.server.communication.FaviconHandler; | ||
import com.vaadin.flow.server.communication.HeartbeatHandler; | ||
import com.vaadin.flow.server.communication.IndexHtmlRequestHandler; | ||
import com.vaadin.flow.server.communication.JavaScriptBootstrapHandler; | ||
import com.vaadin.flow.server.communication.PushRequestHandler; | ||
import com.vaadin.flow.server.communication.PwaHandler; | ||
import com.vaadin.flow.server.communication.SessionRequestHandler; | ||
import com.vaadin.flow.server.communication.StreamRequestHandler; | ||
import com.vaadin.flow.server.communication.WebComponentBootstrapHandler; | ||
import com.vaadin.flow.server.communication.WebComponentProvider; | ||
|
||
public class CustomService extends VaadinServletService { | ||
|
||
public CustomService(VaadinServlet servlet, | ||
DeploymentConfiguration deploymentConfiguration) { | ||
super(servlet, deploymentConfiguration); | ||
} | ||
|
||
@Override | ||
protected List<RequestHandler> createRequestHandlers() | ||
throws ServiceException { | ||
List<RequestHandler> handlers = new ArrayList<>(); | ||
handlers.add(new FaviconHandler()); | ||
handlers.add(new JavaScriptBootstrapHandler()); | ||
handlers.add(new SessionRequestHandler()); | ||
handlers.add(new HeartbeatHandler()); | ||
|
||
handlers.add(new CustomUidlRequestHandler()); | ||
|
||
handlers.add(new UnsupportedBrowserHandler()); | ||
|
||
handlers.add(new StreamRequestHandler()); | ||
|
||
handlers.add(new PwaHandler(() -> getPwaRegistry())); | ||
|
||
handlers.add(new TranslationFileRequestHandler( | ||
getInstantiator().getI18NProvider())); | ||
|
||
handlers.add(new WebComponentBootstrapHandler()); | ||
handlers.add(new WebComponentProvider()); | ||
|
||
Mode mode = getDeploymentConfiguration().getMode(); | ||
if (mode == Mode.DEVELOPMENT_FRONTEND_LIVERELOAD | ||
|| mode == Mode.DEVELOPMENT_BUNDLE) { | ||
Optional<DevModeHandler> handlerManager = DevModeHandlerManager | ||
.getDevModeHandler(this); | ||
if (handlerManager.isPresent()) { | ||
DevModeHandler devModeHandler = handlerManager.get(); | ||
// WebComponentProvider handler should run before DevModeHandler | ||
// to avoid responding with html contents when dev bundle is | ||
// not ready (e.g. dev-mode-not-ready.html) | ||
handlers.stream().filter(WebComponentProvider.class::isInstance) | ||
.findFirst().map(handlers::indexOf) | ||
.ifPresentOrElse(idx -> { | ||
handlers.add(idx, devModeHandler); | ||
}, () -> handlers.add(devModeHandler)); | ||
} | ||
} | ||
|
||
// PushRequestHandler should run before DevModeHandler to avoid | ||
// responding with html contents when dev mode server is not ready | ||
// (e.g. dev-mode-not-ready.html) | ||
if (isAtmosphereAvailable()) { | ||
try { | ||
handlers.add(new PushRequestHandler(this)); | ||
} catch (ServiceException e) { | ||
// Atmosphere init failed. Push won't work but we don't throw a | ||
// service exception as we don't want to prevent non-push | ||
// applications from working | ||
} | ||
} | ||
|
||
handlers.add(0, new IndexHtmlRequestHandler()); | ||
return handlers; | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
flow-tests/test-client-queue/src/main/java/com/vaadin/flow/misc/ui/CustomServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright 2000-2024 Vaadin Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
package com.vaadin.flow.misc.ui; | ||
|
||
import jakarta.servlet.annotation.WebServlet; | ||
|
||
import com.vaadin.flow.function.DeploymentConfiguration; | ||
import com.vaadin.flow.server.ServiceException; | ||
import com.vaadin.flow.server.VaadinServlet; | ||
import com.vaadin.flow.server.VaadinServletService; | ||
|
||
@WebServlet(urlPatterns = "/*", asyncSupported = true) | ||
public class CustomServlet extends VaadinServlet { | ||
|
||
@Override | ||
protected VaadinServletService createServletService( | ||
DeploymentConfiguration deploymentConfiguration) | ||
throws ServiceException { | ||
CustomService service = new CustomService(this, | ||
deploymentConfiguration); | ||
service.init(); | ||
return service; | ||
} | ||
} |
Oops, something went wrong.