@Test public void shouldTestSuggestColumnString() throws IOException { final String json = IOUtils.toString(this.getClass().getResourceAsStream("metadata_gonfleurs_suggestion.json"), UTF_8); ObjectMapper mapper = new ObjectMapper(); final ColumnMetadata columnMetadata = mapper.readValue(json, ColumnMetadata.class); String[] expectedResult = { "lowercase", "propercase", "replace_on_value", "uppercase" }; String[] newActionFormArray = suggestionEngine .score(actionRegistry.findAll(), columnMetadata) .filter(i -> i.getScore() > 0) .limit(5) .map(a -> a.getAction().getName()) .toArray(String[]::new); assertEquals(4, newActionFormArray.length); assertArrayEquals(expectedResult, newActionFormArray); }
@Override public Stream<Suggestion> score(Stream<ActionDefinition> actions, ColumnMetadata column) { return actions.map(actionMetadata -> score(actionMetadata, column)).sorted(SUGGESTION_COMPARATOR); }
SimpleSuggestionEngine implements SuggestionEngine { @Override public Stream<Suggestion> score(Stream<ActionDefinition> actions, ColumnMetadata column) { return actions.map(actionMetadata -> score(actionMetadata, column)).sorted(SUGGESTION_COMPARATOR); } }
SimpleSuggestionEngine implements SuggestionEngine { @Override public Stream<Suggestion> score(Stream<ActionDefinition> actions, ColumnMetadata column) { return actions.map(actionMetadata -> score(actionMetadata, column)).sorted(SUGGESTION_COMPARATOR); }  }
SimpleSuggestionEngine implements SuggestionEngine { @Override public Stream<Suggestion> score(Stream<ActionDefinition> actions, ColumnMetadata column) { return actions.map(actionMetadata -> score(actionMetadata, column)).sorted(SUGGESTION_COMPARATOR); }  void setRules(List<SuggestionEngineRule> rules); @Override Stream<Suggestion> score(Stream<ActionDefinition> actions, ColumnMetadata column); @Override Suggestion score(ActionDefinition actionDef, ColumnMetadata column); @Override List<ActionDefinition> suggest(DataSet dataSet); }
SimpleSuggestionEngine implements SuggestionEngine { @Override public Stream<Suggestion> score(Stream<ActionDefinition> actions, ColumnMetadata column) { return actions.map(actionMetadata -> score(actionMetadata, column)).sorted(SUGGESTION_COMPARATOR); }  void setRules(List<SuggestionEngineRule> rules); @Override Stream<Suggestion> score(Stream<ActionDefinition> actions, ColumnMetadata column); @Override Suggestion score(ActionDefinition actionDef, ColumnMetadata column); @Override List<ActionDefinition> suggest(DataSet dataSet);  }