Skip to content

Commit

Permalink
fix ut failed.
Browse files Browse the repository at this point in the history
  • Loading branch information
changming.xie committed May 30, 2021
1 parent 0869402 commit 826cc1b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.mengyun.tcctransaction.unittest.client;

import org.mengyun.tcctransaction.api.TransactionContext;
import org.mengyun.tcctransaction.api.TransactionStatus;
import org.mengyun.tcctransaction.unittest.service.AccountService;
import org.mengyun.tcctransaction.unittest.service.AccountServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -50,10 +51,12 @@ public void transferToWithTimeoutBeforeBranchTransactionStart(TransactionContext
@Override
public void run() {

try {
Thread.sleep(4000l);
} catch (InterruptedException e) {
e.printStackTrace();
if (transactionContext.getStatus() == TransactionStatus.TRYING.getId()) {
try {
Thread.sleep(4000l);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
accountService.transferTo(transactionContext, accountId, amount);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void testTransferWithTimeoutAndCancelBeforeBranchTransactionStart() {
Assert.assertEquals(MessageConstants.ACCOUNT_SERVICE_IMPL_TRANSFER_FROM_CANCEL_CALLED, messages.get(3));

try {
Thread.sleep(10000l);
Thread.sleep(15000l);
} catch (InterruptedException e) {
e.printStackTrace();
}
Expand Down

0 comments on commit 826cc1b

Please sign in to comment.