@Test public void test_search() { final Pagination<BudgetReAppropriation> expectedResult = new Pagination<>(); expectedResult.setPageSize(500); expectedResult.setOffset(0); when(budgetReAppropriationJdbcRepository.search(any(BudgetReAppropriationSearch.class))) .thenReturn(expectedResult); final Pagination<BudgetReAppropriation> actualResult = budgetReAppropriationRepositoryWithKafka .search(getBudgetReAppropriationSearch()); assertEquals(expectedResult, actualResult); }
public Pagination<BudgetReAppropriation> search(final BudgetReAppropriationSearch domain) { if (financialConfigurationContractRepository.fetchDataFrom() != null && financialConfigurationContractRepository.fetchDataFrom().equalsIgnoreCase("es")) { BudgetReAppropriationMapper mapper = new BudgetReAppropriationMapper(); BudgetReAppropriationSearchContract budgetReAppropriationSearchContract = new BudgetReAppropriationSearchContract(); budgetReAppropriationSearchContract = mapper.toSearchContract(domain); Pagination<BudgetReAppropriation> budgetReAppropriations = budgetReAppropriationESRepository.search(budgetReAppropriationSearchContract); return budgetReAppropriations; } else { return budgetReAppropriationJdbcRepository.search(domain); } }
BudgetReAppropriationRepository { public Pagination<BudgetReAppropriation> search(final BudgetReAppropriationSearch domain) { if (financialConfigurationContractRepository.fetchDataFrom() != null && financialConfigurationContractRepository.fetchDataFrom().equalsIgnoreCase("es")) { BudgetReAppropriationMapper mapper = new BudgetReAppropriationMapper(); BudgetReAppropriationSearchContract budgetReAppropriationSearchContract = new BudgetReAppropriationSearchContract(); budgetReAppropriationSearchContract = mapper.toSearchContract(domain); Pagination<BudgetReAppropriation> budgetReAppropriations = budgetReAppropriationESRepository.search(budgetReAppropriationSearchContract); return budgetReAppropriations; } else { return budgetReAppropriationJdbcRepository.search(domain); } } }
BudgetReAppropriationRepository { public Pagination<BudgetReAppropriation> search(final BudgetReAppropriationSearch domain) { if (financialConfigurationContractRepository.fetchDataFrom() != null && financialConfigurationContractRepository.fetchDataFrom().equalsIgnoreCase("es")) { BudgetReAppropriationMapper mapper = new BudgetReAppropriationMapper(); BudgetReAppropriationSearchContract budgetReAppropriationSearchContract = new BudgetReAppropriationSearchContract(); budgetReAppropriationSearchContract = mapper.toSearchContract(domain); Pagination<BudgetReAppropriation> budgetReAppropriations = budgetReAppropriationESRepository.search(budgetReAppropriationSearchContract); return budgetReAppropriations; } else { return budgetReAppropriationJdbcRepository.search(domain); } } @Autowired  BudgetReAppropriationRepository(final BudgetReAppropriationJdbcRepository budgetReAppropriationJdbcRepository,
                                           final BudgetReAppropriationQueueRepository budgetReAppropriationQueueRepository,
                                           @Value("${persist.through.kafka}") final String persistThroughKafka,
                                           FinancialConfigurationContractRepository financialConfigurationContractRepository,
                                           BudgetReAppropriationESRepository budgetReAppropriationESRepository
    ); }
BudgetReAppropriationRepository { public Pagination<BudgetReAppropriation> search(final BudgetReAppropriationSearch domain) { if (financialConfigurationContractRepository.fetchDataFrom() != null && financialConfigurationContractRepository.fetchDataFrom().equalsIgnoreCase("es")) { BudgetReAppropriationMapper mapper = new BudgetReAppropriationMapper(); BudgetReAppropriationSearchContract budgetReAppropriationSearchContract = new BudgetReAppropriationSearchContract(); budgetReAppropriationSearchContract = mapper.toSearchContract(domain); Pagination<BudgetReAppropriation> budgetReAppropriations = budgetReAppropriationESRepository.search(budgetReAppropriationSearchContract); return budgetReAppropriations; } else { return budgetReAppropriationJdbcRepository.search(domain); } } @Autowired  BudgetReAppropriationRepository(final BudgetReAppropriationJdbcRepository budgetReAppropriationJdbcRepository,
                                           final BudgetReAppropriationQueueRepository budgetReAppropriationQueueRepository,
                                           @Value("${persist.through.kafka}") final String persistThroughKafka,
                                           FinancialConfigurationContractRepository financialConfigurationContractRepository,
                                           BudgetReAppropriationESRepository budgetReAppropriationESRepository
    ); BudgetReAppropriation findById(final BudgetReAppropriation budgetReAppropriation); @Transactional List<BudgetReAppropriation> save(final List<BudgetReAppropriation> budgetReAppropriations,
                                            final RequestInfo requestInfo); @Transactional List<BudgetReAppropriation> update(final List<BudgetReAppropriation> budgetReAppropriations,
                                              final RequestInfo requestInfo); @Transactional List<BudgetReAppropriation> delete(final List<BudgetReAppropriation> budgetReAppropriations,
                                              final RequestInfo requestInfo); @Transactional BudgetReAppropriation save(final BudgetReAppropriation budgetReAppropriation); @Transactional BudgetReAppropriation update(final BudgetReAppropriation entity); @Transactional BudgetReAppropriation delete(final BudgetReAppropriation entity); Pagination<BudgetReAppropriation> search(final BudgetReAppropriationSearch domain); boolean uniqueCheck(String fieldName, BudgetReAppropriation budgetReAppropriation); }
BudgetReAppropriationRepository { public Pagination<BudgetReAppropriation> search(final BudgetReAppropriationSearch domain) { if (financialConfigurationContractRepository.fetchDataFrom() != null && financialConfigurationContractRepository.fetchDataFrom().equalsIgnoreCase("es")) { BudgetReAppropriationMapper mapper = new BudgetReAppropriationMapper(); BudgetReAppropriationSearchContract budgetReAppropriationSearchContract = new BudgetReAppropriationSearchContract(); budgetReAppropriationSearchContract = mapper.toSearchContract(domain); Pagination<BudgetReAppropriation> budgetReAppropriations = budgetReAppropriationESRepository.search(budgetReAppropriationSearchContract); return budgetReAppropriations; } else { return budgetReAppropriationJdbcRepository.search(domain); } } @Autowired  BudgetReAppropriationRepository(final BudgetReAppropriationJdbcRepository budgetReAppropriationJdbcRepository,
                                           final BudgetReAppropriationQueueRepository budgetReAppropriationQueueRepository,
                                           @Value("${persist.through.kafka}") final String persistThroughKafka,
                                           FinancialConfigurationContractRepository financialConfigurationContractRepository,
                                           BudgetReAppropriationESRepository budgetReAppropriationESRepository
    ); BudgetReAppropriation findById(final BudgetReAppropriation budgetReAppropriation); @Transactional List<BudgetReAppropriation> save(final List<BudgetReAppropriation> budgetReAppropriations,
                                            final RequestInfo requestInfo); @Transactional List<BudgetReAppropriation> update(final List<BudgetReAppropriation> budgetReAppropriations,
                                              final RequestInfo requestInfo); @Transactional List<BudgetReAppropriation> delete(final List<BudgetReAppropriation> budgetReAppropriations,
                                              final RequestInfo requestInfo); @Transactional BudgetReAppropriation save(final BudgetReAppropriation budgetReAppropriation); @Transactional BudgetReAppropriation update(final BudgetReAppropriation entity); @Transactional BudgetReAppropriation delete(final BudgetReAppropriation entity); Pagination<BudgetReAppropriation> search(final BudgetReAppropriationSearch domain); boolean uniqueCheck(String fieldName, BudgetReAppropriation budgetReAppropriation);  }