diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2009-09-02 10:40:06 +0000 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2009-09-02 10:40:06 +0000 |
commit | c7e4952a8f8f1f35ba3397c2f9c76593039cf1a3 (patch) | |
tree | e31537f4f524656809fe4775d8f7e33a4776298c /test | |
parent | 400fe1b68bcc3dbd72733053193fc6722e3a8451 (diff) | |
download | jitsi-c7e4952a8f8f1f35ba3397c2f9c76593039cf1a3.zip jitsi-c7e4952a8f8f1f35ba3397c2f9c76593039cf1a3.tar.gz jitsi-c7e4952a8f8f1f35ba3397c2f9c76593039cf1a3.tar.bz2 |
Commits the second patch of Sebastien Vincent in the dev mailing list thread "Fix lot of warnings in the code" which fixes multiple compiler warnings.
Diffstat (limited to 'test')
5 files changed, 114 insertions, 170 deletions
diff --git a/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java b/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java index db01212..3db3d3b 100644 --- a/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java +++ b/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java @@ -165,7 +165,7 @@ public class TestCallHistoryService iter = v.iterator(); while (iter.hasNext()) { - CallPeer item = (CallPeer) iter.next(); + CallPeer item = iter.next(); mockBTelphonyOpSet.hangupCallPeer(item); } } @@ -212,14 +212,14 @@ public class TestCallHistoryService assertEquals("Calls must be 2", rs.size(), 2); - CallRecord rec = (CallRecord)resultIter.next(); + CallRecord rec = resultIter.next(); CallPeerRecord participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). equals(participantAddresses.get(2))); - rec = (CallRecord)resultIter.next(); + rec = resultIter.next(); participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", @@ -234,7 +234,7 @@ public class TestCallHistoryService assertEquals("Calls must be 1", rs.size(), 1); - rec = (CallRecord)resultIter.next(); + rec = resultIter.next(); participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", @@ -249,21 +249,21 @@ public class TestCallHistoryService assertEquals("Calls must be 3", rs.size(), 3); - rec = (CallRecord)resultIter.next(); + rec = resultIter.next(); participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). equals(participantAddresses.get(3))); - rec = (CallRecord)resultIter.next(); + rec = resultIter.next(); participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", participant.getPeerAddress(). equals(participantAddresses.get(2))); - rec = (CallRecord)resultIter.next(); + rec = resultIter.next(); participant = rec.getPeerRecords().get(0); assertTrue("Participant incorrect ", @@ -304,7 +304,7 @@ public class TestCallHistoryService iter = v.iterator(); while (iter.hasNext()) { - CallPeer item = (CallPeer) iter.next(); + CallPeer item = iter.next(); mockBTelphonyOpSet.hangupCallPeer(item); } } diff --git a/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java b/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java index f2d5e30..641a859 100644 --- a/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java +++ b/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java @@ -300,7 +300,7 @@ public class TestMetaHistoryService iter = v.iterator(); while (iter.hasNext()) { - CallPeer item = (CallPeer) iter.next(); + CallPeer item = iter.next(); mockBTelphonyOpSet.hangupCallPeer(item); } } @@ -704,7 +704,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( 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 22e3871..c00ad3b 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/FullUserInfoCmd.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/FullUserInfoCmd.java @@ -166,8 +166,7 @@ public class FullUserInfoCmd private Hashtable<String, Object> getInfoForRequest(int requestID) { Hashtable<String, Object> res - = (Hashtable<String, Object>) - retreivedInfo.get(new Integer(requestID)); + = retreivedInfo.get(new Integer(requestID)); if (res == null) { 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 605df86..f7fcfe5 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java @@ -24,13 +24,10 @@ import net.kano.joscar.snaccmd.ssi.*; import net.kano.joscar.tlv.*; import net.kano.joustsim.*; import net.kano.joustsim.oscar.*; -import net.kano.joustsim.oscar.State; import net.kano.joustsim.oscar.oscar.service.bos.*; import net.kano.joustsim.oscar.oscar.service.buddy.*; import net.kano.joustsim.oscar.oscar.service.icbm.*; -import net.kano.joustsim.oscar.oscar.service.info.*; import net.kano.joustsim.oscar.oscar.service.ssi.*; -import net.kano.joustsim.trust.*; /** * An utility that we use to test AIM/ICQ implementations of the @@ -656,18 +653,16 @@ public class IcqTesterAgent public Object extraInfoLock = new Object(); public Object infoLock = new Object(); - public List lastExtraInfos = null; public FullUserInfo lastUserInfo = null; /** * Saves the extraInfos list and calls a notifyAll on the extraInfoLock * @param extraInfos the list of extraInfos that the AIM server sent */ - public void handleYourExtraInfo(List extraInfos) + public void handleYourExtraInfo(List<ExtraInfoBlock> extraInfos) { logger.debug("Bosiat.extrainfo=" + extraInfos); synchronized(extraInfoLock){ - lastExtraInfos = extraInfos; extraInfoLock.notifyAll(); } } @@ -697,7 +692,7 @@ public class IcqTesterAgent { public Vector<Group> addedGroups = new Vector<Group>(); public Vector<Buddy> addedBuddies = new Vector<Buddy>(); - public Vector removedBuddies = new Vector(); + public Vector<Buddy> removedBuddies = new Vector<Buddy>(); /** * The method would wait until at least one new buddy is collected by @@ -807,22 +802,28 @@ public class IcqTesterAgent } //we don't use this one so far. - public void groupsReordered(BuddyList list, List oldOrder, List newOrder) + public void groupsReordered( + BuddyList list, + List<? extends Group> oldOrder, + List<? extends Group> newOrder) { logger.debug("groupsReordered"); } //we don't use this one so far. - public void groupRemoved(BuddyList list, - List oldItems, List newItems, Group group) + public void groupRemoved( + BuddyList list, + List<? extends Group> oldItems, + List<? extends Group> newItems, + Group group) { logger.debug("removedGroup="+group.getName()); } // we don't use this one so far. public void buddyRemoved(BuddyList list, Group group, - List oldItems, - List newItems, + List<? extends Buddy> oldItems, + List<? extends Buddy> newItems, Buddy buddy) { logger.debug("removed buddy=" + buddy); @@ -830,8 +831,8 @@ public class IcqTesterAgent //we don't use this one public void buddiesReordered(BuddyList list, Group group, - List oldBuddies, - List newBuddies) + List<? extends Buddy> oldBuddies, + List<? extends Buddy> newBuddies) { logger.debug("buddiesReordered in group " + group.getName()); } @@ -844,7 +845,7 @@ public class IcqTesterAgent { System.out.println("BuddyListener.gotBuddyStatus " + buddy.toString() +" and status is : " + info.getIcqStatus()); - List eInfoBlocks = info.getExtraInfoBlocks(); + List<ExtraInfoBlock> eInfoBlocks = info.getExtraInfoBlocks(); if (eInfoBlocks != null) { System.out.println("printing extra info blocks (" @@ -907,71 +908,36 @@ public class IcqTesterAgent } - private class ServiceListener implements OpenedServiceListener - { - - public void closedServices(AimConnection conn, Collection services) - { - - } - - public void openedServices(AimConnection conn, Collection services) - { - conn.getBuddyInfoManager().addGlobalBuddyInfoListener(new GlobalBuddyListener()); - conn.getBuddyService().addBuddyListener(new BuddyListener()); - } - - } - - private static class InfoRespListener implements InfoResponseListener{ - - public void handleAwayMessage(InfoService service, Screenname buddy, - String awayMessage) - { - System.out.println("InfoResponseListener.handleAwayMessage " + awayMessage); - } - - public void handleCertificateInfo(InfoService service, - Screenname buddy, - BuddyCertificateInfo certInfo) - { - System.out.println("InfoResponseListener.handleCertificateInfo " + certInfo); - } - - public void handleDirectoryInfo(InfoService service, - Screenname buddy, DirInfo dirInfo) - { - System.out.println("InfoResponseListener.handleDirectoryInfo " + dirInfo); - } - - public void handleUserProfile(InfoService service, Screenname buddy, - String userInfo) - { - System.out.println("InfoResponseListener.handleUserProfile " + userInfo); - } - - public void handleInvalidCertificates(InfoService service, - Screenname buddy, - CertificateInfo origCertInfo, - Throwable ex) - { - System.out.println("InfoResponseListener.handleInvalidCertificates " + origCertInfo); - } - - } +// private class ServiceListener +// implements OpenedServiceListener +// { +// public void closedServices(AimConnection conn, Collection services) +// { +// } +// +// public void openedServices(AimConnection conn, Collection services) +// { +// conn.getBuddyInfoManager() +// .addGlobalBuddyInfoListener(new GlobalBuddyListener()); +// conn.getBuddyService().addBuddyListener(new BuddyListener()); +// } +// } private class RetroListener implements BuddyListLayoutListener, GroupListener { - public void groupsReordered(BuddyList list, List oldOrder, - List newOrder) + public void groupsReordered(BuddyList list, + List<? extends Group> oldOrder, + List<? extends Group> newOrder) { System.out.println(" RetroListener.groupReordered"); } - 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) { System.out.println("RetroListener.groupAdded"); System.out.println(" group.name is="+group.getName()); @@ -989,36 +955,42 @@ public class IcqTesterAgent group.addGroupListener(this); } - public void groupRemoved(BuddyList list, List oldItems, - List newItems, - Group group) + public void groupRemoved(BuddyList list, + List<? extends Group> oldItems, + List<? extends Group> newItems, + Group group) { System.out.println(" RetroListener.groupRemoved"); } - 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) { System.out.println(" RetroListener.buddyAdded="+buddy); } - public void buddyRemoved(BuddyList list, Group group, - List oldItems, - List newItems, - Buddy buddy) + public void buddyRemoved(BuddyList list, + Group group, + List<? extends Buddy> oldItems, + List<? extends Buddy> newItems, + Buddy buddy) { System.out.println(" RetroListener.buddyRemoved"+buddy); } - public void buddiesReordered(BuddyList list, Group group, - List oldBuddies, - List newBuddies) + public void buddiesReordered(BuddyList list, + Group group, + List<? extends Buddy> oldBuddies, + List<? extends Buddy> newBuddies) { System.out.println(" RetroListener.buddiesReordered"); } - public void groupNameChanged(Group group, String oldName, + public void groupNameChanged(Group group, + String oldName, String newName) { System.out.println( @@ -1028,23 +1000,22 @@ public class IcqTesterAgent + newName + " group is="+group.getName()); System.out.println("GroupContains="+group.getBuddiesCopy()); - } - } ////////////////////////// ugly unused testing code ////////////////////////// private RetroListener rl = new RetroListener(); public static void main(String[] args) throws Throwable { -java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level.FINEST); + java.util.logging.Logger.getLogger("net.kano") + .setLevel(java.util.logging.Level.FINEST); + IcqTesterAgent icqtests = new IcqTesterAgent("319305099"); if (!icqtests.register("6pC0mmtt")) { System.out.println("registration failed"); ; return; } - MainBosService bos = icqtests.conn.getBosService(); Thread.sleep(1000); icqtests.conn.getSsiService() .getBuddyList().addRetroactiveLayoutListener(icqtests.rl); @@ -1056,19 +1027,13 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. MutableBuddyList list = icqtests.conn.getSsiService().getBuddyList(); - MutableGroup dupeGroup = null; MutableGroup grpGroup = null; Buddy buddyToMove = null; - List groups = list.getGroups(); - Iterator groupsIter = groups.iterator(); - while(groupsIter.hasNext()) + for (Group group : list.getGroups()) { - MutableGroup group = (MutableGroup)groupsIter.next(); - if (group.getName().equals("dupe")) - dupeGroup = group; if (group.getName().equals("grp")) - grpGroup = group; + grpGroup = (MutableGroup) group; List<? extends Buddy> buddies = group.getBuddiesCopy(); System.out.println("Printing buddies for group " + group.getName()); Thread.sleep(1000); @@ -1091,10 +1056,8 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. //find the buddy again. Buddy movedBuddy = null; - groupsIter = list.getGroups().iterator(); - while(groupsIter.hasNext()) + for (Group group : list.getGroups()) { - MutableGroup group = (MutableGroup)groupsIter.next(); List<? extends Buddy> buddies = group.getBuddiesCopy(); for (Buddy buddy : buddies) { @@ -1105,28 +1068,6 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. if (buddyToMove == movedBuddy) System.out.println("hahaha"); - - } - - private class TestSnacCmd extends SnacCommand - { - /** The SNAC family code for the location family. */ - public static final int FAMILY_ICQ = 0x0015; - - protected TestSnacCmd(int command) { - super(FAMILY_ICQ, command); - } - - /** - * Writes this command's SNAC data block to the given stream. The SNAC data - * block is the data after the first ten bytes of a SNAC packet. - * - * @param out the stream to which to write the SNAC data - * @throws IOException if an I/O error occurs - */ - public void writeData(OutputStream out) throws IOException - { - } } public void deleteBuddy(String screenname) @@ -1331,7 +1272,7 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. extends ServerSsiCmdFactory implements SnacResponseListener { - List SUPPORTED_TYPES = null; + List<CmdType> SUPPORTED_TYPES = null; public String responseReasonStr = null; public String requestReasonStr = null; @@ -1342,15 +1283,15 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. public AuthCmdFactory() { - List types = super.getSupportedTypes(); - ArrayList tempTypes = new ArrayList(types); + List<CmdType> types = super.getSupportedTypes(); + ArrayList<CmdType> tempTypes = new ArrayList<CmdType>(types); tempTypes.add(new CmdType(SsiCommand.FAMILY_SSI, 0x001b)); // 1b auth request reply tempTypes.add(new CmdType(SsiCommand.FAMILY_SSI, 0x0019)); // 19 auth request this.SUPPORTED_TYPES = DefensiveTools.getUnmodifiable(tempTypes); } - public List getSupportedTypes() + public List<CmdType> getSupportedTypes() {return SUPPORTED_TYPES;} public SnacCommand genSnacCommand(SnacPacket packet) @@ -1402,9 +1343,9 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. (SsiDataModResponse) e.getSnacCommand(); int[] results = dataModResponse.getResults(); - List items = ( (ItemsCmd) e.getRequest().getCommand()). + List<SsiItem> items = ( (ItemsCmd) e.getRequest().getCommand()). getItems(); - items = new LinkedList(items); + items = new LinkedList<SsiItem>(items); for (int i = 0; i < results.length; i++) { @@ -1415,11 +1356,11 @@ java.util.logging.Logger.getLogger("net.kano").setLevel(java.util.logging.Level. isErrorAddingReceived = true; // authorisation required for user - SsiItem buddyItem = (SsiItem) items.get(i); + SsiItem buddyItem = items.get(i); String uinToAskForAuth = buddyItem.getName(); - Vector buddiesToBeAdded = new Vector(); + Vector<SsiItem> buddiesToBeAdded = new Vector<SsiItem>(); BuddyAwaitingAuth newBuddy = new BuddyAwaitingAuth( buddyItem); diff --git a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetServerStoredInfo.java b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetServerStoredInfo.java index d65f588..225df3e 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetServerStoredInfo.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetServerStoredInfo.java @@ -10,6 +10,7 @@ import java.util.*; import junit.framework.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.service.protocol.ServerStoredDetails.*; import net.java.sip.communicator.util.*; /** @@ -192,14 +193,15 @@ public class TestOperationSetServerStoredInfo = opSetPresence.findContactByID(fixture.testerAgent.getIcqUIN()); // Get the last name info - Iterator iter = + Iterator<GenericDetail> iter = opSetServerStoredContactInfo. getDetails(testerAgentContact, ServerStoredDetails.LastNameDetail.class); while (iter.hasNext()) { - ServerStoredDetails.LastNameDetail item = (ServerStoredDetails.LastNameDetail) iter.next(); + ServerStoredDetails.LastNameDetail item + = (ServerStoredDetails.LastNameDetail) iter.next(); assertEquals("The LastName we set is not set or not read properly" , item.getName() @@ -227,10 +229,11 @@ public class TestOperationSetServerStoredInfo opSetServerStoredContactInfo. getDetails(testerAgentContact, ServerStoredDetails.SpokenLanguageDetail.class); - ArrayList spokenLanguagesServer = new ArrayList(); + List<Locale> spokenLanguagesServer = new ArrayList<Locale>(); while (iter.hasNext()) { - ServerStoredDetails.SpokenLanguageDetail item = (ServerStoredDetails.SpokenLanguageDetail)iter.next(); + ServerStoredDetails.SpokenLanguageDetail item + = (ServerStoredDetails.SpokenLanguageDetail)iter.next(); spokenLanguagesServer.add(item.getLocale()); } @@ -254,7 +257,8 @@ public class TestOperationSetServerStoredInfo ServerStoredDetails.CountryDetail.class); while (iter.hasNext()) { - ServerStoredDetails.CountryDetail item = (ServerStoredDetails.CountryDetail) iter.next(); + ServerStoredDetails.CountryDetail item + = (ServerStoredDetails.CountryDetail) iter.next(); logger.info("read item value: " + item.getLocale().getDisplayCountry()); @@ -282,7 +286,7 @@ public class TestOperationSetServerStoredInfo ServerStoredDetails.CountryDetail homeCountryDetail = null; // Get Last name info detail - Iterator iter = + Iterator<GenericDetail> iter = opSetServerStoredAccountInfo. getDetails(ServerStoredDetails.LastNameDetail.class); if (iter.hasNext()) @@ -485,7 +489,7 @@ public class TestOperationSetServerStoredInfo logger.trace("Proceeding to Testing values!"); // make the tests here - Hashtable userInfo = fixture.testerAgent.getUserInfo(fixture.ourUserID); + Hashtable<String, Object> userInfo = fixture.testerAgent.getUserInfo(fixture.ourUserID); assertEquals("The LastName we set is not set or not read properly" , newLastName @@ -495,13 +499,17 @@ public class TestOperationSetServerStoredInfo , newPhoneNumber , userInfo.get(FullUserInfoCmd.PHONE_NUMBER)); - ArrayList languageCodes = (ArrayList)userInfo.get(FullUserInfoCmd.SPEAK_LANG); - ArrayList languages = new ArrayList(); + List<?> languageCodes + = (ArrayList<?>) userInfo.get(FullUserInfoCmd.SPEAK_LANG); + ArrayList<Locale> languages = new ArrayList<Locale>(); // convert language codes to locales in the list - iter = languageCodes.iterator(); - while (iter.hasNext()) + Iterator<?> languageCodeIter = languageCodes.iterator(); + while (languageCodeIter.hasNext()) { - languages.add(spokenLanguages[((Integer)iter.next()).intValue()]); + languages + .add( + spokenLanguages[ + ((Integer) languageCodeIter.next()).intValue()]); } // assertEquals("The number of spoken languages dowsn't match", // newLanguages.length, @@ -525,15 +533,14 @@ public class TestOperationSetServerStoredInfo */ public void errorHandling() { - Iterator iter = + Iterator<GenericDetail> iter = opSetServerStoredAccountInfo. getDetails(ServerStoredDetails.SpokenLanguageDetail.class); - ArrayList initialLanguages = new ArrayList(); + ArrayList<GenericDetail> initialLanguages + = new ArrayList<GenericDetail>(); while (iter.hasNext()) - { initialLanguages.add(iter.next()); - } assertEquals("There must be 3 language details!", 3, initialLanguages.size()); @@ -607,23 +614,22 @@ public class TestOperationSetServerStoredInfo try { - Iterator iter = + Iterator<GenericDetail> iter = opSetServerStoredAccountInfo. getDetails(ServerStoredDetails.SpokenLanguageDetail.class); - ArrayList initialLanguages = new ArrayList(); + List<GenericDetail> initialLanguages + = new ArrayList<GenericDetail>(); while (iter.hasNext()) - { initialLanguages.add(iter.next()); - } // now remove those languages iter = initialLanguages.iterator(); while (iter.hasNext()) { - assertTrue("Error removing language!", - opSetServerStoredAccountInfo.removeDetail( - (ServerStoredDetails.SpokenLanguageDetail)iter.next())); + assertTrue( + "Error removing language!", + opSetServerStoredAccountInfo.removeDetail(iter.next())); synchronized (lock) { try{ @@ -648,14 +654,12 @@ public class TestOperationSetServerStoredInfo opSetServerStoredAccountInfo. getDetails(ServerStoredDetails.SpokenLanguageDetail.class); - ArrayList languages = new ArrayList(); + List<GenericDetail> languages = new ArrayList<GenericDetail>(); while (iter.hasNext()) - { languages.add(iter.next()); - } logger.trace("languages " + languages.size()); - // there must be no languages after the last retreive + // there must be no languages after the last retrieve assertEquals("There must be no language details!", 0, languages.size()); } catch (OperationFailedException ex) |