Skip to content

Commit 0aaf499

Browse files
committed
clean up
1 parent 79c2125 commit 0aaf499

4 files changed

Lines changed: 6 additions & 53 deletions

File tree

src/main/java/dev/dbos/transact/database/SystemDatabase.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,6 @@ public <T> T callFunctionAsStep(Supplier<T> fn, String functionName) {
346346
functionResult = fn.get();
347347
} catch (Exception e) {
348348
if (ctx != null && ctx.isInWorkflow()) {
349-
// recordOperationError(ctx, functionName, e);
350349
String jsonError = JSONUtil.serializeError(e);
351350
StepResult r = new StepResult(ctx.getWorkflowId(), nextFuncId, functionName, null, jsonError);
352351
stepsDAO.recordStepResultTxn(r);

src/main/java/dev/dbos/transact/execution/DBOSExecutor.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -363,8 +363,6 @@ public <T> T runStep(String stepName,
363363

364364
if (recordedResult != null) {
365365

366-
logger.info("There is an recorded result for step " + stepFunctionId) ;
367-
368366
String output = recordedResult.getOutput() ;
369367
if (output != null) {
370368
logger.info("Result has an output") ;
@@ -377,8 +375,6 @@ public <T> T runStep(String stepName,
377375
// TODO: fix deserialization of errors
378376
throw new Exception(error);
379377
}
380-
} else {
381-
logger.info("There is an No recorded result for step " + stepFunctionId) ;
382378
}
383379

384380
int currAttempts = 1 ;
@@ -388,8 +384,6 @@ public <T> T runStep(String stepName,
388384

389385
while (retriedAllowed && currAttempts <= maxAttempts) {
390386

391-
logger.info("curr attempt " + currAttempts) ;
392-
393387
try {
394388
result = function.execute();
395389
serializedOutput = JSONUtil.serialize(result);

src/main/java/dev/dbos/transact/json/JSONUtil.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,6 @@ public class JSONUtil {
1818

1919
private static final ObjectMapper mapper = new ObjectMapper();
2020

21-
/* static {
22-
// mapper.activateDefaultTyping(mapper.getPolymorphicTypeValidator(), ObjectMapper.DefaultTyping.NON_FINAL, JsonTypeInfo.As.PROPERTY);
23-
PolymorphicTypeValidator ptv = BasicPolymorphicTypeValidator.builder()
24-
.allowIfSubType(Object.class)
25-
.build();
26-
27-
// This ensures type info is added even for final classes like String, Integer, etc.
28-
mapper.activateDefaultTyping(ptv, ObjectMapper.DefaultTyping.EVERYTHING, JsonTypeInfo.As.PROPERTY);
29-
30-
} */
31-
3221
static {
3322
mapper.registerModule(new JavaTimeModule());
3423
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); // Optional
@@ -67,21 +56,7 @@ public static SerializableException deserializeError(String json) {
6756
}
6857

6958

70-
/* public static <T> T deserialize(String json, Class<T> clazz) {
71-
try {
72-
return mapper.readValue(json, clazz);
73-
} catch (JsonProcessingException e) {
74-
throw new RuntimeException("Deserialization failed", e);
75-
}
76-
}
7759

78-
public static <T> T deserialize(String json, TypeReference<T> typeRef) {
79-
try {
80-
return mapper.readValue(json, typeRef);
81-
} catch (JsonProcessingException e) {
82-
throw new RuntimeException("Deserialization failed", e);
83-
}
84-
} */
8560

8661
}
8762

src/test/java/dev/dbos/transact/workflow/WorkflowMgmtTest.java

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import dev.dbos.transact.context.DBOSOptions;
66
import dev.dbos.transact.context.SetDBOSOptions;
77
import dev.dbos.transact.database.SystemDatabase;
8+
import dev.dbos.transact.exceptions.AwaitedWorkflowCancelledException;
89
import dev.dbos.transact.exceptions.WorkflowCancelledException;
910
import dev.dbos.transact.execution.DBOSExecutor;
1011
import dev.dbos.transact.execution.ExecutingService;
@@ -125,6 +126,8 @@ public void asyncCancelResumeTest() throws Exception {
125126
result = (Integer) handle.getResult() ;
126127
assertEquals(23, result);
127128
assertEquals(3, mgmtService.getStepsExecuted()) ;
129+
h = dbosExecutor.retrieveWorkflow(workflowId) ;
130+
assertEquals(WorkflowState.SUCCESS.name(), h.getStatus().getStatus());
128131

129132
logger.info("Test completed");
130133

@@ -172,6 +175,8 @@ public void queuedCancelResumeTest() throws Exception {
172175
result = (Integer) handle.getResult() ;
173176
assertEquals(23, result);
174177
assertEquals(3, mgmtService.getStepsExecuted()) ;
178+
h = dbosExecutor.retrieveWorkflow(workflowId) ;
179+
assertEquals(WorkflowState.SUCCESS.name(), h.getStatus().getStatus());
175180

176181
logger.info("Test completed");
177182

@@ -205,46 +210,26 @@ public void syncCancelResumeTest() throws Exception {
205210
mgmtService.simpleWorkflow(23);
206211
}
207212
} catch(Throwable t) {
208-
logger.info("caught ex");
209-
// assertTrue(t instanceof WorkflowCancelledException) ;
213+
assertTrue(t instanceof AwaitedWorkflowCancelledException) ;
210214
}
211215

212216
assertEquals(1, mgmtService.getStepsExecuted()) ;
213-
logger.info("counting down latch") ;
214217
testLatch.countDown();
215-
logger.info("exiting thread 1") ;
216218
}) ;
217219

218-
219-
220-
// mainLatch.await();
221-
// dbos.cancelWorkflow(workflowId);
222-
// workLatch.countDown();
223-
224-
225-
226220
e.submit(() -> {
227221
try {
228222
mainLatch.await();
229223
dbos.cancelWorkflow(workflowId);
230224
workLatch.countDown();
231-
232-
logger.info("2 counting down lotch") ;
233225
testLatch.countDown();
234-
logger.info("2 after counting down lotch") ;
235-
236226

237227
} catch(InterruptedException ie) {
238228
logger.error(ie.toString()) ;
239229
}
240-
logger.info("Exiting thread 2") ;
241230
}) ;
242231

243-
logger.info("Before test latch");
244232
testLatch.await();
245-
logger.info("after test latch");
246-
247-
248233

249234
WorkflowHandle<?> handle = dbos.resumeWorkflow(workflowId) ;
250235

0 commit comments

Comments
 (0)