diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2009-08-31 15:25:57 +0000 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2009-08-31 15:25:57 +0000 |
commit | f837057d334ce9132ddae3438b5361baf2f56750 (patch) | |
tree | fce75a25c16e1972a565023aa195bae8955fef3b /test/net/java/sip/communicator/slick | |
parent | d84529346a391f3fd33d3bff5ebb808a837429d3 (diff) | |
download | jitsi-f837057d334ce9132ddae3438b5361baf2f56750.zip jitsi-f837057d334ce9132ddae3438b5361baf2f56750.tar.gz jitsi-f837057d334ce9132ddae3438b5361baf2f56750.tar.bz2 |
Commits the last part of the patch provided by Sebastien Vincent on the dev mailing list in an e-mail with the subject "Fix lot of warnings in the code" which fixes warnings in the test directory.
Diffstat (limited to 'test/net/java/sip/communicator/slick')
75 files changed, 577 insertions, 616 deletions
diff --git a/test/net/java/sip/communicator/slick/callhistory/CallHistoryServiceLick.java b/test/net/java/sip/communicator/slick/callhistory/CallHistoryServiceLick.java index 8ccea16..6abaca8 100644 --- a/test/net/java/sip/communicator/slick/callhistory/CallHistoryServiceLick.java +++ b/test/net/java/sip/communicator/slick/callhistory/CallHistoryServiceLick.java @@ -34,7 +34,7 @@ public class CallHistoryServiceLick extends TestSuite implements BundleActivator CallHistoryServiceLick.bc = bundleContext; setName("CallHistoryServiceLick"); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put("service.pid", getName()); addTest(TestCallHistoryService.suite()); diff --git a/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java b/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java index 95e525c..db01212 100644 --- a/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java +++ b/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java @@ -53,7 +53,7 @@ public class TestCallHistoryService /** * The addresses will be used in the generated mock calls */ - private static Vector participantAddresses = new Vector(); + private static Vector<String> participantAddresses = new Vector<String>(); public TestCallHistoryService(String name) { @@ -97,7 +97,7 @@ public class TestCallHistoryService System.setProperty(MetaContactListService.PROVIDER_MASK_PROPERTY, "1"); - Hashtable mockProvProperties = new Hashtable(); + Hashtable<String, String> mockProvProperties = new Hashtable<String, String>(); mockProvProperties.put(ProtocolProviderFactory.PROTOCOL , mockProvider.getProtocolName()); mockProvProperties.put(MetaContactListService.PROVIDER_MASK_PROPERTY, @@ -132,17 +132,17 @@ public class TestCallHistoryService { logger.info("write records "); - generateCall((String)participantAddresses.get(0)); + generateCall(participantAddresses.get(0)); controlDate1 = new Date(); - generateCall((String)participantAddresses.get(1)); + generateCall(participantAddresses.get(1)); - generateCall((String)participantAddresses.get(2)); + generateCall(participantAddresses.get(2)); controlDate2 = new Date(); - generateCall((String)participantAddresses.get(3)); + generateCall(participantAddresses.get(3)); } private void generateCall(String participant) @@ -151,12 +151,12 @@ public class TestCallHistoryService { Call newCall = mockBTelphonyOpSet.placeCall(participant); - Vector v = new Vector(); + Vector<CallPeer> v = new Vector<CallPeer>(); - Iterator iter = newCall.getCallPeers(); + Iterator<CallPeer> iter = newCall.getCallPeers(); while (iter.hasNext()) { - CallPeer item = (CallPeer) iter.next(); + CallPeer item = iter.next(); v.add(item); } @@ -198,8 +198,9 @@ public class TestCallHistoryService * This must match also many calls, as tests are run many times * but the minimum is 3 */ - Collection rs = callHistoryService.findByEndDate(controlDate2); - Iterator resultIter = rs.iterator(); + Collection<CallRecord> rs + = callHistoryService.findByEndDate(controlDate2); + Iterator<CallRecord> resultIter = rs.iterator(); assertTrue("Calls too few - findByEndDate", rs.size() >= 3); @@ -212,15 +213,14 @@ public class TestCallHistoryService assertEquals("Calls must be 2", rs.size(), 2); CallRecord rec = (CallRecord)resultIter.next(); - CallPeerRecord participant = - (CallPeerRecord)rec.getPeerRecords().get(0); + CallPeerRecord participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). equals(participantAddresses.get(2))); rec = (CallRecord)resultIter.next(); - participant = (CallPeerRecord)rec.getPeerRecords().get(0); + participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). @@ -235,7 +235,7 @@ public class TestCallHistoryService assertEquals("Calls must be 1", rs.size(), 1); rec = (CallRecord)resultIter.next(); - participant = (CallPeerRecord)rec.getPeerRecords().get(0); + participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). @@ -250,21 +250,21 @@ public class TestCallHistoryService assertEquals("Calls must be 3", rs.size(), 3); rec = (CallRecord)resultIter.next(); - participant = (CallPeerRecord) rec.getPeerRecords().get(0); + participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). equals(participantAddresses.get(3))); rec = (CallRecord)resultIter.next(); - participant = (CallPeerRecord) rec.getPeerRecords().get(0); + participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). equals(participantAddresses.get(2))); rec = (CallRecord)resultIter.next(); - participant = (CallPeerRecord) rec.getPeerRecords().get(0); + participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). @@ -282,12 +282,12 @@ public class TestCallHistoryService Call newCall = mockBTelphonyOpSet.placeCall(partAddresses[0]); - Vector v = new Vector(); + Vector<CallPeer> v = new Vector<CallPeer>(); - Iterator iter = newCall.getCallPeers(); + Iterator<CallPeer> iter = newCall.getCallPeers(); while (iter.hasNext()) { - CallPeer item = (CallPeer) iter.next(); + CallPeer item = iter.next(); v.add(item); } @@ -315,11 +315,11 @@ public class TestCallHistoryService } - Collection lastCall = callHistoryService.findLast(1); + Collection<CallRecord> lastCall = callHistoryService.findLast(1); assertEquals("There must be 1 Call", lastCall.size(), 1); - CallRecord callRecord = (CallRecord)lastCall.iterator().next(); + CallRecord callRecord = lastCall.iterator().next(); assertEquals("There must be 2 participants in the call", callRecord.getPeerRecords().size(), 2); @@ -335,16 +335,4 @@ public class TestCallHistoryService assertTrue("Second participant hanguped before first one", callP2.getEndTime().before(callP1.getEndTime())); } - - private void dumpResult(Collection c) - { - Iterator rs = c.iterator(); - while (rs.hasNext()) - { - CallRecord hr = (CallRecord)rs.next(); - logger.info("----------------------"); - logger.info(hr.getPeerRecords()); - logger.info("----------------------"); - } - } } diff --git a/test/net/java/sip/communicator/slick/configuration/ConfigurationServiceLick.java b/test/net/java/sip/communicator/slick/configuration/ConfigurationServiceLick.java index e607802..a4f4cde 100644 --- a/test/net/java/sip/communicator/slick/configuration/ConfigurationServiceLick.java +++ b/test/net/java/sip/communicator/slick/configuration/ConfigurationServiceLick.java @@ -31,7 +31,7 @@ public class ConfigurationServiceLick { ConfigurationServiceLick.bc = bundleContext; setName("ConfigurationServiceLick"); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put("service.pid", getName()); addTestSuite(TestConfigurationService.class); diff --git a/test/net/java/sip/communicator/slick/contactlist/MclSlickFixture.java b/test/net/java/sip/communicator/slick/contactlist/MclSlickFixture.java index a92df3d..428def0 100644 --- a/test/net/java/sip/communicator/slick/contactlist/MclSlickFixture.java +++ b/test/net/java/sip/communicator/slick/contactlist/MclSlickFixture.java @@ -238,7 +238,7 @@ public class MclSlickFixture , actualMetaContact.getContacts().hasNext()); Contact actualProtoContact - = (Contact)actualMetaContact.getContacts().next(); + = actualMetaContact.getContacts().next(); assertNotNull("getContactForProvider returned null for MockProvider" , actualProtoContact); diff --git a/test/net/java/sip/communicator/slick/contactlist/MetaContactListServiceLick.java b/test/net/java/sip/communicator/slick/contactlist/MetaContactListServiceLick.java index af21999..d983b27 100644 --- a/test/net/java/sip/communicator/slick/contactlist/MetaContactListServiceLick.java +++ b/test/net/java/sip/communicator/slick/contactlist/MetaContactListServiceLick.java @@ -58,7 +58,7 @@ public class MetaContactListServiceLick MclSlickFixture.bundleContext = context; setName("MetaContactListServiceLick"); - Hashtable slickServiceProperties = new Hashtable(); + Hashtable<String, String> slickServiceProperties = new Hashtable<String, String>(); slickServiceProperties.put("service.pid", getName()); logger.debug("Service " + getClass().getName() + " [ STARTED ]"); @@ -150,7 +150,7 @@ public class MetaContactListServiceLick //properties of the newly registered provider. System.setProperty(MetaContactListService.PROVIDER_MASK_PROPERTY, "1"); - Hashtable mockProvProperties = new Hashtable(); + Hashtable<String, String> mockProvProperties = new Hashtable<String, String>(); mockProvProperties.put(MetaContactListService.PROVIDER_MASK_PROPERTY, "1"); diff --git a/test/net/java/sip/communicator/slick/contactlist/TestMetaContactGroup.java b/test/net/java/sip/communicator/slick/contactlist/TestMetaContactGroup.java index 0d6a863..a628560 100644 --- a/test/net/java/sip/communicator/slick/contactlist/TestMetaContactGroup.java +++ b/test/net/java/sip/communicator/slick/contactlist/TestMetaContactGroup.java @@ -98,7 +98,7 @@ public class TestMetaContactGroup extends TestCase */ public void testGetChildContacts() { - Iterator childContactsIter = metaGroup.getChildContacts(); + Iterator<MetaContact> childContactsIter = metaGroup.getChildContacts(); assertNotNull("getChildContacts() returned a null iterator." , childContactsIter); @@ -129,15 +129,14 @@ public class TestMetaContactGroup extends TestCase */ public void testGetContactGroups() { - Iterator contactGroups = metaGroup.getContactGroups(); + Iterator<ContactGroup> contactGroups = metaGroup.getContactGroups(); assertNotNull("contact groups iterator", contactGroups); assertTrue("The contact groups iterator was empty." , contactGroups.hasNext()); - MockContactGroup actualMockGroup - = (MockContactGroup)contactGroups.next(); + ContactGroup actualMockGroup = contactGroups.next(); assertSame("Iterator did not contain the right contact group" , mockGroup @@ -149,15 +148,14 @@ public class TestMetaContactGroup extends TestCase */ public void testGetContactGroupsForProvider() { - Iterator contactGroups = metaGroup.getContactGroups(); + Iterator<ContactGroup> contactGroups = metaGroup.getContactGroups(); assertNotNull("contact groups for provider iterator", contactGroups); assertTrue("The contact groups iterator was empty for a mock provider." , contactGroups.hasNext()); - MockContactGroup actualMockGroup - = (MockContactGroup)contactGroups.next(); + ContactGroup actualMockGroup = contactGroups.next(); assertSame("A prov. iterator did not contain the right contact group" , mockGroup @@ -203,7 +201,7 @@ public class TestMetaContactGroup extends TestCase public void testGetMetaContact2() { //firt obtain a reference to a contact through iteration. - Iterator childContactsIter = metaGroup.getChildContacts(); + Iterator<MetaContact> childContactsIter = metaGroup.getChildContacts(); //make sure the returned ref is ok. assertNotNull("getChildContacts() returned a null iterator." @@ -212,7 +210,7 @@ public class TestMetaContactGroup extends TestCase assertTrue("getChildContacts() returned an empty iterator." , childContactsIter.hasNext()); - MetaContact expectedChild = (MetaContact)childContactsIter.next(); + MetaContact expectedChild = childContactsIter.next(); MetaContact actualChild = metaGroup.getMetaContact( expectedChild.getMetaUID()); @@ -266,8 +264,8 @@ public class TestMetaContactGroup extends TestCase assertNotNull("The returned group does not appear to really exist" ,mockGroup.getGroup(actualGroup.getGroupName())); assertNotNull("Group encapsulated in the returned group did not match" - , mockGroup.getGroup(((MockContactGroup)actualGroup - .getContactGroups().next()).getGroupName())); + , mockGroup.getGroup(actualGroup + .getContactGroups().next().getGroupName())); } /** @@ -277,7 +275,7 @@ public class TestMetaContactGroup extends TestCase { //firt obtain references to a group. MetaContactGroup actualGroup = metaGroup.getMetaContactSubgroup( - ((MetaContactGroup)metaGroup.getSubgroups().next()).getGroupName()); + (metaGroup.getSubgroups().next()).getGroupName()); //make sure that what we just got is not null. assertNotNull("getMetaContact(String) returned null for group 0" @@ -321,7 +319,7 @@ public class TestMetaContactGroup extends TestCase */ public void testGetSubgroups() { - Iterator subgroupsIter = metaGroup.getSubgroups(); + Iterator<MetaContactGroup> subgroupsIter = metaGroup.getSubgroups(); assertNotNull("getSubgroup() returned a null iterator." , subgroupsIter); diff --git a/test/net/java/sip/communicator/slick/contactlist/TestMetaContactList.java b/test/net/java/sip/communicator/slick/contactlist/TestMetaContactList.java index ce9b117..55d96de 100644 --- a/test/net/java/sip/communicator/slick/contactlist/TestMetaContactList.java +++ b/test/net/java/sip/communicator/slick/contactlist/TestMetaContactList.java @@ -127,10 +127,9 @@ public class TestMetaContactList //change a status fixture.metaClService.addMetaContactListListener(evtCollector); - ((MockPersistentPresenceOperationSet)fixture.mockPresOpSet) - .changePresenceStatusForContact(MetaContactListServiceLick - .mockContactToReorder - , MockStatusEnum.MOCK_STATUS_100); + fixture.mockPresOpSet.changePresenceStatusForContact( + MetaContactListServiceLick.mockContactToReorder, + MockStatusEnum.MOCK_STATUS_100); fixture.metaClService.removeMetaContactListListener(evtCollector); @@ -153,10 +152,9 @@ public class TestMetaContactList assertContactsOrder(fixture.metaClService.getRoot()); //restore the contacts original status - ((MockPersistentPresenceOperationSet)fixture.mockPresOpSet) - .changePresenceStatusForContact(MetaContactListServiceLick - .mockContactToReorder - , MockStatusEnum.MOCK_STATUS_00); + fixture.mockPresOpSet.changePresenceStatusForContact( + MetaContactListServiceLick.mockContactToReorder, + MockStatusEnum.MOCK_STATUS_00); //repeat order tests but this time after changing the display name of a @@ -241,13 +239,13 @@ public class TestMetaContactList //get a top level contact and then try to find it through the tested //findMetaContactByMetaUID method. - Iterator contactsIter = root.getChildContacts(); + Iterator<MetaContact> contactsIter = root.getChildContacts(); assertTrue( "No contacts were found in the meta contact list" , contactsIter.hasNext()); - MetaContact expectedContact = (MetaContact)contactsIter.next(); + MetaContact expectedContact = contactsIter.next(); MetaContact actualResult = fixture.metaClService .findMetaContactByMetaUID(expectedContact.getMetaUID()); @@ -257,13 +255,13 @@ public class TestMetaContactList // get one of the subgroups, extract one of its child contacts and // repeat the same test. - Iterator subgroupsIter = root.getSubgroups(); + Iterator<MetaContactGroup> subgroupsIter = root.getSubgroups(); assertTrue( "No sub groups were found in the meta contact list" , subgroupsIter.hasNext()); - MetaContactGroup subgroup = (MetaContactGroup)subgroupsIter.next(); + MetaContactGroup subgroup = subgroupsIter.next(); contactsIter = subgroup.getChildContacts(); @@ -272,7 +270,7 @@ public class TestMetaContactList + subgroup.getGroupName() , contactsIter.hasNext()); - expectedContact = (MetaContact)contactsIter.next(); + expectedContact = contactsIter.next(); actualResult = fixture.metaClService .findMetaContactByMetaUID(expectedContact.getMetaUID()); @@ -294,13 +292,13 @@ public class TestMetaContactList //get a top level contact and then try to find it through the tested //findMetaContactByContact method. - Iterator contactsIter = root.getChildContacts(); + Iterator<MetaContact> contactsIter = root.getChildContacts(); assertTrue( "No contacts were found in the meta contact list" , contactsIter.hasNext()); - MetaContact expectedMetaContact = (MetaContact)contactsIter.next(); + MetaContact expectedMetaContact = contactsIter.next(); assertTrue( "No contacts are encapsulated by MetaContact: " @@ -308,7 +306,7 @@ public class TestMetaContactList , expectedMetaContact.getContacts().hasNext()); - Contact mockContact = (Contact)expectedMetaContact.getContacts().next(); + Contact mockContact = expectedMetaContact.getContacts().next(); MetaContact actualResult = fixture.metaClService .findMetaContactByContact(mockContact); @@ -318,13 +316,13 @@ public class TestMetaContactList // get one of the subgroups, extract one of its child contacts and // repeat the same test. - Iterator subgroupsIter = root.getSubgroups(); + Iterator<MetaContactGroup> subgroupsIter = root.getSubgroups(); assertTrue( "No sub groups were found in the meta contact list" , subgroupsIter.hasNext()); - MetaContactGroup subgroup = (MetaContactGroup)subgroupsIter.next(); + MetaContactGroup subgroup = subgroupsIter.next(); contactsIter = subgroup.getChildContacts(); @@ -334,7 +332,7 @@ public class TestMetaContactList , contactsIter.hasNext()); - expectedMetaContact = (MetaContact)contactsIter.next(); + expectedMetaContact = contactsIter.next(); assertTrue( "No contacts were encapsulated by meta contact: " @@ -342,7 +340,7 @@ public class TestMetaContactList , expectedMetaContact.getContacts().hasNext()); - mockContact = (Contact)expectedMetaContact.getContacts().next(); + mockContact = expectedMetaContact.getContacts().next(); actualResult = fixture.metaClService .findMetaContactByContact(mockContact); @@ -367,14 +365,13 @@ public class TestMetaContactList //get a group, extract its proto group and then try to obtain a //reference through the tested find method. - Iterator groupsIter = root.getSubgroups(); + Iterator<MetaContactGroup> groupsIter = root.getSubgroups(); assertTrue( "No sub groups were found in the meta contact list" , groupsIter.hasNext()); - MetaContactGroup expectedMetaContactGroup - = (MetaContactGroup)groupsIter.next(); + MetaContactGroup expectedMetaContactGroup = groupsIter.next(); assertTrue( "There were no contact groups encapsulated in MetaContactGroup: " @@ -386,7 +383,7 @@ public class TestMetaContactList + expectedMetaContactGroup , expectedMetaContactGroup.getContactGroups().hasNext()); - ContactGroup mockContactGroup = (ContactGroup)expectedMetaContactGroup + ContactGroup mockContactGroup = expectedMetaContactGroup .getContactGroups().next(); MetaContactGroup actualMetaContactGroup = fixture.metaClService .findMetaContactGroupByContactGroup(mockContactGroup); @@ -502,11 +499,10 @@ public class TestMetaContactList newContactGroup.addSubgroup(newInnerContactGroup); fixture.metaClService.addMetaContactListListener(mclEvtCollector); - ((MockPersistentPresenceOperationSet)fixture.mockPresOpSet) - .addMockGroupAndFireEvent( - (MockContactGroup)fixture.mockPresOpSet - .getServerStoredContactListRoot() - , newContactGroup); + fixture.mockPresOpSet.addMockGroupAndFireEvent( + (MockContactGroup) + fixture.mockPresOpSet.getServerStoredContactListRoot(), + newContactGroup); fixture.metaClService.removeMetaContactListListener(mclEvtCollector); @@ -585,7 +581,7 @@ public class TestMetaContactList , fixture.mockProvider, evt.getSourceProvider()); //check whether the group was indeed renamed. - Iterator groupsIter = evt.getSourceMetaContactGroup() + Iterator<ContactGroup> groupsIter = evt.getSourceMetaContactGroup() .getContactGroupsForProvider(fixture.mockProvider); assertTrue("A proto group was unexplicably removed after renaming.", @@ -593,7 +589,7 @@ public class TestMetaContactList assertEquals("The name of a protocol group after renaming." , renamedGroupName - , ((MockContactGroup)groupsIter.next()).getGroupName()); + , groupsIter.next().getGroupName()); //remove the group and check for the event. fixture.metaClService.addMetaContactListListener(mclEvtCollector); @@ -765,8 +761,6 @@ public class TestMetaContactList assertEquals ( "Event ID in ProtoContactEvent gen. upon remove." , ProtoContactEvent.PROTO_CONTACT_REMOVED , event.getPropertyName()); - - } /** @@ -904,7 +898,6 @@ public class TestMetaContactList assertEquals ( "Event ID in MetaContactEvent gen. upon remove." , MetaContactEvent.META_CONTACT_REMOVED , event.getEventID()); - } /** @@ -1104,8 +1097,8 @@ public class TestMetaContactList private class MclEventCollector implements MetaContactListListener { - public Vector collectedMetaContactEvents = new Vector(); - public Vector collectedMetaContactGroupEvents = new Vector(); + public Vector<EventObject> collectedMetaContactEvents = new Vector<EventObject>(); + public Vector<EventObject> collectedMetaContactGroupEvents = new Vector<EventObject>(); /** * Indicates that a MetaContact has been successfully added diff --git a/test/net/java/sip/communicator/slick/fileaccess/FileAccessServiceLick.java b/test/net/java/sip/communicator/slick/fileaccess/FileAccessServiceLick.java index 906c9e2..14220b1 100644 --- a/test/net/java/sip/communicator/slick/fileaccess/FileAccessServiceLick.java +++ b/test/net/java/sip/communicator/slick/fileaccess/FileAccessServiceLick.java @@ -35,7 +35,7 @@ public class FileAccessServiceLick extends TestSuite implements BundleActivator { FileAccessServiceLick.bc = bundleContext; setName("FileAccessServiceLick"); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put("service.pid", getName()); addTestSuite(TestFileAccessService.class); diff --git a/test/net/java/sip/communicator/slick/history/HistoryServiceLick.java b/test/net/java/sip/communicator/slick/history/HistoryServiceLick.java index f50581b..b05594d 100644 --- a/test/net/java/sip/communicator/slick/history/HistoryServiceLick.java +++ b/test/net/java/sip/communicator/slick/history/HistoryServiceLick.java @@ -36,7 +36,7 @@ public class HistoryServiceLick extends TestSuite implements BundleActivator { HistoryServiceLick.bc = bundleContext; setName("HistoryServiceLick"); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put("service.pid", getName()); addTest(TestHistoryService.suite()); diff --git a/test/net/java/sip/communicator/slick/history/TestHistoryService.java b/test/net/java/sip/communicator/slick/history/TestHistoryService.java index f828a82..27df950 100644 --- a/test/net/java/sip/communicator/slick/history/TestHistoryService.java +++ b/test/net/java/sip/communicator/slick/history/TestHistoryService.java @@ -82,12 +82,12 @@ public class TestHistoryService extends TestCase { public void testCreateDB() { - ArrayList al = new ArrayList(); + ArrayList<String> al = new ArrayList<String>(); - Iterator i = this.historyService.getExistingIDs(); + Iterator<HistoryID> i = this.historyService.getExistingIDs(); while (i.hasNext()) { - HistoryID id = (HistoryID) i.next(); + HistoryID id = i.next(); String[] components = id.getID(); if (components.length == 2 && "test".equals(components[0])) diff --git a/test/net/java/sip/communicator/slick/media/MediaServiceLick.java b/test/net/java/sip/communicator/slick/media/MediaServiceLick.java index 9db93db..a531008 100644 --- a/test/net/java/sip/communicator/slick/media/MediaServiceLick.java +++ b/test/net/java/sip/communicator/slick/media/MediaServiceLick.java @@ -42,7 +42,7 @@ public class MediaServiceLick { MediaServiceLick.bc = bundleContext; setName("MediaServiceLick"); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put("service.pid", getName()); // disable video support when testing diff --git a/test/net/java/sip/communicator/slick/metahistory/MetaHistoryServiceLick.java b/test/net/java/sip/communicator/slick/metahistory/MetaHistoryServiceLick.java index 7b1d148..63423e6 100644 --- a/test/net/java/sip/communicator/slick/metahistory/MetaHistoryServiceLick.java +++ b/test/net/java/sip/communicator/slick/metahistory/MetaHistoryServiceLick.java @@ -37,7 +37,7 @@ public class MetaHistoryServiceLick MetaHistoryServiceLick.bc = bundleContext; setName("MetaHistoryServiceSLick"); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put("service.pid", getName()); addTest(TestMetaHistoryService.suite()); diff --git a/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java b/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java index de7ffd3..f2d5e30 100644 --- a/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java +++ b/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java @@ -80,7 +80,7 @@ public class TestMetaHistoryService /** * The addresses will be used in the generated mock calls */ - private static Vector participantAddresses = new Vector(); + private static Vector<String> participantAddresses = new Vector<String>(); /** * Files to receive @@ -172,7 +172,7 @@ public class TestMetaHistoryService System.setProperty(MetaContactListService.PROVIDER_MASK_PROPERTY, "1"); - Hashtable mockProvProperties = new Hashtable(); + Hashtable<String, String> mockProvProperties = new Hashtable<String, String>(); mockProvProperties.put(ProtocolProviderFactory.PROTOCOL , mockProvider.getProtocolName()); mockProvProperties.put(MetaContactListService.PROVIDER_MASK_PROPERTY, @@ -241,8 +241,8 @@ public class TestMetaHistoryService mockFTOpSet.receiveFile(files[1], testContact); mockFTOpSet.removeFileTransferListener(tl); - generateCall((String)participantAddresses.get(0)); - generateCall((String)participantAddresses.get(1)); + generateCall(participantAddresses.get(0)); + generateCall(participantAddresses.get(1)); mockBImOpSet.deliverMessage(TEST_CONTACT_NAME_1, messagesToSend[0]); mockBImOpSet.deliverMessage(TEST_CONTACT_NAME_2, messagesToSend[1]); @@ -250,8 +250,8 @@ public class TestMetaHistoryService waitSeconds(200); - generateCall((String)participantAddresses.get(2)); - generateCall((String)participantAddresses.get(3)); + generateCall(participantAddresses.get(2)); + generateCall(participantAddresses.get(3)); mockBImOpSet.deliverMessage(TEST_CONTACT_NAME_1, messagesToSend[2]); mockBImOpSet.deliverMessage(TEST_CONTACT_NAME_2, messagesToSend[3]); // finish an out file transfer @@ -266,8 +266,8 @@ public class TestMetaHistoryService controlDate2 = new Date(); waitSeconds(200); - generateCall((String)participantAddresses.get(4)); - generateCall((String)participantAddresses.get(5)); + generateCall(participantAddresses.get(4)); + generateCall(participantAddresses.get(5)); // finish an out file transfer ft = mockFTOpSet.sendFile(testContact, files[4]); mockFTOpSet.changeFileTransferStatus(ft, FileTransferStatusChangeEvent.REFUSED); @@ -286,12 +286,12 @@ public class TestMetaHistoryService { Call newCall = mockBTelphonyOpSet.placeCall(participant); - Vector v = new Vector(); + Vector<CallPeer> v = new Vector<CallPeer>(); - Iterator iter = newCall.getCallPeers(); + Iterator<CallPeer> iter = newCall.getCallPeers(); while (iter.hasNext()) { - CallPeer item = (CallPeer) iter.next(); + CallPeer item = iter.next(); v.add(item); } @@ -337,7 +337,7 @@ public class TestMetaHistoryService assertTrue("Nothing found findByKeyword ", !rs.isEmpty()); - Vector msgs = getMessages(rs); + List<String> msgs = getMessages(rs); assertTrue("Messages too few - findByKeyword", msgs.size() >= 5); @@ -523,15 +523,14 @@ public class TestMetaHistoryService assertEquals("Calls must be 2", rs.size(), 2); CallRecord rec = (CallRecord)resultIter.next(); - CallPeerRecord participant = - (CallPeerRecord)rec.getPeerRecords().get(0); + CallPeerRecord participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). equals(participantAddresses.get(2))); rec = (CallRecord)resultIter.next(); - participant = (CallPeerRecord)rec.getPeerRecords().get(0); + participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). @@ -549,14 +548,14 @@ public class TestMetaHistoryService assertEquals("Calls must be 2", rs.size(), 2); rec = (CallRecord)resultIter.next(); - participant = (CallPeerRecord)rec.getPeerRecords().get(0); + participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). equals(participantAddresses.get(4))); rec = (CallRecord)resultIter.next(); - participant = (CallPeerRecord)rec.getPeerRecords().get(0); + participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). @@ -574,21 +573,21 @@ public class TestMetaHistoryService assertEquals("Calls must be 3", rs.size(), 3); rec = (CallRecord)resultIter.next(); - participant = (CallPeerRecord) rec.getPeerRecords().get(0); + participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). equals(participantAddresses.get(3))); rec = (CallRecord)resultIter.next(); - participant = (CallPeerRecord) rec.getPeerRecords().get(0); + participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). equals(participantAddresses.get(4))); rec = (CallRecord)resultIter.next(); - participant = (CallPeerRecord) rec.getPeerRecords().get(0); + participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). @@ -600,7 +599,7 @@ public class TestMetaHistoryService /** * must find 4 results. */ - Collection rs = + Collection<FileRecord> rs = getFileRecords( metaHistoryService.findByStartDate( new String[]{FileHistoryService.class.getName()}, @@ -620,12 +619,12 @@ public class TestMetaHistoryService testMetaContact, controlDate1, controlDate2)); assertEquals("Filetransfers must be 2", rs.size(), 2); - Iterator it = rs.iterator(); + Iterator<FileRecord> it = rs.iterator(); assertTrue("Filetransfers not found", - ((FileRecord)it.next()).getFile().getName(). + it.next().getFile().getName(). equals(files[2].getName())); assertTrue("Filetransfers not found", - ((FileRecord)it.next()).getFile().getName(). + it.next().getFile().getName(). equals(files[3].getName())); rs = getFileRecords( @@ -637,7 +636,7 @@ public class TestMetaHistoryService it = rs.iterator(); assertTrue("Filetransfers not found", - ((FileRecord)it.next()).getFile().getName(). + it.next().getFile().getName(). equals(files[2].getName())); rs = getFileRecords( @@ -654,7 +653,7 @@ public class TestMetaHistoryService assertEquals("Filetransfers must be 2", rs.size(), 2); it = rs.iterator(); - FileRecord fr = (FileRecord)it.next(); + FileRecord fr = it.next(); assertTrue("Filetransfers not found", fr.getFile().getName(). equals(files[4].getName())); @@ -666,7 +665,7 @@ public class TestMetaHistoryService fr.getDirection(). equalsIgnoreCase("out")); - fr = (FileRecord)it.next(); + fr = it.next(); assertTrue("Filetransfers not found", fr.getFile().getName(). equals(files[5].getName())); @@ -686,7 +685,7 @@ public class TestMetaHistoryService it = rs.iterator(); assertTrue("Filetransfers not found", - ((FileRecord)it.next()).getFile().getName(). + it.next().getFile().getName(). equals(files[2].getName())); rs = getFileRecords( @@ -724,7 +723,7 @@ public class TestMetaHistoryService assertEquals("Filetransfers must be 2", rs.size(), 2); it = rs.iterator(); - fr = (FileRecord)it.next(); + fr = it.next(); assertTrue("Filetransfers not found", fr.getFile().getName(). equals(files[2].getName())); @@ -735,7 +734,7 @@ public class TestMetaHistoryService fr.getDirection(). equalsIgnoreCase("out")); - fr = (FileRecord)it.next(); + fr = it.next(); assertTrue("Filetransfers not found", fr.getFile().getName(). equals(files[3].getName())); @@ -755,7 +754,7 @@ public class TestMetaHistoryService assertEquals("Filetransfers must be 2", rs.size(), 2); it = rs.iterator(); - fr = (FileRecord)it.next(); + fr = it.next(); assertTrue("Filetransfers not found", fr.getFile().getName(). equals(files[0].getName())); @@ -766,7 +765,7 @@ public class TestMetaHistoryService fr.getDirection(). equalsIgnoreCase("out")); - fr = (FileRecord)it.next(); + fr = it.next(); assertTrue("Filetransfers not found", fr.getFile().getName(). equals(files[1].getName())); @@ -919,46 +918,45 @@ public class TestMetaHistoryService metaClService.purgeLocallyStoredContactListCopy(); } - private Vector getMessages(Collection rs) + private List<String> getMessages(Collection rs) { - Vector result = new Vector(); + List<String> result = new Vector<String>(); Iterator iter = rs.iterator(); while (iter.hasNext()) { Object item = iter.next(); if(item instanceof MessageDeliveredEvent) result.add(((MessageDeliveredEvent)item).getSourceMessage().getContent()); - else - if(item instanceof MessageReceivedEvent) - result.add(((MessageReceivedEvent)item).getSourceMessage().getContent()); + else if(item instanceof MessageReceivedEvent) + result.add(((MessageReceivedEvent)item).getSourceMessage().getContent()); } return result; } - private Vector getCalls(Collection rs) + private List<CallRecord> getCalls(Collection rs) { - Vector result = new Vector(); + List<CallRecord> result = new Vector<CallRecord>(); Iterator iter = rs.iterator(); while (iter.hasNext()) { Object item = iter.next(); if(item instanceof CallRecord) - result.add(item); + result.add((CallRecord) item); } return result; } - private Collection getFileRecords(Collection rs) + private Collection<FileRecord> getFileRecords(Collection rs) { - Vector result = new Vector(); + List<FileRecord> result = new Vector<FileRecord>(); Iterator iter = rs.iterator(); while (iter.hasNext()) { Object item = iter.next(); if(item instanceof FileRecord) - result.add(item); + result.add((FileRecord) item); } return result; diff --git a/test/net/java/sip/communicator/slick/msghistory/MsgHistoryServiceLick.java b/test/net/java/sip/communicator/slick/msghistory/MsgHistoryServiceLick.java index aac1431..536576c 100644 --- a/test/net/java/sip/communicator/slick/msghistory/MsgHistoryServiceLick.java +++ b/test/net/java/sip/communicator/slick/msghistory/MsgHistoryServiceLick.java @@ -34,7 +34,7 @@ public class MsgHistoryServiceLick extends TestSuite implements BundleActivator MsgHistoryServiceLick.bc = bundleContext; setName("MsgHistoryServiceLick"); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put("service.pid", getName()); addTest(TestMsgHistoryService.suite()); diff --git a/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java b/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java index 0a8f461..e23ffaf 100644 --- a/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java +++ b/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java @@ -150,7 +150,7 @@ public class TestMsgHistoryService System.setProperty(MetaContactListService.PROVIDER_MASK_PROPERTY, "1"); - Hashtable mockProvProperties = new Hashtable(); + Hashtable<String, String> mockProvProperties = new Hashtable<String, String>(); mockProvProperties.put(ProtocolProviderFactory.PROTOCOL , mockProvider.getProtocolName()); mockProvProperties.put(MetaContactListService.PROVIDER_MASK_PROPERTY, @@ -245,12 +245,12 @@ public class TestMsgHistoryService assertTrue("Nothing found findByKeyword ", !rs.isEmpty()); - Vector msgs = getMessages(rs); + List<String> msgs = getMessages(rs); assertTrue("Messages too few - findByKeyword", msgs.size() >= 5); /** - * Will test case sernsitive and insensitive search + * Will test case sensitive and insensitive search */ rs = msgHistoryService.findByKeyword(testMetaContact, "Test", false); @@ -470,12 +470,12 @@ public class TestMsgHistoryService assertTrue("Nothing found findByKeyword ", !rs.isEmpty()); - Vector msgs = getChatMessages(rs); + List<String> msgs = getChatMessages(rs); assertTrue("Messages too few - findByKeyword", msgs.size() >= 5); /** - * Will test case sernsitive and insensitive search + * Will test case sensitive and insensitive search */ rs = msgHistoryService.findByKeyword(room, "Test", false); @@ -620,9 +620,9 @@ public class TestMsgHistoryService metaClService.purgeLocallyStoredContactListCopy(); } - private Vector getMessages(Collection rs) + private List<String> getMessages(Collection rs) { - Vector result = new Vector(); + List<String> result = new Vector<String>(); Iterator iter = rs.iterator(); while (iter.hasNext()) { @@ -637,9 +637,9 @@ public class TestMsgHistoryService return result; } - private Vector getChatMessages(Collection rs) + private List<String> getChatMessages(Collection rs) { - Vector result = new Vector(); + List<String> result = new Vector<String>(); Iterator iter = rs.iterator(); while (iter.hasNext()) { diff --git a/test/net/java/sip/communicator/slick/netaddr/NetworkAddressManagerServiceLick.java b/test/net/java/sip/communicator/slick/netaddr/NetworkAddressManagerServiceLick.java index 901fa15..21e9d74 100644 --- a/test/net/java/sip/communicator/slick/netaddr/NetworkAddressManagerServiceLick.java +++ b/test/net/java/sip/communicator/slick/netaddr/NetworkAddressManagerServiceLick.java @@ -35,7 +35,7 @@ public class NetworkAddressManagerServiceLick { this.bc = bundleContext; setName("NetworkAddressManagerServiceLick"); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put("service.pid", getName()); // addTestSuite(TestNetworkAddressManagerService.class); diff --git a/test/net/java/sip/communicator/slick/popupmessagehandler/PopupMessageHandlerSLick.java b/test/net/java/sip/communicator/slick/popupmessagehandler/PopupMessageHandlerSLick.java index b9ba24f..bef3f13 100644 --- a/test/net/java/sip/communicator/slick/popupmessagehandler/PopupMessageHandlerSLick.java +++ b/test/net/java/sip/communicator/slick/popupmessagehandler/PopupMessageHandlerSLick.java @@ -36,7 +36,7 @@ public class PopupMessageHandlerSLick extends TestSuite implements BundleActivat setName("PopupMessageHandlerSLick");
- Hashtable properties = new Hashtable();
+ Hashtable<String, String> properties = new Hashtable<String, String>();
properties.put("service.pid", getName());
diff --git a/test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetFileTransfer.java b/test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetFileTransfer.java index 5b797d0..ca30998 100644 --- a/test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetFileTransfer.java +++ b/test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetFileTransfer.java @@ -126,7 +126,7 @@ public abstract class TestOperationSetFileTransfer , 1, senderStatusListener.collectedEvents.size()); FileTransferStatusChangeEvent fileTransferStatusEvent - = (FileTransferStatusChangeEvent)senderStatusListener.collectedEvents.get(0); + = senderStatusListener.collectedEvents.get(0); assertEquals("Event must be preparing" ,FileTransferStatusChangeEvent.PREPARING @@ -178,21 +178,21 @@ public abstract class TestOperationSetFileTransfer , 3, receiverStatusListener.collectedEvents.size()); fileTransferStatusEvent - = (FileTransferStatusChangeEvent)receiverStatusListener.collectedEvents.get(0); + = receiverStatusListener.collectedEvents.get(0); assertEquals("Event must be preparing" ,FileTransferStatusChangeEvent.PREPARING ,fileTransferStatusEvent.getNewStatus()); fileTransferStatusEvent - = (FileTransferStatusChangeEvent)receiverStatusListener.collectedEvents.get(1); + = receiverStatusListener.collectedEvents.get(1); assertEquals("Event must be completed" ,FileTransferStatusChangeEvent.IN_PROGRESS ,fileTransferStatusEvent.getNewStatus()); fileTransferStatusEvent - = (FileTransferStatusChangeEvent)receiverStatusListener.collectedEvents.get(2); + = receiverStatusListener.collectedEvents.get(2); assertEquals("Event must be completed" ,FileTransferStatusChangeEvent.COMPLETED @@ -258,7 +258,7 @@ public abstract class TestOperationSetFileTransfer , 1, senderStatusListener.collectedEvents.size()); FileTransferStatusChangeEvent fileTransferStatusEvent - = (FileTransferStatusChangeEvent)senderStatusListener.collectedEvents.get(0); + = senderStatusListener.collectedEvents.get(0); assertEquals("Event must be preparing" ,FileTransferStatusChangeEvent.PREPARING @@ -298,7 +298,7 @@ public abstract class TestOperationSetFileTransfer , 1, senderStatusListener.collectedEvents.size()); fileTransferStatusEvent - = (FileTransferStatusChangeEvent)senderStatusListener.collectedEvents.get(0); + = senderStatusListener.collectedEvents.get(0); assertEquals("Event must be canceled" ,FileTransferStatusChangeEvent.CANCELED @@ -368,7 +368,7 @@ public abstract class TestOperationSetFileTransfer , 1, senderStatusListener.collectedEvents.size()); FileTransferStatusChangeEvent fileTransferStatusEvent - = (FileTransferStatusChangeEvent)senderStatusListener.collectedEvents.get(0); + = senderStatusListener.collectedEvents.get(0); assertEquals("Event must be preparing" ,FileTransferStatusChangeEvent.PREPARING @@ -417,7 +417,7 @@ public abstract class TestOperationSetFileTransfer , 1, senderStatusListener.collectedEvents.size()); fileTransferStatusEvent - = (FileTransferStatusChangeEvent)senderStatusListener.collectedEvents.get(0); + = senderStatusListener.collectedEvents.get(0); assertEquals("Event must be refused" ,FileTransferStatusChangeEvent.REFUSED @@ -482,7 +482,7 @@ public abstract class TestOperationSetFileTransfer , 1, senderStatusListener.collectedEvents.size()); FileTransferStatusChangeEvent fileTransferStatusEvent - = (FileTransferStatusChangeEvent)senderStatusListener.collectedEvents.get(0); + = senderStatusListener.collectedEvents.get(0); assertEquals("Event must be preparing" ,FileTransferStatusChangeEvent.PREPARING @@ -625,7 +625,7 @@ public abstract class TestOperationSetFileTransfer , 1, senderStatusListener.collectedEvents.size()); FileTransferStatusChangeEvent fileTransferStatusEvent - = (FileTransferStatusChangeEvent)senderStatusListener.collectedEvents.get(0); + = senderStatusListener.collectedEvents.get(0); assertEquals("Event must be preparing" ,FileTransferStatusChangeEvent.PREPARING @@ -740,7 +740,9 @@ public abstract class TestOperationSetFileTransfer public class FileTransferEventCollector implements FileTransferListener { - public ArrayList collectedEvents = new ArrayList(); + public final List<EventObject> collectedEvents + = new ArrayList<EventObject>(); + private boolean rejected = false; private boolean canceled = false; private FileTransferStatusEventCollector statusCollector = null; diff --git a/test/net/java/sip/communicator/slick/protocol/gibberish/GibberishProtocolProviderServiceLick.java b/test/net/java/sip/communicator/slick/protocol/gibberish/GibberishProtocolProviderServiceLick.java index 657c0ce..67703b8 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/GibberishProtocolProviderServiceLick.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/GibberishProtocolProviderServiceLick.java @@ -61,7 +61,7 @@ public class GibberishProtocolProviderServiceLick { setName("GibberishProtocolProviderServiceLick"); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put("service.pid", getName()); GibberishSlickFixture.bc = context; diff --git a/test/net/java/sip/communicator/slick/protocol/gibberish/GibberishSlickFixture.java b/test/net/java/sip/communicator/slick/protocol/gibberish/GibberishSlickFixture.java index fc970b5..2f838a3 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/GibberishSlickFixture.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/GibberishSlickFixture.java @@ -84,7 +84,7 @@ public class GibberishSlickFixture * and initialise the ss contact list before the tested implementation has * actually done so. */ - public static Hashtable preInstalledBuddyList = null; + public static Hashtable<String, List<String>> preInstalledBuddyList = null; /** @@ -264,8 +264,8 @@ public class GibberishSlickFixture ContactGroup rootGroup1 = opSetPersPresence1.getServerStoredContactListRoot(); // first delete the groups - Vector groupsToRemove = new Vector(); - Iterator iter = rootGroup1.subgroups(); + Vector<ContactGroup> groupsToRemove = new Vector<ContactGroup>(); + Iterator<ContactGroup> iter = rootGroup1.subgroups(); while (iter.hasNext()) { groupsToRemove.add(iter.next()); @@ -274,27 +274,27 @@ public class GibberishSlickFixture iter = groupsToRemove.iterator(); while (iter.hasNext()) { - ContactGroup item = (ContactGroup) iter.next(); + ContactGroup item = iter.next(); opSetPersPresence1.removeServerStoredContactGroup(item); } //then delete contacts if any in root list - Vector contactsToRemove = new Vector(); - iter = rootGroup1.contacts(); - while (iter.hasNext()) + Vector<Contact> contactsToRemove = new Vector<Contact>(); + Iterator<Contact> iter2 = rootGroup1.contacts(); + while (iter2.hasNext()) { - contactsToRemove.add(iter.next()); + contactsToRemove.add(iter2.next()); } - iter = contactsToRemove.iterator(); - while (iter.hasNext()) + iter2 = contactsToRemove.iterator(); + while (iter2.hasNext()) { - opSetPersPresence1.unsubscribe((Contact)iter.next()); + opSetPersPresence1.unsubscribe(iter2.next()); } ContactGroup rootGroup2 = opSetPersPresence2.getServerStoredContactListRoot(); // delete groups - groupsToRemove = new Vector(); + groupsToRemove = new Vector<ContactGroup>(); iter = rootGroup2.subgroups(); while (iter.hasNext()) { @@ -304,21 +304,21 @@ public class GibberishSlickFixture iter = groupsToRemove.iterator(); while (iter.hasNext()) { - ContactGroup item = (ContactGroup) iter.next(); + ContactGroup item = iter.next(); opSetPersPresence2.removeServerStoredContactGroup(item); } //then delete contacts if any in root list - contactsToRemove = new Vector(); - iter = rootGroup2.contacts(); - while (iter.hasNext()) + contactsToRemove = new Vector<Contact>(); + iter2 = rootGroup2.contacts(); + while (iter2.hasNext()) { - contactsToRemove.add(iter.next()); + contactsToRemove.add(iter2.next()); } - iter = contactsToRemove.iterator(); - while (iter.hasNext()) + iter2 = contactsToRemove.iterator(); + while (iter2.hasNext()) { - opSetPersPresence2.unsubscribe( (Contact) iter.next()); + opSetPersPresence2.unsubscribe(iter2.next()); } } } diff --git a/test/net/java/sip/communicator/slick/protocol/gibberish/TestAccountInstallation.java b/test/net/java/sip/communicator/slick/protocol/gibberish/TestAccountInstallation.java index c0c2388..e3d95a9 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/TestAccountInstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/TestAccountInstallation.java @@ -84,9 +84,9 @@ public class TestAccountInstallation //Prepare the properties of the first gibberish account. - Hashtable gibberishAccount1Properties = getAccountProperties( + Hashtable<String, String> gibberishAccount1Properties = getAccountProperties( GibberishProtocolProviderServiceLick.ACCOUNT_1_PREFIX); - Hashtable gibberishAccount2Properties = getAccountProperties( + Hashtable<String, String> gibberishAccount2Properties = getAccountProperties( GibberishProtocolProviderServiceLick.ACCOUNT_2_PREFIX); //try to install an account with a null account id @@ -102,10 +102,10 @@ public class TestAccountInstallation //now really install the accounts gibberishProviderFactory.installAccount( - (String)gibberishAccount1Properties.get(ProtocolProviderFactory.USER_ID) + gibberishAccount1Properties.get(ProtocolProviderFactory.USER_ID) , gibberishAccount1Properties); gibberishProviderFactory.installAccount( - (String)gibberishAccount2Properties.get(ProtocolProviderFactory.USER_ID) + gibberishAccount2Properties.get(ProtocolProviderFactory.USER_ID) , gibberishAccount2Properties); @@ -113,7 +113,7 @@ public class TestAccountInstallation //excepion is thrown. try{ gibberishProviderFactory.installAccount( - (String)gibberishAccount1Properties.get(ProtocolProviderFactory.USER_ID) + gibberishAccount1Properties.get(ProtocolProviderFactory.USER_ID) , gibberishAccount1Properties); fail("An IllegalStateException must be thrown when trying to "+ @@ -136,7 +136,7 @@ public class TestAccountInstallation osgiFilter = "(&("+ProtocolProviderFactory.PROTOCOL +"=Gibberish)" +"(" + ProtocolProviderFactory.USER_ID - + "=" + (String)gibberishAccount1Properties.get( + + "=" + gibberishAccount1Properties.get( ProtocolProviderFactory.USER_ID) + "))"; @@ -172,9 +172,9 @@ public class TestAccountInstallation * @return a Hashtable that can be used when creating the account in a * protocol provider factory. */ - private Hashtable getAccountProperties(String accountPrefix) + private Hashtable<String, String> getAccountProperties(String accountPrefix) { - Hashtable table = new Hashtable(); + Hashtable<String, String> table = new Hashtable<String, String>(); String userID = System.getProperty( accountPrefix + ProtocolProviderFactory.USER_ID, null); diff --git a/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetBasicInstantMessaging.java b/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetBasicInstantMessaging.java index 2b45377..7411f22 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetBasicInstantMessaging.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetBasicInstantMessaging.java @@ -398,7 +398,7 @@ public class TestOperationSetBasicInstantMessaging */ private class ImEventCollector implements MessageListener { - private List collectedEvents = new LinkedList(); + private List<EventObject> collectedEvents = new LinkedList<EventObject>(); /** * Called when a new incoming <tt>Message</tt> has been received. * @param evt the <tt>MessageReceivedEvent</tt> containing the newly diff --git a/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetPersistentPresence.java b/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetPersistentPresence.java index cf1009f..b1a86de 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetPersistentPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetPersistentPresence.java @@ -143,7 +143,8 @@ public class TestOperationSetPersistentPresence + "rootGroup.childGroups="+rootGroup.countSubgroups() + "Printing rootGroupContents=\n"+rootGroup.toString()); - Hashtable expectedContactList = fixture.preInstalledBuddyList; + Hashtable<String, List<String>> expectedContactList + = fixture.preInstalledBuddyList; logger.debug("============== Expected Contact List ==================="); logger.debug(expectedContactList); @@ -151,17 +152,17 @@ public class TestOperationSetPersistentPresence //Go through the contact list retrieved by the persistence presence set //and remove the name of every contact and group that we find there from //the expected contct list hashtable. - Iterator groups = rootGroup.subgroups(); + Iterator<ContactGroup> groups = rootGroup.subgroups(); while (groups.hasNext() ) { - ContactGroup group = (ContactGroup)groups.next(); + ContactGroup group = groups.next(); - List expectedContactsInGroup - = (List)expectedContactList.get(group.getGroupName()); + List<String> expectedContactsInGroup + = expectedContactList.get(group.getGroupName()); // When sending the offline message // the sever creates a group NotInContactList, - // beacuse the buddy we are sending message to is not in + // because the buddy we are sending message to is not in // the contactlist. So this group must be ignored if(!group.getGroupName().equals("NotInContactList")) { @@ -171,11 +172,10 @@ public class TestOperationSetPersistentPresence "the server but was not in the expected contact list." , expectedContactsInGroup); - Iterator contactsIter = group.contacts(); + Iterator<Contact> contactsIter = group.contacts(); while(contactsIter.hasNext()) { - String contactID = ((Contact)contactsIter.next()). - getAddress(); + String contactID = contactsIter.next().getAddress(); expectedContactsInGroup.remove(contactID); } @@ -390,7 +390,8 @@ public class TestOperationSetPersistentPresence logger.debug("tokens contained by the CL tokenized=" +tokenizer.countTokens()); - Hashtable contactListToCreate = new Hashtable(); + Hashtable<String, List<String>> contactListToCreate + = new Hashtable<String, List<String>>(); //go over all group.uin tokens while (tokenizer.hasMoreTokens()) @@ -416,10 +417,10 @@ public class TestOperationSetPersistentPresence } //check if we've already seen this group and if not - add it - List uinInThisGroup = (List)contactListToCreate.get(groupName); + List<String> uinInThisGroup = contactListToCreate.get(groupName); if (uinInThisGroup == null) { - uinInThisGroup = new ArrayList(); + uinInThisGroup = new ArrayList<String>(); contactListToCreate.put(groupName, uinInThisGroup); } @@ -427,12 +428,12 @@ public class TestOperationSetPersistentPresence } // now init the list - Enumeration newGroupsEnum = contactListToCreate.keys(); + Enumeration<String> newGroupsEnum = contactListToCreate.keys(); //go over all groups in the contactsToAdd table while (newGroupsEnum.hasMoreElements()) { - String groupName = (String) newGroupsEnum.nextElement(); + String groupName = newGroupsEnum.nextElement(); logger.debug("Will add group " + groupName); opSetPersPresence1.createServerStoredContactGroup( @@ -441,11 +442,11 @@ public class TestOperationSetPersistentPresence ContactGroup newlyCreatedGroup = opSetPersPresence1.getServerStoredContactListRoot().getGroup(groupName); - Iterator contactsToAddToThisGroup - = ( (List) contactListToCreate.get(groupName)).iterator(); + Iterator<String> contactsToAddToThisGroup + = contactListToCreate.get(groupName).iterator(); while (contactsToAddToThisGroup.hasNext()) { - String id = (String) contactsToAddToThisGroup.next(); + String id = contactsToAddToThisGroup.next(); logger.debug("Will add buddy " + id); opSetPersPresence1.subscribe(newlyCreatedGroup, id); @@ -462,7 +463,7 @@ public class TestOperationSetPersistentPresence */ private class GroupChangeCollector implements ServerStoredGroupListener { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); /** * Blocks until at least one event is received or until waitFor @@ -560,7 +561,7 @@ public class TestOperationSetPersistentPresence */ private class SubscriptionEventCollector implements SubscriptionListener { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); /** * Blocks until at least one event is received or until waitFor @@ -686,6 +687,5 @@ public class TestOperationSetPersistentPresence notifyAll(); } } - } } diff --git a/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetPresence.java b/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetPresence.java index ff11221..343a7e1 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetPresence.java @@ -153,14 +153,12 @@ public class TestOperationSetPresence { //first create a local list containing the presence status instances //supported by the underlying implementation. - Iterator supportedStatusSetIter = + Iterator<PresenceStatus> supportedStatusSetIter = operationSetPresence1.getSupportedStatusSet(); while (supportedStatusSetIter.hasNext()) { - PresenceStatus supportedStatus - = (PresenceStatus)supportedStatusSetIter.next(); - + PresenceStatus supportedStatus = supportedStatusSetIter.next(); logger.trace("Will test a transition to " + supportedStatus.getStatusName()); @@ -261,7 +259,7 @@ public class TestOperationSetPresence { try { - Thread.currentThread().sleep(1500); + Thread.sleep(1500); } catch (InterruptedException ex) { @@ -280,14 +278,11 @@ public class TestOperationSetPresence { //first create a local list containing the presence status instances //supported by the underlying implementation. - Iterator supportedStatusSetIter = - operationSetPresence1.getSupportedStatusSet(); + Iterator<PresenceStatus> supportedStatusSetIter = operationSetPresence1.getSupportedStatusSet(); while (supportedStatusSetIter.hasNext()) { - PresenceStatus supportedStatus - = (PresenceStatus)supportedStatusSetIter.next(); - + PresenceStatus supportedStatus = supportedStatusSetIter.next(); logger.trace("Will test a transition to " + supportedStatus.getStatusName()); @@ -601,13 +596,12 @@ public class TestOperationSetPresence PresenceStatus mostConnectedPresenceStatus = null; int mostConnectedPresenceStatusInt = Integer.MIN_VALUE; - Iterator supportedStatusSetIter = + Iterator<PresenceStatus> supportedStatusSetIter = operationSetPresence1.getSupportedStatusSet(); while (supportedStatusSetIter.hasNext()) { - PresenceStatus supportedStatus - = (PresenceStatus)supportedStatusSetIter.next(); + PresenceStatus supportedStatus = supportedStatusSetIter.next(); if(supportedStatus.getStatus() > mostConnectedPresenceStatusInt) { @@ -632,13 +626,12 @@ public class TestOperationSetPresence PresenceStatus leastConnectedPresenceStatus = null; int leastConnectedPresenceStatusInt = Integer.MAX_VALUE; - Iterator supportedStatusSetIter = + Iterator<PresenceStatus> supportedStatusSetIter = operationSetPresence1.getSupportedStatusSet(); while (supportedStatusSetIter.hasNext()) { - PresenceStatus supportedStatus - = (PresenceStatus)supportedStatusSetIter.next(); + PresenceStatus supportedStatus = supportedStatusSetIter.next(); if(supportedStatus.getStatus() < leastConnectedPresenceStatusInt && leastConnectedPresenceStatusInt @@ -660,8 +653,8 @@ public class TestOperationSetPresence private class PresenceStatusEventCollector implements ProviderPresenceStatusListener { - public ArrayList collectedPresEvents = new ArrayList(); - public ArrayList collectedStatMsgEvents = new ArrayList(); + public ArrayList<EventObject> collectedPresEvents = new ArrayList<EventObject>(); + public ArrayList<EventObject> collectedStatMsgEvents = new ArrayList<EventObject>(); public void providerStatusChanged(ProviderPresenceStatusChangeEvent evt) { @@ -755,7 +748,7 @@ public class TestOperationSetPresence */ private class SubscriptionEventCollector implements SubscriptionListener { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); /** * Blocks until at least one event is received or until waitFor @@ -882,7 +875,7 @@ public class TestOperationSetPresence private class ContactPresenceEventCollector implements ContactPresenceStatusListener { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); private String trackedScreenName = null; private PresenceStatus status = null; diff --git a/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetTypingNotifications.java b/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetTypingNotifications.java index f3db890..42883f2 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetTypingNotifications.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetTypingNotifications.java @@ -270,7 +270,7 @@ public class TestOperationSetTypingNotifications */ private class TypingEventCollector implements TypingNotificationsListener { - private List collectedEvents = new LinkedList(); + private List<EventObject> collectedEvents = new LinkedList<EventObject>(); /** * Called to indicate that a remote <tt>Contact</tt> has sent us a typing * notification. The method adds the <tt>event</tt> to the list of diff --git a/test/net/java/sip/communicator/slick/protocol/gibberish/TestProtocolProviderServiceGibberishImpl.java b/test/net/java/sip/communicator/slick/protocol/gibberish/TestProtocolProviderServiceGibberishImpl.java index 6c6b6b8..f388452 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/TestProtocolProviderServiceGibberishImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/TestProtocolProviderServiceGibberishImpl.java @@ -170,7 +170,7 @@ public class TestProtocolProviderServiceGibberishImpl public class RegistrationEventCollector implements RegistrationStateChangeListener { - public List collectedNewStates = new LinkedList(); + public List<RegistrationState> collectedNewStates = new LinkedList<RegistrationState>(); /** * The method would simply register all received events so that they diff --git a/test/net/java/sip/communicator/slick/protocol/icq/FullUserInfoCmd.java b/test/net/java/sip/communicator/slick/protocol/icq/FullUserInfoCmd.java index 051f0b4..22e3871 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/FullUserInfoCmd.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/FullUserInfoCmd.java @@ -35,7 +35,8 @@ public class FullUserInfoCmd boolean lastOfSequences = false; - private static Hashtable retreivedInfo = new Hashtable(); + private static Hashtable<Integer, Hashtable<String, Object>> retreivedInfo + = new Hashtable<Integer, Hashtable<String, Object>>(); // properties for the retreived info final static String LAST_NAME = "LastName"; @@ -162,9 +163,11 @@ public class FullUserInfoCmd * @param requestID int * @return Hashtable */ - private Hashtable getInfoForRequest(int requestID) + private Hashtable<String, Object> getInfoForRequest(int requestID) { - Hashtable res = (Hashtable) retreivedInfo.get(new Integer(requestID)); + Hashtable<String, Object> res + = (Hashtable<String, Object>) + retreivedInfo.get(new Integer(requestID)); if (res == null) { @@ -172,7 +175,7 @@ public class FullUserInfoCmd // doesn't exists, so this is the first packet // from the sequence (basic info) - res = new Hashtable(); + res = new Hashtable<String, Object>(); retreivedInfo.put(new Integer(requestID), res); } @@ -183,7 +186,7 @@ public class FullUserInfoCmd * Return the retreived info from the last received request * @return Hashtable */ - public Hashtable getInfo() + public Hashtable<String, Object> getInfo() { return getInfoForRequest(requestID); } @@ -196,7 +199,7 @@ public class FullUserInfoCmd */ private void readBasicUserInfo(ByteBlock block, int requestID) { - Hashtable infoData = getInfoForRequest(requestID); + Hashtable<String, Object> infoData = getInfoForRequest(requestID); // sequence of 11 String fields String bscInfo[] = new String[11]; @@ -247,7 +250,7 @@ public class FullUserInfoCmd */ private void readMoreUserInfo(ByteBlock block, int requestID) { - Hashtable infoData = getInfoForRequest(requestID); + Hashtable<String, Object> infoData = getInfoForRequest(requestID); int offset = 1; String[] tmp = new String[1]; diff --git a/test/net/java/sip/communicator/slick/protocol/icq/IcqProtocolProviderSlick.java b/test/net/java/sip/communicator/slick/protocol/icq/IcqProtocolProviderSlick.java index 2798a53..a22a409 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/IcqProtocolProviderSlick.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/IcqProtocolProviderSlick.java @@ -66,7 +66,7 @@ public class IcqProtocolProviderSlick public void start(BundleContext bundleContext) throws Exception { setName("IcqProtocolProviderSlick"); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put("service.pid", getName()); //store the bundle cache reference for usage by other others @@ -221,7 +221,8 @@ public class IcqProtocolProviderSlick logger.debug("tokens contained by the CL tokenized=" +tokenizer.countTokens()); - Hashtable contactListToCreate = new Hashtable(); + Hashtable<String, List<String>> contactListToCreate + = new Hashtable<String, List<String>>(); //go over all group.uin tokens while (tokenizer.hasMoreTokens()) @@ -247,10 +248,10 @@ public class IcqProtocolProviderSlick } //check if we've already seen this group and if not - add it - List uinInThisGroup = (List)contactListToCreate.get(groupName); + List<String> uinInThisGroup = contactListToCreate.get(groupName); if (uinInThisGroup == null) { - uinInThisGroup = new ArrayList(); + uinInThisGroup = new ArrayList<String>(); contactListToCreate.put(groupName, uinInThisGroup); } diff --git a/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java b/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java index e8e0497..605df86 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java @@ -152,32 +152,32 @@ public class IcqTesterAgent * lists of contact identifiers * (screennames). */ - public void initializeBuddyList(Hashtable listContents) + public void initializeBuddyList(Hashtable<String, List<String>> listContents) { logger.debug("Will Create the following contact list:\n"+ listContents); MutableBuddyList joustSimBuddyList - = (MutableBuddyList)conn.getSsiService().getBuddyList(); + = conn.getSsiService().getBuddyList(); //First empty the existing contact list. - List groups = joustSimBuddyList.getGroups(); + List<? extends Group> groups = joustSimBuddyList.getGroups(); - Iterator groupsIter = groups.iterator(); + Iterator<? extends Group> groupsIter = groups.iterator(); while (groupsIter.hasNext()) { - Group group = (Group)groupsIter.next(); + Group group = groupsIter.next(); joustSimBuddyList.deleteGroupAndBuddies(group); } //Now insert all items from the listContents hashtable if they're not //already there. - Enumeration newGroupsEnum = listContents.keys(); + Enumeration<String> newGroupsEnum = listContents.keys(); LayoutEventCollector evtCollector = new LayoutEventCollector(); //go over all groups in the contactsToAdd table while (newGroupsEnum.hasMoreElements()) { - String groupName = (String) newGroupsEnum.nextElement(); + String groupName = newGroupsEnum.nextElement(); logger.debug("Will add group " + groupName); //first clear any previously registered groups and then add the @@ -203,11 +203,11 @@ public class IcqTesterAgent throw new NullPointerException( "Couldn't create group " + groupName); - Iterator contactsToAddToThisGroup - = ( (List) listContents.get(groupName)).iterator(); + Iterator<String> contactsToAddToThisGroup + = listContents.get(groupName).iterator(); while (contactsToAddToThisGroup.hasNext()) { - String screenname = (String) contactsToAddToThisGroup.next(); + String screenname = contactsToAddToThisGroup.next(); //remove all buddies captured by the event collector so far //then register it as a listener @@ -340,15 +340,13 @@ public class IcqTesterAgent */ private Buddy findBuddyInBuddyList(BuddyList list, String screenname) { - Iterator groups = list.getGroups().iterator(); + Iterator<? extends Group> groups = list.getGroups().iterator(); while (groups.hasNext()) { - Group group = (Group) groups.next(); - List buddies = group.getBuddiesCopy(); - for (int i = 0; i < buddies.size(); i++) + Group group = groups.next(); + for (Buddy buddy : group.getBuddiesCopy()) { - Buddy buddy = (Buddy)buddies.get(i); if(buddy.getScreenname().getFormatted().equals(screenname)) return buddy; } @@ -526,7 +524,6 @@ public class IcqTesterAgent ran = true; } - Object value = null; if (snac instanceof UserInfoCmd) { UserInfoCmd uic = (UserInfoCmd) snac; @@ -544,18 +541,16 @@ public class IcqTesterAgent logger.debug("status is " + status +"=" + userInfo.getIcqStatus()); - List eInfoBlocks = userInfo.getExtraInfoBlocks(); + List<ExtraInfoBlock> eInfoBlocks + = userInfo.getExtraInfoBlocks(); if(eInfoBlocks != null){ System.out.println("printing extra info blocks (" + eInfoBlocks.size() + ")"); - for (int i = 0; i < eInfoBlocks.size(); i++) + for (ExtraInfoBlock block : eInfoBlocks) { - ExtraInfoBlock block - = (ExtraInfoBlock) eInfoBlocks.get(i); - System.out.println("block.toString()=" - + block.toString()); ; - + System.out.println( + "block.toString()=" + block.toString()); } } else @@ -700,8 +695,8 @@ public class IcqTesterAgent private class LayoutEventCollector implements BuddyListLayoutListener { - public Vector addedGroups = new Vector(); - public Vector addedBuddies = new Vector(); + public Vector<Group> addedGroups = new Vector<Group>(); + public Vector<Buddy> addedBuddies = new Vector<Buddy>(); public Vector removedBuddies = new Vector(); /** @@ -775,9 +770,11 @@ public class IcqTesterAgent * @param group a reference to the Group that has just been created. * @param buddies a List of the buddies created by this group (unused). */ - public void groupAdded(BuddyList list, List oldItems, - List newItems, - Group group, List buddies) + public void groupAdded(BuddyList list, + List<? extends Group> oldItems, + List<? extends Group> newItems, + Group group, + List<? extends Buddy> buddies) { logger.debug("A group was added gname is=" + group.getName()); synchronized(this.addedGroups){ @@ -795,8 +792,11 @@ public class IcqTesterAgent * @param newItems List (unused) * @param buddy a reference to the newly added Buddy. */ - public void buddyAdded(BuddyList list, Group group, List oldItems, - List newItems, Buddy buddy) + public void buddyAdded(BuddyList list, + Group group, + List<? extends Buddy> oldItems, + List<? extends Buddy> newItems, + Buddy buddy) { logger.debug("A buddy ("+buddy.getScreenname() +")was added to group " + group.getName()); @@ -1069,12 +1069,11 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. dupeGroup = group; if (group.getName().equals("grp")) grpGroup = group; - List buddies = group.getBuddiesCopy(); + List<? extends Buddy> buddies = group.getBuddiesCopy(); System.out.println("Printing buddies for group " + group.getName()); Thread.sleep(1000); - for (int i = 0; i < buddies.size(); i++) + for (Buddy buddy : buddies) { - Buddy buddy = (Buddy) buddies.get(i); System.out.println(buddy.getScreenname()); if (buddy.getScreenname().getFormatted().equals("201345337")) buddyToMove = buddy; @@ -1084,7 +1083,7 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. System.out.println();System.out.println();System.out.println();System.out.println();System.out.println();System.out.println();System.out.println();System.out.println();System.out.println(); System.out.println("will move buddyyyyyyyyyy"); Thread.sleep(5000); - List listToMove = new ArrayList(); + List<Buddy> listToMove = new ArrayList<Buddy>(); listToMove.add(buddyToMove); list.moveBuddies(listToMove, grpGroup); System.out.println("MOved i sega triabva da doidat eventi "); @@ -1096,10 +1095,9 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. while(groupsIter.hasNext()) { MutableGroup group = (MutableGroup)groupsIter.next(); - List buddies = group.getBuddiesCopy(); - for (int i = 0; i < buddies.size(); i++) + List<? extends Buddy> buddies = group.getBuddiesCopy(); + for (Buddy buddy : buddies) { - Buddy buddy = (Buddy) buddies.get(i); if (buddy.getScreenname().getFormatted().equals("201345337")) movedBuddy = buddy; } @@ -1128,7 +1126,6 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. */ public void writeData(OutputStream out) throws IOException { - } } @@ -1136,23 +1133,23 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. { logger.debug("Will delete buddy : " + screenname); MutableBuddyList joustSimBuddyList - = (MutableBuddyList)conn.getSsiService().getBuddyList(); + = conn.getSsiService().getBuddyList(); LayoutEventCollector evtCollector = new LayoutEventCollector(); joustSimBuddyList.addLayoutListener(evtCollector); - List grList = joustSimBuddyList.getGroups(); + List<? extends Group> grList = joustSimBuddyList.getGroups(); boolean isDeleted = false; - Iterator iter = grList.iterator(); + Iterator<? extends Group> iter = grList.iterator(); while (iter.hasNext()) { MutableGroup item = (MutableGroup) iter.next(); - List bs = item.getBuddiesCopy(); - Iterator iter1 = bs.iterator(); + List<? extends Buddy> bs = item.getBuddiesCopy(); + Iterator<? extends Buddy> iter1 = bs.iterator(); while (iter1.hasNext()) { - Buddy b = (Buddy) iter1.next(); + Buddy b = iter1.next(); if(b.getScreenname().getFormatted().equals(screenname)) { item.deleteBuddy(b); @@ -1174,20 +1171,20 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. { logger.debug("Will add buddy : " + screenname); MutableBuddyList joustSimBuddyList - = (MutableBuddyList)conn.getSsiService().getBuddyList(); + = conn.getSsiService().getBuddyList(); - List grList = joustSimBuddyList.getGroups(); + List<? extends Group> grList = joustSimBuddyList.getGroups(); - Iterator iter = grList.iterator(); + Iterator<? extends Group> iter = grList.iterator(); while (iter.hasNext()) { MutableGroup item = (MutableGroup) iter.next(); logger.debug("group : " + item); - List bs = item.getBuddiesCopy(); - Iterator iter1 = bs.iterator(); + List<? extends Buddy> bs = item.getBuddiesCopy(); + Iterator<? extends Buddy> iter1 = bs.iterator(); while (iter1.hasNext()) { - Object b = (Object) iter1.next(); + Object b = iter1.next(); logger.debug("buddy : " + b); } } @@ -1433,7 +1430,7 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. logger.trace("Adding buddy as awaiting authorization " + uinToAskForAuth); MutableBuddyList joustSimBuddyList - = (MutableBuddyList)conn.getSsiService().getBuddyList(); + = conn.getSsiService().getBuddyList(); LayoutEventCollector evtCollector = new LayoutEventCollector(); joustSimBuddyList.addLayoutListener(evtCollector); @@ -1517,7 +1514,7 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. conn.getSsiService().getOscarConnection().sendSnac(cmd); } - public Hashtable getUserInfo(String uin) + public Hashtable<String, Object> getUserInfo(String uin) { UserInfoResponse response = new UserInfoResponse(); @@ -1565,7 +1562,7 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. private class UserInfoResponse extends SnacRequestAdapter { - Hashtable info = null; + Hashtable<String, Object> info = null; public void handleResponse(SnacResponseEvent e) { diff --git a/test/net/java/sip/communicator/slick/protocol/icq/TestAccountInstallation.java b/test/net/java/sip/communicator/slick/protocol/icq/TestAccountInstallation.java index d458d23..d47161c 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestAccountInstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestAccountInstallation.java @@ -118,7 +118,7 @@ public class TestAccountInstallation extends TestCase uin = uin + "1234"; - Hashtable icqAccountProperties = new Hashtable(); + Hashtable<String, String> icqAccountProperties = new Hashtable<String, String>(); icqAccountProperties.put(ProtocolProviderFactory.PASSWORD, passwd); AccountID icqAccountID = icqProviderFactory.installAccount( @@ -247,7 +247,7 @@ public class TestAccountInstallation extends TestCase passwd = "dam1234"; - Hashtable icqAccountProperties = new Hashtable(); + Hashtable<String, String> icqAccountProperties = new Hashtable<String, String>(); icqAccountProperties.put(ProtocolProviderFactory.PASSWORD, passwd); AccountID icqAccountID = icqProviderFactory.installAccount( @@ -384,7 +384,7 @@ public class TestAccountInstallation extends TestCase passwd); - Hashtable icqAccountProperties = new Hashtable(); + Hashtable<String, String> icqAccountProperties = new Hashtable<String, String>(); icqAccountProperties.put(ProtocolProviderFactory.PASSWORD, passwd); //try to install an account with a null account id @@ -460,7 +460,7 @@ public class TestAccountInstallation extends TestCase public class RegistrationFailedEventCollector implements RegistrationStateChangeListener { - public List collectedNewStates = new LinkedList(); + public List<RegistrationState> collectedNewStates = new LinkedList<RegistrationState>(); public int failedCode; public String failedReason = null; diff --git a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetBasicInstantMessaging.java b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetBasicInstantMessaging.java index 9d5232e..376fd53 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetBasicInstantMessaging.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetBasicInstantMessaging.java @@ -217,8 +217,8 @@ public class TestOperationSetBasicInstantMessaging //verify that the message has successfully arived at the destination assertTrue( "No messages received by the tester agent" , jsEvtCollector.collectedMessageInfo.size() > 0); - String receivedBody = ((MessageInfo)jsEvtCollector.collectedMessageInfo - .get(0)).getMessage().getMessageBody(); + String receivedBody = jsEvtCollector.collectedMessageInfo + .get(0).getMessage().getMessageBody(); assertEquals("received message body", msg.getContent(), receivedBody); } @@ -289,7 +289,8 @@ public class TestOperationSetBasicInstantMessaging */ private class ImEventCollector implements MessageListener { - private List collectedEvents = new LinkedList(); + private List<EventObject> collectedEvents = new LinkedList<EventObject>(); + /** * Called when a new incoming <tt>Message</tt> has been received. * @param evt the <tt>MessageReceivedEvent</tt> containing the newly @@ -375,7 +376,7 @@ public class TestOperationSetBasicInstantMessaging private class JoustSimMessageEventCollector implements ConversationListener { - private List collectedMessageInfo = new LinkedList(); + private List<MessageInfo> collectedMessageInfo = new LinkedList<MessageInfo>(); /** * Adds <tt>minfo</tt> into the list of collected messages. diff --git a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPersistentPresence.java b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPersistentPresence.java index 12d465e..629625a 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPersistentPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPersistentPresence.java @@ -424,7 +424,7 @@ public class TestOperationSetPersistentPresence */ private class GroupChangeCollector implements ServerStoredGroupListener { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); /** * Blocks until at least one event is received or until waitFor @@ -525,7 +525,7 @@ public class TestOperationSetPersistentPresence */ private class SubscriptionEventCollector implements SubscriptionListener { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); /** * Blocks until at least one event is received or until waitFor diff --git a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPresence.java b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPresence.java index cb28d81..ebe4b8b 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPresence.java @@ -127,17 +127,19 @@ public class TestOperationSetPresence { //first create a local list containing the presence status instances //supported by the underlying implementation. - Iterator supportedStatusSetIter = + Iterator<PresenceStatus> supportedStatusSetIter = operationSetPresence.getSupportedStatusSet(); - List supportedStatusSet = new LinkedList(); + List<PresenceStatus> supportedStatusSet + = new LinkedList<PresenceStatus>(); while (supportedStatusSetIter.hasNext()){ supportedStatusSet.add(supportedStatusSetIter.next()); } //create a copy of the MUST status set and remove any matching status //that is also present in the supported set. - List requiredStatusSetCopy = (List)IcqStatusEnum.icqStatusSet.clone(); + List<?> requiredStatusSetCopy + = (List<?>) IcqStatusEnum.icqStatusSet.clone(); requiredStatusSetCopy.removeAll(supportedStatusSet); @@ -331,7 +333,7 @@ public class TestOperationSetPresence { try { - Thread.currentThread().sleep(5000); + Thread.sleep(5000); } catch (InterruptedException ex) { @@ -585,10 +587,11 @@ public class TestOperationSetPresence EventObject evt = null; - Iterator events = subEvtCollector.collectedEvents.iterator(); + Iterator<EventObject> events + = subEvtCollector.collectedEvents.iterator(); while (events.hasNext()) { - Object elem = events.next(); + EventObject elem = events.next(); if(elem instanceof SubscriptionEvent) { if(((SubscriptionEvent)elem).getEventID() @@ -845,8 +848,8 @@ public class TestOperationSetPresence private class PresenceStatusEventCollector implements ProviderPresenceStatusListener { - public ArrayList collectedPresEvents = new ArrayList(); - public ArrayList collectedStatMsgEvents = new ArrayList(); + public ArrayList<EventObject> collectedPresEvents = new ArrayList<EventObject>(); + public ArrayList<EventObject> collectedStatMsgEvents = new ArrayList<EventObject>(); public void providerStatusChanged(ProviderPresenceStatusChangeEvent evt) { @@ -871,9 +874,9 @@ public class TestOperationSetPresence /** * Blocks until at least one event is received or until waitFor - * miliseconds pass (whicever happens first). + * milliseconds pass (whichever happens first). * - * @param waitFor the number of miliseconds that we should be waiting + * @param waitFor the number of milliseconds that we should be waiting * for an event before simply bailing out. */ public void waitForPresEvent(long waitFor) @@ -901,10 +904,10 @@ public class TestOperationSetPresence } /** - * Blocks until at least one staus message event is received or until - * waitFor miliseconds pass (whichever happens first). + * Blocks until at least one status message event is received or until + * waitFor milliseconds pass (whichever happens first). * - * @param waitFor the number of miliseconds that we should be waiting + * @param waitFor the number of milliseconds that we should be waiting * for a status message event before simply bailing out. */ public void waitForStatMsgEvent(long waitFor) @@ -940,13 +943,13 @@ public class TestOperationSetPresence */ private class SubscriptionEventCollector implements SubscriptionListener { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); /** * Blocks until at least one event is received or until waitFor - * miliseconds pass (whicever happens first). + * milliseconds pass (whichever happens first). * - * @param waitFor the number of miliseconds that we should be waiting + * @param waitFor the number of milliseconds that we should be waiting * for an event before simply bailing out. */ public void waitForEvent(long waitFor) @@ -968,7 +971,7 @@ public class TestOperationSetPresence } /** - * Stores the received subsctiption and notifies all waiting on this + * Stores the received subscription and notifies all waiting on this * object * @param evt the SubscriptionEvent containing the corresponding contact */ @@ -983,7 +986,7 @@ public class TestOperationSetPresence } /** - * Stores the received subsctiption and notifies all waiting on this + * Stores the received subscription and notifies all waiting on this * object * @param evt the SubscriptionEvent containing the corresponding contact */ @@ -998,7 +1001,7 @@ public class TestOperationSetPresence } /** - * Stores the received subsctiption and notifies all waiting on this + * Stores the received subscription and notifies all waiting on this * object * @param evt the SubscriptionEvent containing the corresponding contact */ @@ -1014,7 +1017,7 @@ public class TestOperationSetPresence /** - * Stores the received subsctiption and notifies all waiting on this + * Stores the received subscription and notifies all waiting on this * object * @param evt the SubscriptionEvent containing the corresponding contact */ @@ -1029,7 +1032,7 @@ public class TestOperationSetPresence } /** - * Stores the received subsctiption and notifies all waiting on this + * Stores the received subscription and notifies all waiting on this * object * @param evt the SubscriptionEvent containing the corresponding contact */ @@ -1044,7 +1047,7 @@ public class TestOperationSetPresence } /** - * Stores the received subsctiption and notifies all waiting on this + * Stores the received subscription and notifies all waiting on this * object * @param evt the SubscriptionEvent containing the corresponding contact */ @@ -1067,7 +1070,7 @@ public class TestOperationSetPresence private class ContactPresenceEventCollector implements ContactPresenceStatusListener { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); private String trackedScreenName = null; private IcqStatusEnum status = null; @@ -1080,9 +1083,9 @@ public class TestOperationSetPresence /** * Blocks until at least one event is received or until waitFor - * miliseconds pass (whicever happens first). + * milliseconds pass (whichever happens first). * - * @param waitFor the number of miliseconds that we should be waiting + * @param waitFor the number of milliseconds that we should be waiting * for an event before simply bailing out. */ public void waitForEvent(long waitFor) diff --git a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetTypingNotifications.java b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetTypingNotifications.java index 2ad71d3..f04d71a 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetTypingNotifications.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetTypingNotifications.java @@ -173,7 +173,7 @@ public class TestOperationSetTypingNotifications */ private class TypingEventCollector implements TypingNotificationsListener { - private List collectedEvents = new LinkedList(); + private List<EventObject> collectedEvents = new LinkedList<EventObject>(); /** * Called to indicate that a remote <tt>Contact</tt> has sent us a typing * notification. The method adds the <tt>event</tt> to the list of @@ -222,7 +222,7 @@ public class TestOperationSetTypingNotifications private class JoustSimTypingEventCollector implements IcbmListener, TypingListener { - private List collectedTypingInfo = new LinkedList(); + private List<TypingInfo> collectedTypingInfo = new LinkedList<TypingInfo>(); /** diff --git a/test/net/java/sip/communicator/slick/protocol/icq/TestProtocolProviderServiceIcqImpl.java b/test/net/java/sip/communicator/slick/protocol/icq/TestProtocolProviderServiceIcqImpl.java index e56f2d7..0c37d56 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestProtocolProviderServiceIcqImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestProtocolProviderServiceIcqImpl.java @@ -259,7 +259,7 @@ public class TestProtocolProviderServiceIcqImpl extends TestCase */ public class RegistrationEventCollector implements RegistrationStateChangeListener { - public List collectedNewStates = new LinkedList(); + public List<RegistrationState> collectedNewStates = new LinkedList<RegistrationState>(); /** * The method would simply register all received events so that they diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/JabberProtocolProviderServiceLick.java b/test/net/java/sip/communicator/slick/protocol/jabber/JabberProtocolProviderServiceLick.java index 9293902..5208625 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/JabberProtocolProviderServiceLick.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/JabberProtocolProviderServiceLick.java @@ -67,7 +67,7 @@ public class JabberProtocolProviderServiceLick { setName("JabberProtocolProviderSlick"); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put("service.pid", getName()); JabberSlickFixture.bc = context; diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/JabberSlickFixture.java b/test/net/java/sip/communicator/slick/protocol/jabber/JabberSlickFixture.java index ce63093..2fe9014 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/JabberSlickFixture.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/JabberSlickFixture.java @@ -90,17 +90,17 @@ public class JabberSlickFixture * screen names. This is a snapshot of the server stored buddy list for * the account that is going to be used by the tested implementation. * It is filled in by the tester agent who'd login with that account - * and initialise the ss contact list before the tested implementation has + * and initialize the ss contact list before the tested implementation has * actually done so. */ - public static Hashtable preInstalledBuddyList = null; + public static Hashtable<String, List<String>> preInstalledBuddyList = null; /** * Initializes protocol provider references and whatever else there is to * initialize. * - * @throws java.lang.Exception in case we meet problems while retriving + * @throws java.lang.Exception in case we meet problems while retrieving * protocol providers through OSGI */ public void setUp() @@ -276,8 +276,8 @@ public class JabberSlickFixture ContactGroup rootGroup1 = opSetPersPresence1.getServerStoredContactListRoot(); // first delete the groups - Vector groupsToRemove = new Vector(); - Iterator iter = rootGroup1.subgroups(); + Vector<ContactGroup> groupsToRemove = new Vector<ContactGroup>(); + Iterator<ContactGroup> iter = rootGroup1.subgroups(); while (iter.hasNext()) { groupsToRemove.add(iter.next()); @@ -286,27 +286,27 @@ public class JabberSlickFixture iter = groupsToRemove.iterator(); while (iter.hasNext()) { - ContactGroup item = (ContactGroup) iter.next(); + ContactGroup item = iter.next(); opSetPersPresence1.removeServerStoredContactGroup(item); } //then delete contacts if any in root list - Vector contactsToRemove = new Vector(); - iter = rootGroup1.contacts(); - while (iter.hasNext()) + Vector<Contact> contactsToRemove = new Vector<Contact>(); + Iterator<Contact> iter2 = rootGroup1.contacts(); + while (iter2.hasNext()) { - contactsToRemove.add(iter.next()); + contactsToRemove.add(iter2.next()); } - iter = contactsToRemove.iterator(); - while (iter.hasNext()) + iter2 = contactsToRemove.iterator(); + while (iter2.hasNext()) { - opSetPersPresence1.unsubscribe((Contact)iter.next()); + opSetPersPresence1.unsubscribe(iter2.next()); } ContactGroup rootGroup2 = opSetPersPresence2.getServerStoredContactListRoot(); // delete groups - groupsToRemove = new Vector(); + groupsToRemove = new Vector<ContactGroup>(); iter = rootGroup2.subgroups(); while (iter.hasNext()) { @@ -316,21 +316,21 @@ public class JabberSlickFixture iter = groupsToRemove.iterator(); while (iter.hasNext()) { - ContactGroup item = (ContactGroup) iter.next(); + ContactGroup item = iter.next(); opSetPersPresence2.removeServerStoredContactGroup(item); } //then delete contacts if any in root list - contactsToRemove = new Vector(); - iter = rootGroup2.contacts(); - while (iter.hasNext()) + contactsToRemove = new Vector<Contact>(); + iter2 = rootGroup2.contacts(); + while (iter2.hasNext()) { - contactsToRemove.add(iter.next()); + contactsToRemove.add(iter2.next()); } - iter = contactsToRemove.iterator(); - while (iter.hasNext()) + iter2 = contactsToRemove.iterator(); + while (iter2.hasNext()) { - opSetPersPresence2.unsubscribe( (Contact) iter.next()); + opSetPersPresence2.unsubscribe(iter2.next()); } } } diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/TestAccountInstallation.java b/test/net/java/sip/communicator/slick/protocol/jabber/TestAccountInstallation.java index 620ea8b..ba4a4c4 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestAccountInstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestAccountInstallation.java @@ -78,9 +78,9 @@ public class TestAccountInstallation //Prepare the properties of the first jabber account. - Hashtable jabberAccount1Properties = getAccountProperties( + Hashtable<String, String> jabberAccount1Properties = getAccountProperties( JabberProtocolProviderServiceLick.ACCOUNT_1_PREFIX); - Hashtable jabberAccount2Properties = getAccountProperties( + Hashtable<String, String> jabberAccount2Properties = getAccountProperties( JabberProtocolProviderServiceLick.ACCOUNT_2_PREFIX); //try to install an account with a null account id @@ -96,10 +96,10 @@ public class TestAccountInstallation //now really install the accounts jabberProviderFactory.installAccount( - (String)jabberAccount1Properties.get(ProtocolProviderFactory.USER_ID) + jabberAccount1Properties.get(ProtocolProviderFactory.USER_ID) , jabberAccount1Properties); jabberProviderFactory.installAccount( - (String)jabberAccount2Properties.get(ProtocolProviderFactory.USER_ID) + jabberAccount2Properties.get(ProtocolProviderFactory.USER_ID) , jabberAccount2Properties); @@ -107,7 +107,7 @@ public class TestAccountInstallation //excepion is thrown. try{ jabberProviderFactory.installAccount( - (String)jabberAccount1Properties.get(ProtocolProviderFactory.USER_ID) + jabberAccount1Properties.get(ProtocolProviderFactory.USER_ID) , jabberAccount1Properties); fail("An IllegalStateException must be thrown when trying to "+ @@ -130,7 +130,7 @@ public class TestAccountInstallation osgiFilter = "(&("+ProtocolProviderFactory.PROTOCOL +"="+ProtocolNames.JABBER+")" +"(" + ProtocolProviderFactory.USER_ID - + "=" + (String)jabberAccount1Properties.get( + + "=" + jabberAccount1Properties.get( ProtocolProviderFactory.USER_ID) + "))"; @@ -166,9 +166,9 @@ public class TestAccountInstallation * @return a Hashtable that can be used when creating the account in a * protocol provider factory. */ - private Hashtable getAccountProperties(String accountPrefix) + private Hashtable<String, String> getAccountProperties(String accountPrefix) { - Hashtable table = new Hashtable(); + Hashtable<String, String> table = new Hashtable<String, String>(); String userID = System.getProperty( accountPrefix + ProtocolProviderFactory.USER_ID, null); diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetBasicInstantMessaging.java b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetBasicInstantMessaging.java index 9885443..78ff9dd 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetBasicInstantMessaging.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetBasicInstantMessaging.java @@ -402,7 +402,7 @@ public class TestOperationSetBasicInstantMessaging */ private class ImEventCollector implements MessageListener { - private List collectedEvents = new LinkedList(); + private List<EventObject> collectedEvents = new LinkedList<EventObject>(); /** * Called when a new incoming <tt>Message</tt> has been received. * @param evt the <tt>MessageReceivedEvent</tt> containing the newly diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetBasicTelephonyJabberImpl.java b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetBasicTelephonyJabberImpl.java index 9deae2b..f3c17b6 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetBasicTelephonyJabberImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetBasicTelephonyJabberImpl.java @@ -122,10 +122,8 @@ public class TestOperationSetBasicTelephonyJabberImpl assertEquals("callAtP2.getCallPeerCount()"
, 1, callAtP2.getCallPeerCount());
- CallPeer peerAtP1
- = (CallPeer)callAtP1.getCallPeers().next();
- CallPeer peerAtP2
- = (CallPeer)callAtP2.getCallPeers().next();
+ CallPeer peerAtP1 = callAtP1.getCallPeers().next();
+ CallPeer peerAtP2 = callAtP2.getCallPeers().next();
//now add listeners to the peers and make sure they have entered
//the states they were expected to.
@@ -352,10 +350,8 @@ public class TestOperationSetBasicTelephonyJabberImpl assertEquals("callAtP2.getCallPeerCount()"
, 1, callAtP2.getCallPeerCount());
- CallPeer peerAtP1
- = (CallPeer)callAtP1.getCallPeers().next();
- CallPeer peerAtP2
- = (CallPeer)callAtP2.getCallPeers().next();
+ CallPeer peerAtP1 = callAtP1.getCallPeers().next();
+ CallPeer peerAtP2 = callAtP2.getCallPeers().next();
//now add listeners to the peers and make sure they have entered
//the states they were expected to.
@@ -589,10 +585,8 @@ public class TestOperationSetBasicTelephonyJabberImpl assertEquals("callAtP2.getCallPeerCount()"
, 1, callAtP2.getCallPeerCount());
- CallPeer peerAtP1
- = (CallPeer)callAtP1.getCallPeers().next();
- CallPeer peerAtP2
- = (CallPeer)callAtP2.getCallPeers().next();
+ CallPeer peerAtP1 = callAtP1.getCallPeers().next();
+ CallPeer peerAtP2 = callAtP2.getCallPeers().next();
//now add listeners to the peers and make sure they have entered
//the states they were expected to.
@@ -752,7 +746,7 @@ public class TestOperationSetBasicTelephonyJabberImpl */
public class CallEventCollector implements CallListener
{
- public ArrayList collectedEvents = new ArrayList();
+ public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>();
public OperationSetBasicTelephony listenedOpSet = null;
/**
@@ -860,7 +854,7 @@ public class TestOperationSetBasicTelephonyJabberImpl public class CallPeerStateEventCollector
extends CallPeerAdapter
{
- public ArrayList collectedEvents = new ArrayList();
+ public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>();
private CallPeer listenedCallPeer = null;
public CallPeerState awaitedState = null;
@@ -985,7 +979,7 @@ public class TestOperationSetBasicTelephonyJabberImpl public class CallStateEventCollector
extends CallChangeAdapter
{
- public ArrayList collectedEvents = new ArrayList();
+ public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>();
private Call listenedCall = null;
public CallState awaitedState = null;
diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetMultiUserChat2.java b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetMultiUserChat2.java index ab8cede..8bc338a 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetMultiUserChat2.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetMultiUserChat2.java @@ -1110,7 +1110,7 @@ public class TestOperationSetMultiUserChat2 ChatRoomMemberRoleListener, ChatRoomLocalUserRoleListener { - private final ArrayList collectedEvents = new ArrayList(); + private final ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); private int waitCount = 0; diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPersistentPresence.java b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPersistentPresence.java index b11d3c9..d8b963a 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPersistentPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPersistentPresence.java @@ -139,7 +139,8 @@ public class TestOperationSetPersistentPresence + "rootGroup.childGroups="+rootGroup.countSubgroups() + "Printing rootGroupContents=\n"+rootGroup.toString()); - Hashtable expectedContactList = fixture.preInstalledBuddyList; + Hashtable<String, List<String>> expectedContactList + = fixture.preInstalledBuddyList; logger.debug("============== Expected Contact List ==================="); logger.debug(expectedContactList); @@ -147,13 +148,13 @@ public class TestOperationSetPersistentPresence //Go through the contact list retrieved by the persistence presence set //and remove the name of every contact and group that we find there from //the expected contct list hashtable. - Iterator groups = rootGroup.subgroups(); + Iterator<ContactGroup> groups = rootGroup.subgroups(); while (groups.hasNext() ) { - ContactGroup group = (ContactGroup)groups.next(); + ContactGroup group = groups.next(); - List expectedContactsInGroup - = (List)expectedContactList.get(group.getGroupName()); + List<String> expectedContactsInGroup + = expectedContactList.get(group.getGroupName()); // When sending the offline message // the sever creates a group NotInContactList, @@ -167,10 +168,10 @@ public class TestOperationSetPersistentPresence "the server but was not in the expected contact list." , expectedContactsInGroup); - Iterator contactsIter = group.contacts(); + Iterator<Contact> contactsIter = group.contacts(); while(contactsIter.hasNext()) { - String contactID = ((Contact)contactsIter.next()). + String contactID = contactsIter.next(). getAddress(); expectedContactsInGroup.remove(contactID); } @@ -381,7 +382,8 @@ public class TestOperationSetPersistentPresence logger.debug("tokens contained by the CL tokenized=" +tokenizer.countTokens()); - Hashtable contactListToCreate = new Hashtable(); + Hashtable<String, List<String>> contactListToCreate + = new Hashtable<String, List<String>>(); //go over all group.uin tokens while (tokenizer.hasMoreTokens()) @@ -407,10 +409,10 @@ public class TestOperationSetPersistentPresence } //check if we've already seen this group and if not - add it - List uinInThisGroup = (List)contactListToCreate.get(groupName); + List<String> uinInThisGroup = contactListToCreate.get(groupName); if (uinInThisGroup == null) { - uinInThisGroup = new ArrayList(); + uinInThisGroup = new ArrayList<String>(); contactListToCreate.put(groupName, uinInThisGroup); } @@ -418,12 +420,12 @@ public class TestOperationSetPersistentPresence } // now init the list - Enumeration newGroupsEnum = contactListToCreate.keys(); + Enumeration<String> newGroupsEnum = contactListToCreate.keys(); //go over all groups in the contactsToAdd table while (newGroupsEnum.hasMoreElements()) { - String groupName = (String) newGroupsEnum.nextElement(); + String groupName = newGroupsEnum.nextElement(); logger.debug("Will add group " + groupName); opSetPersPresence1.createServerStoredContactGroup( @@ -432,11 +434,11 @@ public class TestOperationSetPersistentPresence ContactGroup newlyCreatedGroup = opSetPersPresence1.getServerStoredContactListRoot().getGroup(groupName); - Iterator contactsToAddToThisGroup - = ( (List) contactListToCreate.get(groupName)).iterator(); + Iterator<String> contactsToAddToThisGroup + = contactListToCreate.get(groupName).iterator(); while (contactsToAddToThisGroup.hasNext()) { - String id = (String) contactsToAddToThisGroup.next(); + String id = contactsToAddToThisGroup.next(); logger.debug("Will add buddy " + id); opSetPersPresence1.subscribe(newlyCreatedGroup, id); @@ -453,7 +455,7 @@ public class TestOperationSetPersistentPresence */ private class GroupChangeCollector implements ServerStoredGroupListener { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); /** * Blocks until at least one event is received or until waitFor @@ -551,13 +553,14 @@ public class TestOperationSetPersistentPresence */ private class SubscriptionEventCollector implements SubscriptionListener { - public ArrayList collectedEvents = new ArrayList(); + public final List<EventObject> collectedEvents + = new ArrayList<EventObject>(); /** * Blocks until at least one event is received or until waitFor - * miliseconds pass (whicever happens first). + * milliseconds pass (whichever happens first). * - * @param waitFor the number of miliseconds that we should be waiting + * @param waitFor the number of milliseconds that we should be waiting * for an event before simply bailing out. */ public void waitForEvent(long waitFor) @@ -588,7 +591,7 @@ public class TestOperationSetPersistentPresence } /** - * Stores the received subsctiption and notifies all waiting on this + * Stores the received subscription and notifies all waiting on this * object * @param evt the SubscriptionEvent containing the corresponding contact */ @@ -603,7 +606,7 @@ public class TestOperationSetPersistentPresence } /** - * Stores the received subsctiption and notifies all waiting on this + * Stores the received subscription and notifies all waiting on this * object * @param evt the SubscriptionEvent containing the corresponding contact */ @@ -618,7 +621,7 @@ public class TestOperationSetPersistentPresence } /** - * Stores the received subsctiption and notifies all waiting on this + * Stores the received subscription and notifies all waiting on this * object * @param evt the SubscriptionEvent containing the corresponding contact */ @@ -633,7 +636,7 @@ public class TestOperationSetPersistentPresence } /** - * Stores the received subsctiption and notifies all waiting on this + * Stores the received subscription and notifies all waiting on this * object * @param evt the SubscriptionEvent containing the corresponding contact */ @@ -649,7 +652,7 @@ public class TestOperationSetPersistentPresence /** - * Stores the received subsctiption and notifies all waiting on this + * Stores the received subscription and notifies all waiting on this * object * @param evt the SubscriptionEvent containing the corresponding contact */ @@ -664,7 +667,7 @@ public class TestOperationSetPersistentPresence } /** - * Stores the received subsctiption and notifies all waiting on this + * Stores the received subscription and notifies all waiting on this * object * @param evt the SubscriptionEvent containing the corresponding contact */ @@ -677,6 +680,5 @@ public class TestOperationSetPersistentPresence notifyAll(); } } - } } diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPresence.java b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPresence.java index b2c7d9e..e9db131 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPresence.java @@ -190,8 +190,8 @@ public class TestOperationSetPresence List<String> supportedStatusNames = new LinkedList<String>(); while (supportedStatusSetIter.hasNext()) { - supportedStatusNames.add(((PresenceStatus) supportedStatusSetIter - .next()).getStatusName()); + supportedStatusNames.add(supportedStatusSetIter + .next().getStatusName()); } //create a copy of the MUST status set and remove any matching status @@ -321,13 +321,11 @@ public class TestOperationSetPresence 1, statusEventCollector.collectedStatMsgEvents.size()); assertEquals("A status message event contained wrong old value.", oldStatusMessage, - ((PropertyChangeEvent) - statusEventCollector.collectedStatMsgEvents.get(0)) + statusEventCollector.collectedStatMsgEvents.get(0) .getOldValue()); assertEquals("A status message event contained wrong new value.", newStatusMessage, - ((PropertyChangeEvent) - statusEventCollector.collectedStatMsgEvents.get(0)) + statusEventCollector.collectedStatMsgEvents.get(0) .getNewValue()); // verify that the operation set itself is aware of the new status msg. @@ -569,9 +567,7 @@ public class TestOperationSetPresence assertEquals("Presence Notif. event dispatching failed." , 1, contactPresEvtCollector.collectedEvents.size()); - ContactPresenceStatusChangeEvent presEvt = - (ContactPresenceStatusChangeEvent) - contactPresEvtCollector.collectedEvents.get(0); + ContactPresenceStatusChangeEvent presEvt = contactPresEvtCollector.collectedEvents.get(0); assertEquals("Presence Notif. event Source:", fixture.userID2, diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetTypingNotifications.java b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetTypingNotifications.java index c938cce..eee2848 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetTypingNotifications.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetTypingNotifications.java @@ -274,7 +274,7 @@ public class TestOperationSetTypingNotifications */ private class TypingEventCollector implements TypingNotificationsListener { - private List collectedEvents = new LinkedList(); + private List<EventObject> collectedEvents = new LinkedList<EventObject>(); /** * Called to indicate that a remote <tt>Contact</tt> has sent us a typing * notification. The method adds the <tt>event</tt> to the list of diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/TestProtocolProviderServiceJabberImpl.java b/test/net/java/sip/communicator/slick/protocol/jabber/TestProtocolProviderServiceJabberImpl.java index a8b7e4b..fab9432 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestProtocolProviderServiceJabberImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestProtocolProviderServiceJabberImpl.java @@ -170,12 +170,12 @@ public class TestProtocolProviderServiceJabberImpl public class RegistrationEventCollector implements RegistrationStateChangeListener { - public List collectedNewStates = new LinkedList(); + public List<RegistrationState> collectedNewStates = new LinkedList<RegistrationState>(); /** * The method would simply register all received events so that they * could be available for later inspection by the unit tests. In the - * case where a registraiton event notifying us of a completed + * case where a registration event notifying us of a completed * registration is seen, the method would call notifyAll(). * * @param evt ProviderStatusChangeEvent the event describing the status diff --git a/test/net/java/sip/communicator/slick/protocol/msn/MsnProtocolProviderServiceLick.java b/test/net/java/sip/communicator/slick/protocol/msn/MsnProtocolProviderServiceLick.java index 2abaece..9c3e9f2 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/MsnProtocolProviderServiceLick.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/MsnProtocolProviderServiceLick.java @@ -59,7 +59,7 @@ public class MsnProtocolProviderServiceLick { setName("MsnProtocolProviderSlick"); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put("service.pid", getName()); MsnSlickFixture.bc = context; diff --git a/test/net/java/sip/communicator/slick/protocol/msn/MsnSlickFixture.java b/test/net/java/sip/communicator/slick/protocol/msn/MsnSlickFixture.java index fd00ebc..0e423e0 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/MsnSlickFixture.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/MsnSlickFixture.java @@ -81,17 +81,17 @@ public class MsnSlickFixture * screen names. This is a snapshot of the server stored buddy list for * the account that is going to be used by the tested implementation. * It is filled in by the tester agent who'd login with that account - * and initialise the ss contact list before the tested implementation has + * and initialize the ss contact list before the tested implementation has * actually done so. */ - public static Hashtable preInstalledBuddyList = null; + public static Hashtable<String, List<String>> preInstalledBuddyList = null; /** * Initializes protocol provider references and whatever else there is to * initialize. * - * @throws java.lang.Exception in case we meet problems while retriving + * @throws java.lang.Exception in case we meet problems while retrieving * protocol providers through OSGI */ public void setUp() @@ -262,8 +262,8 @@ public class MsnSlickFixture ContactGroup rootGroup1 = opSetPersPresence1.getServerStoredContactListRoot(); // first delete the groups - Vector groupsToRemove = new Vector(); - Iterator iter = rootGroup1.subgroups(); + Vector<ContactGroup> groupsToRemove = new Vector<ContactGroup>(); + Iterator<ContactGroup> iter = rootGroup1.subgroups(); while (iter.hasNext()) { groupsToRemove.add(iter.next()); @@ -272,27 +272,27 @@ public class MsnSlickFixture iter = groupsToRemove.iterator(); while (iter.hasNext()) { - ContactGroup item = (ContactGroup) iter.next(); + ContactGroup item = iter.next(); opSetPersPresence1.removeServerStoredContactGroup(item); } //then delete contacts if any in root list - Vector contactsToRemove = new Vector(); - iter = rootGroup1.contacts(); - while (iter.hasNext()) + Vector<Contact> contactsToRemove = new Vector<Contact>(); + Iterator<Contact> iter2 = rootGroup1.contacts(); + while (iter2.hasNext()) { - contactsToRemove.add(iter.next()); + contactsToRemove.add(iter2.next()); } - iter = contactsToRemove.iterator(); - while (iter.hasNext()) + iter2 = contactsToRemove.iterator(); + while (iter2.hasNext()) { - opSetPersPresence1.unsubscribe((Contact)iter.next()); + opSetPersPresence1.unsubscribe(iter2.next()); } ContactGroup rootGroup2 = opSetPersPresence2.getServerStoredContactListRoot(); // delete groups - groupsToRemove = new Vector(); + groupsToRemove = new Vector<ContactGroup>(); iter = rootGroup2.subgroups(); while (iter.hasNext()) { @@ -302,21 +302,21 @@ public class MsnSlickFixture iter = groupsToRemove.iterator(); while (iter.hasNext()) { - ContactGroup item = (ContactGroup) iter.next(); + ContactGroup item = iter.next(); opSetPersPresence2.removeServerStoredContactGroup(item); } //then delete contacts if any in root list - contactsToRemove = new Vector(); - iter = rootGroup2.contacts(); - while (iter.hasNext()) + contactsToRemove = new Vector<Contact>(); + iter2 = rootGroup2.contacts(); + while (iter2.hasNext()) { - contactsToRemove.add(iter.next()); + contactsToRemove.add(iter2.next()); } - iter = contactsToRemove.iterator(); - while (iter.hasNext()) + iter2 = contactsToRemove.iterator(); + while (iter2.hasNext()) { - opSetPersPresence2.unsubscribe( (Contact) iter.next()); + opSetPersPresence2.unsubscribe(iter2.next()); } } } diff --git a/test/net/java/sip/communicator/slick/protocol/msn/TestAccountInstallation.java b/test/net/java/sip/communicator/slick/protocol/msn/TestAccountInstallation.java index 703e9ae..73ec2de 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestAccountInstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestAccountInstallation.java @@ -78,9 +78,9 @@ public class TestAccountInstallation //Prepare the properties of the first msn account. - Hashtable msnAccount1Properties = getAccountProperties( + Hashtable<String, String> msnAccount1Properties = getAccountProperties( MsnProtocolProviderServiceLick.ACCOUNT_1_PREFIX); - Hashtable msnAccount2Properties = getAccountProperties( + Hashtable<String, String> msnAccount2Properties = getAccountProperties( MsnProtocolProviderServiceLick.ACCOUNT_2_PREFIX); //try to install an account with a null account id @@ -96,10 +96,10 @@ public class TestAccountInstallation //now really install the accounts msnProviderFactory.installAccount( - (String)msnAccount1Properties.get(ProtocolProviderFactory.USER_ID) + msnAccount1Properties.get(ProtocolProviderFactory.USER_ID) , msnAccount1Properties); msnProviderFactory.installAccount( - (String)msnAccount2Properties.get(ProtocolProviderFactory.USER_ID) + msnAccount2Properties.get(ProtocolProviderFactory.USER_ID) , msnAccount2Properties); @@ -107,7 +107,7 @@ public class TestAccountInstallation //excepion is thrown. try{ msnProviderFactory.installAccount( - (String)msnAccount1Properties.get(ProtocolProviderFactory.USER_ID) + msnAccount1Properties.get(ProtocolProviderFactory.USER_ID) , msnAccount1Properties); fail("An IllegalStateException must be thrown when trying to "+ @@ -130,7 +130,7 @@ public class TestAccountInstallation osgiFilter = "(&("+ProtocolProviderFactory.PROTOCOL +"="+ProtocolNames.MSN+")" +"(" + ProtocolProviderFactory.USER_ID - + "=" + (String)msnAccount1Properties.get( + + "=" + msnAccount1Properties.get( ProtocolProviderFactory.USER_ID) + "))"; @@ -166,9 +166,9 @@ public class TestAccountInstallation * @return a Hashtable that can be used when creating the account in a * protocol provider factory. */ - private Hashtable getAccountProperties(String accountPrefix) + private Hashtable<String, String> getAccountProperties(String accountPrefix) { - Hashtable table = new Hashtable(); + Hashtable<String, String> table = new Hashtable<String, String>(); String userID = System.getProperty( accountPrefix + ProtocolProviderFactory.USER_ID, null); diff --git a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetBasicInstantMessaging.java b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetBasicInstantMessaging.java index 329badb..1b02f24 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetBasicInstantMessaging.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetBasicInstantMessaging.java @@ -369,7 +369,7 @@ public class TestOperationSetBasicInstantMessaging */ private class ImEventCollector implements MessageListener { - private List collectedEvents = new LinkedList(); + private List<EventObject> collectedEvents = new LinkedList<EventObject>(); /** * Called when a new incoming <tt>Message</tt> has been received. * @param evt the <tt>MessageReceivedEvent</tt> containing the newly diff --git a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetPersistentPresence.java b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetPersistentPresence.java index 18d26d7..7d41f65 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetPersistentPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetPersistentPresence.java @@ -142,7 +142,8 @@ public class TestOperationSetPersistentPresence + "rootGroup.childGroups="+rootGroup.countSubgroups() + "Printing rootGroupContents=\n"+rootGroup.toString()); - Hashtable expectedContactList = fixture.preInstalledBuddyList; + Hashtable<String, List<String>> expectedContactList + = fixture.preInstalledBuddyList; logger.debug("============== Expected Contact List ==================="); logger.debug(expectedContactList); @@ -150,13 +151,12 @@ public class TestOperationSetPersistentPresence //Go through the contact list retrieved by the persistence presence set //and remove the name of every contact and group that we find there from //the expected contact list hashtable. - Iterator groups = rootGroup.subgroups(); + Iterator<ContactGroup> groups = rootGroup.subgroups(); while (groups.hasNext() ) { - ContactGroup group = (ContactGroup)groups.next(); - - List expectedContactsInGroup - = (List)expectedContactList.get(group.getGroupName()); + ContactGroup group = groups.next(); + List<String> expectedContactsInGroup + = expectedContactList.get(group.getGroupName()); // When sending the offline message // the sever creates a group NotInContactList, @@ -173,11 +173,10 @@ public class TestOperationSetPersistentPresence "the server but was not in the expected contact list." , expectedContactsInGroup); - Iterator contactsIter = group.contacts(); + Iterator<Contact> contactsIter = group.contacts(); while(contactsIter.hasNext()) { - String contactID = ((Contact)contactsIter.next()). - getAddress(); + String contactID = contactsIter.next().getAddress(); expectedContactsInGroup.remove(contactID); } @@ -379,7 +378,7 @@ public class TestOperationSetPersistentPresence logger.debug("tokens contained by the CL tokenized=" +tokenizer.countTokens()); - Hashtable contactListToCreate = new Hashtable(); + Hashtable<String, List<String>> contactListToCreate = new Hashtable<String, List<String>>(); //go over all group.uin tokens while (tokenizer.hasMoreTokens()) @@ -405,10 +404,10 @@ public class TestOperationSetPersistentPresence } //check if we've already seen this group and if not - add it - List uinInThisGroup = (List)contactListToCreate.get(groupName); + List<String> uinInThisGroup = contactListToCreate.get(groupName); if (uinInThisGroup == null) { - uinInThisGroup = new ArrayList(); + uinInThisGroup = new ArrayList<String>(); contactListToCreate.put(groupName, uinInThisGroup); } @@ -416,7 +415,7 @@ public class TestOperationSetPersistentPresence } // now init the list - Enumeration newGroupsEnum = contactListToCreate.keys(); + Enumeration <String>newGroupsEnum = contactListToCreate.keys(); GroupChangeCollector groupChangeCollector = new GroupChangeCollector(); opSetPersPresence1.addServerStoredGroupChangeListener(groupChangeCollector); @@ -424,7 +423,7 @@ public class TestOperationSetPersistentPresence //go over all groups in the contactsToAdd table while (newGroupsEnum.hasMoreElements()) { - String groupName = (String) newGroupsEnum.nextElement(); + String groupName = newGroupsEnum.nextElement(); logger.debug("Will add group " + groupName); groupChangeCollector.collectedEvents.clear(); @@ -437,11 +436,11 @@ public class TestOperationSetPersistentPresence ContactGroup newlyCreatedGroup = opSetPersPresence1.getServerStoredContactListRoot().getGroup(groupName); - Iterator contactsToAddToThisGroup - = ( (List) contactListToCreate.get(groupName)).iterator(); + Iterator<String> contactsToAddToThisGroup + = contactListToCreate.get(groupName).iterator(); while (contactsToAddToThisGroup.hasNext()) { - String id = (String) contactsToAddToThisGroup.next(); + String id = contactsToAddToThisGroup.next(); logger.debug("Will add buddy " + id); opSetPersPresence1.subscribe(newlyCreatedGroup, id); @@ -470,7 +469,7 @@ public class TestOperationSetPersistentPresence */ private class GroupChangeCollector implements ServerStoredGroupListener { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); /** * Blocks until at least one event is received or until waitFor @@ -568,7 +567,7 @@ public class TestOperationSetPersistentPresence */ private class SubscriptionEventCollector implements SubscriptionListener { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); /** * Blocks until at least one event is received or until waitFor diff --git a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetPresence.java b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetPresence.java index 8aab33c..1c6488c 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetPresence.java @@ -37,7 +37,6 @@ public class TestOperationSetPresence private MsnSlickFixture fixture = new MsnSlickFixture(); private OperationSetPresence operationSetPresence1 = null; private OperationSetPresence operationSetPresence2 = null; - private String statusMessageRoot = new String("Our status is now: "); public TestOperationSetPresence(String name) { @@ -151,17 +150,18 @@ public class TestOperationSetPresence { //first create a local list containing the presence status instances //supported by the underlying implementation. - Iterator supportedStatusSetIter = + Iterator<PresenceStatus> supportedStatusSetIter = operationSetPresence1.getSupportedStatusSet(); - List supportedStatusSet = new LinkedList(); + List<PresenceStatus> supportedStatusSet = new LinkedList<PresenceStatus>(); while (supportedStatusSetIter.hasNext()){ supportedStatusSet.add(supportedStatusSetIter.next()); } //create a copy of the MUST status set and remove any matching status //that is also present in the supported set. - List requiredStatusSetCopy = (List)MsnStatusEnum.msnStatusSet.clone(); + List<?> requiredStatusSetCopy + = (List<?>) MsnStatusEnum.msnStatusSet.clone(); requiredStatusSetCopy.removeAll(supportedStatusSet); @@ -333,7 +333,7 @@ public class TestOperationSetPresence { try { - Thread.currentThread().sleep(3000); + Thread.sleep(3000); } catch (InterruptedException ex) { @@ -410,12 +410,6 @@ public class TestOperationSetPresence logger.info("subtestQueryContactStatus for " + status + " Failed - trying again!"); - PresenceStatus tempStatus; - if(status.equals(MsnStatusEnum.ONLINE)) - tempStatus = MsnStatusEnum.AWAY; - else - tempStatus = MsnStatusEnum.ONLINE; - // reset the status so we can change it once again operationSetPresence2.publishPresenceStatus(status, "status message"); @@ -685,8 +679,8 @@ public class TestOperationSetPresence private class PresenceStatusEventCollector implements ProviderPresenceStatusListener { - public ArrayList collectedPresEvents = new ArrayList(); - public ArrayList collectedStatMsgEvents = new ArrayList(); + public ArrayList<EventObject> collectedPresEvents = new ArrayList<EventObject>(); + public ArrayList<EventObject> collectedStatMsgEvents = new ArrayList<EventObject>(); public void providerStatusChanged(ProviderPresenceStatusChangeEvent evt) { @@ -780,7 +774,7 @@ public class TestOperationSetPresence */ private class SubscriptionEventCollector implements SubscriptionListener { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); /** * Blocks until at least one event is received or until waitFor @@ -910,7 +904,7 @@ public class TestOperationSetPresence private class ContactPresenceEventCollector implements ContactPresenceStatusListener { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); private String trackedScreenName = null; private MsnStatusEnum status = null; diff --git a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetTypingNotifications.java b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetTypingNotifications.java index 4eb90e4..3f8f97c 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetTypingNotifications.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetTypingNotifications.java @@ -248,7 +248,7 @@ public class TestOperationSetTypingNotifications */ private class TypingEventCollector implements TypingNotificationsListener { - private List collectedEvents = new LinkedList(); + private List<EventObject> collectedEvents = new LinkedList<EventObject>(); /** * Called to indicate that a remote <tt>Contact</tt> has sent us a typing * notification. The method adds the <tt>event</tt> to the list of diff --git a/test/net/java/sip/communicator/slick/protocol/msn/TestProtocolProviderServiceMsnImpl.java b/test/net/java/sip/communicator/slick/protocol/msn/TestProtocolProviderServiceMsnImpl.java index 7eb3604..7194f31 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestProtocolProviderServiceMsnImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestProtocolProviderServiceMsnImpl.java @@ -171,7 +171,7 @@ public class TestProtocolProviderServiceMsnImpl public class RegistrationEventCollector implements RegistrationStateChangeListener { - public List collectedNewStates = new LinkedList(); + public List<RegistrationState> collectedNewStates = new LinkedList<RegistrationState>(); /** * The method would simply register all received events so that they diff --git a/test/net/java/sip/communicator/slick/protocol/rss/RssProtocolProviderServiceLick.java b/test/net/java/sip/communicator/slick/protocol/rss/RssProtocolProviderServiceLick.java index b72cee6..ff62a32 100755 --- a/test/net/java/sip/communicator/slick/protocol/rss/RssProtocolProviderServiceLick.java +++ b/test/net/java/sip/communicator/slick/protocol/rss/RssProtocolProviderServiceLick.java @@ -36,7 +36,7 @@ public class RssProtocolProviderServiceLick setName("RssProtocolProviderServiceLick"); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put("service.pid", getName()); RssSlickFixture.bc = bundleContext; diff --git a/test/net/java/sip/communicator/slick/protocol/rss/TestAccountInstallation.java b/test/net/java/sip/communicator/slick/protocol/rss/TestAccountInstallation.java index 7ba0a09..34f1a67 100755 --- a/test/net/java/sip/communicator/slick/protocol/rss/TestAccountInstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/rss/TestAccountInstallation.java @@ -50,7 +50,7 @@ public class TestAccountInstallation */ public void testInstallAccount() { - Hashtable accountProperties = new Hashtable(); + Hashtable<String, String> accountProperties = new Hashtable<String, String>(); ServiceReference[] serRefs = null; String osgiFilter = "(" + ProtocolProviderFactory.PROTOCOL + "=" diff --git a/test/net/java/sip/communicator/slick/protocol/rss/TestProtocolProviderServiceRssImpl.java b/test/net/java/sip/communicator/slick/protocol/rss/TestProtocolProviderServiceRssImpl.java index fa7148d..3b787f7 100755 --- a/test/net/java/sip/communicator/slick/protocol/rss/TestProtocolProviderServiceRssImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/rss/TestProtocolProviderServiceRssImpl.java @@ -153,7 +153,7 @@ public class TestProtocolProviderServiceRssImpl * We store all the received events in this list. It's made public to * ease later inspection by unit tests. */ - public List collectedStates = new LinkedList(); + public List<RegistrationState> collectedStates = new LinkedList<RegistrationState>(); /** * This method simply records all received events in a <code>List</code> diff --git a/test/net/java/sip/communicator/slick/protocol/sip/SipProtocolProviderServiceLick.java b/test/net/java/sip/communicator/slick/protocol/sip/SipProtocolProviderServiceLick.java index 6688b63..0c3775b 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/SipProtocolProviderServiceLick.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/SipProtocolProviderServiceLick.java @@ -59,7 +59,7 @@ public class SipProtocolProviderServiceLick { setName("SipProtocolProviderServiceLick"); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put("service.pid", getName()); SipSlickFixture.bc = context; diff --git a/test/net/java/sip/communicator/slick/protocol/sip/SipSlickFixture.java b/test/net/java/sip/communicator/slick/protocol/sip/SipSlickFixture.java index bb3e692..6c006e1 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/SipSlickFixture.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/SipSlickFixture.java @@ -79,16 +79,16 @@ public class SipSlickFixture * screen names. This is a snapshot of the server stored buddy list for * the account that is going to be used by the tested implementation. * It is filled in by the tester agent who'd login with that account - * and initialise the ss contact list before the tested implementation has + * and initialize the ss contact list before the tested implementation has * actually done so. */ - public static Hashtable preInstalledBuddyList = null; + public static Hashtable<String, List<String>> preInstalledBuddyList = null; /** * Initializes protocol provider references and whatever else there is to * initialize. * - * @throws java.lang.Exception in case we meet problems while retriving + * @throws java.lang.Exception in case we meet problems while retrieving * protocol providers through OSGI */ public void setUp() @@ -267,20 +267,20 @@ public class SipSlickFixture = opSetPersPresence1.getServerStoredContactListRoot(); // first delete the groups - Iterator iter = rootGroup1.subgroups(); - while (iter.hasNext()) + Iterator<ContactGroup> cgiter = rootGroup1.subgroups(); + while (cgiter.hasNext()) { - ContactGroup item = (ContactGroup) iter.next(); + ContactGroup item = cgiter.next(); opSetPersPresence1.removeServerStoredContactGroup(item); - iter = rootGroup1.subgroups(); + cgiter = rootGroup1.subgroups(); } //then delete contacts if any in root list - iter = rootGroup1.contacts(); - while (iter.hasNext()) + Iterator<Contact> citer = rootGroup1.contacts(); + while (citer.hasNext()) { - opSetPersPresence1.unsubscribe((Contact)iter.next()); - iter = rootGroup1.contacts(); + opSetPersPresence1.unsubscribe(citer.next()); + citer = rootGroup1.contacts(); } ContactGroup rootGroup2 @@ -288,19 +288,19 @@ public class SipSlickFixture // delete groups - iter = rootGroup2.subgroups(); - while (iter.hasNext()) + cgiter = rootGroup2.subgroups(); + while (cgiter.hasNext()) { - ContactGroup item = (ContactGroup) iter.next(); + ContactGroup item = cgiter.next(); opSetPersPresence2.removeServerStoredContactGroup(item); } //then delete contacts if any in root list - iter = rootGroup2.contacts(); - while (iter.hasNext()) + citer = rootGroup2.contacts(); + while (citer.hasNext()) { - opSetPersPresence2.unsubscribe( (Contact) iter.next()); - iter = rootGroup2.contacts(); + opSetPersPresence2.unsubscribe(citer.next()); + citer = rootGroup2.contacts(); } } } diff --git a/test/net/java/sip/communicator/slick/protocol/sip/TestAccountInstallation.java b/test/net/java/sip/communicator/slick/protocol/sip/TestAccountInstallation.java index 4fb79cd..90894a3 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestAccountInstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestAccountInstallation.java @@ -96,10 +96,10 @@ public class TestAccountInstallation //now really install the accounts sipProviderFactory.installAccount( - (String)sipAccount1Properties.get(ProtocolProviderFactory.USER_ID) + sipAccount1Properties.get(ProtocolProviderFactory.USER_ID) , sipAccount1Properties); sipProviderFactory.installAccount( - (String)sipAccount2Properties.get(ProtocolProviderFactory.USER_ID) + sipAccount2Properties.get(ProtocolProviderFactory.USER_ID) , sipAccount2Properties); @@ -107,7 +107,7 @@ public class TestAccountInstallation //excepion is thrown. try{ sipProviderFactory.installAccount( - (String)sipAccount1Properties.get(ProtocolProviderFactory.USER_ID) + sipAccount1Properties.get(ProtocolProviderFactory.USER_ID) , sipAccount1Properties); fail("An IllegalStateException must be thrown when trying to "+ @@ -130,7 +130,7 @@ public class TestAccountInstallation osgiFilter = "(&("+ProtocolProviderFactory.PROTOCOL +"="+ProtocolNames.SIP+")" +"(" + ProtocolProviderFactory.USER_ID - + "=" + (String)sipAccount1Properties.get( + + "=" + sipAccount1Properties.get( ProtocolProviderFactory.USER_ID) + "))"; diff --git a/test/net/java/sip/communicator/slick/protocol/sip/TestAccountUninstallation.java b/test/net/java/sip/communicator/slick/protocol/sip/TestAccountUninstallation.java index 49c3ada..f5c1a08 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestAccountUninstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestAccountUninstallation.java @@ -329,7 +329,7 @@ public class TestAccountUninstallation public class UnregistrationEventCollector implements RegistrationStateChangeListener { - public List collectedNewStates = new LinkedList(); + public List<RegistrationState> collectedNewStates = new LinkedList<RegistrationState>(); /** * The method would simply register all received events so that they diff --git a/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetBasicInstantMessaging.java b/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetBasicInstantMessaging.java index ad98b7b..061e5d6 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetBasicInstantMessaging.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetBasicInstantMessaging.java @@ -444,7 +444,7 @@ public class TestOperationSetBasicInstantMessaging */ private class ImEventCollector implements MessageListener { - private List collectedEvents = new LinkedList(); + private List<EventObject> collectedEvents = new LinkedList<EventObject>(); /** * Called when a new incoming <tt>Message</tt> has been received. * @param evt the <tt>MessageReceivedEvent</tt> containing the newly diff --git a/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetBasicTelephonySipImpl.java b/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetBasicTelephonySipImpl.java index e98a30c..4e607b7 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetBasicTelephonySipImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetBasicTelephonySipImpl.java @@ -122,9 +122,9 @@ public class TestOperationSetBasicTelephonySipImpl , 1, callAtP2.getCallPeerCount()); CallPeer peerAtP1 - = (CallPeer)callAtP1.getCallPeers().next(); + = callAtP1.getCallPeers().next(); CallPeer peerAtP2 - = (CallPeer)callAtP2.getCallPeers().next(); + = callAtP2.getCallPeers().next(); //now add listeners to the peers and make sure they have entered //the states they were expected to. @@ -352,9 +352,9 @@ public class TestOperationSetBasicTelephonySipImpl , 1, callAtP2.getCallPeerCount()); CallPeer peerAtP1 - = (CallPeer)callAtP1.getCallPeers().next(); + = callAtP1.getCallPeers().next(); CallPeer peerAtP2 - = (CallPeer)callAtP2.getCallPeers().next(); + = callAtP2.getCallPeers().next(); //now add listeners to the peers and make sure they have entered //the states they were expected to. @@ -589,9 +589,9 @@ public class TestOperationSetBasicTelephonySipImpl , 1, callAtP2.getCallPeerCount()); CallPeer peerAtP1 - = (CallPeer)callAtP1.getCallPeers().next(); + = callAtP1.getCallPeers().next(); CallPeer peerAtP2 - = (CallPeer)callAtP2.getCallPeers().next(); + = callAtP2.getCallPeers().next(); //now add listeners to the peers and make sure they have entered //the states they were expected to. @@ -751,7 +751,7 @@ public class TestOperationSetBasicTelephonySipImpl */ public class CallEventCollector implements CallListener { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); public OperationSetBasicTelephony listenedOpSet = null; /** @@ -859,7 +859,7 @@ public class TestOperationSetBasicTelephonySipImpl public class CallPeerStateEventCollector extends CallPeerAdapter { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); private CallPeer listenedCallPeer = null; public CallPeerState awaitedState = null; @@ -984,7 +984,7 @@ public class TestOperationSetBasicTelephonySipImpl public class CallStateEventCollector extends CallChangeAdapter { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); private Call listenedCall = null; public CallState awaitedState = null; diff --git a/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetPersistentPresence.java b/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetPersistentPresence.java index eaae996..c7ba59d 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetPersistentPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetPersistentPresence.java @@ -142,7 +142,8 @@ public class TestOperationSetPersistentPresence + "rootGroup.childGroups="+rootGroup.countSubgroups() + "Printing rootGroupContents=\n"+rootGroup.toString()); - Hashtable expectedContactList = fixture.preInstalledBuddyList; + Hashtable<String, List<String>> expectedContactList + = fixture.preInstalledBuddyList; logger.debug("============== Expected Contact List ==================="); logger.debug(expectedContactList); @@ -150,13 +151,12 @@ public class TestOperationSetPersistentPresence //Go through the contact list retrieved by the persistence presence set //and remove the name of every contact and group that we find there from //the expected contct list hashtable. - Iterator groups = rootGroup.subgroups(); + Iterator<ContactGroup> groups = rootGroup.subgroups(); while (groups.hasNext() ) { - ContactGroup group = (ContactGroup)groups.next(); - - List expectedContactsInGroup - = (List)expectedContactList.get(group.getGroupName()); + ContactGroup group = groups.next(); + List<String> expectedContactsInGroup + = expectedContactList.get(group.getGroupName()); // When sending the offline message // the sever creates a group NotInContactList, @@ -170,11 +170,10 @@ public class TestOperationSetPersistentPresence "the server but was not in the expected contact list." , expectedContactsInGroup); - Iterator contactsIter = group.contacts(); + Iterator<Contact> contactsIter = group.contacts(); while(contactsIter.hasNext()) { - String contactID = ((Contact)contactsIter.next()). - getAddress(); + String contactID = contactsIter.next().getAddress(); expectedContactsInGroup.remove(contactID); } @@ -391,7 +390,7 @@ public class TestOperationSetPersistentPresence logger.debug("tokens contained by the CL tokenized=" +tokenizer.countTokens()); - Hashtable contactListToCreate = new Hashtable(); + Hashtable<String, List<String>> contactListToCreate = new Hashtable<String, List<String>>(); //go over all group.uin tokens while (tokenizer.hasMoreTokens()) @@ -417,10 +416,10 @@ public class TestOperationSetPersistentPresence } //check if we've already seen this group and if not - add it - List uinInThisGroup = (List)contactListToCreate.get(groupName); + List<String> uinInThisGroup = contactListToCreate.get(groupName); if (uinInThisGroup == null) { - uinInThisGroup = new ArrayList(); + uinInThisGroup = new ArrayList<String>(); contactListToCreate.put(groupName, uinInThisGroup); } @@ -428,12 +427,12 @@ public class TestOperationSetPersistentPresence } // now init the list - Enumeration newGroupsEnum = contactListToCreate.keys(); + Enumeration<String> newGroupsEnum = contactListToCreate.keys(); //go over all groups in the contactsToAdd table while (newGroupsEnum.hasMoreElements()) { - String groupName = (String) newGroupsEnum.nextElement(); + String groupName = newGroupsEnum.nextElement(); logger.debug("Will add group " + groupName); this.opSetPersPresence1.createServerStoredContactGroup( @@ -443,11 +442,11 @@ public class TestOperationSetPersistentPresence this.opSetPersPresence1 .getServerStoredContactListRoot().getGroup(groupName); - Iterator contactsToAddToThisGroup - = ( (List) contactListToCreate.get(groupName)).iterator(); + Iterator<String> contactsToAddToThisGroup + = contactListToCreate.get(groupName).iterator(); while (contactsToAddToThisGroup.hasNext()) { - String id = (String) contactsToAddToThisGroup.next(); + String id = contactsToAddToThisGroup.next(); logger.debug("Will add buddy " + id); this.opSetPersPresence1.subscribe(newlyCreatedGroup, id); @@ -464,7 +463,7 @@ public class TestOperationSetPersistentPresence */ private class GroupChangeCollector implements ServerStoredGroupListener { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); /** * Blocks until at least one event is received or until waitFor diff --git a/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetPresence.java b/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetPresence.java index 15bb97a..38c9212 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetPresence.java @@ -274,7 +274,7 @@ public class TestOperationSetPresence { try { - Thread.currentThread().sleep(2000); + Thread.sleep(2000); } catch (InterruptedException ex) { @@ -537,7 +537,6 @@ public class TestOperationSetPresence { //iterate through all supported statuses and return the one with the //highest connectivity index. - PresenceStatus mostConnectedPresenceStatus = null; int mostConnectedPresenceStatusInt = Integer.MIN_VALUE; PresenceStatus secondMostConnectedPresenceStatus = null; int secondMostConnectedPresenceStatusInt = Integer.MIN_VALUE; @@ -552,7 +551,6 @@ public class TestOperationSetPresence if(supportedStatus.getStatus() > mostConnectedPresenceStatusInt) { mostConnectedPresenceStatusInt = supportedStatus.getStatus(); - mostConnectedPresenceStatus = supportedStatus; } else if(supportedStatus.getStatus() > secondMostConnectedPresenceStatusInt) { @@ -671,8 +669,8 @@ public class TestOperationSetPresence private class PresenceStatusEventCollector implements ProviderPresenceStatusListener { - public ArrayList collectedPresEvents = new ArrayList(); - public ArrayList collectedStatMsgEvents = new ArrayList(); + public ArrayList<EventObject> collectedPresEvents = new ArrayList<EventObject>(); + public ArrayList<EventObject> collectedStatMsgEvents = new ArrayList<EventObject>(); public void providerStatusChanged(ProviderPresenceStatusChangeEvent evt) { @@ -769,7 +767,7 @@ public class TestOperationSetPresence */ private class SubscriptionEventCollector implements SubscriptionListener { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); /** * Blocks until at least one event is received or until waitFor @@ -902,7 +900,7 @@ public class TestOperationSetPresence private class ContactPresenceEventCollector implements ContactPresenceStatusListener { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); private String trackedScreenName = null; private PresenceStatus status = null; diff --git a/test/net/java/sip/communicator/slick/protocol/sip/TestProtocolProviderServiceSipImpl.java b/test/net/java/sip/communicator/slick/protocol/sip/TestProtocolProviderServiceSipImpl.java index 091a484..4788d4e 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestProtocolProviderServiceSipImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestProtocolProviderServiceSipImpl.java @@ -170,7 +170,7 @@ public class TestProtocolProviderServiceSipImpl public class RegistrationEventCollector implements RegistrationStateChangeListener { - public List collectedNewStates = new LinkedList(); + public List<RegistrationState> collectedNewStates = new LinkedList<RegistrationState>(); /** * The method would simply register all received events so that they diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountInstallation.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountInstallation.java index 61a2afe..d45082a 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountInstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountInstallation.java @@ -78,9 +78,9 @@ public class TestAccountInstallation //Prepare the properties of the first yahoo account. - Hashtable yahooAccount1Properties = getAccountProperties( + Hashtable<String, String> yahooAccount1Properties = getAccountProperties( YahooProtocolProviderServiceLick.ACCOUNT_1_PREFIX); - Hashtable yahooAccount2Properties = getAccountProperties( + Hashtable<String, String> yahooAccount2Properties = getAccountProperties( YahooProtocolProviderServiceLick.ACCOUNT_2_PREFIX); //try to install an account with a null account id @@ -96,10 +96,10 @@ public class TestAccountInstallation //now really install the accounts yahooProviderFactory.installAccount( - (String)yahooAccount1Properties.get(ProtocolProviderFactory.USER_ID) + yahooAccount1Properties.get(ProtocolProviderFactory.USER_ID) , yahooAccount1Properties); yahooProviderFactory.installAccount( - (String)yahooAccount2Properties.get(ProtocolProviderFactory.USER_ID) + yahooAccount2Properties.get(ProtocolProviderFactory.USER_ID) , yahooAccount2Properties); @@ -107,7 +107,7 @@ public class TestAccountInstallation //excepion is thrown. try{ yahooProviderFactory.installAccount( - (String)yahooAccount1Properties.get(ProtocolProviderFactory.USER_ID) + yahooAccount1Properties.get(ProtocolProviderFactory.USER_ID) , yahooAccount1Properties); fail("An IllegalStateException must be thrown when trying to "+ @@ -130,7 +130,7 @@ public class TestAccountInstallation osgiFilter = "(&("+ProtocolProviderFactory.PROTOCOL +"="+ProtocolNames.YAHOO+")" +"(" + ProtocolProviderFactory.USER_ID - + "=" + (String)yahooAccount1Properties.get( + + "=" + yahooAccount1Properties.get( ProtocolProviderFactory.USER_ID) + "))"; @@ -166,9 +166,9 @@ public class TestAccountInstallation * @return a Hashtable that can be used when creating the account in a * protocol provider factory. */ - private Hashtable getAccountProperties(String accountPrefix) + private Hashtable<String, String> getAccountProperties(String accountPrefix) { - Hashtable table = new Hashtable(); + Hashtable<String, String> table = new Hashtable<String, String>(); String userID = System.getProperty( accountPrefix + ProtocolProviderFactory.USER_ID, null); diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetBasicInstantMessaging.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetBasicInstantMessaging.java index cc25a0b..67d0144 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetBasicInstantMessaging.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetBasicInstantMessaging.java @@ -379,7 +379,7 @@ public class TestOperationSetBasicInstantMessaging */ private class ImEventCollector implements MessageListener { - private List collectedEvents = new LinkedList(); + private List<EventObject> collectedEvents = new LinkedList<EventObject>(); /** * Called when a new incoming <tt>Message</tt> has been received. * @param evt the <tt>MessageReceivedEvent</tt> containing the newly diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPersistentPresence.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPersistentPresence.java index 7fdf536..772d8f1 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPersistentPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPersistentPresence.java @@ -139,7 +139,8 @@ public class TestOperationSetPersistentPresence + "rootGroup.childGroups="+rootGroup.countSubgroups() + "Printing rootGroupContents=\n"+rootGroup.toString()); - Hashtable expectedContactList = fixture.preInstalledBuddyList; + Hashtable<String, List<String>> expectedContactList + = fixture.preInstalledBuddyList; logger.debug("============== Expected Contact List ==================="); logger.debug(expectedContactList); @@ -147,17 +148,17 @@ public class TestOperationSetPersistentPresence //Go through the contact list retrieved by the persistence presence set //and remove the name of every contact and group that we find there from //the expected contct list hashtable. - Iterator groups = rootGroup.subgroups(); + Iterator<ContactGroup> groups = rootGroup.subgroups(); while (groups.hasNext() ) { - ContactGroup group = (ContactGroup)groups.next(); + ContactGroup group = groups.next(); - List expectedContactsInGroup - = (List)expectedContactList.get(group.getGroupName()); + List<String> expectedContactsInGroup + = expectedContactList.get(group.getGroupName()); // When sending the offline message // the sever creates a group NotInContactList, - // beacuse the buddy we are sending message to is not in + // because the buddy we are sending message to is not in // the contactlist. So this group must be ignored // Also we must ignore the group created by default // from the yahoo lib @@ -170,11 +171,10 @@ public class TestOperationSetPersistentPresence "the server but was not in the expected contact list." , expectedContactsInGroup); - Iterator contactsIter = group.contacts(); + Iterator<Contact> contactsIter = group.contacts(); while(contactsIter.hasNext()) { - String contactID = ((Contact)contactsIter.next()). - getAddress(); + String contactID = contactsIter.next().getAddress(); expectedContactsInGroup.remove(contactID); } @@ -378,7 +378,7 @@ public class TestOperationSetPersistentPresence logger.debug("tokens contained by the CL tokenized=" +tokenizer.countTokens()); - Hashtable contactListToCreate = new Hashtable(); + Hashtable<String, List<String>> contactListToCreate = new Hashtable<String, List<String>>(); //go over all group.uin tokens while (tokenizer.hasMoreTokens()) @@ -404,10 +404,10 @@ public class TestOperationSetPersistentPresence } //check if we've already seen this group and if not - add it - List uinInThisGroup = (List)contactListToCreate.get(groupName); + List<String> uinInThisGroup = contactListToCreate.get(groupName); if (uinInThisGroup == null) { - uinInThisGroup = new ArrayList(); + uinInThisGroup = new ArrayList<String>(); contactListToCreate.put(groupName, uinInThisGroup); } @@ -415,7 +415,7 @@ public class TestOperationSetPersistentPresence } // now init the list - Enumeration newGroupsEnum = contactListToCreate.keys(); + Enumeration<String> newGroupsEnum = contactListToCreate.keys(); GroupChangeCollector groupChangeCollector = new GroupChangeCollector(); opSetPersPresence1.addServerStoredGroupChangeListener(groupChangeCollector); @@ -423,7 +423,7 @@ public class TestOperationSetPersistentPresence //go over all groups in the contactsToAdd table while (newGroupsEnum.hasMoreElements()) { - String groupName = (String) newGroupsEnum.nextElement(); + String groupName = newGroupsEnum.nextElement(); logger.debug("Will add group " + groupName); opSetPersPresence1.createServerStoredContactGroup( @@ -434,11 +434,11 @@ public class TestOperationSetPersistentPresence ContactGroup newlyCreatedGroup = opSetPersPresence1.getServerStoredContactListRoot().getGroup(groupName); - Iterator contactsToAddToThisGroup - = ( (List) contactListToCreate.get(groupName)).iterator(); + Iterator<String> contactsToAddToThisGroup + = contactListToCreate.get(groupName).iterator(); while (contactsToAddToThisGroup.hasNext()) { - String id = (String) contactsToAddToThisGroup.next(); + String id = contactsToAddToThisGroup.next(); logger.debug("Will add buddy " + id); opSetPersPresence1.subscribe(newlyCreatedGroup, id); @@ -467,7 +467,7 @@ public class TestOperationSetPersistentPresence */ private class GroupChangeCollector implements ServerStoredGroupListener { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); /** * Blocks until at least one event is received or until waitFor diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPresence.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPresence.java index 20967d0..76a7a1e 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPresence.java @@ -165,17 +165,19 @@ public class TestOperationSetPresence { //first create a local list containing the presence status instances //supported by the underlying implementation. - Iterator supportedStatusSetIter = + Iterator<PresenceStatus> supportedStatusSetIter = operationSetPresence1.getSupportedStatusSet(); - List supportedStatusSet = new LinkedList(); + List<PresenceStatus> supportedStatusSet + = new LinkedList<PresenceStatus>(); while (supportedStatusSetIter.hasNext()){ supportedStatusSet.add(supportedStatusSetIter.next()); } //create a copy of the MUST status set and remove any matching status //that is also present in the supported set. - List requiredStatusSetCopy = (List)YahooStatusEnum.yahooStatusSet.clone(); + List<?> requiredStatusSetCopy + = (List<?>) YahooStatusEnum.yahooStatusSet.clone(); requiredStatusSetCopy.removeAll(supportedStatusSet); @@ -618,8 +620,8 @@ public class TestOperationSetPresence private class PresenceStatusEventCollector implements ProviderPresenceStatusListener { - public ArrayList collectedPresEvents = new ArrayList(); - public ArrayList collectedStatMsgEvents = new ArrayList(); + public ArrayList<EventObject> collectedPresEvents = new ArrayList<EventObject>(); + public ArrayList<EventObject> collectedStatMsgEvents = new ArrayList<EventObject>(); public void providerStatusChanged(ProviderPresenceStatusChangeEvent evt) { @@ -713,7 +715,7 @@ public class TestOperationSetPresence */ private class SubscriptionEventCollector implements SubscriptionListener { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); /** * Blocks until at least one event is received or until waitFor @@ -843,7 +845,7 @@ public class TestOperationSetPresence private class ContactPresenceEventCollector implements ContactPresenceStatusListener { - public ArrayList collectedEvents = new ArrayList(); + public ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); private String trackedScreenName = null; private YahooStatusEnum status = null; @@ -942,7 +944,7 @@ public class TestOperationSetPresence private void dumplists() { - // just wait a liitle all modification events to be received + // just wait a little all modification events to be received Object o = new Object(); synchronized(o) { @@ -954,13 +956,13 @@ public class TestOperationSetPresence logger.info("------------ START DUMP LIST " + fixture.userID1 + " ------------"); ContactGroup rootGroup = op1.getServerStoredContactListRoot(); - Iterator groups = rootGroup.subgroups(); + Iterator<ContactGroup> groups = rootGroup.subgroups(); while (groups.hasNext() ) { - ContactGroup group = (ContactGroup)groups.next(); + ContactGroup group = groups.next(); logger.info("group " + group.getGroupName()); - Iterator contactsIter = group.contacts(); + Iterator<Contact> contactsIter = group.contacts(); while(contactsIter.hasNext()) { logger.info("\tcontact " + contactsIter.next()); @@ -974,10 +976,10 @@ public class TestOperationSetPresence groups = rootGroup.subgroups(); while (groups.hasNext() ) { - ContactGroup group = (ContactGroup)groups.next(); + ContactGroup group = groups.next(); logger.info("group " + group.getGroupName()); - Iterator contactsIter = group.contacts(); + Iterator<Contact> contactsIter = group.contacts(); while(contactsIter.hasNext()) { logger.info("\tcontact " + contactsIter.next()); @@ -985,4 +987,4 @@ public class TestOperationSetPresence } logger.info("------------ END DUMP LIST " + fixture.userID2 + " ------------"); } -}
\ No newline at end of file +} diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetTypingNotifications.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetTypingNotifications.java index 14138dd..166b8d8 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetTypingNotifications.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetTypingNotifications.java @@ -251,7 +251,7 @@ public class TestOperationSetTypingNotifications */ private class TypingEventCollector implements TypingNotificationsListener { - private List collectedEvents = new LinkedList(); + private List<EventObject> collectedEvents = new LinkedList<EventObject>(); /** * Called to indicate that a remote <tt>Contact</tt> has sent us a typing * notification. The method adds the <tt>event</tt> to the list of diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestProtocolProviderServiceYahooImpl.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestProtocolProviderServiceYahooImpl.java index e32f9cf..a3b347d 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestProtocolProviderServiceYahooImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestProtocolProviderServiceYahooImpl.java @@ -170,7 +170,7 @@ public class TestProtocolProviderServiceYahooImpl public class RegistrationEventCollector implements RegistrationStateChangeListener { - public List collectedNewStates = new LinkedList(); + public List<RegistrationState> collectedNewStates = new LinkedList<RegistrationState>(); /** * The method would simply register all received events so that they diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/YahooProtocolProviderServiceLick.java b/test/net/java/sip/communicator/slick/protocol/yahoo/YahooProtocolProviderServiceLick.java index b527ca9..e3435b1 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/YahooProtocolProviderServiceLick.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/YahooProtocolProviderServiceLick.java @@ -59,7 +59,7 @@ public class YahooProtocolProviderServiceLick { setName("YahooProtocolProviderSlick"); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put("service.pid", getName()); YahooSlickFixture.bc = context; diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/YahooSlickFixture.java b/test/net/java/sip/communicator/slick/protocol/yahoo/YahooSlickFixture.java index 33371ed..10909c4 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/YahooSlickFixture.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/YahooSlickFixture.java @@ -81,17 +81,17 @@ public class YahooSlickFixture * screen names. This is a snapshot of the server stored buddy list for * the account that is going to be used by the tested implementation. * It is filled in by the tester agent who'd login with that account - * and initialise the ss contact list before the tested implementation has + * and initialize the ss contact list before the tested implementation has * actually done so. */ - public static Hashtable preInstalledBuddyList = null; + public static Hashtable<String, List<String>> preInstalledBuddyList = null; /** * Initializes protocol provider references and whatever else there is to * initialize. * - * @throws java.lang.Exception in case we meet problems while retriving + * @throws java.lang.Exception in case we meet problems while retrieving * protocol providers through OSGI */ public void setUp() @@ -262,8 +262,8 @@ public class YahooSlickFixture ContactGroup rootGroup1 = opSetPersPresence1.getServerStoredContactListRoot(); // first delete the groups - Vector groupsToRemove = new Vector(); - Iterator iter = rootGroup1.subgroups(); + Vector<ContactGroup> groupsToRemove = new Vector<ContactGroup>(); + Iterator<ContactGroup> iter = rootGroup1.subgroups(); while (iter.hasNext()) { groupsToRemove.add(iter.next()); @@ -272,14 +272,14 @@ public class YahooSlickFixture iter = groupsToRemove.iterator(); while (iter.hasNext()) { - ContactGroup item = (ContactGroup) iter.next(); + ContactGroup item = iter.next(); opSetPersPresence1.removeServerStoredContactGroup(item); } ContactGroup rootGroup2 = opSetPersPresence2.getServerStoredContactListRoot(); // delete groups - groupsToRemove = new Vector(); + groupsToRemove = new Vector<ContactGroup>(); iter = rootGroup2.subgroups(); while (iter.hasNext()) { @@ -289,7 +289,7 @@ public class YahooSlickFixture iter = groupsToRemove.iterator(); while (iter.hasNext()) { - ContactGroup item = (ContactGroup) iter.next(); + ContactGroup item = iter.next(); opSetPersPresence2.removeServerStoredContactGroup(item); } diff --git a/test/net/java/sip/communicator/slick/runner/XmlFormatter.java b/test/net/java/sip/communicator/slick/runner/XmlFormatter.java index 37a9450..7edb772 100644 --- a/test/net/java/sip/communicator/slick/runner/XmlFormatter.java +++ b/test/net/java/sip/communicator/slick/runner/XmlFormatter.java @@ -63,15 +63,15 @@ public class XmlFormatter extends ResultPrinter implements XMLConstants { /** * Element for the current test. */ - private Hashtable testElements = new Hashtable(); + private Hashtable<Test, Element> testElements = new Hashtable<Test, Element>(); /** * tests that failed. */ - private Hashtable failedTests = new Hashtable(); + private Hashtable<Test, Test> failedTests = new Hashtable<Test, Test>(); /** * Timing helper. */ - private Hashtable testStarts = new Hashtable(); + private Hashtable<Test, Long> testStarts = new Hashtable<Test, Long>(); /** * Where to write the log to. */ @@ -113,7 +113,7 @@ public class XmlFormatter extends ResultPrinter implements XMLConstants { if (props != null) { - Enumeration e = props.propertyNames(); + Enumeration<?> e = props.propertyNames(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); @@ -214,10 +214,10 @@ public class XmlFormatter extends ResultPrinter implements XMLConstants { rootElement.appendChild(currentTest); testElements.put(test, currentTest); } else { - currentTest = (Element) testElements.get(test); + currentTest = testElements.get(test); } - Long l = (Long) testStarts.get(test); + Long l = testStarts.get(test); currentTest.setAttribute(ATTR_TIME, "" + ((System.currentTimeMillis() - l.longValue()) / 1000.0)); } @@ -264,7 +264,7 @@ public class XmlFormatter extends ResultPrinter implements XMLConstants { Element currentTest = null; if (test != null) { - currentTest = (Element) testElements.get(test); + currentTest = testElements.get(test); } else { currentTest = rootElement; } diff --git a/test/net/java/sip/communicator/slick/slickless/SlicklessTests.java b/test/net/java/sip/communicator/slick/slickless/SlicklessTests.java index 08d73cf..b24440e 100644 --- a/test/net/java/sip/communicator/slick/slickless/SlicklessTests.java +++ b/test/net/java/sip/communicator/slick/slickless/SlicklessTests.java @@ -45,7 +45,7 @@ public class SlicklessTests { bc = bundleContext; setName("SlicklessTests"); - Hashtable properties = new Hashtable(); + Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put("service.pid", getName()); addTest(createSuite()); @@ -107,9 +107,9 @@ public class SlicklessTests { try { - Class testClass = Class.forName(testName); + Class<?> testClass = Class.forName(testName); if ((bc == null) - && (BundleActivator.class.isAssignableFrom(testClass))) + && BundleActivator.class.isAssignableFrom(testClass)) { logger.error("test " + testName + " skipped - it must run under felix"); @@ -126,5 +126,5 @@ public class SlicklessTests } } return suite; -} + } } |