use of org.jivesoftware.smackx.forward.packet.Forwarded in project Smack by igniterealtime.
the class MamIntegrationTest method mamTest.
@SmackIntegrationTest
public void mamTest() throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException, NotLoggedInException {
EntityBareJid userOne = conOne.getUser().asEntityBareJid();
EntityBareJid userTwo = conTwo.getUser().asEntityBareJid();
Message message = new Message(userTwo);
String messageId = message.setStanzaId();
String messageBody = "test message";
message.setBody(messageBody);
conOne.sendStanza(message);
int pageSize = 20;
MamQueryResult mamQueryResult = mamManagerConTwo.queryArchive(pageSize, null, null, userOne, null);
while (!mamQueryResult.mamFin.isComplete()) {
mamQueryResult = mamManagerConTwo.pageNext(mamQueryResult, pageSize);
}
List<Forwarded> forwardedMessages = mamQueryResult.forwardedMessages;
Message mamMessage = (Message) forwardedMessages.get(forwardedMessages.size() - 1).getForwardedStanza();
assertEquals(messageId, mamMessage.getStanzaId());
assertEquals(messageBody, mamMessage.getBody());
assertEquals(conOne.getUser(), mamMessage.getFrom());
assertEquals(userTwo, mamMessage.getTo());
}
Aggregations