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
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static WorkflowRunOperationToken loadWorkflowRunOperationToken(String ope
throw new IllegalArgumentException(
"Invalid workflow run token: incorrect operation token type: " + token.getType());
}
if (token.getVersion() != null) {
if (token.getVersion() != null && token.getVersion() != 0) {
throw new IllegalArgumentException("Invalid workflow run token: unexpected version field");
}
if (Strings.isNullOrEmpty(token.getWorkflowId())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,20 @@ public void loadWorkflowIdFromOperationToken() {
encoder.encodeToString(json.getBytes())));
}

@Test
public void loadWorkflowIdFromGoOperationToken() {
// This is a token generated by the Go SDK, use this to test compatibility
// across SDKs.
String goOperationToken = "eyJ2IjowLCJ0IjoxLCJucyI6Im5zIiwid2lkIjoidyJ9";

WorkflowRunOperationToken token =
OperationTokenUtil.loadWorkflowRunOperationToken(goOperationToken);
Assert.assertEquals("w", token.getWorkflowId());
Assert.assertEquals("ns", token.getNamespace());
Assert.assertEquals(Integer.valueOf(0), token.getVersion());
Assert.assertEquals(OperationTokenType.WORKFLOW_RUN, token.getType());
}

@Test
public void loadWorkflowIdFromBadOperationToken() {
// Bad token, empty json
Expand Down
Loading