@Test public void testCreateMarriageRegnDemandTest() { DemandResponse demandResponse= new DemandResponse(); demandResponse.setDemands(getDemand()); List<Demand> demands=getDemand(); when(demandServiceRepository.prepareDemand(any(MarriageRegnRequest.class))).thenReturn(demands); when(demandServiceRepository.createDemand((List<Demand>) any(Demand.class), any(org.egov.common.contract.request.RequestInfo.class))).thenReturn(demandResponse); when(kafkaTemplate.send(any(String.class),any(Object.class))).thenReturn(new SendResult<>(null, null)); }
public void createMarriageRegnDemand(MarriageRegnRequest marriageRegnRequest) { log.info(" DemandService createDemand" + marriageRegnRequest); MarriageRegn marriageRegn = marriageRegnRequest.getMarriageRegn(); RequestInfo requestInfo = marriageRegnRequest.getRequestInfo(); List<Demand> demands = demandServiceRepository.prepareDemand(marriageRegnRequest); log.info(" DemandService createDemand demands" + demands.get(0).getConsumerCode()); DemandResponse demandResponse = demandServiceRepository.createDemand(demands, requestInfo); log.info(" DemandService createDemand" + demandResponse); marriageRegn.setDemands(demandResponse.getDemands()); List<String> demandIds=new ArrayList<>(); for (Demand demand : demandResponse.getDemands()) { String demandId=demand.getId(); demandIds.add(demandId); } log.info("demandIds"+demandIds); marriageRegn.setDemandIds(demandIds); marriageRegnRequest.setMarriageRegn(marriageRegn); log.info(" DemandService marriageRegnRequest.getRequestInfo()" + marriageRegnRequest); ; String kafkaTopic = null; if (marriageRegn.getSource().equals(Source.DATA_ENTRY)) { kafkaTopic = propertiesManager.getCreateMarriageRegnTopicName(); kafkaTemplate.send(kafkaTopic, marriageRegnRequest); } else if (marriageRegn.getSource().equals(Source.SYSTEM)) { kafkaTopic = propertiesManager.getCreateWorkflowTopicName(); marriageRegn.setStatus(ApplicationStatus.WORKFLOW); log.info(" DemandService marriageRegnRequest before calling workflow" + marriageRegnRequest); kafkaTemplate.send(kafkaTopic, marriageRegnRequest); } }
DemandService { public void createMarriageRegnDemand(MarriageRegnRequest marriageRegnRequest) { log.info(" DemandService createDemand" + marriageRegnRequest); MarriageRegn marriageRegn = marriageRegnRequest.getMarriageRegn(); RequestInfo requestInfo = marriageRegnRequest.getRequestInfo(); List<Demand> demands = demandServiceRepository.prepareDemand(marriageRegnRequest); log.info(" DemandService createDemand demands" + demands.get(0).getConsumerCode()); DemandResponse demandResponse = demandServiceRepository.createDemand(demands, requestInfo); log.info(" DemandService createDemand" + demandResponse); marriageRegn.setDemands(demandResponse.getDemands()); List<String> demandIds=new ArrayList<>(); for (Demand demand : demandResponse.getDemands()) { String demandId=demand.getId(); demandIds.add(demandId); } log.info("demandIds"+demandIds); marriageRegn.setDemandIds(demandIds); marriageRegnRequest.setMarriageRegn(marriageRegn); log.info(" DemandService marriageRegnRequest.getRequestInfo()" + marriageRegnRequest); ; String kafkaTopic = null; if (marriageRegn.getSource().equals(Source.DATA_ENTRY)) { kafkaTopic = propertiesManager.getCreateMarriageRegnTopicName(); kafkaTemplate.send(kafkaTopic, marriageRegnRequest); } else if (marriageRegn.getSource().equals(Source.SYSTEM)) { kafkaTopic = propertiesManager.getCreateWorkflowTopicName(); marriageRegn.setStatus(ApplicationStatus.WORKFLOW); log.info(" DemandService marriageRegnRequest before calling workflow" + marriageRegnRequest); kafkaTemplate.send(kafkaTopic, marriageRegnRequest); } } }
DemandService { public void createMarriageRegnDemand(MarriageRegnRequest marriageRegnRequest) { log.info(" DemandService createDemand" + marriageRegnRequest); MarriageRegn marriageRegn = marriageRegnRequest.getMarriageRegn(); RequestInfo requestInfo = marriageRegnRequest.getRequestInfo(); List<Demand> demands = demandServiceRepository.prepareDemand(marriageRegnRequest); log.info(" DemandService createDemand demands" + demands.get(0).getConsumerCode()); DemandResponse demandResponse = demandServiceRepository.createDemand(demands, requestInfo); log.info(" DemandService createDemand" + demandResponse); marriageRegn.setDemands(demandResponse.getDemands()); List<String> demandIds=new ArrayList<>(); for (Demand demand : demandResponse.getDemands()) { String demandId=demand.getId(); demandIds.add(demandId); } log.info("demandIds"+demandIds); marriageRegn.setDemandIds(demandIds); marriageRegnRequest.setMarriageRegn(marriageRegn); log.info(" DemandService marriageRegnRequest.getRequestInfo()" + marriageRegnRequest); ; String kafkaTopic = null; if (marriageRegn.getSource().equals(Source.DATA_ENTRY)) { kafkaTopic = propertiesManager.getCreateMarriageRegnTopicName(); kafkaTemplate.send(kafkaTopic, marriageRegnRequest); } else if (marriageRegn.getSource().equals(Source.SYSTEM)) { kafkaTopic = propertiesManager.getCreateWorkflowTopicName(); marriageRegn.setStatus(ApplicationStatus.WORKFLOW); log.info(" DemandService marriageRegnRequest before calling workflow" + marriageRegnRequest); kafkaTemplate.send(kafkaTopic, marriageRegnRequest); } }  }
DemandService { public void createMarriageRegnDemand(MarriageRegnRequest marriageRegnRequest) { log.info(" DemandService createDemand" + marriageRegnRequest); MarriageRegn marriageRegn = marriageRegnRequest.getMarriageRegn(); RequestInfo requestInfo = marriageRegnRequest.getRequestInfo(); List<Demand> demands = demandServiceRepository.prepareDemand(marriageRegnRequest); log.info(" DemandService createDemand demands" + demands.get(0).getConsumerCode()); DemandResponse demandResponse = demandServiceRepository.createDemand(demands, requestInfo); log.info(" DemandService createDemand" + demandResponse); marriageRegn.setDemands(demandResponse.getDemands()); List<String> demandIds=new ArrayList<>(); for (Demand demand : demandResponse.getDemands()) { String demandId=demand.getId(); demandIds.add(demandId); } log.info("demandIds"+demandIds); marriageRegn.setDemandIds(demandIds); marriageRegnRequest.setMarriageRegn(marriageRegn); log.info(" DemandService marriageRegnRequest.getRequestInfo()" + marriageRegnRequest); ; String kafkaTopic = null; if (marriageRegn.getSource().equals(Source.DATA_ENTRY)) { kafkaTopic = propertiesManager.getCreateMarriageRegnTopicName(); kafkaTemplate.send(kafkaTopic, marriageRegnRequest); } else if (marriageRegn.getSource().equals(Source.SYSTEM)) { kafkaTopic = propertiesManager.getCreateWorkflowTopicName(); marriageRegn.setStatus(ApplicationStatus.WORKFLOW); log.info(" DemandService marriageRegnRequest before calling workflow" + marriageRegnRequest); kafkaTemplate.send(kafkaTopic, marriageRegnRequest); } }  void createMarriageRegnDemand(MarriageRegnRequest marriageRegnRequest); }
DemandService { public void createMarriageRegnDemand(MarriageRegnRequest marriageRegnRequest) { log.info(" DemandService createDemand" + marriageRegnRequest); MarriageRegn marriageRegn = marriageRegnRequest.getMarriageRegn(); RequestInfo requestInfo = marriageRegnRequest.getRequestInfo(); List<Demand> demands = demandServiceRepository.prepareDemand(marriageRegnRequest); log.info(" DemandService createDemand demands" + demands.get(0).getConsumerCode()); DemandResponse demandResponse = demandServiceRepository.createDemand(demands, requestInfo); log.info(" DemandService createDemand" + demandResponse); marriageRegn.setDemands(demandResponse.getDemands()); List<String> demandIds=new ArrayList<>(); for (Demand demand : demandResponse.getDemands()) { String demandId=demand.getId(); demandIds.add(demandId); } log.info("demandIds"+demandIds); marriageRegn.setDemandIds(demandIds); marriageRegnRequest.setMarriageRegn(marriageRegn); log.info(" DemandService marriageRegnRequest.getRequestInfo()" + marriageRegnRequest); ; String kafkaTopic = null; if (marriageRegn.getSource().equals(Source.DATA_ENTRY)) { kafkaTopic = propertiesManager.getCreateMarriageRegnTopicName(); kafkaTemplate.send(kafkaTopic, marriageRegnRequest); } else if (marriageRegn.getSource().equals(Source.SYSTEM)) { kafkaTopic = propertiesManager.getCreateWorkflowTopicName(); marriageRegn.setStatus(ApplicationStatus.WORKFLOW); log.info(" DemandService marriageRegnRequest before calling workflow" + marriageRegnRequest); kafkaTemplate.send(kafkaTopic, marriageRegnRequest); } }  void createMarriageRegnDemand(MarriageRegnRequest marriageRegnRequest);  }