@Test public void testCreateAsync() { TaxHeadMaster taxHeadMaster = getTaxHeadMaster(); TaxHeadMasterRequest taxHeadMasterRequest = new TaxHeadMasterRequest(); List<TaxHeadMaster> taxHeadMasters = new ArrayList<>(); taxHeadMasters.add(taxHeadMaster); taxHeadMasterRequest.setTaxHeadMasters(taxHeadMasters); TaxHeadMasterResponse taxHeadMasterResponse = new TaxHeadMasterResponse(); taxHeadMasterResponse.setResponseInfo(null); taxHeadMasterResponse.setTaxHeadMasters(taxHeadMasters); List<String> ids=new ArrayList<>(); ids.add("23"); when(applicationProperties.getTaxHeadSeqName()).thenReturn("seq_egbs_taxHeadMaster"); when(sequenceGenService.getIds(taxHeadMasters.size(),applicationProperties.getTaxHeadSeqName())).thenReturn(ids); when(sequenceGenService.getIds(any(Integer.class),any(String.class))).thenReturn(ids); assertTrue(taxHeadMasterResponse.equals(taxHeadMasterService.createAsync(taxHeadMasterRequest))); }
public TaxHeadMasterResponse createAsync(TaxHeadMasterRequest taxHeadMasterRequest) { List<TaxHeadMaster> taxHeadMaster = taxHeadMasterRequest.getTaxHeadMasters(); List<String> taxHeadIds = sequenceGenService.getIds(taxHeadMaster.size(), applicationProperties.getTaxHeadSeqName()); int index = 0; for (TaxHeadMaster master : taxHeadMaster) { master.setId(taxHeadIds.get(index++)); } log.info("taxHeadMasterRequest createAsync::" + taxHeadMasterRequest); kafkaTemplate.send(applicationProperties.getCreateTaxHeadMasterTopicName(), applicationProperties.getCreateTaxHeadMasterTopicKey(), taxHeadMasterRequest); return getTaxHeadMasterResponse(taxHeadMaster, taxHeadMasterRequest.getRequestInfo()); }
TaxHeadMasterService { public TaxHeadMasterResponse createAsync(TaxHeadMasterRequest taxHeadMasterRequest) { List<TaxHeadMaster> taxHeadMaster = taxHeadMasterRequest.getTaxHeadMasters(); List<String> taxHeadIds = sequenceGenService.getIds(taxHeadMaster.size(), applicationProperties.getTaxHeadSeqName()); int index = 0; for (TaxHeadMaster master : taxHeadMaster) { master.setId(taxHeadIds.get(index++)); } log.info("taxHeadMasterRequest createAsync::" + taxHeadMasterRequest); kafkaTemplate.send(applicationProperties.getCreateTaxHeadMasterTopicName(), applicationProperties.getCreateTaxHeadMasterTopicKey(), taxHeadMasterRequest); return getTaxHeadMasterResponse(taxHeadMaster, taxHeadMasterRequest.getRequestInfo()); } }
TaxHeadMasterService { public TaxHeadMasterResponse createAsync(TaxHeadMasterRequest taxHeadMasterRequest) { List<TaxHeadMaster> taxHeadMaster = taxHeadMasterRequest.getTaxHeadMasters(); List<String> taxHeadIds = sequenceGenService.getIds(taxHeadMaster.size(), applicationProperties.getTaxHeadSeqName()); int index = 0; for (TaxHeadMaster master : taxHeadMaster) { master.setId(taxHeadIds.get(index++)); } log.info("taxHeadMasterRequest createAsync::" + taxHeadMasterRequest); kafkaTemplate.send(applicationProperties.getCreateTaxHeadMasterTopicName(), applicationProperties.getCreateTaxHeadMasterTopicKey(), taxHeadMasterRequest); return getTaxHeadMasterResponse(taxHeadMaster, taxHeadMasterRequest.getRequestInfo()); }  }
TaxHeadMasterService { public TaxHeadMasterResponse createAsync(TaxHeadMasterRequest taxHeadMasterRequest) { List<TaxHeadMaster> taxHeadMaster = taxHeadMasterRequest.getTaxHeadMasters(); List<String> taxHeadIds = sequenceGenService.getIds(taxHeadMaster.size(), applicationProperties.getTaxHeadSeqName()); int index = 0; for (TaxHeadMaster master : taxHeadMaster) { master.setId(taxHeadIds.get(index++)); } log.info("taxHeadMasterRequest createAsync::" + taxHeadMasterRequest); kafkaTemplate.send(applicationProperties.getCreateTaxHeadMasterTopicName(), applicationProperties.getCreateTaxHeadMasterTopicKey(), taxHeadMasterRequest); return getTaxHeadMasterResponse(taxHeadMaster, taxHeadMasterRequest.getRequestInfo()); }  TaxHeadMasterResponse getTaxHeads(TaxHeadMasterCriteria searchTaxHead, RequestInfo requestInfo); TaxHeadMasterResponse create(TaxHeadMasterRequest taxHeadMasterRequest); TaxHeadMasterResponse createAsync(TaxHeadMasterRequest taxHeadMasterRequest); TaxHeadMasterResponse updateAsync(TaxHeadMasterRequest taxHeadMasterRequest); TaxHeadMasterResponse update(TaxHeadMasterRequest taxHeadMasterRequest); }
TaxHeadMasterService { public TaxHeadMasterResponse createAsync(TaxHeadMasterRequest taxHeadMasterRequest) { List<TaxHeadMaster> taxHeadMaster = taxHeadMasterRequest.getTaxHeadMasters(); List<String> taxHeadIds = sequenceGenService.getIds(taxHeadMaster.size(), applicationProperties.getTaxHeadSeqName()); int index = 0; for (TaxHeadMaster master : taxHeadMaster) { master.setId(taxHeadIds.get(index++)); } log.info("taxHeadMasterRequest createAsync::" + taxHeadMasterRequest); kafkaTemplate.send(applicationProperties.getCreateTaxHeadMasterTopicName(), applicationProperties.getCreateTaxHeadMasterTopicKey(), taxHeadMasterRequest); return getTaxHeadMasterResponse(taxHeadMaster, taxHeadMasterRequest.getRequestInfo()); }  TaxHeadMasterResponse getTaxHeads(TaxHeadMasterCriteria searchTaxHead, RequestInfo requestInfo); TaxHeadMasterResponse create(TaxHeadMasterRequest taxHeadMasterRequest); TaxHeadMasterResponse createAsync(TaxHeadMasterRequest taxHeadMasterRequest); TaxHeadMasterResponse updateAsync(TaxHeadMasterRequest taxHeadMasterRequest); TaxHeadMasterResponse update(TaxHeadMasterRequest taxHeadMasterRequest);  }