From f0d2c9fe71ac1ff18536b6a9ed633385e455dda3 Mon Sep 17 00:00:00 2001 From: Dan Newton Date: Thu, 4 Jun 2020 08:04:41 +0100 Subject: [PATCH] NOTICK Correct `StatemachineGeneralErrorHandlingtest` (#6306) --- .../statemachine/StatemachineErrorHandlingTest.kt | 13 +++++++++++++ .../StatemachineGeneralErrorHandlingTest.kt | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/node/src/integration-test-slow/kotlin/net/corda/node/services/statemachine/StatemachineErrorHandlingTest.kt b/node/src/integration-test-slow/kotlin/net/corda/node/services/statemachine/StatemachineErrorHandlingTest.kt index e7bda45134..7ed4ce5325 100644 --- a/node/src/integration-test-slow/kotlin/net/corda/node/services/statemachine/StatemachineErrorHandlingTest.kt +++ b/node/src/integration-test-slow/kotlin/net/corda/node/services/statemachine/StatemachineErrorHandlingTest.kt @@ -122,6 +122,19 @@ abstract class StatemachineErrorHandlingTest { } } + @StartableByRPC + class GetNumberOfHospitalizedCheckpointsFlow : FlowLogic() { + override fun call(): Long { + val sqlStatement = "select count(*) from node_checkpoints where status in (${Checkpoint.FlowStatus.HOSPITALIZED.ordinal})" + return serviceHub.jdbcSession().prepareStatement(sqlStatement).use { ps -> + ps.executeQuery().use { rs -> + rs.next() + rs.getLong(1) + } + } + } + } + // Internal use for testing only!! @StartableByRPC class GetHospitalCountersFlow : FlowLogic() { diff --git a/node/src/integration-test-slow/kotlin/net/corda/node/services/statemachine/StatemachineGeneralErrorHandlingTest.kt b/node/src/integration-test-slow/kotlin/net/corda/node/services/statemachine/StatemachineGeneralErrorHandlingTest.kt index a7a3e1cbb1..349ab5e5a8 100644 --- a/node/src/integration-test-slow/kotlin/net/corda/node/services/statemachine/StatemachineGeneralErrorHandlingTest.kt +++ b/node/src/integration-test-slow/kotlin/net/corda/node/services/statemachine/StatemachineGeneralErrorHandlingTest.kt @@ -1178,9 +1178,9 @@ class StatemachineGeneralErrorHandlingTest : StatemachineErrorHandlingTest() { // 1 for the flow that is waiting for the errored counterparty flow to finish and 1 for GetNumberOfCheckpointsFlow assertEquals(2, aliceClient.startFlow(StatemachineErrorHandlingTest::GetNumberOfUncompletedCheckpointsFlow).returnValue.get()) // 1 for GetNumberOfCheckpointsFlow - // the checkpoint is not persisted since it kept failing the original checkpoint commit + // a hospitalized flow is saved as the original checkpoint kept failing to commit // the flow will recover since artemis will keep the events and replay them on node restart - assertEquals(1, charlieClient.startFlow(StatemachineErrorHandlingTest::GetNumberOfUncompletedCheckpointsFlow).returnValue.get()) + assertEquals(1, charlieClient.startFlow(StatemachineErrorHandlingTest::GetNumberOfHospitalizedCheckpointsFlow).returnValue.get()) } }