Skip to content

Commit

Permalink
MessageAction enum changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonWoolf committed Jan 8, 2025
1 parent 2c0f111 commit 8c3d03c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
12 changes: 5 additions & 7 deletions lib/src/main/java/io/ably/lib/types/MessageAction.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package io.ably.lib.types;

public enum MessageAction {
MESSAGE_UNSET, // 0
MESSAGE_CREATE, // 1
MESSAGE_UPDATE, // 2
MESSAGE_DELETE, // 3
ANNOTATION_CREATE, // 4
ANNOTATION_DELETE, // 5
META_OCCUPANCY; // 6
MESSAGE_CREATE, // 0
MESSAGE_UPDATE, // 1
MESSAGE_DELETE, // 2
META_OCCUPANCY; // 3
MESSAGE_SUMMARY; // 4

static MessageAction tryFindByOrdinal(int ordinal) {
return values().length <= ordinal ? null: values()[ordinal];
Expand Down
15 changes: 9 additions & 6 deletions lib/src/test/java/io/ably/lib/test/common/Setup.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.google.gson.Gson;

import io.ably.lib.http.Http;
import io.ably.lib.util.Log;
import io.ably.lib.http.HttpCore;
import io.ably.lib.http.HttpScheduler;
import io.ably.lib.http.HttpUtils;
Expand Down Expand Up @@ -159,7 +160,8 @@ public void fillInOptions(ClientOptions opts, TestParameters params) {
opts.environment = environment;
opts.port = port;
opts.tlsPort = tlsPort;
opts.tls = tls;
opts.tls = false;
opts.logLevel = Log.VERBOSE;
}
}

Expand Down Expand Up @@ -201,10 +203,11 @@ private static TestVars __getTestVars() {
* convenience methods */
opts.key = "none:none";
opts.restHost = host;
opts.environment = environment;
opts.port = port;
opts.tlsPort = tlsPort;
opts.tls = true;
opts.environment = "local";
opts.logLevel = Log.VERBOSE;
opts.port = 8080;
opts.tlsPort = 8081;
opts.tls = false;
ably = new AblyRest(opts);
} catch(AblyException e) {
TerminationReason.UNABLE_TO_INSTANCE_REST.exit(e);
Expand Down Expand Up @@ -255,7 +258,7 @@ private static void __clearTestVars() {
opts.environment = environment;
opts.port = port;
opts.tlsPort = tlsPort;
opts.tls = true;
opts.tls = false;
ably = new AblyRest(opts);
ably.http.request(new Http.Execute<Void>() {
@Override
Expand Down
4 changes: 2 additions & 2 deletions lib/src/test/java/io/ably/lib/types/MessageTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void serialize_message_with_serial() {
assertEquals("test-key", serializedObject.get("connectionKey").getAsString());
assertEquals("test-data", serializedObject.get("data").getAsString());
assertEquals("test-name", serializedObject.get("name").getAsString());
assertEquals(1, serializedObject.get("action").getAsInt());
assertEquals(0, serializedObject.get("action").getAsInt());
assertEquals("01826232498871-001@abcdefghij:001", serializedObject.get("serial").getAsString());
}

Expand All @@ -76,7 +76,7 @@ public void deserialize_message_with_serial() throws Exception {
jsonObject.addProperty("clientId", "test-client-id");
jsonObject.addProperty("data", "test-data");
jsonObject.addProperty("name", "test-name");
jsonObject.addProperty("action", 1);
jsonObject.addProperty("action", 0);
jsonObject.addProperty("serial", "01826232498871-001@abcdefghij:001");

// When
Expand Down

0 comments on commit 8c3d03c

Please sign in to comment.