diff options
author | 2022-11-19 14:00:12 +0100 | |
---|---|---|
committer | 2022-11-22 16:40:03 +0100 | |
commit | 383137c190cab040d2609f8295ef822c3917b88d (patch) | |
tree | d0d88528de2020da51cb6e92459b84cf63609feb /subprojects/language-web/src | |
parent | chore(deps): bump dependencies (diff) | |
download | refinery-383137c190cab040d2609f8295ef822c3917b88d.tar.gz refinery-383137c190cab040d2609f8295ef822c3917b88d.tar.zst refinery-383137c190cab040d2609f8295ef822c3917b88d.zip |
feat(language): numeric expressions
Diffstat (limited to 'subprojects/language-web/src')
2 files changed, 25 insertions, 30 deletions
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 49464d27..74695c9a 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,35 +1,35 @@ | |||
1 | package tools.refinery.language.web.tests; | 1 | package tools.refinery.language.web.tests; |
2 | 2 | ||
3 | import static org.junit.jupiter.api.Assertions.fail; | 3 | import org.eclipse.jetty.websocket.api.Session; |
4 | import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose; | ||
5 | import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect; | ||
6 | import org.eclipse.jetty.websocket.api.annotations.OnWebSocketError; | ||
7 | import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; | ||
4 | 8 | ||
5 | import java.io.IOException; | 9 | import java.io.IOException; |
6 | import java.time.Duration; | 10 | import java.time.Duration; |
7 | import java.util.ArrayList; | 11 | import java.util.ArrayList; |
8 | import java.util.List; | 12 | import java.util.List; |
9 | 13 | ||
10 | import org.eclipse.jetty.websocket.api.Session; | 14 | import static org.junit.jupiter.api.Assertions.fail; |
11 | import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose; | ||
12 | import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect; | ||
13 | import org.eclipse.jetty.websocket.api.annotations.OnWebSocketError; | ||
14 | import org.eclipse.jetty.websocket.api.annotations.OnWebSocketMessage; | ||
15 | 15 | ||
16 | public abstract class WebSocketIntegrationTestClient { | 16 | public abstract class WebSocketIntegrationTestClient { |
17 | private static long TIMEOUT_MILLIS = Duration.ofSeconds(1).toMillis(); | 17 | private static final long TIMEOUT_MILLIS = Duration.ofSeconds(1).toMillis(); |
18 | 18 | ||
19 | private boolean finished = false; | 19 | private boolean finished = false; |
20 | 20 | ||
21 | private Object lock = new Object(); | 21 | private final Object lock = new Object(); |
22 | 22 | ||
23 | private Throwable error; | 23 | private Throwable error; |
24 | 24 | ||
25 | private int closeStatusCode; | 25 | private int closeStatusCode; |
26 | 26 | ||
27 | private List<String> responses = new ArrayList<>(); | 27 | private final List<String> responses = new ArrayList<>(); |
28 | 28 | ||
29 | public int getCloseStatusCode() { | 29 | public int getCloseStatusCode() { |
30 | return closeStatusCode; | 30 | return closeStatusCode; |
31 | } | 31 | } |
32 | 32 | ||
33 | public List<String> getResponses() { | 33 | public List<String> getResponses() { |
34 | return responses; | 34 | return responses; |
35 | } | 35 | } |
@@ -38,7 +38,7 @@ public abstract class WebSocketIntegrationTestClient { | |||
38 | public void onConnect(Session session) { | 38 | public void onConnect(Session session) { |
39 | arrangeAndCatchErrors(session); | 39 | arrangeAndCatchErrors(session); |
40 | } | 40 | } |
41 | 41 | ||
42 | private void arrangeAndCatchErrors(Session session) { | 42 | private void arrangeAndCatchErrors(Session session) { |
43 | try { | 43 | try { |
44 | arrange(session, responses.size()); | 44 | arrange(session, responses.size()); |
@@ -46,8 +46,8 @@ public abstract class WebSocketIntegrationTestClient { | |||
46 | finishedWithError(e); | 46 | finishedWithError(e); |
47 | } | 47 | } |
48 | } | 48 | } |
49 | 49 | ||
50 | protected abstract void arrange(Session session, int responsesReceived) throws IOException; | 50 | protected abstract void arrange(Session session, int responsesReceived) throws IOException; |
51 | 51 | ||
52 | @OnWebSocketClose | 52 | @OnWebSocketClose |
53 | public void onClose(int statusCode, String reason) { | 53 | 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 5b8fedba..83030b2b 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,16 +1,6 @@ | |||
1 | package tools.refinery.language.web.xtext.servlet; | 1 | package tools.refinery.language.web.xtext.servlet; |
2 | 2 | ||
3 | import static org.hamcrest.MatcherAssert.assertThat; | 3 | import com.google.inject.Inject; |
4 | import static org.hamcrest.Matchers.equalTo; | ||
5 | import static org.hamcrest.Matchers.hasProperty; | ||
6 | import static org.hamcrest.Matchers.instanceOf; | ||
7 | import static org.mockito.Mockito.mock; | ||
8 | import static org.mockito.Mockito.times; | ||
9 | import static org.mockito.Mockito.verify; | ||
10 | |||
11 | import java.util.List; | ||
12 | import java.util.Map; | ||
13 | |||
14 | import org.eclipse.emf.common.util.URI; | 4 | import org.eclipse.emf.common.util.URI; |
15 | import org.eclipse.xtext.resource.IResourceServiceProvider; | 5 | import org.eclipse.xtext.resource.IResourceServiceProvider; |
16 | import org.eclipse.xtext.testing.InjectWith; | 6 | import org.eclipse.xtext.testing.InjectWith; |
@@ -23,9 +13,6 @@ import org.junit.jupiter.api.Test; | |||
23 | import org.junit.jupiter.api.extension.ExtendWith; | 13 | import org.junit.jupiter.api.extension.ExtendWith; |
24 | import org.mockito.ArgumentCaptor; | 14 | import org.mockito.ArgumentCaptor; |
25 | import org.mockito.junit.jupiter.MockitoExtension; | 15 | import org.mockito.junit.jupiter.MockitoExtension; |
26 | |||
27 | import com.google.inject.Inject; | ||
28 | |||
29 | import tools.refinery.language.web.tests.AwaitTerminationExecutorServiceProvider; | 16 | import tools.refinery.language.web.tests.AwaitTerminationExecutorServiceProvider; |
30 | import tools.refinery.language.web.tests.ProblemWebInjectorProvider; | 17 | import tools.refinery.language.web.tests.ProblemWebInjectorProvider; |
31 | import tools.refinery.language.web.xtext.server.ResponseHandler; | 18 | import tools.refinery.language.web.xtext.server.ResponseHandler; |
@@ -35,6 +22,13 @@ import tools.refinery.language.web.xtext.server.message.XtextWebOkResponse; | |||
35 | import tools.refinery.language.web.xtext.server.message.XtextWebRequest; | 22 | import tools.refinery.language.web.xtext.server.message.XtextWebRequest; |
36 | import tools.refinery.language.web.xtext.server.message.XtextWebResponse; | 23 | import tools.refinery.language.web.xtext.server.message.XtextWebResponse; |
37 | 24 | ||
25 | import java.util.List; | ||
26 | import java.util.Map; | ||
27 | |||
28 | import static org.hamcrest.MatcherAssert.assertThat; | ||
29 | import static org.hamcrest.Matchers.*; | ||
30 | import static org.mockito.Mockito.*; | ||
31 | |||
38 | @ExtendWith(MockitoExtension.class) | 32 | @ExtendWith(MockitoExtension.class) |
39 | @ExtendWith(InjectionExtension.class) | 33 | @ExtendWith(InjectionExtension.class) |
40 | @InjectWith(ProblemWebInjectorProvider.class) | 34 | @InjectWith(ProblemWebInjectorProvider.class) |
@@ -92,7 +86,8 @@ class TransactionExecutorTest { | |||
92 | var stateId = updateFullText(); | 86 | var stateId = updateFullText(); |
93 | var responseHandler = sendRequestAndWaitForAllResponses( | 87 | var responseHandler = sendRequestAndWaitForAllResponses( |
94 | new XtextWebRequest("bar", Map.of("resource", RESOURCE_NAME, "serviceType", "update", "requiredStateId", | 88 | new XtextWebRequest("bar", Map.of("resource", RESOURCE_NAME, "serviceType", "update", "requiredStateId", |
95 | stateId, "deltaText", "indiv q.\nnode(q).\n", "deltaOffset", "0", "deltaReplaceLength", "0"))); | 89 | stateId, "deltaText", "individual q.\nnode(q).\n", "deltaOffset", "0", "deltaReplaceLength", |
90 | "0"))); | ||
96 | 91 | ||
97 | var captor = newCaptor(); | 92 | var captor = newCaptor(); |
98 | verify(responseHandler, times(2)).onResponse(captor.capture()); | 93 | verify(responseHandler, times(2)).onResponse(captor.capture()); |