use of io.seata.saga.statelang.domain.StateMachineInstance in project seata by seata.
the class StateMachineAsyncTests method testStatusMatchingStateMachine.
@Test
public void testStatusMatchingStateMachine() {
long start = System.currentTimeMillis();
Map<String, Object> paramMap = new HashMap<>(1);
paramMap.put("a", 1);
paramMap.put("barThrowException", "true");
String stateMachineName = "simpleStatusMatchingStateMachine";
StateMachineInstance inst = stateMachineEngine.startAsync(stateMachineName, null, paramMap, callback);
waittingForFinish(inst);
long cost = System.currentTimeMillis() - start;
System.out.println("====== cost :" + cost);
Assertions.assertNotNull(inst.getException());
Assertions.assertTrue(ExecutionStatus.UN.equals(inst.getStatus()));
}
use of io.seata.saga.statelang.domain.StateMachineInstance in project seata by seata.
the class StateMachineAsyncTests method testCompensationAndSubStateMachine.
@Test
public void testCompensationAndSubStateMachine() {
long start = System.currentTimeMillis();
Map<String, Object> paramMap = new HashMap<>(1);
paramMap.put("a", 2);
paramMap.put("barThrowException", "true");
String stateMachineName = "simpleStateMachineWithCompensationAndSubMachine";
StateMachineInstance inst = stateMachineEngine.startAsync(stateMachineName, null, paramMap, callback);
waittingForFinish(inst);
long cost = System.currentTimeMillis() - start;
System.out.println("====== cost :" + cost);
Assertions.assertTrue(ExecutionStatus.UN.equals(inst.getStatus()));
}
use of io.seata.saga.statelang.domain.StateMachineInstance in project seata by seata.
the class StateMachineAsyncTests method testSimpleCatchesStateMachine.
@Test
public void testSimpleCatchesStateMachine() {
long start = System.currentTimeMillis();
Map<String, Object> paramMap = new HashMap<>(1);
paramMap.put("a", 1);
paramMap.put("barThrowException", "true");
String stateMachineName = "simpleCachesStateMachine";
StateMachineInstance inst = stateMachineEngine.startAsync(stateMachineName, null, paramMap, callback);
waittingForFinish(inst);
long cost = System.currentTimeMillis() - start;
System.out.println("====== cost :" + cost);
Assertions.assertNotNull(inst.getException());
Assertions.assertTrue(ExecutionStatus.FA.equals(inst.getStatus()));
}
use of io.seata.saga.statelang.domain.StateMachineInstance in project seata by seata.
the class StateMachineAsyncTests method testSimpleScriptTaskStateMachine.
@Test
public void testSimpleScriptTaskStateMachine() {
long start = System.currentTimeMillis();
Map<String, Object> paramMap = new HashMap<>(1);
paramMap.put("a", 1);
String stateMachineName = "simpleScriptTaskStateMachine";
StateMachineInstance inst = stateMachineEngine.start(stateMachineName, null, paramMap);
waittingForFinish(inst);
long cost = System.currentTimeMillis() - start;
System.out.println("====== cost :" + cost);
Assertions.assertTrue(ExecutionStatus.SU.equals(inst.getStatus()));
Assertions.assertNotNull(inst.getEndParams().get("scriptStateResult"));
start = System.currentTimeMillis();
inst = stateMachineEngine.start(stateMachineName, null, paramMap);
waittingForFinish(inst);
cost = System.currentTimeMillis() - start;
System.out.println("====== cost :" + cost);
Assertions.assertTrue(ExecutionStatus.SU.equals(inst.getStatus()));
start = System.currentTimeMillis();
paramMap.put("scriptThrowException", true);
inst = stateMachineEngine.start(stateMachineName, null, paramMap);
waittingForFinish(inst);
cost = System.currentTimeMillis() - start;
System.out.println("====== cost :" + cost);
Assertions.assertTrue(ExecutionStatus.FA.equals(inst.getStatus()));
}
use of io.seata.saga.statelang.domain.StateMachineInstance in project seata by seata.
the class StateMachineTests method testStatusMatchingStateMachine.
@Test
public void testStatusMatchingStateMachine() {
long start = System.currentTimeMillis();
Map<String, Object> paramMap = new HashMap<>(1);
paramMap.put("a", 1);
paramMap.put("barThrowException", "true");
String stateMachineName = "simpleStatusMatchingStateMachine";
StateMachineInstance inst = stateMachineEngine.start(stateMachineName, null, paramMap);
long cost = System.currentTimeMillis() - start;
System.out.println("====== cost :" + cost);
Assertions.assertNotNull(inst.getException());
Assertions.assertTrue(ExecutionStatus.UN.equals(inst.getStatus()));
}
Aggregations