use of com.symphony.api.model.V4MessageList in project spring-bot by finos.
the class CXFMultipartIT method testAttachmentPosting.
@Test
public void testAttachmentPosting() throws Exception {
TestClientStrategy strategy = TestPodConfig.CXF_RSA;
MessagesApi messagesApi = strategy.getAgentApi(MessagesApi.class);
// pull some messages back
V4MessageList msg = messagesApi.v4StreamSidMessageGet(AbstractIT.ROOM, 0l, null, null, 0, 100);
Assertions.assertTrue(msg.size() > 4);
// post a message
String message = "<messageML>Hello Java Java World!</messageML>";
File f = new File(this.getClass().getResource("/walker.jpeg").getFile());
Attachment a = new Attachment("attachment", "image/jpeg", f);
V4Message response = messagesApi.v4StreamSidMessageCreatePost(null, AbstractIT.ROOM, message, null, null, f, null, null);
messagesApi.v4StreamSidMessageCreatePost(null, AbstractIT.ROOM, message, null, null, a, null, null);
System.out.println(response.toString());
}
use of com.symphony.api.model.V4MessageList in project spring-bot by finos.
the class TokenIT method checkTokenCreation.
@ParameterizedTest
@MethodSource("setupConfigurations")
public void checkTokenCreation(TestClientStrategy s) throws Exception {
TokenManager tm = s.getTokenManager();
MessagesApi messagesApi = s.getAgentApi(MessagesApi.class);
// pull some messages back: look - no tokens are set
V4MessageList msg = messagesApi.v4StreamSidMessageGet(ROOM, 0l, null, null, 0, 5);
Assertions.assertTrue(msg.size() > 4);
String originalSessionToken = tm.getSessionToken().getToken();
String originalKeyManagerToken = tm.getKeyManagerToken().getToken();
// expire the session token
try {
s.getSessionAuthApi().v1LogoutPost(tm.getSessionToken().getToken());
} catch (Exception e) {
// doesn't return what symphony says it will
}
// this will perform a retry, since the original tokens are invalid.
messagesApi.v4StreamSidMessageGet(ROOM, 0l, null, null, 0, 5);
// check that tokens actually did get refreshed
Assertions.assertNotEquals(originalSessionToken, tm.getSessionToken());
Assertions.assertNotEquals(originalKeyManagerToken, tm.getKeyManagerToken());
}
use of com.symphony.api.model.V4MessageList in project spring-bot by finos.
the class SymphonyHistoryImpl method getEntityJsonFromHistory.
@Override
public List<EntityJson> getEntityJsonFromHistory(Tag t, Addressable address, Instant since) {
MessageSearchQuery msq = createMessageSearchQuery(null, address, since, t);
V4MessageList out = messageApi.v1MessageSearchPost(msq, null, null, 0, 50, null, null);
return out.stream().map(msg -> getEntityJson(msg)).filter(e -> e != null).collect(Collectors.toList());
}
use of com.symphony.api.model.V4MessageList in project spring-bot by finos.
the class SymphonyHistoryImpl method getEntityJsonFromHistory.
@Override
public <X> List<EntityJson> getEntityJsonFromHistory(Class<X> type, Addressable address, Instant since) {
MessageSearchQuery msq = createMessageSearchQuery(type, address, since, null);
V4MessageList out = messageApi.v1MessageSearchPost(msq, null, null, 0, 50, null, null);
return out.stream().map(msg -> getEntityJson(msg)).filter(e -> e != null).collect(Collectors.toList());
}
use of com.symphony.api.model.V4MessageList in project spring-bot by finos.
the class SymphonyHistoryImpl method getLastEntityJsonFromHistory.
@Override
public <X> Optional<EntityJson> getLastEntityJsonFromHistory(Class<X> type, Addressable address) {
MessageSearchQuery msq = createMessageSearchQuery(type, address, null, null);
V4MessageList out = messageApi.v1MessageSearchPost(msq, null, null, 0, 1, null, null);
return convertToOptionalEntityJson(out);
}
Aggregations