@@ -24,7 +24,7 @@ public class EndToEndTests {
2424 private static final String hostHealthPingPath = "/admin/host/ping" ;
2525 private static final String startOrchestrationPath = "/api/StartOrchestration" ;
2626 private static final String approvalWorkFlow = "/api/ApprovalWorkflowOrchestration" ;
27- private static JsonPath rewindTestJsonPath = null ;
27+ private static final String rewindInstance = "/api/RewindInstance" ;
2828
2929 @ Order (1 )
3030 @ Test
@@ -209,28 +209,29 @@ private boolean pollingCheck(String statusQueryGetUri,
209209
210210 @ Order (2 )
211211 @ Test
212- public void approvalWorkFlow () throws InterruptedException {
212+ public void testRewindInstanceAPI () throws InterruptedException {
213213 Response response = post (approvalWorkFlow );
214- rewindTestJsonPath = response .jsonPath ();
214+ JsonPath rewindTestJsonPath = response .jsonPath ();
215+
216+ // Wait for the ApprovalWorkflowOrchestration to fail
215217 Thread .sleep (3000 );
218+
219+ String instanceId = rewindTestJsonPath .get ("id" );
216220 String statusQueryGetUri = rewindTestJsonPath .get ("statusQueryGetUri" );
217221 Response statusResponse = get (statusQueryGetUri );
218222 String runTimeStatus = statusResponse .jsonPath ().get ("runtimeStatus" );
219223 assertEquals ("Failed" , runTimeStatus );
220- }
221224
222- @ Order (3 )
223- @ Test
224- public void rewindInstance () throws InterruptedException {
225- String rewindPostUri = rewindTestJsonPath .get ("rewindPostUri" );
226- Response response = post (rewindPostUri );
225+ // Rewind the instance
226+ String rewindPostUri = rewindInstance + "?instanceId=" + instanceId ;
227+ response = post (rewindPostUri );
228+ assertEquals ("Failed orchestration instance is scheduled for rewind." , response .toString ());
227229
230+ // Wait for orchestration to rewind and complete
228231 Thread .sleep (3000 );
229232
230- String statusQueryGetUri = rewindTestJsonPath .get ("statusQueryGetUri" );
231- String runTimeStatus = null ;
232233 for (int i = 0 ; i < 5 ; i ++) {
233- Response statusResponse = get (statusQueryGetUri );
234+ statusResponse = get (statusQueryGetUri );
234235 runTimeStatus = statusResponse .jsonPath ().get ("runtimeStatus" );
235236 if (!"Completed" .equals (runTimeStatus )) {
236237 Thread .sleep (1000 );
0 commit comments