@Test public void testSearchWithResults() { prepareAndInitSession(); searchService.search(MULTIPLE_INSTANCE_SUBPROCESS, 20, searchCallback); verify(searchCallback).afterSearch(searchResultsCaptor.capture()); LiveSearchResults<String> results = searchResultsCaptor.getValue(); List<Pair<String, String>> expectedVariables1 = buildExpectedVariableNames(MULTIPLE_INSTANCE_SUBPROCESS, 17); verifyResultsContains(results, expectedVariables1); searchService.search("MultipleIns", 20, searchCallback); verify(searchCallback, times(2)).afterSearch(searchResultsCaptor.capture()); results = searchResultsCaptor.getValue(); verifyResultsContains(results, expectedVariables1); searchService.search(ADHOC_SUBPROCESS, 20, searchCallback); verify(searchCallback, times(3)).afterSearch(searchResultsCaptor.capture()); results = searchResultsCaptor.getValue(); List<Pair<String, String>> expectedVariables2 = buildExpectedVariableNames(ADHOC_SUBPROCESS, 17); verifyResultsContains(results, expectedVariables2); verifyResultsNotContains(results, expectedVariables1); }
@Override public void search(String pattern, int maxResults, LiveSearchCallback<String> callback) { LiveSearchResults<String> results = new LiveSearchResults<>(maxResults); options.entrySet().stream() .filter(entry -> entry.getValue().toLowerCase().contains(pattern.toLowerCase())) .forEach(entry -> results.add(entry.getKey(), entry.getValue())); callback.afterSearch(results); }
VariableSearchService implements LiveSearchService<String> { @Override public void search(String pattern, int maxResults, LiveSearchCallback<String> callback) { LiveSearchResults<String> results = new LiveSearchResults<>(maxResults); options.entrySet().stream() .filter(entry -> entry.getValue().toLowerCase().contains(pattern.toLowerCase())) .forEach(entry -> results.add(entry.getKey(), entry.getValue())); callback.afterSearch(results); } }
VariableSearchService implements LiveSearchService<String> { @Override public void search(String pattern, int maxResults, LiveSearchCallback<String> callback) { LiveSearchResults<String> results = new LiveSearchResults<>(maxResults); options.entrySet().stream() .filter(entry -> entry.getValue().toLowerCase().contains(pattern.toLowerCase())) .forEach(entry -> results.add(entry.getKey(), entry.getValue())); callback.afterSearch(results); } @Inject  VariableSearchService(final ConditionEditorMetadataService metadataService,
                                 final ClientTranslationService translationService); }
VariableSearchService implements LiveSearchService<String> { @Override public void search(String pattern, int maxResults, LiveSearchCallback<String> callback) { LiveSearchResults<String> results = new LiveSearchResults<>(maxResults); options.entrySet().stream() .filter(entry -> entry.getValue().toLowerCase().contains(pattern.toLowerCase())) .forEach(entry -> results.add(entry.getKey(), entry.getValue())); callback.afterSearch(results); } @Inject  VariableSearchService(final ConditionEditorMetadataService metadataService,
                                 final ClientTranslationService translationService); void init(ClientSession session); @Override void search(String pattern, int maxResults, LiveSearchCallback<String> callback); @Override void searchEntry(String key, LiveSearchCallback<String> callback); String getOptionType(String key); void clear(); }
VariableSearchService implements LiveSearchService<String> { @Override public void search(String pattern, int maxResults, LiveSearchCallback<String> callback) { LiveSearchResults<String> results = new LiveSearchResults<>(maxResults); options.entrySet().stream() .filter(entry -> entry.getValue().toLowerCase().contains(pattern.toLowerCase())) .forEach(entry -> results.add(entry.getKey(), entry.getValue())); callback.afterSearch(results); } @Inject  VariableSearchService(final ConditionEditorMetadataService metadataService,
                                 final ClientTranslationService translationService); void init(ClientSession session); @Override void search(String pattern, int maxResults, LiveSearchCallback<String> callback); @Override void searchEntry(String key, LiveSearchCallback<String> callback); String getOptionType(String key); void clear();  }