File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
main/java/io/temporal/internal/nexus
test/java/io/temporal/internal/nexus Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ public static WorkflowRunOperationToken loadWorkflowRunOperationToken(String ope
31
31
throw new IllegalArgumentException (
32
32
"Invalid workflow run token: incorrect operation token type: " + token .getType ());
33
33
}
34
- if (token .getVersion () != null ) {
34
+ if (token .getVersion () != null && token . getVersion () != 0 ) {
35
35
throw new IllegalArgumentException ("Invalid workflow run token: unexpected version field" );
36
36
}
37
37
if (Strings .isNullOrEmpty (token .getWorkflowId ())) {
Original file line number Diff line number Diff line change @@ -80,6 +80,20 @@ public void loadWorkflowIdFromOperationToken() {
80
80
encoder .encodeToString (json .getBytes ())));
81
81
}
82
82
83
+ @ Test
84
+ public void loadWorkflowIdFromGoOperationToken () {
85
+ // This is a token generated by the Go SDK, use this to test compatibility
86
+ // across SDKs.
87
+ String goOperationToken = "eyJ2IjowLCJ0IjoxLCJucyI6Im5zIiwid2lkIjoidyJ9" ;
88
+
89
+ WorkflowRunOperationToken token =
90
+ OperationTokenUtil .loadWorkflowRunOperationToken (goOperationToken );
91
+ Assert .assertEquals ("w" , token .getWorkflowId ());
92
+ Assert .assertEquals ("ns" , token .getNamespace ());
93
+ Assert .assertEquals (Integer .valueOf (0 ), token .getVersion ());
94
+ Assert .assertEquals (OperationTokenType .WORKFLOW_RUN , token .getType ());
95
+ }
96
+
83
97
@ Test
84
98
public void loadWorkflowIdFromBadOperationToken () {
85
99
// Bad token, empty json
You can’t perform that action at this time.
0 commit comments