Merge branch 'headless-fixes' into 'master'

Headless fixes

See merge request briar/briar!985
This commit is contained in:
akwizgran
2018-11-08 10:55:28 +00:00
6 changed files with 20 additions and 24 deletions

View File

@@ -171,7 +171,8 @@ You can test connecting to the websocket with curl:
--header "Upgrade: websocket" \ --header "Upgrade: websocket" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \ --header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \ --header "Sec-WebSocket-Version: 13" \
http://DZbfoUie8sjap7CSDR9y6cgJCojV+xUITTIFbgtAgqk=@127.0.0.1:7000/v1/ws --user "DZbfoUie8sjap7CSDR9y6cgJCojV+xUITTIFbgtAgqk="
http://127.0.0.1:7000/v1/ws
The headers are only required when testing with curl. The headers are only required when testing with curl.
Your websocket client will most likely add these headers automatically. Your websocket client will most likely add these headers automatically.

View File

@@ -14,7 +14,7 @@ dependencies {
implementation project(path: ':briar-core', configuration: 'default') implementation project(path: ':briar-core', configuration: 'default')
implementation project(path: ':bramble-java', configuration: 'default') implementation project(path: ':bramble-java', configuration: 'default')
implementation 'io.javalin:javalin:2.3.0' implementation 'io.javalin:javalin:2.4.0'
implementation 'org.slf4j:slf4j-simple:1.7.25' implementation 'org.slf4j:slf4j-simple:1.7.25'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.7' implementation 'com.fasterxml.jackson.core:jackson-databind:2.9.7'
implementation 'com.github.ajalt:clikt:1.5.0' implementation 'com.github.ajalt:clikt:1.5.0'
@@ -28,7 +28,7 @@ dependencies {
testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion" testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion" testImplementation "org.junit.jupiter:junit-jupiter-params:$junitVersion"
testRuntime "org.junit.jupiter:junit-jupiter-engine:$junitVersion" testRuntime "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
testImplementation "io.mockk:mockk:1.8.9" testImplementation "io.mockk:mockk:1.8.12"
testImplementation "org.skyscreamer:jsonassert:1.5.0" testImplementation "org.skyscreamer:jsonassert:1.5.0"
} }

View File

@@ -81,9 +81,9 @@ constructor(
override fun eventOccurred(e: Event) { override fun eventOccurred(e: Event) {
when (e) { when (e) {
is ConversationMessageReceivedEvent<*> -> dbExecutor.execute { is ConversationMessageReceivedEvent<*> -> {
val h = e.messageHeader val h = e.messageHeader
if (h is PrivateMessageHeader) { if (h is PrivateMessageHeader) dbExecutor.execute {
val text = messagingManager.getMessageText(h.id) val text = messagingManager.getMessageText(h.id)
webSocketController.sendEvent(EVENT_CONVERSATION_MESSAGE, e.output(text)) webSocketController.sendEvent(EVENT_CONVERSATION_MESSAGE, e.output(text))
} else { } else {

View File

@@ -23,13 +23,10 @@ internal fun ConversationMessageHeader.output(contactId: ContactId, text: String
return dict return dict
} }
internal fun PrivateMessageHeader.output(contactId: ContactId, text: String?): JsonDict { internal fun PrivateMessageHeader.output(contactId: ContactId, text: String?) =
val dict = (this as ConversationMessageHeader).output(contactId, text) (this as ConversationMessageHeader).output(contactId, text).apply {
dict.putAll( put("type", "PrivateMessage")
"type" to "PrivateMessage" }
)
return dict
}
/** /**
* Use only for outgoing messages that were just sent * Use only for outgoing messages that were just sent

View File

@@ -69,8 +69,6 @@ internal class WebSocketControllerTest : ControllerTest() {
@Test @Test
fun testIntroductionRequestEvent() { fun testIntroductionRequestEvent() {
val sessionId = SessionId(getRandomId())
val authorInfo = AuthorInfo(VERIFIED)
val introductionRequest = IntroductionRequest( val introductionRequest = IntroductionRequest(
message.id, message.id,
group.id, group.id,
@@ -79,11 +77,11 @@ internal class WebSocketControllerTest : ControllerTest() {
true, true,
true, true,
true, true,
sessionId, SessionId(getRandomId()),
author, author,
text, text,
false, false,
authorInfo AuthorInfo(VERIFIED)
) )
val introductionRequestEvent = val introductionRequestEvent =
IntroductionRequestReceivedEvent(introductionRequest, contact.id) IntroductionRequestReceivedEvent(introductionRequest, contact.id)

View File

@@ -16,14 +16,14 @@ dependencyVerification {
'com.google.j2objc:j2objc-annotations:1.1:j2objc-annotations-1.1.jar:40ceb7157feb263949e0f503fe5f71689333a621021aa20ce0d0acee3badaa0f', 'com.google.j2objc:j2objc-annotations:1.1:j2objc-annotations-1.1.jar:40ceb7157feb263949e0f503fe5f71689333a621021aa20ce0d0acee3badaa0f',
'com.squareup:javapoet:1.11.1:javapoet-1.11.1.jar:9cbf2107be499ec6e95afd36b58e3ca122a24166cdd375732e51267d64058e90', 'com.squareup:javapoet:1.11.1:javapoet-1.11.1.jar:9cbf2107be499ec6e95afd36b58e3ca122a24166cdd375732e51267d64058e90',
'com.vaadin.external.google:android-json:0.0.20131108.vaadin1:android-json-0.0.20131108.vaadin1.jar:dfb7bae2f404cfe0b72b4d23944698cb716b7665171812a0a4d0f5926c0fac79', 'com.vaadin.external.google:android-json:0.0.20131108.vaadin1:android-json-0.0.20131108.vaadin1.jar:dfb7bae2f404cfe0b72b4d23944698cb716b7665171812a0a4d0f5926c0fac79',
'io.javalin:javalin:2.3.0:javalin-2.3.0.jar:3571e83863e1f163854f1b2ee3cbfc1336fcbdfa595ec9c2ed8ab8bfa792e5f4', 'io.javalin:javalin:2.4.0:javalin-2.4.0.jar:f23b5e2b63a501e369372fc08f06fc92ace0881f7e13bab17fb41f7c31b34bf1',
'io.mockk:mockk-agent-api:1.8.9:mockk-agent-api-1.8.9.jar:8cbc0adc0f349f891d44ffdaba55c68271790ce9c33cc437d2be86a5af572d6c', 'io.mockk:mockk-agent-api:1.8.12:mockk-agent-api-1.8.12.jar:ab956f74d7b2f6926234edd2cc1ff89231056c47ede21b8cfaf405fd9650f502',
'io.mockk:mockk-agent-common:1.8.9:mockk-agent-common-1.8.9.jar:a67b8bb696f91023e4446e2c8594c652924a350422047c96f31031be2a8de54a', 'io.mockk:mockk-agent-common:1.8.12:mockk-agent-common-1.8.12.jar:58c3cec1bea418d1995889345a06aca21d041914d3e70b81075cf2dbf6806815',
'io.mockk:mockk-agent-jvm:1.8.9:mockk-agent-jvm-1.8.9.jar:4a8b83501e0fda6f79601e073c9e419dc649eeb8d18645ae0d60c64f1e671076', 'io.mockk:mockk-agent-jvm:1.8.12:mockk-agent-jvm-1.8.12.jar:88f3376e1e5607a6f14ac7747ded8ce72c9ca6f3ee203c207e373566b2bea861',
'io.mockk:mockk-common:1.8.9:mockk-common-1.8.9.jar:a3fb4d3fa776dde4eab2cc49e5df68fa394064df47431e2add9fc2100f3a145f', 'io.mockk:mockk-common:1.8.12:mockk-common-1.8.12.jar:317ac52976ed8bcebb218e3506b34b273a056b6c6840c1db30a05c9a6971e8ca',
'io.mockk:mockk-dsl-jvm:1.8.9:mockk-dsl-jvm-1.8.9.jar:d6cfda3ba94b3fba2826c4554a33866a5559df9326fb28b559078fcb4508e60d', 'io.mockk:mockk-dsl-jvm:1.8.12:mockk-dsl-jvm-1.8.12.jar:44797b66dcc0a774084b4b444a1d61ebf7d81e480be2f24f184b186d790ce525',
'io.mockk:mockk-dsl:1.8.9:mockk-dsl-1.8.9.jar:e24f0de13e12227544a68dae13f4fae4dd376f5d1eac796d3f4594989c0f2e68', 'io.mockk:mockk-dsl:1.8.12:mockk-dsl-1.8.12.jar:ed72ba909ffb737bb972342df5eda73de72510e8fef9e20fc4dac7806e73a029',
'io.mockk:mockk:1.8.9:mockk-1.8.9.jar:9ead145f12b086af1d15eb4bf0fa5ccee02781b69937be6f77f47ac03100f526', 'io.mockk:mockk:1.8.12:mockk-1.8.12.jar:3ad1a39322c2088d7803ff9840e8f9896623530b4cdb2e107957c2b8201fc789',
'javax.annotation:jsr250-api:1.0:jsr250-api-1.0.jar:a1a922d0d9b6d183ed3800dfac01d1e1eb159f0e8c6f94736931c1def54a941f', 'javax.annotation:jsr250-api:1.0:jsr250-api-1.0.jar:a1a922d0d9b6d183ed3800dfac01d1e1eb159f0e8c6f94736931c1def54a941f',
'javax.inject:javax.inject:1:javax.inject-1.jar:91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff', 'javax.inject:javax.inject:1:javax.inject-1.jar:91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff',
'javax.servlet:javax.servlet-api:3.1.0:javax.servlet-api-3.1.0.jar:af456b2dd41c4e82cf54f3e743bc678973d9fe35bd4d3071fa05c7e5333b8482', 'javax.servlet:javax.servlet-api:3.1.0:javax.servlet-api-3.1.0.jar:af456b2dd41c4e82cf54f3e743bc678973d9fe35bd4d3071fa05c7e5333b8482',