use of com.symphony.api.model.V4User in project spring-bot by finos.
the class RoomWelcomeEventConsumerIT method testUserAdded.
@Test
public void testUserAdded() {
RoomWelcomeEventConsumer rwec = new RoomWelcomeEventConsumer(messages, users, bot, WELCOME_MESSAGE);
V4Event event = new V4Event().payload(new V4Payload().userJoinedRoom(new V4UserJoinedRoom().affectedUser(new V4User().displayName("Gordon Bennett")).stream(new V4Stream().streamId(NEW_ROOM_STREAM_ID))));
rwec.accept(event);
Mockito.verify(messages, Mockito.times(1)).v4StreamSidMessageCreatePost(Mockito.isNull(), Mockito.matches(Pattern.quote(NEW_ROOM_STREAM_ID)), Mockito.matches(Pattern.quote(WELCOME_MESSAGE)), Mockito.isNotNull(), Mockito.isNull(), Mockito.isNull(), Mockito.isNull(), Mockito.isNull());
Mockito.clearInvocations(messages);
}
use of com.symphony.api.model.V4User in project spring-bot by finos.
the class BotIT method testPressButton.
/**
* When the user presses a button, we return a response.
*/
@Test
public void testPressButton() {
V4Event in = new V4Event().initiator(new V4Initiator().user(new V4User().email("rob@example.com").displayName("Rob Example").userId(2438923l))).payload(new V4Payload().symphonyElementsAction(new V4SymphonyElementsAction().formId("koreai-choice").formValues(Collections.singletonMap("action", "some button")).stream(new V4Stream().streamId("ABC123"))));
getPublicBot().sendToConsumer(in);
littleSleep();
wireMockRule.verify(1, WireMock.postRequestedFor(urlPathMatching("/agent/v4/stream/ABC123/message/create")));
}
use of com.symphony.api.model.V4User in project spring-bot by finos.
the class BotIT method testSendMessageRoomWithMention.
@Test
public void testSendMessageRoomWithMention() throws JsonProcessingException {
Mention m = new Mention();
m.setId(new ArrayList<>());
m.getId().add(new UserId("1234"));
EntityJson ej = new EntityJson();
ej.put("m1", m);
String data = symphonyObjectMapper.writeValueAsString(ej);
V4Event in = new V4Event().initiator(new V4Initiator().user(new V4User().email("rob@example.com").displayName("Rob Example").userId(2438923l))).payload(new V4Payload().messageSent(new V4MessageSent().message(new V4Message().message("<div>hello</div>").stream(new V4Stream().streamId("ABC123").streamType("ROOM")).data(data))));
getPublicBot().sendToConsumer(in);
littleSleep();
wireMockRule.verify(1, WireMock.postRequestedFor(urlPathMatching("/agent/v4/stream/ABC123/message/create")));
}
use of com.symphony.api.model.V4User in project spring-bot by finos.
the class BotIT method testSendMessageIM.
@Test
public void testSendMessageIM() {
V4Event in = new V4Event().initiator(new V4Initiator().user(new V4User().email("rob@example.com").displayName("Rob Example").userId(2438923l))).payload(new V4Payload().messageSent(new V4MessageSent().message(new V4Message().message("<div>hello</div>").data("{}").stream(new V4Stream().streamId("ABC123").streamType("IM")))));
getPublicBot().sendToConsumer(in);
littleSleep();
wireMockRule.verify(1, WireMock.postRequestedFor(urlPathMatching("/agent/v4/stream/ABC123/message/create")));
}
use of com.symphony.api.model.V4User in project spring-bot by finos.
the class BotIT method testSendMessageRoomWithoutSlash.
@Test
public void testSendMessageRoomWithoutSlash() {
V4Event in = new V4Event().initiator(new V4Initiator().user(new V4User().email("rob@example.com").displayName("Rob Example").userId(2438923l))).payload(new V4Payload().messageSent(new V4MessageSent().message(new V4Message().message("<div>hello</div>").data("{}").stream(new V4Stream().streamId("ABC123").streamType("ROOM")))));
getPublicBot().sendToConsumer(in);
littleSleep();
// we shouldn't see a message sent
wireMockRule.verify(0, WireMock.postRequestedFor(urlPathMatching("/agent/v4/stream/ABC123/message/create")));
}
Aggregations