use of org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyUser in project spring-bot by finos.
the class SymphonyWorkflowConfig method defaultAddressingChecker.
@Bean
@ConditionalOnMissingBean
public AddressingChecker defaultAddressingChecker() {
UserV2 symphonyBotUser = usersApi.v2UserGet(null, null, botIdentity.getEmail(), null, symphonyProperties.isLocalPod());
SymphonyUser su = new SymphonyUser(symphonyBotUser.getDisplayName(), symphonyBotUser.getEmailAddress());
return new InRoomAddressingChecker(su, true);
}
use of org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyUser in project spring-bot by finos.
the class TestContents method testContents.
@Test
public void testContents() {
// tag def
doAssertsOnContent(new CashTag("id123"), new CashTag("id123"));
doAssertsOnContent(new HashTag("id123"), new HashTag("id123"));
// room def
doAssertsOnObject(new SymphonyRoom("abc", "abc123"), new SymphonyRoom("abc", "abc123"));
doAssertsOnObject(new SymphonyRoom(null, "abc123"), new SymphonyRoom(null, "abc123"));
doAssertsOnObject(new SymphonyRoom("abc", "abc123"), new SymphonyRoom("abc", "abc123"));
doAssertsOnObject(new SymphonyRoom("abc", null), new SymphonyRoom("abc", null));
// user def
doAssertsOnObject(new SymphonyUser(123l, "rob", "rob@example.com"), new SymphonyUser(123l, "rob", "rob@example.com"));
doAssertsOnObject(new SymphonyUser("rob", "rob@example.com"), new SymphonyUser("rob", "rob@example.com"));
doAssertsOnObject(new SymphonyUser(null, "rob@example.com"), new SymphonyUser(null, "rob@example.com"));
doAssertsOnObject(new SymphonyUser(123l, "rob", null), new SymphonyUser(123l, "rob", null));
// id
UUID some = UUID.randomUUID();
doAssertsOnContent(HashTag.createID(some), HashTag.createID(some));
// wordx
Word w1 = Word.of("hello");
Word w2 = Word.of("bye");
doAssertsOnContent(w1, Word.of("hello"));
// paragraph
Paragraph p1 = Paragraph.of(Arrays.asList(w1, w2));
Paragraph p2 = Paragraph.of(Arrays.asList(w1, w2));
doAssertsOnContent(p1, p2);
doAssertsOnContent(p1.getNth(Word.class, 0).get(), p2.getNth(Word.class, 0).get());
// message
Message m1 = Message.of(Arrays.asList(p1, p2));
Message m2 = Message.of(Arrays.asList(p1, p2));
doAssertsOnContent(m1, m2);
}
use of org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyUser in project spring-bot by finos.
the class TestEntityJsonConversion method testOb3.
@Test
public void testOb3() throws Exception {
EJTestObject a1 = new EJTestObject(new SymphonyRoom("abc", "123"), new SymphonyUser("Robert Moffat", "rbo@kjite9.com"), "SOme message");
String out = toWorkflowJson(a1);
compare(out, "{\n" + " \"workflow_001\" : {\n" + " \"type\" : \"org.finos.symphony.toolkit.workflow.fixture.eJTestObject\",\n" + " \"version\" : \"1.0\",\n" + " \"r\" : {\n" + " \"type\" : \"org.finos.symphony.toolkit.workflow.content.chat\",\n" + " \"version\" : \"1.0\",\n" + " \"id\" : [ {\n" + " \"type\" : \"com.symphony.user.streamID\",\n" + " \"version\" : \"1.0\",\n" + " \"value\" : \"123\"\n" + " }, {\n" + " \"type\" : \"org.finos.symphony.toolkit.workflow.sources.symphony.content.roomName\",\n" + " \"version\" : \"1.0\",\n" + " \"value\" : \"abc\"\n" + " } ]\n" + " },\n" + " \"u\" : {\n" + " \"type\" : \"com.symphony.user.mention\",\n" + " \"version\" : \"1.0\",\n" + " \"id\" : [ {\n" + " \"type\" : \"com.symphony.user.displayName\",\n" + " \"version\" : \"1.0\",\n" + " \"value\" : \"Robert Moffat\"\n" + " }, {\n" + " \"type\" : \"com.symphony.user.emailAddress\",\n" + " \"version\" : \"1.0\",\n" + " \"value\" : \"rbo@kjite9.com\"\n" + " } ]\n" + " },\n" + " \"someText\" : \"SOme message\"\n" + " }\n" + "}");
EJTestObject b = (EJTestObject) readWorkflowValue(out);
Assertions.assertEquals(a1, b);
}
use of org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyUser in project spring-bot by finos.
the class TestFormConverter method before.
@BeforeEach
public void before() {
Mockito.when(rooms.loadUserById(Mockito.eq(345315370602462l))).thenReturn(new SymphonyUser(345315370602462l, "Some Guy", "sg@example.com"));
fc = new FormConverter(rooms);
}
use of org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyUser in project spring-bot by finos.
the class TestHandlerMapping method pressButton.
private void pressButton(String s) throws Exception {
EntityJson jsonObjects = new EntityJson();
jsonObjects.put("1", new SymphonyUser(123l, "gaurav", "gaurav@example.com"));
jsonObjects.put("2", new HashTag("SomeTopic"));
Chat r = new SymphonyRoom("The Room Where It Happened", "abc123");
User author = new SymphonyUser(ROB_EXAMPLE_ID, ROB_NAME, ROB_EXAMPLE_EMAIL);
Object fd = new StartClaim();
Action a = new FormAction(r, author, fd, s, jsonObjects);
Action.CURRENT_ACTION.set(a);
mc.accept(a);
}
Aggregations