use of com.symphony.api.model.V3RoomSearchResults in project spring-bot by finos.
the class PodApiIT method testRoomSearch.
@ParameterizedTest
@MethodSource("setupConfigurations")
public void testRoomSearch(TestClientStrategy client) throws Exception {
StreamsApi sApi = client.getPodApi(StreamsApi.class);
V2RoomSearchCriteria criteria = new V2RoomSearchCriteria();
criteria.setQuery("Demo");
criteria.setPrivate(true);
criteria.setActive(true);
criteria.setLabels(Collections.emptyList());
criteria.setSortOrder(SortOrderEnum.BASIC);
V3RoomSearchResults res = sApi.v3RoomSearchPost(criteria, null, 0, 100);
System.out.println(res);
}
use of com.symphony.api.model.V3RoomSearchResults 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);
}
use of com.symphony.api.model.V3RoomSearchResults in project spring-bot by finos.
the class TestRoomAndUsersBuilder method testEnsureRoom.
@Test
public void testEnsureRoom() {
ruBuilder.setDefaultAdministrators(Collections.singletonList(new SymphonyUser(1111l)));
// create room
when(streamsApi.v1StreamsListPost(Mockito.isNull(), Mockito.any(), Mockito.eq(0), Mockito.eq(50))).thenAnswer(c -> {
StreamList out = new StreamList();
out.add(new StreamAttributes().roomAttributes(new RoomSpecificStreamAttributes().name("Some Test Room")).id("abc123").streamType(new StreamType().type(TypeEnum.ROOM)));
UserIdList l = new UserIdList();
// robski
l.add(765l);
// the bot
l.add(654321l);
out.add(new StreamAttributes().streamAttributes(new ConversationSpecificStreamAttributes().members(l)).id("283746").streamType(new StreamType().type(TypeEnum.IM)));
return out;
});
when(streamsApi.v3RoomCreatePost(any(), isNull())).then(a -> new V3RoomDetail().roomSystemInfo(new RoomSystemInfo().id("456")).roomAttributes(new V3RoomAttributes()._public(false).name("Some Test Room").description("Still Bogus")));
when(streamsApi.v3RoomSearchPost(Mockito.any(), Mockito.isNull(), Mockito.isNull(), Mockito.isNull())).then(a -> new V3RoomSearchResults().rooms(Collections.emptyList()));
SymphonyRoom rd = new SymphonyRoom("Some Test Room", null);
SymphonyUser su = new SymphonyUser(2342l);
SymphonyRoom out = ruBuilder.ensureChat(rd, Collections.singletonList(su), SymphonyConversations.simpleMeta("Automated Test Room Created", true));
assertEquals("Some Test Room", out.getName());
assertEquals(2, ruBuilder.getAllConversations().size());
assertEquals("456", out.getStreamId());
// return members
MembershipList ml = new MembershipList();
ml.add(new MemberInfo().id(123l).owner(true));
when(rmApi.v2RoomIdMembershipListGet(Mockito.anyString(), Mockito.isNull())).thenReturn(ml);
List<User> chatMembers = ruBuilder.getChatMembers(out);
Assertions.assertEquals(Collections.singletonList(new SymphonyUser(123l, ROB_NAME, ROB_EXAMPLE_EMAIL)), chatMembers);
}
Aggregations