@@ -1129,4 +1129,93 @@ public void testListClosedWorkflows_ResponseWithToken() throws TException {
1129
1129
response = migrationService .ListClosedWorkflowExecutions (requestTwoItems );
1130
1130
assertEquals (expectedResponseWithToken , response );
1131
1131
}
1132
+
1133
+ @ Test
1134
+ public void testSignalWithStartWorkflowExecution_NewService () throws TException {
1135
+ SignalWithStartWorkflowExecutionRequest request =
1136
+ new SignalWithStartWorkflowExecutionRequest ()
1137
+ .setWorkflowId ("newSignalWorkflow" )
1138
+ .setSignalName ("TestSignal" )
1139
+ .setDomain ("domainNew" );
1140
+
1141
+ when (serviceNew .SignalWithStartWorkflowExecution (request ))
1142
+ .thenReturn (new StartWorkflowExecutionResponse ().setRunId ("newRunId" ));
1143
+
1144
+ StartWorkflowExecutionResponse response =
1145
+ migrationService .SignalWithStartWorkflowExecution (request );
1146
+
1147
+ assertEquals ("newRunId" , response .getRunId ());
1148
+ verify (serviceNew , times (1 )).SignalWithStartWorkflowExecution (request );
1149
+ verify (serviceOld , never ()).SignalWithStartWorkflowExecution (request );
1150
+ }
1151
+
1152
+ @ Test
1153
+ public void testSignalWithStartWorkflowExecution_OldService () throws TException {
1154
+ SignalWithStartWorkflowExecutionRequest signal =
1155
+ new SignalWithStartWorkflowExecutionRequest ()
1156
+ .setWorkflowId ("testSignal" )
1157
+ .setDomain ("oldDomain" )
1158
+ .setSignalName ("sampleSignal" );
1159
+
1160
+ when (serviceNew .DescribeWorkflowExecution (any ())).thenReturn (null );
1161
+
1162
+ DescribeWorkflowExecutionResponse describeWorkflowExecutionResponse =
1163
+ new DescribeWorkflowExecutionResponse ();
1164
+ when (serviceOld .DescribeWorkflowExecution (any ())).thenReturn (describeWorkflowExecutionResponse );
1165
+
1166
+ when (serviceOld .SignalWithStartWorkflowExecution (signal ))
1167
+ .thenReturn (new StartWorkflowExecutionResponse ().setRunId ("oldRunID" ));
1168
+ StartWorkflowExecutionResponse responseOld =
1169
+ migrationService .SignalWithStartWorkflowExecution (signal );
1170
+
1171
+ verify (serviceNew , times (1 )).DescribeWorkflowExecution (any ());
1172
+ verify (serviceOld , times (1 )).DescribeWorkflowExecution (any ());
1173
+ verify (serviceOld , times (1 )).SignalWithStartWorkflowExecution (any ());
1174
+
1175
+ verifyNoMoreInteractions (serviceNew );
1176
+ verifyNoMoreInteractions (serviceOld );
1177
+
1178
+ assertEquals (responseOld .getRunId (), "oldRunID" );
1179
+ }
1180
+
1181
+ @ Test
1182
+ public void testSignalWorkflowExecution_SignalNewService () throws TException {
1183
+ SignalWorkflowExecutionRequest request =
1184
+ new SignalWorkflowExecutionRequest ()
1185
+ .setWorkflowExecution (new WorkflowExecution ().setWorkflowId ("newSignal" ))
1186
+ .setSignalName ("signalNew" )
1187
+ .setDomain ("domainNew" );
1188
+
1189
+ doNothing ().when (serviceNew ).SignalWorkflowExecution (request );
1190
+
1191
+ migrationService .SignalWorkflowExecution (request );
1192
+
1193
+ verify (serviceNew , times (1 )).SignalWorkflowExecution (request );
1194
+ verify (serviceOld , never ()).SignalWorkflowExecution (any ());
1195
+ }
1196
+
1197
+ @ Test
1198
+ public void testSignalWorkflowExecution_SignalInOldService () throws TException {
1199
+ SignalWorkflowExecutionRequest request =
1200
+ new SignalWorkflowExecutionRequest ()
1201
+ .setWorkflowExecution (new WorkflowExecution ().setWorkflowId ("oldSignal" ))
1202
+ .setSignalName ("signalOld" )
1203
+ .setDomain ("domainOld" );
1204
+
1205
+ when (serviceNew .DescribeWorkflowExecution (any ())).thenReturn (null );
1206
+
1207
+ DescribeWorkflowExecutionResponse describeWorkflowExecutionResponse =
1208
+ new DescribeWorkflowExecutionResponse ();
1209
+ when (serviceOld .DescribeWorkflowExecution (any ())).thenReturn (describeWorkflowExecutionResponse );
1210
+
1211
+ doNothing ().when (serviceOld ).SignalWorkflowExecution (request );
1212
+ migrationService .SignalWorkflowExecution (request );
1213
+
1214
+ verify (serviceNew , times (1 )).DescribeWorkflowExecution (any ());
1215
+ verify (serviceOld , times (1 )).DescribeWorkflowExecution (any ());
1216
+ verify (serviceOld , times (1 )).SignalWorkflowExecution (any ());
1217
+
1218
+ verifyNoMoreInteractions (serviceNew );
1219
+ verifyNoMoreInteractions (serviceOld );
1220
+ }
1132
1221
}
0 commit comments