use of org.corpus_tools.annis.gui.EmbeddedVisUI in project ANNIS by korpling.
the class EmbeddedVisTest method regression509.
@Test
void regression509() throws Exception {
EmbeddedVisUI ui = (EmbeddedVisUI) UI.getCurrent();
MockRequest request = MockVaadinKt.getMock(VaadinRequest.getCurrent());
request.setParameter("embedded_ns", "exmaralda");
request.setParameter("embedded_instance", "");
request.setParameter("embedded_match", "pcc2/11299#tok_1");
request.setParameter("embedded_left", "5");
request.setParameter("embedded_right", "5");
request.setParameter("embedded_interface", "http://localhost:5712/#_q=dG9r&ql=aql&_c=cGNjMg&cl=5&cr=5&s=0&l=10&m=0");
ui.attachToPath("/embeddedvis/grid", VaadinRequest.getCurrent());
awaitCondition(30, () -> !_find(Link.class, spec -> spec.withCaption("Show in ANNIS search interface")).isEmpty());
Link link = _get(Link.class, spec -> spec.withCaption("Show in ANNIS search interface"));
assertEquals("dontprint", link.getStyleName());
}
use of org.corpus_tools.annis.gui.EmbeddedVisUI in project ANNIS by korpling.
the class EmbeddedVisTest method showRawText.
@Test
void showRawText() throws Exception {
EmbeddedVisUI ui = (EmbeddedVisUI) UI.getCurrent();
MockRequest request = MockVaadinKt.getMock(VaadinRequest.getCurrent());
request.setParameter("embedded_match", "pcc2/11299#tok_1");
request.setParameter("embedded_fulltext", "");
ui.attachToPath("/embeddedvis/raw_text", VaadinRequest.getCurrent());
awaitCondition(60, () -> !_find(Label.class, spec -> spec.withPredicate(l -> "raw_text_label".equals(l.getStyleName()))).isEmpty());
Label labelRawText = _get(Label.class, spec -> spec.withPredicate(l -> "raw_text_label".equals(l.getStyleName())));
assertTrue(labelRawText.getValue().startsWith("Feigenblatt Die Jugendlichen in Zossen wollen ein Musikcafé ."));
assertTrue(labelRawText.getValue().endsWith("Die glänzten diesmal noch mit Abwesenheit ."));
}
use of org.corpus_tools.annis.gui.EmbeddedVisUI in project ANNIS by korpling.
the class EmbeddedVisTest method unknownRemoteSaltVisualizer.
/**
* Make sure there is an error message when an unknown visualizer is requested.
*
* @throws Exception
*/
@Test
void unknownRemoteSaltVisualizer() throws Exception {
EmbeddedVisUI ui = (EmbeddedVisUI) UI.getCurrent();
MockRequest request = MockVaadinKt.getMock(VaadinRequest.getCurrent());
request.setParameter("embedded_salt", "http://example.com/does-not-exist.salt");
ui.attachToPath("/embeddedvis/notavisualizer", VaadinRequest.getCurrent());
awaitCondition(60, () -> !_find(Label.class, spec -> spec.withPredicate(l -> l.getContentMode() == ContentMode.HTML && l.getValue().startsWith("<h1>"))).isEmpty());
Label labelMessage = _get(Label.class);
assertEquals("<h1>Unknown visualizer \"notavisualizer\"</h1><div>This ANNIS instance does not know the given visualizer.</div>", labelMessage.getValue());
}
use of org.corpus_tools.annis.gui.EmbeddedVisUI in project ANNIS by korpling.
the class EmbeddedVisTest method invalidRemoteSaltUrlScheme.
@Test
void invalidRemoteSaltUrlScheme() throws Exception {
EmbeddedVisUI ui = (EmbeddedVisUI) UI.getCurrent();
MockRequest request = MockVaadinKt.getMock(VaadinRequest.getCurrent());
request.setParameter("embedded_salt", "file://example.com/does-not-exist.salt");
ui.attachToPath("/embeddedvis/raw_text", VaadinRequest.getCurrent());
awaitCondition(60, () -> !_find(Label.class, spec -> spec.withPredicate(l -> l.getContentMode() == ContentMode.HTML && l.getValue().startsWith("<h1>"))).isEmpty());
Label labelMessage = _get(Label.class);
assertEquals("<h1>Could not generate the visualization.</h1><div>Expected URL scheme 'http' or 'https' but was 'file'</div>", labelMessage.getValue());
}
Aggregations