-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
The XmlSerializer was intended to be generic, but is used in only one invocation. To make it easier to test the implementation, this commit turns the generic implementation into something that is specific to this plugin.
- Loading branch information
Showing
7 changed files
with
80 additions
and
69 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
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: 0 additions & 32 deletions
32
src/test/java/org/jivesoftware/openfire/archive/ConversationManagerTest.java
This file was deleted.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
src/test/java/org/jivesoftware/openfire/archive/XmlSerializerTest.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,50 @@ | ||
/* | ||
* Copyright (C) 2021 Ignite Realtime Foundation. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
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; | ||
|
||
/** | ||
* Verifies the implementation of {@link XmlSerializer} | ||
* | ||
* @author Guus der Kinderen, [email protected] | ||
*/ | ||
public class XmlSerializerTest { | ||
|
||
/** | ||
* Checks that an instance of {@link ConversationEvent} can be marshalled to XML, and back to an object again, | ||
* verifying that the resulting object is equal to the original input. | ||
*/ | ||
@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)); | ||
|
||
// Execute system under test. | ||
final String xml = XmlSerializer.getInstance().marshall(input); | ||
final Object result = XmlSerializer.getInstance().unmarshall(xml); | ||
|
||
// Verify result. | ||
assertTrue(result instanceof ConversationEvent); | ||
assertEquals("Marshalled content didn't unmarshall as equal object. Marshalled content: " + xml, input, result); | ||
} | ||
} |