|
5 | 5 | import dev.dbos.transact.context.DBOSOptions; |
6 | 6 | import dev.dbos.transact.context.SetDBOSOptions; |
7 | 7 | import dev.dbos.transact.database.SystemDatabase; |
| 8 | +import dev.dbos.transact.exceptions.AwaitedWorkflowCancelledException; |
8 | 9 | import dev.dbos.transact.exceptions.WorkflowCancelledException; |
9 | 10 | import dev.dbos.transact.execution.DBOSExecutor; |
10 | 11 | import dev.dbos.transact.execution.ExecutingService; |
@@ -125,6 +126,8 @@ public void asyncCancelResumeTest() throws Exception { |
125 | 126 | result = (Integer) handle.getResult() ; |
126 | 127 | assertEquals(23, result); |
127 | 128 | assertEquals(3, mgmtService.getStepsExecuted()) ; |
| 129 | + h = dbosExecutor.retrieveWorkflow(workflowId) ; |
| 130 | + assertEquals(WorkflowState.SUCCESS.name(), h.getStatus().getStatus()); |
128 | 131 |
|
129 | 132 | logger.info("Test completed"); |
130 | 133 |
|
@@ -172,6 +175,8 @@ public void queuedCancelResumeTest() throws Exception { |
172 | 175 | result = (Integer) handle.getResult() ; |
173 | 176 | assertEquals(23, result); |
174 | 177 | assertEquals(3, mgmtService.getStepsExecuted()) ; |
| 178 | + h = dbosExecutor.retrieveWorkflow(workflowId) ; |
| 179 | + assertEquals(WorkflowState.SUCCESS.name(), h.getStatus().getStatus()); |
175 | 180 |
|
176 | 181 | logger.info("Test completed"); |
177 | 182 |
|
@@ -205,46 +210,26 @@ public void syncCancelResumeTest() throws Exception { |
205 | 210 | mgmtService.simpleWorkflow(23); |
206 | 211 | } |
207 | 212 | } catch(Throwable t) { |
208 | | - logger.info("caught ex"); |
209 | | - // assertTrue(t instanceof WorkflowCancelledException) ; |
| 213 | + assertTrue(t instanceof AwaitedWorkflowCancelledException) ; |
210 | 214 | } |
211 | 215 |
|
212 | 216 | assertEquals(1, mgmtService.getStepsExecuted()) ; |
213 | | - logger.info("counting down latch") ; |
214 | 217 | testLatch.countDown(); |
215 | | - logger.info("exiting thread 1") ; |
216 | 218 | }) ; |
217 | 219 |
|
218 | | - |
219 | | - |
220 | | - // mainLatch.await(); |
221 | | - // dbos.cancelWorkflow(workflowId); |
222 | | - // workLatch.countDown(); |
223 | | - |
224 | | - |
225 | | - |
226 | 220 | e.submit(() -> { |
227 | 221 | try { |
228 | 222 | mainLatch.await(); |
229 | 223 | dbos.cancelWorkflow(workflowId); |
230 | 224 | workLatch.countDown(); |
231 | | - |
232 | | - logger.info("2 counting down lotch") ; |
233 | 225 | testLatch.countDown(); |
234 | | - logger.info("2 after counting down lotch") ; |
235 | | - |
236 | 226 |
|
237 | 227 | } catch(InterruptedException ie) { |
238 | 228 | logger.error(ie.toString()) ; |
239 | 229 | } |
240 | | - logger.info("Exiting thread 2") ; |
241 | 230 | }) ; |
242 | 231 |
|
243 | | - logger.info("Before test latch"); |
244 | 232 | testLatch.await(); |
245 | | - logger.info("after test latch"); |
246 | | - |
247 | | - |
248 | 233 |
|
249 | 234 | WorkflowHandle<?> handle = dbos.resumeWorkflow(workflowId) ; |
250 | 235 |
|
|
0 commit comments