use of io.seata.core.protocol.transaction.GlobalBeginRequest in project seata by seata.
the class MergedWarpMessageTest method buildGlobalBeginRequest.
private GlobalBeginRequest buildGlobalBeginRequest() {
final GlobalBeginRequest globalBeginRequest = new GlobalBeginRequest();
globalBeginRequest.setTransactionName("xx");
globalBeginRequest.setTimeout(3000);
return globalBeginRequest;
}
use of io.seata.core.protocol.transaction.GlobalBeginRequest in project seata by seata.
the class GlobalBeginRequestTest method testToString.
/**
* Test to string.
*
* @throws Exception the exception
*/
@Test
public void testToString() throws Exception {
GlobalBeginRequest globalBeginRequest = new GlobalBeginRequest();
globalBeginRequest.setTransactionName("tran 1");
System.out.println(globalBeginRequest.toString());
Assertions.assertEquals("timeout=60000,transactionName=tran 1", globalBeginRequest.toString());
}
use of io.seata.core.protocol.transaction.GlobalBeginRequest in project seata by seata.
the class GlobalBeginRequestSerializerTest method test_codec.
/**
* Test codec.
*/
@Test
public void test_codec() {
GlobalBeginRequest globalBeginRequest = new GlobalBeginRequest();
globalBeginRequest.setTimeout(10);
globalBeginRequest.setTransactionName("a24");
byte[] bytes = seataSerializer.serialize(globalBeginRequest);
GlobalBeginRequest globalBeginRequest2 = seataSerializer.deserialize(bytes);
assertThat(globalBeginRequest2.getTransactionName()).isEqualTo(globalBeginRequest.getTransactionName());
assertThat(globalBeginRequest2.getTimeout()).isEqualTo(globalBeginRequest.getTimeout());
}
use of io.seata.core.protocol.transaction.GlobalBeginRequest in project seata by seata.
the class MergedWarpMessageSerializerTest method test_codec.
/**
* Test codec.
*/
@Test
public void test_codec() {
MergedWarpMessage mergedWarpMessage = new MergedWarpMessage();
final ArrayList<AbstractMessage> msgs = new ArrayList<>();
final GlobalBeginRequest globalBeginRequest1 = buildGlobalBeginRequest("x1");
final GlobalBeginRequest globalBeginRequest2 = buildGlobalBeginRequest("x2");
msgs.add(globalBeginRequest1);
msgs.add(globalBeginRequest2);
mergedWarpMessage.msgs = msgs;
byte[] body = seataSerializer.serialize(mergedWarpMessage);
MergedWarpMessage mergedWarpMessage2 = seataSerializer.deserialize(body);
assertThat(mergedWarpMessage2.msgs.size()).isEqualTo(mergedWarpMessage.msgs.size());
GlobalBeginRequest globalBeginRequest21 = (GlobalBeginRequest) mergedWarpMessage2.msgs.get(0);
assertThat(globalBeginRequest21.getTimeout()).isEqualTo(globalBeginRequest1.getTimeout());
assertThat(globalBeginRequest21.getTransactionName()).isEqualTo(globalBeginRequest1.getTransactionName());
GlobalBeginRequest globalBeginRequest22 = (GlobalBeginRequest) mergedWarpMessage2.msgs.get(1);
assertThat(globalBeginRequest22.getTimeout()).isEqualTo(globalBeginRequest2.getTimeout());
assertThat(globalBeginRequest22.getTransactionName()).isEqualTo(globalBeginRequest2.getTransactionName());
}
use of io.seata.core.protocol.transaction.GlobalBeginRequest in project seata by seata.
the class GlobalBeginRequestConvertor method convert2Model.
@Override
public GlobalBeginRequest convert2Model(GlobalBeginRequestProto globalBeginRequestProto) {
GlobalBeginRequest globalBeginRequest = new GlobalBeginRequest();
globalBeginRequest.setTimeout(globalBeginRequestProto.getTimeout());
globalBeginRequest.setTransactionName(globalBeginRequestProto.getTransactionName());
return globalBeginRequest;
}
Aggregations