@Test public void convert2Proto() { GlobalStatusRequest globalStatusRequest = new GlobalStatusRequest(); globalStatusRequest.setExtraData("extraData"); globalStatusRequest.setXid("xid"); GlobalStatusRequestConvertor convertor = new GlobalStatusRequestConvertor(); GlobalStatusRequestProto proto = convertor.convert2Proto( globalStatusRequest); GlobalStatusRequest real = convertor.convert2Model(proto); assertThat((real.getTypeCode())).isEqualTo(globalStatusRequest.getTypeCode()); assertThat((real.getXid())).isEqualTo(globalStatusRequest.getXid()); assertThat((real.getExtraData())).isEqualTo(globalStatusRequest.getExtraData()); }
@Override public GlobalStatusRequestProto convert2Proto(GlobalStatusRequest globalStatusRequest) { final short typeCode = globalStatusRequest.getTypeCode(); final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType( MessageTypeProto.forNumber(typeCode)).build(); final AbstractTransactionRequestProto abstractTransactionRequestProto = AbstractTransactionRequestProto .newBuilder().setAbstractMessage( abstractMessage).build(); final String extraData = globalStatusRequest.getExtraData(); AbstractGlobalEndRequestProto abstractGlobalEndRequestProto = AbstractGlobalEndRequestProto.newBuilder() .setAbstractTransactionRequest(abstractTransactionRequestProto) .setXid(globalStatusRequest.getXid()) .setExtraData(extraData==null?"":extraData) .build(); GlobalStatusRequestProto result = GlobalStatusRequestProto.newBuilder().setAbstractGlobalEndRequest( abstractGlobalEndRequestProto).build(); return result; }
GlobalStatusRequestConvertor implements PbConvertor<GlobalStatusRequest, GlobalStatusRequestProto> { @Override public GlobalStatusRequestProto convert2Proto(GlobalStatusRequest globalStatusRequest) { final short typeCode = globalStatusRequest.getTypeCode(); final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType( MessageTypeProto.forNumber(typeCode)).build(); final AbstractTransactionRequestProto abstractTransactionRequestProto = AbstractTransactionRequestProto .newBuilder().setAbstractMessage( abstractMessage).build(); final String extraData = globalStatusRequest.getExtraData(); AbstractGlobalEndRequestProto abstractGlobalEndRequestProto = AbstractGlobalEndRequestProto.newBuilder() .setAbstractTransactionRequest(abstractTransactionRequestProto) .setXid(globalStatusRequest.getXid()) .setExtraData(extraData==null?"":extraData) .build(); GlobalStatusRequestProto result = GlobalStatusRequestProto.newBuilder().setAbstractGlobalEndRequest( abstractGlobalEndRequestProto).build(); return result; } }
GlobalStatusRequestConvertor implements PbConvertor<GlobalStatusRequest, GlobalStatusRequestProto> { @Override public GlobalStatusRequestProto convert2Proto(GlobalStatusRequest globalStatusRequest) { final short typeCode = globalStatusRequest.getTypeCode(); final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType( MessageTypeProto.forNumber(typeCode)).build(); final AbstractTransactionRequestProto abstractTransactionRequestProto = AbstractTransactionRequestProto .newBuilder().setAbstractMessage( abstractMessage).build(); final String extraData = globalStatusRequest.getExtraData(); AbstractGlobalEndRequestProto abstractGlobalEndRequestProto = AbstractGlobalEndRequestProto.newBuilder() .setAbstractTransactionRequest(abstractTransactionRequestProto) .setXid(globalStatusRequest.getXid()) .setExtraData(extraData==null?"":extraData) .build(); GlobalStatusRequestProto result = GlobalStatusRequestProto.newBuilder().setAbstractGlobalEndRequest( abstractGlobalEndRequestProto).build(); return result; }  }
GlobalStatusRequestConvertor implements PbConvertor<GlobalStatusRequest, GlobalStatusRequestProto> { @Override public GlobalStatusRequestProto convert2Proto(GlobalStatusRequest globalStatusRequest) { final short typeCode = globalStatusRequest.getTypeCode(); final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType( MessageTypeProto.forNumber(typeCode)).build(); final AbstractTransactionRequestProto abstractTransactionRequestProto = AbstractTransactionRequestProto .newBuilder().setAbstractMessage( abstractMessage).build(); final String extraData = globalStatusRequest.getExtraData(); AbstractGlobalEndRequestProto abstractGlobalEndRequestProto = AbstractGlobalEndRequestProto.newBuilder() .setAbstractTransactionRequest(abstractTransactionRequestProto) .setXid(globalStatusRequest.getXid()) .setExtraData(extraData==null?"":extraData) .build(); GlobalStatusRequestProto result = GlobalStatusRequestProto.newBuilder().setAbstractGlobalEndRequest( abstractGlobalEndRequestProto).build(); return result; }  @Override GlobalStatusRequestProto convert2Proto(GlobalStatusRequest globalStatusRequest); @Override GlobalStatusRequest convert2Model(GlobalStatusRequestProto globalStatusRequestProto); }
GlobalStatusRequestConvertor implements PbConvertor<GlobalStatusRequest, GlobalStatusRequestProto> { @Override public GlobalStatusRequestProto convert2Proto(GlobalStatusRequest globalStatusRequest) { final short typeCode = globalStatusRequest.getTypeCode(); final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType( MessageTypeProto.forNumber(typeCode)).build(); final AbstractTransactionRequestProto abstractTransactionRequestProto = AbstractTransactionRequestProto .newBuilder().setAbstractMessage( abstractMessage).build(); final String extraData = globalStatusRequest.getExtraData(); AbstractGlobalEndRequestProto abstractGlobalEndRequestProto = AbstractGlobalEndRequestProto.newBuilder() .setAbstractTransactionRequest(abstractTransactionRequestProto) .setXid(globalStatusRequest.getXid()) .setExtraData(extraData==null?"":extraData) .build(); GlobalStatusRequestProto result = GlobalStatusRequestProto.newBuilder().setAbstractGlobalEndRequest( abstractGlobalEndRequestProto).build(); return result; }  @Override GlobalStatusRequestProto convert2Proto(GlobalStatusRequest globalStatusRequest); @Override GlobalStatusRequest convert2Model(GlobalStatusRequestProto globalStatusRequestProto);  }