diff options
Diffstat (limited to 'subprojects/language-web')
40 files changed, 322 insertions, 215 deletions
diff --git a/subprojects/language-web/build.gradle b/subprojects/language-web/build.gradle deleted file mode 100644 index 8d277a5b..00000000 --- a/subprojects/language-web/build.gradle +++ /dev/null | |||
@@ -1,87 +0,0 @@ | |||
1 | plugins { | ||
2 | id 'refinery-java-application' | ||
3 | id 'refinery-xtext-conventions' | ||
4 | } | ||
5 | |||
6 | configurations { | ||
7 | webapp { | ||
8 | canBeConsumed = false | ||
9 | canBeResolved = true | ||
10 | } | ||
11 | |||
12 | all { | ||
13 | // Use log4j-over-slf4j instead of log4j 1.x | ||
14 | exclude group: 'log4j', module: 'log4j' | ||
15 | } | ||
16 | } | ||
17 | |||
18 | dependencies { | ||
19 | implementation project(':refinery-language') | ||
20 | implementation project(':refinery-language-ide') | ||
21 | implementation libs.jetty.server | ||
22 | implementation libs.jetty.servlet | ||
23 | implementation libs.jetty.websocket.server | ||
24 | implementation libs.slf4j.api | ||
25 | implementation libs.slf4j.simple | ||
26 | implementation libs.slf4j.log4j | ||
27 | implementation libs.xtext.web | ||
28 | webapp project(path: ':refinery-frontend', configuration: 'productionAssets') | ||
29 | testImplementation testFixtures(project(':refinery-language')) | ||
30 | testImplementation libs.jetty.websocket.client | ||
31 | } | ||
32 | |||
33 | def generateXtextLanguage = project(':refinery-language').tasks.named('generateXtextLanguage') | ||
34 | |||
35 | for (taskName in ['compileJava', 'processResources']) { | ||
36 | tasks.named(taskName) { | ||
37 | dependsOn generateXtextLanguage | ||
38 | } | ||
39 | } | ||
40 | |||
41 | mainClassName = 'tools.refinery.language.web.ServerLauncher' | ||
42 | |||
43 | // Enable JDK 19 preview features for virtual thread support. | ||
44 | application { | ||
45 | applicationDefaultJvmArgs += '--enable-preview' | ||
46 | } | ||
47 | tasks.withType(JavaCompile) { | ||
48 | options.release = 19 | ||
49 | options.compilerArgs += '--enable-preview' | ||
50 | } | ||
51 | tasks.withType(Test) { | ||
52 | jvmArgs += '--enable-preview' | ||
53 | } | ||
54 | |||
55 | tasks.named('jar') { | ||
56 | dependsOn project.configurations.webapp | ||
57 | from(project.configurations.webapp) { | ||
58 | into 'webapp' | ||
59 | } | ||
60 | } | ||
61 | |||
62 | tasks.named('shadowJar') { | ||
63 | dependsOn project.configurations.webapp | ||
64 | from(project.sourceSets.main.output) | ||
65 | configurations = [project.configurations.runtimeClasspath] | ||
66 | exclude('META-INF/INDEX.LIST', 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA','schema/*', | ||
67 | '.options', '.api_description', '*.profile', 'about.*', 'about_*.html', 'about_files/*', | ||
68 | 'plugin.xml', 'systembundle.properties', 'profile.list', 'META-INF/resources/xtext/**') | ||
69 | append('plugin.properties') | ||
70 | from(project.configurations.webapp) { | ||
71 | into 'webapp' | ||
72 | } | ||
73 | } | ||
74 | |||
75 | tasks.register('serveBackend', JavaExec) { | ||
76 | dependsOn project.configurations.webapp | ||
77 | dependsOn sourceSets.main.runtimeClasspath | ||
78 | classpath = sourceSets.main.runtimeClasspath | ||
79 | mainClass = mainClassName | ||
80 | // Enable JDK 19 preview features for virtual thread support. | ||
81 | jvmArgs += '--enable-preview' | ||
82 | standardInput = System.in | ||
83 | def baseResource = project.configurations.webapp.incoming.artifacts.artifactFiles.first() | ||
84 | environment BASE_RESOURCE: baseResource | ||
85 | group = 'run' | ||
86 | description = 'Start a Jetty web server serving the Xtex API and assets.' | ||
87 | } | ||
diff --git a/subprojects/language-web/build.gradle.kts b/subprojects/language-web/build.gradle.kts new file mode 100644 index 00000000..562a1bd9 --- /dev/null +++ b/subprojects/language-web/build.gradle.kts | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | |||
7 | plugins { | ||
8 | id("tools.refinery.gradle.java-application") | ||
9 | id("tools.refinery.gradle.xtext-generated") | ||
10 | } | ||
11 | |||
12 | val webapp: Configuration by configurations.creating { | ||
13 | isCanBeConsumed = false | ||
14 | isCanBeResolved = true | ||
15 | } | ||
16 | |||
17 | dependencies { | ||
18 | implementation(project(":refinery-language")) | ||
19 | implementation(project(":refinery-language-ide")) | ||
20 | implementation(libs.jetty.server) | ||
21 | implementation(libs.jetty.servlet) | ||
22 | implementation(libs.jetty.websocket.api) | ||
23 | implementation(libs.jetty.websocket.server) | ||
24 | implementation(libs.slf4j.api) | ||
25 | implementation(libs.xtext.web) | ||
26 | xtextGenerated(project(":refinery-language", "generatedWebSources")) | ||
27 | webapp(project(":refinery-frontend", "productionAssets")) | ||
28 | testImplementation(testFixtures(project(":refinery-language"))) | ||
29 | testImplementation(libs.jetty.websocket.client) | ||
30 | } | ||
31 | |||
32 | application { | ||
33 | mainClass.set("tools.refinery.language.web.ServerLauncher") | ||
34 | } | ||
35 | |||
36 | tasks { | ||
37 | jar { | ||
38 | dependsOn(webapp) | ||
39 | from(webapp) { | ||
40 | into("webapp") | ||
41 | } | ||
42 | } | ||
43 | |||
44 | shadowJar { | ||
45 | dependsOn(webapp) | ||
46 | from(project.sourceSets.main.map { it.output }) | ||
47 | exclude("META-INF/INDEX.LIST", "META-INF/*.SF", "META-INF/*.DSA", "META-INF/*.RSA", "schema/*", | ||
48 | ".options", ".api_description", "*.profile", "about.*", "about_*.html", "about_files/*", | ||
49 | "plugin.xml", "systembundle.properties", "profile.list", "META-INF/resources/xtext/**") | ||
50 | append("plugin.properties") | ||
51 | from(webapp) { | ||
52 | into("webapp") | ||
53 | } | ||
54 | } | ||
55 | |||
56 | register<JavaExec>("serveBackend") { | ||
57 | dependsOn(webapp) | ||
58 | val mainRuntimeClasspath = sourceSets.main.map { it.runtimeClasspath } | ||
59 | dependsOn(mainRuntimeClasspath) | ||
60 | classpath(mainRuntimeClasspath) | ||
61 | mainClass.set(application.mainClass) | ||
62 | standardInput = System.`in` | ||
63 | val baseResource = webapp.incoming.artifacts.artifactFiles.first() | ||
64 | environment("BASE_RESOURCE", baseResource) | ||
65 | group = "run" | ||
66 | description = "Start a Jetty web server serving the Xtex API and assets." | ||
67 | } | ||
68 | } | ||
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/CacheControlFilter.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/CacheControlFilter.java index fd2af1b2..53f78c3c 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/CacheControlFilter.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/CacheControlFilter.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web; | 6 | package tools.refinery.language.web; |
2 | 7 | ||
3 | import jakarta.servlet.*; | 8 | import jakarta.servlet.*; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebModule.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebModule.java index 706413a9..b0197c01 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebModule.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebModule.java | |||
@@ -1,15 +1,19 @@ | |||
1 | /* | 1 | /* |
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | |||
7 | /* | ||
2 | * generated by Xtext 2.25.0 | 8 | * generated by Xtext 2.25.0 |
3 | */ | 9 | */ |
4 | package tools.refinery.language.web; | 10 | package tools.refinery.language.web; |
5 | 11 | ||
6 | import org.eclipse.xtext.ide.ExecutorServiceProvider; | ||
7 | import org.eclipse.xtext.web.server.XtextServiceDispatcher; | 12 | import org.eclipse.xtext.web.server.XtextServiceDispatcher; |
8 | import org.eclipse.xtext.web.server.model.IWebDocumentProvider; | 13 | import org.eclipse.xtext.web.server.model.IWebDocumentProvider; |
9 | import org.eclipse.xtext.web.server.model.XtextWebDocumentAccess; | 14 | import org.eclipse.xtext.web.server.model.XtextWebDocumentAccess; |
10 | import org.eclipse.xtext.web.server.occurrences.OccurrencesService; | 15 | import org.eclipse.xtext.web.server.occurrences.OccurrencesService; |
11 | import tools.refinery.language.web.occurrences.ProblemOccurrencesService; | 16 | import tools.refinery.language.web.occurrences.ProblemOccurrencesService; |
12 | import tools.refinery.language.web.xtext.VirtualThreadExecutorServiceProvider; | ||
13 | import tools.refinery.language.web.xtext.server.push.PushServiceDispatcher; | 17 | import tools.refinery.language.web.xtext.server.push.PushServiceDispatcher; |
14 | import tools.refinery.language.web.xtext.server.push.PushWebDocumentAccess; | 18 | import tools.refinery.language.web.xtext.server.push.PushWebDocumentAccess; |
15 | import tools.refinery.language.web.xtext.server.push.PushWebDocumentProvider; | 19 | import tools.refinery.language.web.xtext.server.push.PushWebDocumentProvider; |
@@ -33,8 +37,4 @@ public class ProblemWebModule extends AbstractProblemWebModule { | |||
33 | public Class<? extends OccurrencesService> bindOccurrencesService() { | 37 | public Class<? extends OccurrencesService> bindOccurrencesService() { |
34 | return ProblemOccurrencesService.class; | 38 | return ProblemOccurrencesService.class; |
35 | } | 39 | } |
36 | |||
37 | public Class<? extends ExecutorServiceProvider> bindExecutorServiceProvider() { | ||
38 | return VirtualThreadExecutorServiceProvider.class; | ||
39 | } | ||
40 | } | 40 | } |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebSetup.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebSetup.java index 4738bc80..53a394d8 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebSetup.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebSetup.java | |||
@@ -1,4 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | |||
7 | /* | ||
2 | * generated by Xtext 2.25.0 | 8 | * generated by Xtext 2.25.0 |
3 | */ | 9 | */ |
4 | package tools.refinery.language.web; | 10 | package tools.refinery.language.web; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebSocketServlet.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebSocketServlet.java index df67b521..7b48cde8 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebSocketServlet.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/ProblemWebSocketServlet.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web; | 6 | package tools.refinery.language.web; |
2 | 7 | ||
3 | import org.eclipse.xtext.util.DisposableRegistry; | 8 | import org.eclipse.xtext.util.DisposableRegistry; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/SecurityHeadersFilter.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/SecurityHeadersFilter.java index c41db799..7b094fde 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/SecurityHeadersFilter.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/SecurityHeadersFilter.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web; | 6 | package tools.refinery.language.web; |
2 | 7 | ||
3 | import jakarta.servlet.*; | 8 | import jakarta.servlet.*; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/ServerLauncher.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/ServerLauncher.java index f49f46ee..ad19e77d 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/ServerLauncher.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/ServerLauncher.java | |||
@@ -1,4 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | |||
7 | /* | ||
2 | * generated by Xtext 2.25.0 | 8 | * generated by Xtext 2.25.0 |
3 | */ | 9 | */ |
4 | package tools.refinery.language.web; | 10 | package tools.refinery.language.web; |
@@ -13,6 +19,7 @@ import org.eclipse.jetty.ee10.websocket.server.config.JettyWebSocketServletConta | |||
13 | import org.eclipse.jetty.server.Server; | 19 | import org.eclipse.jetty.server.Server; |
14 | import org.eclipse.jetty.util.resource.Resource; | 20 | import org.eclipse.jetty.util.resource.Resource; |
15 | import org.eclipse.jetty.util.resource.ResourceFactory; | 21 | import org.eclipse.jetty.util.resource.ResourceFactory; |
22 | import org.eclipse.jetty.util.thread.QueuedThreadPool; | ||
16 | import org.slf4j.Logger; | 23 | import org.slf4j.Logger; |
17 | import org.slf4j.LoggerFactory; | 24 | import org.slf4j.LoggerFactory; |
18 | import tools.refinery.language.web.config.BackendConfigServlet; | 25 | import tools.refinery.language.web.config.BackendConfigServlet; |
@@ -43,7 +50,8 @@ public class ServerLauncher { | |||
43 | private final Server server; | 50 | private final Server server; |
44 | 51 | ||
45 | public ServerLauncher(InetSocketAddress bindAddress, String[] allowedOrigins, String webSocketUrl) { | 52 | public ServerLauncher(InetSocketAddress bindAddress, String[] allowedOrigins, String webSocketUrl) { |
46 | server = VirtualThreadUtils.newServerWithVirtualThreadsThreadPool("jetty", bindAddress); | 53 | server = new Server(bindAddress); |
54 | ((QueuedThreadPool) server.getThreadPool()).setName("jetty"); | ||
47 | var handler = new ServletContextHandler(); | 55 | var handler = new ServletContextHandler(); |
48 | addSessionHandler(handler); | 56 | addSessionHandler(handler); |
49 | addProblemServlet(handler, allowedOrigins); | 57 | addProblemServlet(handler, allowedOrigins); |
@@ -105,7 +113,7 @@ public class ServerLauncher { | |||
105 | var indexUrlInJar = ServerLauncher.class.getResource("/webapp/index.html"); | 113 | var indexUrlInJar = ServerLauncher.class.getResource("/webapp/index.html"); |
106 | if (indexUrlInJar != null) { | 114 | if (indexUrlInJar != null) { |
107 | // If the app is packaged in the jar, serve it. | 115 | // If the app is packaged in the jar, serve it. |
108 | URI webRootUri = null; | 116 | URI webRootUri; |
109 | try { | 117 | try { |
110 | webRootUri = URI.create(indexUrlInJar.toURI().toASCIIString().replaceFirst("/index.html$", "/")); | 118 | webRootUri = URI.create(indexUrlInJar.toURI().toASCIIString().replaceFirst("/index.html$", "/")); |
111 | } catch (URISyntaxException e) { | 119 | } catch (URISyntaxException e) { |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/VirtualThreadUtils.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/VirtualThreadUtils.java deleted file mode 100644 index a055e755..00000000 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/VirtualThreadUtils.java +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | package tools.refinery.language.web; | ||
2 | |||
3 | import org.eclipse.jetty.server.Server; | ||
4 | import org.eclipse.jetty.server.ServerConnector; | ||
5 | import org.eclipse.jetty.util.thread.QueuedThreadPool; | ||
6 | import org.eclipse.jetty.util.thread.ThreadPool; | ||
7 | |||
8 | import java.net.InetSocketAddress; | ||
9 | import java.time.Duration; | ||
10 | import java.util.concurrent.ExecutorService; | ||
11 | import java.util.concurrent.Executors; | ||
12 | |||
13 | public final class VirtualThreadUtils { | ||
14 | private VirtualThreadUtils() { | ||
15 | throw new IllegalStateException("This is a static utility class and should not be instantiated directly"); | ||
16 | } | ||
17 | |||
18 | public static ExecutorService newNamedVirtualThreadsExecutor(String name) { | ||
19 | // Based on | ||
20 | // https://github.com/eclipse/jetty.project/blob/83154b4ffe4767ef44981598d6c26e6a5d32e57c/jetty-server/src/main/config/etc/jetty-threadpool-virtual-preview.xml | ||
21 | return Executors.newThreadPerTaskExecutor(Thread.ofVirtual() | ||
22 | .allowSetThreadLocals(true) | ||
23 | .inheritInheritableThreadLocals(false) | ||
24 | .name(name + "-virtual-", 0) | ||
25 | .factory()); | ||
26 | } | ||
27 | |||
28 | public static ThreadPool newThreadPoolWithVirtualThreadsExecutor(String name) { | ||
29 | // Based on | ||
30 | // https://github.com/eclipse/jetty.project/blob/83154b4ffe4767ef44981598d6c26e6a5d32e57c/jetty-server/src/main/config/etc/jetty-threadpool-virtual-preview.xml | ||
31 | int timeout = (int) Duration.ofMinutes(1).toMillis(); | ||
32 | var threadPool = new QueuedThreadPool(200, 10, timeout, -1, null, null); | ||
33 | threadPool.setName(name); | ||
34 | threadPool.setDetailedDump(false); | ||
35 | threadPool.setVirtualThreadsExecutor(newNamedVirtualThreadsExecutor(name)); | ||
36 | return threadPool; | ||
37 | } | ||
38 | |||
39 | public static Server newServerWithVirtualThreadsThreadPool(String name, InetSocketAddress listenAddress) { | ||
40 | var server = new Server(newThreadPoolWithVirtualThreadsExecutor(name)); | ||
41 | var connector = new ServerConnector(server); | ||
42 | try { | ||
43 | connector.setHost(listenAddress.getHostName()); | ||
44 | connector.setPort(listenAddress.getPort()); | ||
45 | server.addConnector(connector); | ||
46 | } catch (Exception e) { | ||
47 | connector.close(); | ||
48 | throw e; | ||
49 | } | ||
50 | return server; | ||
51 | } | ||
52 | } | ||
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/config/BackendConfig.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/config/BackendConfig.java index 2e864998..807b789c 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/config/BackendConfig.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/config/BackendConfig.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.config; | 6 | package tools.refinery.language.web.config; |
2 | 7 | ||
3 | import com.google.gson.annotations.SerializedName; | 8 | import com.google.gson.annotations.SerializedName; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/config/BackendConfigServlet.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/config/BackendConfigServlet.java index f314a9fa..a2f04e34 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/config/BackendConfigServlet.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/config/BackendConfigServlet.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.config; | 6 | package tools.refinery.language.web.config; |
2 | 7 | ||
3 | import com.google.gson.Gson; | 8 | import com.google.gson.Gson; |
@@ -29,7 +34,7 @@ public class BackendConfigServlet extends HttpServlet { | |||
29 | } | 34 | } |
30 | 35 | ||
31 | @Override | 36 | @Override |
32 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { | 37 | protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { |
33 | resp.setStatus(HttpStatus.OK_200); | 38 | resp.setStatus(HttpStatus.OK_200); |
34 | resp.setContentType("application/json"); | 39 | resp.setContentType("application/json"); |
35 | var writer = resp.getWriter(); | 40 | var writer = resp.getWriter(); |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/occurrences/ProblemOccurrencesService.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/occurrences/ProblemOccurrencesService.java index d32bbb54..34117384 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/occurrences/ProblemOccurrencesService.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/occurrences/ProblemOccurrencesService.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.occurrences; | 6 | package tools.refinery.language.web.occurrences; |
2 | 7 | ||
3 | import org.eclipse.emf.ecore.EObject; | 8 | import org.eclipse.emf.ecore.EObject; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/VirtualThreadExecutorServiceProvider.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/VirtualThreadExecutorServiceProvider.java deleted file mode 100644 index abbcbd53..00000000 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/VirtualThreadExecutorServiceProvider.java +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | package tools.refinery.language.web.xtext; | ||
2 | |||
3 | import org.eclipse.xtext.ide.ExecutorServiceProvider; | ||
4 | import tools.refinery.language.web.VirtualThreadUtils; | ||
5 | |||
6 | import java.util.concurrent.ExecutorService; | ||
7 | |||
8 | public class VirtualThreadExecutorServiceProvider extends ExecutorServiceProvider { | ||
9 | private static final String THREAD_POOL_NAME = "xtextWeb"; | ||
10 | |||
11 | @Override | ||
12 | protected ExecutorService createInstance(String key) { | ||
13 | var name = key == null ? THREAD_POOL_NAME : THREAD_POOL_NAME + "-" + key; | ||
14 | return VirtualThreadUtils.newNamedVirtualThreadsExecutor(name); | ||
15 | } | ||
16 | } | ||
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/PongResult.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/PongResult.java index fe510f51..27b2e04e 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/PongResult.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/PongResult.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.server; | 6 | package tools.refinery.language.web.xtext.server; |
2 | 7 | ||
3 | import java.util.Objects; | 8 | import java.util.Objects; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/ResponseHandler.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/ResponseHandler.java index 2a85afe3..3069c2dd 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/ResponseHandler.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/ResponseHandler.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.server; | 6 | package tools.refinery.language.web.xtext.server; |
2 | 7 | ||
3 | import tools.refinery.language.web.xtext.server.message.XtextWebResponse; | 8 | import tools.refinery.language.web.xtext.server.message.XtextWebResponse; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/ResponseHandlerException.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/ResponseHandlerException.java index b686d33a..366ef0a7 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/ResponseHandlerException.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/ResponseHandlerException.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.server; | 6 | package tools.refinery.language.web.xtext.server; |
2 | 7 | ||
3 | import java.io.Serial; | 8 | import java.io.Serial; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/SubscribingServiceContext.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/SubscribingServiceContext.java index 78e00a9e..04212b84 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/SubscribingServiceContext.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/SubscribingServiceContext.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.server; | 6 | package tools.refinery.language.web.xtext.server; |
2 | 7 | ||
3 | import java.util.Set; | 8 | import java.util.Set; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/TransactionExecutor.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/TransactionExecutor.java index 7bb11d2e..0135d8f5 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/TransactionExecutor.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/TransactionExecutor.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.server; | 6 | package tools.refinery.language.web.xtext.server; |
2 | 7 | ||
3 | import com.google.common.base.Strings; | 8 | import com.google.common.base.Strings; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebErrorKind.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebErrorKind.java index f74bae74..6f4f265c 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebErrorKind.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebErrorKind.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.server.message; | 6 | package tools.refinery.language.web.xtext.server.message; |
2 | 7 | ||
3 | import com.google.gson.annotations.SerializedName; | 8 | import com.google.gson.annotations.SerializedName; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebErrorResponse.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebErrorResponse.java index 01d78c31..af38ad70 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebErrorResponse.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebErrorResponse.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.server.message; | 6 | package tools.refinery.language.web.xtext.server.message; |
2 | 7 | ||
3 | import java.util.Objects; | 8 | import java.util.Objects; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebOkResponse.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebOkResponse.java index 8af27247..73527ee5 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebOkResponse.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebOkResponse.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.server.message; | 6 | package tools.refinery.language.web.xtext.server.message; |
2 | 7 | ||
3 | import java.util.Objects; | 8 | import java.util.Objects; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebPushMessage.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebPushMessage.java index c9432e1c..e9ff87c4 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebPushMessage.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebPushMessage.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.server.message; | 6 | package tools.refinery.language.web.xtext.server.message; |
2 | 7 | ||
3 | import java.util.Objects; | 8 | import java.util.Objects; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebRequest.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebRequest.java index 959749f8..ff788e94 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebRequest.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebRequest.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.server.message; | 6 | package tools.refinery.language.web.xtext.server.message; |
2 | 7 | ||
3 | import java.util.Map; | 8 | import java.util.Map; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebResponse.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebResponse.java index 3bd13047..61444c99 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebResponse.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/message/XtextWebResponse.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.server.message; | 6 | package tools.refinery.language.web.xtext.server.message; |
2 | 7 | ||
3 | public sealed interface XtextWebResponse permits XtextWebOkResponse,XtextWebErrorResponse,XtextWebPushMessage { | 8 | public sealed interface XtextWebResponse permits XtextWebOkResponse,XtextWebErrorResponse,XtextWebPushMessage { |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PrecomputationListener.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PrecomputationListener.java index 79a284db..110c8f52 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PrecomputationListener.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PrecomputationListener.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.server.push; | 6 | package tools.refinery.language.web.xtext.server.push; |
2 | 7 | ||
3 | import org.eclipse.xtext.web.server.IServiceResult; | 8 | import org.eclipse.xtext.web.server.IServiceResult; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushServiceDispatcher.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushServiceDispatcher.java index c7b8108d..4c9135c8 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushServiceDispatcher.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushServiceDispatcher.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.server.push; | 6 | package tools.refinery.language.web.xtext.server.push; |
2 | 7 | ||
3 | import org.eclipse.xtext.web.server.IServiceContext; | 8 | import org.eclipse.xtext.web.server.IServiceContext; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocument.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocument.java index 906b9e30..56fd12c9 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocument.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocument.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.server.push; | 6 | package tools.refinery.language.web.xtext.server.push; |
2 | 7 | ||
3 | import java.util.ArrayList; | 8 | import java.util.ArrayList; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocumentAccess.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocumentAccess.java index b3666a86..d9e548cd 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocumentAccess.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocumentAccess.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.server.push; | 6 | package tools.refinery.language.web.xtext.server.push; |
2 | 7 | ||
3 | import org.eclipse.xtext.service.OperationCanceledManager; | 8 | import org.eclipse.xtext.service.OperationCanceledManager; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocumentProvider.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocumentProvider.java index b6f04748..b6f4fb43 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocumentProvider.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/server/push/PushWebDocumentProvider.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.server.push; | 6 | package tools.refinery.language.web.xtext.server.push; |
2 | 7 | ||
3 | import org.eclipse.xtext.web.server.IServiceContext; | 8 | import org.eclipse.xtext.web.server.IServiceContext; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/SimpleServiceContext.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/SimpleServiceContext.java index 43e37160..fee1141d 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/SimpleServiceContext.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/SimpleServiceContext.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.servlet; | 6 | package tools.refinery.language.web.xtext.servlet; |
2 | 7 | ||
3 | import java.util.Map; | 8 | import java.util.Map; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/SimpleSession.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/SimpleSession.java index 09c055a2..bc60c282 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/SimpleSession.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/SimpleSession.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.servlet; | 6 | package tools.refinery.language.web.xtext.servlet; |
2 | 7 | ||
3 | import java.util.HashMap; | 8 | import java.util.HashMap; |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextStatusCode.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextStatusCode.java index 0cd229e8..caa98e84 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextStatusCode.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextStatusCode.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.servlet; | 6 | package tools.refinery.language.web.xtext.servlet; |
2 | 7 | ||
3 | public final class XtextStatusCode { | 8 | public final class XtextStatusCode { |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextWebSocket.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextWebSocket.java index 1d9e0463..043d318c 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextWebSocket.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextWebSocket.java | |||
@@ -1,12 +1,17 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.servlet; | 6 | package tools.refinery.language.web.xtext.servlet; |
2 | 7 | ||
3 | import com.google.gson.Gson; | 8 | import com.google.gson.Gson; |
4 | import com.google.gson.JsonIOException; | 9 | import com.google.gson.JsonIOException; |
5 | import com.google.gson.JsonParseException; | 10 | import com.google.gson.JsonParseException; |
6 | import org.eclipse.jetty.ee10.websocket.api.Session; | 11 | import org.eclipse.jetty.websocket.api.Callback; |
7 | import org.eclipse.jetty.ee10.websocket.api.StatusCode; | 12 | import org.eclipse.jetty.websocket.api.Session; |
8 | import org.eclipse.jetty.ee10.websocket.api.WriteCallback; | 13 | import org.eclipse.jetty.websocket.api.StatusCode; |
9 | import org.eclipse.jetty.ee10.websocket.api.annotations.*; | 14 | import org.eclipse.jetty.websocket.api.annotations.*; |
10 | import org.eclipse.xtext.resource.IResourceServiceProvider; | 15 | import org.eclipse.xtext.resource.IResourceServiceProvider; |
11 | import org.eclipse.xtext.web.server.ISession; | 16 | import org.eclipse.xtext.web.server.ISession; |
12 | import org.slf4j.Logger; | 17 | import org.slf4j.Logger; |
@@ -20,7 +25,7 @@ import tools.refinery.language.web.xtext.server.message.XtextWebResponse; | |||
20 | import java.io.Reader; | 25 | import java.io.Reader; |
21 | 26 | ||
22 | @WebSocket | 27 | @WebSocket |
23 | public class XtextWebSocket implements WriteCallback, ResponseHandler { | 28 | public class XtextWebSocket implements ResponseHandler { |
24 | private static final Logger LOG = LoggerFactory.getLogger(XtextWebSocket.class); | 29 | private static final Logger LOG = LoggerFactory.getLogger(XtextWebSocket.class); |
25 | 30 | ||
26 | private final Gson gson = new Gson(); | 31 | private final Gson gson = new Gson(); |
@@ -38,13 +43,13 @@ public class XtextWebSocket implements WriteCallback, ResponseHandler { | |||
38 | this(new TransactionExecutor(session, resourceServiceProviderRegistry)); | 43 | this(new TransactionExecutor(session, resourceServiceProviderRegistry)); |
39 | } | 44 | } |
40 | 45 | ||
41 | @OnWebSocketConnect | 46 | @OnWebSocketOpen |
42 | public void onConnect(Session webSocketSession) { | 47 | public void onOpen(Session webSocketSession) { |
43 | if (this.webSocketSession != null) { | 48 | if (this.webSocketSession != null) { |
44 | LOG.error("Websocket session onConnect when already connected"); | 49 | LOG.error("Websocket session onConnect when already connected"); |
45 | return; | 50 | return; |
46 | } | 51 | } |
47 | LOG.debug("New websocket connection from {}", webSocketSession.getRemoteAddress()); | 52 | LOG.debug("New websocket connection from {}", webSocketSession.getRemoteSocketAddress()); |
48 | this.webSocketSession = webSocketSession; | 53 | this.webSocketSession = webSocketSession; |
49 | } | 54 | } |
50 | 55 | ||
@@ -55,10 +60,10 @@ public class XtextWebSocket implements WriteCallback, ResponseHandler { | |||
55 | return; | 60 | return; |
56 | } | 61 | } |
57 | if (statusCode == StatusCode.NORMAL || statusCode == StatusCode.SHUTDOWN) { | 62 | if (statusCode == StatusCode.NORMAL || statusCode == StatusCode.SHUTDOWN) { |
58 | LOG.debug("{} closed connection normally: {}", webSocketSession.getRemoteAddress(), reason); | 63 | LOG.debug("{} closed connection normally: {}", webSocketSession.getRemoteSocketAddress(), reason); |
59 | } else { | 64 | } else { |
60 | LOG.warn("{} closed connection with status code {}: {}", webSocketSession.getRemoteAddress(), statusCode, | 65 | LOG.warn("{} closed connection with status code {}: {}", webSocketSession.getRemoteSocketAddress(), |
61 | reason); | 66 | statusCode, reason); |
62 | } | 67 | } |
63 | webSocketSession = null; | 68 | webSocketSession = null; |
64 | } | 69 | } |
@@ -68,7 +73,7 @@ public class XtextWebSocket implements WriteCallback, ResponseHandler { | |||
68 | if (webSocketSession == null) { | 73 | if (webSocketSession == null) { |
69 | return; | 74 | return; |
70 | } | 75 | } |
71 | LOG.error("Internal websocket error in connection from" + webSocketSession.getRemoteAddress(), error); | 76 | LOG.error("Internal websocket error in connection from" + webSocketSession.getRemoteSocketAddress(), error); |
72 | } | 77 | } |
73 | 78 | ||
74 | @OnWebSocketMessage | 79 | @OnWebSocketMessage |
@@ -81,14 +86,14 @@ public class XtextWebSocket implements WriteCallback, ResponseHandler { | |||
81 | try { | 86 | try { |
82 | request = gson.fromJson(reader, XtextWebRequest.class); | 87 | request = gson.fromJson(reader, XtextWebRequest.class); |
83 | } catch (JsonIOException e) { | 88 | } catch (JsonIOException e) { |
84 | LOG.error("Cannot read from websocket from" + webSocketSession.getRemoteAddress(), e); | 89 | LOG.error("Cannot read from websocket from" + webSocketSession.getRemoteSocketAddress(), e); |
85 | if (webSocketSession.isOpen()) { | 90 | if (webSocketSession.isOpen()) { |
86 | webSocketSession.close(StatusCode.SERVER_ERROR, "Cannot read payload"); | 91 | webSocketSession.close(StatusCode.SERVER_ERROR, "Cannot read payload", Callback.NOOP); |
87 | } | 92 | } |
88 | return; | 93 | return; |
89 | } catch (JsonParseException e) { | 94 | } catch (JsonParseException e) { |
90 | LOG.warn("Malformed websocket request from" + webSocketSession.getRemoteAddress(), e); | 95 | LOG.warn("Malformed websocket request from" + webSocketSession.getRemoteSocketAddress(), e); |
91 | webSocketSession.close(XtextStatusCode.INVALID_JSON, "Invalid JSON payload"); | 96 | webSocketSession.close(XtextStatusCode.INVALID_JSON, "Invalid JSON payload", Callback.NOOP); |
92 | return; | 97 | return; |
93 | } | 98 | } |
94 | try { | 99 | try { |
@@ -96,7 +101,7 @@ public class XtextWebSocket implements WriteCallback, ResponseHandler { | |||
96 | } catch (ResponseHandlerException e) { | 101 | } catch (ResponseHandlerException e) { |
97 | LOG.warn("Cannot write websocket response", e); | 102 | LOG.warn("Cannot write websocket response", e); |
98 | if (webSocketSession.isOpen()) { | 103 | if (webSocketSession.isOpen()) { |
99 | webSocketSession.close(StatusCode.SERVER_ERROR, "Cannot write response"); | 104 | webSocketSession.close(StatusCode.SERVER_ERROR, "Cannot write response", Callback.NOOP); |
100 | } | 105 | } |
101 | } | 106 | } |
102 | } | 107 | } |
@@ -107,15 +112,14 @@ public class XtextWebSocket implements WriteCallback, ResponseHandler { | |||
107 | throw new ResponseHandlerException("Trying to send message when websocket is disconnected"); | 112 | throw new ResponseHandlerException("Trying to send message when websocket is disconnected"); |
108 | } | 113 | } |
109 | var responseString = gson.toJson(response); | 114 | var responseString = gson.toJson(response); |
110 | webSocketSession.getRemote().sendPartialString(responseString, true, this); | 115 | webSocketSession.sendText(responseString, Callback.from(() -> {}, this::writeFailed)); |
111 | } | 116 | } |
112 | 117 | ||
113 | @Override | ||
114 | public void writeFailed(Throwable x) { | 118 | public void writeFailed(Throwable x) { |
115 | if (webSocketSession == null) { | 119 | if (webSocketSession == null) { |
116 | LOG.error("Cannot complete async write to disconnected websocket", x); | 120 | LOG.error("Cannot complete async write to disconnected websocket", x); |
117 | return; | 121 | return; |
118 | } | 122 | } |
119 | LOG.warn("Cannot complete async write to websocket " + webSocketSession.getRemoteAddress(), x); | 123 | LOG.warn("Cannot complete async write to websocket " + webSocketSession.getRemoteSocketAddress(), x); |
120 | } | 124 | } |
121 | } | 125 | } |
diff --git a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextWebSocketServlet.java b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextWebSocketServlet.java index 9a32b937..5e4fb0ce 100644 --- a/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextWebSocketServlet.java +++ b/subprojects/language-web/src/main/java/tools/refinery/language/web/xtext/servlet/XtextWebSocketServlet.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.servlet; | 6 | package tools.refinery.language.web.xtext.servlet; |
2 | 7 | ||
3 | import jakarta.servlet.ServletConfig; | 8 | import jakarta.servlet.ServletConfig; |
diff --git a/subprojects/language-web/src/test/java/tools/refinery/language/web/ProblemWebSocketServletIntegrationTest.java b/subprojects/language-web/src/test/java/tools/refinery/language/web/ProblemWebSocketServletIntegrationTest.java index ecbefc4f..927eeab1 100644 --- a/subprojects/language-web/src/test/java/tools/refinery/language/web/ProblemWebSocketServletIntegrationTest.java +++ b/subprojects/language-web/src/test/java/tools/refinery/language/web/ProblemWebSocketServletIntegrationTest.java | |||
@@ -1,20 +1,30 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web; | 6 | package tools.refinery.language.web; |
2 | 7 | ||
3 | import org.eclipse.jetty.ee10.servlet.ServletContextHandler; | 8 | import org.eclipse.jetty.ee10.servlet.ServletContextHandler; |
4 | import org.eclipse.jetty.ee10.servlet.ServletHolder; | 9 | import org.eclipse.jetty.ee10.servlet.ServletHolder; |
5 | import org.eclipse.jetty.ee10.websocket.api.Session; | ||
6 | import org.eclipse.jetty.ee10.websocket.api.StatusCode; | ||
7 | import org.eclipse.jetty.ee10.websocket.api.annotations.WebSocket; | ||
8 | import org.eclipse.jetty.ee10.websocket.api.exceptions.UpgradeException; | ||
9 | import org.eclipse.jetty.ee10.websocket.client.ClientUpgradeRequest; | ||
10 | import org.eclipse.jetty.ee10.websocket.client.WebSocketClient; | ||
11 | import org.eclipse.jetty.ee10.websocket.server.config.JettyWebSocketServletContainerInitializer; | 10 | import org.eclipse.jetty.ee10.websocket.server.config.JettyWebSocketServletContainerInitializer; |
12 | import org.eclipse.jetty.http.HttpHeader; | 11 | import org.eclipse.jetty.http.HttpHeader; |
13 | import org.eclipse.jetty.http.HttpStatus; | 12 | import org.eclipse.jetty.http.HttpStatus; |
14 | import org.eclipse.jetty.server.Server; | 13 | import org.eclipse.jetty.server.Server; |
14 | import org.eclipse.jetty.util.thread.QueuedThreadPool; | ||
15 | import org.eclipse.jetty.websocket.api.Callback; | ||
16 | import org.eclipse.jetty.websocket.api.Session; | ||
17 | import org.eclipse.jetty.websocket.api.StatusCode; | ||
18 | import org.eclipse.jetty.websocket.api.annotations.WebSocket; | ||
19 | import org.eclipse.jetty.websocket.api.exceptions.UpgradeException; | ||
20 | import org.eclipse.jetty.websocket.client.ClientUpgradeRequest; | ||
21 | import org.eclipse.jetty.websocket.client.WebSocketClient; | ||
15 | import org.eclipse.xtext.testing.GlobalRegistries; | 22 | import org.eclipse.xtext.testing.GlobalRegistries; |
16 | import org.eclipse.xtext.testing.GlobalRegistries.GlobalStateMemento; | 23 | import org.eclipse.xtext.testing.GlobalRegistries.GlobalStateMemento; |
17 | import org.junit.jupiter.api.*; | 24 | import org.junit.jupiter.api.AfterEach; |
25 | import org.junit.jupiter.api.BeforeEach; | ||
26 | import org.junit.jupiter.api.Test; | ||
27 | import org.junit.jupiter.api.TestInfo; | ||
18 | import org.junit.jupiter.params.ParameterizedTest; | 28 | import org.junit.jupiter.params.ParameterizedTest; |
19 | import org.junit.jupiter.params.provider.ValueSource; | 29 | import org.junit.jupiter.params.provider.ValueSource; |
20 | import tools.refinery.language.web.tests.WebSocketIntegrationTestClient; | 30 | import tools.refinery.language.web.tests.WebSocketIntegrationTestClient; |
@@ -86,23 +96,34 @@ class ProblemWebSocketServletIntegrationTest { | |||
86 | assertThat(responses, hasSize(5)); | 96 | assertThat(responses, hasSize(5)); |
87 | assertThat(responses.get(0), equalTo("{\"id\":\"foo\",\"response\":{\"stateId\":\"-80000000\"}}")); | 97 | assertThat(responses.get(0), equalTo("{\"id\":\"foo\",\"response\":{\"stateId\":\"-80000000\"}}")); |
88 | assertThat(responses.get(1), startsWith( | 98 | assertThat(responses.get(1), startsWith( |
89 | "{\"resource\":\"test.problem\",\"stateId\":\"-80000000\",\"service\":\"highlight\",\"push\":{\"regions\":[")); | 99 | "{\"resource\":\"test.problem\",\"stateId\":\"-80000000\",\"service\":\"highlight\"," + |
100 | "\"push\":{\"regions\":[")); | ||
90 | assertThat(responses.get(2), equalTo( | 101 | assertThat(responses.get(2), equalTo( |
91 | "{\"resource\":\"test.problem\",\"stateId\":\"-80000000\",\"service\":\"validate\",\"push\":{\"issues\":[]}}")); | 102 | "{\"resource\":\"test.problem\",\"stateId\":\"-80000000\",\"service\":\"validate\"," + |
103 | "\"push\":{\"issues\":[]}}")); | ||
92 | assertThat(responses.get(3), equalTo("{\"id\":\"bar\",\"response\":{\"stateId\":\"-7fffffff\"}}")); | 104 | assertThat(responses.get(3), equalTo("{\"id\":\"bar\",\"response\":{\"stateId\":\"-7fffffff\"}}")); |
93 | assertThat(responses.get(4), startsWith( | 105 | assertThat(responses.get(4), startsWith( |
94 | "{\"resource\":\"test.problem\",\"stateId\":\"-7fffffff\",\"service\":\"highlight\",\"push\":{\"regions\":[")); | 106 | "{\"resource\":\"test.problem\",\"stateId\":\"-7fffffff\",\"service\":\"highlight\"," + |
107 | "\"push\":{\"regions\":[")); | ||
95 | } | 108 | } |
96 | 109 | ||
97 | @WebSocket | 110 | @WebSocket |
98 | public static class UpdateTestClient extends WebSocketIntegrationTestClient { | 111 | public static class UpdateTestClient extends WebSocketIntegrationTestClient { |
99 | @Override | 112 | @Override |
100 | protected void arrange(Session session, int responsesReceived) throws IOException { | 113 | protected void arrange(Session session, int responsesReceived) { |
101 | switch (responsesReceived) { | 114 | switch (responsesReceived) { |
102 | case 0 -> session.getRemote().sendString( | 115 | case 0 -> session.sendText( |
103 | "{\"id\":\"foo\",\"request\":{\"resource\":\"test.problem\",\"serviceType\":\"update\",\"fullText\":\"class Person.\n\"}}"); | 116 | "{\"id\":\"foo\",\"request\":{\"resource\":\"test.problem\",\"serviceType\":\"update\"," + |
104 | case 3 -> session.getRemote().sendString( | 117 | "\"fullText\":\"class Person.\n\"}}", |
105 | "{\"id\":\"bar\",\"request\":{\"resource\":\"test.problem\",\"serviceType\":\"update\",\"requiredStateId\":\"-80000000\",\"deltaText\":\"indiv q.\nnode(q).\n\",\"deltaOffset\":\"0\",\"deltaReplaceLength\":\"0\"}}"); | 118 | Callback.NOOP |
119 | ); | ||
120 | case 3 -> //noinspection TextBlockMigration | ||
121 | session.sendText( | ||
122 | "{\"id\":\"bar\",\"request\":{\"resource\":\"test.problem\",\"serviceType\":\"update\"," + | ||
123 | "\"requiredStateId\":\"-80000000\",\"deltaText\":\"indiv q.\nnode(q).\n\"," + | ||
124 | "\"deltaOffset\":\"0\",\"deltaReplaceLength\":\"0\"}}", | ||
125 | Callback.NOOP | ||
126 | ); | ||
106 | case 5 -> session.close(); | 127 | case 5 -> session.close(); |
107 | } | 128 | } |
108 | } | 129 | } |
@@ -152,13 +173,13 @@ class ProblemWebSocketServletIntegrationTest { | |||
152 | @WebSocket | 173 | @WebSocket |
153 | public static class InvalidJsonTestClient extends WebSocketIntegrationTestClient { | 174 | public static class InvalidJsonTestClient extends WebSocketIntegrationTestClient { |
154 | @Override | 175 | @Override |
155 | protected void arrange(Session session, int responsesReceived) throws IOException { | 176 | protected void arrange(Session session, int responsesReceived) { |
156 | session.getRemote().sendString("<invalid json>"); | 177 | session.sendText("<invalid json>", Callback.NOOP); |
157 | } | 178 | } |
158 | } | 179 | } |
159 | 180 | ||
160 | @ParameterizedTest(name = "validOriginTest(\"{0}\")") | 181 | @ParameterizedTest(name = "validOriginTest(\"{0}\")") |
161 | @ValueSource(strings = { "https://refinery.example", "https://refinery.example:443", "HTTPS://REFINERY.EXAMPLE" }) | 182 | @ValueSource(strings = {"https://refinery.example", "https://refinery.example:443", "HTTPS://REFINERY.EXAMPLE"}) |
162 | void validOriginTest(String origin) { | 183 | void validOriginTest(String origin) { |
163 | startServer("https://refinery.example,https://refinery.example:443"); | 184 | startServer("https://refinery.example,https://refinery.example:443"); |
164 | var clientSocket = new CloseImmediatelyTestClient(); | 185 | var clientSocket = new CloseImmediatelyTestClient(); |
@@ -188,7 +209,8 @@ class ProblemWebSocketServletIntegrationTest { | |||
188 | private void startServer(String allowedOrigins) { | 209 | private void startServer(String allowedOrigins) { |
189 | var testName = getClass().getSimpleName() + "-" + testInfo.getDisplayName(); | 210 | var testName = getClass().getSimpleName() + "-" + testInfo.getDisplayName(); |
190 | var listenAddress = new InetSocketAddress(HOSTNAME, serverPort); | 211 | var listenAddress = new InetSocketAddress(HOSTNAME, serverPort); |
191 | server = VirtualThreadUtils.newServerWithVirtualThreadsThreadPool(testName, listenAddress); | 212 | server = new Server(listenAddress); |
213 | ((QueuedThreadPool) server.getThreadPool()).setName(testName); | ||
192 | var handler = new ServletContextHandler(); | 214 | var handler = new ServletContextHandler(); |
193 | var holder = new ServletHolder(ProblemWebSocketServlet.class); | 215 | var holder = new ServletHolder(ProblemWebSocketServlet.class); |
194 | if (allowedOrigins != null) { | 216 | if (allowedOrigins != null) { |
diff --git a/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/AwaitTerminationExecutorServiceProvider.java b/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/AwaitTerminationExecutorServiceProvider.java index c634e8fc..52acee6d 100644 --- a/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/AwaitTerminationExecutorServiceProvider.java +++ b/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/AwaitTerminationExecutorServiceProvider.java | |||
@@ -1,14 +1,19 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.tests; | 6 | package tools.refinery.language.web.tests; |
2 | 7 | ||
3 | import com.google.inject.Singleton; | 8 | import com.google.inject.Singleton; |
4 | import tools.refinery.language.web.xtext.VirtualThreadExecutorServiceProvider; | 9 | import org.eclipse.xtext.ide.ExecutorServiceProvider; |
5 | 10 | ||
6 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
7 | import java.util.List; | 12 | import java.util.List; |
8 | import java.util.concurrent.ExecutorService; | 13 | import java.util.concurrent.ExecutorService; |
9 | 14 | ||
10 | @Singleton | 15 | @Singleton |
11 | public class AwaitTerminationExecutorServiceProvider extends VirtualThreadExecutorServiceProvider { | 16 | public class AwaitTerminationExecutorServiceProvider extends ExecutorServiceProvider { |
12 | private final List<RestartableCachedThreadPool> servicesToShutDown = new ArrayList<>(); | 17 | private final List<RestartableCachedThreadPool> servicesToShutDown = new ArrayList<>(); |
13 | 18 | ||
14 | @Override | 19 | @Override |
diff --git a/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/ProblemWebInjectorProvider.java b/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/ProblemWebInjectorProvider.java index 43c12faa..4a5eed95 100644 --- a/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/ProblemWebInjectorProvider.java +++ b/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/ProblemWebInjectorProvider.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.tests; | 6 | package tools.refinery.language.web.tests; |
2 | 7 | ||
3 | import org.eclipse.xtext.ide.ExecutorServiceProvider; | 8 | import org.eclipse.xtext.ide.ExecutorServiceProvider; |
diff --git a/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/RestartableCachedThreadPool.java b/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/RestartableCachedThreadPool.java index cf805eda..09079aa8 100644 --- a/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/RestartableCachedThreadPool.java +++ b/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/RestartableCachedThreadPool.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.tests; | 6 | package tools.refinery.language.web.tests; |
2 | 7 | ||
3 | import com.google.inject.Provider; | 8 | import com.google.inject.Provider; |
diff --git a/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/WebSocketIntegrationTestClient.java b/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/WebSocketIntegrationTestClient.java index f19c10ca..6ccf1760 100644 --- a/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/WebSocketIntegrationTestClient.java +++ b/subprojects/language-web/src/test/java/tools/refinery/language/web/tests/WebSocketIntegrationTestClient.java | |||
@@ -1,12 +1,16 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.tests; | 6 | package tools.refinery.language.web.tests; |
2 | 7 | ||
3 | import org.eclipse.jetty.ee10.websocket.api.Session; | 8 | import org.eclipse.jetty.websocket.api.Session; |
4 | import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketClose; | 9 | import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose; |
5 | import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketConnect; | 10 | import org.eclipse.jetty.websocket.api.annotations.OnWebSocketError; |
6 | import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketError; | 11 | import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; |
7 | import org.eclipse.jetty.ee10.websocket.api.annotations.OnWebSocketMessage; | 12 | import org.eclipse.jetty.websocket.api.annotations.OnWebSocketOpen; |
8 | 13 | ||
9 | import java.io.IOException; | ||
10 | import java.time.Duration; | 14 | import java.time.Duration; |
11 | import java.util.ArrayList; | 15 | import java.util.ArrayList; |
12 | import java.util.List; | 16 | import java.util.List; |
@@ -14,7 +18,7 @@ import java.util.List; | |||
14 | import static org.junit.jupiter.api.Assertions.fail; | 18 | import static org.junit.jupiter.api.Assertions.fail; |
15 | 19 | ||
16 | public abstract class WebSocketIntegrationTestClient { | 20 | public abstract class WebSocketIntegrationTestClient { |
17 | private static final long TIMEOUT_MILLIS = Duration.ofSeconds(1).toMillis(); | 21 | private static final long TIMEOUT_MILLIS = Duration.ofSeconds(10).toMillis(); |
18 | 22 | ||
19 | private boolean finished = false; | 23 | private boolean finished = false; |
20 | 24 | ||
@@ -34,8 +38,8 @@ public abstract class WebSocketIntegrationTestClient { | |||
34 | return responses; | 38 | return responses; |
35 | } | 39 | } |
36 | 40 | ||
37 | @OnWebSocketConnect | 41 | @OnWebSocketOpen |
38 | public void onConnect(Session session) { | 42 | public void onOpen(Session session) { |
39 | arrangeAndCatchErrors(session); | 43 | arrangeAndCatchErrors(session); |
40 | } | 44 | } |
41 | 45 | ||
@@ -47,7 +51,7 @@ public abstract class WebSocketIntegrationTestClient { | |||
47 | } | 51 | } |
48 | } | 52 | } |
49 | 53 | ||
50 | protected abstract void arrange(Session session, int responsesReceived) throws IOException; | 54 | protected abstract void arrange(Session session, int responsesReceived); |
51 | 55 | ||
52 | @OnWebSocketClose | 56 | @OnWebSocketClose |
53 | public void onClose(int statusCode, String reason) { | 57 | public void onClose(int statusCode, String reason) { |
diff --git a/subprojects/language-web/src/test/java/tools/refinery/language/web/xtext/servlet/TransactionExecutorTest.java b/subprojects/language-web/src/test/java/tools/refinery/language/web/xtext/servlet/TransactionExecutorTest.java index 17f1ff5c..841bacd3 100644 --- a/subprojects/language-web/src/test/java/tools/refinery/language/web/xtext/servlet/TransactionExecutorTest.java +++ b/subprojects/language-web/src/test/java/tools/refinery/language/web/xtext/servlet/TransactionExecutorTest.java | |||
@@ -1,3 +1,8 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
1 | package tools.refinery.language.web.xtext.servlet; | 6 | package tools.refinery.language.web.xtext.servlet; |
2 | 7 | ||
3 | import com.google.inject.Inject; | 8 | import com.google.inject.Inject; |