@@ -62,6 +62,7 @@ func testInternalWorkerRegister(r *registry) {
62
62
testActivityMultipleArgs ,
63
63
RegisterActivityOptions {Name : "testActivityMultipleArgs" },
64
64
)
65
+ r .RegisterActivity (testActivityMultipleArgsWithStruct )
65
66
r .RegisterActivity (testActivityReturnString )
66
67
r .RegisterActivity (testActivityReturnEmptyString )
67
68
r .RegisterActivity (testActivityReturnEmptyStruct )
@@ -94,6 +95,7 @@ func testInternalWorkerRegisterWithTestEnv(env *TestWorkflowEnvironment) {
94
95
testActivityMultipleArgs ,
95
96
RegisterActivityOptions {Name : "testActivityMultipleArgs" },
96
97
)
98
+ env .RegisterActivity (testActivityMultipleArgsWithStruct )
97
99
env .RegisterActivity (testActivityReturnString )
98
100
env .RegisterActivity (testActivityReturnEmptyString )
99
101
env .RegisterActivity (testActivityReturnEmptyStruct )
@@ -413,6 +415,7 @@ func (s *internalWorkerTestSuite) TestDecisionTaskHandler_WithDataConverter() {
413
415
func sampleWorkflowExecute (ctx Context , input []byte ) (result []byte , err error ) {
414
416
ExecuteActivity (ctx , testActivityByteArgs , input )
415
417
ExecuteActivity (ctx , testActivityMultipleArgs , 2 , []string {"test" }, true )
418
+ ExecuteActivity (ctx , testActivityMultipleArgsWithStruct , - 8 , newTestActivityArg ())
416
419
return []byte ("Done" ), nil
417
420
}
418
421
@@ -428,6 +431,12 @@ func testActivityMultipleArgs(context.Context, int, []string, bool) ([]byte, err
428
431
return nil , nil
429
432
}
430
433
434
+ // test testActivityMultipleArgsWithStruct
435
+ func testActivityMultipleArgsWithStruct (_ context.Context , i int , s testActivityArg ) ([]byte , error ) {
436
+ fmt .Printf ("Executing testActivityMultipleArgsWithStruct: %d, %v\n " , i , s )
437
+ return nil , nil
438
+ }
439
+
431
440
func (s * internalWorkerTestSuite ) TestCreateWorker () {
432
441
worker := createWorkerWithThrottle (s .service , float64 (500.0 ), nil )
433
442
err := worker .Start ()
@@ -736,6 +745,9 @@ func (w activitiesCallingOptionsWorkflow) Execute(ctx Context, input []byte) (re
736
745
err = ExecuteActivity (ctx , testActivityMultipleArgs , 2 , []string {"test" }, true ).Get (ctx , nil )
737
746
require .NoError (w .t , err , err )
738
747
748
+ err = ExecuteActivity (ctx , testActivityMultipleArgsWithStruct , - 8 , newTestActivityArg ()).Get (ctx , nil )
749
+ require .NoError (w .t , err , err )
750
+
739
751
err = ExecuteActivity (ctx , testActivityNoResult , 2 , "test" ).Get (ctx , nil )
740
752
require .NoError (w .t , err , err )
741
753
@@ -859,10 +871,34 @@ func testActivityReturnEmptyString() (string, error) {
859
871
return "" , nil
860
872
}
861
873
874
+ type testActivityArg struct {
875
+ Index int
876
+ Name string
877
+ Data []byte
878
+ IndexPtr * int
879
+ NamePtr * string
880
+ DataPtr * []byte
881
+ }
882
+
862
883
type testActivityResult struct {
863
884
Index int
864
885
}
865
886
887
+ func newTestActivityArg () * testActivityArg {
888
+ name := "JohnSmith"
889
+ index := 22
890
+ data := []byte {22 , 8 , 78 }
891
+
892
+ return & testActivityArg {
893
+ Name : name ,
894
+ Index : index ,
895
+ Data : data ,
896
+ NamePtr : & name ,
897
+ IndexPtr : & index ,
898
+ DataPtr : & data ,
899
+ }
900
+ }
901
+
866
902
// testActivityReturnEmptyStruct
867
903
func testActivityReturnEmptyStruct () (testActivityResult , error ) {
868
904
// Return is mocked to retrun nil from server.
0 commit comments