@Test public void test_save() { SurrenderReasonEntity entity = getSurrenderReasonEntity(); SurrenderReason expectedResult = entity.toDomain(); when(surrenderReasonJdbcRepository.create(any(SurrenderReasonEntity.class))).thenReturn(entity); SurrenderReason actualResult = surrenderReasonRepositoryWithKafka.save(getSurrenderReasonDomin()); assertEquals(expectedResult.getName(), actualResult.getName()); assertEquals(expectedResult.getDescription(), actualResult.getDescription()); assertEquals(expectedResult.getTenantId(), actualResult.getTenantId()); }
@Transactional public List<SurrenderReason> save(List<SurrenderReason> surrenderReasons, RequestInfo requestInfo) { SurrenderReasonMapper mapper = new SurrenderReasonMapper(); if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { SurrenderReasonRequest request = new SurrenderReasonRequest(); request.setRequestInfo(requestInfo); request.setSurrenderReasons(new ArrayList<>()); for (SurrenderReason iac : surrenderReasons) request.getSurrenderReasons().add(mapper.toContract(iac)); surrenderReasonQueueRepository.addToQue(request); return surrenderReasons; } else { List<SurrenderReason> resultList = new ArrayList<SurrenderReason>(); for (SurrenderReason iac : surrenderReasons) resultList.add(save(iac)); SurrenderReasonRequest request = new SurrenderReasonRequest(); request.setRequestInfo(requestInfo); request.setSurrenderReasons(new ArrayList<>()); for (SurrenderReason iac : resultList) request.getSurrenderReasons().add(mapper.toContract(iac)); surrenderReasonQueueRepository.addToSearchQue(request); return resultList; } }
SurrenderReasonRepository { @Transactional public List<SurrenderReason> save(List<SurrenderReason> surrenderReasons, RequestInfo requestInfo) { SurrenderReasonMapper mapper = new SurrenderReasonMapper(); if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { SurrenderReasonRequest request = new SurrenderReasonRequest(); request.setRequestInfo(requestInfo); request.setSurrenderReasons(new ArrayList<>()); for (SurrenderReason iac : surrenderReasons) request.getSurrenderReasons().add(mapper.toContract(iac)); surrenderReasonQueueRepository.addToQue(request); return surrenderReasons; } else { List<SurrenderReason> resultList = new ArrayList<SurrenderReason>(); for (SurrenderReason iac : surrenderReasons) resultList.add(save(iac)); SurrenderReasonRequest request = new SurrenderReasonRequest(); request.setRequestInfo(requestInfo); request.setSurrenderReasons(new ArrayList<>()); for (SurrenderReason iac : resultList) request.getSurrenderReasons().add(mapper.toContract(iac)); surrenderReasonQueueRepository.addToSearchQue(request); return resultList; } } }
SurrenderReasonRepository { @Transactional public List<SurrenderReason> save(List<SurrenderReason> surrenderReasons, RequestInfo requestInfo) { SurrenderReasonMapper mapper = new SurrenderReasonMapper(); if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { SurrenderReasonRequest request = new SurrenderReasonRequest(); request.setRequestInfo(requestInfo); request.setSurrenderReasons(new ArrayList<>()); for (SurrenderReason iac : surrenderReasons) request.getSurrenderReasons().add(mapper.toContract(iac)); surrenderReasonQueueRepository.addToQue(request); return surrenderReasons; } else { List<SurrenderReason> resultList = new ArrayList<SurrenderReason>(); for (SurrenderReason iac : surrenderReasons) resultList.add(save(iac)); SurrenderReasonRequest request = new SurrenderReasonRequest(); request.setRequestInfo(requestInfo); request.setSurrenderReasons(new ArrayList<>()); for (SurrenderReason iac : resultList) request.getSurrenderReasons().add(mapper.toContract(iac)); surrenderReasonQueueRepository.addToSearchQue(request); return resultList; } } @Autowired  SurrenderReasonRepository(SurrenderReasonJdbcRepository surrenderReasonJdbcRepository,
            SurrenderReasonQueueRepository surrenderReasonQueueRepository,
            @Value("${persist.through.kafka}") String persistThroughKafka,
            FinancialConfigurationContractRepository financialConfigurationContractRepository,
            SurrenderReasonESRepository surrenderReasonESRepository); }
SurrenderReasonRepository { @Transactional public List<SurrenderReason> save(List<SurrenderReason> surrenderReasons, RequestInfo requestInfo) { SurrenderReasonMapper mapper = new SurrenderReasonMapper(); if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { SurrenderReasonRequest request = new SurrenderReasonRequest(); request.setRequestInfo(requestInfo); request.setSurrenderReasons(new ArrayList<>()); for (SurrenderReason iac : surrenderReasons) request.getSurrenderReasons().add(mapper.toContract(iac)); surrenderReasonQueueRepository.addToQue(request); return surrenderReasons; } else { List<SurrenderReason> resultList = new ArrayList<SurrenderReason>(); for (SurrenderReason iac : surrenderReasons) resultList.add(save(iac)); SurrenderReasonRequest request = new SurrenderReasonRequest(); request.setRequestInfo(requestInfo); request.setSurrenderReasons(new ArrayList<>()); for (SurrenderReason iac : resultList) request.getSurrenderReasons().add(mapper.toContract(iac)); surrenderReasonQueueRepository.addToSearchQue(request); return resultList; } } @Autowired  SurrenderReasonRepository(SurrenderReasonJdbcRepository surrenderReasonJdbcRepository,
            SurrenderReasonQueueRepository surrenderReasonQueueRepository,
            @Value("${persist.through.kafka}") String persistThroughKafka,
            FinancialConfigurationContractRepository financialConfigurationContractRepository,
            SurrenderReasonESRepository surrenderReasonESRepository); SurrenderReason findById(SurrenderReason surrenderReason); @Transactional List<SurrenderReason> save(List<SurrenderReason> surrenderReasons, RequestInfo requestInfo); @Transactional List<SurrenderReason> update(List<SurrenderReason> surrenderReasons, RequestInfo requestInfo); @Transactional List<SurrenderReason> delete(List<SurrenderReason> surrenderReasons, RequestInfo requestInfo); @Transactional SurrenderReason save(SurrenderReason surrenderReason); @Transactional SurrenderReason update(SurrenderReason surrenderReason); @Transactional SurrenderReason delete(SurrenderReason surrenderReason); Pagination<SurrenderReason> search(SurrenderReasonSearch domain); boolean uniqueCheck(String fieldName, SurrenderReason surrenderReason); }
SurrenderReasonRepository { @Transactional public List<SurrenderReason> save(List<SurrenderReason> surrenderReasons, RequestInfo requestInfo) { SurrenderReasonMapper mapper = new SurrenderReasonMapper(); if (persistThroughKafka != null && !persistThroughKafka.isEmpty() && persistThroughKafka.equalsIgnoreCase("yes")) { SurrenderReasonRequest request = new SurrenderReasonRequest(); request.setRequestInfo(requestInfo); request.setSurrenderReasons(new ArrayList<>()); for (SurrenderReason iac : surrenderReasons) request.getSurrenderReasons().add(mapper.toContract(iac)); surrenderReasonQueueRepository.addToQue(request); return surrenderReasons; } else { List<SurrenderReason> resultList = new ArrayList<SurrenderReason>(); for (SurrenderReason iac : surrenderReasons) resultList.add(save(iac)); SurrenderReasonRequest request = new SurrenderReasonRequest(); request.setRequestInfo(requestInfo); request.setSurrenderReasons(new ArrayList<>()); for (SurrenderReason iac : resultList) request.getSurrenderReasons().add(mapper.toContract(iac)); surrenderReasonQueueRepository.addToSearchQue(request); return resultList; } } @Autowired  SurrenderReasonRepository(SurrenderReasonJdbcRepository surrenderReasonJdbcRepository,
            SurrenderReasonQueueRepository surrenderReasonQueueRepository,
            @Value("${persist.through.kafka}") String persistThroughKafka,
            FinancialConfigurationContractRepository financialConfigurationContractRepository,
            SurrenderReasonESRepository surrenderReasonESRepository); SurrenderReason findById(SurrenderReason surrenderReason); @Transactional List<SurrenderReason> save(List<SurrenderReason> surrenderReasons, RequestInfo requestInfo); @Transactional List<SurrenderReason> update(List<SurrenderReason> surrenderReasons, RequestInfo requestInfo); @Transactional List<SurrenderReason> delete(List<SurrenderReason> surrenderReasons, RequestInfo requestInfo); @Transactional SurrenderReason save(SurrenderReason surrenderReason); @Transactional SurrenderReason update(SurrenderReason surrenderReason); @Transactional SurrenderReason delete(SurrenderReason surrenderReason); Pagination<SurrenderReason> search(SurrenderReasonSearch domain); boolean uniqueCheck(String fieldName, SurrenderReason surrenderReason);  }