Search in sources :

Example 6 with GlobalRollbackRequest

use of io.seata.core.protocol.transaction.GlobalRollbackRequest in project seata by seata.

the class GlobalRollbackRequestConvertor method convert2Model.

@Override
public GlobalRollbackRequest convert2Model(GlobalRollbackRequestProto globalRollbackRequestProto) {
    GlobalRollbackRequest branchCommitRequest = new GlobalRollbackRequest();
    branchCommitRequest.setExtraData(globalRollbackRequestProto.getAbstractGlobalEndRequest().getExtraData());
    branchCommitRequest.setXid(globalRollbackRequestProto.getAbstractGlobalEndRequest().getXid());
    return branchCommitRequest;
}
Also used : GlobalRollbackRequest(io.seata.core.protocol.transaction.GlobalRollbackRequest)

Example 7 with GlobalRollbackRequest

use of io.seata.core.protocol.transaction.GlobalRollbackRequest in project seata by seata.

the class GlobalRollbackRequestConvertorTest method convert2Proto.

@Test
public void convert2Proto() {
    GlobalRollbackRequest globalRollbackRequest = new GlobalRollbackRequest();
    globalRollbackRequest.setExtraData("extraData");
    globalRollbackRequest.setXid("xid");
    GlobalRollbackRequestConvertor convertor = new GlobalRollbackRequestConvertor();
    GlobalRollbackRequestProto proto = convertor.convert2Proto(globalRollbackRequest);
    GlobalRollbackRequest real = convertor.convert2Model(proto);
    assertThat((real.getTypeCode())).isEqualTo(globalRollbackRequest.getTypeCode());
    assertThat((real.getXid())).isEqualTo(globalRollbackRequest.getXid());
    assertThat((real.getExtraData())).isEqualTo(globalRollbackRequest.getExtraData());
}
Also used : GlobalRollbackRequest(io.seata.core.protocol.transaction.GlobalRollbackRequest) GlobalRollbackRequestProto(io.seata.serializer.protobuf.generated.GlobalRollbackRequestProto) Test(org.junit.jupiter.api.Test)

Aggregations

GlobalRollbackRequest (io.seata.core.protocol.transaction.GlobalRollbackRequest)7 Test (org.junit.jupiter.api.Test)4 GlobalRollbackResponse (io.seata.core.protocol.transaction.GlobalRollbackResponse)3 StoreException (io.seata.common.exception.StoreException)1 TransactionException (io.seata.core.exception.TransactionException)1 GlobalBeginRequest (io.seata.core.protocol.transaction.GlobalBeginRequest)1 GlobalBeginResponse (io.seata.core.protocol.transaction.GlobalBeginResponse)1 GlobalCommitRequest (io.seata.core.protocol.transaction.GlobalCommitRequest)1 GlobalCommitResponse (io.seata.core.protocol.transaction.GlobalCommitResponse)1 RpcContext (io.seata.core.rpc.RpcContext)1 Measurement (io.seata.metrics.Measurement)1 GlobalRollbackRequestProto (io.seata.serializer.protobuf.generated.GlobalRollbackRequestProto)1 MockServerMessageSender (io.seata.server.coordinator.DefaultCoordinatorTest.MockServerMessageSender)1 HashMap (java.util.HashMap)1