@Test public void testUpdatee() { FundEntity fundEntity = getFundEntity(); Fund expectedResult = fundEntity.toDomain(); when(fundJdbcRepository.update(any(FundEntity.class))).thenReturn(fundEntity); Fund actualResult = fundRepository.update(getFundDomain()); assertEquals(expectedResult, actualResult); }
@Transactional public List<Fund> update(List<Fund> funds, RequestInfo requestInfo) { ModelMapper mapper = new ModelMapper(); Map<String, Object> message = new HashMap<>(); FundRequest request = new FundRequest(); FundContract contract; if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { request.setRequestInfo(requestInfo); request.setFunds(new ArrayList<>()); for (Fund f : funds) { contract = new FundContract(); contract.setCreatedDate(new Date()); mapper.map(f, contract); request.getFunds().add(contract); } message.put("fund_update", request); fundQueueRepository.add(message); return funds; } else { List<Fund> resultList = new ArrayList<Fund>(); for (Fund f : funds) { resultList.add(update(f)); } request.setRequestInfo(requestInfo); request.setFunds(new ArrayList<>()); for (Fund f : resultList) { contract = new FundContract(); contract.setCreatedDate(new Date()); mapper.map(f, contract); request.getFunds().add(contract); } message.put("fund_persisted", request); fundQueueRepository.addToSearch(message); return resultList; } }
FundRepository { @Transactional public List<Fund> update(List<Fund> funds, RequestInfo requestInfo) { ModelMapper mapper = new ModelMapper(); Map<String, Object> message = new HashMap<>(); FundRequest request = new FundRequest(); FundContract contract; if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { request.setRequestInfo(requestInfo); request.setFunds(new ArrayList<>()); for (Fund f : funds) { contract = new FundContract(); contract.setCreatedDate(new Date()); mapper.map(f, contract); request.getFunds().add(contract); } message.put("fund_update", request); fundQueueRepository.add(message); return funds; } else { List<Fund> resultList = new ArrayList<Fund>(); for (Fund f : funds) { resultList.add(update(f)); } request.setRequestInfo(requestInfo); request.setFunds(new ArrayList<>()); for (Fund f : resultList) { contract = new FundContract(); contract.setCreatedDate(new Date()); mapper.map(f, contract); request.getFunds().add(contract); } message.put("fund_persisted", request); fundQueueRepository.addToSearch(message); return resultList; } } }
FundRepository { @Transactional public List<Fund> update(List<Fund> funds, RequestInfo requestInfo) { ModelMapper mapper = new ModelMapper(); Map<String, Object> message = new HashMap<>(); FundRequest request = new FundRequest(); FundContract contract; if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { request.setRequestInfo(requestInfo); request.setFunds(new ArrayList<>()); for (Fund f : funds) { contract = new FundContract(); contract.setCreatedDate(new Date()); mapper.map(f, contract); request.getFunds().add(contract); } message.put("fund_update", request); fundQueueRepository.add(message); return funds; } else { List<Fund> resultList = new ArrayList<Fund>(); for (Fund f : funds) { resultList.add(update(f)); } request.setRequestInfo(requestInfo); request.setFunds(new ArrayList<>()); for (Fund f : resultList) { contract = new FundContract(); contract.setCreatedDate(new Date()); mapper.map(f, contract); request.getFunds().add(contract); } message.put("fund_persisted", request); fundQueueRepository.addToSearch(message); return resultList; } } @Autowired  FundRepository(FundJdbcRepository fundJdbcRepository, MastersQueueRepository fundQueueRepository,
			FinancialConfigurationService financialConfigurationService, FundESRepository fundESRepository,
			@Value("${persist.through.kafka}") String persistThroughKafka); }
FundRepository { @Transactional public List<Fund> update(List<Fund> funds, RequestInfo requestInfo) { ModelMapper mapper = new ModelMapper(); Map<String, Object> message = new HashMap<>(); FundRequest request = new FundRequest(); FundContract contract; if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { request.setRequestInfo(requestInfo); request.setFunds(new ArrayList<>()); for (Fund f : funds) { contract = new FundContract(); contract.setCreatedDate(new Date()); mapper.map(f, contract); request.getFunds().add(contract); } message.put("fund_update", request); fundQueueRepository.add(message); return funds; } else { List<Fund> resultList = new ArrayList<Fund>(); for (Fund f : funds) { resultList.add(update(f)); } request.setRequestInfo(requestInfo); request.setFunds(new ArrayList<>()); for (Fund f : resultList) { contract = new FundContract(); contract.setCreatedDate(new Date()); mapper.map(f, contract); request.getFunds().add(contract); } message.put("fund_persisted", request); fundQueueRepository.addToSearch(message); return resultList; } } @Autowired  FundRepository(FundJdbcRepository fundJdbcRepository, MastersQueueRepository fundQueueRepository,
			FinancialConfigurationService financialConfigurationService, FundESRepository fundESRepository,
			@Value("${persist.through.kafka}") String persistThroughKafka); @Transactional List<Fund> save(List<Fund> funds, RequestInfo requestInfo); @Transactional List<Fund> update(List<Fund> funds, RequestInfo requestInfo); String getNextSequence(); Fund findById(Fund fund); @Transactional Fund save(Fund fund); @Transactional Fund update(Fund fund); Pagination<Fund> search(FundSearch domain); boolean uniqueCheck(String fieldName, Fund fund); }
FundRepository { @Transactional public List<Fund> update(List<Fund> funds, RequestInfo requestInfo) { ModelMapper mapper = new ModelMapper(); Map<String, Object> message = new HashMap<>(); FundRequest request = new FundRequest(); FundContract contract; if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { request.setRequestInfo(requestInfo); request.setFunds(new ArrayList<>()); for (Fund f : funds) { contract = new FundContract(); contract.setCreatedDate(new Date()); mapper.map(f, contract); request.getFunds().add(contract); } message.put("fund_update", request); fundQueueRepository.add(message); return funds; } else { List<Fund> resultList = new ArrayList<Fund>(); for (Fund f : funds) { resultList.add(update(f)); } request.setRequestInfo(requestInfo); request.setFunds(new ArrayList<>()); for (Fund f : resultList) { contract = new FundContract(); contract.setCreatedDate(new Date()); mapper.map(f, contract); request.getFunds().add(contract); } message.put("fund_persisted", request); fundQueueRepository.addToSearch(message); return resultList; } } @Autowired  FundRepository(FundJdbcRepository fundJdbcRepository, MastersQueueRepository fundQueueRepository,
			FinancialConfigurationService financialConfigurationService, FundESRepository fundESRepository,
			@Value("${persist.through.kafka}") String persistThroughKafka); @Transactional List<Fund> save(List<Fund> funds, RequestInfo requestInfo); @Transactional List<Fund> update(List<Fund> funds, RequestInfo requestInfo); String getNextSequence(); Fund findById(Fund fund); @Transactional Fund save(Fund fund); @Transactional Fund update(Fund fund); Pagination<Fund> search(FundSearch domain); boolean uniqueCheck(String fieldName, Fund fund);  }