@SuppressWarnings("unchecked") @Test public void testForUpdateAsync() { MarriageDocTypeResponse marriageDocTypeResponse = null; try { marriageDocTypeResponse = getMarriageDocTypeResponse( "org/egov/mr/service/marriageDocumentTypeListForUpdate.json"); } catch (Exception e) { e.printStackTrace(); } List<MarriageDocumentType> marriageDocumentTypes = getMarriageDocumentTypesForUpdate(); MarriageDocTypeRequest marriageDocTypeRequest = new MarriageDocTypeRequest(); RequestInfo requestInfo = new RequestInfo(); requestInfo.setTs(Long.valueOf("987456321")); marriageDocTypeRequest.setRequestInfo(requestInfo); marriageDocTypeRequest.setMarriageDocTypes(marriageDocumentTypes); when(genService.idSeqGen(Matchers.anyInt(), Matchers.anyString())).thenReturn(getIds()); when(genService.codeSeqGen(Matchers.anyInt(), Matchers.anyString())).thenReturn(getCodes()); when(prosManager.getCreateMarriageDocumentTypeTopicName()) .thenReturn("kafka.topics.create.marriagedocumenttype"); when(_kafkaTemplate.send(Matchers.anyString(), Matchers.anyObject())).thenReturn(new SendResult<>(null, null)); when(marriageDocumentTypeRepository.getIds(Matchers.any(List.class))).thenReturn(getIds()); when(_kafkaTemplate.send(Matchers.anyString(), Matchers.anyObject())).thenReturn(new SendResult<>(null, null)); ResponseEntity<?> resEntity = marriageDocumentTypeService.updateAsync(marriageDocTypeRequest); assertEquals(resEntity.getBody().toString(), marriageDocumentTypeService.updateAsync(marriageDocTypeRequest).getBody().toString()); }
public ResponseEntity<?> updateAsync(MarriageDocTypeRequest marriageDocTypeRequest) { log.info("Service:: MarriageDocTypeRequest: " + marriageDocTypeRequest); RequestInfo requestInfo = marriageDocTypeRequest.getRequestInfo(); List<Long> ids = marriageDocumentTypeRepository.getIds(marriageDocTypeRequest.getMarriageDocTypes()); List<MarriageDocumentType> updateMarriageDocumentType = new ArrayList<>(); List<MarriageDocumentType> insertMarriageDocumentType = new ArrayList<>(); for (MarriageDocumentType marriageDocumentType : marriageDocTypeRequest.getMarriageDocTypes()) { if (ids.contains(marriageDocumentType.getId())) { updateMarriageDocumentType.add(marriageDocumentType); } else { insertMarriageDocumentType.add(marriageDocumentType); } } if (!insertMarriageDocumentType.isEmpty() && insertMarriageDocumentType != null) { MarriageDocTypeRequest mdtReq = new MarriageDocTypeRequest(); mdtReq.setRequestInfo(requestInfo); mdtReq.setMarriageDocTypes(insertMarriageDocumentType); createAsync(mdtReq); } log.info("Service after IDs set:: MarriageDocTypeRequest: " + marriageDocTypeRequest); System.err.println("marriageDocumentTypeSERVICE ENTERing KAFKA: "); kafkaTemplate.send(propertiesManager.getUpdateMarriageDocumentTypeTopicName(), marriageDocTypeRequest); return getSuccessResponse(marriageDocTypeRequest.getMarriageDocTypes(), requestInfo); }
MarriageDocumentTypeService { public ResponseEntity<?> updateAsync(MarriageDocTypeRequest marriageDocTypeRequest) { log.info("Service:: MarriageDocTypeRequest: " + marriageDocTypeRequest); RequestInfo requestInfo = marriageDocTypeRequest.getRequestInfo(); List<Long> ids = marriageDocumentTypeRepository.getIds(marriageDocTypeRequest.getMarriageDocTypes()); List<MarriageDocumentType> updateMarriageDocumentType = new ArrayList<>(); List<MarriageDocumentType> insertMarriageDocumentType = new ArrayList<>(); for (MarriageDocumentType marriageDocumentType : marriageDocTypeRequest.getMarriageDocTypes()) { if (ids.contains(marriageDocumentType.getId())) { updateMarriageDocumentType.add(marriageDocumentType); } else { insertMarriageDocumentType.add(marriageDocumentType); } } if (!insertMarriageDocumentType.isEmpty() && insertMarriageDocumentType != null) { MarriageDocTypeRequest mdtReq = new MarriageDocTypeRequest(); mdtReq.setRequestInfo(requestInfo); mdtReq.setMarriageDocTypes(insertMarriageDocumentType); createAsync(mdtReq); } log.info("Service after IDs set:: MarriageDocTypeRequest: " + marriageDocTypeRequest); System.err.println("marriageDocumentTypeSERVICE ENTERing KAFKA: "); kafkaTemplate.send(propertiesManager.getUpdateMarriageDocumentTypeTopicName(), marriageDocTypeRequest); return getSuccessResponse(marriageDocTypeRequest.getMarriageDocTypes(), requestInfo); } }
MarriageDocumentTypeService { public ResponseEntity<?> updateAsync(MarriageDocTypeRequest marriageDocTypeRequest) { log.info("Service:: MarriageDocTypeRequest: " + marriageDocTypeRequest); RequestInfo requestInfo = marriageDocTypeRequest.getRequestInfo(); List<Long> ids = marriageDocumentTypeRepository.getIds(marriageDocTypeRequest.getMarriageDocTypes()); List<MarriageDocumentType> updateMarriageDocumentType = new ArrayList<>(); List<MarriageDocumentType> insertMarriageDocumentType = new ArrayList<>(); for (MarriageDocumentType marriageDocumentType : marriageDocTypeRequest.getMarriageDocTypes()) { if (ids.contains(marriageDocumentType.getId())) { updateMarriageDocumentType.add(marriageDocumentType); } else { insertMarriageDocumentType.add(marriageDocumentType); } } if (!insertMarriageDocumentType.isEmpty() && insertMarriageDocumentType != null) { MarriageDocTypeRequest mdtReq = new MarriageDocTypeRequest(); mdtReq.setRequestInfo(requestInfo); mdtReq.setMarriageDocTypes(insertMarriageDocumentType); createAsync(mdtReq); } log.info("Service after IDs set:: MarriageDocTypeRequest: " + marriageDocTypeRequest); System.err.println("marriageDocumentTypeSERVICE ENTERing KAFKA: "); kafkaTemplate.send(propertiesManager.getUpdateMarriageDocumentTypeTopicName(), marriageDocTypeRequest); return getSuccessResponse(marriageDocTypeRequest.getMarriageDocTypes(), requestInfo); }  }
MarriageDocumentTypeService { public ResponseEntity<?> updateAsync(MarriageDocTypeRequest marriageDocTypeRequest) { log.info("Service:: MarriageDocTypeRequest: " + marriageDocTypeRequest); RequestInfo requestInfo = marriageDocTypeRequest.getRequestInfo(); List<Long> ids = marriageDocumentTypeRepository.getIds(marriageDocTypeRequest.getMarriageDocTypes()); List<MarriageDocumentType> updateMarriageDocumentType = new ArrayList<>(); List<MarriageDocumentType> insertMarriageDocumentType = new ArrayList<>(); for (MarriageDocumentType marriageDocumentType : marriageDocTypeRequest.getMarriageDocTypes()) { if (ids.contains(marriageDocumentType.getId())) { updateMarriageDocumentType.add(marriageDocumentType); } else { insertMarriageDocumentType.add(marriageDocumentType); } } if (!insertMarriageDocumentType.isEmpty() && insertMarriageDocumentType != null) { MarriageDocTypeRequest mdtReq = new MarriageDocTypeRequest(); mdtReq.setRequestInfo(requestInfo); mdtReq.setMarriageDocTypes(insertMarriageDocumentType); createAsync(mdtReq); } log.info("Service after IDs set:: MarriageDocTypeRequest: " + marriageDocTypeRequest); System.err.println("marriageDocumentTypeSERVICE ENTERing KAFKA: "); kafkaTemplate.send(propertiesManager.getUpdateMarriageDocumentTypeTopicName(), marriageDocTypeRequest); return getSuccessResponse(marriageDocTypeRequest.getMarriageDocTypes(), requestInfo); }  ResponseEntity<?> search(MarriageDocumentTypeSearchCriteria marriageDocumentTypeSearchCriteria,
			org.egov.common.contract.request.RequestInfo requestInfo); ResponseEntity<?> createAsync(MarriageDocTypeRequest marriageDocTypeRequest); ResponseEntity<?> updateAsync(MarriageDocTypeRequest marriageDocTypeRequest); void create(MarriageDocTypeRequest marriageDocTypeRequest); void update(MarriageDocTypeRequest marriageDocTypeRequest); }
MarriageDocumentTypeService { public ResponseEntity<?> updateAsync(MarriageDocTypeRequest marriageDocTypeRequest) { log.info("Service:: MarriageDocTypeRequest: " + marriageDocTypeRequest); RequestInfo requestInfo = marriageDocTypeRequest.getRequestInfo(); List<Long> ids = marriageDocumentTypeRepository.getIds(marriageDocTypeRequest.getMarriageDocTypes()); List<MarriageDocumentType> updateMarriageDocumentType = new ArrayList<>(); List<MarriageDocumentType> insertMarriageDocumentType = new ArrayList<>(); for (MarriageDocumentType marriageDocumentType : marriageDocTypeRequest.getMarriageDocTypes()) { if (ids.contains(marriageDocumentType.getId())) { updateMarriageDocumentType.add(marriageDocumentType); } else { insertMarriageDocumentType.add(marriageDocumentType); } } if (!insertMarriageDocumentType.isEmpty() && insertMarriageDocumentType != null) { MarriageDocTypeRequest mdtReq = new MarriageDocTypeRequest(); mdtReq.setRequestInfo(requestInfo); mdtReq.setMarriageDocTypes(insertMarriageDocumentType); createAsync(mdtReq); } log.info("Service after IDs set:: MarriageDocTypeRequest: " + marriageDocTypeRequest); System.err.println("marriageDocumentTypeSERVICE ENTERing KAFKA: "); kafkaTemplate.send(propertiesManager.getUpdateMarriageDocumentTypeTopicName(), marriageDocTypeRequest); return getSuccessResponse(marriageDocTypeRequest.getMarriageDocTypes(), requestInfo); }  ResponseEntity<?> search(MarriageDocumentTypeSearchCriteria marriageDocumentTypeSearchCriteria,
			org.egov.common.contract.request.RequestInfo requestInfo); ResponseEntity<?> createAsync(MarriageDocTypeRequest marriageDocTypeRequest); ResponseEntity<?> updateAsync(MarriageDocTypeRequest marriageDocTypeRequest); void create(MarriageDocTypeRequest marriageDocTypeRequest); void update(MarriageDocTypeRequest marriageDocTypeRequest);  }