From 331d75a93a6f83444b5d295c1697d6e707c19d46 Mon Sep 17 00:00:00 2001 From: Lyubomir Marinov Date: Tue, 9 Dec 2008 20:45:16 +0000 Subject: [PATCH] Eliminates duplication of ProtocolProviderService.getOperationSet() and .getSupportedOperationSets() for all protocol implementations by moving the implementations into AbstractProtocolProviderService. Uses .getOperationSet() instead of .getSupportedOperationSets() where appropriate in order to produce less garbage (due to Hashtable cloning). --- .../callhistory/CallHistoryServiceImpl.java | 15 ++-- .../MetaContactListServiceImpl.java | 69 +++++++++---------- .../GrowlNotificationServiceImpl.java | 14 ++-- .../contactlist/ContactRightButtonMenu.java | 22 +++--- .../msghistory/MessageHistoryServiceImpl.java | 29 ++++---- .../dict/ProtocolProviderServiceDictImpl.java | 36 ---------- .../ProtocolProviderServiceGibberishImpl.java | 36 ---------- ...rationSetBasicInstantMessagingIcqImpl.java | 6 +- .../icq/OperationSetMultiUserChatIcqImpl.java | 7 +- ...OperationSetPersistentPresenceIcqImpl.java | 5 +- ...perationSetTypingNotificationsIcqImpl.java | 7 +- .../icq/ProtocolProviderServiceIcqImpl.java | 32 --------- .../irc/ProtocolProviderServiceIrcImpl.java | 36 +--------- ...ionSetBasicInstantMessagingJabberImpl.java | 6 +- ...ationSetTypingNotificationsJabberImpl.java | 6 +- .../ProtocolProviderServiceJabberImpl.java | 36 +--------- .../impl/protocol/mock/MockProvider.java | 7 +- ...rationSetBasicInstantMessagingMsnImpl.java | 6 +- .../msn/OperationSetMultiUserChatMsnImpl.java | 10 ++- ...perationSetTypingNotificationsMsnImpl.java | 6 +- .../msn/ProtocolProviderServiceMsnImpl.java | 32 --------- .../rss/ProtocolProviderServiceRssImpl.java | 40 +---------- ...rationSetBasicInstantMessagingSipImpl.java | 6 +- ...perationSetTypingNotificationsSipImpl.java | 9 +-- .../sip/ProtocolProviderServiceSipImpl.java | 68 ++---------------- .../ssh/ProtocolProviderServiceSSHImpl.java | 45 ++---------- ...tionSetBasicInstantMessagingYahooImpl.java | 6 +- .../OperationSetMultiUserChatYahooImpl.java | 8 +-- ...rationSetTypingNotificationsYahooImpl.java | 6 +- .../ProtocolProviderServiceYahooImpl.java | 33 --------- .../protocol/zeroconf/BonjourService.java | 6 +- .../impl/protocol/zeroconf/ClientThread.java | 16 +++-- .../ProtocolProviderServiceZeroconfImpl.java | 36 ---------- .../chatalerter/ChatAlerterActivator.java | 35 ++++------ .../communicator/plugin/mailbox/Mailbox.java | 14 ++-- .../AbstractProtocolProviderService.java | 45 ++++++++++++ .../protocol/ProtocolProviderService.java | 7 +- .../callhistory/TestCallHistoryService.java | 7 +- .../slick/contactlist/MclSlickFixture.java | 14 ++-- .../MetaContactListServiceLick.java | 14 ++-- .../contactlist/TestMetaContactGroup.java | 7 +- .../TestMetaContactListPersistence.java | 48 ++++++------- .../msghistory/TestMsgHistoryService.java | 2 +- .../gibberish/GibberishSlickFixture.java | 6 +- ...TestOperationSetBasicInstantMessaging.java | 5 +- .../TestOperationSetPersistentPresence.java | 7 +- .../gibberish/TestOperationSetPresence.java | 4 +- .../TestOperationSetTypingNotifications.java | 4 +- ...tProtocolProviderServiceGibberishImpl.java | 21 +++--- ...TestOperationSetBasicInstantMessaging.java | 2 +- .../TestOperationSetPersistentPresence.java | 2 +- .../icq/TestOperationSetPresence.java | 2 +- .../icq/TestOperationSetServerStoredInfo.java | 2 +- .../TestOperationSetTypingNotifications.java | 2 +- .../TestProtocolProviderServiceIcqImpl.java | 28 ++++---- .../protocol/jabber/JabberSlickFixture.java | 7 +- ...TestOperationSetBasicInstantMessaging.java | 4 +- .../jabber/TestOperationSetMultiUserChat.java | 4 +- .../TestOperationSetPersistentPresence.java | 6 +- .../jabber/TestOperationSetPresence.java | 4 +- .../TestOperationSetTypingNotifications.java | 4 +- ...TestProtocolProviderServiceJabberImpl.java | 21 +++--- .../slick/protocol/msn/MsnSlickFixture.java | 8 ++- ...TestOperationSetBasicInstantMessaging.java | 4 +- .../TestOperationSetPersistentPresence.java | 6 +- .../msn/TestOperationSetPresence.java | 4 +- .../TestOperationSetTypingNotifications.java | 4 +- .../TestProtocolProviderServiceMsnImpl.java | 22 +++--- .../TestProtocolProviderServiceRssImpl.java | 29 ++++---- .../slick/protocol/sip/SipSlickFixture.java | 6 +- ...TestOperationSetBasicInstantMessaging.java | 4 +- .../TestOperationSetPersistentPresence.java | 4 +- .../sip/TestOperationSetPresence.java | 4 +- .../TestProtocolProviderServiceSipImpl.java | 21 +++--- ...TestOperationSetBasicInstantMessaging.java | 4 +- .../TestOperationSetPersistentPresence.java | 6 +- .../yahoo/TestOperationSetPresence.java | 4 +- .../TestOperationSetTypingNotifications.java | 4 +- .../TestProtocolProviderServiceYahooImpl.java | 21 +++--- .../protocol/yahoo/YahooSlickFixture.java | 8 ++- 80 files changed, 407 insertions(+), 786 deletions(-) diff --git a/src/net/java/sip/communicator/impl/callhistory/CallHistoryServiceImpl.java b/src/net/java/sip/communicator/impl/callhistory/CallHistoryServiceImpl.java index 75733059b..25df1816a 100644 --- a/src/net/java/sip/communicator/impl/callhistory/CallHistoryServiceImpl.java +++ b/src/net/java/sip/communicator/impl/callhistory/CallHistoryServiceImpl.java @@ -10,6 +10,7 @@ import java.util.*; import org.osgi.framework.*; + import net.java.sip.communicator.service.callhistory.*; import net.java.sip.communicator.service.callhistory.event.*; import net.java.sip.communicator.service.contactlist.*; @@ -678,10 +679,9 @@ private void handleProviderAdded(ProtocolProviderService provider) logger.debug("Adding protocol provider " + provider.getProtocolName()); // check whether the provider has a basic telephony operation set - OperationSetBasicTelephony opSetTelephony - = (OperationSetBasicTelephony) provider - .getSupportedOperationSets().get( - OperationSetBasicTelephony.class.getName()); + OperationSetBasicTelephony opSetTelephony = + (OperationSetBasicTelephony) provider + .getOperationSet(OperationSetBasicTelephony.class); if (opSetTelephony != null) { @@ -701,10 +701,9 @@ private void handleProviderAdded(ProtocolProviderService provider) */ private void handleProviderRemoved(ProtocolProviderService provider) { - OperationSetBasicTelephony opSetTelephony - = (OperationSetBasicTelephony) provider - .getSupportedOperationSets().get( - OperationSetBasicTelephony.class.getName()); + OperationSetBasicTelephony opSetTelephony = + (OperationSetBasicTelephony) provider + .getOperationSet(OperationSetBasicTelephony.class); if (opSetTelephony != null) { diff --git a/src/net/java/sip/communicator/impl/contactlist/MetaContactListServiceImpl.java b/src/net/java/sip/communicator/impl/contactlist/MetaContactListServiceImpl.java index ed157785e..60260b68c 100644 --- a/src/net/java/sip/communicator/impl/contactlist/MetaContactListServiceImpl.java +++ b/src/net/java/sip/communicator/impl/contactlist/MetaContactListServiceImpl.java @@ -9,6 +9,7 @@ import java.util.*; import org.osgi.framework.*; + import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.contactlist.event.*; import net.java.sip.communicator.service.protocol.*; @@ -356,10 +357,9 @@ private void addNewContactToMetaContact( ProtocolProviderService provider, boolean fireEvent) throws MetaContactListException { - OperationSetPersistentPresence opSetPersPresence - = (OperationSetPersistentPresence) provider - .getSupportedOperationSets().get( - OperationSetPersistentPresence.class.getName()); + OperationSetPersistentPresence opSetPersPresence = + (OperationSetPersistentPresence) provider + .getOperationSet(OperationSetPersistentPresence.class); if (opSetPersPresence == null) { /** @todo handle non-persistent presence operation sets as well */ @@ -507,10 +507,9 @@ private ContactGroup resolveProtoPath(ProtocolProviderService protoProvider, throw new NullPointerException("Internal Error. Orphan group."); } - OperationSetPersistentPresence opSetPersPresence - = (OperationSetPersistentPresence) protoProvider - .getSupportedOperationSets().get(OperationSetPersistentPresence - .class.getName()); + OperationSetPersistentPresence opSetPersPresence = + (OperationSetPersistentPresence) protoProvider + .getOperationSet(OperationSetPersistentPresence.class); //if persistent presence is not supported - just bail //we should have verified this earlier anyway @@ -889,10 +888,9 @@ public void moveContact(Contact contact, currentParentMetaContact.removeProtoContact(contact); //get a persistent presence operation set - OperationSetPersistentPresence opSetPresence - = (OperationSetPersistentPresence) contact - .getProtocolProvider().getSupportedOperationSets() - .get(OperationSetPersistentPresence.class.getName()); + OperationSetPersistentPresence opSetPresence = + (OperationSetPersistentPresence) contact.getProtocolProvider() + .getOperationSet(OperationSetPersistentPresence.class); if (opSetPresence == null) { @@ -991,10 +989,10 @@ public void moveMetaContact(MetaContact metaContact, .getProtocolProvider(), (MetaContactGroupImpl) newMetaGroup); //get a persistent or non persistent presence operation set - OperationSetPersistentPresence opSetPresence - = (OperationSetPersistentPresence) protoContact - .getProtocolProvider().getSupportedOperationSets() - .get(OperationSetPersistentPresence.class.getName()); + OperationSetPersistentPresence opSetPresence = + (OperationSetPersistentPresence) protoContact + .getProtocolProvider().getOperationSet( + OperationSetPersistentPresence.class); if (opSetPresence == null) { @@ -1040,15 +1038,14 @@ public void removeContact(Contact contact) throws MetaContactListException //provider OperationSetPresence opSetPresence = (OperationSetPresence) contact.getProtocolProvider() - .getSupportedOperationSets().get(OperationSetPresence.class - .getName()); + .getOperationSet(OperationSetPresence.class); - //in case the provider only hase a persistent operation set: + //in case the provider only has a persistent operation set: if (opSetPresence == null) { - opSetPresence = (OperationSetPresence) contact.getProtocolProvider() - .getSupportedOperationSets().get( - OperationSetPersistentPresence.class.getName()); + opSetPresence = + (OperationSetPresence) contact.getProtocolProvider() + .getOperationSet(OperationSetPersistentPresence.class); if (opSetPresence == null) { @@ -1145,10 +1142,10 @@ public void removeMetaContactGroup( { ContactGroup protoGroup = protoGroups.next(); - OperationSetPersistentPresence opSetPersPresence - = (OperationSetPersistentPresence) protoGroup - .getProtocolProvider().getSupportedOperationSets().get( - OperationSetPersistentPresence.class.getName()); + OperationSetPersistentPresence opSetPersPresence = + (OperationSetPersistentPresence) protoGroup + .getProtocolProvider().getOperationSet( + OperationSetPersistentPresence.class); if (opSetPersPresence == null) { @@ -1405,7 +1402,7 @@ public MetaContactGroup findMetaContactGroupByMetaUID(String metaGroupID) public Iterator findAllMetaContactsForProvider( ProtocolProviderService protocolProvider) { - ArrayList resultList = new ArrayList(); + List resultList = new ArrayList(); this.findAllMetaContactsForProvider(protocolProvider, rootMetaGroup, @@ -1619,11 +1616,9 @@ private void handleProviderAdded( + provider.getProtocolName()); // check whether the provider has a persistent presence op set - OperationSetPersistentPresence opSetPersPresence - = (OperationSetPersistentPresence) provider - .getSupportedOperationSets().get( - OperationSetPersistentPresence.class - .getName()); + OperationSetPersistentPresence opSetPersPresence = + (OperationSetPersistentPresence) provider + .getOperationSet(OperationSetPersistentPresence.class); this.currentlyInstalledProviders.put( provider.getAccountID().getAccountUniqueID(), @@ -2760,9 +2755,8 @@ ContactGroup loadStoredContactGroup(MetaContactGroupImpl containingMetaGroup, ProtocolProviderService sourceProvider = (ProtocolProviderService) currentlyInstalledProviders.get(accountID); OperationSetPersistentPresence presenceOpSet = - (OperationSetPersistentPresence)sourceProvider - .getSupportedOperationSets().get(OperationSetPersistentPresence - .class.getName()); + (OperationSetPersistentPresence) sourceProvider + .getOperationSet(OperationSetPersistentPresence.class); ContactGroup newProtoGroup = presenceOpSet.createUnresolvedContactGroup( contactGroupUID, persistentData, @@ -2812,9 +2806,8 @@ void loadStoredMetaContact( ProtocolProviderService sourceProvider = (ProtocolProviderService) currentlyInstalledProviders.get(accountID); OperationSetPersistentPresence presenceOpSet = - (OperationSetPersistentPresence)sourceProvider - .getSupportedOperationSets().get(OperationSetPersistentPresence - .class.getName()); + (OperationSetPersistentPresence) sourceProvider + .getOperationSet(OperationSetPersistentPresence.class); Iterator contactsIter = protoContacts.iterator(); diff --git a/src/net/java/sip/communicator/impl/growlnotification/GrowlNotificationServiceImpl.java b/src/net/java/sip/communicator/impl/growlnotification/GrowlNotificationServiceImpl.java index f6733740d..1c12ca41d 100644 --- a/src/net/java/sip/communicator/impl/growlnotification/GrowlNotificationServiceImpl.java +++ b/src/net/java/sip/communicator/impl/growlnotification/GrowlNotificationServiceImpl.java @@ -300,10 +300,9 @@ private void handleProviderAdded(ProtocolProviderService provider) logger.debug("Adding protocol provider " + provider.getProtocolName()); // check whether the provider has a basic im operation set - OperationSetBasicInstantMessaging opSetIm - = (OperationSetBasicInstantMessaging) provider - .getSupportedOperationSets().get( - OperationSetBasicInstantMessaging.class.getName()); + OperationSetBasicInstantMessaging opSetIm = + (OperationSetBasicInstantMessaging) provider + .getOperationSet(OperationSetBasicInstantMessaging.class); if (opSetIm != null) { @@ -334,10 +333,9 @@ private void handleProviderAdded(ProtocolProviderService provider) */ private void handleProviderRemoved(ProtocolProviderService provider) { - OperationSetBasicInstantMessaging opSetIm - = (OperationSetBasicInstantMessaging) provider - .getSupportedOperationSets().get( - OperationSetBasicInstantMessaging.class.getName()); + OperationSetBasicInstantMessaging opSetIm = + (OperationSetBasicInstantMessaging) provider + .getOperationSet(OperationSetBasicInstantMessaging.class); if (opSetIm != null) { diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java index a50f32b93..0f9b50233 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactRightButtonMenu.java @@ -293,8 +293,8 @@ private void init() this.moveSubcontactMenu.add(contactItem1); // add all the contacts that support telephony to the call menu - if (contact.getProtocolProvider().getSupportedOperationSets() - .get(OperationSetBasicTelephony.class.getName()) != null) + if (contact.getProtocolProvider().getOperationSet( + OperationSetBasicTelephony.class) != null) { JMenuItem callContactItem = new JMenuItem(contactDisplayName); callContactItem.setIcon(protocolIcon); @@ -304,9 +304,8 @@ private void init() this.callContactMenu.add(callContactItem); } - OperationSetWebContactInfo wContactInfo - = (OperationSetWebContactInfo) protocolProvider - .getOperationSet(OperationSetWebContactInfo.class); + // TODO Why is OperationSetWebContactInfo requested and not used? + protocolProvider.getOperationSet(OperationSetWebContactInfo.class); } this.add(sendMessageItem); @@ -641,16 +640,17 @@ private void callContact(Contact contact) */ private Contact getContactFromMetaContact(String itemID) { - Iterator i = contactItem.getContacts(); + Iterator i = contactItem.getContacts(); - while(i.hasNext()) + while (i.hasNext()) { - Contact contact = (Contact)i.next(); + Contact contact = i.next(); - String id = contact.getAddress() - + contact.getProtocolProvider().getProtocolName(); + String id = + contact.getAddress() + + contact.getProtocolProvider().getProtocolName(); - if(itemID.equals(id)) + if (itemID.equals(id)) { return contact; } diff --git a/src/net/java/sip/communicator/impl/msghistory/MessageHistoryServiceImpl.java b/src/net/java/sip/communicator/impl/msghistory/MessageHistoryServiceImpl.java index e4739fd78..0f7d7ee71 100644 --- a/src/net/java/sip/communicator/impl/msghistory/MessageHistoryServiceImpl.java +++ b/src/net/java/sip/communicator/impl/msghistory/MessageHistoryServiceImpl.java @@ -24,7 +24,6 @@ import net.java.sip.communicator.service.protocol.event.*; import net.java.sip.communicator.util.*; - /** * The Message History Service stores messages exchanged through the various protocols * Logs messages for all protocol providers that support basic instant messaging @@ -929,10 +928,9 @@ private void handleProviderAdded(ProtocolProviderService provider) + provider.getProtocolDisplayName()); // check whether the provider has a basic im operation set - OperationSetBasicInstantMessaging opSetIm - = (OperationSetBasicInstantMessaging) provider - .getSupportedOperationSets().get( - OperationSetBasicInstantMessaging.class.getName()); + OperationSetBasicInstantMessaging opSetIm = + (OperationSetBasicInstantMessaging) provider + .getOperationSet(OperationSetBasicInstantMessaging.class); if (opSetIm != null) { @@ -943,10 +941,9 @@ private void handleProviderAdded(ProtocolProviderService provider) logger.trace("Service did not have a im op. set."); } - OperationSetMultiUserChat opSetMultiUChat - = (OperationSetMultiUserChat) provider - .getSupportedOperationSets().get( - OperationSetMultiUserChat.class.getName()); + OperationSetMultiUserChat opSetMultiUChat = + (OperationSetMultiUserChat) provider + .getOperationSet(OperationSetMultiUserChat.class); if (opSetMultiUChat != null) { @@ -975,20 +972,18 @@ private void handleProviderAdded(ProtocolProviderService provider) */ private void handleProviderRemoved(ProtocolProviderService provider) { - OperationSetBasicInstantMessaging opSetIm - = (OperationSetBasicInstantMessaging) provider - .getSupportedOperationSets().get( - OperationSetBasicInstantMessaging.class.getName()); + OperationSetBasicInstantMessaging opSetIm = + (OperationSetBasicInstantMessaging) provider + .getOperationSet(OperationSetBasicInstantMessaging.class); if (opSetIm != null) { opSetIm.removeMessageListener(this); } - OperationSetMultiUserChat opSetMultiUChat - = (OperationSetMultiUserChat) provider - .getSupportedOperationSets().get( - OperationSetMultiUserChat.class.getName()); + OperationSetMultiUserChat opSetMultiUChat = + (OperationSetMultiUserChat) provider + .getOperationSet(OperationSetMultiUserChat.class); if (opSetMultiUChat != null) { diff --git a/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderServiceDictImpl.java b/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderServiceDictImpl.java index b803c6c75..426f13f33 100644 --- a/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderServiceDictImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/dict/ProtocolProviderServiceDictImpl.java @@ -6,8 +6,6 @@ */ package net.java.sip.communicator.impl.protocol.dict; -import java.util.*; - import net.java.dict4j.*; import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.event.*; @@ -43,11 +41,6 @@ public class ProtocolProviderServiceDictImpl */ private Object initializationLock = new Object(); - /** - * The hashtable with the operation sets that we support locally. - */ - private Hashtable supportedOperationSets = new Hashtable(); - /** * Indicates whether or not the provider is initialized and ready for use. */ @@ -162,21 +155,6 @@ public AccountID getAccountID() return accountID; } - /** - * Returns the operation set corresponding to the specified class or null - * if this operation set is not supported by the provider implementation. - * - * @param opsetClass the Class of the operation set that we're - * looking for. - * @return returns an OperationSet of the specified Class if - * the undelying implementation supports it or null otherwise. - */ - public OperationSet getOperationSet(Class opsetClass) - { - return (OperationSet) getSupportedOperationSets() - .get(opsetClass.getName()); - } - /** * Returns the short name of the protocol that the implementation of this * provider is based upon (like SIP, Jabber, ICQ/AIM, or others for @@ -211,20 +189,6 @@ public RegistrationState getRegistrationState() return currentRegistrationState; } - /** - * Returns an array containing all operation sets supported by the - * current implementation. - * - * @return a java.util.Map containing instance of all supported - * operation sets mapped against their class names (e.g. - * OperationSetPresence.class.getName()) . - */ - public Map getSupportedOperationSets() - { - //Copy the map so that the caller is not able to modify it. - return (Map)supportedOperationSets.clone(); - } - /** * Starts the registration process. * diff --git a/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderServiceGibberishImpl.java b/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderServiceGibberishImpl.java index 714d5e501..6a64b1a7e 100644 --- a/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderServiceGibberishImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/gibberish/ProtocolProviderServiceGibberishImpl.java @@ -6,8 +6,6 @@ */ package net.java.sip.communicator.impl.protocol.gibberish; -import java.util.*; - import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.event.*; import net.java.sip.communicator.util.*; @@ -38,11 +36,6 @@ public class ProtocolProviderServiceGibberishImpl */ private Object initializationLock = new Object(); - /** - * The hashtable with the operation sets that we support locally. - */ - private Hashtable supportedOperationSets = new Hashtable(); - /** * Indicates whether or not the provider is initialized and ready for use. */ @@ -140,21 +133,6 @@ public AccountID getAccountID() return accountID; } - /** - * Returns the operation set corresponding to the specified class or null - * if this operation set is not supported by the provider implementation. - * - * @param opsetClass the Class of the operation set that we're - * looking for. - * @return returns an OperationSet of the specified Class if - * the undelying implementation supports it or null otherwise. - */ - public OperationSet getOperationSet(Class opsetClass) - { - return (OperationSet) getSupportedOperationSets() - .get(opsetClass.getName()); - } - /** * Returns the short name of the protocol that the implementation of this * provider is based upon (like SIP, Jabber, ICQ/AIM, or others for @@ -180,20 +158,6 @@ public RegistrationState getRegistrationState() return currentRegistrationState; } - /** - * Returns an array containing all operation sets supported by the - * current implementation. - * - * @return a java.util.Map containing instance of all supported - * operation sets mapped against their class names (e.g. - * OperationSetPresence.class.getName()) . - */ - public Map getSupportedOperationSets() - { - //Copy the map so that the caller is not able to modify it. - return (Map)supportedOperationSets.clone(); - } - /** * Starts the registration process. * diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java index 2f5a98988..b0827cfb8 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetBasicInstantMessagingIcqImpl.java @@ -366,9 +366,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt) icqProvider.getAimConnection().getIcbmService() .addIcbmListener(joustSimIcbmListener); - opSetPersPresence = (OperationSetPersistentPresenceIcqImpl) - icqProvider.getSupportedOperationSets() - .get(OperationSetPersistentPresence.class.getName()); + opSetPersPresence = + (OperationSetPersistentPresenceIcqImpl) icqProvider + .getOperationSet(OperationSetPersistentPresence.class); } else if (evt.getNewState() == RegistrationState.REGISTERED) { diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetMultiUserChatIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetMultiUserChatIcqImpl.java index ff59214e0..ba77f3ee5 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetMultiUserChatIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetMultiUserChatIcqImpl.java @@ -502,10 +502,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt) .getProperty("icq.custom.message.charset")) != null) OscarTools.setDefaultCharset(customMessageEncoding); - opSetPersPresence - = (OperationSetPersistentPresenceIcqImpl) icqProvider - .getSupportedOperationSets().get( - OperationSetPersistentPresence.class.getName()); + opSetPersPresence = + (OperationSetPersistentPresenceIcqImpl) icqProvider + .getOperationSet(OperationSetPersistentPresence.class); //add ChatRoomMangagerListener icqProvider.getAimConnection().getChatRoomManager() diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java index 433130e65..87d094241 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetPersistentPresenceIcqImpl.java @@ -1243,9 +1243,8 @@ else if(evt.getNewState() == RegistrationState.REGISTERED) if(parentProvider.USING_ICQ) { opSetExtendedAuthorizations = - (OperationSetExtendedAuthorizationsIcqImpl) - parentProvider.getSupportedOperationSets() - .get(OperationSetExtendedAuthorizations.class.getName()); + (OperationSetExtendedAuthorizationsIcqImpl) parentProvider + .getOperationSet(OperationSetExtendedAuthorizations.class); if(presenceQueryTimer == null) presenceQueryTimer = new Timer(); diff --git a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetTypingNotificationsIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetTypingNotificationsIcqImpl.java index e2849e35c..7d23ed098 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/OperationSetTypingNotificationsIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/OperationSetTypingNotificationsIcqImpl.java @@ -246,10 +246,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt) icqProvider.getAimConnection().getIcbmService() .addIcbmListener(joustSimIcbmListener); - opSetPersPresence = (OperationSetPersistentPresenceIcqImpl) - icqProvider.getSupportedOperationSets() - .get(OperationSetPersistentPresence.class.getName()); - + opSetPersPresence = + (OperationSetPersistentPresenceIcqImpl) icqProvider + .getOperationSet(OperationSetPersistentPresence.class); } } } diff --git a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java index 5c4a0aab8..77de1a959 100644 --- a/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/icq/ProtocolProviderServiceIcqImpl.java @@ -33,11 +33,6 @@ public class ProtocolProviderServiceIcqImpl private static final Logger logger = Logger.getLogger(ProtocolProviderServiceIcqImpl.class); - /** - * The hashtable with the operation sets that we support locally. - */ - private Hashtable supportedOperationSets = new Hashtable(); - private DefaultAppSession session = null; private AimSession aimSession = null; @@ -437,33 +432,6 @@ public String getProtocolDisplayName() return ProtocolNames.AIM; } - /** - * Returns an array containing all operation sets supported by the - * current implementation. - * - * @return an array of OperationSet-s supported by this protocol - * provider implementation. - */ - public Map getSupportedOperationSets() - { - return supportedOperationSets; - } - - /** - * Returns the operation set corresponding to the specified class or null - * if this operation set is not supported by the provider implementation. - * - * @param opsetClass the Class of the operation set that we're - * looking for. - * @return returns an OperationSet of the specified Class if the - * undelying implementation supports it or null otherwise. - */ - public OperationSet getOperationSet(Class opsetClass) - { - return (OperationSet)getSupportedOperationSets() - .get(opsetClass.getName()); - } - /** * Initialized the service implementation, and puts it in a sate where it * could interoperate with other services. It is strongly recomended that diff --git a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java index f0a6cf0f1..22bccffd0 100644 --- a/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/irc/ProtocolProviderServiceIrcImpl.java @@ -37,12 +37,7 @@ public class ProtocolProviderServiceIrcImpl /** * We use this to lock access to initialization. */ - private Object initializationLock = new Object(); - - /** - * The hashtable with the operation sets that we support locally. - */ - private Hashtable supportedOperationSets = new Hashtable(); + private final Object initializationLock = new Object(); /** * The operation set managing multi user chat. @@ -119,21 +114,6 @@ public AccountID getAccountID() return accountID; } - /** - * Returns the operation set corresponding to the specified class or null - * if this operation set is not supported by the provider implementation. - * - * @param opsetClass the Class of the operation set that we're - * looking for. - * @return returns an OperationSet of the specified Class if - * the underlying implementation supports it or null otherwise. - */ - public OperationSet getOperationSet(Class opsetClass) - { - return (OperationSet) getSupportedOperationSets() - .get(opsetClass.getName()); - } - /** * Returns the short name of the protocol that the implementation of this * provider is based upon (like SIP, Jabber, ICQ/AIM, or others for @@ -159,20 +139,6 @@ public RegistrationState getRegistrationState() return currentRegistrationState; } - /** - * Returns an array containing all operation sets supported by the - * current implementation. - * - * @return a java.util.Map containing instance of all supported - * operation sets mapped against their class names (e.g. - * OperationSetPresence.class.getName()) . - */ - public Map getSupportedOperationSets() - { - //Copy the map so that the caller is not able to modify it. - return (Map) supportedOperationSets.clone(); - } - /** * Starts the registration process. * diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicInstantMessagingJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicInstantMessagingJabberImpl.java index 9cca89818..d5fbb9adf 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicInstantMessagingJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetBasicInstantMessagingJabberImpl.java @@ -271,9 +271,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt) if (evt.getNewState() == RegistrationState.REGISTERED) { - opSetPersPresence = (OperationSetPersistentPresenceJabberImpl) - jabberProvider.getSupportedOperationSets() - .get(OperationSetPersistentPresence.class.getName()); + opSetPersPresence = + (OperationSetPersistentPresenceJabberImpl) jabberProvider + .getOperationSet(OperationSetPersistentPresence.class); jabberProvider.getConnection().addPacketListener( new SmackMessageListener(), diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetTypingNotificationsJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetTypingNotificationsJabberImpl.java index aecd9372f..61827419a 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetTypingNotificationsJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetTypingNotificationsJabberImpl.java @@ -286,9 +286,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt) + " to: " + evt.getNewState()); if (evt.getNewState() == RegistrationState.REGISTERED) { - opSetPersPresence = (OperationSetPersistentPresenceJabberImpl) - jabberProvider.getSupportedOperationSets() - .get(OperationSetPersistentPresence.class.getName()); + opSetPersPresence = + (OperationSetPersistentPresenceJabberImpl) jabberProvider + .getOperationSet(OperationSetPersistentPresence.class); messageEventManager = new MessageEventManager(jabberProvider.getConnection()); diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java index 728c98b3f..d7459cce1 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/ProtocolProviderServiceJabberImpl.java @@ -35,11 +35,6 @@ public class ProtocolProviderServiceJabberImpl private static final Logger logger = Logger.getLogger(ProtocolProviderServiceJabberImpl.class); - /** - * The hashtable with the operation sets that we support locally. - */ - private Hashtable supportedOperationSets = new Hashtable(); - /** * Used to connect to a XMPP server. */ @@ -451,33 +446,6 @@ public String getProtocolName() return ProtocolNames.JABBER; } - /** - * Returns an array containing all operation sets supported by the - * current implementation. - * - * @return an array of OperationSet-s supported by this protocol - * provider implementation. - */ - public Map getSupportedOperationSets() - { - return supportedOperationSets; - } - - /** - * Returns the operation set corresponding to the specified class or null - * if this operation set is not supported by the provider implementation. - * - * @param opsetClass the Class of the operation set that we're - * looking for. - * @return returns an OperationSet of the specified Class if the - * underlying implementation supports it or null otherwise. - */ - public OperationSet getOperationSet(Class opsetClass) - { - return (OperationSet)getSupportedOperationSets() - .get(opsetClass.getName()); - } - /** * Initialized the service implementation, and puts it in a sate where it * could interoperate with other services. It is strongly recommended that @@ -708,9 +676,7 @@ private class JabberConnectionListener public void connectionClosed() { OperationSetPersistentPresenceJabberImpl opSetPersPresence = - (OperationSetPersistentPresenceJabberImpl) - getSupportedOperationSets() - .get(OperationSetPersistentPresence.class.getName()); + (OperationSetPersistentPresenceJabberImpl) getOperationSet(OperationSetPersistentPresence.class); opSetPersPresence.fireProviderPresenceStatusChangeEvent( opSetPersPresence.getPresenceStatus(), getJabberStatusEnum() diff --git a/src/net/java/sip/communicator/impl/protocol/mock/MockProvider.java b/src/net/java/sip/communicator/impl/protocol/mock/MockProvider.java index 97003a90b..cbdb3cfdb 100644 --- a/src/net/java/sip/communicator/impl/protocol/mock/MockProvider.java +++ b/src/net/java/sip/communicator/impl/protocol/mock/MockProvider.java @@ -28,7 +28,8 @@ public class MockProvider /** * The operation sets that our mock provider supports. */ - private Hashtable supportedOperationSets = new Hashtable(); + private final Map supportedOperationSets = + new Hashtable(); /** * The presence operation set supported by the mock provider. @@ -127,7 +128,7 @@ public RegistrationState getRegistrationState() * operation sets mapped against their class names (e.g. * OperationSetPresence.class.getName()) . */ - public Map getSupportedOperationSets() + public Map getSupportedOperationSets() { return this.supportedOperationSets; } @@ -141,7 +142,7 @@ public Map getSupportedOperationSets() * @return returns an OperationSet of the specified Class if the * undelying implementation supports it or null otherwise. */ - public OperationSet getOperationSet(Class opsetClass) + public OperationSet getOperationSet(Class opsetClass) { return (OperationSet) getSupportedOperationSets() .get(opsetClass.getName()); diff --git a/src/net/java/sip/communicator/impl/protocol/msn/OperationSetBasicInstantMessagingMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/OperationSetBasicInstantMessagingMsnImpl.java index f27f94720..49b0e6f57 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/OperationSetBasicInstantMessagingMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/OperationSetBasicInstantMessagingMsnImpl.java @@ -168,9 +168,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt) if (evt.getNewState() == RegistrationState.REGISTERED) { - opSetPersPresence = (OperationSetPersistentPresenceMsnImpl) - msnProvider.getSupportedOperationSets() - .get(OperationSetPersistentPresence.class.getName()); + opSetPersPresence = + (OperationSetPersistentPresenceMsnImpl) msnProvider + .getOperationSet(OperationSetPersistentPresence.class); msnProvider.getMessenger(). addMessageListener(new MsnMessageListener()); diff --git a/src/net/java/sip/communicator/impl/protocol/msn/OperationSetMultiUserChatMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/OperationSetMultiUserChatMsnImpl.java index a773a237d..f2b49fddd 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/OperationSetMultiUserChatMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/OperationSetMultiUserChatMsnImpl.java @@ -1,3 +1,9 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ package net.java.sip.communicator.impl.protocol.msn; import java.util.*; @@ -558,11 +564,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt) { if (evt.getNewState() == RegistrationState.REGISTERED) { - opSetPersPresence = (OperationSetPersistentPresenceMsnImpl) msnProvider - .getSupportedOperationSets().get( - OperationSetPersistentPresence.class.getName()); + .getOperationSet(OperationSetPersistentPresence.class); msnProvider.getMessenger().addSwitchboardListener( new MsnSwitchboardListener()); diff --git a/src/net/java/sip/communicator/impl/protocol/msn/OperationSetTypingNotificationsMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/OperationSetTypingNotificationsMsnImpl.java index 68e2d32db..a792d6f2d 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/OperationSetTypingNotificationsMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/OperationSetTypingNotificationsMsnImpl.java @@ -233,9 +233,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt) + " to: " + evt.getNewState()); if (evt.getNewState() == RegistrationState.REGISTERED) { - opSetPersPresence = (OperationSetPersistentPresenceMsnImpl) - msnProvider.getSupportedOperationSets() - .get(OperationSetPersistentPresence.class.getName()); + opSetPersPresence = + (OperationSetPersistentPresenceMsnImpl) msnProvider + .getOperationSet(OperationSetPersistentPresence.class); } } } diff --git a/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderServiceMsnImpl.java b/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderServiceMsnImpl.java index 56e93fc60..21f11daaa 100644 --- a/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderServiceMsnImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/msn/ProtocolProviderServiceMsnImpl.java @@ -29,11 +29,6 @@ public class ProtocolProviderServiceMsnImpl private static final Logger logger = Logger.getLogger(ProtocolProviderServiceMsnImpl.class); - /** - * The hashtable with the operation sets that we support locally. - */ - private Hashtable supportedOperationSets = new Hashtable(); - private MsnMessenger messenger = null; /** @@ -247,33 +242,6 @@ public String getProtocolName() return ProtocolNames.MSN; } - /** - * Returns an array containing all operation sets supported by the - * current implementation. - * - * @return an array of OperationSet-s supported by this protocol - * provider implementation. - */ - public Map getSupportedOperationSets() - { - return supportedOperationSets; - } - - /** - * Returns the operation set corresponding to the specified class or null - * if this operation set is not supported by the provider implementation. - * - * @param opsetClass the Class of the operation set that we're - * looking for. - * @return returns an OperationSet of the specified Class if the - * undelying implementation supports it or null otherwise. - */ - public OperationSet getOperationSet(Class opsetClass) - { - return (OperationSet)getSupportedOperationSets() - .get(opsetClass.getName()); - } - /** * Initialized the service implementation, and puts it in a sate where it * could interoperate with other services. It is strongly recomended that diff --git a/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java b/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java index 3c7b48e90..f0b61d37e 100644 --- a/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/rss/ProtocolProviderServiceRssImpl.java @@ -6,8 +6,6 @@ */ package net.java.sip.communicator.impl.protocol.rss; -import java.util.*; - import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.event.*; import net.java.sip.communicator.util.*; @@ -37,12 +35,7 @@ public class ProtocolProviderServiceRssImpl /** * We use this to lock access to initialization. */ - private Object initializationLock = new Object(); - - /** - * The hashtable with the operation sets that we support locally. - */ - private Hashtable supportedOperationSets = new Hashtable(); + private final Object initializationLock = new Object(); /** * Indicates whether or not the provider is initialized and ready for use. @@ -60,8 +53,6 @@ public class ProtocolProviderServiceRssImpl */ private OperationSetBasicInstantMessagingRssImpl basicInstantMessaging; - private boolean start = false; - /** * The registration state that we are currently in. Note that in a real * world protocol implementation this field won't exist and the registration @@ -140,21 +131,6 @@ public AccountID getAccountID() return accountID; } - /** - * Returns the operation set corresponding to the specified class or null - * if this operation set is not supported by the provider implementation. - * - * @param opsetClass the Class of the operation set that we're - * looking for. - * @return returns an OperationSet of the specified Class if - * the undelying implementation supports it or null otherwise. - */ - public OperationSet getOperationSet(Class opsetClass) - { - return (OperationSet) getSupportedOperationSets() - .get(opsetClass.getName()); - } - /** * Returns the short name of the protocol that the implementation of this * provider is based upon (like SIP, Jabber, ICQ/AIM, or others for @@ -180,20 +156,6 @@ public RegistrationState getRegistrationState() return currentRegistrationState; } - /** - * Returns an array containing all operation sets supported by the - * current implementation. - * - * @return a java.util.Map containing instance of all supported - * operation sets mapped against their class names (e.g. - * OperationSetPresence.class.getName()) . - */ - public Map getSupportedOperationSets() - { - //Copy the map so that the caller is not able to modify it. - return (Map)supportedOperationSets.clone(); - } - /** * Starts the registration process. * diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicInstantMessagingSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicInstantMessagingSipImpl.java index a8fef3894..37608673d 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicInstantMessagingSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetBasicInstantMessagingSipImpl.java @@ -548,9 +548,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt) if (evt.getNewState() == RegistrationState.REGISTERED) { - opSetPersPresence = (OperationSetPresenceSipImpl) - sipProvider.getSupportedOperationSets() - .get(OperationSetPersistentPresence.class.getName()); + opSetPersPresence = + (OperationSetPresenceSipImpl) sipProvider + .getOperationSet(OperationSetPersistentPresence.class); } } } diff --git a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetTypingNotificationsSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetTypingNotificationsSipImpl.java index 9ea9428ec..0ae15cd4d 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/OperationSetTypingNotificationsSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/OperationSetTypingNotificationsSipImpl.java @@ -8,6 +8,7 @@ import java.text.*; import java.util.*; + import javax.sip.*; import javax.sip.header.*; import javax.sip.message.*; @@ -15,10 +16,10 @@ import org.w3c.dom.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.service.protocol.Message; import net.java.sip.communicator.service.protocol.event.*; import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.xml.*; -import net.java.sip.communicator.service.protocol.Message; /** * A implementation of the typing notification operation @@ -133,9 +134,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt) if (evt.getNewState() == RegistrationState.REGISTERED) { - opSetPersPresence = (OperationSetPresenceSipImpl) - sipProvider.getSupportedOperationSets() - .get(OperationSetPersistentPresence.class.getName()); + opSetPersPresence = + (OperationSetPresenceSipImpl) sipProvider + .getOperationSet(OperationSetPersistentPresence.class); } } } diff --git a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java index 5bd3c6871..cc99d2603 100644 --- a/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/sip/ProtocolProviderServiceSipImpl.java @@ -9,6 +9,7 @@ import java.net.*; import java.text.*; import java.util.*; + import javax.sip.*; import javax.sip.address.*; import javax.sip.header.*; @@ -16,6 +17,7 @@ import org.osgi.framework.*; +import net.java.sip.communicator.impl.protocol.sip.security.*; import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.event.*; @@ -23,12 +25,10 @@ import net.java.sip.communicator.service.version.Version; import net.java.sip.communicator.util.*; -import gov.nist.javax.sip.*; + import gov.nist.javax.sip.header.*; import gov.nist.javax.sip.address.*; import gov.nist.javax.sip.message.*; -import gov.nist.javax.sip.stack.*; -import net.java.sip.communicator.impl.protocol.sip.security.*; /** * A SIP implementation of the Protocol Provider Service. @@ -44,12 +44,6 @@ public class ProtocolProviderServiceSipImpl private static final Logger logger = Logger.getLogger(ProtocolProviderServiceSipImpl.class); - /** - * The hashtable with the operation sets that we support locally. - */ - private Hashtable supportedOperationSets - = new Hashtable(); - /** * The identifier of the account that this provider represents. */ @@ -70,12 +64,6 @@ public class ProtocolProviderServiceSipImpl */ private List registeredEvents = new ArrayList(); - /** - * The SipFactory instance used to create the SipStack and the Address - * Message and Header Factories. - */ - private SipFactory sipFactory; - /** * The AddressFactory used to create URLs ans Address objects. */ @@ -159,11 +147,6 @@ public class ProtocolProviderServiceSipImpl */ private MaxForwardsHeader maxForwardsHeader = null; - /** - * The contact header we use in non REGISTER requests. - */ - private ContactHeader genericContactHeader = null; - /** * The header that we use to identify ourselves. */ @@ -277,40 +260,6 @@ public List getKnownEventsList() return this.registeredEvents; } - /** - * Returns an array containing all operation sets supported by the current - * implementation. When querying this method users must be prepared to - * receive any sybset of the OperationSet-s defined by this service. They - * MUST ignore any OperationSet-s that they are not aware of and that may be - * defined by future version of this service. Such "unknown" OperationSet-s - * though not encouraged, may also be defined by service implementors. - * - * @return a java.util.Map containing instance of all supported operation - * sets mapped against their class names (e.g. - * OperationSetPresence.class.getName()) . - */ - public Map getSupportedOperationSets() - { - return supportedOperationSets; - } - - /** - * Returns the operation set corresponding to the specified class or null - * if this operation set is not supported by the provider implementation. - * - * @param opsetClass the Class of the operation set that we're - * looking for. - * @return returns an OperationSet of the specified Class if the - * undelying implementation supports it or null otherwise. - */ - public OperationSet getOperationSet(Class opsetClass) - { - return (OperationSet)getSupportedOperationSets() - .get(opsetClass.getName()); - } - - - /** * Starts the registration process. Connection details such as * registration server, user name/number are provided through the @@ -569,7 +518,7 @@ protected void initialize(String sipAddress, OperationSetDTMF.class.getName(), opSetDTMF); //initialize our OPTIONS handler - ClientCapabilities capabilities = new ClientCapabilities(this); + new ClientCapabilities(this); //initialize our display name ourDisplayName = (String)accountID.getAccountProperties() @@ -923,7 +872,6 @@ public void run() { headerFactory = null; messageFactory = null; addressFactory = null; - sipFactory = null; sipSecurityManager = null; methodProcessors.clear(); @@ -1522,9 +1470,6 @@ private void initRegistrarConnection(SipAccountID accountID) private void initRegistrarlessConnection(SipAccountID accountID) throws IllegalArgumentException { - String userID = (String) accountID.getAccountProperties() - .get(ProtocolProviderFactory.USER_ID); - //registrar transport String registrarTransport = (String) accountID.getAccountProperties() .get(ProtocolProviderFactory.PREFERRED_TRANSPORT); @@ -1836,7 +1781,8 @@ public void registerMethodProcessor(String method, } else { - Class methodProcessorClass = methodProcessor.getClass(); + Class methodProcessorClass = + methodProcessor.getClass(); for (Iterator processorIter = processors.iterator(); processorIter.hasNext();) { @@ -1967,7 +1913,7 @@ public UserAgentHeader getSipCommUserAgentHeader() { try { - List userAgentTokens = new LinkedList(); + List userAgentTokens = new LinkedList(); Version ver = SipActivator.getVersionService().getCurrentVersion(); diff --git a/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java b/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java index 08eb57b6b..3230cfc43 100644 --- a/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/ssh/ProtocolProviderServiceSSHImpl.java @@ -9,20 +9,21 @@ * SSH Suport in SIP Communicator - GSoC' 07 Project * */ - package net.java.sip.communicator.impl.protocol.ssh; import java.io.*; -import java.util.*; -import com.jcraft.jsch.*; + import javax.swing.*; -import org.osgi.framework.*; import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.event.*; import net.java.sip.communicator.util.Logger; import net.java.sip.communicator.service.gui.*; +import org.osgi.framework.*; + +import com.jcraft.jsch.*; + /** * A SSH implementation of the ProtocolProviderService. * @@ -75,12 +76,7 @@ public class ProtocolProviderServiceSSHImpl /** * We use this to lock access to initialization. */ - private Object initializationLock = new Object(); - - /** - * The hashtable with the operation sets that we support locally. - */ - private final Hashtable supportedOperationSets = new Hashtable(); + private final Object initializationLock = new Object(); private OperationSetBasicInstantMessagingSSHImpl basicInstantMessaging; @@ -514,21 +510,6 @@ public AccountID getAccountID() return accountID; } - /** - * Returns the operation set corresponding to the specified class or null - * if this operation set is not supported by the provider implementation. - * - * @param opsetClass the Class of the operation set that we're - * looking for. - * @return returns an OperationSet of the specified Class if - * the undelying implementation supports it or null otherwise. - */ - public OperationSet getOperationSet(Class opsetClass) - { - return (OperationSet) getSupportedOperationSets() - .get(opsetClass.getName()); - } - /** * Returns the short name of the protocol that the implementation of this * provider is based upon (like SIP, Jabber, ICQ/AIM, or others for @@ -554,20 +535,6 @@ public RegistrationState getRegistrationState() return currentRegistrationState; } - /** - * Returns an array containing all operation sets supported by the - * current implementation. - * - * @return a java.util.Map containing instance of all supported - * operation sets mapped against their class names (e.g. - * OperationSetPresence.class.getName()) . - */ - public Map getSupportedOperationSets() - { - //Copy the map so that the caller is not able to modify it. - return (Map)supportedOperationSets.clone(); - } - /** * Starts the registration process. * diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetBasicInstantMessagingYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetBasicInstantMessagingYahooImpl.java index bfa146043..ca145cc0b 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetBasicInstantMessagingYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetBasicInstantMessagingYahooImpl.java @@ -233,9 +233,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt) if (evt.getNewState() == RegistrationState.REGISTERED) { - opSetPersPresence = (OperationSetPersistentPresenceYahooImpl) - yahooProvider.getSupportedOperationSets() - .get(OperationSetPersistentPresence.class.getName()); + opSetPersPresence = + (OperationSetPersistentPresenceYahooImpl) yahooProvider + .getOperationSet(OperationSetPersistentPresence.class); yahooProvider.getYahooSession(). addSessionListener(new YahooMessageListener()); diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetMultiUserChatYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetMultiUserChatYahooImpl.java index fad58da3a..e049e4f7d 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetMultiUserChatYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetMultiUserChatYahooImpl.java @@ -582,11 +582,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt) { if (evt.getNewState() == RegistrationState.REGISTERED) { - - opSetPersPresence - = (OperationSetPersistentPresenceYahooImpl) yahooProvider - .getSupportedOperationSets().get( - OperationSetPersistentPresence.class.getName()); + opSetPersPresence = + (OperationSetPersistentPresenceYahooImpl) yahooProvider + .getOperationSet(OperationSetPersistentPresence.class); yahooProvider.getYahooSession().addSessionListener( new YahooMessageListener()); diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetTypingNotificationsYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetTypingNotificationsYahooImpl.java index 587f2b63f..65827e83a 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetTypingNotificationsYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/OperationSetTypingNotificationsYahooImpl.java @@ -219,9 +219,9 @@ public void registrationStateChanged(RegistrationStateChangeEvent evt) + " to: " + evt.getNewState()); if (evt.getNewState() == RegistrationState.REGISTERED) { - opSetPersPresence = (OperationSetPersistentPresenceYahooImpl) - yahooProvider.getSupportedOperationSets() - .get(OperationSetPersistentPresence.class.getName()); + opSetPersPresence = + (OperationSetPersistentPresenceYahooImpl) yahooProvider + .getOperationSet(OperationSetPersistentPresence.class); yahooProvider.getYahooSession().addSessionListener(new TypingListener()); } diff --git a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java b/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java index fc740513b..97f3b7761 100644 --- a/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/yahoo/ProtocolProviderServiceYahooImpl.java @@ -7,7 +7,6 @@ package net.java.sip.communicator.impl.protocol.yahoo; import java.io.*; -import java.util.*; import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.event.*; @@ -29,11 +28,6 @@ public class ProtocolProviderServiceYahooImpl private static final Logger logger = Logger.getLogger(ProtocolProviderServiceYahooImpl.class); - /** - * The hashtable with the operation sets that we support locally. - */ - private Hashtable supportedOperationSets = new Hashtable(); - private YahooSession yahooSession = null; /** @@ -278,33 +272,6 @@ public String getProtocolName() return ProtocolNames.YAHOO; } - /** - * Returns an array containing all operation sets supported by the - * current implementation. - * - * @return an array of OperationSet-s supported by this protocol - * provider implementation. - */ - public Map getSupportedOperationSets() - { - return supportedOperationSets; - } - - /** - * Returns the operation set corresponding to the specified class or null - * if this operation set is not supported by the provider implementation. - * - * @param opsetClass the Class of the operation set that we're - * looking for. - * @return returns an OperationSet of the specified Class if the - * undelying implementation supports it or null otherwise. - */ - public OperationSet getOperationSet(Class opsetClass) - { - return (OperationSet)getSupportedOperationSets() - .get(opsetClass.getName()); - } - /** * Initialized the service implementation, and puts it in a sate where it * could interoperate with other services. It is strongly recomended that diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java index 894230315..2139e7ef6 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/BonjourService.java @@ -75,9 +75,9 @@ public BonjourService(int port, this.id = acc.getUserID(); this.pps = pps; - opSetPersPresence = (OperationSetPersistentPresenceZeroconfImpl) - pps.getSupportedOperationSets() - .get(OperationSetPersistentPresence.class.getName()); + opSetPersPresence = + (OperationSetPersistentPresenceZeroconfImpl) pps + .getOperationSet(OperationSetPersistentPresence.class); props = new Hashtable(); diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/ClientThread.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/ClientThread.java index 135f45fbd..35da61af9 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/ClientThread.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/ClientThread.java @@ -81,13 +81,15 @@ public ClientThread(Socket sock, BonjourService bonjourService) this.sock = sock; this.remoteIPAddress = sock.getInetAddress(); this.bonjourService = bonjourService; - this.opSetBasicIM = (OperationSetBasicInstantMessagingZeroconfImpl) - bonjourService.getPPS().getSupportedOperationSets() - .get(OperationSetBasicInstantMessaging.class.getName()); - - this.opSetTyping = (OperationSetTypingNotificationsZeroconfImpl) - bonjourService.getPPS().getSupportedOperationSets() - .get(OperationSetTypingNotifications.class.getName()); + this.opSetBasicIM = + (OperationSetBasicInstantMessagingZeroconfImpl) bonjourService + .getPPS().getOperationSet( + OperationSetBasicInstantMessaging.class); + + this.opSetTyping = + (OperationSetTypingNotificationsZeroconfImpl) bonjourService + .getPPS() + .getOperationSet(OperationSetTypingNotifications.class); this.setDaemon(true); try diff --git a/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java b/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java index 9b479aaa0..ef7638618 100644 --- a/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/zeroconf/ProtocolProviderServiceZeroconfImpl.java @@ -6,8 +6,6 @@ */ package net.java.sip.communicator.impl.protocol.zeroconf; -import java.util.*; - import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.event.*; import net.java.sip.communicator.util.*; @@ -23,11 +21,6 @@ public class ProtocolProviderServiceZeroconfImpl { private static final Logger logger = Logger.getLogger(ProtocolProviderServiceZeroconfImpl.class); - - /** - * The hashtable with the operation sets that we support locally. - */ - private Hashtable supportedOperationSets = new Hashtable(); /** * We use this to lock access to initialization. @@ -152,21 +145,6 @@ protected void initialize(String userID, } } - - /** - * Returns the operation set corresponding to the specified class or null - * if this operation set is not supported by the provider implementation. - * - * @param opsetClass the Class of the operation set that we're - * looking for. - * @return returns an OperationSet of the specified Class if - * the undelying implementation supports it or null otherwise. - */ - public OperationSet getOperationSet(Class opsetClass) - { - return (OperationSet) getSupportedOperationSets() - .get(opsetClass.getName()); - } /** * Returns the short name of the protocol that the implementation of this @@ -193,20 +171,6 @@ public RegistrationState getRegistrationState() return currentRegistrationState; } - /** - * Returns an array containing all operation sets supported by the - * current implementation. - * - * @return a java.util.Map containing instance of all supported - * operation sets mapped against their class names (e.g. - * OperationSetPresence.class.getName()) . - */ - public Map getSupportedOperationSets() - { - //Copy the map so that the caller is not able to modify it. - return (Map)supportedOperationSets.clone(); - } - /** * Starts the registration process. * diff --git a/src/net/java/sip/communicator/plugin/chatalerter/ChatAlerterActivator.java b/src/net/java/sip/communicator/plugin/chatalerter/ChatAlerterActivator.java index efdbad7fa..c370410ef 100644 --- a/src/net/java/sip/communicator/plugin/chatalerter/ChatAlerterActivator.java +++ b/src/net/java/sip/communicator/plugin/chatalerter/ChatAlerterActivator.java @@ -155,10 +155,9 @@ private void handleProviderAdded(ProtocolProviderService provider) logger.debug("Adding protocol provider " + provider.getProtocolName()); // check whether the provider has a basic im operation set - OperationSetBasicInstantMessaging opSetIm - = (OperationSetBasicInstantMessaging) provider - .getSupportedOperationSets().get( - OperationSetBasicInstantMessaging.class.getName()); + OperationSetBasicInstantMessaging opSetIm = + (OperationSetBasicInstantMessaging) provider + .getOperationSet(OperationSetBasicInstantMessaging.class); if (opSetIm != null) { @@ -170,10 +169,9 @@ private void handleProviderAdded(ProtocolProviderService provider) } // check whether the provider has a sms operation set - OperationSetSmsMessaging opSetSms - = (OperationSetSmsMessaging) provider - .getSupportedOperationSets().get( - OperationSetSmsMessaging.class.getName()); + OperationSetSmsMessaging opSetSms = + (OperationSetSmsMessaging) provider + .getOperationSet(OperationSetSmsMessaging.class); if (opSetSms != null) { @@ -184,10 +182,9 @@ private void handleProviderAdded(ProtocolProviderService provider) logger.trace("Service did not have a sms op. set."); } - OperationSetMultiUserChat opSetMultiUChat - = (OperationSetMultiUserChat) provider - .getSupportedOperationSets().get( - OperationSetMultiUserChat.class.getName()); + OperationSetMultiUserChat opSetMultiUChat = + (OperationSetMultiUserChat) provider + .getOperationSet(OperationSetMultiUserChat.class); if (opSetMultiUChat != null) { @@ -216,20 +213,18 @@ private void handleProviderAdded(ProtocolProviderService provider) */ private void handleProviderRemoved(ProtocolProviderService provider) { - OperationSetBasicInstantMessaging opSetIm - = (OperationSetBasicInstantMessaging) provider - .getSupportedOperationSets().get( - OperationSetBasicInstantMessaging.class.getName()); + OperationSetBasicInstantMessaging opSetIm = + (OperationSetBasicInstantMessaging) provider + .getOperationSet(OperationSetBasicInstantMessaging.class); if (opSetIm != null) { opSetIm.removeMessageListener(this); } - OperationSetMultiUserChat opSetMultiUChat - = (OperationSetMultiUserChat) provider - .getSupportedOperationSets().get( - OperationSetMultiUserChat.class.getName()); + OperationSetMultiUserChat opSetMultiUChat = + (OperationSetMultiUserChat) provider + .getOperationSet(OperationSetMultiUserChat.class); if (opSetMultiUChat != null) { diff --git a/src/net/java/sip/communicator/plugin/mailbox/Mailbox.java b/src/net/java/sip/communicator/plugin/mailbox/Mailbox.java index 14ad84f9d..234d434e0 100644 --- a/src/net/java/sip/communicator/plugin/mailbox/Mailbox.java +++ b/src/net/java/sip/communicator/plugin/mailbox/Mailbox.java @@ -348,10 +348,9 @@ public void handleProviderAdded(ProtocolProviderService provider) logger.debug("Adding protocol provider " + provider.getProtocolName()); // check whether the provider has a basic telephony operation set - OperationSetBasicTelephony opSetTelephony - = (OperationSetBasicTelephony) provider - .getSupportedOperationSets().get( - OperationSetBasicTelephony.class.getName()); + OperationSetBasicTelephony opSetTelephony = + (OperationSetBasicTelephony) provider + .getOperationSet(OperationSetBasicTelephony.class); if (opSetTelephony != null) { @@ -372,10 +371,9 @@ public void handleProviderAdded(ProtocolProviderService provider) */ private void handleProviderRemoved(ProtocolProviderService provider) { - OperationSetBasicTelephony opSetTelephony - = (OperationSetBasicTelephony) provider - .getSupportedOperationSets().get( - OperationSetBasicTelephony.class.getName()); + OperationSetBasicTelephony opSetTelephony = + (OperationSetBasicTelephony) provider + .getOperationSet(OperationSetBasicTelephony.class); if (opSetTelephony != null) { diff --git a/src/net/java/sip/communicator/service/protocol/AbstractProtocolProviderService.java b/src/net/java/sip/communicator/service/protocol/AbstractProtocolProviderService.java index 5d1b4146d..1898ac03b 100644 --- a/src/net/java/sip/communicator/service/protocol/AbstractProtocolProviderService.java +++ b/src/net/java/sip/communicator/service/protocol/AbstractProtocolProviderService.java @@ -32,6 +32,12 @@ public abstract class AbstractProtocolProviderService private final List registrationListeners = new ArrayList(); + /** + * The hashtable with the operation sets that we support locally. + */ + protected final Map supportedOperationSets + = new Hashtable(); + /** * Registers the specified listener with this provider so that it would * receive notifications on changes of its state or other properties such @@ -92,6 +98,20 @@ public void fireRegistrationStateChanged( RegistrationState oldState, logger.trace("Done."); } + /** + * Returns the operation set corresponding to the specified class or null if + * this operation set is not supported by the provider implementation. + * + * @param opsetClass the Class of the operation set that we're + * looking for. + * @return returns an OperationSet of the specified Class if the + * undelying implementation supports it or null otherwise. + */ + public OperationSet getOperationSet(Class opsetClass) + { + return doGetSupportedOperationSets().get(opsetClass.getName()); + } + /** * Returns the protocol display name. This is the name that would be used * by the GUI to display the protocol name. @@ -106,6 +126,31 @@ public String getProtocolDisplayName() return (displayName == null) ? getProtocolName() : displayName; } + /** + * Returns an array containing all operation sets supported by the current + * implementation. When querying this method users must be prepared to + * receive any subset of the OperationSet-s defined by this service. They + * MUST ignore any OperationSet-s that they are not aware of and that may be + * defined by future version of this service. Such "unknown" OperationSet-s + * though not encouraged, may also be defined by service implementors. + * + * @return a java.util.Map containing instance of all supported operation + * sets mapped against their class names (e.g. + * OperationSetPresence.class.getName()) . + */ + public Map getSupportedOperationSets() + { + Map supportedOperationSets = + doGetSupportedOperationSets(); + + return new Hashtable(supportedOperationSets); + } + + protected Map doGetSupportedOperationSets() + { + return supportedOperationSets; + } + /** * Indicates whether or not this provider is registered * diff --git a/src/net/java/sip/communicator/service/protocol/ProtocolProviderService.java b/src/net/java/sip/communicator/service/protocol/ProtocolProviderService.java index 0d521273a..59227f0c7 100644 --- a/src/net/java/sip/communicator/service/protocol/ProtocolProviderService.java +++ b/src/net/java/sip/communicator/service/protocol/ProtocolProviderService.java @@ -10,7 +10,6 @@ import net.java.sip.communicator.service.protocol.event.*; - /** * The ProtocolProvider interface should be implemented by bundles that wrap * Instant Messaging and telephony protocol stacks. It gives the user interface @@ -134,7 +133,7 @@ public void removeRegistrationStateChangeListener( /** * Returns an array containing all operation sets supported by the current * implementation. When querying this method users must be prepared to - * receive any sybset of the OperationSet-s defined by this service. They + * receive any subset of the OperationSet-s defined by this service. They * MUST ignore any OperationSet-s that they are not aware of and that may be * defined by future version of this service. Such "unknown" OperationSet-s * though not encouraged, may also be defined by service implementors. @@ -143,7 +142,7 @@ public void removeRegistrationStateChangeListener( * sets mapped against their class names (e.g. * OperationSetPresence.class.getName()) . */ - public Map getSupportedOperationSets(); + public Map getSupportedOperationSets(); /** * Returns the operation set corresponding to the specified class or null @@ -154,7 +153,7 @@ public void removeRegistrationStateChangeListener( * @return returns an OperationSet of the specified Class if the * undelying implementation supports it or null otherwise. */ - public OperationSet getOperationSet(Class opsetClass); + public OperationSet getOperationSet(Class opsetClass); /** * Makes the service implementation close all open sockets and release diff --git a/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java b/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java index 0485448cb..2f28d79d2 100644 --- a/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java +++ b/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java @@ -91,12 +91,9 @@ public void setupContact() mockProvider = new MockProvider("CallHistoryMockUser"); //store thre presence op set of the new provider into the fixture - Map supportedOperationSets = - mockProvider.getSupportedOperationSets(); - mockBTelphonyOpSet = - (MockOperationSetBasicTelephony) supportedOperationSets.get( - OperationSetBasicTelephony.class.getName()); + (MockOperationSetBasicTelephony) mockProvider + .getOperationSet(OperationSetBasicTelephony.class); System.setProperty(MetaContactListService.PROVIDER_MASK_PROPERTY, "1"); diff --git a/test/net/java/sip/communicator/slick/contactlist/MclSlickFixture.java b/test/net/java/sip/communicator/slick/contactlist/MclSlickFixture.java index 451cc355c..a92df3d67 100644 --- a/test/net/java/sip/communicator/slick/contactlist/MclSlickFixture.java +++ b/test/net/java/sip/communicator/slick/contactlist/MclSlickFixture.java @@ -118,22 +118,20 @@ public class MclSlickFixture mockP1Grp1.addContact(emilP1); mockP1Grp1.addSubgroup(subMockP1Grp); - mockPresOpSetP1 = (MockPersistentPresenceOperationSet) mockP1 - .getSupportedOperationSets().get( - OperationSetPresence.class.getName()); + mockPresOpSetP1 = + (MockPersistentPresenceOperationSet) mockP1 + .getOperationSet(OperationSetPresence.class); mockPresOpSetP1.addMockGroup(mockP1Grp1); //init mock provider 2 mockP2Grp1.addContact(emilP2); - mockPresOpSetP2 = (MockPersistentPresenceOperationSet) mockP2 - .getSupportedOperationSets().get( - OperationSetPresence.class.getName()); + mockPresOpSetP2 = + (MockPersistentPresenceOperationSet) mockP2 + .getOperationSet(OperationSetPresence.class); mockPresOpSetP2.addMockGroup(mockP2Grp1); } - - public MclSlickFixture(Object obj) { } diff --git a/test/net/java/sip/communicator/slick/contactlist/MetaContactListServiceLick.java b/test/net/java/sip/communicator/slick/contactlist/MetaContactListServiceLick.java index 7c8b5bd32..af219998b 100644 --- a/test/net/java/sip/communicator/slick/contactlist/MetaContactListServiceLick.java +++ b/test/net/java/sip/communicator/slick/contactlist/MetaContactListServiceLick.java @@ -78,14 +78,11 @@ public void start(BundleContext context) MclSlickFixture.mockProvider = provider; //store thre presence op set of the new provider into the fixture - Map supportedOperationSets = - MclSlickFixture.mockProvider.getSupportedOperationSets(); //get the operation set presence here. MclSlickFixture.mockPresOpSet = - (MockPersistentPresenceOperationSet)supportedOperationSets.get( - OperationSetPersistentPresence.class.getName()); - + (MockPersistentPresenceOperationSet) MclSlickFixture.mockProvider + .getOperationSet(OperationSetPersistentPresence.class); //add the meta contact list tests. addTestSuite(TestMetaContactList.class); @@ -175,10 +172,9 @@ public static ServiceRegistration registerMockProviderService( */ private void fillMockContactList(MockProvider provider) { - MockPersistentPresenceOperationSet mockOpSet - = (MockPersistentPresenceOperationSet)provider. - getSupportedOperationSets().get( OperationSetPersistentPresence. - class.getName()); + MockPersistentPresenceOperationSet mockOpSet = + (MockPersistentPresenceOperationSet) provider + .getOperationSet(OperationSetPersistentPresence.class); MockContactGroup root = (MockContactGroup)mockOpSet.getServerStoredContactListRoot(); root.addContact( new MockContact("Ivan Ivanov", provider) ); diff --git a/test/net/java/sip/communicator/slick/contactlist/TestMetaContactGroup.java b/test/net/java/sip/communicator/slick/contactlist/TestMetaContactGroup.java index 29fbbd2b7..0d6a863a0 100644 --- a/test/net/java/sip/communicator/slick/contactlist/TestMetaContactGroup.java +++ b/test/net/java/sip/communicator/slick/contactlist/TestMetaContactGroup.java @@ -45,10 +45,9 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - OperationSetPersistentPresence opSetPresence - = (OperationSetPersistentPresence)fixture.mockProvider - .getSupportedOperationSets().get( - OperationSetPersistentPresence.class.getName()); + OperationSetPersistentPresence opSetPresence = + (OperationSetPersistentPresence) fixture.mockProvider + .getOperationSet(OperationSetPersistentPresence.class); mockGroup = (MockContactGroup)opSetPresence .getServerStoredContactListRoot(); diff --git a/test/net/java/sip/communicator/slick/contactlist/TestMetaContactListPersistence.java b/test/net/java/sip/communicator/slick/contactlist/TestMetaContactListPersistence.java index a3b75d71f..6011b14e7 100644 --- a/test/net/java/sip/communicator/slick/contactlist/TestMetaContactListPersistence.java +++ b/test/net/java/sip/communicator/slick/contactlist/TestMetaContactListPersistence.java @@ -189,10 +189,10 @@ public void testPartialContactListRestauration() { //verify that contents of the meta contact list matches contents of //the mock provider we removed. - ContactGroup oldProtoRoot = ((OperationSetPersistentPresence)fixture - .mockProvider.getSupportedOperationSets().get( - OperationSetPersistentPresence.class.getName())) - .getServerStoredContactListRoot(); + ContactGroup oldProtoRoot = + ((OperationSetPersistentPresence) fixture.mockProvider + .getOperationSet(OperationSetPersistentPresence.class)) + .getServerStoredContactListRoot(); fixture.assertGroupEquals( (MockContactGroup)oldProtoRoot @@ -202,10 +202,10 @@ public void testPartialContactListRestauration() //verify that the new mock provider has created unresolved contacts //for all contacts in the meta cl. - ContactGroup newProtoRoot = ((OperationSetPersistentPresence)fixture - .replacementMockPr.getSupportedOperationSets().get( - OperationSetPersistentPresence.class.getName())) - .getServerStoredContactListRoot(); + ContactGroup newProtoRoot = + ((OperationSetPersistentPresence) fixture.replacementMockPr + .getOperationSet(OperationSetPersistentPresence.class)) + .getServerStoredContactListRoot(); assertEquals("Newly loaded provider does not match the old one." , oldProtoRoot @@ -239,32 +239,32 @@ public void testCompleteContactListRestauration() .registerMockProviderService(fixture.replacementMockP2); //Get references to the root groups of the 2 providers we removed - ContactGroup oldProtoMockP1Root = ((OperationSetPersistentPresence) - fixture.mockP1.getSupportedOperationSets().get( - OperationSetPersistentPresence.class.getName())) - .getServerStoredContactListRoot(); + ContactGroup oldProtoMockP1Root = + ((OperationSetPersistentPresence) fixture.mockP1 + .getOperationSet(OperationSetPersistentPresence.class)) + .getServerStoredContactListRoot(); - ContactGroup oldProtoMockP2Root = ( (OperationSetPersistentPresence) - fixture.mockP2.getSupportedOperationSets(). - get(OperationSetPersistentPresence.class.getName())) - .getServerStoredContactListRoot(); + ContactGroup oldProtoMockP2Root = + ((OperationSetPersistentPresence) fixture.mockP2 + .getOperationSet(OperationSetPersistentPresence.class)) + .getServerStoredContactListRoot(); //verify that contacts tnat unresolved contacts that have been created //inside that the replacement mock providers match those in the //providers we removed. - ContactGroup newProtoMockP1Root = ((OperationSetPersistentPresence)fixture - .replacementMockP1.getSupportedOperationSets().get( - OperationSetPersistentPresence.class.getName())) - .getServerStoredContactListRoot(); + ContactGroup newProtoMockP1Root = + ((OperationSetPersistentPresence) fixture.replacementMockP1 + .getOperationSet(OperationSetPersistentPresence.class)) + .getServerStoredContactListRoot(); assertEquals("Newly loaded provider does not match the old one." , oldProtoMockP1Root , newProtoMockP1Root); - ContactGroup newProtoMockP2Root = ((OperationSetPersistentPresence)fixture - .replacementMockP2.getSupportedOperationSets().get( - OperationSetPersistentPresence.class.getName())) - .getServerStoredContactListRoot(); + ContactGroup newProtoMockP2Root = + ((OperationSetPersistentPresence) fixture.replacementMockP2 + .getOperationSet(OperationSetPersistentPresence.class)) + .getServerStoredContactListRoot(); assertEquals("Newly loaded provider does not match the old one." , oldProtoMockP2Root diff --git a/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java b/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java index 3c989a57b..0a8f4616a 100644 --- a/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java +++ b/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java @@ -111,7 +111,7 @@ public void setupContact() mockProvider = new MockProvider("MessageHistoryMockUser"); //store thre presence op set of the new provider into the fixture - Map supportedOperationSets = + Map supportedOperationSets = mockProvider.getSupportedOperationSets(); //get the operation set presence here. 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 4e350116d..fc970b53b 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/GibberishSlickFixture.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/GibberishSlickFixture.java @@ -216,7 +216,8 @@ public static Bundle findProtocolProviderBundle( public void clearProvidersLists() throws Exception { - Map supportedOperationSets1 = provider1.getSupportedOperationSets(); + Map supportedOperationSets1 = + provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null || supportedOperationSets1.size() < 1) @@ -238,7 +239,8 @@ public void clearProvidersLists() + "Operation Sets"); // lets do it once again for the second provider - Map supportedOperationSets2 = provider2.getSupportedOperationSets(); + Map supportedOperationSets2 = + provider2.getSupportedOperationSets(); if (supportedOperationSets2 == null || supportedOperationSets2.size() < 1) 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 ebf7cf62e..2b45377f0 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetBasicInstantMessaging.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetBasicInstantMessaging.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.event.*; import net.java.sip.communicator.util.*; @@ -49,7 +50,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets1 = + Map supportedOperationSets1 = fixture.provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null @@ -82,7 +83,7 @@ protected void setUp() throws Exception + "implementation of at least one of the PresenceOperationSets"); } - Map supportedOperationSets2 = + Map supportedOperationSets2 = fixture.provider2.getSupportedOperationSets(); if ( supportedOperationSets2 == null 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 e97f4ab37..cf1009f8d 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetPersistentPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetPersistentPresence.java @@ -9,6 +9,7 @@ import java.util.*; import junit.framework.*; + import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.event.*; import net.java.sip.communicator.util.*; @@ -73,7 +74,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets1 = + Map supportedOperationSets1 = fixture.provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null @@ -96,8 +97,8 @@ protected void setUp() throws Exception + "Operation Sets"); // lets do it once again for the second provider - Map supportedOperationSets2 = - fixture.provider2.getSupportedOperationSets(); + Map supportedOperationSets2 = + fixture.provider2.getSupportedOperationSets(); if (supportedOperationSets2 == null || supportedOperationSets2.size() < 1) 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 a57ddc1d9..51a588492 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetPresence.java @@ -51,7 +51,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets1 = + Map supportedOperationSets1 = fixture.provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null @@ -76,7 +76,7 @@ protected void setUp() throws Exception } // do it once again for the second provider - Map supportedOperationSets2 = + Map supportedOperationSets2 = fixture.provider2.getSupportedOperationSets(); if ( supportedOperationSets2 == 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 86fb2f640..f3db8903a 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetTypingNotifications.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetTypingNotifications.java @@ -44,7 +44,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets1 = + Map supportedOperationSets1 = fixture.provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null @@ -90,7 +90,7 @@ protected void setUp() throws Exception + "implementation of at least one of the PresenceOperationSets"); } - Map supportedOperationSets2 = + Map supportedOperationSets2 = fixture.provider2.getSupportedOperationSets(); if ( supportedOperationSets2 == null 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 bc04f2fec..6c6b6b80a 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/TestProtocolProviderServiceGibberishImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/TestProtocolProviderServiceGibberishImpl.java @@ -145,20 +145,19 @@ public void testRegister() */ public void testOperationSetTypes() throws Exception { - Map supportedOperationSets - = fixture.provider1.getSupportedOperationSets(); + Map supportedOperationSets = + fixture.provider1.getSupportedOperationSets(); - //make sure that keys (which are supposed to be class names) correspond - //what the class of the values recorded against them. - Iterator setNames = supportedOperationSets.keySet().iterator(); - while (setNames.hasNext()) + // make sure that keys (which are supposed to be class names) correspond + // what the class of the values recorded against them. + for (Map.Entry entry : supportedOperationSets + .entrySet()) { - String setName = (String) setNames.next(); - Object opSet = supportedOperationSets.get(setName); + String setName = entry.getKey(); + Object opSet = entry.getValue(); - assertTrue(opSet + " was not an instance of " - + setName + " as declared" - , Class.forName(setName).isInstance(opSet)); + assertTrue(opSet + " was not an instance of " + setName + + " as declared", Class.forName(setName).isInstance(opSet)); } } 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 1f171c780..9d5232e6c 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetBasicInstantMessaging.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetBasicInstantMessaging.java @@ -48,7 +48,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets = + Map supportedOperationSets = fixture.provider.getSupportedOperationSets(); if ( supportedOperationSets == null 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 33082c00b..12d465efb 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPersistentPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPersistentPresence.java @@ -75,7 +75,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets = + Map supportedOperationSets = fixture.provider.getSupportedOperationSets(); if ( supportedOperationSets == null 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 855117396..b6b212436 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPresence.java @@ -53,7 +53,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets = + Map supportedOperationSets = fixture.provider.getSupportedOperationSets(); if ( supportedOperationSets == null 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 47cdb60e6..d65f58867 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetServerStoredInfo.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetServerStoredInfo.java @@ -47,7 +47,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets = + Map supportedOperationSets = fixture.provider.getSupportedOperationSets(); if ( supportedOperationSets == null 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 7b386c4b1..2ad71d3a2 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetTypingNotifications.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetTypingNotifications.java @@ -42,7 +42,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets = + Map supportedOperationSets = fixture.provider.getSupportedOperationSets(); if ( supportedOperationSets == null 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 dadcdc46f..e56f2d757 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestProtocolProviderServiceIcqImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestProtocolProviderServiceIcqImpl.java @@ -146,11 +146,9 @@ public void testRegister() // Here is registered the listener which will receive the first message // This message is supposed to be offline message and as one is tested // in TestOperationSetBasicInstantMessaging.testReceiveOfflineMessages() - Map supportedOperationSets = - fixture.provider.getSupportedOperationSets(); OperationSetBasicInstantMessaging opSetBasicIM = - (OperationSetBasicInstantMessaging)supportedOperationSets.get( - OperationSetBasicInstantMessaging.class.getName()); + (OperationSetBasicInstantMessaging) fixture.provider + .getOperationSet(OperationSetBasicInstantMessaging.class); fixture.offlineMsgCollector.register(opSetBasicIM); //give time for the AIM server to notify everyone of our arrival @@ -236,24 +234,22 @@ public void testGetRegistrationState() */ public void testOperationSetTypes() throws Exception { - Map supportedOperationSets - = fixture.provider.getSupportedOperationSets(); + Map supportedOperationSets = + fixture.provider.getSupportedOperationSets(); - //make sure that keys (which are supposed to be class names) correspond - //what the class of the values recorded against them. - Iterator setNames = supportedOperationSets.keySet().iterator(); - while (setNames.hasNext()) + // make sure that keys (which are supposed to be class names) correspond + // what the class of the values recorded against them. + for (Map.Entry entry : supportedOperationSets + .entrySet()) { - String setName = (String) setNames.next(); - Object opSet = supportedOperationSets.get(setName); + String setName = entry.getKey(); + Object opSet = entry.getValue(); - assertTrue(opSet + " was not an instance of " - + setName + " as declared" - , Class.forName(setName).isInstance(opSet)); + assertTrue(opSet + " was not an instance of " + setName + + " as declared", Class.forName(setName).isInstance(opSet)); } } - /** * A class that would plugin as a registration listener to a protocol * provider and simply record all events that it sees and notify the 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 86f78e92b..ce63093c2 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/JabberSlickFixture.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/JabberSlickFixture.java @@ -7,7 +7,6 @@ package net.java.sip.communicator.slick.protocol.jabber; import java.util.*; -import java.util.Map; import org.osgi.framework.*; @@ -229,7 +228,8 @@ public static Bundle findProtocolProviderBundle( public void clearProvidersLists() throws Exception { - Map supportedOperationSets1 = provider1.getSupportedOperationSets(); + Map supportedOperationSets1 = + provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null || supportedOperationSets1.size() < 1) @@ -251,7 +251,8 @@ public void clearProvidersLists() + "Operation Sets"); // lets do it once again for the second provider - Map supportedOperationSets2 = provider2.getSupportedOperationSets(); + Map supportedOperationSets2 = + provider2.getSupportedOperationSets(); if (supportedOperationSets2 == null || supportedOperationSets2.size() < 1) 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 5dee6bbe8..98854430c 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetBasicInstantMessaging.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetBasicInstantMessaging.java @@ -49,7 +49,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets1 = + Map supportedOperationSets1 = fixture.provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null @@ -82,7 +82,7 @@ protected void setUp() throws Exception + "implementation of at least one of the PresenceOperationSets"); } - Map supportedOperationSets2 = + Map supportedOperationSets2 = fixture.provider2.getSupportedOperationSets(); if ( supportedOperationSets2 == null diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetMultiUserChat.java b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetMultiUserChat.java index 4b0f7e240..cb7d7f3ca 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetMultiUserChat.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetMultiUserChat.java @@ -96,7 +96,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets1 = + Map supportedOperationSets1 = fixture.provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null @@ -129,7 +129,7 @@ protected void setUp() throws Exception + "implementation of at least one of the PresenceOperationSets"); } - Map supportedOperationSets2 = + Map supportedOperationSets2 = fixture.provider2.getSupportedOperationSets(); if ( supportedOperationSets2 == null 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 ad9e4c780..b11d3c9c2 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPersistentPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPersistentPresence.java @@ -70,7 +70,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets1 = + Map supportedOperationSets1 = fixture.provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null @@ -93,8 +93,8 @@ protected void setUp() throws Exception + "Operation Sets"); // lets do it once again for the second provider - Map supportedOperationSets2 = - fixture.provider2.getSupportedOperationSets(); + Map supportedOperationSets2 = + fixture.provider2.getSupportedOperationSets(); if (supportedOperationSets2 == null || supportedOperationSets2.size() < 1) 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 9e956be3c..1ad8f03ae 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPresence.java @@ -55,7 +55,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets1 = + Map supportedOperationSets1 = fixture.provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null @@ -80,7 +80,7 @@ protected void setUp() throws Exception } // do it once again for the second provider - Map supportedOperationSets2 = + Map supportedOperationSets2 = fixture.provider2.getSupportedOperationSets(); if ( supportedOperationSets2 == null 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 5fcb50213..c938cce48 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetTypingNotifications.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetTypingNotifications.java @@ -44,7 +44,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets1 = + Map supportedOperationSets1 = fixture.provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null @@ -90,7 +90,7 @@ protected void setUp() throws Exception + "implementation of at least one of the PresenceOperationSets"); } - Map supportedOperationSets2 = + Map supportedOperationSets2 = fixture.provider2.getSupportedOperationSets(); if ( supportedOperationSets2 == null 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 4181b3efe..a8b7e4bf3 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestProtocolProviderServiceJabberImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestProtocolProviderServiceJabberImpl.java @@ -145,20 +145,19 @@ public void testRegister() */ public void testOperationSetTypes() throws Exception { - Map supportedOperationSets - = fixture.provider1.getSupportedOperationSets(); + Map supportedOperationSets = + fixture.provider1.getSupportedOperationSets(); - //make sure that keys (which are supposed to be class names) correspond - //what the class of the values recorded against them. - Iterator setNames = supportedOperationSets.keySet().iterator(); - while (setNames.hasNext()) + // make sure that keys (which are supposed to be class names) correspond + // what the class of the values recorded against them. + for (Map.Entry entry : supportedOperationSets + .entrySet()) { - String setName = (String) setNames.next(); - Object opSet = supportedOperationSets.get(setName); + String setName = entry.getKey(); + Object opSet = entry.getValue(); - assertTrue(opSet + " was not an instance of " - + setName + " as declared" - , Class.forName(setName).isInstance(opSet)); + assertTrue(opSet + " was not an instance of " + setName + + " as declared", Class.forName(setName).isInstance(opSet)); } } 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 330c1e2ec..fd00ebc7b 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/MsnSlickFixture.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/MsnSlickFixture.java @@ -9,7 +9,7 @@ import org.osgi.framework.*; import junit.framework.*; import net.java.sip.communicator.service.protocol.*; -import java.util.Map; + import java.util.*; /** @@ -214,7 +214,8 @@ public static Bundle findProtocolProviderBundle( public void clearProvidersLists() throws Exception { - Map supportedOperationSets1 = provider1.getSupportedOperationSets(); + Map supportedOperationSets1 = + provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null || supportedOperationSets1.size() < 1) @@ -236,7 +237,8 @@ public void clearProvidersLists() + "Operation Sets"); // lets do it once again for the second provider - Map supportedOperationSets2 = provider2.getSupportedOperationSets(); + Map supportedOperationSets2 = + provider2.getSupportedOperationSets(); if (supportedOperationSets2 == null || supportedOperationSets2.size() < 1) 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 b229d8309..329badbd7 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetBasicInstantMessaging.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetBasicInstantMessaging.java @@ -49,7 +49,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets1 = + Map supportedOperationSets1 = fixture.provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null @@ -82,7 +82,7 @@ protected void setUp() throws Exception + "implementation of at least one of the PresenceOperationSets"); } - Map supportedOperationSets2 = + Map supportedOperationSets2 = fixture.provider2.getSupportedOperationSets(); if ( supportedOperationSets2 == null 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 2e98202db..18d26d71e 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetPersistentPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetPersistentPresence.java @@ -70,7 +70,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets1 = + Map supportedOperationSets1 = fixture.provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null @@ -93,8 +93,8 @@ protected void setUp() throws Exception + "Operation Sets"); // lets do it once again for the second provider - Map supportedOperationSets2 = - fixture.provider2.getSupportedOperationSets(); + Map supportedOperationSets2 = + fixture.provider2.getSupportedOperationSets(); if (supportedOperationSets2 == null || supportedOperationSets2.size() < 1) 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 702985730..00c5df9da 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetPresence.java @@ -49,7 +49,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets1 = + Map supportedOperationSets1 = fixture.provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null @@ -74,7 +74,7 @@ protected void setUp() throws Exception } // do it once again for the second provider - Map supportedOperationSets2 = + Map supportedOperationSets2 = fixture.provider2.getSupportedOperationSets(); if ( supportedOperationSets2 == 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 27cde0d87..4eb90e4d1 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetTypingNotifications.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetTypingNotifications.java @@ -44,7 +44,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets1 = + Map supportedOperationSets1 = fixture.provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null @@ -90,7 +90,7 @@ protected void setUp() throws Exception + "implementation of at least one of the PresenceOperationSets"); } - Map supportedOperationSets2 = + Map supportedOperationSets2 = fixture.provider2.getSupportedOperationSets(); if ( supportedOperationSets2 == null 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 a4f0c0b1e..7eb36048a 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestProtocolProviderServiceMsnImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestProtocolProviderServiceMsnImpl.java @@ -9,6 +9,7 @@ import java.util.*; import junit.framework.*; + import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.event.*; import net.java.sip.communicator.util.*; @@ -145,20 +146,19 @@ public void testRegister() */ public void testOperationSetTypes() throws Exception { - Map supportedOperationSets - = fixture.provider1.getSupportedOperationSets(); + Map supportedOperationSets = + fixture.provider1.getSupportedOperationSets(); - //make sure that keys (which are supposed to be class names) correspond - //what the class of the values recorded against them. - Iterator setNames = supportedOperationSets.keySet().iterator(); - while (setNames.hasNext()) + // make sure that keys (which are supposed to be class names) correspond + // what the class of the values recorded against them. + for (Map.Entry entry : supportedOperationSets + .entrySet()) { - String setName = (String) setNames.next(); - Object opSet = supportedOperationSets.get(setName); + String setName = entry.getKey(); + Object opSet = entry.getValue(); - assertTrue(opSet + " was not an instance of " - + setName + " as declared" - , Class.forName(setName).isInstance(opSet)); + assertTrue(opSet + " was not an instance of " + setName + + " as declared", Class.forName(setName).isInstance(opSet)); } } 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 503746fca..2c97bdfdb 100755 --- a/test/net/java/sip/communicator/slick/protocol/rss/TestProtocolProviderServiceRssImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/rss/TestProtocolProviderServiceRssImpl.java @@ -116,20 +116,21 @@ public void testRegister() throws OperationFailedException */ public void testOperationsSets() throws ClassNotFoundException { - Map supportedOperationSets = - fixture.provider.getSupportedOperationSets(); - - //get the keys for the supported operation set. The keys are strings - //corresponding to class names. - Iterator setNames = supportedOperationSets.keySet().iterator(); - while (setNames.hasNext()) - { - String key = (String) setNames.next(); - Object opSet = supportedOperationSets.get(key); - - assertTrue(opSet + " was not an instance of " + key +"as declared", - Class.forName(key).isInstance(opSet)); - } + Map supportedOperationSets = + fixture.provider.getSupportedOperationSets(); + + // get the keys for the supported operation set. The keys are strings + // corresponding to class names. + for (Map.Entry entry : supportedOperationSets + .entrySet()) + { + String key = entry.getKey(); + Object opSet = entry.getValue(); + + assertTrue( + opSet + " was not an instance of " + key + "as declared", Class + .forName(key).isInstance(opSet)); + } } /** 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 557e23e60..bb3e69279 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/SipSlickFixture.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/SipSlickFixture.java @@ -218,7 +218,8 @@ public static Bundle findProtocolProviderBundle( public void clearProvidersLists() throws Exception { - Map supportedOperationSets1 = provider1.getSupportedOperationSets(); + Map supportedOperationSets1 = + provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null || supportedOperationSets1.size() < 1) @@ -240,7 +241,8 @@ public void clearProvidersLists() + "Operation Sets"); // lets do it once again for the second provider - Map supportedOperationSets2 = provider2.getSupportedOperationSets(); + Map supportedOperationSets2 = + provider2.getSupportedOperationSets(); if (supportedOperationSets2 == null || supportedOperationSets2.size() < 1) 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 eccdef5d5..5e93db17f 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetBasicInstantMessaging.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetBasicInstantMessaging.java @@ -49,7 +49,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets1 = + Map supportedOperationSets1 = fixture.provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null @@ -82,7 +82,7 @@ protected void setUp() throws Exception + "implementation of at least one of the PresenceOperationSets"); } - Map supportedOperationSets2 = + Map supportedOperationSets2 = fixture.provider2.getSupportedOperationSets(); if ( supportedOperationSets2 == 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 2dab9a721..eaae99601 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetPersistentPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetPersistentPresence.java @@ -73,7 +73,7 @@ protected void setUp() throws Exception super.setUp(); this.fixture.setUp(); - Map supportedOperationSets1 = + Map supportedOperationSets1 = this.fixture.provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null @@ -96,7 +96,7 @@ protected void setUp() throws Exception + "Operation Sets"); // lets do it once again for the second provider - Map supportedOperationSets2 = + Map supportedOperationSets2 = this.fixture.provider2.getSupportedOperationSets(); if (supportedOperationSets2 == null 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 54216f30a..bfd51c2c7 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetPresence.java @@ -49,7 +49,7 @@ protected void setUp() throws Exception super.setUp(); this.fixture.setUp(); - Map supportedOperationSets1 = + Map supportedOperationSets1 = this.fixture.provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null @@ -74,7 +74,7 @@ protected void setUp() throws Exception } // do it once again for the second provider - Map supportedOperationSets2 = + Map supportedOperationSets2 = this.fixture.provider2.getSupportedOperationSets(); if (supportedOperationSets2 == 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 044387a92..091a48493 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestProtocolProviderServiceSipImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestProtocolProviderServiceSipImpl.java @@ -145,20 +145,19 @@ public void testRegister() */ public void testOperationSetTypes() throws Exception { - Map supportedOperationSets - = fixture.provider1.getSupportedOperationSets(); + Map supportedOperationSets = + fixture.provider1.getSupportedOperationSets(); - //make sure that keys (which are supposed to be class names) correspond - //what the class of the values recorded against them. - Iterator setNames = supportedOperationSets.keySet().iterator(); - while (setNames.hasNext()) + // make sure that keys (which are supposed to be class names) correspond + // what the class of the values recorded against them. + for (Map.Entry entry : supportedOperationSets + .entrySet()) { - String setName = (String) setNames.next(); - Object opSet = supportedOperationSets.get(setName); + String setName = entry.getKey(); + Object opSet = entry.getValue(); - assertTrue(opSet + " was not an instance of " - + setName + " as declared" - , Class.forName(setName).isInstance(opSet)); + assertTrue(opSet + " was not an instance of " + setName + + " as declared", Class.forName(setName).isInstance(opSet)); } } 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 3ab739882..cc25a0b62 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetBasicInstantMessaging.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetBasicInstantMessaging.java @@ -49,7 +49,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets1 = + Map supportedOperationSets1 = fixture.provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null @@ -82,7 +82,7 @@ protected void setUp() throws Exception + "implementation of at least one of the PresenceOperationSets"); } - Map supportedOperationSets2 = + Map supportedOperationSets2 = fixture.provider2.getSupportedOperationSets(); if ( supportedOperationSets2 == null 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 163272b1d..7fdf5362a 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPersistentPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPersistentPresence.java @@ -70,7 +70,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets1 = + Map supportedOperationSets1 = fixture.provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null @@ -93,8 +93,8 @@ protected void setUp() throws Exception + "Operation Sets"); // lets do it once again for the second provider - Map supportedOperationSets2 = - fixture.provider2.getSupportedOperationSets(); + Map supportedOperationSets2 = + fixture.provider2.getSupportedOperationSets(); if (supportedOperationSets2 == null || supportedOperationSets2.size() < 1) 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 c58b23e75..14d3ecf45 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPresence.java @@ -51,7 +51,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets1 = + Map supportedOperationSets1 = fixture.provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null @@ -76,7 +76,7 @@ protected void setUp() throws Exception } // do it once again for the second provider - Map supportedOperationSets2 = + Map supportedOperationSets2 = fixture.provider2.getSupportedOperationSets(); if ( supportedOperationSets2 == null 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 790a25340..b3116a443 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetTypingNotifications.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetTypingNotifications.java @@ -44,7 +44,7 @@ protected void setUp() throws Exception super.setUp(); fixture.setUp(); - Map supportedOperationSets1 = + Map supportedOperationSets1 = fixture.provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null @@ -90,7 +90,7 @@ protected void setUp() throws Exception + "implementation of at least one of the PresenceOperationSets"); } - Map supportedOperationSets2 = + Map supportedOperationSets2 = fixture.provider2.getSupportedOperationSets(); if ( supportedOperationSets2 == null 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 cc4daa3fc..e32f9cfd6 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestProtocolProviderServiceYahooImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestProtocolProviderServiceYahooImpl.java @@ -145,20 +145,19 @@ public void testRegister() */ public void testOperationSetTypes() throws Exception { - Map supportedOperationSets - = fixture.provider1.getSupportedOperationSets(); + Map supportedOperationSets = + fixture.provider1.getSupportedOperationSets(); - //make sure that keys (which are supposed to be class names) correspond - //what the class of the values recorded against them. - Iterator setNames = supportedOperationSets.keySet().iterator(); - while (setNames.hasNext()) + // make sure that keys (which are supposed to be class names) correspond + // what the class of the values recorded against them. + for (Map.Entry entry : supportedOperationSets + .entrySet()) { - String setName = (String) setNames.next(); - Object opSet = supportedOperationSets.get(setName); + String setName = entry.getKey(); + Object opSet = entry.getValue(); - assertTrue(opSet + " was not an instance of " - + setName + " as declared" - , Class.forName(setName).isInstance(opSet)); + assertTrue(opSet + " was not an instance of " + setName + + " as declared", Class.forName(setName).isInstance(opSet)); } } 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 75d9e0c17..33371ed88 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/YahooSlickFixture.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/YahooSlickFixture.java @@ -9,7 +9,7 @@ import org.osgi.framework.*; import junit.framework.*; import net.java.sip.communicator.service.protocol.*; -import java.util.Map; + import java.util.*; /** @@ -214,7 +214,8 @@ public static Bundle findProtocolProviderBundle( public void clearProvidersLists() throws Exception { - Map supportedOperationSets1 = provider1.getSupportedOperationSets(); + Map supportedOperationSets1 = + provider1.getSupportedOperationSets(); if ( supportedOperationSets1 == null || supportedOperationSets1.size() < 1) @@ -236,7 +237,8 @@ public void clearProvidersLists() + "Operation Sets"); // lets do it once again for the second provider - Map supportedOperationSets2 = provider2.getSupportedOperationSets(); + Map supportedOperationSets2 = + provider2.getSupportedOperationSets(); if (supportedOperationSets2 == null || supportedOperationSets2.size() < 1)