From 93661619d3841ff62da9056a7c747e342fad7e66 Mon Sep 17 00:00:00 2001 From: KienHT Date: Fri, 12 Apr 2019 14:04:34 +0700 Subject: [PATCH 1/9] fix lifecycle if pass lifecycleOwner (Activity, Fragment) to Scarlet.Configuration --- .../lifecycle/android/LifecycleOwnerResumedLifecycle.kt | 5 +++-- .../lifecycle/android/LifecycleOwnerStartedLifecycle.kt | 5 +++-- .../com/tinder/scarlet/lifecycle/LifecycleStateUtils.kt | 9 ++++++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/LifecycleOwnerResumedLifecycle.kt b/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/LifecycleOwnerResumedLifecycle.kt index 70ad2364..a914f335 100644 --- a/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/LifecycleOwnerResumedLifecycle.kt +++ b/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/LifecycleOwnerResumedLifecycle.kt @@ -12,8 +12,8 @@ import com.tinder.scarlet.LifecycleState import com.tinder.scarlet.lifecycle.LifecycleRegistry internal class LifecycleOwnerResumedLifecycle( - private val lifecycleOwner: LifecycleOwner, - private val lifecycleRegistry: LifecycleRegistry + private val lifecycleOwner: LifecycleOwner, + private val lifecycleRegistry: LifecycleRegistry ) : Lifecycle by lifecycleRegistry { init { @@ -34,6 +34,7 @@ internal class LifecycleOwnerResumedLifecycle( @OnLifecycleEvent(androidx.lifecycle.Lifecycle.Event.ON_DESTROY) fun onDestroy() { lifecycleRegistry.onComplete() + lifecycleOwner.lifecycle.removeObserver(this) } } } diff --git a/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/LifecycleOwnerStartedLifecycle.kt b/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/LifecycleOwnerStartedLifecycle.kt index 08c0dfa0..a42e7a8c 100644 --- a/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/LifecycleOwnerStartedLifecycle.kt +++ b/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/LifecycleOwnerStartedLifecycle.kt @@ -12,8 +12,8 @@ import com.tinder.scarlet.LifecycleState import com.tinder.scarlet.lifecycle.LifecycleRegistry internal class LifecycleOwnerStartedLifecycle( - private val lifecycleOwner: LifecycleOwner, - private val lifecycleRegistry: LifecycleRegistry + private val lifecycleOwner: LifecycleOwner, + private val lifecycleRegistry: LifecycleRegistry ) : Lifecycle by lifecycleRegistry { init { @@ -34,6 +34,7 @@ internal class LifecycleOwnerStartedLifecycle( @OnLifecycleEvent(androidx.lifecycle.Lifecycle.Event.ON_DESTROY) fun onDestroy() { lifecycleRegistry.onComplete() + lifecycleOwner.lifecycle.removeObserver(this) } } } \ No newline at end of file diff --git a/scarlet/src/main/java/com/tinder/scarlet/lifecycle/LifecycleStateUtils.kt b/scarlet/src/main/java/com/tinder/scarlet/lifecycle/LifecycleStateUtils.kt index e76270e1..f6a355c8 100644 --- a/scarlet/src/main/java/com/tinder/scarlet/lifecycle/LifecycleStateUtils.kt +++ b/scarlet/src/main/java/com/tinder/scarlet/lifecycle/LifecycleStateUtils.kt @@ -8,8 +8,11 @@ import com.tinder.scarlet.LifecycleState internal fun List.combine(): LifecycleState { val shouldStop = any { it == LifecycleState.Stopped } - if (shouldStop) { - return LifecycleState.Stopped + val completed = any { it == LifecycleState.Completed } + + return when { + shouldStop -> LifecycleState.Stopped + completed -> LifecycleState.Completed + else -> LifecycleState.Started } - return LifecycleState.Started } From 48776ff07187046e0d2ddc3e588ce3b79224711b Mon Sep 17 00:00:00 2001 From: KienHT Date: Sun, 14 Apr 2019 17:22:49 +0700 Subject: [PATCH 2/9] unregister connectivity broadcast receiver when lifecycleState = Completed --- .../android/ConnectivityOnLifecycle.kt | 20 ++++++++---- .../scarlet/lifecycle/FlowableLifecycle.kt | 32 +++++++++++++++++-- 2 files changed, 44 insertions(+), 8 deletions(-) diff --git a/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/ConnectivityOnLifecycle.kt b/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/ConnectivityOnLifecycle.kt index efdf3951..5b3d07a0 100644 --- a/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/ConnectivityOnLifecycle.kt +++ b/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/ConnectivityOnLifecycle.kt @@ -4,6 +4,7 @@ package com.tinder.scarlet.lifecycle.android +import android.annotation.SuppressLint import android.content.BroadcastReceiver import android.content.Context import android.content.Intent @@ -14,10 +15,12 @@ import com.tinder.scarlet.LifecycleState import com.tinder.scarlet.lifecycle.LifecycleRegistry internal class ConnectivityOnLifecycle( - applicationContext: Context, - private val lifecycleRegistry: LifecycleRegistry = LifecycleRegistry() + private val applicationContext: Context, + private val lifecycleRegistry: LifecycleRegistry = LifecycleRegistry() ) : Lifecycle by lifecycleRegistry { + private val connectivityChangeBroadcastReceiver = ConnectivityChangeBroadcastReceiver() + init { emitCurrentConnectivity(applicationContext) subscribeToConnectivityChange(applicationContext) @@ -25,16 +28,16 @@ internal class ConnectivityOnLifecycle( private fun emitCurrentConnectivity(applicationContext: Context) { val connectivityManager = - applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager + applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager lifecycleRegistry.onNext(toLifecycleState(connectivityManager.isConnected())) } private fun subscribeToConnectivityChange(applicationContext: Context) { - val intentFilter = IntentFilter() - .apply { addAction(ConnectivityManager.CONNECTIVITY_ACTION) } - applicationContext.registerReceiver(ConnectivityChangeBroadcastReceiver(), intentFilter) + val intentFilter = IntentFilter().apply { addAction(ConnectivityManager.CONNECTIVITY_ACTION) } + applicationContext.registerReceiver(connectivityChangeBroadcastReceiver, intentFilter) } + @SuppressLint("MissingPermission") private fun ConnectivityManager.isConnected(): Boolean { val activeNetworkInfo = activeNetworkInfo return activeNetworkInfo != null && activeNetworkInfo.isConnectedOrConnecting @@ -46,6 +49,10 @@ internal class ConnectivityOnLifecycle( LifecycleState.Stopped } + fun unregisterReceiver() { + applicationContext.unregisterReceiver(connectivityChangeBroadcastReceiver) + } + private inner class ConnectivityChangeBroadcastReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { val extras = intent.extras ?: return @@ -54,3 +61,4 @@ internal class ConnectivityOnLifecycle( } } } + diff --git a/scarlet/src/main/java/com/tinder/scarlet/lifecycle/FlowableLifecycle.kt b/scarlet/src/main/java/com/tinder/scarlet/lifecycle/FlowableLifecycle.kt index d8155b3d..e4688243 100644 --- a/scarlet/src/main/java/com/tinder/scarlet/lifecycle/FlowableLifecycle.kt +++ b/scarlet/src/main/java/com/tinder/scarlet/lifecycle/FlowableLifecycle.kt @@ -8,14 +8,42 @@ import com.tinder.scarlet.Lifecycle import com.tinder.scarlet.LifecycleState import io.reactivex.Flowable import org.reactivestreams.Publisher +import java.lang.reflect.Method internal class FlowableLifecycle( - private val flowable: Flowable + private val flowable: Flowable ) : Lifecycle, Publisher by flowable { + companion object { + const val CONNECTIVITY_ON_LIFECYCLE_CLASS_NAME = "com.tinder.scarlet.lifecycle.android.ConnectivityOnLifecycle" + const val UNREGISTER_CONNECTIVITY_BROADCAST_RECEIVER_METHOD_NAME = "unregisterReceiver" + } + override fun combineWith(others: List): Lifecycle { val lifecycles = others + this - val flowable = Flowable.combineLatest(lifecycles) { it.map { it as LifecycleState }.combine() } + + val flowable = + Flowable.combineLatest(lifecycles) { lifecycle -> + val state = lifecycle.map { it as LifecycleState }.combine() + lifecycles.unregisterConnectivityBroadcastReceiver(state) + state + } return FlowableLifecycle(flowable) } + + private fun List.unregisterConnectivityBroadcastReceiver(state: LifecycleState) { + if (state == LifecycleState.Completed) { + val connectivityClazz: Class<*>? = Class.forName(CONNECTIVITY_ON_LIFECYCLE_CLASS_NAME) + connectivityClazz?.let { + val connectivityOnLifecycle: Lifecycle? = this.find { connectivityClazz.isInstance(it) } + connectivityOnLifecycle?.let { + val obj: Any? = connectivityClazz.cast(connectivityOnLifecycle) + val method: Method? = connectivityClazz.getMethod(UNREGISTER_CONNECTIVITY_BROADCAST_RECEIVER_METHOD_NAME) + if (obj != null && method != null) { + method.invoke(obj) + } + } + } + } + } } From d77d1c20887e160dd542cf63ea0ac0cd53a7f74c Mon Sep 17 00:00:00 2001 From: KienHT Date: Sun, 14 Apr 2019 17:57:59 +0700 Subject: [PATCH 3/9] handle if receiver not registered --- .../scarlet/lifecycle/android/ConnectivityOnLifecycle.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/ConnectivityOnLifecycle.kt b/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/ConnectivityOnLifecycle.kt index 5b3d07a0..c1b6c717 100644 --- a/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/ConnectivityOnLifecycle.kt +++ b/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/ConnectivityOnLifecycle.kt @@ -13,6 +13,7 @@ import android.net.ConnectivityManager import com.tinder.scarlet.Lifecycle import com.tinder.scarlet.LifecycleState import com.tinder.scarlet.lifecycle.LifecycleRegistry +import java.lang.Exception internal class ConnectivityOnLifecycle( private val applicationContext: Context, @@ -50,7 +51,10 @@ internal class ConnectivityOnLifecycle( } fun unregisterReceiver() { - applicationContext.unregisterReceiver(connectivityChangeBroadcastReceiver) + try { + applicationContext.unregisterReceiver(connectivityChangeBroadcastReceiver) + } catch (e: Exception) { + } } private inner class ConnectivityChangeBroadcastReceiver : BroadcastReceiver() { From 9aca0deb380989e8eea3e6c9bd68abe1107821d5 Mon Sep 17 00:00:00 2001 From: KienHT Date: Sun, 14 Apr 2019 18:21:50 +0700 Subject: [PATCH 4/9] handle exception get class for name --- .../java/com/tinder/scarlet/lifecycle/FlowableLifecycle.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scarlet/src/main/java/com/tinder/scarlet/lifecycle/FlowableLifecycle.kt b/scarlet/src/main/java/com/tinder/scarlet/lifecycle/FlowableLifecycle.kt index e4688243..802e9655 100644 --- a/scarlet/src/main/java/com/tinder/scarlet/lifecycle/FlowableLifecycle.kt +++ b/scarlet/src/main/java/com/tinder/scarlet/lifecycle/FlowableLifecycle.kt @@ -25,7 +25,10 @@ internal class FlowableLifecycle( val flowable = Flowable.combineLatest(lifecycles) { lifecycle -> val state = lifecycle.map { it as LifecycleState }.combine() - lifecycles.unregisterConnectivityBroadcastReceiver(state) + try { + lifecycles.unregisterConnectivityBroadcastReceiver(state) + } catch (e: Exception) { + } state } return FlowableLifecycle(flowable) From e8a9676b02af38a18d3041539c943ac5fc63972c Mon Sep 17 00:00:00 2001 From: KienHT Date: Mon, 15 Apr 2019 14:13:52 +0700 Subject: [PATCH 5/9] Made a trivial change on the one test so that this triggers CI again. --- .../java/com/tindre/scarlet/stomp/StompIntegrationTest.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scarlet-protocol-stomp/src/test/java/com/tindre/scarlet/stomp/StompIntegrationTest.kt b/scarlet-protocol-stomp/src/test/java/com/tindre/scarlet/stomp/StompIntegrationTest.kt index 9bcaa347..23ed0602 100644 --- a/scarlet-protocol-stomp/src/test/java/com/tindre/scarlet/stomp/StompIntegrationTest.kt +++ b/scarlet-protocol-stomp/src/test/java/com/tindre/scarlet/stomp/StompIntegrationTest.kt @@ -53,12 +53,13 @@ class StompIntegrationTest { connection1.open() connection1.client.sendText("message1") connection1.client.sendText("message2") + connection1.client.sendText("message3") connection1.clientClosure() connection2.open() LOGGER.info("${queueTextObserver.values}") - queueTextObserver.awaitCount(2) + queueTextObserver.awaitCount(3) } @Test @@ -69,6 +70,7 @@ class StompIntegrationTest { connection1.begin("tx1") connection1.send(DESTINATION, "message1", "tx1", null) connection1.send(DESTINATION, "message2", "tx1", null) + connection1.send(DESTINATION, "message3", "tx1", null) connection1.commit("tx1") connection1.disconnect() @@ -76,7 +78,7 @@ class StompIntegrationTest { val queueTextObserver = connection2.client.observeText().test() - queueTextObserver.awaitCount(2) + queueTextObserver.awaitCount(3) LOGGER.info("${queueTextObserver.values}") } From 2a6dfde096a059914c3784fcde76006d50512587 Mon Sep 17 00:00:00 2001 From: KienHT Date: Mon, 15 Apr 2019 14:23:16 +0700 Subject: [PATCH 6/9] LifecycleOwnerResumedLifecycle, LifecycleOwnerStartedLifecycle should implement LifecycleObserver --- .../android/LifecycleOwnerResumedLifecycle.kt | 30 +++++++++---------- .../android/LifecycleOwnerStartedLifecycle.kt | 30 +++++++++---------- 2 files changed, 28 insertions(+), 32 deletions(-) diff --git a/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/LifecycleOwnerResumedLifecycle.kt b/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/LifecycleOwnerResumedLifecycle.kt index a914f335..e665c86a 100644 --- a/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/LifecycleOwnerResumedLifecycle.kt +++ b/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/LifecycleOwnerResumedLifecycle.kt @@ -14,27 +14,25 @@ import com.tinder.scarlet.lifecycle.LifecycleRegistry internal class LifecycleOwnerResumedLifecycle( private val lifecycleOwner: LifecycleOwner, private val lifecycleRegistry: LifecycleRegistry -) : Lifecycle by lifecycleRegistry { +) : LifecycleObserver, Lifecycle by lifecycleRegistry { init { - lifecycleOwner.lifecycle.addObserver(ALifecycleObserver()) + lifecycleOwner.lifecycle.addObserver(this) } - private inner class ALifecycleObserver : LifecycleObserver { - @OnLifecycleEvent(androidx.lifecycle.Lifecycle.Event.ON_PAUSE) - fun onPause() { - lifecycleRegistry.onNext(LifecycleState.Stopped) - } + @OnLifecycleEvent(androidx.lifecycle.Lifecycle.Event.ON_PAUSE) + fun onPause() { + lifecycleRegistry.onNext(LifecycleState.Stopped) + } - @OnLifecycleEvent(androidx.lifecycle.Lifecycle.Event.ON_RESUME) - fun onResume() { - lifecycleRegistry.onNext(LifecycleState.Started) - } + @OnLifecycleEvent(androidx.lifecycle.Lifecycle.Event.ON_RESUME) + fun onResume() { + lifecycleRegistry.onNext(LifecycleState.Started) + } - @OnLifecycleEvent(androidx.lifecycle.Lifecycle.Event.ON_DESTROY) - fun onDestroy() { - lifecycleRegistry.onComplete() - lifecycleOwner.lifecycle.removeObserver(this) - } + @OnLifecycleEvent(androidx.lifecycle.Lifecycle.Event.ON_DESTROY) + fun onDestroy() { + lifecycleRegistry.onComplete() + lifecycleOwner.lifecycle.removeObserver(this) } } diff --git a/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/LifecycleOwnerStartedLifecycle.kt b/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/LifecycleOwnerStartedLifecycle.kt index a42e7a8c..36099136 100644 --- a/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/LifecycleOwnerStartedLifecycle.kt +++ b/scarlet-lifecycle-android/src/main/java/com/tinder/scarlet/lifecycle/android/LifecycleOwnerStartedLifecycle.kt @@ -14,27 +14,25 @@ import com.tinder.scarlet.lifecycle.LifecycleRegistry internal class LifecycleOwnerStartedLifecycle( private val lifecycleOwner: LifecycleOwner, private val lifecycleRegistry: LifecycleRegistry -) : Lifecycle by lifecycleRegistry { +) : LifecycleObserver, Lifecycle by lifecycleRegistry { init { - lifecycleOwner.lifecycle.addObserver(ALifecycleObserver()) + lifecycleOwner.lifecycle.addObserver(this) } - private inner class ALifecycleObserver : LifecycleObserver { - @OnLifecycleEvent(androidx.lifecycle.Lifecycle.Event.ON_STOP) - fun onPause() { - lifecycleRegistry.onNext(LifecycleState.Stopped) - } + @OnLifecycleEvent(androidx.lifecycle.Lifecycle.Event.ON_STOP) + fun onPause() { + lifecycleRegistry.onNext(LifecycleState.Stopped) + } - @OnLifecycleEvent(androidx.lifecycle.Lifecycle.Event.ON_START) - fun onResume() { - lifecycleRegistry.onNext(LifecycleState.Started) - } + @OnLifecycleEvent(androidx.lifecycle.Lifecycle.Event.ON_START) + fun onResume() { + lifecycleRegistry.onNext(LifecycleState.Started) + } - @OnLifecycleEvent(androidx.lifecycle.Lifecycle.Event.ON_DESTROY) - fun onDestroy() { - lifecycleRegistry.onComplete() - lifecycleOwner.lifecycle.removeObserver(this) - } + @OnLifecycleEvent(androidx.lifecycle.Lifecycle.Event.ON_DESTROY) + fun onDestroy() { + lifecycleRegistry.onComplete() + lifecycleOwner.lifecycle.removeObserver(this) } } \ No newline at end of file From 9daf864e76aa01a4eb3d84dd1e63d40b6507b663 Mon Sep 17 00:00:00 2001 From: KienHT Date: Mon, 15 Apr 2019 14:29:46 +0700 Subject: [PATCH 7/9] Made a trivial change on the one test so that this triggers CI again. --- .../java/com/tindre/scarlet/stomp/StompIntegrationTest.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scarlet-protocol-stomp/src/test/java/com/tindre/scarlet/stomp/StompIntegrationTest.kt b/scarlet-protocol-stomp/src/test/java/com/tindre/scarlet/stomp/StompIntegrationTest.kt index 23ed0602..9003e325 100644 --- a/scarlet-protocol-stomp/src/test/java/com/tindre/scarlet/stomp/StompIntegrationTest.kt +++ b/scarlet-protocol-stomp/src/test/java/com/tindre/scarlet/stomp/StompIntegrationTest.kt @@ -54,12 +54,13 @@ class StompIntegrationTest { connection1.client.sendText("message1") connection1.client.sendText("message2") connection1.client.sendText("message3") + connection1.client.sendText("message4") connection1.clientClosure() connection2.open() LOGGER.info("${queueTextObserver.values}") - queueTextObserver.awaitCount(3) + queueTextObserver.awaitCount(4) } @Test @@ -71,6 +72,7 @@ class StompIntegrationTest { connection1.send(DESTINATION, "message1", "tx1", null) connection1.send(DESTINATION, "message2", "tx1", null) connection1.send(DESTINATION, "message3", "tx1", null) + connection1.send(DESTINATION, "message4", "tx1", null) connection1.commit("tx1") connection1.disconnect() @@ -78,7 +80,7 @@ class StompIntegrationTest { val queueTextObserver = connection2.client.observeText().test() - queueTextObserver.awaitCount(3) + queueTextObserver.awaitCount(4) LOGGER.info("${queueTextObserver.values}") } From 985f06a484f774d8ff95ebe387d367aa106f8be0 Mon Sep 17 00:00:00 2001 From: KienHT Date: Mon, 15 Apr 2019 14:37:06 +0700 Subject: [PATCH 8/9] Made a trivial change on the one test so that this triggers CI again. --- .../com/tinder/scarlet/streamadapter/rxjava2/FlowableTest.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scarlet-stream-adapter-rxjava2/src/test/java/com/tinder/scarlet/streamadapter/rxjava2/FlowableTest.kt b/scarlet-stream-adapter-rxjava2/src/test/java/com/tinder/scarlet/streamadapter/rxjava2/FlowableTest.kt index ea5a1fce..e14fdeff 100644 --- a/scarlet-stream-adapter-rxjava2/src/test/java/com/tinder/scarlet/streamadapter/rxjava2/FlowableTest.kt +++ b/scarlet-stream-adapter-rxjava2/src/test/java/com/tinder/scarlet/streamadapter/rxjava2/FlowableTest.kt @@ -38,8 +38,8 @@ internal class FlowableTest { fun send_givenConnectionIsEstablished_shouldBeReceivedByTheServer() { // Given connection.open() - val textMessage1 = "Hello" - val textMessage2 = "Hi" + val textMessage1 = "Hello!" + val textMessage2 = "Hi!" val bytesMessage1 = "Yo".toByteArray() val bytesMessage2 = "Sup".toByteArray() val testTextSubscriber = connection.server.observeText().test() From da1cc2b6747ccd01a6ed0b3cb92a1100e49e9d4f Mon Sep 17 00:00:00 2001 From: KienHT Date: Tue, 16 Apr 2019 14:24:22 +0700 Subject: [PATCH 9/9] Made a trivial change on the one test so that this triggers CI again. --- .../java/com/tindre/scarlet/stomp/StompIntegrationTest.kt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/scarlet-protocol-stomp/src/test/java/com/tindre/scarlet/stomp/StompIntegrationTest.kt b/scarlet-protocol-stomp/src/test/java/com/tindre/scarlet/stomp/StompIntegrationTest.kt index 9003e325..23ed0602 100644 --- a/scarlet-protocol-stomp/src/test/java/com/tindre/scarlet/stomp/StompIntegrationTest.kt +++ b/scarlet-protocol-stomp/src/test/java/com/tindre/scarlet/stomp/StompIntegrationTest.kt @@ -54,13 +54,12 @@ class StompIntegrationTest { connection1.client.sendText("message1") connection1.client.sendText("message2") connection1.client.sendText("message3") - connection1.client.sendText("message4") connection1.clientClosure() connection2.open() LOGGER.info("${queueTextObserver.values}") - queueTextObserver.awaitCount(4) + queueTextObserver.awaitCount(3) } @Test @@ -72,7 +71,6 @@ class StompIntegrationTest { connection1.send(DESTINATION, "message1", "tx1", null) connection1.send(DESTINATION, "message2", "tx1", null) connection1.send(DESTINATION, "message3", "tx1", null) - connection1.send(DESTINATION, "message4", "tx1", null) connection1.commit("tx1") connection1.disconnect() @@ -80,7 +78,7 @@ class StompIntegrationTest { val queueTextObserver = connection2.client.observeText().test() - queueTextObserver.awaitCount(4) + queueTextObserver.awaitCount(3) LOGGER.info("${queueTextObserver.values}") }