mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-06 11:01:16 +01:00
SMACK-363 Applied code cleanup patches for many generics related issues.
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13325 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
6dc64671e2
commit
e08c8afe44
109 changed files with 577 additions and 605 deletions
|
|
@ -3,6 +3,7 @@ package org.jivesoftware.smack;
|
|||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smack.packet.Privacy;
|
||||
import org.jivesoftware.smack.packet.PrivacyItem;
|
||||
|
||||
/**
|
||||
* This class supports automated tests about privacy communication from the
|
||||
|
|
@ -27,7 +28,7 @@ public class PrivacyClient implements PrivacyListListener {
|
|||
super();
|
||||
}
|
||||
|
||||
public void setPrivacyList(String listName, List listItem) {
|
||||
public void setPrivacyList(String listName, List<PrivacyItem> listItem) {
|
||||
privacy.setPrivacyList(listName, listItem);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -60,8 +60,6 @@ import org.jivesoftware.smack.packet.*;
|
|||
*/
|
||||
public class PacketTypeFilterTest extends TestCase {
|
||||
|
||||
private class Dummy {}
|
||||
|
||||
private class InnerClassDummy {
|
||||
public class DummyPacket extends Packet {
|
||||
public String toXML() {
|
||||
|
|
@ -88,12 +86,13 @@ public class PacketTypeFilterTest extends TestCase {
|
|||
* Test case for the constructor of PacketTypeFilter objects.
|
||||
*/
|
||||
public void testConstructor() {
|
||||
// We dont need to test this since PacketTypeFilter(Class<? extends Packet> packetType) only excepts Packets
|
||||
// Test a class that is not a subclass of Packet
|
||||
try {
|
||||
new PacketTypeFilter(Dummy.class);
|
||||
fail("Parameter must be a subclass of Packet.");
|
||||
}
|
||||
catch (IllegalArgumentException e) {}
|
||||
// try {
|
||||
// new PacketTypeFilter(Dummy.class);
|
||||
// fail("Parameter must be a subclass of Packet.");
|
||||
// }
|
||||
// catch (IllegalArgumentException e) {}
|
||||
|
||||
// Test a class that is a subclass of Packet
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -52,8 +52,6 @@
|
|||
|
||||
package org.jivesoftware.smack.packet;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* A mock implementation of the Packet abstract class. Implements toXML() by returning null.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -45,11 +45,11 @@ public class PrivacyTest extends SmackTestCase {
|
|||
|
||||
// Assert the list composition.
|
||||
assertEquals(listName, privacyManager.getActiveList().toString());
|
||||
List privacyItems = privacyManager.getPrivacyList(listName).getItems();
|
||||
List<PrivacyItem> privacyItems = privacyManager.getPrivacyList(listName).getItems();
|
||||
assertEquals(1, privacyItems.size());
|
||||
|
||||
// Assert the privacy item composition
|
||||
PrivacyItem receivedItem = (PrivacyItem) privacyItems.get(0);
|
||||
PrivacyItem receivedItem = privacyItems.get(0);
|
||||
assertEquals(1, receivedItem.getOrder());
|
||||
assertEquals(PrivacyItem.Type.jid, receivedItem.getType());
|
||||
assertEquals(true, receivedItem.isAllow());
|
||||
|
|
@ -278,11 +278,11 @@ public class PrivacyTest extends SmackTestCase {
|
|||
|
||||
// Assert the list composition.
|
||||
assertEquals(listName, privacyManager.getDefaultList().toString());
|
||||
List privacyItems = privacyManager.getPrivacyList(listName).getItems();
|
||||
List<PrivacyItem> privacyItems = privacyManager.getPrivacyList(listName).getItems();
|
||||
assertEquals(1, privacyItems.size());
|
||||
|
||||
// Assert the privacy item composition
|
||||
PrivacyItem receivedItem = (PrivacyItem) privacyItems.get(0);
|
||||
PrivacyItem receivedItem = privacyItems.get(0);
|
||||
assertEquals(1, receivedItem.getOrder());
|
||||
assertEquals(PrivacyItem.Type.jid, receivedItem.getType());
|
||||
assertEquals(true, receivedItem.isAllow());
|
||||
|
|
@ -427,7 +427,7 @@ public class PrivacyTest extends SmackTestCase {
|
|||
Thread.sleep(500);
|
||||
|
||||
// Assert the server list composition.
|
||||
List privacyItems = privacyManager.getPrivacyList(listName).getItems();
|
||||
List<PrivacyItem> privacyItems = privacyManager.getPrivacyList(listName).getItems();
|
||||
assertEquals(originalPrivacyItems.length, privacyItems.size());
|
||||
|
||||
// Assert the local and server privacy item composition
|
||||
|
|
@ -436,7 +436,7 @@ public class PrivacyTest extends SmackTestCase {
|
|||
int index;
|
||||
for (int j = 0; j < originalPrivacyItems.length; j++) {
|
||||
// Look for the same server and original items
|
||||
receivedItem = (PrivacyItem) privacyItems.get(j);
|
||||
receivedItem = privacyItems.get(j);
|
||||
index = 0;
|
||||
while ((index < originalPrivacyItems.length)
|
||||
&& (originalPrivacyItems[index].getOrder() != receivedItem.getOrder())) {
|
||||
|
|
|
|||
|
|
@ -353,17 +353,17 @@ public abstract class SmackTestCase extends TestCase {
|
|||
try {
|
||||
boolean found = false;
|
||||
// Try to load the configutation from an XML file specific for this test case
|
||||
Enumeration resources =
|
||||
Enumeration<URL> resources =
|
||||
ClassLoader.getSystemClassLoader().getResources(getConfigurationFilename());
|
||||
while (resources.hasMoreElements()) {
|
||||
found = parseURL((URL) resources.nextElement());
|
||||
found = parseURL(resources.nextElement());
|
||||
}
|
||||
// If none was found then try to load the configuration from the default configuration
|
||||
// file (i.e. "config/test-case.xml")
|
||||
if (!found) {
|
||||
resources = ClassLoader.getSystemClassLoader().getResources("config/test-case.xml");
|
||||
while (resources.hasMoreElements()) {
|
||||
found = parseURL((URL) resources.nextElement());
|
||||
found = parseURL(resources.nextElement());
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue