@Test public void testCreatedDate() throws Exception { DateTime now = DateTime.now(); DateTime secondsBefore = now.minusSeconds(2); DateTime secondsAfter = now.plusSeconds(2); TMTestData tmTestData = new TMTestData(testIdWatcher); TextUnitSearcherParameters textUnitSearcherParameters = new TextUnitSearcherParameters(); textUnitSearcherParameters.setRepositoryIds(tmTestData.repository.getId()); textUnitSearcherParameters.setUsedFilter(UsedFilter.USED); List<TextUnitDTO> search = textUnitSearcher.search(textUnitSearcherParameters); assertEquals(8, search.size()); textUnitSearcherParameters.setTmTextUnitCreatedBefore(secondsBefore); search = textUnitSearcher.search(textUnitSearcherParameters); assertEquals(0, search.size()); textUnitSearcherParameters.setTmTextUnitCreatedAfter(secondsBefore); textUnitSearcherParameters.setTmTextUnitCreatedBefore(null); search = textUnitSearcher.search(textUnitSearcherParameters); assertEquals(8, search.size()); textUnitSearcherParameters.setTmTextUnitCreatedAfter(secondsBefore); textUnitSearcherParameters.setTmTextUnitCreatedBefore(secondsAfter); search = textUnitSearcher.search(textUnitSearcherParameters); assertEquals(8, search.size()); textUnitSearcherParameters.setTmTextUnitCreatedAfter(secondsAfter); textUnitSearcherParameters.setTmTextUnitCreatedBefore(null); search = textUnitSearcher.search(textUnitSearcherParameters); assertEquals(0, search.size()); }
@Transactional @Retryable( value = {TextUnitSearcherError.class}, backoff = @Backoff(delay = 500, multiplier = 2)) public List<TextUnitDTO> search(TextUnitSearcherParameters searchParameters) { NativeCriteria c = getCriteriaForSearch(searchParameters); try { logger.debug("Perform query"); List<TextUnitDTO> resultAsList = c.criteriaResult(new TextUnitDTONativeObjectMapper()); if (logger.isDebugEnabled()) { logger.debug("Query done, info: {}", c.getQueryInfo()); } return resultAsList; } catch (Exception e) { logger.warn("TextUnitSearcher failed to search, exception", e); logger.warn("TextUnitSearcher failed to search, query: {}", c.getQueryInfo().toString()); throw new TextUnitSearcherError(c, "search", e); } }
TextUnitSearcher { @Transactional @Retryable( value = {TextUnitSearcherError.class}, backoff = @Backoff(delay = 500, multiplier = 2)) public List<TextUnitDTO> search(TextUnitSearcherParameters searchParameters) { NativeCriteria c = getCriteriaForSearch(searchParameters); try { logger.debug("Perform query"); List<TextUnitDTO> resultAsList = c.criteriaResult(new TextUnitDTONativeObjectMapper()); if (logger.isDebugEnabled()) { logger.debug("Query done, info: {}", c.getQueryInfo()); } return resultAsList; } catch (Exception e) { logger.warn("TextUnitSearcher failed to search, exception", e); logger.warn("TextUnitSearcher failed to search, query: {}", c.getQueryInfo().toString()); throw new TextUnitSearcherError(c, "search", e); } } }
TextUnitSearcher { @Transactional @Retryable( value = {TextUnitSearcherError.class}, backoff = @Backoff(delay = 500, multiplier = 2)) public List<TextUnitDTO> search(TextUnitSearcherParameters searchParameters) { NativeCriteria c = getCriteriaForSearch(searchParameters); try { logger.debug("Perform query"); List<TextUnitDTO> resultAsList = c.criteriaResult(new TextUnitDTONativeObjectMapper()); if (logger.isDebugEnabled()) { logger.debug("Query done, info: {}", c.getQueryInfo()); } return resultAsList; } catch (Exception e) { logger.warn("TextUnitSearcher failed to search, exception", e); logger.warn("TextUnitSearcher failed to search, query: {}", c.getQueryInfo().toString()); throw new TextUnitSearcherError(c, "search", e); } }  }
TextUnitSearcher { @Transactional @Retryable( value = {TextUnitSearcherError.class}, backoff = @Backoff(delay = 500, multiplier = 2)) public List<TextUnitDTO> search(TextUnitSearcherParameters searchParameters) { NativeCriteria c = getCriteriaForSearch(searchParameters); try { logger.debug("Perform query"); List<TextUnitDTO> resultAsList = c.criteriaResult(new TextUnitDTONativeObjectMapper()); if (logger.isDebugEnabled()) { logger.debug("Query done, info: {}", c.getQueryInfo()); } return resultAsList; } catch (Exception e) { logger.warn("TextUnitSearcher failed to search, exception", e); logger.warn("TextUnitSearcher failed to search, query: {}", c.getQueryInfo().toString()); throw new TextUnitSearcherError(c, "search", e); } }  @Retryable( value = {TextUnitSearcherError.class}, backoff = @Backoff(delay = 500, multiplier = 2)) TextUnitAndWordCount countTextUnitAndWordCount(TextUnitSearcherParameters searchParameters); @Recover TextUnitAndWordCount recoverCountTextUnitAndWordCount(TextUnitSearcherError textUnitSearcherError, TextUnitSearcherParameters searchParameters); @Recover List<TextUnitDTO> recoverSearch(TextUnitSearcherError textUnitSearcherError, TextUnitSearcherParameters searchParameters); @Transactional @Retryable( value = {TextUnitSearcherError.class}, backoff = @Backoff(delay = 500, multiplier = 2)) List<TextUnitDTO> search(TextUnitSearcherParameters searchParameters); }
TextUnitSearcher { @Transactional @Retryable( value = {TextUnitSearcherError.class}, backoff = @Backoff(delay = 500, multiplier = 2)) public List<TextUnitDTO> search(TextUnitSearcherParameters searchParameters) { NativeCriteria c = getCriteriaForSearch(searchParameters); try { logger.debug("Perform query"); List<TextUnitDTO> resultAsList = c.criteriaResult(new TextUnitDTONativeObjectMapper()); if (logger.isDebugEnabled()) { logger.debug("Query done, info: {}", c.getQueryInfo()); } return resultAsList; } catch (Exception e) { logger.warn("TextUnitSearcher failed to search, exception", e); logger.warn("TextUnitSearcher failed to search, query: {}", c.getQueryInfo().toString()); throw new TextUnitSearcherError(c, "search", e); } }  @Retryable( value = {TextUnitSearcherError.class}, backoff = @Backoff(delay = 500, multiplier = 2)) TextUnitAndWordCount countTextUnitAndWordCount(TextUnitSearcherParameters searchParameters); @Recover TextUnitAndWordCount recoverCountTextUnitAndWordCount(TextUnitSearcherError textUnitSearcherError, TextUnitSearcherParameters searchParameters); @Recover List<TextUnitDTO> recoverSearch(TextUnitSearcherError textUnitSearcherError, TextUnitSearcherParameters searchParameters); @Transactional @Retryable( value = {TextUnitSearcherError.class}, backoff = @Backoff(delay = 500, multiplier = 2)) List<TextUnitDTO> search(TextUnitSearcherParameters searchParameters);  }