Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/src/main/java/io/ably/lib/transport/Defaults.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class Defaults {
* spec: G4
* </p>
*/
public static final String ABLY_PROTOCOL_VERSION = "5";
public static final String ABLY_PROTOCOL_VERSION = "6";

public static final String ABLY_AGENT_VERSION = String.format("%s/%s", "ably-java", BuildConfig.VERSION);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void realtime_websocket_param_test() {
* Defaults.ABLY_VERSION_PARAM, as ultimately the request param has been derived from those values.
*/
assertEquals("Verify correct version", requestParameters.get("v"),
Collections.singletonList("5"));
Collections.singletonList("6"));

/* Spec RSC7d3
* This test should not directly validate version against Defaults.ABLY_AGENT_VERSION, nor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void header_lib_channel_publish() {
* from those values.
*/
Assert.assertNotNull("Expected headers", headers);
Assert.assertEquals(headers.get("x-ably-version"), "5");
Assert.assertEquals(headers.get("x-ably-version"), "6");
Assert.assertEquals(headers.get("ably-agent"), expectedAblyAgentHeader);
// RSA7e2
Assert.assertNull("Shouldn't include 'x-ably-clientid' if `clientId` is not specified", headers.get("x-ably-clientid"));
Expand Down
2 changes: 1 addition & 1 deletion lib/src/test/java/io/ably/lib/transport/DefaultsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class DefaultsTest {

@Test
public void protocol_version_CSV2() {
assertThat(Defaults.ABLY_PROTOCOL_VERSION, is("5"));
assertThat(Defaults.ABLY_PROTOCOL_VERSION, is("6"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ internal class DefaultRealtimeObjects(internal val channelName: String, internal
throw invalidInputError("Map keys should not be empty")
}

// RTO11f4 - Create initial value operation
// RTO11f14 - Create initial value operation
val initialMapValue = DefaultLiveMap.initialValue(entries)

// RTO11f5 - Create initial value JSON string
// RTO11f15 - Create initial value JSON string
val initialValueJSONString = gson.toJson(initialMapValue)

// RTO11f8 - Create object ID from initial value
Expand All @@ -126,9 +126,11 @@ internal class DefaultRealtimeObjects(internal val channelName: String, internal
operation = ObjectOperation(
action = ObjectOperationAction.MapCreate,
objectId = objectId,
map = initialMapValue.map,
nonce = nonce,
initialValue = initialValueJSONString,
mapCreateWithObjectId = MapCreateWithObjectId(
nonce = nonce,
initialValue = initialValueJSONString,
derivedFrom = initialMapValue,
),
)
)

Expand All @@ -148,9 +150,9 @@ internal class DefaultRealtimeObjects(internal val channelName: String, internal
throw invalidInputError("Counter value should be a valid number")
}

// RTO12f2
// RTO12f12
val initialCounterValue = DefaultLiveCounter.initialValue(initialValue)
// RTO12f3 - Create initial value operation
// RTO12f13 - Create initial value operation
val initialValueJSONString = gson.toJson(initialCounterValue)

// RTO12f6- Create object ID from initial value
Expand All @@ -161,9 +163,11 @@ internal class DefaultRealtimeObjects(internal val channelName: String, internal
operation = ObjectOperation(
action = ObjectOperationAction.CounterCreate,
objectId = objectId,
counter = initialCounterValue.counter,
nonce = nonce,
initialValue = initialValueJSONString
counterCreateWithObjectId = CounterCreateWithObjectId(
nonce = nonce,
initialValue = initialValueJSONString,
derivedFrom = initialCounterValue,
),
)
)

Expand Down
22 changes: 0 additions & 22 deletions liveobjects/src/main/kotlin/io/ably/lib/objects/Helpers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -161,26 +161,4 @@ internal fun ObjectsAdapter.throwIfEchoMessagesDisabled() {
}
}

internal class Binary(val data: ByteArray) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is Binary) return false
return data.contentEquals(other.data)
}

override fun hashCode(): Int {
return data.contentHashCode()
}
}

internal fun Binary.size(): Int {
return data.size
}

internal data class CounterCreatePayload(
val counter: ObjectsCounter
)

internal data class MapCreatePayload(
val map: ObjectsMap
)
Loading
Loading