Search in sources :

Example 1 with SymphonyRoom

use of org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyRoom in project spring-bot by finos.

the class AbstractMockSymphonyTest method createWorkAddSubmit.

protected WorkResponse createWorkAddSubmit(WorkMode wm, Object ob5) {
    SymphonyRoom theRoom = new SymphonyRoom("tesxt room", "abc123");
    WorkResponse wr = new WorkResponse(theRoom, ob5, wm);
    ButtonList bl = (ButtonList) wr.getData().get(ButtonList.KEY);
    Button submit = new Button("submit", Type.ACTION, "GO");
    bl.add(submit);
    return wr;
}
Also used : Button(org.finos.symphony.toolkit.workflow.form.Button) WorkResponse(org.finos.symphony.toolkit.workflow.response.WorkResponse) ButtonList(org.finos.symphony.toolkit.workflow.form.ButtonList) SymphonyRoom(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyRoom)

Example 2 with SymphonyRoom

use of org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyRoom in project spring-bot by finos.

the class RoomAndDropdownMessageML method dropdownsWork.

protected WorkResponse dropdownsWork(WorkMode wm) {
    SymphonyRoom theRoom = new SymphonyRoom("tesxt room", "abc123");
    String strangeOption = "a";
    RoomAndDropdown to4 = new RoomAndDropdown(theRoom, strangeOption);
    Button submit = new Button("submit", Type.ACTION, "GO");
    WorkResponse wr = new WorkResponse(theRoom, to4, wm);
    // ensure buttons
    ButtonList bl = (ButtonList) wr.getData().get(ButtonList.KEY);
    bl.add(submit);
    // ensure rooms
    wr.getData().put("rooms", getSomeRooms());
    // ensure dynamic dropdown options
    wr.getData().put("dynoptions", getDynamicOptions());
    return wr;
}
Also used : Button(org.finos.symphony.toolkit.workflow.form.Button) RoomAndDropdown(org.finos.symphony.toolkit.workflow.fixture.RoomAndDropdown) WorkResponse(org.finos.symphony.toolkit.workflow.response.WorkResponse) ButtonList(org.finos.symphony.toolkit.workflow.form.ButtonList) SymphonyRoom(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyRoom)

Example 3 with SymphonyRoom

use of org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyRoom in project spring-bot by finos.

the class RoomAndDropdownMessageML method getSomeRooms.

protected RoomList getSomeRooms() {
    SymphonyRoom a = new SymphonyRoom("room one", "one");
    SymphonyRoom b = new SymphonyRoom("tesxt room", "abc123");
    SymphonyRoom c = new SymphonyRoom("room three", "three");
    RoomList out = new RoomList();
    out.add(a);
    out.add(b);
    out.add(c);
    return out;
}
Also used : RoomList(org.finos.symphony.toolkit.workflow.sources.symphony.json.RoomList) SymphonyRoom(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyRoom)

Example 4 with SymphonyRoom

use of org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyRoom in project spring-bot by finos.

the class SymphonyConversationsImpl method loadRoomByName.

@Override
public SymphonyRoom loadRoomByName(String name) {
    V2RoomSearchCriteria rsc = new V2RoomSearchCriteria();
    rsc.setQuery(name);
    V3RoomSearchResults res = streamsApi.v3RoomSearchPost(rsc, null, null, null);
    return res.getRooms().stream().filter(r -> r.getRoomAttributes().getName().equals(name)).findFirst().map(rd -> new SymphonyRoom(rd.getRoomAttributes().getName(), rd.getRoomSystemInfo().getId())).orElse(null);
}
Also used : V2RoomSearchCriteria(com.symphony.api.model.V2RoomSearchCriteria) User(org.finos.symphony.toolkit.workflow.content.User) SymphonyIdentity(com.symphony.api.id.SymphonyIdentity) TypeEnum(com.symphony.api.model.StreamType.TypeEnum) LoggerFactory(org.slf4j.LoggerFactory) V3RoomDetail(com.symphony.api.model.V3RoomDetail) StreamsApi(com.symphony.api.pod.StreamsApi) InitializingBean(org.springframework.beans.factory.InitializingBean) V3RoomAttributes(com.symphony.api.model.V3RoomAttributes) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Map(java.util.Map) StreamList(com.symphony.api.model.StreamList) UserV2(com.symphony.api.model.UserV2) V3RoomSearchResults(com.symphony.api.model.V3RoomSearchResults) Logger(org.slf4j.Logger) UsersApi(com.symphony.api.pod.UsersApi) SymphonyUser(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyUser) AbstractStreamResolving(org.finos.symphony.toolkit.workflow.sources.symphony.streams.AbstractStreamResolving) MembershipList(com.symphony.api.model.MembershipList) SymphonyApiProperties(org.finos.symphony.toolkit.spring.api.properties.SymphonyApiProperties) RoomMembershipApi(com.symphony.api.pod.RoomMembershipApi) Set(java.util.Set) Chat(org.finos.symphony.toolkit.workflow.content.Chat) Collectors(java.util.stream.Collectors) List(java.util.List) Addressable(org.finos.symphony.toolkit.workflow.content.Addressable) StreamAttributes(com.symphony.api.model.StreamAttributes) StreamID(com.symphony.user.StreamID) SymphonyRoom(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyRoom) StreamFilter(com.symphony.api.model.StreamFilter) Collections(java.util.Collections) StreamType(com.symphony.api.model.StreamType) UserId(com.symphony.api.model.UserId) V2RoomSearchCriteria(com.symphony.api.model.V2RoomSearchCriteria) V3RoomSearchResults(com.symphony.api.model.V3RoomSearchResults) SymphonyRoom(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyRoom)

Example 5 with SymphonyRoom

use of org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyRoom in project spring-bot by finos.

the class TestHistory method testGetLast.

@Test
public void testGetLast() {
    TestObjects to = new TestObjects();
    Mockito.when(messagesApi.v1MessageSearchPost(Mockito.any(), Mockito.isNull(), Mockito.isNull(), Mockito.anyInt(), Mockito.anyInt(), Mockito.any(), Mockito.any())).thenAnswer(a -> {
        V4MessageList out = new V4MessageList();
        out.addAll(Arrays.asList(makeMessage(to)));
        return out;
    });
    TestObjects out = mh.getLastFromHistory(TestObjects.class, new SymphonyRoom("someroom", "abc123")).orElseThrow(() -> new RuntimeException());
    Assertions.assertEquals(out, to);
    Assertions.assertFalse(out == to);
}
Also used : V4MessageList(com.symphony.api.model.V4MessageList) TestObjects(org.finos.symphony.toolkit.workflow.fixture.TestObjects) SymphonyRoom(org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyRoom) Test(org.junit.jupiter.api.Test)

Aggregations

SymphonyRoom (org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyRoom)16 SymphonyUser (org.finos.symphony.toolkit.workflow.sources.symphony.content.SymphonyUser)8 Test (org.junit.jupiter.api.Test)7 User (org.finos.symphony.toolkit.workflow.content.User)5 WorkResponse (org.finos.symphony.toolkit.workflow.response.WorkResponse)5 Chat (org.finos.symphony.toolkit.workflow.content.Chat)4 Button (org.finos.symphony.toolkit.workflow.form.Button)4 ButtonList (org.finos.symphony.toolkit.workflow.form.ButtonList)4 HashTag (org.finos.symphony.toolkit.workflow.sources.symphony.content.HashTag)4 MembershipList (com.symphony.api.model.MembershipList)3 StreamAttributes (com.symphony.api.model.StreamAttributes)3 StreamList (com.symphony.api.model.StreamList)3 StreamType (com.symphony.api.model.StreamType)3 V3RoomAttributes (com.symphony.api.model.V3RoomAttributes)3 V3RoomDetail (com.symphony.api.model.V3RoomDetail)3 V3RoomSearchResults (com.symphony.api.model.V3RoomSearchResults)3 List (java.util.List)3 EntityJson (org.finos.symphony.toolkit.json.EntityJson)3 SymphonyIdentity (com.symphony.api.id.SymphonyIdentity)2 StreamFilter (com.symphony.api.model.StreamFilter)2