@Test public void testCreateAsync() { MarriageDocTypeResponse mdtResponse = null; try { mdtResponse = getResponse("org/egov/mr/service/marriageDocumentTypeCreateResponseAsDB.json"); } catch (Exception e) { e.printStackTrace(); fail(); } List<MarriageDocumentType> marriageDocumentType = getMarriageDocumentTypesForCreate(); MarriageDocTypeRequest marriageDocTypeRequest = new MarriageDocTypeRequest(); marriageDocTypeRequest.setMarriageDocTypes(marriageDocumentType); RequestInfo requestInfo = new RequestInfo(); requestInfo.setTs(Long.valueOf("987456321")); marriageDocTypeRequest.setRequestInfo(requestInfo); 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)); ResponseEntity<?> resEntity = marriageDocumentTypeService.createAsync(marriageDocTypeRequest); assertEquals(Long.valueOf("200").toString(), resEntity.getStatusCode().toString()); System.err.println(mdtResponse); System.err.println(resEntity.getBody()); assertEquals(mdtResponse, resEntity.getBody()); }
public ResponseEntity<?> createAsync(MarriageDocTypeRequest marriageDocTypeRequest) { log.info("Service:: MarriageDocTypeRequest: " + marriageDocTypeRequest); RequestInfo requestInfo = marriageDocTypeRequest.getRequestInfo(); List<MarriageDocumentType> marriageDocumentTypes = marriageDocTypeRequest.getMarriageDocTypes(); Integer size = marriageDocumentTypes.size(); List<Long> ids = sequenceIdGenService.idSeqGen(size, "seq_marriage_document_type"); for (int index = 0; index < size; index++) { marriageDocumentTypes.get(index).setId(ids.get(index)); } List<Long> codes = sequenceIdGenService.codeSeqGen(size, "seq_marriage_document_type_code"); for (int index = 0; index < size; index++) { marriageDocumentTypes.get(index).setCode(codes.get(index).toString()); } log.info("Service after IDs set:: MarriageDocTypeRequest: " + marriageDocTypeRequest); kafkaTemplate.send(propertiesManager.getCreateMarriageDocumentTypeTopicName(), marriageDocTypeRequest); return getSuccessResponse(marriageDocTypeRequest.getMarriageDocTypes(), requestInfo); }
MarriageDocumentTypeService { public ResponseEntity<?> createAsync(MarriageDocTypeRequest marriageDocTypeRequest) { log.info("Service:: MarriageDocTypeRequest: " + marriageDocTypeRequest); RequestInfo requestInfo = marriageDocTypeRequest.getRequestInfo(); List<MarriageDocumentType> marriageDocumentTypes = marriageDocTypeRequest.getMarriageDocTypes(); Integer size = marriageDocumentTypes.size(); List<Long> ids = sequenceIdGenService.idSeqGen(size, "seq_marriage_document_type"); for (int index = 0; index < size; index++) { marriageDocumentTypes.get(index).setId(ids.get(index)); } List<Long> codes = sequenceIdGenService.codeSeqGen(size, "seq_marriage_document_type_code"); for (int index = 0; index < size; index++) { marriageDocumentTypes.get(index).setCode(codes.get(index).toString()); } log.info("Service after IDs set:: MarriageDocTypeRequest: " + marriageDocTypeRequest); kafkaTemplate.send(propertiesManager.getCreateMarriageDocumentTypeTopicName(), marriageDocTypeRequest); return getSuccessResponse(marriageDocTypeRequest.getMarriageDocTypes(), requestInfo); } }
MarriageDocumentTypeService { public ResponseEntity<?> createAsync(MarriageDocTypeRequest marriageDocTypeRequest) { log.info("Service:: MarriageDocTypeRequest: " + marriageDocTypeRequest); RequestInfo requestInfo = marriageDocTypeRequest.getRequestInfo(); List<MarriageDocumentType> marriageDocumentTypes = marriageDocTypeRequest.getMarriageDocTypes(); Integer size = marriageDocumentTypes.size(); List<Long> ids = sequenceIdGenService.idSeqGen(size, "seq_marriage_document_type"); for (int index = 0; index < size; index++) { marriageDocumentTypes.get(index).setId(ids.get(index)); } List<Long> codes = sequenceIdGenService.codeSeqGen(size, "seq_marriage_document_type_code"); for (int index = 0; index < size; index++) { marriageDocumentTypes.get(index).setCode(codes.get(index).toString()); } log.info("Service after IDs set:: MarriageDocTypeRequest: " + marriageDocTypeRequest); kafkaTemplate.send(propertiesManager.getCreateMarriageDocumentTypeTopicName(), marriageDocTypeRequest); return getSuccessResponse(marriageDocTypeRequest.getMarriageDocTypes(), requestInfo); }  }
MarriageDocumentTypeService { public ResponseEntity<?> createAsync(MarriageDocTypeRequest marriageDocTypeRequest) { log.info("Service:: MarriageDocTypeRequest: " + marriageDocTypeRequest); RequestInfo requestInfo = marriageDocTypeRequest.getRequestInfo(); List<MarriageDocumentType> marriageDocumentTypes = marriageDocTypeRequest.getMarriageDocTypes(); Integer size = marriageDocumentTypes.size(); List<Long> ids = sequenceIdGenService.idSeqGen(size, "seq_marriage_document_type"); for (int index = 0; index < size; index++) { marriageDocumentTypes.get(index).setId(ids.get(index)); } List<Long> codes = sequenceIdGenService.codeSeqGen(size, "seq_marriage_document_type_code"); for (int index = 0; index < size; index++) { marriageDocumentTypes.get(index).setCode(codes.get(index).toString()); } log.info("Service after IDs set:: MarriageDocTypeRequest: " + marriageDocTypeRequest); kafkaTemplate.send(propertiesManager.getCreateMarriageDocumentTypeTopicName(), 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<?> createAsync(MarriageDocTypeRequest marriageDocTypeRequest) { log.info("Service:: MarriageDocTypeRequest: " + marriageDocTypeRequest); RequestInfo requestInfo = marriageDocTypeRequest.getRequestInfo(); List<MarriageDocumentType> marriageDocumentTypes = marriageDocTypeRequest.getMarriageDocTypes(); Integer size = marriageDocumentTypes.size(); List<Long> ids = sequenceIdGenService.idSeqGen(size, "seq_marriage_document_type"); for (int index = 0; index < size; index++) { marriageDocumentTypes.get(index).setId(ids.get(index)); } List<Long> codes = sequenceIdGenService.codeSeqGen(size, "seq_marriage_document_type_code"); for (int index = 0; index < size; index++) { marriageDocumentTypes.get(index).setCode(codes.get(index).toString()); } log.info("Service after IDs set:: MarriageDocTypeRequest: " + marriageDocTypeRequest); kafkaTemplate.send(propertiesManager.getCreateMarriageDocumentTypeTopicName(), 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);  }