use of org.corpus_tools.annis.api.model.FindQuery.OrderEnum in project ANNIS by korpling.
the class AnnisUITest method searchPcc2InverseOrder.
@Test
void searchPcc2InverseOrder() throws Exception {
selectCorpus("pcc2");
// Set inverse order in search options
TabSheet optionTabSheet = _get(_get(ControlPanel.class), TabSheet.class);
optionTabSheet.setSelectedTab(_get(SearchOptionsPanel.class));
awaitCondition(10, () -> !_find(optionTabSheet, ComboBox.class, spec -> spec.withCaption("Order")).isEmpty());
@SuppressWarnings("unchecked") ComboBox<OrderEnum> orderComboBox = _get(optionTabSheet, ComboBox.class, spec -> spec.withCaption("Order"));
_setValue(orderComboBox, OrderEnum.INVERTED);
// Set the query and submit query
_get(AqlCodeEditor.class).getPropertyDataSource().setValue("\"Die\"");
MockVaadin.INSTANCE.clientRoundtrip();
awaitCondition(5, () -> "\"Die\"".equals(ui.getQueryState().getAql().getValue()));
awaitCondition(5, () -> "Valid query, click on \"Search\" to start searching.".equals(ui.getSearchView().getControlPanel().getQueryPanel().getLastPublicStatus()));
Button searchButton = _get(Button.class, spec -> spec.withCaption("Search"));
_click(searchButton);
// Wait until the count is displayed
String expectedStatus = "4 matches\nin 2 documents";
awaitCondition(60, () -> expectedStatus.equals(ui.getSearchView().getControlPanel().getQueryPanel().getLastPublicStatus()), () -> "Waited for status \"" + expectedStatus + "\" but was \"" + ui.getSearchView().getControlPanel().getQueryPanel().getLastPublicStatus() + "\"");
ResultViewPanel resultView = _get(ResultViewPanel.class);
awaitCondition(30, () -> _find(resultView, SingleResultPanel.class).size() == 4);
// Test that the cell values have the correct token value
SingleResultPanel resultPanel = _find(SingleResultPanel.class).get(0);
KWICComponent kwicVis = _get(resultPanel, KWICComponent.class);
AnnotationGrid kwicGrid = _get(kwicVis, AnnotationGrid.class);
ArrayList<Row> tokens = kwicGrid.getRowsByAnnotation().get("tok");
assertEquals(1, tokens.size());
assertEquals(Arrays.asList("fürs", "Dallgower", "Tor", "gab", ".", "Die", "Seeburger", "und", "einige", "Groß-Glienicker", "haben"), tokens.get(0).getEvents().stream().map(GridEvent::getValue).collect(Collectors.toList()));
}
Aggregations