@Test public void testSkipAssetPathWithPattern() { TMTestData testData = new TMTestData(testIdWatcher); TextUnitSearcherParameters params = new TextUnitSearcherParameters(); params.setRepositoryIds(testData.repository.getId()); params.setSkipAssetPathWithPattern("%skip_me"); Asset asset = assetService.createAssetWithContent(testData.repository.getId(), "fake_skip_me", "fake for test other tm repo"); TMTextUnit tu1 = tmService.addTMTextUnit(testData.tm.getId(), asset.getId(), "fake1", "Content1", "Comment1"); TMTextUnit tu2 = tmService.addTMTextUnit(testData.tm.getId(), asset.getId(), "fake2", "Content2", "Comment2"); TMTextUnit tu3 = tmService.addTMTextUnit(testData.tm.getId(), testData.asset.getId(), "fake3", "Content4", "Comment4"); TMTextUnit tu4 = tmService.addTMTextUnit(testData.tm.getId(), testData.asset.getId(), "fake4", "Content4", "Comment4"); List<TextUnitDTO> textUnits = textUnitSearcher.search(params); assertThat(textUnits).isNotEmpty(); assertThat(textUnits).extracting(TextUnitDTO::getTmTextUnitId).doesNotContain(tu1.getId(), tu2.getId()); assertThat(textUnits).extracting(TextUnitDTO::getTmTextUnitId).contains(tu3.getId(), tu4.getId()); params.setSkipAssetPathWithPattern("dont_use%"); asset = assetService.createAssetWithContent(testData.repository.getId(), "dont_use_me", "fake for test other tm repo"); tu1 = tmService.addTMTextUnit(testData.tm.getId(), asset.getId(), "dont_use_fake1", "Content1", "Comment1"); tu2 = tmService.addTMTextUnit(testData.tm.getId(), asset.getId(), "dont_use_fake2", "Content2", "Comment2"); tu3 = tmService.addTMTextUnit(testData.tm.getId(), testData.asset.getId(), "use_fake3", "Content4", "Comment4"); tu4 = tmService.addTMTextUnit(testData.tm.getId(), testData.asset.getId(), "use_fake4", "Content4", "Comment4"); textUnits = textUnitSearcher.search(params); assertThat(textUnits).isNotEmpty(); assertThat(textUnits).extracting(TextUnitDTO::getTmTextUnitId).doesNotContain(tu1.getId(), tu2.getId()); assertThat(textUnits).extracting(TextUnitDTO::getTmTextUnitId).contains(tu3.getId(), tu4.getId()); params.setSkipAssetPathWithPattern("%ignore%"); asset = assetService.createAssetWithContent(testData.repository.getId(), "wil_be_ignored", "fake for test other tm repo"); tu1 = tmService.addTMTextUnit(testData.tm.getId(), asset.getId(), "ignore_fake1", "Content1", "Comment1"); tu2 = tmService.addTMTextUnit(testData.tm.getId(), asset.getId(), "ignore_use_fake2", "Content2", "Comment2"); tu3 = tmService.addTMTextUnit(testData.tm.getId(), testData.asset.getId(), "no_fake3", "Content4", "Comment4"); tu4 = tmService.addTMTextUnit(testData.tm.getId(), testData.asset.getId(), "no_fake4", "Content4", "Comment4"); textUnits = textUnitSearcher.search(params); assertThat(textUnits).isNotEmpty(); assertThat(textUnits).extracting(TextUnitDTO::getTmTextUnitId).doesNotContain(tu1.getId(), tu2.getId()); assertThat(textUnits).extracting(TextUnitDTO::getTmTextUnitId).contains(tu3.getId(), tu4.getId()); }
@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);  }