Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-cebo committed Oct 28, 2024
1 parent cb101dd commit 59c8a12
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 45 deletions.
32 changes: 14 additions & 18 deletions pubnub-kotlin/pubnub-kotlin-api/config/ktlint/baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,20 @@
<error line="467" column="15" source="standard:class-naming" />
<error line="483" column="15" source="standard:class-naming" />
<error line="496" column="15" source="standard:class-naming" />
<error line="840" column="13" source="standard:property-naming" />
<error line="1023" column="15" source="standard:class-naming" />
<error line="1029" column="15" source="standard:class-naming" />
<error line="1148" column="13" source="standard:property-naming" />
<error line="1154" column="13" source="standard:property-naming" />
<error line="1156" column="13" source="standard:property-naming" />
<error line="1216" column="39" source="standard:comment-wrapping" />
<error line="1301" column="15" source="standard:class-naming" />
<error line="1329" column="42" source="standard:comment-wrapping" />
<error line="1379" column="37" source="standard:comment-wrapping" />
<error line="1400" column="13" source="standard:property-naming" />
<error line="841" column="13" source="standard:property-naming" />
<error line="1024" column="15" source="standard:class-naming" />
<error line="1030" column="15" source="standard:class-naming" />
<error line="1149" column="13" source="standard:property-naming" />
<error line="1155" column="13" source="standard:property-naming" />
<error line="1157" column="13" source="standard:property-naming" />
<error line="1217" column="39" source="standard:comment-wrapping" />
<error line="1302" column="15" source="standard:class-naming" />
<error line="1330" column="42" source="standard:comment-wrapping" />
<error line="1380" column="37" source="standard:comment-wrapping" />
<error line="1401" column="13" source="standard:property-naming" />
<error line="1405" column="13" source="standard:property-naming" />
<error line="1402" column="13" source="standard:property-naming" />
<error line="1406" column="13" source="standard:property-naming" />
<error line="1425" column="9" source="standard:property-naming" />
<error line="1407" column="13" source="standard:property-naming" />
<error line="1426" column="9" source="standard:property-naming" />
<error line="1427" column="9" source="standard:property-naming" />
<error line="1428" column="9" source="standard:property-naming" />
Expand All @@ -37,7 +36,7 @@
<error line="1435" column="9" source="standard:property-naming" />
<error line="1436" column="9" source="standard:property-naming" />
<error line="1437" column="9" source="standard:property-naming" />
<error line="1441" column="9" source="standard:property-naming" />
<error line="1438" column="9" source="standard:property-naming" />
<error line="1442" column="9" source="standard:property-naming" />
<error line="1443" column="9" source="standard:property-naming" />
<error line="1444" column="9" source="standard:property-naming" />
Expand Down Expand Up @@ -73,9 +72,6 @@
<error line="1474" column="9" source="standard:property-naming" />
<error line="1475" column="9" source="standard:property-naming" />
<error line="1476" column="9" source="standard:property-naming" />
</file>
<file name="src/jsMain/kotlin/com/pubnub/api/PubNubImpl.kt">
<error line="1122" column="5" source="standard:function-naming" />
<error line="1142" column="5" source="standard:function-naming" />
<error line="1477" column="9" source="standard:property-naming" />
</file>
</baseline>
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ class PubNubImpl(private val pubNubObjC: KMPPubNub) : PubNub {
includeUUID: Boolean,
includeMeta: Boolean,
includeMessageActions: Boolean,
includeMessageType: Boolean
includeMessageType: Boolean,
includeCustomMessageType: Boolean
): FetchMessages {
return FetchMessagesImpl(
pubnub = pubNubObjC,
Expand All @@ -318,7 +319,8 @@ class PubNubImpl(private val pubNubObjC: KMPPubNub) : PubNub {
includeUUID = includeUUID,
includeMeta = includeMeta,
includeMessageActions = includeMessageActions,
includeMessageType = includeMessageType
includeMessageType = includeMessageType,
includeCustomMessageType = includeCustomMessageType
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ open class FetchMessagesImpl(
private val includeUUID: Boolean,
private val includeMeta: Boolean,
private val includeMessageActions: Boolean,
private val includeMessageType: Boolean
private val includeMessageType: Boolean,
private val includeCustomMessageType: Boolean
) : FetchMessages {
override fun async(callback: Consumer<Result<PNFetchMessagesResult>>) {
pubnub.fetchMessagesFrom(
Expand All @@ -41,6 +42,7 @@ open class FetchMessagesImpl(
includeMeta = includeMeta,
includeMessageActions = includeMessageActions,
includeMessageType = includeMessageType,
// includeCustomMessageType = includeCustomMessageType, // todo
page = KMPBoundedPage(
start = page.start?.let { NSNumber(long = it) },
end = page.end?.let { NSNumber(long = it) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ open external class PubNub(config: Any /* UUID | UserId */) {
var includeUUID: Boolean?
var includeMeta: Boolean?
var includeMessageActions: Boolean?
var includeCustomMessageType: Boolean?
}

interface Action {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ class PubNubImpl(val jsPubNub: PubNubJs) : PubNub {
includeUUID: Boolean,
includeMeta: Boolean,
includeMessageActions: Boolean,
includeMessageType: Boolean
includeMessageType: Boolean,
includeCustomMessageType: Boolean
): FetchMessages {
return FetchMessagesImpl(
jsPubNub,
Expand All @@ -309,6 +310,7 @@ class PubNubImpl(val jsPubNub: PubNubJs) : PubNub {
this.includeMessageActions = includeMessageActions
this.includeMessageType = includeMessageType
this.stringifiedTimeToken = true
this.includeCustomMessageType = includeCustomMessageType
}
)
}
Expand Down
15 changes: 0 additions & 15 deletions pubnub-kotlin/pubnub-kotlin-impl/config/ktlint/baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
<file name="src/main/kotlin/com/pubnub/internal/subscribe/eventengine/effect/ReconnectionPolicy.kt">
<error line="1" column="1" source="standard:no-empty-file" />
</file>
<file name="src/main/kotlin/com/pubnub/internal/v2/PNConfigurationImpl.kt">
<error line="100" column="1" source="standard:indent" />
<error line="101" column="1" source="standard:indent" />
</file>
<file name="src/test/kotlin/com/pubnub/api/legacy/endpoints/files/TestsWithFiles.kt">
<error line="17" column="30" source="standard:property-naming" />
</file>
Expand Down Expand Up @@ -180,17 +176,6 @@
<error line="23" column="38" source="standard:curly-spacing" />
<error line="23" column="38" source="standard:function-start-of-body-spacing" />
</file>
<file name="src/test/kotlin/com/pubnub/contract/subscribe/eventEngine/step/EventEngineSteps.kt">
<error line="22" column="1" source="standard:no-unused-imports" />
<error line="95" column="50" source="standard:curly-spacing" />
<error line="95" column="50" source="standard:function-start-of-body-spacing" />
<error line="172" column="56" source="standard:curly-spacing" />
<error line="172" column="56" source="standard:function-start-of-body-spacing" />
<error line="176" column="42" source="standard:argument-list-wrapping" />
<error line="182" column="116" source="standard:curly-spacing" />
<error line="182" column="116" source="standard:function-start-of-body-spacing" />
<error line="184" column="29" source="standard:no-multi-spaces" />
</file>
<file name="src/test/kotlin/com/pubnub/contract/uuidmetadata/step/GivenSteps.kt">
<error line="15" column="9" source="standard:function-naming" />
<error line="21" column="9" source="standard:function-naming" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ import io.cucumber.java.en.Then
import io.cucumber.java.en.When
import org.awaitility.kotlin.await
import org.hamcrest.CoreMatchers
import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.MatcherAssert
import org.hamcrest.Matchers
import org.junit.jupiter.api.Assertions.assertFalse
import org.junit.jupiter.api.Assertions.assertTrue
import java.util.concurrent.TimeUnit
import kotlin.time.Duration.Companion.milliseconds
Expand Down Expand Up @@ -91,7 +90,7 @@ class EventEngineSteps(private val state: EventEngineState) {
}

@When("I subscribe to {string} channel")
fun i_subscribe_to_channel(channelId: String){
fun i_subscribe_to_channel(channelId: String) {
i_subscribe()
}

Expand Down Expand Up @@ -167,18 +166,19 @@ class EventEngineSteps(private val state: EventEngineState) {
}

@Then("I receive 2 messages in my subscribe response")
fun i_receive_2_messages_in_my_subscribe_response(){
fun i_receive_2_messages_in_my_subscribe_response() {
await.pollInterval(50, TimeUnit.MILLISECONDS).atMost(2, TimeUnit.SECONDS).untilAsserted {
MatcherAssert.assertThat(
state.messagesList.size, Matchers.`is`(2)
state.messagesList.size,
`is`(2)
)
}
}

@Then("response contains messages with {string} and {string} types")
fun response_contains_messages_with_customMessageType(customMessageType01: String, customMessageType02: String){
fun response_contains_messages_with_customMessageType(customMessageType01: String, customMessageType02: String) {
await.pollInterval(50, TimeUnit.MILLISECONDS).atMost(500, TimeUnit.MILLISECONDS).untilAsserted {
val messageList = state.messagesList as List<PNMessageResult>
val messageList = state.messagesList as List<PNMessageResult>
val customMessageTypeList = messageList.map { message -> message.customMessageType }.toList()
assertTrue(customMessageTypeList.contains(customMessageType01))
assertTrue(customMessageTypeList.contains(customMessageType02))
Expand All @@ -189,7 +189,7 @@ class EventEngineSteps(private val state: EventEngineState) {
fun i_observe_the_following(dataTable: DataTable) {
await.pollInterval(50, TimeUnit.MILLISECONDS).atMost(500, TimeUnit.MILLISECONDS).untilAsserted {
val expectedNames = dataTable.asMaps().map { it["type"] to it["name"] }.toList()
MatcherAssert.assertThat(state.subscribeQueuedElements, Matchers.`is`(expectedNames))
MatcherAssert.assertThat(state.subscribeQueuedElements, `is`(expectedNames))
}
}

Expand Down

0 comments on commit 59c8a12

Please sign in to comment.