@Test public void test_search() { final Pagination<BudgetDetail> expectedResult = new Pagination<>(); expectedResult.setPageSize(500); expectedResult.setOffset(0); when(budgetDetailJdbcRepository.search(any(BudgetDetailSearch.class))).thenReturn(expectedResult); final Pagination<BudgetDetail> actualResult = budgetDetailRepositoryWithKafka.search(getBudgetDetailSearch()); assertEquals(expectedResult, actualResult); }
public Pagination<BudgetDetail> search(final BudgetDetailSearch domain) { if (financialConfigurationContractRepository.fetchDataFrom() != null && financialConfigurationContractRepository.fetchDataFrom().equalsIgnoreCase("es")) { BudgetDetailMapper mapper = new BudgetDetailMapper(); BudgetDetailSearchContract budgetDetailSearchContract = new BudgetDetailSearchContract(); budgetDetailSearchContract = mapper.toSearchContract(domain); Pagination<BudgetDetail> budgetDetails = budgetDetailESRepository.search(budgetDetailSearchContract); return budgetDetails; } else { return budgetDetailJdbcRepository.search(domain); } }
BudgetDetailRepository { public Pagination<BudgetDetail> search(final BudgetDetailSearch domain) { if (financialConfigurationContractRepository.fetchDataFrom() != null && financialConfigurationContractRepository.fetchDataFrom().equalsIgnoreCase("es")) { BudgetDetailMapper mapper = new BudgetDetailMapper(); BudgetDetailSearchContract budgetDetailSearchContract = new BudgetDetailSearchContract(); budgetDetailSearchContract = mapper.toSearchContract(domain); Pagination<BudgetDetail> budgetDetails = budgetDetailESRepository.search(budgetDetailSearchContract); return budgetDetails; } else { return budgetDetailJdbcRepository.search(domain); } } }
BudgetDetailRepository { public Pagination<BudgetDetail> search(final BudgetDetailSearch domain) { if (financialConfigurationContractRepository.fetchDataFrom() != null && financialConfigurationContractRepository.fetchDataFrom().equalsIgnoreCase("es")) { BudgetDetailMapper mapper = new BudgetDetailMapper(); BudgetDetailSearchContract budgetDetailSearchContract = new BudgetDetailSearchContract(); budgetDetailSearchContract = mapper.toSearchContract(domain); Pagination<BudgetDetail> budgetDetails = budgetDetailESRepository.search(budgetDetailSearchContract); return budgetDetails; } else { return budgetDetailJdbcRepository.search(domain); } } @Autowired  BudgetDetailRepository(final BudgetDetailJdbcRepository budgetDetailJdbcRepository,
                                  final BudgetDetailQueueRepository budgetDetailQueueRepository,
                                  @Value("${persist.through.kafka}") final String persistThroughKafka,
                                  FinancialConfigurationContractRepository financialConfigurationContractRepository,
                                  BudgetDetailESRepository budgetDetailESRepository
    ); }
BudgetDetailRepository { public Pagination<BudgetDetail> search(final BudgetDetailSearch domain) { if (financialConfigurationContractRepository.fetchDataFrom() != null && financialConfigurationContractRepository.fetchDataFrom().equalsIgnoreCase("es")) { BudgetDetailMapper mapper = new BudgetDetailMapper(); BudgetDetailSearchContract budgetDetailSearchContract = new BudgetDetailSearchContract(); budgetDetailSearchContract = mapper.toSearchContract(domain); Pagination<BudgetDetail> budgetDetails = budgetDetailESRepository.search(budgetDetailSearchContract); return budgetDetails; } else { return budgetDetailJdbcRepository.search(domain); } } @Autowired  BudgetDetailRepository(final BudgetDetailJdbcRepository budgetDetailJdbcRepository,
                                  final BudgetDetailQueueRepository budgetDetailQueueRepository,
                                  @Value("${persist.through.kafka}") final String persistThroughKafka,
                                  FinancialConfigurationContractRepository financialConfigurationContractRepository,
                                  BudgetDetailESRepository budgetDetailESRepository
    ); BudgetDetail findById(final BudgetDetail budgetDetail); @Transactional List<BudgetDetail> save(final List<BudgetDetail> budgetDetails, final RequestInfo requestInfo); @Transactional List<BudgetDetail> update(final List<BudgetDetail> budgetDetails, final RequestInfo requestInfo); @Transactional List<BudgetDetail> delete(final List<BudgetDetail> budgetDetails, final RequestInfo requestInfo); @Transactional BudgetDetail save(final BudgetDetail budgetDetail); @Transactional BudgetDetail update(final BudgetDetail entity); @Transactional BudgetDetail delete(final BudgetDetail entity); Pagination<BudgetDetail> search(final BudgetDetailSearch domain); boolean uniqueCheck(String fieldName, BudgetDetail budgetDetail); }
BudgetDetailRepository { public Pagination<BudgetDetail> search(final BudgetDetailSearch domain) { if (financialConfigurationContractRepository.fetchDataFrom() != null && financialConfigurationContractRepository.fetchDataFrom().equalsIgnoreCase("es")) { BudgetDetailMapper mapper = new BudgetDetailMapper(); BudgetDetailSearchContract budgetDetailSearchContract = new BudgetDetailSearchContract(); budgetDetailSearchContract = mapper.toSearchContract(domain); Pagination<BudgetDetail> budgetDetails = budgetDetailESRepository.search(budgetDetailSearchContract); return budgetDetails; } else { return budgetDetailJdbcRepository.search(domain); } } @Autowired  BudgetDetailRepository(final BudgetDetailJdbcRepository budgetDetailJdbcRepository,
                                  final BudgetDetailQueueRepository budgetDetailQueueRepository,
                                  @Value("${persist.through.kafka}") final String persistThroughKafka,
                                  FinancialConfigurationContractRepository financialConfigurationContractRepository,
                                  BudgetDetailESRepository budgetDetailESRepository
    ); BudgetDetail findById(final BudgetDetail budgetDetail); @Transactional List<BudgetDetail> save(final List<BudgetDetail> budgetDetails, final RequestInfo requestInfo); @Transactional List<BudgetDetail> update(final List<BudgetDetail> budgetDetails, final RequestInfo requestInfo); @Transactional List<BudgetDetail> delete(final List<BudgetDetail> budgetDetails, final RequestInfo requestInfo); @Transactional BudgetDetail save(final BudgetDetail budgetDetail); @Transactional BudgetDetail update(final BudgetDetail entity); @Transactional BudgetDetail delete(final BudgetDetail entity); Pagination<BudgetDetail> search(final BudgetDetailSearch domain); boolean uniqueCheck(String fieldName, BudgetDetail budgetDetail);  }