cherrylzhao commented on a change in pull request #339: SCB-963 Add Test case 
for saga transactional compensation.
URL: https://github.com/apache/servicecomb-saga/pull/339#discussion_r234564883
 
 

 ##########
 File path: 
omega/omega-spring-tx/src/test/java/org/apache/servicecomb/saga/omega/transaction/spring/TransactionalUserService.java
 ##########
 @@ -65,4 +65,17 @@ public void delete(User user, int count) {
     resetCount();
     userRepository.delete(user);
   }
+
+  @Compensable(compensationMethod = "deleteTransactional")
+  public User addTransactional(User user) {
+    if (ILLEGAL_USER.equals(user.username())) {
+      throw new IllegalArgumentException("User is illegal");
+    }
+    return userRepository.save(user);
+  }
+
+  public void deleteTransactional(User user) {
+    userRepository.delete(user);
+    throw new RuntimeException("saga compensation rollback test");
 
 Review comment:
   yes, runtimeException is for transaction rollback. we need change the method 
name?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to