@Test public void test_update_with_kafka() { List<InstrumentType> expectedResult = getInstrumentTypes(); instrumentTypeRepositoryWithKafka.update(expectedResult, requestInfo); verify(instrumentTypeQueueRepository).addToQue(captor.capture()); final InstrumentTypeRequest actualRequest = captor.getValue(); assertEquals(expectedResult.get(0).getActive(), actualRequest.getInstrumentTypes().get(0).getActive()); assertEquals(expectedResult.get(0).getName(), actualRequest.getInstrumentTypes().get(0).getName()); assertEquals(expectedResult.get(0).getDescription(), actualRequest.getInstrumentTypes().get(0).getDescription()); assertEquals(expectedResult.get(0).getTenantId(), actualRequest.getInstrumentTypes().get(0).getTenantId()); }
@Transactional public List<InstrumentType> update(List<InstrumentType> instrumentTypes, RequestInfo requestInfo) { InstrumentTypeMapper mapper = new InstrumentTypeMapper(); if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { InstrumentTypeRequest request = new InstrumentTypeRequest(); request.setRequestInfo(requestInfo); request.setInstrumentTypes(new ArrayList<>()); for (InstrumentType iac : instrumentTypes) request.getInstrumentTypes().add(mapper.toContract(iac)); instrumentTypeQueueRepository.addToQue(request); return instrumentTypes; } else { List<InstrumentType> resultList = new ArrayList<InstrumentType>(); for (InstrumentType iac : instrumentTypes) resultList.add(update(iac)); InstrumentTypeRequest request = new InstrumentTypeRequest(); request.setRequestInfo(requestInfo); request.setInstrumentTypes(new ArrayList<>()); for (InstrumentType iac : resultList) request.getInstrumentTypes().add(mapper.toContract(iac)); instrumentTypeQueueRepository.addToSearchQue(request); return resultList; } }
InstrumentTypeRepository { @Transactional public List<InstrumentType> update(List<InstrumentType> instrumentTypes, RequestInfo requestInfo) { InstrumentTypeMapper mapper = new InstrumentTypeMapper(); if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { InstrumentTypeRequest request = new InstrumentTypeRequest(); request.setRequestInfo(requestInfo); request.setInstrumentTypes(new ArrayList<>()); for (InstrumentType iac : instrumentTypes) request.getInstrumentTypes().add(mapper.toContract(iac)); instrumentTypeQueueRepository.addToQue(request); return instrumentTypes; } else { List<InstrumentType> resultList = new ArrayList<InstrumentType>(); for (InstrumentType iac : instrumentTypes) resultList.add(update(iac)); InstrumentTypeRequest request = new InstrumentTypeRequest(); request.setRequestInfo(requestInfo); request.setInstrumentTypes(new ArrayList<>()); for (InstrumentType iac : resultList) request.getInstrumentTypes().add(mapper.toContract(iac)); instrumentTypeQueueRepository.addToSearchQue(request); return resultList; } } }
InstrumentTypeRepository { @Transactional public List<InstrumentType> update(List<InstrumentType> instrumentTypes, RequestInfo requestInfo) { InstrumentTypeMapper mapper = new InstrumentTypeMapper(); if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { InstrumentTypeRequest request = new InstrumentTypeRequest(); request.setRequestInfo(requestInfo); request.setInstrumentTypes(new ArrayList<>()); for (InstrumentType iac : instrumentTypes) request.getInstrumentTypes().add(mapper.toContract(iac)); instrumentTypeQueueRepository.addToQue(request); return instrumentTypes; } else { List<InstrumentType> resultList = new ArrayList<InstrumentType>(); for (InstrumentType iac : instrumentTypes) resultList.add(update(iac)); InstrumentTypeRequest request = new InstrumentTypeRequest(); request.setRequestInfo(requestInfo); request.setInstrumentTypes(new ArrayList<>()); for (InstrumentType iac : resultList) request.getInstrumentTypes().add(mapper.toContract(iac)); instrumentTypeQueueRepository.addToSearchQue(request); return resultList; } } @Autowired  InstrumentTypeRepository(InstrumentTypeJdbcRepository instrumentTypeJdbcRepository,
            InstrumentTypeQueueRepository instrumentTypeQueueRepository,
            @Value("${persist.through.kafka}") String persistThroughKafka,
            FinancialConfigurationContractRepository financialConfigurationContractRepository,
            InstrumentTypeESRepository instrumentTypeESRepository); }
InstrumentTypeRepository { @Transactional public List<InstrumentType> update(List<InstrumentType> instrumentTypes, RequestInfo requestInfo) { InstrumentTypeMapper mapper = new InstrumentTypeMapper(); if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { InstrumentTypeRequest request = new InstrumentTypeRequest(); request.setRequestInfo(requestInfo); request.setInstrumentTypes(new ArrayList<>()); for (InstrumentType iac : instrumentTypes) request.getInstrumentTypes().add(mapper.toContract(iac)); instrumentTypeQueueRepository.addToQue(request); return instrumentTypes; } else { List<InstrumentType> resultList = new ArrayList<InstrumentType>(); for (InstrumentType iac : instrumentTypes) resultList.add(update(iac)); InstrumentTypeRequest request = new InstrumentTypeRequest(); request.setRequestInfo(requestInfo); request.setInstrumentTypes(new ArrayList<>()); for (InstrumentType iac : resultList) request.getInstrumentTypes().add(mapper.toContract(iac)); instrumentTypeQueueRepository.addToSearchQue(request); return resultList; } } @Autowired  InstrumentTypeRepository(InstrumentTypeJdbcRepository instrumentTypeJdbcRepository,
            InstrumentTypeQueueRepository instrumentTypeQueueRepository,
            @Value("${persist.through.kafka}") String persistThroughKafka,
            FinancialConfigurationContractRepository financialConfigurationContractRepository,
            InstrumentTypeESRepository instrumentTypeESRepository); InstrumentType findById(InstrumentType instrumentType); @Transactional List<InstrumentType> save(List<InstrumentType> instrumentTypes, RequestInfo requestInfo); @Transactional List<InstrumentType> update(List<InstrumentType> instrumentTypes, RequestInfo requestInfo); @Transactional List<InstrumentType> delete(List<InstrumentType> instrumentTypes, RequestInfo requestInfo); @Transactional InstrumentType save(InstrumentType instrumentType); @Transactional InstrumentType update(InstrumentType instrumentType); @Transactional InstrumentType delete(InstrumentType instrumentType); Pagination<InstrumentType> search(InstrumentTypeSearch domain); boolean uniqueCheck(String fieldName, InstrumentType instrumentType); }
InstrumentTypeRepository { @Transactional public List<InstrumentType> update(List<InstrumentType> instrumentTypes, RequestInfo requestInfo) { InstrumentTypeMapper mapper = new InstrumentTypeMapper(); if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { InstrumentTypeRequest request = new InstrumentTypeRequest(); request.setRequestInfo(requestInfo); request.setInstrumentTypes(new ArrayList<>()); for (InstrumentType iac : instrumentTypes) request.getInstrumentTypes().add(mapper.toContract(iac)); instrumentTypeQueueRepository.addToQue(request); return instrumentTypes; } else { List<InstrumentType> resultList = new ArrayList<InstrumentType>(); for (InstrumentType iac : instrumentTypes) resultList.add(update(iac)); InstrumentTypeRequest request = new InstrumentTypeRequest(); request.setRequestInfo(requestInfo); request.setInstrumentTypes(new ArrayList<>()); for (InstrumentType iac : resultList) request.getInstrumentTypes().add(mapper.toContract(iac)); instrumentTypeQueueRepository.addToSearchQue(request); return resultList; } } @Autowired  InstrumentTypeRepository(InstrumentTypeJdbcRepository instrumentTypeJdbcRepository,
            InstrumentTypeQueueRepository instrumentTypeQueueRepository,
            @Value("${persist.through.kafka}") String persistThroughKafka,
            FinancialConfigurationContractRepository financialConfigurationContractRepository,
            InstrumentTypeESRepository instrumentTypeESRepository); InstrumentType findById(InstrumentType instrumentType); @Transactional List<InstrumentType> save(List<InstrumentType> instrumentTypes, RequestInfo requestInfo); @Transactional List<InstrumentType> update(List<InstrumentType> instrumentTypes, RequestInfo requestInfo); @Transactional List<InstrumentType> delete(List<InstrumentType> instrumentTypes, RequestInfo requestInfo); @Transactional InstrumentType save(InstrumentType instrumentType); @Transactional InstrumentType update(InstrumentType instrumentType); @Transactional InstrumentType delete(InstrumentType instrumentType); Pagination<InstrumentType> search(InstrumentTypeSearch domain); boolean uniqueCheck(String fieldName, InstrumentType instrumentType);  }