forked from igniterealtime/openfire-monitoring-plugin
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For igniterealtime#120 / igniterealtime#170: Fix XML marshalling of C…
…onversationEvent If ConversationEvent can't be marshalled to/from XML, then events won't ever be pushed successfully from junior cluster nodes to the senior node.
- Loading branch information
Showing
5 changed files
with
85 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/test/java/org/jivesoftware/openfire/archive/ConversationManagerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.jivesoftware.openfire.archive; | ||
|
||
import org.junit.Test; | ||
import org.xmpp.packet.JID; | ||
|
||
import java.util.Date; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
public class ConversationManagerTest { | ||
|
||
@Test | ||
public void testXmlMarshallingConversationEventTest() throws Exception { | ||
// Setup test fixture. | ||
final ConversationEvent input = ConversationEvent.chatMessageReceived(new JID("[email protected]"), new JID("[email protected]/g"), "body", "stanza", new Date(1)); | ||
final XmlSerializer serializer = new XmlSerializer( | ||
Conversation.class, | ||
UserParticipations.class, | ||
ConversationParticipation.class, | ||
ConversationEvent.class | ||
); | ||
|
||
// Execute system under test. | ||
final String xml = serializer.marshall(input); | ||
final Object result = serializer.unmarshall(xml); | ||
|
||
// Verify result. | ||
assertTrue(result instanceof ConversationEvent); | ||
assertEquals("Marshalled content didn't unmarshall as equal object. Marshalled content: " + xml, input, result); | ||
} | ||
} |