use of com.symphony.api.agent.MessagesApi in project spring-bot by finos.
the class TestOboCall method doSomethingOBORSA.
@Test
public void doSomethingOBORSA() throws Exception {
ApiInstance ai = oboInstanceFactory.createApiInstance(1234l, "1000");
MessagesApi messagesApi = ai.getAgentApi(MessagesApi.class);
messagesApi.v4MessageBlastPost(STREAM_IDS, MESSAGE_CONTENT, null, null, null, null, null, null);
}
use of com.symphony.api.agent.MessagesApi 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.agent.MessagesApi 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.agent.MessagesApi in project spring-bot by finos.
the class AgentIT method testDataPost.
@ParameterizedTest
@MethodSource("setupConfigurations")
public void testDataPost(TestClientStrategy s) throws Exception {
MessagesApi messageAPi = s.getAgentApi(MessagesApi.class);
String in = asString(this.getClass().getResourceAsStream("/pizza.json"));
V4Message done = messageAPi.v4StreamSidMessageCreatePost(null, ROOM, "<messageML>" + " Hello. Here is an important message with an" + " <div class=\"entity\" data-entity-id=\"object001\" />" + " included." + "</messageML>", in, null, null, null, null);
// updating messages currently not supported on develop pod
// // try updating the message
// V4Message second = messageAPi.v4StreamSidMessageMidUpdatePost(null, ROOM, done.getMessageId(), "<messageML>This is updated</messageML>", in, null, null);
//
// // read the message back
// V4Message third = messageAPi.v1MessageIdGet(null, null, done.getMessageId());
//
// Assertions.assertEquals(second.getMessage(), third.getMessage());
}
use of com.symphony.api.agent.MessagesApi in project spring-bot by finos.
the class AgentIT method testStreamsV4.
@ParameterizedTest
@MethodSource("setupConfigurations")
public void testStreamsV4(TestClientStrategy s) throws Exception {
DatafeedApi dfApi = s.getAgentApi(DatafeedApi.class);
MessagesApi messageAPi = s.getAgentApi(MessagesApi.class);
Datafeed datafeed = dfApi.v4DatafeedCreatePost(null, null);
System.out.println("Datafeed ID: " + datafeed.getId());
Supplier<List<V4Event>> supplier = () -> dfApi.v4DatafeedIdReadGet(datafeed.getId(), null, null, 100);
final int[] count = { 0 };
final Worker<V4Event> w = Streams.createWorker(supplier, e -> e.printStackTrace());
Thread t = new Thread(() -> {
w.stream().forEach(e -> count[0]++);
});
t.setDaemon(true);
t.start();
String toSend = "Trigger Listener." + new Random().nextInt();
messageAPi.v4StreamSidMessageCreatePost(null, ROOM, "<messageML>" + toSend + "</messageML>", null, null, null, null, null);
// wait for roundtrip
while (count[0] == 0) {
Thread.yield();
}
}
Aggregations