Search in sources :

Example 1 with SymphonyUser

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);
}
Also used : UserV2(com.symphony.api.model.UserV2) InRoomAddressingChecker(org.finos.symphony.toolkit.workflow.actions.consumers.InRoomAddressingChecker) SymphonyUser(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyUser) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with SymphonyUser

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);
}
Also used : Word(org.finos.symphony.toolkit.workflow.content.Word) Message(org.finos.symphony.toolkit.workflow.content.Message) HashTag(org.finos.symphony.toolkit.workflow.sources.symphony.content.HashTag) CashTag(org.finos.symphony.toolkit.workflow.sources.symphony.content.CashTag) UUID(java.util.UUID) SymphonyUser(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyUser) SymphonyRoom(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyRoom) Paragraph(org.finos.symphony.toolkit.workflow.content.Paragraph) Test(org.junit.jupiter.api.Test)

Example 3 with SymphonyUser

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);
}
Also used : EJTestObject(org.finos.symphony.toolkit.workflow.fixture.EJTestObject) SymphonyUser(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyUser) SymphonyRoom(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyRoom) Test(org.junit.jupiter.api.Test)

Example 4 with SymphonyUser

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);
}
Also used : FormConverter(org.finos.symphony.toolkit.workflow.sources.symphony.elements.FormConverter) SymphonyUser(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyUser) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 5 with SymphonyUser

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);
}
Also used : Action(org.finos.symphony.toolkit.workflow.actions.Action) SimpleMessageAction(org.finos.symphony.toolkit.workflow.actions.SimpleMessageAction) FormAction(org.finos.symphony.toolkit.workflow.actions.FormAction) EntityJson(org.finos.symphony.toolkit.json.EntityJson) User(org.finos.symphony.toolkit.workflow.content.User) SymphonyUser(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyUser) StartClaim(org.finos.symphony.toolkit.workflow.fixture.StartClaim) HashTag(org.finos.symphony.toolkit.workflow.sources.symphony.content.HashTag) Chat(org.finos.symphony.toolkit.workflow.content.Chat) FormAction(org.finos.symphony.toolkit.workflow.actions.FormAction) SymphonyUser(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyUser) SymphonyRoom(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyRoom)

Aggregations

SymphonyUser (org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyUser)15 SymphonyRoom (org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyRoom)7 HashTag (org.finos.symphony.toolkit.workflow.sources.symphony.content.HashTag)6 Test (org.junit.jupiter.api.Test)5 Message (org.finos.symphony.toolkit.workflow.content.Message)4 User (org.finos.symphony.toolkit.workflow.content.User)4 StreamID (com.symphony.user.StreamID)3 EntityJson (org.finos.symphony.toolkit.json.EntityJson)3 Chat (org.finos.symphony.toolkit.workflow.content.Chat)3 CashTag (org.finos.symphony.toolkit.workflow.sources.symphony.content.CashTag)3 MembershipList (com.symphony.api.model.MembershipList)2 Stream (com.symphony.api.model.Stream)2 StreamAttributes (com.symphony.api.model.StreamAttributes)2 StreamList (com.symphony.api.model.StreamList)2 StreamType (com.symphony.api.model.StreamType)2 UserV2 (com.symphony.api.model.UserV2)2 V3RoomAttributes (com.symphony.api.model.V3RoomAttributes)2 V3RoomDetail (com.symphony.api.model.V3RoomDetail)2 V3RoomSearchResults (com.symphony.api.model.V3RoomSearchResults)2 Action (org.finos.symphony.toolkit.workflow.actions.Action)2