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
6 changes: 6 additions & 0 deletions lib/src/test/java/io/ably/lib/test/common/Helpers.java
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,12 @@ public synchronized void waitFor() {
} catch(InterruptedException e) {}
}

public synchronized void reset() {
Comment thread
sacOO7 marked this conversation as resolved.
gotResult = false;
result = null;
error = null;
}

public T result;
public ErrorInfo error;
private boolean gotResult = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,13 +385,23 @@ public void appendMessage_checkUpdatedData() throws Exception {
messageAppend.data = "Append data";
channel.appendMessage(messageAppend);

appendWaiter.waitFor();

// 3. Verify update
Message retrieved = waitForUpdatedMessageAppear(channel, serial);
assertEquals("Expected updated data in history", "Initial dataAppend data", retrieved.data);
assertEquals("Expected MESSAGE_UPDATE action in history", MessageAction.MESSAGE_UPDATE, retrieved.action);
assertEquals("Expected MESSAGE_APPEND action through realtime", MessageAction.MESSAGE_APPEND, appendWaiter.result.action);
assertEquals("Expected delta through realtime", "Append data", appendWaiter.result.data);
assertEquals("Expected MESSAGE_UPDATE only for the first time from realtime", MessageAction.MESSAGE_UPDATE, appendWaiter.result.action);
assertEquals("Expected full message data through realtime", "Initial dataAppend data", appendWaiter.result.data);
Comment thread
ttypic marked this conversation as resolved.
Comment thread
ttypic marked this conversation as resolved.

appendWaiter.reset();

channel.appendMessage(messageAppend);

appendWaiter.waitFor();

assertEquals("Expected MESSAGE_APPEND action through realtime", MessageAction.MESSAGE_APPEND, appendWaiter.result.action);
assertEquals("Expected only delta through realtime", "Append data", appendWaiter.result.data);
Comment thread
ttypic marked this conversation as resolved.
}

private PaginatedResult<Message> waitForMessageAppearInVersionHistory(Channel channel, String serial, Param[] params, Predicate<Message[]> predicate) throws Exception {
Expand Down
Loading