@Test public void convert2Proto() { UndoLogDeleteRequest undoLogDeleteRequest = new UndoLogDeleteRequest(); undoLogDeleteRequest.setBranchType(BranchType.AT); undoLogDeleteRequest.setResourceId(RESOURCE_ID); undoLogDeleteRequest.setSaveDays(SAVE_DAYS); UndoLogDeleteRequestConvertor undoLogDeleteRequestConvertor = new UndoLogDeleteRequestConvertor(); UndoLogDeleteRequestProto proto = undoLogDeleteRequestConvertor.convert2Proto( undoLogDeleteRequest); UndoLogDeleteRequest realRequest = undoLogDeleteRequestConvertor.convert2Model(proto); assertThat(realRequest.getTypeCode()).isEqualTo(undoLogDeleteRequest.getTypeCode()); assertThat(realRequest.getBranchType()).isEqualTo(undoLogDeleteRequest.getBranchType()); assertThat(realRequest.getResourceId()).isEqualTo(undoLogDeleteRequest.getResourceId()); assertThat(realRequest.getSaveDays()).isEqualTo(undoLogDeleteRequest.getSaveDays()); }
@Override public UndoLogDeleteRequestProto convert2Proto(UndoLogDeleteRequest undoLogDeleteRequest) { final short typeCode = undoLogDeleteRequest.getTypeCode(); final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType( MessageTypeProto.forNumber(typeCode)).build(); final AbstractTransactionRequestProto abstractTransactionRequestProto = AbstractTransactionRequestProto .newBuilder().setAbstractMessage( abstractMessage).build(); final UndoLogDeleteRequestProto undoLogDeleteRequestProto = UndoLogDeleteRequestProto .newBuilder() .setAbstractTransactionRequest(abstractTransactionRequestProto) .setSaveDays(undoLogDeleteRequest.getSaveDays()) .setBranchType(BranchTypeProto.valueOf(undoLogDeleteRequest.getBranchType().name())) .setResourceId(undoLogDeleteRequest.getResourceId()) .build(); return undoLogDeleteRequestProto; }
UndoLogDeleteRequestConvertor implements PbConvertor<UndoLogDeleteRequest, UndoLogDeleteRequestProto> { @Override public UndoLogDeleteRequestProto convert2Proto(UndoLogDeleteRequest undoLogDeleteRequest) { final short typeCode = undoLogDeleteRequest.getTypeCode(); final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType( MessageTypeProto.forNumber(typeCode)).build(); final AbstractTransactionRequestProto abstractTransactionRequestProto = AbstractTransactionRequestProto .newBuilder().setAbstractMessage( abstractMessage).build(); final UndoLogDeleteRequestProto undoLogDeleteRequestProto = UndoLogDeleteRequestProto .newBuilder() .setAbstractTransactionRequest(abstractTransactionRequestProto) .setSaveDays(undoLogDeleteRequest.getSaveDays()) .setBranchType(BranchTypeProto.valueOf(undoLogDeleteRequest.getBranchType().name())) .setResourceId(undoLogDeleteRequest.getResourceId()) .build(); return undoLogDeleteRequestProto; } }
UndoLogDeleteRequestConvertor implements PbConvertor<UndoLogDeleteRequest, UndoLogDeleteRequestProto> { @Override public UndoLogDeleteRequestProto convert2Proto(UndoLogDeleteRequest undoLogDeleteRequest) { final short typeCode = undoLogDeleteRequest.getTypeCode(); final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType( MessageTypeProto.forNumber(typeCode)).build(); final AbstractTransactionRequestProto abstractTransactionRequestProto = AbstractTransactionRequestProto .newBuilder().setAbstractMessage( abstractMessage).build(); final UndoLogDeleteRequestProto undoLogDeleteRequestProto = UndoLogDeleteRequestProto .newBuilder() .setAbstractTransactionRequest(abstractTransactionRequestProto) .setSaveDays(undoLogDeleteRequest.getSaveDays()) .setBranchType(BranchTypeProto.valueOf(undoLogDeleteRequest.getBranchType().name())) .setResourceId(undoLogDeleteRequest.getResourceId()) .build(); return undoLogDeleteRequestProto; }  }
UndoLogDeleteRequestConvertor implements PbConvertor<UndoLogDeleteRequest, UndoLogDeleteRequestProto> { @Override public UndoLogDeleteRequestProto convert2Proto(UndoLogDeleteRequest undoLogDeleteRequest) { final short typeCode = undoLogDeleteRequest.getTypeCode(); final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType( MessageTypeProto.forNumber(typeCode)).build(); final AbstractTransactionRequestProto abstractTransactionRequestProto = AbstractTransactionRequestProto .newBuilder().setAbstractMessage( abstractMessage).build(); final UndoLogDeleteRequestProto undoLogDeleteRequestProto = UndoLogDeleteRequestProto .newBuilder() .setAbstractTransactionRequest(abstractTransactionRequestProto) .setSaveDays(undoLogDeleteRequest.getSaveDays()) .setBranchType(BranchTypeProto.valueOf(undoLogDeleteRequest.getBranchType().name())) .setResourceId(undoLogDeleteRequest.getResourceId()) .build(); return undoLogDeleteRequestProto; }  @Override UndoLogDeleteRequestProto convert2Proto(UndoLogDeleteRequest undoLogDeleteRequest); @Override UndoLogDeleteRequest convert2Model(UndoLogDeleteRequestProto undoLogDeleteRequestProto); }
UndoLogDeleteRequestConvertor implements PbConvertor<UndoLogDeleteRequest, UndoLogDeleteRequestProto> { @Override public UndoLogDeleteRequestProto convert2Proto(UndoLogDeleteRequest undoLogDeleteRequest) { final short typeCode = undoLogDeleteRequest.getTypeCode(); final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType( MessageTypeProto.forNumber(typeCode)).build(); final AbstractTransactionRequestProto abstractTransactionRequestProto = AbstractTransactionRequestProto .newBuilder().setAbstractMessage( abstractMessage).build(); final UndoLogDeleteRequestProto undoLogDeleteRequestProto = UndoLogDeleteRequestProto .newBuilder() .setAbstractTransactionRequest(abstractTransactionRequestProto) .setSaveDays(undoLogDeleteRequest.getSaveDays()) .setBranchType(BranchTypeProto.valueOf(undoLogDeleteRequest.getBranchType().name())) .setResourceId(undoLogDeleteRequest.getResourceId()) .build(); return undoLogDeleteRequestProto; }  @Override UndoLogDeleteRequestProto convert2Proto(UndoLogDeleteRequest undoLogDeleteRequest); @Override UndoLogDeleteRequest convert2Model(UndoLogDeleteRequestProto undoLogDeleteRequestProto);  }