use of org.finos.symphony.toolkit.json.EntityJson in project spring-bot by finos.
the class TestHandlerMapping method getMappingsFor.
private List<ChatMapping<ChatRequest>> getMappingsFor(String s) throws Exception {
EntityJson jsonObjects = new EntityJson();
Message m = smp.parse("<messageML>" + s + "</messageML>", jsonObjects);
Action a = new SimpleMessageAction(null, null, m, jsonObjects);
return hm.getHandlers(a);
}
use of org.finos.symphony.toolkit.json.EntityJson in project spring-bot by finos.
the class TestMessageMLParser method testTaggedMessage.
@Test
public void testTaggedMessage() throws Exception {
EntityJson ej = entityJsonConverter.readValue("{\"0\":{\"id\":[{\"type\":\"com.symphony.user.userId\",\"value\":\"347583113331315\"}],\"type\":\"com.symphony.user.mention\"},\"1\":{\"id\":[{\"type\":\"com.symphony.user.userId\",\"value\":\"345315370604167\"}],\"type\":\"com.symphony.user.mention\"},\"2\":{\"id\":[{\"type\":\"com.symphony.user.userId\",\"value\":\"345315370598706\"}],\"type\":\"com.symphony.user.mention\"}}");
Message actual = smp.parse("<div data-format=\"PresentationML\" data-version=\"2.0\" class=\"wysiwyg\"><p> </p><p>/help <span class=\"entity\" data-entity-id=\"0\">@Rob Moffat</span> <span class=\"entity\" data-entity-id=\"1\">@Mark Mainwood</span> <span class=\"entity\" data-entity-id=\"2\">@James Tan</span> </p></div>", ej);
Message expected = Message.of(Arrays.asList(Paragraph.of(Collections.emptyList()), Paragraph.of(Arrays.asList(Word.of("/help"), new SymphonyUser(347583113331315l, "Rob Moffat", null), new SymphonyUser(345315370604167l, "Mark Mainwood", null), new SymphonyUser(345315370598706l, "James Tan", null)))));
Assertions.assertEquals(expected, actual);
}
use of org.finos.symphony.toolkit.json.EntityJson in project spring-bot by finos.
the class TestMessageMLParser method testMessageWithTable.
@Test
public void testMessageWithTable() throws Exception {
Content c = smp.parse("<div data-format=\"PresentationML\" data-version=\"2.0\" class=\"wysiwyg\"><p><table class=\"pasted-table\"><thead><tr><th>Name</th><th>Age</th><th>Alive</th></tr></thead><tbody><tr><td>Jim</td><td>5</td><td>FALSE</td></tr><tr><td>James</td><td>7</td><td>TRUE</td></tr></tbody></table></p></div>", new EntityJson());
Assertions.assertEquals(Paragraph.of(Arrays.asList(Word.of("Age"))), c.getNth(Table.class, 0).get().getColumnNames().get(1));
Assertions.assertEquals(Paragraph.of(Arrays.asList(Word.of("TRUE"))), c.getNth(Table.class, 0).get().getData().get(1).get(2));
}
use of org.finos.symphony.toolkit.json.EntityJson in project spring-bot by finos.
the class TestTableEdit method editRow.
protected void editRow(String testStem, Object toChange, Object newRow, String spel) throws Exception {
EntityJson ej = new EntityJson();
ej.put(WorkResponse.OBJECT_KEY, toChange);
FormAction ea = new FormAction(room, u, toChange, spel + TableEditRow.EDIT_SUFFIX, ej);
editRow.accept(ea);
// should get a new form back.
String jsonStr = testTemplating("abc123", testStem + "1.ml", testStem + "1.json");
EntityJson json = ejc.readValue(jsonStr);
ea = new FormAction(room, u, newRow, spel + TableEditRow.UPDATE_SUFFIX, json);
Mockito.reset(messagesApi);
editRow.accept(ea);
testTemplating("abc123", testStem + "2.ml", testStem + "2.json");
}
use of org.finos.symphony.toolkit.json.EntityJson in project spring-bot by finos.
the class TestHistory method makeMessage.
protected V4Message makeMessage(TestObjects one) {
EntityJson out = new EntityJson();
out.put("1", one);
return new V4Message().message("some stuff").data(ejc.writeValue(out));
}
Aggregations