@@ -15,7 +15,7 @@ public class EndToEndTests {
1515 private static final String hostHealthPingPath = "/admin/host/ping" ;
1616 private static final String startOrchestrationPath = "/api/StartOrchestration" ;
1717 private static final String approvalWorkFlow = "/api/ApprovalWorkflowOrchestration" ;
18- private static JsonPath rewindTestJsonPath = null ;
18+ private static final String rewindInstance = "/api/RewindInstance" ;
1919
2020 @ Order (1 )
2121 @ Test
@@ -41,28 +41,29 @@ public void basicChain() throws InterruptedException {
4141
4242 @ Order (2 )
4343 @ Test
44- public void approvalWorkFlow () throws InterruptedException {
44+ public void testRewindInstanceAPI () throws InterruptedException {
4545 Response response = post (approvalWorkFlow );
46- rewindTestJsonPath = response .jsonPath ();
46+ JsonPath rewindTestJsonPath = response .jsonPath ();
47+
48+ // Wait for the ApprovalWorkflowOrchestration to fail
4749 Thread .sleep (3000 );
50+
51+ String instanceId = rewindTestJsonPath .get ("id" );
4852 String statusQueryGetUri = rewindTestJsonPath .get ("statusQueryGetUri" );
4953 Response statusResponse = get (statusQueryGetUri );
5054 String runTimeStatus = statusResponse .jsonPath ().get ("runtimeStatus" );
5155 assertEquals ("Failed" , runTimeStatus );
52- }
5356
54- @ Order (3 )
55- @ Test
56- public void rewindInstance () throws InterruptedException {
57- String rewindPostUri = rewindTestJsonPath .get ("rewindPostUri" );
58- Response response = post (rewindPostUri );
57+ // Rewind the instance
58+ String rewindPostUri = rewindInstance + "?instanceId=" + instanceId ;
59+ response = post (rewindPostUri );
60+ assertEquals ("Failed orchestration instance is scheduled for rewind." , response .toString ());
5961
62+ // Wait for orchestration to rewind and complete
6063 Thread .sleep (3000 );
6164
62- String statusQueryGetUri = rewindTestJsonPath .get ("statusQueryGetUri" );
63- String runTimeStatus = null ;
6465 for (int i = 0 ; i < 5 ; i ++) {
65- Response statusResponse = get (statusQueryGetUri );
66+ statusResponse = get (statusQueryGetUri );
6667 runTimeStatus = statusResponse .jsonPath ().get ("runtimeStatus" );
6768 if (!"Completed" .equals (runTimeStatus )) {
6869 Thread .sleep (1000 );
0 commit comments