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
3131 throw new IllegalArgumentException (
3232 "Invalid workflow run token: incorrect operation token type: " + token .getType ());
3333 }
34- if (token .getVersion () != null ) {
34+ if (token .getVersion () != null && token . getVersion () != 0 ) {
3535 throw new IllegalArgumentException ("Invalid workflow run token: unexpected version field" );
3636 }
3737 if (Strings .isNullOrEmpty (token .getWorkflowId ())) {
Original file line number Diff line number Diff line change @@ -80,6 +80,20 @@ public void loadWorkflowIdFromOperationToken() {
8080 encoder .encodeToString (json .getBytes ())));
8181 }
8282
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+
8397 @ Test
8498 public void loadWorkflowIdFromBadOperationToken () {
8599 // Bad token, empty json
You can’t perform that action at this time.
0 commit comments