File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
main/kotlin/org/modelix/model/server/handlers
test/kotlin/org/modelix/model/server Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ class DeprecatedLightModelServer(val client: LocalModelClient) {
163
163
val oldVersion = CLVersion .loadFromHash(versionHash, getStore())
164
164
respondVersion(version, oldVersion)
165
165
}
166
- webSocket(" /{repositoryId}/ws" ) {
166
+ webSocket(" /json/ {repositoryId}/ws" ) {
167
167
val repositoryId = RepositoryId (call.parameters[" repositoryId" ]!! )
168
168
val userId = call.getUserName()
169
169
Original file line number Diff line number Diff line change 14
14
15
15
package org.modelix.model.server
16
16
17
+ import io.ktor.client.plugins.websocket.webSocketSession
17
18
import io.ktor.client.request.get
18
19
import io.ktor.client.request.post
19
20
import io.ktor.client.request.setBody
@@ -40,6 +41,7 @@ import org.modelix.model.server.store.LocalModelClient
40
41
import kotlin.test.Test
41
42
import kotlin.test.assertEquals
42
43
import kotlin.test.assertNotNull
44
+ import kotlin.test.fail
43
45
44
46
class JsonAPITest {
45
47
private fun runTest (block : suspend ApplicationTestBuilder .() -> Unit ) = testApplication {
@@ -61,6 +63,18 @@ class JsonAPITest {
61
63
assertEmptyVersion(JSONObject (response.bodyAsText()))
62
64
}
63
65
66
+ @Test
67
+ fun connectToWebsocket () = runTest {
68
+ val client = createClient {
69
+ install(io.ktor.client.plugins.websocket.WebSockets )
70
+ }
71
+ try {
72
+ client.webSocketSession(" ws://localhost/json/$repoId /ws" )
73
+ } catch (e: Exception ) {
74
+ fail(" Could not connect to WebSocket" , e)
75
+ }
76
+ }
77
+
64
78
private fun assertEmptyVersion (json : JSONObject ) {
65
79
assertEquals(json.getJSONObject(" root" ).getString(" nodeId" ).toLong(), 1L )
66
80
assertEquals(json.getString(" repositoryId" ), repoId)
You can’t perform that action at this time.
0 commit comments