use of io.seata.core.protocol.transaction.GlobalCommitResponse in project seata by seata.
the class DefaultTransactionManager method commit.
@Override
public GlobalStatus commit(String xid) throws TransactionException {
GlobalCommitRequest globalCommit = new GlobalCommitRequest();
globalCommit.setXid(xid);
GlobalCommitResponse response = (GlobalCommitResponse) syncCall(globalCommit);
return response.getGlobalStatus();
}
use of io.seata.core.protocol.transaction.GlobalCommitResponse in project seata by seata.
the class GlobalCommitResponseConvertor method convert2Model.
@Override
public GlobalCommitResponse convert2Model(GlobalCommitResponseProto globalCommitResponseProto) {
GlobalCommitResponse branchRegisterResponse = new GlobalCommitResponse();
final AbstractGlobalEndResponseProto abstractGlobalEndResponse = globalCommitResponseProto.getAbstractGlobalEndResponse();
AbstractTransactionResponseProto abstractResultMessage = abstractGlobalEndResponse.getAbstractTransactionResponse();
branchRegisterResponse.setMsg(abstractResultMessage.getAbstractResultMessage().getMsg());
branchRegisterResponse.setResultCode(ResultCode.valueOf(abstractResultMessage.getAbstractResultMessage().getResultCode().name()));
branchRegisterResponse.setTransactionExceptionCode(TransactionExceptionCode.valueOf(abstractResultMessage.getTransactionExceptionCode().name()));
branchRegisterResponse.setGlobalStatus(GlobalStatus.valueOf(abstractGlobalEndResponse.getGlobalStatus().name()));
return branchRegisterResponse;
}
use of io.seata.core.protocol.transaction.GlobalCommitResponse in project seata by seata.
the class GlobalCommitResponseTest method testToString.
/**
* Test to string.
*
* @throws Exception the exception
*/
@Test
public void testToString() throws Exception {
GlobalCommitResponse globalCommitResponse = new GlobalCommitResponse();
globalCommitResponse.setGlobalStatus(GlobalStatus.Committed);
globalCommitResponse.setResultCode(ResultCode.Success);
globalCommitResponse.setMsg("OK");
System.out.println(globalCommitResponse.toString());
Assertions.assertEquals("globalStatus=Committed,ResultCode=Success,Msg=OK", globalCommitResponse.toString());
}
Aggregations