Search in sources :

Example 1 with OrderEnum

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()));
}
Also used : Panel(com.vaadin.ui.Panel) BeforeEach(org.junit.jupiter.api.BeforeEach) Arrays(java.util.Arrays) CorpusListPanel(org.corpus_tools.annis.gui.controlpanel.CorpusListPanel) DocBrowserPanel(org.corpus_tools.annis.gui.docbrowser.DocBrowserPanel) TextField(com.vaadin.ui.TextField) Pair(kotlin.Pair) UI(com.vaadin.ui.UI) Autowired(org.springframework.beans.factory.annotation.Autowired) Window(com.vaadin.ui.Window) ExceptionDialog(org.corpus_tools.annis.gui.components.ExceptionDialog) SearchOptionsPanel(org.corpus_tools.annis.gui.controlpanel.SearchOptionsPanel) ActiveProfiles(org.springframework.test.context.ActiveProfiles) AnnotationGrid(org.corpus_tools.annis.gui.widgets.grid.AnnotationGrid) LocatorJ._find(com.github.mvysny.kaributesting.v8.LocatorJ._find) DocBrowserTable(org.corpus_tools.annis.gui.docbrowser.DocBrowserTable) ResultViewPanel(org.corpus_tools.annis.gui.resultview.ResultViewPanel) Assertions.assertFalse(org.junit.jupiter.api.Assertions.assertFalse) Page(com.vaadin.server.Page) OrderEnum(org.corpus_tools.annis.api.model.FindQuery.OrderEnum) LocatorJ._get(com.github.mvysny.kaributesting.v8.LocatorJ._get) VaadinIcons(com.vaadin.icons.VaadinIcons) GridEvent(org.corpus_tools.annis.gui.widgets.grid.GridEvent) URI(java.net.URI) GridKt(com.github.mvysny.kaributesting.v8.GridKt) WebAppConfiguration(org.springframework.test.context.web.WebAppConfiguration) NotificationsKt(com.github.mvysny.kaributesting.v8.NotificationsKt) KWICComponent(org.corpus_tools.annis.gui.visualizers.component.kwic.KWICComponent) Row(org.corpus_tools.annis.gui.widgets.grid.Row) LocatorJ._click(com.github.mvysny.kaributesting.v8.LocatorJ._click) UUID(java.util.UUID) LocatorJ._setValue(com.github.mvysny.kaributesting.v8.LocatorJ._setValue) Collectors(java.util.stream.Collectors) StandardCharsets(java.nio.charset.StandardCharsets) Test(org.junit.jupiter.api.Test) List(java.util.List) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) TabSheet(com.vaadin.ui.TabSheet) URLEncodedUtils(org.apache.http.client.utils.URLEncodedUtils) Optional(java.util.Optional) NameValuePair(org.apache.http.NameValuePair) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) GridComponent(org.corpus_tools.annis.gui.visualizers.component.grid.GridComponent) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) ComboBox(com.vaadin.ui.ComboBox) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) MockVaadin(com.github.mvysny.kaributesting.v8.MockVaadin) TestHelper.awaitCondition(org.corpus_tools.annis.gui.TestHelper.awaitCondition) Accordion(com.vaadin.ui.Accordion) Label(com.vaadin.ui.Label) UIScopeImpl(com.vaadin.spring.internal.UIScopeImpl) SingleCorpusResultPanel(org.corpus_tools.annis.gui.resultview.SingleCorpusResultPanel) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) DataProvider(com.vaadin.data.provider.DataProvider) AutoHeightIFrame(org.corpus_tools.annis.gui.widgets.AutoHeightIFrame) Tab(com.vaadin.ui.TabSheet.Tab) ListDataProvider(com.vaadin.data.provider.ListDataProvider) ContentMode(com.vaadin.shared.ui.ContentMode) AqlCodeEditor(org.corpus_tools.annis.gui.components.codemirror.AqlCodeEditor) Assert.assertTrue(org.junit.Assert.assertTrue) ControlPanel(org.corpus_tools.annis.gui.controlpanel.ControlPanel) Button(com.vaadin.ui.Button) AfterEach(org.junit.jupiter.api.AfterEach) MediaElementPlayer(org.corpus_tools.annis.gui.components.medialement.MediaElementPlayer) TextArea(com.vaadin.v7.ui.TextArea) SingleResultPanel(org.corpus_tools.annis.gui.resultview.SingleResultPanel) BeanFactory(org.springframework.beans.factory.BeanFactory) Annotation(org.corpus_tools.annis.api.model.Annotation) Component(com.vaadin.ui.Component) Grid(com.vaadin.ui.Grid) GridEvent(org.corpus_tools.annis.gui.widgets.grid.GridEvent) KWICComponent(org.corpus_tools.annis.gui.visualizers.component.kwic.KWICComponent) ComboBox(com.vaadin.ui.ComboBox) SearchOptionsPanel(org.corpus_tools.annis.gui.controlpanel.SearchOptionsPanel) ResultViewPanel(org.corpus_tools.annis.gui.resultview.ResultViewPanel) SingleResultPanel(org.corpus_tools.annis.gui.resultview.SingleResultPanel) AnnotationGrid(org.corpus_tools.annis.gui.widgets.grid.AnnotationGrid) ControlPanel(org.corpus_tools.annis.gui.controlpanel.ControlPanel) Button(com.vaadin.ui.Button) TabSheet(com.vaadin.ui.TabSheet) OrderEnum(org.corpus_tools.annis.api.model.FindQuery.OrderEnum) Row(org.corpus_tools.annis.gui.widgets.grid.Row) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

GridKt (com.github.mvysny.kaributesting.v8.GridKt)1 LocatorJ._click (com.github.mvysny.kaributesting.v8.LocatorJ._click)1 LocatorJ._find (com.github.mvysny.kaributesting.v8.LocatorJ._find)1 LocatorJ._get (com.github.mvysny.kaributesting.v8.LocatorJ._get)1 LocatorJ._setValue (com.github.mvysny.kaributesting.v8.LocatorJ._setValue)1 MockVaadin (com.github.mvysny.kaributesting.v8.MockVaadin)1 NotificationsKt (com.github.mvysny.kaributesting.v8.NotificationsKt)1 DataProvider (com.vaadin.data.provider.DataProvider)1 ListDataProvider (com.vaadin.data.provider.ListDataProvider)1 VaadinIcons (com.vaadin.icons.VaadinIcons)1 Page (com.vaadin.server.Page)1 ContentMode (com.vaadin.shared.ui.ContentMode)1 UIScopeImpl (com.vaadin.spring.internal.UIScopeImpl)1 Accordion (com.vaadin.ui.Accordion)1 Button (com.vaadin.ui.Button)1 ComboBox (com.vaadin.ui.ComboBox)1 Component (com.vaadin.ui.Component)1 Grid (com.vaadin.ui.Grid)1 Label (com.vaadin.ui.Label)1 Panel (com.vaadin.ui.Panel)1