diff options
author | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2013-05-23 18:50:35 +0300 |
---|---|---|
committer | Lyubomir Marinov <lyubomir.marinov@jitsi.org> | 2013-05-23 18:50:35 +0300 |
commit | b211c26d6c8f51a75d3b64b6092284c3847a3a8a (patch) | |
tree | a51b7d816a27f8db492cf9c44f998e2da8176635 /test/net/java/sip/communicator | |
parent | 24e81b82808681c6b5741b14048ef58c4e665e37 (diff) | |
download | jitsi-b211c26d6c8f51a75d3b64b6092284c3847a3a8a.zip jitsi-b211c26d6c8f51a75d3b64b6092284c3847a3a8a.tar.gz jitsi-b211c26d6c8f51a75d3b64b6092284c3847a3a8a.tar.bz2 |
Fixes warnings, removes trailing whitespace, adds @Override annotations.
Diffstat (limited to 'test/net/java/sip/communicator')
106 files changed, 1301 insertions, 1050 deletions
diff --git a/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java b/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java index 71716e2..59c84c8 100644 --- a/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java +++ b/test/net/java/sip/communicator/slick/callhistory/TestCallHistoryService.java @@ -76,10 +76,12 @@ public class TestCallHistoryService return suite; } + @Override protected void setUp() throws Exception { } + @Override protected void tearDown() throws Exception { } diff --git a/test/net/java/sip/communicator/slick/configuration/TestConfigurationService.java b/test/net/java/sip/communicator/slick/configuration/TestConfigurationService.java index e2c428d..1cccd8c 100644 --- a/test/net/java/sip/communicator/slick/configuration/TestConfigurationService.java +++ b/test/net/java/sip/communicator/slick/configuration/TestConfigurationService.java @@ -108,6 +108,7 @@ public class TestConfigurationService extends TestCase * Generic JUnit setUp method. * @throws Exception if anything goes wrong. */ + @Override protected void setUp() throws Exception { configurationService.setProperty(propertyName, null); @@ -119,6 +120,7 @@ public class TestConfigurationService extends TestCase * Generic JUnit tearDown method. * @throws Exception if anything goes wrong. */ + @Override protected void tearDown() throws Exception { //first remove any remaining listeners diff --git a/test/net/java/sip/communicator/slick/configuration/TestConfigurationServicePersistency.java b/test/net/java/sip/communicator/slick/configuration/TestConfigurationServicePersistency.java index 3f6c111..2b7e3c4 100644 --- a/test/net/java/sip/communicator/slick/configuration/TestConfigurationServicePersistency.java +++ b/test/net/java/sip/communicator/slick/configuration/TestConfigurationServicePersistency.java @@ -109,6 +109,7 @@ public class TestConfigurationServicePersistency extends TestCase * Generic JUnit setUp method. * @throws Exception if anything goes wrong. */ + @Override protected void setUp() throws Exception { String confDirLocation @@ -154,6 +155,7 @@ public class TestConfigurationServicePersistency extends TestCase * Generic JUnit tearDown method. * @throws Exception if anything goes wrong. */ + @Override protected void tearDown() throws Exception { //delete the temp conf file diff --git a/test/net/java/sip/communicator/slick/contactlist/MclSlickFixture.java b/test/net/java/sip/communicator/slick/contactlist/MclSlickFixture.java index fd52391..188c41d 100644 --- a/test/net/java/sip/communicator/slick/contactlist/MclSlickFixture.java +++ b/test/net/java/sip/communicator/slick/contactlist/MclSlickFixture.java @@ -141,6 +141,7 @@ public class MclSlickFixture * Find a reference of the meta contact list service and set the * corresponding field. */ + @Override public void setUp() { //find a reference to the meta contaact list service. @@ -154,6 +155,7 @@ public class MclSlickFixture /** * */ + @Override public void tearDown() { } diff --git a/test/net/java/sip/communicator/slick/contactlist/TestMetaContact.java b/test/net/java/sip/communicator/slick/contactlist/TestMetaContact.java index 443d0d2..0f58585 100644 --- a/test/net/java/sip/communicator/slick/contactlist/TestMetaContact.java +++ b/test/net/java/sip/communicator/slick/contactlist/TestMetaContact.java @@ -40,6 +40,7 @@ public class TestMetaContact extends TestCase super(name); } + @Override protected void setUp() throws Exception { super.setUp(); @@ -52,6 +53,7 @@ public class TestMetaContact extends TestCase } + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -66,8 +68,10 @@ public class TestMetaContact extends TestCase */ public void testGetContact() { - Contact actualReturn = metaContact.getContact( - mockContact.getAddress(), fixture.mockProvider); + Contact actualReturn + = metaContact.getContact( + mockContact.getAddress(), + MclSlickFixture.mockProvider); assertNotNull("getContact() return null.", actualReturn); @@ -111,7 +115,7 @@ public class TestMetaContact extends TestCase public void testGetContactsForProvider() { Iterator<Contact> childContacts - = metaContact.getContactsForProvider(fixture.mockProvider); + = metaContact.getContactsForProvider(MclSlickFixture.mockProvider); assertNotNull("getContactsForProvider() returned a null iterator." , childContacts); @@ -247,26 +251,26 @@ public class TestMetaContact extends TestCase String detail_1 = "detail_1"; String detail_2 = "detail_2"; String detail_3 = "detail_3"; - + metaContact.addDetail(name, detail_1); List<String> ds = metaContact.getDetails(name); assertTrue( "Must contain one detail", 1 == ds.size()); assertTrue("The result details does not contain the desired", ds.contains(detail_1)); - + metaContact.changeDetail(name, detail_1, detail_2); ds = metaContact.getDetails(name); assertEquals( "Must contain one detail", 1 , ds.size()); assertTrue("The result details does not contain the desired", ds.contains(detail_2)); - + metaContact.removeDetail(name, detail_2); ds = metaContact.getDetails(name); assertEquals( "Must contain no details", 0 , ds.size()); - + metaContact.addDetail(name, detail_1); metaContact.addDetail(name, detail_2); metaContact.addDetail(name, detail_3); @@ -279,7 +283,7 @@ public class TestMetaContact extends TestCase ds.contains(detail_2)); assertTrue("The result details does not contain the desired", ds.contains(detail_3)); - + metaContact.removeDetails(name); ds = metaContact.getDetails(name); assertEquals( "Must contain no details", diff --git a/test/net/java/sip/communicator/slick/contactlist/TestMetaContactGroup.java b/test/net/java/sip/communicator/slick/contactlist/TestMetaContactGroup.java index 64d0d9f..8c57069 100644 --- a/test/net/java/sip/communicator/slick/contactlist/TestMetaContactGroup.java +++ b/test/net/java/sip/communicator/slick/contactlist/TestMetaContactGroup.java @@ -40,14 +40,15 @@ public class TestMetaContactGroup extends TestCase super(name); } + @Override protected void setUp() throws Exception { super.setUp(); fixture.setUp(); - OperationSetPersistentPresence opSetPresence = - fixture.mockProvider - .getOperationSet(OperationSetPersistentPresence.class); + OperationSetPersistentPresence opSetPresence + = MclSlickFixture.mockProvider.getOperationSet( + OperationSetPersistentPresence.class); mockGroup = (MockContactGroup)opSetPresence .getServerStoredContactListRoot(); @@ -61,6 +62,7 @@ public class TestMetaContactGroup extends TestCase } + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -115,8 +117,10 @@ public class TestMetaContactGroup extends TestCase */ public void testGetContactGroup() { - ContactGroup actualReturn = metaGroup.getContactGroup( - mockGroup.getGroupName(), fixture.mockProvider); + ContactGroup actualReturn + = metaGroup.getContactGroup( + mockGroup.getGroupName(), + MclSlickFixture.mockProvider); assertNotNull("getContactGroup() return null.", actualReturn); @@ -228,18 +232,19 @@ public class TestMetaContactGroup extends TestCase .findMetaContactGroupByContactGroup(MetaContactListServiceLick .topLevelMockGroup); - MetaContact metaContact = metaContactGroup1.getMetaContact( - fixture.mockProvider - , MetaContactListServiceLick.subLevelContactName); + MetaContact metaContact + = metaContactGroup1.getMetaContact( + MclSlickFixture.mockProvider, + MetaContactListServiceLick.subLevelContactName); //do as best as we can to determine whether this is the right meta //contact assertNotNull( - "getMetaCont(prov, contactID) returned a MetaC that didn't " - + "contain our contact" - , metaContact.getContact( - MetaContactListServiceLick.subLevelContactName - , fixture.mockProvider)); + "getMetaCont(prov, contactID) returned a MetaC that didn't " + + "contain our contact", + metaContact.getContact( + MetaContactListServiceLick.subLevelContactName, + MclSlickFixture.mockProvider)); assertEquals( "getMetaCont(prov, contactID) returned a MetaC with a wrong name " diff --git a/test/net/java/sip/communicator/slick/contactlist/TestMetaContactList.java b/test/net/java/sip/communicator/slick/contactlist/TestMetaContactList.java index 419cc14..9c65e9f 100644 --- a/test/net/java/sip/communicator/slick/contactlist/TestMetaContactList.java +++ b/test/net/java/sip/communicator/slick/contactlist/TestMetaContactList.java @@ -65,6 +65,7 @@ public class TestMetaContactList * Initialize the environment. * @throws Exception if anything goes wrong. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -75,6 +76,7 @@ public class TestMetaContactList * Finalization * @throws Exception in case sth goes wrong. */ + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -87,8 +89,9 @@ public class TestMetaContactList */ public void testContactListRetrieving() { - MockContactGroup expectedRoot = (MockContactGroup)fixture.mockPresOpSet - .getServerStoredContactListRoot(); + MockContactGroup expectedRoot + = (MockContactGroup) + MclSlickFixture.mockPresOpSet.getServerStoredContactListRoot(); logger.debug("============== Predefined contact List =============="); @@ -127,9 +130,9 @@ public class TestMetaContactList //change a status fixture.metaClService.addMetaContactListListener(evtCollector); - fixture.mockPresOpSet.changePresenceStatusForContact( - MetaContactListServiceLick.mockContactToReorder, - MockStatusEnum.MOCK_STATUS_100); + MclSlickFixture.mockPresOpSet.changePresenceStatusForContact( + MetaContactListServiceLick.mockContactToReorder, + MockStatusEnum.MOCK_STATUS_100); fixture.metaClService.removeMetaContactListListener(evtCollector); @@ -152,9 +155,9 @@ public class TestMetaContactList assertContactsOrder(fixture.metaClService.getRoot()); //restore the contacts original status - fixture.mockPresOpSet.changePresenceStatusForContact( - MetaContactListServiceLick.mockContactToReorder, - MockStatusEnum.MOCK_STATUS_00); + MclSlickFixture.mockPresOpSet.changePresenceStatusForContact( + MetaContactListServiceLick.mockContactToReorder, + MockStatusEnum.MOCK_STATUS_00); //repeat order tests but this time after changing the display name of a @@ -166,7 +169,7 @@ public class TestMetaContactList fixture.metaClService.removeMetaContactListListener(evtCollector); - //check whether a reordered event is dispatchect + //check whether a reordered event is dispatched assertEquals("Number of evts dispatched after a contact changed its " +"display name" , 1 @@ -395,7 +398,7 @@ public class TestMetaContactList //problems. actualMetaContactGroup = fixture.metaClService .findMetaContactGroupByContactGroup( - fixture.mockPresOpSet.getServerStoredContactListRoot()); + MclSlickFixture.mockPresOpSet.getServerStoredContactListRoot()); assertSame("find failed for root contact group " , root, actualMetaContactGroup); @@ -415,12 +418,12 @@ public class TestMetaContactList MclEventCollector mclEvtCollector = new MclEventCollector(); fixture.metaClService.addMetaContactListListener(mclEvtCollector); - fixture.mockPresOpSet.subscribe(newSubscriptionName); + MclSlickFixture.mockPresOpSet.subscribe(newSubscriptionName); fixture.metaClService.removeMetaContactListListener(mclEvtCollector); //first check that the newly created contact was really added - MockContact newProtoContact = (MockContact)fixture.mockPresOpSet + MockContact newProtoContact = (MockContact)MclSlickFixture.mockPresOpSet .findContactByID(newSubscriptionName); MetaContact newMetaContact = fixture.metaClService .findMetaContactByContact(newProtoContact); @@ -448,7 +451,7 @@ public class TestMetaContactList fixture.metaClService.addMetaContactListListener(mclEvtCollector); - fixture.mockPresOpSet.unsubscribe(newProtoContact); + MclSlickFixture.mockPresOpSet.unsubscribe(newProtoContact); fixture.metaClService.removeMetaContactListListener(mclEvtCollector); @@ -492,16 +495,16 @@ public class TestMetaContactList MclEventCollector mclEvtCollector = new MclEventCollector(); MockContactGroup newContactGroup - = new MockContactGroup(newGroupName, fixture.mockProvider); + = new MockContactGroup(newGroupName, MclSlickFixture.mockProvider); MockContactGroup newInnerContactGroup - = new MockContactGroup(newInnerGroupName, fixture.mockProvider); + = new MockContactGroup(newInnerGroupName, MclSlickFixture.mockProvider); newContactGroup.addSubgroup(newInnerContactGroup); fixture.metaClService.addMetaContactListListener(mclEvtCollector); - fixture.mockPresOpSet.addMockGroupAndFireEvent( + MclSlickFixture.mockPresOpSet.addMockGroupAndFireEvent( (MockContactGroup) - fixture.mockPresOpSet.getServerStoredContactListRoot(), + MclSlickFixture.mockPresOpSet.getServerStoredContactListRoot(), newContactGroup); fixture.metaClService.removeMetaContactListListener(mclEvtCollector); @@ -527,7 +530,7 @@ public class TestMetaContactList , newContactGroup , newMetaGroup.getContactGroup( newContactGroup.getGroupName() - , fixture.mockProvider)); + , MclSlickFixture.mockProvider)); assertEquals("Subgroups were not imported in the MetaContactList." , newContactGroup.countSubgroups() @@ -535,10 +538,10 @@ public class TestMetaContactList //first check that the newly created group was really added assertEquals("Source provider for the add event." - , fixture.mockProvider, evt.getSourceProvider()); + , MclSlickFixture.mockProvider, evt.getSourceProvider()); ContactGroup newProtoGroup = newMetaGroup.getContactGroup( - newGroupName, fixture.mockProvider); + newGroupName, MclSlickFixture.mockProvider); assertNotNull("The new meta contact group did not contain a proto group" , newProtoGroup); @@ -551,12 +554,12 @@ public class TestMetaContactList assertEquals("The new meta contact group did not seem to contain " + "the right protocol contact group." , newProtoGroup.getProtocolProvider() - , fixture.mockProvider); + , MclSlickFixture.mockProvider); //rename the group and see that the corresponding events are handled //properly fixture.metaClService.addMetaContactListListener(mclEvtCollector); - fixture.mockPresOpSet.renameServerStoredContactGroup( + MclSlickFixture.mockPresOpSet.renameServerStoredContactGroup( newProtoGroup, renamedGroupName); fixture.metaClService.removeMetaContactListListener(mclEvtCollector); @@ -578,11 +581,11 @@ public class TestMetaContactList , evt.getSourceMetaContactGroup()); assertEquals("Source provider for the remove event." - , fixture.mockProvider, evt.getSourceProvider()); + , MclSlickFixture.mockProvider, evt.getSourceProvider()); //check whether the group was indeed renamed. Iterator<ContactGroup> groupsIter = evt.getSourceMetaContactGroup() - .getContactGroupsForProvider(fixture.mockProvider); + .getContactGroupsForProvider(MclSlickFixture.mockProvider); assertTrue("A proto group was unexplicably removed after renaming.", groupsIter.hasNext()); @@ -593,7 +596,7 @@ public class TestMetaContactList //remove the group and check for the event. fixture.metaClService.addMetaContactListListener(mclEvtCollector); - fixture.mockPresOpSet.removeServerStoredContactGroup(newProtoGroup); + MclSlickFixture.mockPresOpSet.removeServerStoredContactGroup(newProtoGroup); fixture.metaClService.removeMetaContactListListener(mclEvtCollector); @@ -615,7 +618,7 @@ public class TestMetaContactList , evt.getSourceMetaContactGroup()); assertEquals("Source provider for the remove event." - , fixture.mockProvider, evt.getSourceProvider()); + , MclSlickFixture.mockProvider, evt.getSourceProvider()); } /** @@ -636,7 +639,7 @@ public class TestMetaContactList //add a new mock contact to a meta contact fixture.metaClService.addNewContactToMetaContact( - fixture.mockProvider + MclSlickFixture.mockProvider , metaContact , newContactID); @@ -649,7 +652,7 @@ public class TestMetaContactList , metaContact.getContactCount()); MockContact newContact = (MockContact)metaContact - .getContact(newContactID, fixture.mockProvider); + .getContact(newContactID, MclSlickFixture.mockProvider); assertNotNull("newContact", newContact); @@ -657,7 +660,7 @@ public class TestMetaContactList //and that it is the same as the one added in the MetaContact assertSame("Proto specific contact in mock contact list." , newContact - , fixture.mockPresOpSet.getServerStoredContactListRoot() + , MclSlickFixture.mockPresOpSet.getServerStoredContactListRoot() .getContact(newContactID)); //verify that events have been properly delivered. @@ -671,7 +674,7 @@ public class TestMetaContactList , newContact , event.getProtoContact()); assertSame ( "Source provider in ProtoContactEvent gen. upon add." - , fixture.mockProvider + , MclSlickFixture.mockProvider , event.getProtoContact().getProtocolProvider()); assertEquals ( "Event ID in MetaContactEvent gen. upon add." @@ -698,7 +701,7 @@ public class TestMetaContactList , dstMetaContact.getContactCount()); newContact = (MockContact)dstMetaContact - .getContact(newContactID, fixture.mockProvider); + .getContact(newContactID, MclSlickFixture.mockProvider); assertNotNull("newContact", newContact); @@ -715,7 +718,7 @@ public class TestMetaContactList , dstMetaContact, event.getParent()); assertSame("Source provider in ProtoContactEvent gen. upon move." - , fixture.mockProvider + , MclSlickFixture.mockProvider , event.getProtoContact().getProtocolProvider()); assertEquals("Event ID in ProtoContactEvent gen. upon add." @@ -738,7 +741,7 @@ public class TestMetaContactList //verify that it is no more in the mock contact list assertNull( "The MetaContactList did not remove a contact from the " + "MockList on del." - , fixture.mockPresOpSet.getServerStoredContactListRoot() + , MclSlickFixture.mockPresOpSet.getServerStoredContactListRoot() .getContact(newContactID)); //verify that events have been properly delivered. @@ -755,7 +758,7 @@ public class TestMetaContactList , dstMetaContact, event.getParent()); assertSame ( "Source provider in ProtoContactEvent gen. upon remove." - , fixture.mockProvider + , MclSlickFixture.mockProvider , event.getProtoContact().getProtocolProvider()); assertEquals ( "Event ID in ProtoContactEvent gen. upon remove." @@ -777,7 +780,7 @@ public class TestMetaContactList fixture.metaClService.addMetaContactListListener(evtCollector); //create a new metacontact and, hence mock contact, in the meta //"SomePeople" non-toplevel group - fixture.metaClService.createMetaContact(fixture.mockProvider + fixture.metaClService.createMetaContact(MclSlickFixture.mockProvider , parentMetaGroup , newContactID); @@ -785,7 +788,7 @@ public class TestMetaContactList //check that the contact has been successfully created in the meta cl MetaContact newMetaContact = - parentMetaGroup.getMetaContact(fixture.mockProvider, newContactID); + parentMetaGroup.getMetaContact(MclSlickFixture.mockProvider, newContactID); assertNotNull("create failed. couldn't find the new contact." , newMetaContact); @@ -839,7 +842,7 @@ public class TestMetaContactList + newMetaContact.getDisplayName() + " was not moved to its new location after its " +"encapsulating meta contact was." - ,fixture.mockPresOpSet.getServerStoredContactListRoot() + ,MclSlickFixture.mockPresOpSet.getServerStoredContactListRoot() .getContact(newContactID)); //verify that events have been properly delivered. @@ -853,7 +856,7 @@ public class TestMetaContactList , newMetaContact, movedEvent.getSourceMetaContact()); assertEquals ( "Event Property Name in MetaContactEvent gen. upon move." - , MetaContactMovedEvent.META_CONTACT_MOVED + , MetaContactPropertyChangeEvent.META_CONTACT_MOVED , movedEvent.getPropertyName()); assertEquals ( "Old Parent in MetaContactEvent gen. upon move." @@ -882,7 +885,7 @@ public class TestMetaContactList assertNull("The mock contact corresponding to: " + newMetaContact.getDisplayName() + " was not removed after its encapsulating meta contact was." - ,fixture.mockPresOpSet.getServerStoredContactListRoot() + ,MclSlickFixture.mockPresOpSet.getServerStoredContactListRoot() .getContact(newContactID)); //verify that events have been properly delivered. @@ -922,15 +925,15 @@ public class TestMetaContactList assertNull( "createMetaContactGroup tried to create a proto group too early." - ,fixture.mockPresOpSet.getServerStoredContactListRoot() + ,MclSlickFixture.mockPresOpSet.getServerStoredContactListRoot() .getGroup(newGroupName)); //create a mock contcat through the meta contact list. fixture.metaClService.createMetaContact( - fixture.mockProvider, newMetaGroup, newContactID); + MclSlickFixture.mockProvider, newMetaGroup, newContactID); //check that the mock group was created and added to the right meta grp. - MockContactGroup newMockGroup = (MockContactGroup)fixture.mockPresOpSet + MockContactGroup newMockGroup = (MockContactGroup)MclSlickFixture.mockPresOpSet .getServerStoredContactListRoot().getGroup(newGroupName); assertNotNull( @@ -941,11 +944,11 @@ public class TestMetaContactList "createMetaContact created a proto group but did not add it to the " + "right meta contact group." , newMockGroup - , newMetaGroup.getContactGroup(newGroupName, fixture.mockProvider)); + , newMetaGroup.getContactGroup(newGroupName, MclSlickFixture.mockProvider)); //check that the contact was added MetaContact newMetaContact = newMetaGroup - .getMetaContact(fixture.mockProvider, newContactID); + .getMetaContact(MclSlickFixture.mockProvider, newContactID); assertNotNull("createMetaContact failed", newMetaContact); @@ -975,7 +978,7 @@ public class TestMetaContactList //check that the mock group is removed assertNull( "removeMetaContact did not remove the corresp. proto group." - , fixture.mockPresOpSet.getServerStoredContactListRoot() + , MclSlickFixture.mockPresOpSet.getServerStoredContactListRoot() .getGroup(newGroupName)); } @@ -1045,7 +1048,7 @@ public class TestMetaContactList , contactToRename, event.getSourceMetaContact()); assertEquals ( "Event ID in MetaContactEvent gen. upon remove." - , MetaContactRenamedEvent.META_CONTACT_RENAMED + , MetaContactPropertyChangeEvent.META_CONTACT_RENAMED , event.getPropertyName()); //check that the meta contact has been renamed @@ -1228,8 +1231,8 @@ public class TestMetaContactList /** * Indicates that the order under which the child contacts were ordered * inside the source group has changed. - * @param evt the <tt>MetaContactGroupEvent</tt> containind details of this - * event. + * @param evt the <tt>MetaContactGroupEvent</tt> containing details of + * this event. */ public void childContactsReordered(MetaContactGroupEvent evt) { diff --git a/test/net/java/sip/communicator/slick/contactlist/TestMetaContactListPersistence.java b/test/net/java/sip/communicator/slick/contactlist/TestMetaContactListPersistence.java index 45bfd5b..01803b7 100644 --- a/test/net/java/sip/communicator/slick/contactlist/TestMetaContactListPersistence.java +++ b/test/net/java/sip/communicator/slick/contactlist/TestMetaContactListPersistence.java @@ -26,6 +26,7 @@ public class TestMetaContactListPersistence extends TestCase super(name); } + @Override protected void setUp() throws Exception { super.setUp(); @@ -33,6 +34,7 @@ public class TestMetaContactListPersistence extends TestCase fixture.setUp(); } + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -81,18 +83,21 @@ public class TestMetaContactListPersistence extends TestCase public void testCreateAndMoveMetaContact() { String newContactID ="testCreateAndMoveMetaContact.ContactID"; - MetaContactGroup parentMetaGroup = fixture.metaClService.getRoot() - .getMetaContactSubgroup(MetaContactListServiceLick.topLevelGroupName); + MetaContactGroup parentMetaGroup + = fixture.metaClService.getRoot().getMetaContactSubgroup( + MetaContactListServiceLick.topLevelGroupName); //create a new metacontact and, hence mock contact, in the meta //"SomePeople" non-toplevel group - fixture.metaClService.createMetaContact(fixture.mockProvider + fixture.metaClService.createMetaContact(MclSlickFixture.mockProvider , parentMetaGroup , newContactID); //check that the contact has been successfully created in the meta cl - MetaContact newMetaContact = - parentMetaGroup.getMetaContact(fixture.mockProvider, newContactID); + MetaContact newMetaContact + = parentMetaGroup.getMetaContact( + MclSlickFixture.mockProvider, + newContactID); assertNotNull("create failed. couldn't find the new contact." , newMetaContact); @@ -118,7 +123,7 @@ public class TestMetaContactListPersistence extends TestCase // wait other operations to finish before reloading o.wait(1000); } - + Bundle metaClBundle = findMetaClBundle(); //uninstall the meta contact list service @@ -140,17 +145,17 @@ public class TestMetaContactListPersistence extends TestCase , Bundle.UNINSTALLED, metaClBundle.getState()); //unregister all mock providers - fixture.mockPrServiceRegistration.unregister(); - fixture.mockP1ServiceRegistration.unregister(); - fixture.mockP2ServiceRegistration.unregister(); + MclSlickFixture.mockPrServiceRegistration.unregister(); + MclSlickFixture.mockP1ServiceRegistration.unregister(); + MclSlickFixture.mockP2ServiceRegistration.unregister(); //remove existing mock providers. - fixture.replacementMockPr = new MockProvider( - fixture.mockProvider.getAccountID().getUserID()); - fixture.replacementMockP1 = new MockProvider( - fixture.mockP1.getAccountID().getUserID()); - fixture.replacementMockP2 = new MockProvider( - fixture.mockP2.getAccountID().getUserID()); + MclSlickFixture.replacementMockPr = new MockProvider( + MclSlickFixture.mockProvider.getAccountID().getUserID()); + MclSlickFixture.replacementMockP1 = new MockProvider( + MclSlickFixture.mockP1.getAccountID().getUserID()); + MclSlickFixture.replacementMockP2 = new MockProvider( + MclSlickFixture.mockP2.getAccountID().getUserID()); //reinstall only one of the existing mock providers //we will reinstall the other mock providers later. our purpose is to @@ -158,11 +163,11 @@ public class TestMetaContactListPersistence extends TestCase //re-registered mock provider upon startup and that it would later //complete its list with the rest of the mock providers once we //reregister them. - fixture.mockPrServiceRegistration = MetaContactListServiceLick - .registerMockProviderService(fixture.replacementMockPr); + MclSlickFixture.mockPrServiceRegistration = MetaContactListServiceLick + .registerMockProviderService(MclSlickFixture.replacementMockPr); //reinstall the metacontactlist bundle - metaClBundle = fixture.bundleContext.installBundle( + metaClBundle = MclSlickFixture.bundleContext.installBundle( metaClBundle.getLocation()); assertEquals("Couldn't re-install meta cl bundle." @@ -172,9 +177,11 @@ public class TestMetaContactListPersistence extends TestCase assertEquals("Couldn't re-start meta cl bundle." , Bundle.ACTIVE, metaClBundle.getState()); - fixture.metaClService = (MetaContactListService)fixture.bundleContext - .getService( fixture.bundleContext.getServiceReference( - MetaContactListService.class.getName())); + fixture.metaClService + = (MetaContactListService) + MclSlickFixture.bundleContext.getService( + MclSlickFixture.bundleContext.getServiceReference( + MetaContactListService.class.getName())); assertNotNull("The meta contact list service was not re-registered " +"after reinstalling its bundle." @@ -191,11 +198,11 @@ public class TestMetaContactListPersistence extends TestCase //verify that contents of the meta contact list matches contents of //the mock provider we removed. ContactGroup oldProtoRoot = - fixture.mockProvider + MclSlickFixture.mockProvider .getOperationSet(OperationSetPersistentPresence.class) .getServerStoredContactListRoot(); - fixture.assertGroupEquals( + MclSlickFixture.assertGroupEquals( (MockContactGroup)oldProtoRoot , fixture.metaClService.getRoot() , true);//we might have trailing empty meta groups here remaining @@ -204,7 +211,7 @@ public class TestMetaContactListPersistence extends TestCase //verify that the new mock provider has created unresolved contacts //for all contacts in the meta cl. ContactGroup newProtoRoot = - fixture.replacementMockPr + MclSlickFixture.replacementMockPr .getOperationSet(OperationSetPersistentPresence.class) .getServerStoredContactListRoot(); @@ -233,20 +240,20 @@ public class TestMetaContactListPersistence extends TestCase { //reinstall remaining mock providers //we will reinstall the other mock providers later. our purpose is to - fixture.mockP1ServiceRegistration = MetaContactListServiceLick - .registerMockProviderService(fixture.replacementMockP1); + MclSlickFixture.mockP1ServiceRegistration = MetaContactListServiceLick + .registerMockProviderService(MclSlickFixture.replacementMockP1); - fixture.mockP2ServiceRegistration = MetaContactListServiceLick - .registerMockProviderService(fixture.replacementMockP2); + MclSlickFixture.mockP2ServiceRegistration = MetaContactListServiceLick + .registerMockProviderService(MclSlickFixture.replacementMockP2); //Get references to the root groups of the 2 providers we removed ContactGroup oldProtoMockP1Root = - fixture.mockP1 + MclSlickFixture.mockP1 .getOperationSet(OperationSetPersistentPresence.class) .getServerStoredContactListRoot(); ContactGroup oldProtoMockP2Root = - fixture.mockP2 + MclSlickFixture.mockP2 .getOperationSet(OperationSetPersistentPresence.class) .getServerStoredContactListRoot(); @@ -254,7 +261,7 @@ public class TestMetaContactListPersistence extends TestCase //inside that the replacement mock providers match those in the //providers we removed. ContactGroup newProtoMockP1Root = - fixture.replacementMockP1 + MclSlickFixture.replacementMockP1 .getOperationSet(OperationSetPersistentPresence.class) .getServerStoredContactListRoot(); @@ -263,7 +270,7 @@ public class TestMetaContactListPersistence extends TestCase , newProtoMockP1Root); ContactGroup newProtoMockP2Root = - fixture.replacementMockP2 + MclSlickFixture.replacementMockP2 .getOperationSet(OperationSetPersistentPresence.class) .getServerStoredContactListRoot(); @@ -338,7 +345,7 @@ public class TestMetaContactListPersistence extends TestCase */ private Bundle findMetaClBundle() { - Bundle[] bundles = fixture.bundleContext.getBundles(); + Bundle[] bundles = MclSlickFixture.bundleContext.getBundles(); for (int i = 0; i < bundles.length; i++) { @@ -351,7 +358,8 @@ public class TestMetaContactListPersistence extends TestCase for (int j = 0; j < registeredServices.length; j++) { Object service - = fixture.bundleContext.getService(registeredServices[j]); + = MclSlickFixture.bundleContext.getService( + registeredServices[j]); if(service == fixture.metaClService) return bundles[i]; } diff --git a/test/net/java/sip/communicator/slick/contactlist/TestSupportForMultipleProviders.java b/test/net/java/sip/communicator/slick/contactlist/TestSupportForMultipleProviders.java index 182da14..8995afc 100644 --- a/test/net/java/sip/communicator/slick/contactlist/TestSupportForMultipleProviders.java +++ b/test/net/java/sip/communicator/slick/contactlist/TestSupportForMultipleProviders.java @@ -28,6 +28,7 @@ public class TestSupportForMultipleProviders super(name); } + @Override protected void setUp() throws Exception { super.setUp(); @@ -35,6 +36,7 @@ public class TestSupportForMultipleProviders } + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -68,34 +70,34 @@ public class TestSupportForMultipleProviders public void testAddProviders() { //register the new providers with the osgi bus. - fixture.mockP1ServiceRegistration - = MetaContactListServiceLick.registerMockProviderService(fixture.mockP1); - fixture.mockP2ServiceRegistration - = MetaContactListServiceLick.registerMockProviderService(fixture.mockP2); + MclSlickFixture.mockP1ServiceRegistration + = MetaContactListServiceLick.registerMockProviderService(MclSlickFixture.mockP1); + MclSlickFixture.mockP2ServiceRegistration + = MetaContactListServiceLick.registerMockProviderService(MclSlickFixture.mockP2); //verify that the groups have been properly added. - fixture.metaP1Grp1 = fixture.metaClService - .findMetaContactGroupByContactGroup(fixture.mockP1Grp1); + MclSlickFixture.metaP1Grp1 = fixture.metaClService + .findMetaContactGroupByContactGroup(MclSlickFixture.mockP1Grp1); assertNotNull("The MCL impl ignored a newly added proto provider." - , fixture.metaP1Grp1); + , MclSlickFixture.metaP1Grp1); MclSlickFixture.assertGroupEquals( - fixture.mockP1Grp1 - , fixture.metaP1Grp1 + MclSlickFixture.mockP1Grp1 + , MclSlickFixture.metaP1Grp1 , false);//there's no reason to have empty meta groups here so //they are to be considered a problem - fixture.metaP2Grp1 = fixture.metaClService + MclSlickFixture.metaP2Grp1 = fixture.metaClService .findMetaContactGroupByContactGroup( - fixture.mockP2Grp1); + MclSlickFixture.mockP2Grp1); assertNotNull("The MCL impl ignored a newly added proto provider." - , fixture.metaP2Grp1); + , MclSlickFixture.metaP2Grp1); MclSlickFixture.assertGroupEquals( - fixture.mockP2Grp1 - , fixture.metaP2Grp1 + MclSlickFixture.mockP2Grp1 + , MclSlickFixture.metaP2Grp1 , false);//there's no reason to have empty meta groups here so //they are to be considered a problem } @@ -110,27 +112,27 @@ public class TestSupportForMultipleProviders //add a contact from provider 2 to the meta contact encapsulator of a //provider 1 contact MetaContact metaEmilP1 = fixture.metaClService - .findMetaContactByContact(fixture.emilP1); + .findMetaContactByContact(MclSlickFixture.emilP1); assertNotNull("No meta contact found for " - + fixture.emilP1.getDisplayName(), metaEmilP1); + + MclSlickFixture.emilP1.getDisplayName(), metaEmilP1); - fixture.metaClService.moveContact(fixture.emilP2, metaEmilP1); + fixture.metaClService.moveContact(MclSlickFixture.emilP2, metaEmilP1); //verify that the new meta contact contains both contacts (no point //in verifying events) - assertEquals("Contact " + fixture.emilP2.getDisplayName() + assertEquals("Contact " + MclSlickFixture.emilP2.getDisplayName() + " was not added to metacontact " + metaEmilP1.getDisplayName() , 2, metaEmilP1.getContactCount()); //verify that mock provider 2 contains a new group named the same as the //parent meta group of the contact we just moved - ContactGroup newGrpP2 = fixture.mockPresOpSetP2 + ContactGroup newGrpP2 = MclSlickFixture.mockPresOpSetP2 .getServerStoredContactListRoot().getGroup( - fixture.metaP1Grp1.getGroupName()); + MclSlickFixture.metaP1Grp1.getGroupName()); - assertNotNull("Contact " + fixture.emilP2.getDisplayName() + assertNotNull("Contact " + MclSlickFixture.emilP2.getDisplayName() + " was not moved to the proper group inside provider 2" , newGrpP2); @@ -142,7 +144,7 @@ public class TestSupportForMultipleProviders assertSame("Contact group " + newGrpP2 + " was not added to the right meta contact group" - , fixture.metaP1Grp1 + , MclSlickFixture.metaP1Grp1 , newGrpP2MetaWrapper); } diff --git a/test/net/java/sip/communicator/slick/credentialsstorage/CredentialsStorageServiceLick.java b/test/net/java/sip/communicator/slick/credentialsstorage/CredentialsStorageServiceLick.java index bc709f7..5a739d1 100644 --- a/test/net/java/sip/communicator/slick/credentialsstorage/CredentialsStorageServiceLick.java +++ b/test/net/java/sip/communicator/slick/credentialsstorage/CredentialsStorageServiceLick.java @@ -17,9 +17,9 @@ import org.osgi.framework.*; /** * @author Dmitri Melnikov */ -public class CredentialsStorageServiceLick - extends TestSuite - implements BundleActivator +public class CredentialsStorageServiceLick + extends TestSuite + implements BundleActivator { private Logger logger = Logger.getLogger(getClass().getName()); diff --git a/test/net/java/sip/communicator/slick/credentialsstorage/TestCredentialsStorageService.java b/test/net/java/sip/communicator/slick/credentialsstorage/TestCredentialsStorageService.java index 89ba838..b0bbc48 100644 --- a/test/net/java/sip/communicator/slick/credentialsstorage/TestCredentialsStorageService.java +++ b/test/net/java/sip/communicator/slick/credentialsstorage/TestCredentialsStorageService.java @@ -23,31 +23,31 @@ public class TestCredentialsStorageService * The service we are testing. */ private CredentialsStorageService credentialsService = null; - + /** * Prefix for the test account. */ private static final String accountPrefix = "my.account.prefix"; - + /** * Password for the test account. */ private static final String accountPassword = "pa$$W0rt123."; - + /** * The master password. */ private static final String masterPassword = "MasterPazz321"; /** - * Another master password. + * Another master password. */ private static final String otherMasterPassword = "123$ecretPSWRD"; - - + + /** * Generic JUnit Constructor. - * + * * @param name the name of the test */ public TestCredentialsStorageService(String name) @@ -60,11 +60,12 @@ public class TestCredentialsStorageService credentialsService = (CredentialsStorageService) context.getService(ref); } - + /** * Generic JUnit setUp method. * @throws Exception if anything goes wrong. */ + @Override protected void setUp() throws Exception { // set the master password @@ -77,11 +78,12 @@ public class TestCredentialsStorageService credentialsService.storePassword(accountPrefix, accountPassword); super.setUp(); } - + /** * Generic JUnit tearDown method. * @throws Exception if anything goes wrong. */ + @Override protected void tearDown() throws Exception { // remove the password @@ -103,20 +105,20 @@ public class TestCredentialsStorageService boolean verify1 = credentialsService.verifyMasterPassword(otherMasterPassword); assertFalse("Wrong password cannot be correct", verify1); - + // try to verify a correct password boolean verify2 = credentialsService.verifyMasterPassword(masterPassword); assertTrue("Correct password cannot be wrong", verify2); } - + /** * Tests whether the loaded password is the same as the stored one. */ public void testLoadPassword() { String loadedPassword = credentialsService.loadPassword(accountPrefix); - + assertEquals("Loaded and stored passwords do not match", accountPassword, loadedPassword); } @@ -127,7 +129,7 @@ public class TestCredentialsStorageService public void testIsUsingMasterPassword() { boolean isUsing = credentialsService.isUsingMasterPassword(); - + assertTrue("Master password is used, true expected", isUsing); } @@ -141,12 +143,12 @@ public class TestCredentialsStorageService credentialsService.changeMasterPassword(masterPassword, otherMasterPassword); assertTrue("Changing master password failed", change1); - + // account passwords must remain the same String loadedPassword = credentialsService.loadPassword(accountPrefix); assertEquals("Account passwords must not differ", loadedPassword, accountPassword); - + // change MP back boolean change2 = credentialsService.changeMasterPassword(otherMasterPassword, @@ -172,11 +174,11 @@ public class TestCredentialsStorageService { // remove the saved password credentialsService.removePassword(accountPrefix); - + // try to load the password String loadedPassword = credentialsService.loadPassword(accountPrefix); assertNull("Password was not removed", loadedPassword); - + // save it back again credentialsService.storePassword(accountPrefix, accountPassword); } diff --git a/test/net/java/sip/communicator/slick/fileaccess/TestFailSafeTransaction.java b/test/net/java/sip/communicator/slick/fileaccess/TestFailSafeTransaction.java index 3687287..9cb33e1 100644 --- a/test/net/java/sip/communicator/slick/fileaccess/TestFailSafeTransaction.java +++ b/test/net/java/sip/communicator/slick/fileaccess/TestFailSafeTransaction.java @@ -16,7 +16,7 @@ import org.osgi.framework.*; /** * Tests for the fail safe transactions - * + * * @author Benoit Pradelle */ public class TestFailSafeTransaction @@ -26,33 +26,33 @@ public class TestFailSafeTransaction * The Service that we will be testing. */ private FileAccessService fileAccessService = null; - + /** * Test data to write in the original file */ private static final String origData = "this is a test for the fail safe " + "transaction ability in SIP Communicator"; - + /** * Test data to add to the file */ private static final String addedData = " which is the greatest IM client " + "in the world !"; - + /** * Test data to never write in the file */ private static final String wrongData = "all the file is damaged now !"; - + /** * The base for the name of the temp file */ private static String tempName = "wzsxedcrfv" + System.currentTimeMillis(); - + /** * Standart constructor. - * - * @param name + * + * @param name */ public TestFailSafeTransaction(String name) { @@ -70,43 +70,43 @@ public class TestFailSafeTransaction // setup a temp file File temp = File.createTempFile(tempName + "a", null); FileOutputStream out = new FileOutputStream(temp); - + out.write(origData.getBytes()); - + // write a modification during a transaction FailSafeTransaction trans = this.fileAccessService .createFailSafeTransaction(temp); trans.beginTransaction(); - + out.write(addedData.getBytes()); - + trans.commit(); - + out.close(); - + // test if the two writes are ok // file length assertEquals("the file hasn't the right size after a commit", temp.length(), origData.length() + addedData.length()); - + FileInputStream in = new FileInputStream(temp); byte[] buffer = new byte[in.available()]; in.read(buffer); in.close(); String content = new String(buffer); - + // file content assertEquals("the file content isn't correct", origData + addedData, content); - + temp.delete(); } catch (Exception e) { Assert.fail(e.getMessage()); - } + } } - + /** * Tests the rollback operation */ @@ -116,45 +116,45 @@ public class TestFailSafeTransaction File temp = File.createTempFile(tempName + "b", null); FileOutputStream out = new FileOutputStream(temp); byte[] origDataBytes = origData.getBytes(); - + out.write(origDataBytes); out.flush(); - + // write a modification during a transaction FailSafeTransaction trans = this.fileAccessService .createFailSafeTransaction(temp); trans.beginTransaction(); - + out.write(wrongData.getBytes()); out.flush(); - + trans.rollback(); - + out.close(); - + // test if the two writes are ok // file length assertEquals("the file hasn't the right size after a commit", temp.length(), origDataBytes.length); - + FileInputStream in = new FileInputStream(temp); byte[] buffer = new byte[in.available()]; in.read(buffer); in.close(); String content = new String(buffer); - + // file content assertEquals("the file content isn't correct", origData, content); - + temp.delete(); } catch (Exception e) { Assert.fail(e.getMessage()); } } - + /** * Tests if the file is commited when we start a new transaction */ @@ -163,48 +163,48 @@ public class TestFailSafeTransaction // setup a temp file File temp = File.createTempFile(tempName + "c", null); FileOutputStream out = new FileOutputStream(temp); - + out.write(origData.getBytes()); - + // write a modification during a transaction FailSafeTransaction trans = this.fileAccessService .createFailSafeTransaction(temp); trans.beginTransaction(); - + out.write(addedData.getBytes()); - + // this transaction isn't closed, it should commit the changes trans.beginTransaction(); - + // just to be sure to clean everything // the rollback must rollback nothing trans.rollback(); - + out.close(); - + // test if the two writes are ok // file length assertEquals("the file hasn't the right size after a commit", temp.length(), origData.length() + addedData.length()); - + FileInputStream in = new FileInputStream(temp); byte[] buffer = new byte[in.available()]; in.read(buffer); in.close(); String content = new String(buffer); - + // file content assertEquals("the file content isn't correct", origData + addedData, content); - + temp.delete(); } catch (Exception e) { Assert.fail(e.getMessage()); } } - + /** * Tests if the file is rollback-ed if the transaction is never closed */ @@ -214,45 +214,45 @@ public class TestFailSafeTransaction File temp = File.createTempFile(tempName + "d", null); FileOutputStream out = new FileOutputStream(temp); byte[] origDataBytes = origData.getBytes(); - + out.write(origDataBytes); out.flush(); - + // write a modification during a transaction FailSafeTransaction trans = this.fileAccessService .createFailSafeTransaction(temp); FailSafeTransaction trans2 = this.fileAccessService .createFailSafeTransaction(temp); trans.beginTransaction(); - + out.write(wrongData.getBytes()); out.flush(); - - // we suppose here that SC crashed without closing properly the + + // we suppose here that SC crashed without closing properly the // transaction. When it restarts, the modification must have been // rollback-ed - + trans2.restoreFile(); - + out.close(); - + // test if the two writes are ok // file length assertEquals("the file hasn't the right size after a commit", temp.length(), origDataBytes.length); - + FileInputStream in = new FileInputStream(temp); byte[] buffer = new byte[in.available()]; in.read(buffer); in.close(); String content = new String(buffer); - + // file content assertEquals("the file content isn't correct", origData, content); - + temp.delete(); } catch (Exception e) { Assert.fail(e.getMessage()); diff --git a/test/net/java/sip/communicator/slick/history/TestHistoryService.java b/test/net/java/sip/communicator/slick/history/TestHistoryService.java index f9fc920..60d3367 100644 --- a/test/net/java/sip/communicator/slick/history/TestHistoryService.java +++ b/test/net/java/sip/communicator/slick/history/TestHistoryService.java @@ -47,6 +47,7 @@ public class TestHistoryService extends TestCase { return suite; } + @Override protected void setUp() throws Exception { @@ -69,6 +70,7 @@ public class TestHistoryService extends TestCase { } } + @Override protected void tearDown() throws Exception { diff --git a/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java b/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java index 6b0be0f..d0c654b 100644 --- a/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java +++ b/test/net/java/sip/communicator/slick/metahistory/TestMetaHistoryService.java @@ -111,10 +111,12 @@ public class TestMetaHistoryService return suite; } + @Override protected void setUp() throws Exception { } + @Override protected void tearDown() throws Exception { } diff --git a/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java b/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java index 43f0cc0..11c0ba5 100644 --- a/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java +++ b/test/net/java/sip/communicator/slick/msghistory/TestMsgHistoryService.java @@ -34,7 +34,7 @@ public class TestMsgHistoryService static final String TEST_CONTACT_NAME_1 = "Mincho_Penchev_the_fisrt"; static final String TEST_CONTACT_NAME_2 = "Mincho_Penchev_the_second"; - + static final String TEST_ROOM_NAME = "test_room"; /** @@ -94,10 +94,12 @@ public class TestMsgHistoryService return suite; } + @Override protected void setUp() throws Exception { } + @Override protected void tearDown() throws Exception { } @@ -121,7 +123,7 @@ public class TestMsgHistoryService mockBImOpSet = (MockBasicInstantMessaging) supportedOperationSets.get( OperationSetBasicInstantMessaging.class.getName()); - + mockMultiChat = (MockMultiUserChat) supportedOperationSets.get( OperationSetMultiUserChat.class.getName()); @@ -164,8 +166,8 @@ public class TestMsgHistoryService testMetaContact = metaClService.getRoot(). getMetaContact(mockProvider, TEST_CONTACT_NAME_1); - - // add one more contact as specific problems may happen only when + + // add one more contact as specific problems may happen only when // more than one contact is in the metacontact metaClService.addNewContactToMetaContact( mockProvider, testMetaContact, TEST_CONTACT_NAME_2); @@ -194,7 +196,7 @@ public class TestMsgHistoryService mockBImOpSet.deliverMessage(TEST_CONTACT_NAME_1, messagesToSend[0]); mockBImOpSet.deliverMessage(TEST_CONTACT_NAME_2, messagesToSend[0]); - this.controlDate1 = new Date(); + TestMsgHistoryService.controlDate1 = new Date(); Object lock = new Object(); synchronized (lock) @@ -213,7 +215,7 @@ public class TestMsgHistoryService mockBImOpSet.deliverMessage(TEST_CONTACT_NAME_2, messagesToSend[2]); - this.controlDate2 = new Date(); + TestMsgHistoryService.controlDate2 = new Date(); synchronized (lock) { // wait a moment @@ -389,21 +391,21 @@ public class TestMsgHistoryService assertTrue("Message no found", msgs.contains(messagesToSend[2].getContent())); } - + public void writeRecordsToMultiChat() { try { ChatRoom room = mockMultiChat.createChatRoom("test_room", null); - room.join(); + room.join(); // ChatRoom room = mockMultiChat.findRoom(TEST_ROOM_NAME); // room.joinAs(TEST_CONTACT_NAME); - + // First deliver message, so they are stored by the message history service room.sendMessage(messagesToSend[0]); - this.controlDate1 = new Date(); + TestMsgHistoryService.controlDate1 = new Date(); Object lock = new Object(); synchronized (lock) @@ -422,7 +424,7 @@ public class TestMsgHistoryService room.sendMessage(messagesToSend[2]); - this.controlDate2 = new Date(); + TestMsgHistoryService.controlDate2 = new Date(); synchronized (lock) { // wait a moment @@ -450,18 +452,18 @@ public class TestMsgHistoryService logger.error("Failed to create room", ex); } } - + /** * tests all read methods (finders) */ public void readRecordsFromMultiChat() { ChatRoom room = null; - + try { room = mockMultiChat.findRoom(TEST_ROOM_NAME); - + }catch(Exception ex) { fail("Cannot find room!" + ex.getMessage()); @@ -643,7 +645,7 @@ public class TestMsgHistoryService return result; } - + private List<String> getChatMessages(Collection<EventObject> rs) { List<String> result = new Vector<String>(); diff --git a/test/net/java/sip/communicator/slick/netaddr/NetworkAddressManagerServiceLick.java b/test/net/java/sip/communicator/slick/netaddr/NetworkAddressManagerServiceLick.java index f520cf8..ebac9ae 100644 --- a/test/net/java/sip/communicator/slick/netaddr/NetworkAddressManagerServiceLick.java +++ b/test/net/java/sip/communicator/slick/netaddr/NetworkAddressManagerServiceLick.java @@ -41,7 +41,7 @@ public class NetworkAddressManagerServiceLick */ public void start(BundleContext bundleContext) throws Exception { - this.bc = bundleContext; + NetworkAddressManagerServiceLick.bc = bundleContext; setName("NetworkAddressManagerServiceLick"); Hashtable<String, String> properties = new Hashtable<String, String>(); properties.put("service.pid", getName()); diff --git a/test/net/java/sip/communicator/slick/netaddr/TestNetworkAddressManagerService.java b/test/net/java/sip/communicator/slick/netaddr/TestNetworkAddressManagerService.java index 59e493d..46ab33b 100644 --- a/test/net/java/sip/communicator/slick/netaddr/TestNetworkAddressManagerService.java +++ b/test/net/java/sip/communicator/slick/netaddr/TestNetworkAddressManagerService.java @@ -64,6 +64,7 @@ public class TestNetworkAddressManagerService * * @throws Exception if anything goes wrong. */ + @Override protected void setUp() throws Exception { @@ -86,6 +87,7 @@ public class TestNetworkAddressManagerService * * @throws Exception if anything goes wrong. */ + @Override protected void tearDown() throws Exception { diff --git a/test/net/java/sip/communicator/slick/popupmessagehandler/PopupMessageHandlerSLick.java b/test/net/java/sip/communicator/slick/popupmessagehandler/PopupMessageHandlerSLick.java index ce98ced..c94bf89 100644 --- a/test/net/java/sip/communicator/slick/popupmessagehandler/PopupMessageHandlerSLick.java +++ b/test/net/java/sip/communicator/slick/popupmessagehandler/PopupMessageHandlerSLick.java @@ -38,7 +38,7 @@ public class PopupMessageHandlerSLick extends TestSuite implements BundleActivat Hashtable<String, String> properties = new Hashtable<String, String>();
properties.put("service.pid", getName());
-
+
addTest(TestPopupMessageHandler.suite());
bundleContext.registerService(getClass().getName(), this, properties);
@@ -47,5 +47,5 @@ public class PopupMessageHandlerSLick extends TestSuite implements BundleActivat /** implements BundleActivator.stop() */
public void stop(BundleContext bc) throws Exception
{}
-
+
}
diff --git a/test/net/java/sip/communicator/slick/popupmessagehandler/TestPopupMessageHandler.java b/test/net/java/sip/communicator/slick/popupmessagehandler/TestPopupMessageHandler.java index 01b6f3b..28d2615 100644 --- a/test/net/java/sip/communicator/slick/popupmessagehandler/TestPopupMessageHandler.java +++ b/test/net/java/sip/communicator/slick/popupmessagehandler/TestPopupMessageHandler.java @@ -90,7 +90,7 @@ public class TestPopupMessageHandler { serviceReference = bc.getServiceReference( SystrayService.class.getName()); - + systrayService = (SystrayService) bc.getService(serviceReference); systrayService.setActivePopupMessageHandler(handler1); @@ -152,7 +152,7 @@ public class TestPopupMessageHandler // is it the expected handler which is handling it ? assertEquals(handler2, this); } - + /** * implements <tt>getPreferenceIndex</tt> from <tt>PopupMessageHandler</tt> */ diff --git a/test/net/java/sip/communicator/slick/protocol/generic/AHMUCEventCollector.java b/test/net/java/sip/communicator/slick/protocol/generic/AHMUCEventCollector.java index c326c97..0bc2929 100644 --- a/test/net/java/sip/communicator/slick/protocol/generic/AHMUCEventCollector.java +++ b/test/net/java/sip/communicator/slick/protocol/generic/AHMUCEventCollector.java @@ -13,10 +13,10 @@ import net.java.sip.communicator.service.protocol.event.*; /** * Gather both chat room and chat room members events generated by unit tests. - * + * * @author Valentin Martinet */ -public class AHMUCEventCollector +public class AHMUCEventCollector implements AdHocChatRoomInvitationListener, AdHocChatRoomInvitationRejectionListener, AdHocChatRoomMessageListener, @@ -55,7 +55,7 @@ AdHocChatRoomParticipantPresenceListener /** * Constructor, operation set's side. - * + * * @param opSet the operation set which belong to this event collector * @param evtType event's type */ @@ -73,7 +73,7 @@ AdHocChatRoomParticipantPresenceListener /** * Constructor, room's side. - * + * * @param pRoom the room which belong to this event collector * @param evtType event's type */ @@ -101,7 +101,7 @@ AdHocChatRoomParticipantPresenceListener } } } - + public void addEvent(EventObject evt) { synchronized (this) @@ -110,37 +110,37 @@ AdHocChatRoomParticipantPresenceListener notifyAll(); } } - - public void invitationReceived(AdHocChatRoomInvitationReceivedEvent evt) + + public void invitationReceived(AdHocChatRoomInvitationReceivedEvent evt) { addEvent(evt); } - public void invitationRejected(AdHocChatRoomInvitationRejectedEvent evt) + public void invitationRejected(AdHocChatRoomInvitationRejectedEvent evt) { addEvent(evt); } - public void messageDelivered(AdHocChatRoomMessageDeliveredEvent evt) + public void messageDelivered(AdHocChatRoomMessageDeliveredEvent evt) { addEvent(evt); } public void messageDeliveryFailed( - AdHocChatRoomMessageDeliveryFailedEvent evt) + AdHocChatRoomMessageDeliveryFailedEvent evt) { addEvent(evt); } - public void messageReceived(AdHocChatRoomMessageReceivedEvent evt) + public void messageReceived(AdHocChatRoomMessageReceivedEvent evt) { addEvent(evt); } public void participantPresenceChanged( - AdHocChatRoomParticipantPresenceChangeEvent evt) + AdHocChatRoomParticipantPresenceChangeEvent evt) { addEvent(evt); } diff --git a/test/net/java/sip/communicator/slick/protocol/generic/AdHocMultiUserChatSlickFixture.java b/test/net/java/sip/communicator/slick/protocol/generic/AdHocMultiUserChatSlickFixture.java index 4500d04..9dfc8fd 100644 --- a/test/net/java/sip/communicator/slick/protocol/generic/AdHocMultiUserChatSlickFixture.java +++ b/test/net/java/sip/communicator/slick/protocol/generic/AdHocMultiUserChatSlickFixture.java @@ -15,10 +15,10 @@ import org.osgi.framework.*; /** * Generic Slick fixture for ad-hoc multi-user chat. - * + * * @author Valentin Martinet */ -public abstract class AdHocMultiUserChatSlickFixture extends TestCase +public abstract class AdHocMultiUserChatSlickFixture extends TestCase { /** * To be set by the slick itself upon activation. @@ -110,15 +110,15 @@ public abstract class AdHocMultiUserChatSlickFixture extends TestCase } /** - * - * + * + * * @throws IllegalArgumentException * @throws IllegalStateException * @throws OperationFailedException */ - public void clearProvidersLists() - throws IllegalArgumentException, - IllegalStateException, + public void clearProvidersLists() + throws IllegalArgumentException, + IllegalStateException, OperationFailedException { Map<String, OperationSet> supportedOperationSets1 = @@ -231,17 +231,17 @@ public abstract class AdHocMultiUserChatSlickFixture extends TestCase /** * Delete all groups and contacts for the given persistent presence op. set. - * + * * @param opSetPersPresence * @throws IllegalArgumentException * @throws IllegalStateException * @throws OperationFailedException */ - public void deleteGroups(OperationSetPersistentPresence opSetPersPresence) - throws IllegalArgumentException, IllegalStateException, + public void deleteGroups(OperationSetPersistentPresence opSetPersPresence) + throws IllegalArgumentException, IllegalStateException, OperationFailedException { - ContactGroup rootGroup = + ContactGroup rootGroup = opSetPersPresence.getServerStoredContactListRoot(); // first delete the groups @@ -276,16 +276,18 @@ public abstract class AdHocMultiUserChatSlickFixture extends TestCase /** * JUnit setUp */ - public void setUp() throws Exception + @Override + public void setUp() throws Exception { super.setUp(); - } + } /** * JUnit tearDown method. * Unget service references used in here. */ - public void tearDown() throws Exception + @Override + public void tearDown() throws Exception { bc.ungetService(provider1ServiceRef); bc.ungetService(provider2ServiceRef); diff --git a/test/net/java/sip/communicator/slick/protocol/generic/ImEventCollector.java b/test/net/java/sip/communicator/slick/protocol/generic/ImEventCollector.java index 0c0d50c..f824d10 100644 --- a/test/net/java/sip/communicator/slick/protocol/generic/ImEventCollector.java +++ b/test/net/java/sip/communicator/slick/protocol/generic/ImEventCollector.java @@ -24,7 +24,7 @@ public class ImEventCollector /** * Called when a new incoming <tt>Message</tt> has been received. - * + * * @param evt the <tt>MessageReceivedEvent</tt> containing the newly * received message, its sender and other details. */ @@ -42,7 +42,7 @@ public class ImEventCollector /** * Called to indicated that delivery of a message sent earlier has failed. * Reason code and phrase are contained by the <tt>MessageFailedEvent</tt> - * + * * @param evt the <tt>MessageFailedEvent</tt> containing the ID of the * message whose delivery has failed. */ @@ -61,7 +61,7 @@ public class ImEventCollector * Called when the underlying implementation has received an indication that * a message, sent earlier has been successfully received by the * destination. - * + * * @param evt the MessageDeliveredEvent containing the id of the message * that has caused the event. */ @@ -79,7 +79,7 @@ public class ImEventCollector /** * Blocks until at least one event is received or until waitFor miliseconds * pass (whichever happens first). - * + * * @param waitFor the number of miliseconds that we should be waiting for an * event before simply bailing out. */ diff --git a/test/net/java/sip/communicator/slick/protocol/generic/SecurityAuthorityImpl.java b/test/net/java/sip/communicator/slick/protocol/generic/SecurityAuthorityImpl.java index aab66fd..9249793 100644 --- a/test/net/java/sip/communicator/slick/protocol/generic/SecurityAuthorityImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/generic/SecurityAuthorityImpl.java @@ -70,18 +70,18 @@ public class SecurityAuthorityImpl /** * Sets the userNameEditable property, which should indicate if the * user name could be changed by user or not. - * + * * @param isUserNameEditable indicates if the user name could be changed */ public void setUserNameEditable(boolean isUserNameEditable) { this.isUserNameEditable = isUserNameEditable; } - + /** * Indicates if the user name is currently editable, i.e. could be changed * by user or not. - * + * * @return <code>true</code> if the user name could be changed, * <code>false</code> - otherwise. */ diff --git a/test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetAdHocMultiUserChat.java b/test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetAdHocMultiUserChat.java index 65a1d23..89bacfe 100644 --- a/test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetAdHocMultiUserChat.java +++ b/test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetAdHocMultiUserChat.java @@ -15,14 +15,14 @@ import net.java.sip.communicator.util.*; /** * Generic tests suite for the ad-hoc multi-user chat functionality. - * + * * @author Valentin Martinet */ -public abstract class TestOperationSetAdHocMultiUserChat extends TestCase +public abstract class TestOperationSetAdHocMultiUserChat extends TestCase { private Logger logger = Logger.getLogger( TestOperationSetAdHocMultiUserChat.class); - + /** * The name for the AdHocChatRoom we will use in this test case. */ @@ -53,7 +53,7 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase /** * Constructor: creates the test with the specified method name. - * + * * @param name the name of the method to execute. */ public TestOperationSetAdHocMultiUserChat(String name) @@ -64,6 +64,7 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase /** * JUnit setUp method. */ + @Override public void setUp() throws Exception { start(); @@ -72,6 +73,7 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase /** * JUnit tearDown method. */ + @Override public void tearDown() throws Exception { fixture.tearDown(); @@ -82,11 +84,11 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase /** * Creates an ad-hoc chat room and check if it's registered on the server. - * + * * @throws OperationFailedException * @throws OperationNotSupportedException */ - public void testCreateRoom() + public void testCreateRoom() throws OperationFailedException, OperationNotSupportedException { AdHocChatRoom adHocChatRoom = opSetAHMUC1.createAdHocChatRoom( @@ -110,7 +112,7 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase } // Check that we retrieved the only one room that should be available: - assertEquals("The room can't be retrieved", + assertEquals("The room can't be retrieved", 1, opSetAHMUC1.getAdHocChatRooms().size()); } @@ -118,21 +120,21 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase /** * Creates an ad-hoc chat room in including participants, then check if it's * registered on the server. - * + * * -Users will be part of the participants to invite when creating the room. - * -Thez will accept the invitation so we'll check that thez'll be actually + * -Thez will accept the invitation so we'll check that thez'll be actually * in the room. - * -Then they will leave the room. They will be invited again in another + * -Then they will leave the room. They will be invited again in another * test. - * + * * NOTE that this test will be especially used by Yahoo! protocol because of * the fact that creating a conference chat with this protocol fails if any * participants are given to the dedicated constructor of the library. - * - * @throws OperationNotSupportedException - * @throws OperationFailedException + * + * @throws OperationNotSupportedException + * @throws OperationFailedException */ - public void testCreateRoomWithParticipants() + public void testCreateRoomWithParticipants() throws OperationFailedException, OperationNotSupportedException { List<String> contacts = new ArrayList<String>(); @@ -150,48 +152,48 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase // (NOTE that in Yahoo! adHocChatRoomName won't be considered!) AdHocChatRoom room = opSetAHMUC1.createAdHocChatRoom( adHocChatRoomName, contacts, invitationReason); - + assertNotNull("Returned room is null", room); - + // A room should have been created on user1's side: - assertEquals("The room can't be retrieved", + assertEquals("The room can't be retrieved", 1, opSetAHMUC1.getAdHocChatRooms().size()); assertNotNull("The newly created room is null", opSetAHMUC1.getAdHocChatRooms().get(0)); - + collectorUser2.waitForEvent(40000); - + // Check that an event has been generated on the other side assertEquals("User2 didn't receive an invitation. Wrong number of " + "collected events", 1, collectorUser2.events.size()); - assertTrue("Unexpected event type", collectorUser2.events.get(0) + assertTrue("Unexpected event type", collectorUser2.events.get(0) instanceof AdHocChatRoomInvitationReceivedEvent); - + collectorUser3.waitForEvent(40000); - + assertEquals("User3 didn't receive an invitation. Wrong number of " + "collected events", 1, collectorUser3.events.size()); - assertTrue("Unexpected event type", collectorUser3.events.get(0) + assertTrue("Unexpected event type", collectorUser3.events.get(0) instanceof AdHocChatRoomInvitationReceivedEvent); // Check event's properties for user2: - AdHocChatRoomInvitationReceivedEvent event2 = + AdHocChatRoomInvitationReceivedEvent event2 = (AdHocChatRoomInvitationReceivedEvent) collectorUser2.events.get(0); - assertEquals("Received invitation does NOT concern the right chatroom", - opSetAHMUC1.getAdHocChatRooms().get(0).getName(), + assertEquals("Received invitation does NOT concern the right chatroom", + opSetAHMUC1.getAdHocChatRooms().get(0).getName(), event2.getInvitation().getTargetAdHocChatRoom().getName()); assertEquals("Received invitation does NOT come from expected user", fixture.userID1, event2.getInvitation().getInviter()); assertEquals("Invitation's reason does NOT match", invitationReason, event2.getInvitation().getReason()); - + // Check event's properties for user3: - AdHocChatRoomInvitationReceivedEvent event3 = + AdHocChatRoomInvitationReceivedEvent event3 = (AdHocChatRoomInvitationReceivedEvent) collectorUser3.events.get(0); - assertEquals("Received invitation does NOT concern the right chatroom", - opSetAHMUC1.getAdHocChatRooms().get(0).getName(), + assertEquals("Received invitation does NOT concern the right chatroom", + opSetAHMUC1.getAdHocChatRooms().get(0).getName(), event3.getInvitation().getTargetAdHocChatRoom().getName()); assertEquals("Received invitation does NOT come from expected user", fixture.userID1, event3.getInvitation().getInviter()); @@ -199,72 +201,72 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase invitationReason, event3.getInvitation().getReason()); collectorUser1 = new AHMUCEventCollector( - opSetAHMUC1.getAdHocChatRooms().get(0), + opSetAHMUC1.getAdHocChatRooms().get(0), AHMUCEventCollector.PRESENCE_EVENT); - + // // Our guest accepts our invitation // assertEquals(1, opSetAHMUC2.getAdHocChatRooms().size()); assertNotNull(opSetAHMUC2.getAdHocChatRooms().get(0)); - + event2.getInvitation().getTargetAdHocChatRoom().join(); collectorUser1.waitForEvent(40000); - assertEquals("Wrong count of generated events", + assertEquals("Wrong count of generated events", 1, collectorUser1.events.size()); - assertTrue("Wrong event instance", collectorUser1.events.get(0) + assertTrue("Wrong event instance", collectorUser1.events.get(0) instanceof AdHocChatRoomParticipantPresenceChangeEvent); // First peer - AdHocChatRoomParticipantPresenceChangeEvent presenceEvent2 = - (AdHocChatRoomParticipantPresenceChangeEvent) + AdHocChatRoomParticipantPresenceChangeEvent presenceEvent2 = + (AdHocChatRoomParticipantPresenceChangeEvent) collectorUser1.events.get(0); - assertEquals("Presence event does NOT concern expected chatroom", - opSetAHMUC1.getAdHocChatRooms().get(0).getName(), + assertEquals("Presence event does NOT concern expected chatroom", + opSetAHMUC1.getAdHocChatRooms().get(0).getName(), presenceEvent2.getAdHocChatRoom().getName()); - assertEquals("Wrong event type", - AdHocChatRoomParticipantPresenceChangeEvent.CONTACT_JOINED, + assertEquals("Wrong event type", + AdHocChatRoomParticipantPresenceChangeEvent.CONTACT_JOINED, presenceEvent2.getEventType()); - assertEquals("Presence event does NOT come from the expected user", + assertEquals("Presence event does NOT come from the expected user", fixture.userID2, presenceEvent2.getParticipant().getAddress()); - assertEquals("Unexpected participants count", 1, + assertEquals("Unexpected participants count", 1, opSetAHMUC1.getAdHocChatRooms().get(0).getParticipantsCount()); assertEquals("Unexpected room participant", fixture.userID2, opSetAHMUC1.getAdHocChatRooms().get(0).getParticipants().get(0) .getAddress()); - + // Second peer assertEquals(1, opSetAHMUC3.getAdHocChatRooms().size()); assertNotNull(opSetAHMUC3.getAdHocChatRooms().get(0)); - + event3.getInvitation().getTargetAdHocChatRoom().join(); collectorUser1.waitForEvent(20000); - - assertEquals("Wrong count of generated events", + + assertEquals("Wrong count of generated events", 2, collectorUser1.events.size()); - assertTrue("Wrong event instance", collectorUser1.events.get(1) + assertTrue("Wrong event instance", collectorUser1.events.get(1) instanceof AdHocChatRoomParticipantPresenceChangeEvent); - - AdHocChatRoomParticipantPresenceChangeEvent presenceEvent3 = - (AdHocChatRoomParticipantPresenceChangeEvent) + + AdHocChatRoomParticipantPresenceChangeEvent presenceEvent3 = + (AdHocChatRoomParticipantPresenceChangeEvent) collectorUser1.events.get(1); - assertEquals("Presence event does NOT concern expected chatroom", - opSetAHMUC1.getAdHocChatRooms().get(0).getName(), + assertEquals("Presence event does NOT concern expected chatroom", + opSetAHMUC1.getAdHocChatRooms().get(0).getName(), presenceEvent3.getAdHocChatRoom().getName()); - assertEquals("Wrong event type", - AdHocChatRoomParticipantPresenceChangeEvent.CONTACT_JOINED, + assertEquals("Wrong event type", + AdHocChatRoomParticipantPresenceChangeEvent.CONTACT_JOINED, presenceEvent3.getEventType()); - assertEquals("Presence event does NOT come from the expected user", + assertEquals("Presence event does NOT come from the expected user", fixture.userID3, presenceEvent3.getParticipant().getAddress()); - assertEquals("Unexpected participants count", 2, + assertEquals("Unexpected participants count", 2, opSetAHMUC1.getAdHocChatRooms().get(0).getParticipantsCount()); assertEquals("Unexpected room participant", fixture.userID3, @@ -280,33 +282,33 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase collectorUser1.waitForEvent(40000); // Check the generated events and what information they give: - presenceEvent2 = (AdHocChatRoomParticipantPresenceChangeEvent) + presenceEvent2 = (AdHocChatRoomParticipantPresenceChangeEvent) collectorUser1.events.get(2); assertEquals("Wrong type of event", presenceEvent2.getEventType(), AdHocChatRoomParticipantPresenceChangeEvent.CONTACT_LEFT); - assertEquals("The event belongs to an unexpected room", + assertEquals("The event belongs to an unexpected room", opSetAHMUC1.getAdHocChatRooms().get(0).getName(), presenceEvent2.getAdHocChatRoom().getName()); assertEquals("The event belongs to an unexpected user", fixture.userID2, presenceEvent2.getParticipant().getAddress()); // Check the current state of the room: - assertEquals("Wrong count of participants", 1, + assertEquals("Wrong count of participants", 1, opSetAHMUC1.getAdHocChatRooms().get(0).getParticipantsCount()); - + opSetAHMUC3.getAdHocChatRooms().get(0).leave(); collectorUser1.waitForEvent(10000); // Check the generated events and what information they give: - presenceEvent3 = (AdHocChatRoomParticipantPresenceChangeEvent) + presenceEvent3 = (AdHocChatRoomParticipantPresenceChangeEvent) collectorUser1.events.get(3); assertEquals("Wrong type of event", presenceEvent3.getEventType(), AdHocChatRoomParticipantPresenceChangeEvent.CONTACT_LEFT); - assertEquals("The event belongs to an unexpected room", + assertEquals("The event belongs to an unexpected room", opSetAHMUC1.getAdHocChatRooms().get(0).getName(), presenceEvent3.getAdHocChatRoom().getName()); assertEquals("The event belongs to an unexpected user", fixture.userID3, @@ -314,23 +316,23 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase // Check the current state of the room: assertEquals("The room was supposed to be empty, but it still contains"+ - " participants", 0, + " participants", 0, opSetAHMUC1.getAdHocChatRooms().get(0).getParticipantsCount()); } /** - * Invite both second and third users and check that they correctly have + * Invite both second and third users and check that they correctly have * joined the room. MSN does not support invitations (with rejection), so we * just have to check if the users are present in the room. - * - * @throws OperationFailedException + * + * @throws OperationFailedException */ public void testPeerJoined() throws OperationFailedException { // First make sure the cache contains rooms: // (If no, the test will fails and not generate an index error) - assertEquals("There are any rooms to retrieve on user 1 side's", 1, + assertEquals("There are any rooms to retrieve on user 1 side's", 1, opSetAHMUC1.getAdHocChatRooms().size()); // Then make sure the room is still here: @@ -342,7 +344,7 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase adHocChatRoom, AHMUCEventCollector.PRESENCE_EVENT); // We invite and wait for the other side: - // (Here with MSN and the ad-hoc group chat, we have to invite at least + // (Here with MSN and the ad-hoc group chat, we have to invite at least // two users if we want a (ad-hoc) chatroom to be created on the other // side: it means you are NOT able to start an ad-hoc MULTI user chat // with just one peer, else it will be considered as a simple one-to-one @@ -355,12 +357,12 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase // We first check if presence events have been generated: // (one event for user2, and another one for user3) - assertEquals("Wrong number of collected events", + assertEquals("Wrong number of collected events", 2, collector.events.size()); // Check generated event's properties: - AdHocChatRoomParticipantPresenceChangeEvent presenceEvent1 = - (AdHocChatRoomParticipantPresenceChangeEvent) + AdHocChatRoomParticipantPresenceChangeEvent presenceEvent1 = + (AdHocChatRoomParticipantPresenceChangeEvent) collector.events.get(0); assertEquals("Wrong event type", AdHocChatRoomParticipantPresenceChangeEvent.CONTACT_JOINED, @@ -369,8 +371,8 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase adHocChatRoom.getName(), presenceEvent1.getAdHocChatRoom().getName()); - AdHocChatRoomParticipantPresenceChangeEvent presenceEvent2 = - (AdHocChatRoomParticipantPresenceChangeEvent) + AdHocChatRoomParticipantPresenceChangeEvent presenceEvent2 = + (AdHocChatRoomParticipantPresenceChangeEvent) collector.events.get(1); assertEquals("Wrong event type", AdHocChatRoomParticipantPresenceChangeEvent.CONTACT_JOINED, @@ -390,11 +392,11 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase participantsAdress.add(c.getAddress()); } - // ... and finally check that both of our guests are here by searching + // ... and finally check that both of our guests are here by searching // for their identity: - assertTrue("A participant is missing", + assertTrue("A participant is missing", participantsAdress.contains(fixture.userID2)); - assertTrue("A participant is missing", + assertTrue("A participant is missing", participantsAdress.contains(fixture.userID3)); // We force the creation of an ad-hoc chatroom on each side: @@ -411,16 +413,16 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase collector2.waitForEvent(10000); // Check event's properties: - AdHocChatRoomMessageDeliveredEvent deliveredMessage = + AdHocChatRoomMessageDeliveredEvent deliveredMessage = (AdHocChatRoomMessageDeliveredEvent) collector2.events.get(0); assertEquals("Message delivered to an unexpected room", - adHocChatRoom.getName(), + adHocChatRoom.getName(), deliveredMessage.getSourceAdHocChatRoom().getName()); assertEquals("Wrong message type", AdHocChatRoomMessageDeliveredEvent.CONVERSATION_MESSAGE_DELIVERED, deliveredMessage.getEventType()); - assertEquals("Message's content does NOT match", message.getContent(), + assertEquals("Message's content does NOT match", message.getContent(), deliveredMessage.getMessage().getContent()); } @@ -428,18 +430,18 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase * Make sure that invitations have been received on both side (user2 and * user3). Note that it only make sense to use this method with protocol * who support invitations (Yahoo! and ICQ). - * - * We will first test that after having accept an invitation the concerned + * + * We will first test that after having accept an invitation the concerned * user joins the room and be a part of participants. - * - * We will then test that after having reject an invitation we receive the - * rejection message and the concerned user is not a part of the room + * + * We will then test that after having reject an invitation we receive the + * rejection message and the concerned user is not a part of the room * participants. - * - * Note that before the end of this test we will invite again the user who + * + * Note that before the end of this test we will invite again the user who * rejected our invitation and he will accept our invitation because we will * need his presence for the remaining tests. - * + * * @throws OperationFailedException if something wrong happens when joining * the room */ @@ -447,7 +449,7 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase { // First make sure the cache contains rooms: // (If no, the test will fails and not generate an index error) - assertEquals("There are no rooms to retrieve on user 1 side's", 1, + assertEquals("There are no rooms to retrieve on user 1 side's", 1, opSetAHMUC1.getAdHocChatRooms().size()); // Then make sure the room is still here: @@ -471,23 +473,23 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase // We check if invitations have been well delivered: // (one event for user2, and another one for user3) - assertEquals("Wrong number of collected events", + assertEquals("Wrong number of collected events", 1, collectorUser2.events.size()); - assertEquals("Wrong number of collected events", + assertEquals("Wrong number of collected events", 1, collectorUser3.events.size()); - assertTrue("Unexpected event type", collectorUser2.events.get(0) + assertTrue("Unexpected event type", collectorUser2.events.get(0) instanceof AdHocChatRoomInvitationReceivedEvent); - assertTrue("Unexpected event type", collectorUser3.events.get(0) + assertTrue("Unexpected event type", collectorUser3.events.get(0) instanceof AdHocChatRoomInvitationReceivedEvent); // Check event's properties for user2: - AdHocChatRoomInvitationReceivedEvent event2 = + AdHocChatRoomInvitationReceivedEvent event2 = (AdHocChatRoomInvitationReceivedEvent) collectorUser2.events.get(0); - assertEquals("Received invitation does NOT concern the right chatroom", - adHocChatRoom.getName(), + assertEquals("Received invitation does NOT concern the right chatroom", + adHocChatRoom.getName(), event2.getInvitation().getTargetAdHocChatRoom().getName()); assertEquals("Received invitation does NOT come from expected user", fixture.userID1, event2.getInvitation().getInviter()); @@ -495,11 +497,11 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase invitationReason, event2.getInvitation().getReason()); // Check event's properties for user3: - AdHocChatRoomInvitationReceivedEvent event3 = + AdHocChatRoomInvitationReceivedEvent event3 = (AdHocChatRoomInvitationReceivedEvent) collectorUser3.events.get(0); - assertEquals("Received invitation does NOT concern the right chatroom", - adHocChatRoom.getName(), + assertEquals("Received invitation does NOT concern the right chatroom", + adHocChatRoom.getName(), event3.getInvitation().getTargetAdHocChatRoom().getName()); assertEquals("Received invitation does NOT come from expected user", fixture.userID1, event3.getInvitation().getInviter()); @@ -515,25 +517,25 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } - assertEquals("Wrong count of generated events", + assertEquals("Wrong count of generated events", 1, collectorUser1.events.size()); - assertTrue("Wrong event instance", collectorUser1.events.get(0) + assertTrue("Wrong event instance", collectorUser1.events.get(0) instanceof AdHocChatRoomParticipantPresenceChangeEvent); - AdHocChatRoomParticipantPresenceChangeEvent presenceEvent2 = - (AdHocChatRoomParticipantPresenceChangeEvent) + AdHocChatRoomParticipantPresenceChangeEvent presenceEvent2 = + (AdHocChatRoomParticipantPresenceChangeEvent) collectorUser1.events.get(0); - assertEquals("Presence event does NOT concern expected chatroom", - adHocChatRoom.getName(), + assertEquals("Presence event does NOT concern expected chatroom", + adHocChatRoom.getName(), presenceEvent2.getAdHocChatRoom().getName()); - assertEquals("Wrong event type", - AdHocChatRoomParticipantPresenceChangeEvent.CONTACT_JOINED, + assertEquals("Wrong event type", + AdHocChatRoomParticipantPresenceChangeEvent.CONTACT_JOINED, presenceEvent2.getEventType()); - assertEquals("Presence event does NOT come from the expected user", + assertEquals("Presence event does NOT come from the expected user", fixture.userID2, presenceEvent2.getParticipant().getAddress()); - assertEquals("Unexpected participants count", + assertEquals("Unexpected participants count", 1, adHocChatRoom.getParticipantsCount()); assertEquals("Unexpected room participant", fixture.userID2, @@ -549,13 +551,13 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } - assertEquals("Wrong count of generated events", + assertEquals("Wrong count of generated events", 2, collectorUser1.events.size()); - assertTrue("Wrong event instance", collectorUser1.events.get(1) + assertTrue("Wrong event instance", collectorUser1.events.get(1) instanceof AdHocChatRoomInvitationRejectedEvent); - AdHocChatRoomInvitationRejectedEvent rejectEvent = - (AdHocChatRoomInvitationRejectedEvent) + AdHocChatRoomInvitationRejectedEvent rejectEvent = + (AdHocChatRoomInvitationRejectedEvent) collectorUser1.events.get(1); assertEquals("Reject event does NOT concern expected room", @@ -567,7 +569,7 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase rejectEvent.getReason()); // Makes sure that previous user is still the only one participant - assertEquals("Unexpected participants count", + assertEquals("Unexpected participants count", 1, adHocChatRoom.getParticipantsCount()); assertEquals("Unexpected room participant", fixture.userID2, @@ -579,17 +581,17 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } - assertEquals("Wrong number of collected events", + assertEquals("Wrong number of collected events", 2, collectorUser3.events.size()); - assertTrue("Unexpected event type", collectorUser3.events.get(1) + assertTrue("Unexpected event type", collectorUser3.events.get(1) instanceof AdHocChatRoomInvitationReceivedEvent); // Check event's properties for user3: - event3 = + event3 = (AdHocChatRoomInvitationReceivedEvent) collectorUser3.events.get(1); - assertEquals("Received invitation does NOT concern the right chatroom", - adHocChatRoom.getName(), + assertEquals("Received invitation does NOT concern the right chatroom", + adHocChatRoom.getName(), event3.getInvitation().getTargetAdHocChatRoom().getName()); assertEquals("Received invitation does NOT come from expected user", fixture.userID1, event3.getInvitation().getInviter()); @@ -601,25 +603,25 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } - assertEquals("Wrong count of generated events", + assertEquals("Wrong count of generated events", 3, collectorUser1.events.size() == 1); - assertTrue("Wrong event instance", collectorUser1.events.get(0) + assertTrue("Wrong event instance", collectorUser1.events.get(0) instanceof AdHocChatRoomParticipantPresenceChangeEvent); - AdHocChatRoomParticipantPresenceChangeEvent presenceEvent3 = - (AdHocChatRoomParticipantPresenceChangeEvent) + AdHocChatRoomParticipantPresenceChangeEvent presenceEvent3 = + (AdHocChatRoomParticipantPresenceChangeEvent) collectorUser1.events.get(2); - assertEquals("Presence event does NOT concern expected chatroom", - adHocChatRoom.getName(), + assertEquals("Presence event does NOT concern expected chatroom", + adHocChatRoom.getName(), presenceEvent3.getAdHocChatRoom().getName()); - assertEquals("Wrong event type", - AdHocChatRoomParticipantPresenceChangeEvent.CONTACT_JOINED, + assertEquals("Wrong event type", + AdHocChatRoomParticipantPresenceChangeEvent.CONTACT_JOINED, presenceEvent3.getEventType()); - assertEquals("Presence event does NOT come from the expected user", + assertEquals("Presence event does NOT come from the expected user", fixture.userID3, presenceEvent3.getParticipant().getAddress()); - assertEquals("Unexpected participants count", + assertEquals("Unexpected participants count", 2, adHocChatRoom.getParticipantsCount()); assertEquals("Unexpected room participant", fixture.userID3, @@ -627,19 +629,19 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase } /** - * Send an instant message to the room and check that second user in the + * Send an instant message to the room and check that second user in the * room receives it. - * - * @throws OperationFailedException if an error occurs while sending a + * + * @throws OperationFailedException if an error occurs while sending a * message - * @throws OperationNotSupportedException + * @throws OperationNotSupportedException */ - public void testSendIM() + public void testSendIM() throws OperationFailedException, OperationNotSupportedException { // First make sure the cache contains the expected rooms: // (If no, the test will fails and not generate an index error) - assertEquals("There are any rooms to retrieve on user 1 side's", 1, + assertEquals("There are any rooms to retrieve on user 1 side's", 1, opSetAHMUC1.getAdHocChatRooms().size()); assertEquals("There are any rooms to retrieve on user 2 side's", 1, opSetAHMUC2.getAdHocChatRooms().size()); @@ -651,7 +653,7 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase AdHocChatRoom roomUser2 = opSetAHMUC2.getAdHocChatRooms().get(0); AdHocChatRoom roomUser3 = opSetAHMUC3.getAdHocChatRooms().get(0); - assertNotNull("The room can NOT been retrieved on user's 1 side.", + assertNotNull("The room can NOT been retrieved on user's 1 side.", roomUser1); assertNotNull("The room can NOT been retrieved on user's 2 side.", roomUser2); @@ -669,7 +671,7 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase roomUser3, AHMUCEventCollector.MESSAGE_EVENT); // We create a new message to be sent through the room: - Message message = + Message message = roomUser1.createMessage("Quick brown fox jumps over the lazy dog"); roomUser1.sendMessage(message); @@ -686,58 +688,58 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase // Check event's pertinency on user's 1 side: - AdHocChatRoomMessageDeliveredEvent deliveredMessage = + AdHocChatRoomMessageDeliveredEvent deliveredMessage = (AdHocChatRoomMessageDeliveredEvent) collectorUser1.events.get(0); assertEquals("Message delivered to an unexpected room", - roomUser1.getName(), + roomUser1.getName(), deliveredMessage.getSourceAdHocChatRoom().getName()); assertEquals("Wrong message type", AdHocChatRoomMessageDeliveredEvent.CONVERSATION_MESSAGE_DELIVERED, deliveredMessage.getEventType()); - assertEquals("Message's content does NOT match", message.getContent(), + assertEquals("Message's content does NOT match", message.getContent(), deliveredMessage.getMessage().getContent()); // Check event's pertinency on user's 2 side: - AdHocChatRoomMessageReceivedEvent receivedMessage = + AdHocChatRoomMessageReceivedEvent receivedMessage = (AdHocChatRoomMessageReceivedEvent) collectorUser2.events.get(0); assertEquals("Message does NOT belong to this room", - roomUser2.getName(), + roomUser2.getName(), receivedMessage.getSourceChatRoom().getName()); assertEquals("Wrong message type", AdHocChatRoomMessageReceivedEvent.CONVERSATION_MESSAGE_RECEIVED, receivedMessage.getEventType()); - assertEquals("Message's content does NOT match", message.getContent(), + assertEquals("Message's content does NOT match", message.getContent(), receivedMessage.getMessage().getContent()); // Check event's pertinency on user's 3 side: - receivedMessage = + receivedMessage = (AdHocChatRoomMessageReceivedEvent) collectorUser3.events.get(0); assertEquals("Message does NOT belong to this room", - roomUser3.getName(), + roomUser3.getName(), receivedMessage.getSourceChatRoom().getName()); assertEquals("Wrong message type", AdHocChatRoomMessageReceivedEvent.CONVERSATION_MESSAGE_RECEIVED, receivedMessage.getEventType()); - assertEquals("Message's content does NOT match", message.getContent(), + assertEquals("Message's content does NOT match", message.getContent(), receivedMessage.getMessage().getContent()); } /** - * Our peer leave the room: we check that there is no more participants in + * Our peer leave the room: we check that there is no more participants in * the room. */ public void testPeerLeaved() { // First make sure the cache contains rooms: // (If no, the test will fails and not generate an index error) - assertEquals("There are any rooms to retrieve on user 1 side's", 1, + assertEquals("There are any rooms to retrieve on user 1 side's", 1, opSetAHMUC1.getAdHocChatRooms().size()); - assertEquals("There are any rooms to retrieve on user 2 side's", 1, + assertEquals("There are any rooms to retrieve on user 2 side's", 1, opSetAHMUC2.getAdHocChatRooms().size()); - assertEquals("There are any rooms to retrieve on user 3 side's", 1, + assertEquals("There are any rooms to retrieve on user 3 side's", 1, opSetAHMUC3.getAdHocChatRooms().size()); AdHocChatRoom room = opSetAHMUC1.getAdHocChatRooms().get(0); @@ -755,8 +757,8 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase assertEquals("Wrong events count when first peer leaved the room", 1, collector.events.size()); - AdHocChatRoomParticipantPresenceChangeEvent presenceEvent = - (AdHocChatRoomParticipantPresenceChangeEvent) + AdHocChatRoomParticipantPresenceChangeEvent presenceEvent = + (AdHocChatRoomParticipantPresenceChangeEvent) collector.events.get(0); assertEquals("Wrong type of event", presenceEvent.getEventType(), @@ -769,7 +771,7 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase // Check the current state of the room: assertEquals("No event was generated when second peer leaved the room", 1, room.getParticipantsCount()); - assertEquals("The room was not supposed to contain this user anymore", + assertEquals("The room was not supposed to contain this user anymore", fixture.userID3, room.getParticipants().get(0).getAddress()); @@ -781,7 +783,7 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase collector.waitForEvent(10000); // Check the generated events and what information they give: - presenceEvent = (AdHocChatRoomParticipantPresenceChangeEvent) + presenceEvent = (AdHocChatRoomParticipantPresenceChangeEvent) collector.events.get(1); assertEquals("Wrong type of event", presenceEvent.getEventType(), @@ -798,14 +800,14 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase /** * Make sure each user is on the contact list of others. - * - * @throws Exception + * + * @throws Exception */ public void prepareContactList() throws Exception { fixture.clearProvidersLists(); - try + try { opSetPresence1.setAuthorizationHandler(new AuthHandler()); opSetPresence1.subscribe(fixture.userID2); @@ -815,8 +817,8 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase { // means that the contacts already exits. } - - try + + try { opSetPresence2.setAuthorizationHandler(new AuthHandler()); opSetPresence2.subscribe(fixture.userID1); @@ -826,8 +828,8 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase { // means that the contacts already exits. } - - try + + try { opSetPresence3.setAuthorizationHandler(new AuthHandler()); opSetPresence3.subscribe(fixture.userID1); @@ -837,7 +839,7 @@ public abstract class TestOperationSetAdHocMultiUserChat extends TestCase { // means that the contacts already exits. } - + logger.info("Will wait until the list prepare is completed"); Object o = new Object(); synchronized(o) diff --git a/test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetFileTransfer.java b/test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetFileTransfer.java index e846e62..1d39fa7 100644 --- a/test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetFileTransfer.java +++ b/test/net/java/sip/communicator/slick/protocol/generic/TestOperationSetFileTransfer.java @@ -39,6 +39,7 @@ public abstract class TestOperationSetFileTransfer { } + @Override protected void setUp() throws Exception { @@ -46,6 +47,7 @@ public abstract class TestOperationSetFileTransfer start(); } + @Override protected void tearDown() throws Exception { stop(); @@ -242,7 +244,7 @@ public abstract class TestOperationSetFileTransfer /** * Sender sends file transfer request and cancel it before the remote side * accept it. (This is not supported by all protocols) - * + * * @throws Exception */ public void testSenderCancelBeforeAccepted() @@ -266,7 +268,7 @@ public abstract class TestOperationSetFileTransfer new FileTransferEventCollector("Sender", senderStatusListener); ftOpSet1.addFileTransferListener(senderFTListerner); - FileTransferEventCollector receiverFTListerner = + FileTransferEventCollector receiverFTListerner = new FileTransferEventCollector("Receiver", null); ftOpSet2.addFileTransferListener(receiverFTListerner); @@ -383,7 +385,7 @@ public abstract class TestOperationSetFileTransfer new FileTransferEventCollector("Sender", senderStatusListener); ftOpSet1.addFileTransferListener(senderFTListerner); - FileTransferEventCollector receiverFTListerner = + FileTransferEventCollector receiverFTListerner = new FileTransferEventCollector("Receiver", null); ftOpSet2.addFileTransferListener(receiverFTListerner); @@ -671,7 +673,7 @@ public abstract class TestOperationSetFileTransfer new FileTransferEventCollector("Sender", senderStatusListener); ftOpSet1.addFileTransferListener(senderFTListerner); - FileTransferEventCollector receiverFTListerner = + FileTransferEventCollector receiverFTListerner = new FileTransferEventCollector("Receiver", null); ftOpSet2.addFileTransferListener(receiverFTListerner); @@ -1091,6 +1093,6 @@ public abstract class TestOperationSetFileTransfer eventsNum = 1; } - + } } 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 9862b93..f3c3fc2 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/GibberishSlickFixture.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/GibberishSlickFixture.java @@ -95,6 +95,7 @@ public class GibberishSlickFixture * @throws java.lang.Exception in case we meet problems while retriving * protocol providers through OSGI */ + @Override public void setUp() throws Exception { @@ -173,6 +174,7 @@ public class GibberishSlickFixture /** * Un get service references used in here. */ + @Override public void tearDown() { bc.ungetService(provider1ServiceRef); diff --git a/test/net/java/sip/communicator/slick/protocol/gibberish/TestAccountInstallation.java b/test/net/java/sip/communicator/slick/protocol/gibberish/TestAccountInstallation.java index b7d4a1e..635de9e 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/TestAccountInstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/TestAccountInstallation.java @@ -36,6 +36,7 @@ public class TestAccountInstallation * JUnit setup method. * @throws Exception in case anything goes wrong. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -45,6 +46,7 @@ public class TestAccountInstallation * JUnit teardown method. * @throws Exception in case anything goes wrong. */ + @Override protected void tearDown() throws Exception { super.tearDown(); diff --git a/test/net/java/sip/communicator/slick/protocol/gibberish/TestAccountUninstallation.java b/test/net/java/sip/communicator/slick/protocol/gibberish/TestAccountUninstallation.java index 75450fe..6293efc 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/TestAccountUninstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/TestAccountUninstallation.java @@ -38,6 +38,7 @@ public class TestAccountUninstallation * JUnit setup method. * @throws Exception in case anything goes wrong. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -48,6 +49,7 @@ public class TestAccountUninstallation * JUnit teardown method. * @throws Exception in case anything goes wrong. */ + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -82,7 +84,7 @@ public class TestAccountUninstallation public void testInstallationPersistency() throws Exception { Bundle providerBundle - = fixture.findProtocolProviderBundle(fixture.provider1); + = GibberishSlickFixture.findProtocolProviderBundle(fixture.provider1); //set the global providerBundle reference that we will be using //in the last series of tests (Account uninstallation persistency) @@ -107,7 +109,7 @@ public class TestAccountUninstallation ServiceReference[] gibberishProviderRefs = null; try { - gibberishProviderRefs = fixture.bc.getServiceReferences( + gibberishProviderRefs = GibberishSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(&" + "(" + ProtocolProviderFactory.PROTOCOL @@ -140,7 +142,7 @@ public class TestAccountUninstallation == null); //Now reinstall the bundle - providerBundle = fixture.bc.installBundle(providerBundle.getLocation()); + providerBundle = GibberishSlickFixture.bc.installBundle(providerBundle.getLocation()); //set the global providerBundle reference that we will be using //in the last series of tests (Account uninstallation persistency) @@ -158,7 +160,7 @@ public class TestAccountUninstallation //verify that the provider is no longer available try { - gibberishProviderRefs = fixture.bc.getServiceReferences( + gibberishProviderRefs = GibberishSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(&" + "(" + ProtocolProviderFactory.PROTOCOL @@ -181,7 +183,7 @@ public class TestAccountUninstallation ServiceReference[] gibberishFactoryRefs = null; try { - gibberishFactoryRefs = fixture.bc.getServiceReferences( + gibberishFactoryRefs = GibberishSlickFixture.bc.getServiceReferences( ProtocolProviderFactory.class.getName(), "(" + ProtocolProviderFactory.PROTOCOL + "=Gibberish)"); @@ -194,10 +196,10 @@ public class TestAccountUninstallation //we're the ones who've reinstalled the factory so it's our //responsibility to update the fixture. fixture.providerFactory - = (ProtocolProviderFactory)fixture.bc.getService( + = (ProtocolProviderFactory)GibberishSlickFixture.bc.getService( gibberishFactoryRefs[0]); fixture.provider1 - = (ProtocolProviderService)fixture.bc.getService( + = (ProtocolProviderService)GibberishSlickFixture.bc.getService( gibberishProviderRefs[0]); @@ -242,7 +244,7 @@ public class TestAccountUninstallation ServiceReference[] gibberishProviderRefs = null; try { - gibberishProviderRefs = fixture.bc.getServiceReferences( + gibberishProviderRefs = GibberishSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(" + ProtocolProviderFactory.PROTOCOL + "=Gibberish)"); 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 19b8504..a7302e9 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetBasicInstantMessaging.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetBasicInstantMessaging.java @@ -44,6 +44,7 @@ public class TestOperationSetBasicInstantMessaging * Get a reference to the basic IM operation set. * @throws Exception if this is not a good day. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -116,6 +117,7 @@ public class TestOperationSetBasicInstantMessaging } + @Override protected void tearDown() throws Exception { super.tearDown(); 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 806e3c3..a77eb65 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetPersistentPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetPersistentPresence.java @@ -68,6 +68,7 @@ public class TestOperationSetPersistentPresence return suite; } + @Override protected void setUp() throws Exception { super.setUp(); @@ -119,6 +120,7 @@ public class TestOperationSetPersistentPresence + "Operation Sets"); } + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -143,7 +145,7 @@ public class TestOperationSetPersistentPresence + "Printing rootGroupContents=\n"+rootGroup.toString()); Hashtable<String, List<String>> expectedContactList - = fixture.preInstalledBuddyList; + = GibberishSlickFixture.preInstalledBuddyList; logger.debug("============== Expected Contact List ==================="); logger.debug(expectedContactList); 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 4366223..5d7f607 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetPresence.java @@ -18,7 +18,7 @@ import net.java.sip.communicator.util.*; * Tests Gibberish implementations of a Presence Operation Set. Tests in this * class verify functionality such as: Changing local (our own) status and * corresponding event dispatching; Querying status of contacts, Subscribing - * for presence notifications upong status changes of specific contacts. + * for presence notifications upon status changes of specific contacts. * <p> * Using a custom suite() method, we make sure that apart from standard test * methods (those with a <tt>test</tt> prefix) we also execute those that @@ -46,6 +46,7 @@ public class TestOperationSetPresence super(name); } + @Override protected void setUp() throws Exception { super.setUp(); @@ -102,6 +103,7 @@ public class TestOperationSetPresence } + @Override protected void tearDown() throws Exception { super.tearDown(); 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 a95d208..c24562e 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetTypingNotifications.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/TestOperationSetTypingNotifications.java @@ -39,6 +39,7 @@ public class TestOperationSetTypingNotifications super(name); } + @Override protected void setUp() throws Exception { super.setUp(); @@ -166,6 +167,7 @@ public class TestOperationSetTypingNotifications } } + @Override protected void tearDown() throws Exception { super.tearDown(); 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 e5f3587..fbc30c6 100644 --- a/test/net/java/sip/communicator/slick/protocol/gibberish/TestProtocolProviderServiceGibberishImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/gibberish/TestProtocolProviderServiceGibberishImpl.java @@ -51,6 +51,7 @@ public class TestProtocolProviderServiceGibberishImpl * Initializes the fixture. * @throws Exception if super.setUp() throws one. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -61,6 +62,7 @@ public class TestProtocolProviderServiceGibberishImpl * Tears the fixture down. * @throws Exception if fixture.tearDown() fails. */ + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -305,18 +307,18 @@ public class TestProtocolProviderServiceGibberishImpl /** * Sets the userNameEditable property, which should indicate if the * user name could be changed by user or not. - * + * * @param isUserNameEditable indicates if the user name could be changed */ public void setUserNameEditable(boolean isUserNameEditable) { this.isUserNameEditable = isUserNameEditable; } - + /** * Indicates if the user name is currently editable, i.e. could be changed * by user or not. - * + * * @return <code>true</code> if the user name could be changed, * <code>false</code> - otherwise. */ diff --git a/test/net/java/sip/communicator/slick/protocol/icq/FullUserInfoCmd.java b/test/net/java/sip/communicator/slick/protocol/icq/FullUserInfoCmd.java index c00ad3b..8a6531d 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/FullUserInfoCmd.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/FullUserInfoCmd.java @@ -132,6 +132,7 @@ public class FullUserInfoCmd * @param out the stream to which to write the SNAC data * @throws IOException if an I/O error occurs */ + @Override public void writeData(OutputStream out) throws IOException { @@ -668,10 +669,10 @@ public class FullUserInfoCmd return -1; } - return ( ( (long) data.get(pos + 3) & 0xffL) << 24) - | ( ( (long) data.get(pos + 2) & 0xffL) << 16) - | ( ( (long) data.get(pos + 1) & 0xffL) << 8) - | ( (long) data.get(pos) & 0xffL); + return ( ( data.get(pos + 3) & 0xffL) << 24) + | ( ( data.get(pos + 2) & 0xffL) << 16) + | ( ( data.get(pos + 1) & 0xffL) << 8) + | ( data.get(pos) & 0xffL); } /** @@ -810,6 +811,7 @@ public class FullUserInfoCmd * @param out OutputStream * @throws IOException */ + @Override public void writeData(OutputStream out) throws IOException { ByteArrayOutputStream icqout = new ByteArrayOutputStream(); diff --git a/test/net/java/sip/communicator/slick/protocol/icq/IcqSlickFixture.java b/test/net/java/sip/communicator/slick/protocol/icq/IcqSlickFixture.java index 358f885..e3fc617 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/IcqSlickFixture.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/IcqSlickFixture.java @@ -71,6 +71,7 @@ public class IcqSlickFixture extends TestCase */ public static boolean onlineTestingDisabled = false; + @Override public void setUp() throws Exception { // first obtain a reference to the provider factory @@ -120,6 +121,7 @@ public class IcqSlickFixture extends TestCase provider = (ProtocolProviderService)bc.getService(icqServiceRef); } + @Override public void tearDown() { bc.ungetService(icqServiceRef); diff --git a/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java b/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java index a1c2325..032e0ad 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/IcqTesterAgent.java @@ -512,6 +512,7 @@ public class IcqTesterAgent public Object waitingForResponseLock = new Object(); + @Override public void handleResponse(SnacResponseEvent e) { SnacCommand snac = e.getSnacCommand(); logger.debug("Received a response to our status request: " + snac); @@ -571,6 +572,7 @@ public class IcqTesterAgent } + @Override public void handleTimeout(SnacRequestTimeoutEvent event) { synchronized(this) { if (ran) return; @@ -1176,7 +1178,7 @@ public class IcqTesterAgent { conn.sendSnac(new OfflineSnacCmd(buddy, body)); } - + void sendAuthorizationReplay(String uin, String reasonStr, boolean isAccpeted) { conn.sendSnac(new AuthReplyCmd(uin, reasonStr, isAccpeted)); @@ -1191,6 +1193,7 @@ public class IcqTesterAgent super(sn, message); } + @Override protected void writeChannelData(OutputStream out) throws IOException { @@ -1237,6 +1240,7 @@ public class IcqTesterAgent this.accepted = accepted; } + @Override public void writeData(OutputStream out) throws IOException { @@ -1285,9 +1289,11 @@ public class IcqTesterAgent this.SUPPORTED_TYPES = DefensiveTools.getUnmodifiable(tempTypes); } + @Override public List<CmdType> getSupportedTypes() {return SUPPORTED_TYPES;} + @Override public SnacCommand genSnacCommand(SnacPacket packet) { int command = packet.getCommand(); @@ -1308,12 +1314,12 @@ public class IcqTesterAgent } logger.trace("sending authorization " + ACCEPT); - + sendAuthorizationReplay( String.valueOf(cmd.uin), responseReasonStr, ACCEPT); - + return cmd; } else if (command == 27) // auth reply @@ -1423,6 +1429,7 @@ public class IcqTesterAgent OscarTools.getString(messageData.subBlock(offset, reasonLen), "US-ASCII"); } + @Override public void writeData(OutputStream out) throws IOException { byte[] uinBytes = BinaryTools.getAsciiBytes(uin); @@ -1499,6 +1506,7 @@ public class IcqTesterAgent { Hashtable<String, Object> info = null; + @Override public void handleResponse(SnacResponseEvent e) { if(e.getSnacCommand() instanceof FullUserInfoCmd) @@ -1531,6 +1539,7 @@ public class IcqTesterAgent this.originalItem = originalItem; } + @Override public void write(OutputStream out) throws IOException { byte[] namebytes = BinaryTools.getAsciiBytes(originalItem.getName()); diff --git a/test/net/java/sip/communicator/slick/protocol/icq/TestAccountInstallation.java b/test/net/java/sip/communicator/slick/protocol/icq/TestAccountInstallation.java index 980211a..0e2b30a 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestAccountInstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestAccountInstallation.java @@ -44,6 +44,7 @@ public class TestAccountInstallation extends TestCase * JUnit setup method. * @throws Exception in case anything goes wrong. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -53,6 +54,7 @@ public class TestAccountInstallation extends TestCase * JUnit teardown method. * @throws Exception in case anything goes wrong. */ + @Override protected void tearDown() throws Exception { super.tearDown(); @@ -539,7 +541,7 @@ public class TestAccountInstallation extends TestCase * <p> * @param realm The realm that the credentials are needed for. * @param defaultValues the values to propose the user by default - * + * * @return The credentials associated with the specified realm or null if * none could be obtained. */ @@ -553,18 +555,18 @@ public class TestAccountInstallation extends TestCase /** * Sets the userNameEditable property, which should indicate if the * user name could be changed by user or not. - * + * * @param isUserNameEditable indicates if the user name could be changed */ public void setUserNameEditable(boolean isUserNameEditable) { this.isUserNameEditable = isUserNameEditable; } - + /** * Indicates if the user name is currently editable, i.e. could be changed * by user or not. - * + * * @return <code>true</code> if the user name could be changed, * <code>false</code> - otherwise. */ diff --git a/test/net/java/sip/communicator/slick/protocol/icq/TestAccountInvalidNotification.java b/test/net/java/sip/communicator/slick/protocol/icq/TestAccountInvalidNotification.java index 0a24e5d..e0f6f4e 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestAccountInvalidNotification.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestAccountInvalidNotification.java @@ -23,12 +23,14 @@ public class TestAccountInvalidNotification extends TestCase super(name); } + @Override protected void setUp() throws Exception { super.setUp(); } + @Override protected void tearDown() throws Exception { super.tearDown(); diff --git a/test/net/java/sip/communicator/slick/protocol/icq/TestAccountUninstallation.java b/test/net/java/sip/communicator/slick/protocol/icq/TestAccountUninstallation.java index 45a5d4c..1a0e8d3 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestAccountUninstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestAccountUninstallation.java @@ -53,6 +53,7 @@ public class TestAccountUninstallation * JUnit setup method. * @throws Exception in case anything goes wrong. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -63,6 +64,7 @@ public class TestAccountUninstallation * JUnit teardown method. * @throws Exception in case anything goes wrong. */ + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -152,7 +154,7 @@ public class TestAccountUninstallation throws Exception { Bundle providerBundle - = fixture.findProtocolProviderBundle(fixture.provider); + = IcqSlickFixture.findProtocolProviderBundle(fixture.provider); //set the global providerBundle reference that we will be using //in the last series of tests (Account uninstallation persistency) @@ -177,13 +179,13 @@ public class TestAccountUninstallation ServiceReference[] icqProviderRefs = null; try { - icqProviderRefs = fixture.bc.getServiceReferences( + icqProviderRefs = IcqSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(&" + "(" + ProtocolProviderFactory.PROTOCOL + "=" +ProtocolNames.ICQ + ")" + "(" + ProtocolProviderFactory.USER_ID - + "="+ fixture.icqAccountID.getUserID() + ")" + + "="+ IcqSlickFixture.icqAccountID.getUserID() + ")" + ")"); } catch (InvalidSyntaxException ex) @@ -193,7 +195,7 @@ public class TestAccountUninstallation //make sure we didn't see a service assertTrue("A Protocol Provider Service was still regged as an osgi service " - +"for ICQ UIN:" + fixture.icqAccountID + +"for ICQ UIN:" + IcqSlickFixture.icqAccountID + "After it was explicitly uninstalled" ,icqProviderRefs == null || icqProviderRefs.length == 0); @@ -201,14 +203,14 @@ public class TestAccountUninstallation //provider. assertTrue( "The ICQ provider factory kept a reference to the provider we just " - +"uninstalled (accID="+fixture.icqAccountID+")", + +"uninstalled (accID="+IcqSlickFixture.icqAccountID+")", fixture.providerFactory.getRegisteredAccounts().isEmpty() - && fixture.providerFactory.getProviderForAccount(fixture.icqAccountID) + && fixture.providerFactory.getProviderForAccount(IcqSlickFixture.icqAccountID) == null); //Now reinstall the bundle - providerBundle = fixture.bc.installBundle(providerBundle.getLocation()); + providerBundle = IcqSlickFixture.bc.installBundle(providerBundle.getLocation()); //set the global providerBundle reference that we will be using //in the last series of tests (Account uninstallation persistency) @@ -227,13 +229,13 @@ public class TestAccountUninstallation //verify that the provider is no longer available try { - icqProviderRefs = fixture.bc.getServiceReferences( + icqProviderRefs = IcqSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(&" + "(" + ProtocolProviderFactory.PROTOCOL + "=" +ProtocolNames.ICQ + ")" + "(" + ProtocolProviderFactory.USER_ID - + "="+ fixture.icqAccountID.getUserID() + ")" + + "="+ IcqSlickFixture.icqAccountID.getUserID() + ")" + ")"); } catch (InvalidSyntaxException ex) @@ -243,13 +245,13 @@ public class TestAccountUninstallation //make sure we didn't see a service assertTrue("A Protocol Provider Service was not restored after being" - +"reinstalled. ICQ UIN:" + fixture.icqAccountID + +"reinstalled. ICQ UIN:" + IcqSlickFixture.icqAccountID ,icqProviderRefs != null && icqProviderRefs.length > 0); ServiceReference[] icqFactoryRefs = null; try { - icqFactoryRefs = fixture.bc.getServiceReferences( + icqFactoryRefs = IcqSlickFixture.bc.getServiceReferences( ProtocolProviderFactory.class.getName(), "(" + ProtocolProviderFactory.PROTOCOL + "=" +ProtocolNames.ICQ + ")"); @@ -262,10 +264,10 @@ public class TestAccountUninstallation //we're the ones who've reinstalled the factory so it's our //responsibility to update the fixture. fixture.providerFactory - = (ProtocolProviderFactory)fixture.bc.getService(icqFactoryRefs[0]); + = (ProtocolProviderFactory)IcqSlickFixture.bc.getService(icqFactoryRefs[0]); fixture.provider - = (ProtocolProviderService)fixture.bc.getService(icqProviderRefs[0]); - fixture.icqAccountID + = (ProtocolProviderService)IcqSlickFixture.bc.getService(icqProviderRefs[0]); + IcqSlickFixture.icqAccountID = fixture.provider.getAccountID(); @@ -273,9 +275,9 @@ public class TestAccountUninstallation //itself assertTrue( "The ICQ provider did not restore its own reference to the provider " - +"that we just reinstalled (accID="+fixture.icqAccountID+")", + +"that we just reinstalled (accID="+IcqSlickFixture.icqAccountID+")", !fixture.providerFactory.getRegisteredAccounts().isEmpty() - && fixture.providerFactory.getProviderForAccount(fixture.icqAccountID) + && fixture.providerFactory.getProviderForAccount(IcqSlickFixture.icqAccountID) != null); } /** @@ -288,24 +290,24 @@ public class TestAccountUninstallation assertNotNull( "Found no provider corresponding to account ID " - + fixture.icqAccountID - ,fixture.providerFactory.getProviderForAccount(fixture.icqAccountID)); + + IcqSlickFixture.icqAccountID + ,fixture.providerFactory.getProviderForAccount(IcqSlickFixture.icqAccountID)); assertTrue( "Failed to remove a provider corresponding to acc id " - + fixture.icqAccountID - , fixture.providerFactory.uninstallAccount(fixture.icqAccountID)); + + IcqSlickFixture.icqAccountID + , fixture.providerFactory.uninstallAccount(IcqSlickFixture.icqAccountID)); ServiceReference[] icqProviderRefs = null; try { - icqProviderRefs = fixture.bc.getServiceReferences( + icqProviderRefs = IcqSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(&" + "(" + ProtocolProviderFactory.PROTOCOL + "=" +ProtocolNames.ICQ + ")" + "(" + ProtocolProviderFactory.USER_ID - + "="+ fixture.icqAccountID.getUserID() + ")" + + "="+ IcqSlickFixture.icqAccountID.getUserID() + ")" + ")"); } catch (InvalidSyntaxException ex) @@ -315,7 +317,7 @@ public class TestAccountUninstallation //make sure we didn't see a service assertTrue("A Protocol Provider Service was still regged as an osgi service " - +"for ICQ UIN:" + fixture.icqAccountID + +"for ICQ UIN:" + IcqSlickFixture.icqAccountID + "After it was explicitly uninstalled" ,icqProviderRefs == null || icqProviderRefs.length == 0); @@ -323,9 +325,9 @@ public class TestAccountUninstallation //provider. assertTrue( "The ICQ provider factory kept a reference to the provider we just " - +"uninstalled (accID="+fixture.icqAccountID+")" + +"uninstalled (accID="+IcqSlickFixture.icqAccountID+")" , fixture.providerFactory.getRegisteredAccounts().isEmpty() - && fixture.providerFactory.getProviderForAccount(fixture.icqAccountID) + && fixture.providerFactory.getProviderForAccount(IcqSlickFixture.icqAccountID) == null); } diff --git a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetBasicInstantMessaging.java b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetBasicInstantMessaging.java index 8497235..4680bc3 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetBasicInstantMessaging.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetBasicInstantMessaging.java @@ -43,6 +43,7 @@ public class TestOperationSetBasicInstantMessaging * Get a reference to the basic IM operation set. * @throws Exception if this is not a good day. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -85,6 +86,7 @@ public class TestOperationSetBasicInstantMessaging } + @Override protected void tearDown() throws Exception { super.tearDown(); @@ -134,7 +136,7 @@ public class TestOperationSetBasicInstantMessaging //msg from the tester agent. opSetBasicIM.addMessageListener(evtCollector); - fixture.testerAgent.sendMessage(fixture.ourUserID, body); + IcqSlickFixture.testerAgent.sendMessage(fixture.ourUserID, body); evtCollector.waitForEvent(10000); @@ -155,7 +157,7 @@ public class TestOperationSetBasicInstantMessaging = (MessageReceivedEvent)evtCollector.collectedEvents.get(0); assertEquals("message sender " , evt.getSourceContact().getAddress() - , fixture.testerAgent.getIcqUIN()); + , IcqSlickFixture.testerAgent.getIcqUIN()); //assert messageBody == body assertEquals("message body", body, evt.getSourceMessage().getContent()); @@ -181,18 +183,18 @@ public class TestOperationSetBasicInstantMessaging //register a listener in the tester agent JoustSimMessageEventCollector jsEvtCollector = new JoustSimMessageEventCollector(); - fixture.testerAgent.addConversationListener( fixture.ourUserID + IcqSlickFixture.testerAgent.addConversationListener( fixture.ourUserID , jsEvtCollector); Contact testerAgentContact - = opSetPresence.findContactByID(fixture.testerAgent.getIcqUIN()); + = opSetPresence.findContactByID(IcqSlickFixture.testerAgent.getIcqUIN()); opSetBasicIM.sendInstantMessage(testerAgentContact, msg); imEvtCollector.waitForEvent(10000); jsEvtCollector.waitForEvent(10000); - fixture.testerAgent.removeConversationListener( fixture.ourUserID + IcqSlickFixture.testerAgent.removeConversationListener( fixture.ourUserID , jsEvtCollector); opSetBasicIM.removeMessageListener(imEvtCollector); @@ -209,7 +211,7 @@ public class TestOperationSetBasicInstantMessaging = (MessageDeliveredEvent)imEvtCollector.collectedEvents.get(0); assertEquals("message destination " , evt.getDestinationContact().getAddress() - , fixture.testerAgent.getIcqUIN()); + , IcqSlickFixture.testerAgent.getIcqUIN()); assertSame("source message", msg, evt.getSourceMessage()); @@ -475,7 +477,7 @@ public class TestOperationSetBasicInstantMessaging while(tokenizer.hasMoreTokens()) { - fixture.testerAgent.sendMessage(tokenizer.nextToken(), message); + IcqSlickFixture.testerAgent.sendMessage(tokenizer.nextToken(), message); } } @@ -486,9 +488,9 @@ public class TestOperationSetBasicInstantMessaging public void testReceiveOfflineMessages() { String messageText = - fixture.offlineMsgCollector.getMessageText(); + IcqSlickFixture.offlineMsgCollector.getMessageText(); - Message receiveMessage = fixture.offlineMsgCollector.getReceivedMessage(); + Message receiveMessage = IcqSlickFixture.offlineMsgCollector.getReceivedMessage(); assertNotNull("No Offline messages have been received", receiveMessage); assertEquals("message body", messageText, receiveMessage.getContent()); diff --git a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetFileTransferImpl.java b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetFileTransferImpl.java index c257f73..c1281fe 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetFileTransferImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetFileTransferImpl.java @@ -45,16 +45,18 @@ public class TestOperationSetFileTransferImpl super(name); } + @Override public Contact getContact1() { if(contact1 == null) { - contact1 = opSetPresence1.findContactByID(fixture.testerAgent.getIcqUIN()); + contact1 = opSetPresence1.findContactByID(IcqSlickFixture.testerAgent.getIcqUIN()); } return contact1; } + @Override public Contact getContact2() { if(contact2 == null) @@ -65,6 +67,7 @@ public class TestOperationSetFileTransferImpl return contact2; } + @Override public void start() throws Exception { @@ -81,7 +84,7 @@ public class TestOperationSetFileTransferImpl fixture.setUp(); // make sure tester agent is turned off - fixture.testerAgent.unregister(); + IcqSlickFixture.testerAgent.unregister(); Map<String, OperationSet> supportedOperationSets1 = fixture.provider.getSupportedOperationSets(); @@ -141,7 +144,7 @@ public class TestOperationSetFileTransferImpl bc.getService(serRefs[0]); // fisrt install the account - String USER_ID = fixture.testerAgent.getIcqUIN(); + String USER_ID = IcqSlickFixture.testerAgent.getIcqUIN(); final String PASSWORD = System.getProperty( IcqProtocolProviderSlick.TESTED_IMPL_PWD_PROP_NAME, null); Hashtable<String,String> props = new Hashtable<String,String>(); @@ -154,7 +157,7 @@ public class TestOperationSetFileTransferImpl catch (Exception e) // Exception if account exists {} - String secondProviderID = fixture.testerAgent.getIcqUIN(); + String secondProviderID = IcqSlickFixture.testerAgent.getIcqUIN(); //find the protocol provider service ServiceReference[] icqProviderRefs @@ -333,6 +336,7 @@ public class TestOperationSetFileTransferImpl providerFactory.uninstallAccount(secondProviderAccount); } + @Override public void stop() throws Exception { @@ -357,7 +361,7 @@ public class TestOperationSetFileTransferImpl try { opSetPresence1.setAuthorizationHandler(new AuthHandler()); - opSetPresence1.subscribe(fixture.testerAgent.getIcqUIN()); + opSetPresence1.subscribe(IcqSlickFixture.testerAgent.getIcqUIN()); } catch (OperationFailedException ex) { @@ -386,26 +390,31 @@ public class TestOperationSetFileTransferImpl } } + @Override public OperationSetFileTransfer getOpSetFilTransfer1() { return opSetFT1; } + @Override public OperationSetFileTransfer getOpSetFilTransfer2() { return opSetFT2; } + @Override public BundleContext getContext() { - return fixture.bc; + return IcqSlickFixture.bc; } + @Override public boolean enableTestSendAndReceive() { return true; } + @Override public boolean enableTestSenderCancelBeforeAccepted() { return true; @@ -417,16 +426,19 @@ public class TestOperationSetFileTransferImpl * Its canceled cause its the same event comming from the stack * as when while transfering one of the parties cancel the transfer. */ + @Override public boolean enableTestReceiverDecline() { return false; } + @Override public boolean enableTestReceiverCancelsWhileTransfering() { return true; } + @Override public boolean enableTestSenderCancelsWhileTransfering() { return true; 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 91f95fa..ffd9f30 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPersistentPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPersistentPresence.java @@ -70,6 +70,7 @@ public class TestOperationSetPersistentPresence return suite; } + @Override protected void setUp() throws Exception { super.setUp(); @@ -98,6 +99,7 @@ public class TestOperationSetPersistentPresence + "Operation Sets"); } + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -122,7 +124,7 @@ public class TestOperationSetPersistentPresence + "Printing rootGroupContents=\n"+rootGroup.toString()); Hashtable<String, List<String>> expectedContactList - = fixture.preInstalledBuddyList; + = IcqSlickFixture.preInstalledBuddyList; logger.debug("============== Expected Contact List ==================="); logger.debug(expectedContactList); @@ -220,7 +222,7 @@ public class TestOperationSetPersistentPresence group, ((SubscriptionEvent)evtCollector.collectedEvents.get(0)) .getParentGroup()); - Contact contact = group.getContact(fixture.testerAgent.getIcqUIN()); + Contact contact = group.getContact(IcqSlickFixture.testerAgent.getIcqUIN()); //make sure that the contact appears in the new group. assertNotNull("Couldn't find contact where we created it", contact); @@ -246,7 +248,7 @@ public class TestOperationSetPersistentPresence ContactGroup group = opSetPersPresence.getServerStoredContactListRoot() .getGroup(testGroupName); - Contact contact = group.getContact(fixture.testerAgent.getIcqUIN()); + Contact contact = group.getContact(IcqSlickFixture.testerAgent.getIcqUIN()); //register a subscription event listener SubscriptionEventCollector evtCollector @@ -274,7 +276,7 @@ public class TestOperationSetPersistentPresence group, ((SubscriptionEvent)evtCollector.collectedEvents.get(0)) .getParentGroup()); - contact = group.getContact(fixture.testerAgent.getIcqUIN()); + contact = group.getContact(IcqSlickFixture.testerAgent.getIcqUIN()); //make sure that the contact is not in the group any more. assertNull("A contact was still present after removing its " 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 059f059..7dc8539 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetPresence.java @@ -48,6 +48,7 @@ public class TestOperationSetPresence super(name); } + @Override protected void setUp() throws Exception { super.setUp(); @@ -78,6 +79,7 @@ public class TestOperationSetPresence } } + @Override protected void tearDown() throws Exception { super.tearDown(); @@ -262,14 +264,14 @@ public class TestOperationSetPresence //test event notification. statusEventCollector.waitForPresEvent(10000); statusEventCollector.waitForStatMsgEvent(10000); - - // sometimes we don't get response from the server for the - // changed status. we will query it once again. + + // sometimes we don't get response from the server for the + // changed status. we will query it once again. // and wait for the response if(statusEventCollector.collectedPresEvents.size() == 0) { logger.trace("Will query again status as we haven't received one"); - operationSetPresence.queryContactStatus(fixture.icqAccountID.getUserID()); + operationSetPresence.queryContactStatus(IcqSlickFixture.icqAccountID.getUserID()); statusEventCollector.waitForPresEvent(10000); } @@ -294,8 +296,8 @@ public class TestOperationSetPresence newStatus, operationSetPresence.getPresenceStatus()); - IcqStatusEnum actualStatus = fixture.testerAgent.getBuddyStatus( - fixture.icqAccountID.getUserID()); + IcqStatusEnum actualStatus = IcqSlickFixture.testerAgent.getBuddyStatus( + IcqSlickFixture.icqAccountID.getUserID()); assertEquals("The underlying implementation did not switch to the " +"requested presence status.", newStatus, @@ -414,7 +416,7 @@ public class TestOperationSetPresence PresenceStatus expectedReturn) throws Exception { - if ( !fixture.testerAgent.enterStatus(taStatusLong) ){ + if ( !IcqSlickFixture.testerAgent.enterStatus(taStatusLong) ){ throw new RuntimeException( "Tester UserAgent Failed to switch to the " + expectedReturn.getStatusName() + " state."); @@ -422,7 +424,7 @@ public class TestOperationSetPresence PresenceStatus actualReturn = operationSetPresence.queryContactStatus( - fixture.testerAgent.getIcqUIN()); + IcqSlickFixture.testerAgent.getIcqUIN()); assertEquals("Querying a " + expectedReturn.getStatusName() + " state did not return as expected" @@ -453,10 +455,10 @@ public class TestOperationSetPresence { authEventCollector.authorizationRequestReason = "Please deny my request!"; - fixture.testerAgent.getAuthCmdFactory().responseReasonStr = + IcqSlickFixture.testerAgent.getAuthCmdFactory().responseReasonStr = "First authorization I will Deny!!!"; - fixture.testerAgent.getAuthCmdFactory().ACCEPT = false; - operationSetPresence.subscribe(fixture.testerAgent.getIcqUIN()); + IcqSlickFixture.testerAgent.getAuthCmdFactory().ACCEPT = false; + operationSetPresence.subscribe(IcqSlickFixture.testerAgent.getIcqUIN()); // this one collects event that the buddy has been added // to the list as awaiting @@ -467,15 +469,15 @@ public class TestOperationSetPresence logger.debug("Waiting for authorization error and authorization response..."); authEventCollector.waitForAuthResponse(15000); assertTrue("Error adding buddy not recieved or the buddy(" + - fixture.testerAgent.getIcqUIN() + + IcqSlickFixture.testerAgent.getIcqUIN() + ") doesn't require authorization", authEventCollector.isAuthorizationRequestSent); assertNotNull("Agent haven't received any reason for authorization", - fixture.testerAgent.getAuthCmdFactory().requestReasonStr); + IcqSlickFixture.testerAgent.getAuthCmdFactory().requestReasonStr); assertEquals("Error sent request reason is not as the received one", authEventCollector.authorizationRequestReason, - fixture.testerAgent.getAuthCmdFactory().requestReasonStr + IcqSlickFixture.testerAgent.getAuthCmdFactory().requestReasonStr ); logger.debug("authEventCollector.isAuthorizationResponseReceived " + @@ -487,13 +489,13 @@ public class TestOperationSetPresence boolean isAcceptedAuthReuest = authEventCollector.response.getResponseCode().equals(AuthorizationResponse.ACCEPT); assertEquals("Response is not as the sent one", - fixture.testerAgent.getAuthCmdFactory().ACCEPT, + IcqSlickFixture.testerAgent.getAuthCmdFactory().ACCEPT, isAcceptedAuthReuest); assertNotNull("We didn't receive any reason! ", authEventCollector.authorizationResponseString); assertEquals("The sent response reason is not as the received one", - fixture.testerAgent.getAuthCmdFactory().responseReasonStr, + IcqSlickFixture.testerAgent.getAuthCmdFactory().responseReasonStr, authEventCollector.authorizationResponseString); // here we must wait for server to move the awaiting buddy @@ -505,7 +507,7 @@ public class TestOperationSetPresence } Contact c = operationSetPresence.findContactByID( - fixture.testerAgent.getIcqUIN()); + IcqSlickFixture.testerAgent.getIcqUIN()); logger.debug("I will remove " + c + " from group : " + c.getParentContactGroup()); @@ -527,9 +529,9 @@ public class TestOperationSetPresence // so we haven't asserted so everithing is fine lets try to be authorized authEventCollector.authorizationRequestReason = "Please accept my request!"; - fixture.testerAgent.getAuthCmdFactory().responseReasonStr = + IcqSlickFixture.testerAgent.getAuthCmdFactory().responseReasonStr = "Second authorization I will Accept!!!"; - fixture.testerAgent.getAuthCmdFactory().ACCEPT = true; + IcqSlickFixture.testerAgent.getAuthCmdFactory().ACCEPT = true; // clear some things authEventCollector.isAuthorizationRequestSent = false; @@ -537,29 +539,29 @@ public class TestOperationSetPresence authEventCollector.authorizationResponseString = null; logger.debug("I will add buddy does it exists ? " + - (operationSetPresence.findContactByID(fixture.testerAgent.getIcqUIN()) != null)); + (operationSetPresence.findContactByID(IcqSlickFixture.testerAgent.getIcqUIN()) != null)); // add the listener beacuse now our authorization will be accepted // and so the buddy will be finally added to the list operationSetPresence.addSubscriptionListener(subEvtCollector); // subscribe again so we can trigger again the authorization procedure - operationSetPresence.subscribe(fixture.testerAgent.getIcqUIN()); + operationSetPresence.subscribe(IcqSlickFixture.testerAgent.getIcqUIN()); logger.debug("Waiting ... Subscribe must fail and the authorization process " + "to be trigered again so waiting for auth response ..."); authEventCollector.waitForAuthResponse(15000); assertTrue("Error adding buddy not recieved or the buddy(" + - fixture.testerAgent.getIcqUIN() + + IcqSlickFixture.testerAgent.getIcqUIN() + ") doesn't require authorization", authEventCollector.isAuthorizationRequestSent); assertNotNull("Agent haven't received any reason for authorization", - fixture.testerAgent.getAuthCmdFactory().requestReasonStr); + IcqSlickFixture.testerAgent.getAuthCmdFactory().requestReasonStr); // not working for now assertEquals("Error sent request reason", authEventCollector.authorizationRequestReason, - fixture.testerAgent.getAuthCmdFactory().requestReasonStr + IcqSlickFixture.testerAgent.getAuthCmdFactory().requestReasonStr ); // wait for authorization process to be finnished @@ -580,13 +582,13 @@ public class TestOperationSetPresence // after adding awaitingAuthorization group here are catched 3 events // 1 - creating unresolved contact - // 2 - move of the contact to awaitingAuthorization group + // 2 - move of the contact to awaitingAuthorization group // 3 - move of the contact from awaitingAuthorization group to original group assertTrue("Subscription event dispatching failed." , subEvtCollector.collectedEvents.size() > 0); EventObject evt = null; - + Iterator<EventObject> events = subEvtCollector.collectedEvents.iterator(); while (events.hasNext()) @@ -594,9 +596,9 @@ public class TestOperationSetPresence EventObject elem = events.next(); if(elem instanceof SubscriptionEvent) { - if(((SubscriptionEvent)elem).getEventID() + if(((SubscriptionEvent)elem).getEventID() == SubscriptionEvent.SUBSCRIPTION_CREATED) - evt = (SubscriptionEvent)elem; + evt = elem; } } @@ -617,10 +619,10 @@ public class TestOperationSetPresence } assertEquals("SubscriptionEvent Source:", - fixture.testerAgent.getIcqUIN(), + IcqSlickFixture.testerAgent.getIcqUIN(), ((Contact)source).getAddress()); assertEquals("SubscriptionEvent Source Contact:", - fixture.testerAgent.getIcqUIN(), + IcqSlickFixture.testerAgent.getIcqUIN(), srcContact.getAddress()); assertSame("SubscriptionEvent Source Provider:", fixture.provider, @@ -632,7 +634,7 @@ public class TestOperationSetPresence // notified logger.debug("Testing presence notifications."); IcqStatusEnum testerAgentOldStatus - = fixture.testerAgent.getPresneceStatus(); + = IcqSlickFixture.testerAgent.getPresneceStatus(); IcqStatusEnum testerAgentNewStatus = IcqStatusEnum.FREE_FOR_CHAT; long testerAgentNewStatusLong = FullUserInfo.ICQSTATUS_FFC; @@ -646,12 +648,12 @@ public class TestOperationSetPresence //now do the actual status notification testing ContactPresenceEventCollector contactPresEvtCollector = new ContactPresenceEventCollector( - fixture.testerAgent.getIcqUIN(), testerAgentNewStatus); + IcqSlickFixture.testerAgent.getIcqUIN(), testerAgentNewStatus); operationSetPresence.addContactPresenceStatusListener( contactPresEvtCollector); synchronized (contactPresEvtCollector){ - if (!fixture.testerAgent.enterStatus(testerAgentNewStatusLong)) + if (!IcqSlickFixture.testerAgent.enterStatus(testerAgentNewStatusLong)) { throw new RuntimeException( "Tester UserAgent Failed to switch to the " @@ -665,14 +667,14 @@ public class TestOperationSetPresence if(contactPresEvtCollector.collectedEvents.size() == 0) { - logger.info("PROBLEM. Authorisation process doesn't have finnished " + + logger.info("PROBLEM. Authorisation process doesn't have finnished " + "Server doesn't report us for changing authorization flag! Will try to authorize once again"); - fixture.testerAgent.sendAuthorizationReplay( - fixture.icqAccountID.getUserID(), - fixture.testerAgent.getAuthCmdFactory().responseReasonStr, - fixture.testerAgent.getAuthCmdFactory().ACCEPT); - + IcqSlickFixture.testerAgent.sendAuthorizationReplay( + IcqSlickFixture.icqAccountID.getUserID(), + IcqSlickFixture.testerAgent.getAuthCmdFactory().responseReasonStr, + IcqSlickFixture.testerAgent.getAuthCmdFactory().ACCEPT); + Object obj = new Object(); synchronized(obj) { @@ -680,8 +682,8 @@ public class TestOperationSetPresence obj.wait(10000); logger.debug("Stop waiting!"); } - - testerAgentOldStatus = fixture.testerAgent.getPresneceStatus(); + + testerAgentOldStatus = IcqSlickFixture.testerAgent.getPresneceStatus(); testerAgentNewStatusLong = FullUserInfo.ICQSTATUS_FFC; //in case we are by any chance already in a FREE_FOR_CHAT status, we'll @@ -689,15 +691,15 @@ public class TestOperationSetPresence if(testerAgentOldStatus.equals(testerAgentNewStatus)){ testerAgentNewStatus = IcqStatusEnum.OCCUPIED; testerAgentNewStatusLong = FullUserInfo.ICQSTATUS_OCCUPIED; - } - + } + contactPresEvtCollector = new ContactPresenceEventCollector( - fixture.testerAgent.getIcqUIN(), testerAgentNewStatus); + IcqSlickFixture.testerAgent.getIcqUIN(), testerAgentNewStatus); operationSetPresence.addContactPresenceStatusListener( contactPresEvtCollector); synchronized (contactPresEvtCollector){ - if (!fixture.testerAgent.enterStatus(testerAgentNewStatusLong)) + if (!IcqSlickFixture.testerAgent.enterStatus(testerAgentNewStatusLong)) { throw new RuntimeException( "Tester UserAgent Failed to switch to the " @@ -710,7 +712,7 @@ public class TestOperationSetPresence } } - + assertEquals("Presence Notif. event dispatching failed." , 1, contactPresEvtCollector.collectedEvents.size()); ContactPresenceStatusChangeEvent presEvt = @@ -718,10 +720,10 @@ public class TestOperationSetPresence contactPresEvtCollector.collectedEvents.get(0); assertEquals("Presence Notif. event Source:", - fixture.testerAgent.getIcqUIN(), + IcqSlickFixture.testerAgent.getIcqUIN(), ((Contact)presEvt.getSource()).getAddress()); assertEquals("Presence Notif. event Source Contact:", - fixture.testerAgent.getIcqUIN(), + IcqSlickFixture.testerAgent.getIcqUIN(), presEvt.getSourceContact().getAddress()); assertSame("Presence Notif. event Source Provider:", fixture.provider, @@ -740,7 +742,7 @@ public class TestOperationSetPresence /** @todo tester agent changes status message we see the new message */ /** @todo we should see the alias of the tester agent. */ - + Object obj = new Object(); synchronized(obj) { @@ -768,7 +770,7 @@ public class TestOperationSetPresence operationSetPresence.addSubscriptionListener(subEvtCollector); Contact icqTesterAgentContact = operationSetPresence - .findContactByID(fixture.testerAgent.getIcqUIN()); + .findContactByID(IcqSlickFixture.testerAgent.getIcqUIN()); assertNotNull( "Failed to find an existing subscription for the tester agent" @@ -803,7 +805,7 @@ public class TestOperationSetPresence // get notifications as we're now unsubscribed. logger.debug("Testing (lack of) presence notifications."); IcqStatusEnum testerAgentOldStatus - = fixture.testerAgent.getPresneceStatus(); + = IcqSlickFixture.testerAgent.getPresneceStatus(); IcqStatusEnum testerAgentNewStatus = IcqStatusEnum.FREE_FOR_CHAT; long testerAgentNewStatusLong = FullUserInfo.ICQSTATUS_FFC; @@ -818,13 +820,13 @@ public class TestOperationSetPresence //now do the actual status notification testing ContactPresenceEventCollector contactPresEvtCollector = new ContactPresenceEventCollector( - fixture.testerAgent.getIcqUIN(), null); + IcqSlickFixture.testerAgent.getIcqUIN(), null); operationSetPresence.addContactPresenceStatusListener( contactPresEvtCollector); synchronized (contactPresEvtCollector) { - if (!fixture.testerAgent.enterStatus(testerAgentNewStatusLong)) + if (!IcqSlickFixture.testerAgent.enterStatus(testerAgentNewStatusLong)) { throw new RuntimeException( "Tester UserAgent Failed to switch to the " @@ -1277,6 +1279,7 @@ public class TestOperationSetPresence } } + @Override public void subscriptionRemoved(SubscriptionEvent evt) { synchronized(this) @@ -1303,14 +1306,14 @@ public class TestOperationSetPresence logger.debug("authEventCollector " + authEventCollector); authEventCollector.isAuthorizationRequestReceived = false; authEventCollector.authorizationRequestReason = null; - fixture.testerAgent.getAuthCmdFactory().requestReasonStr = "Deny my first request!"; - fixture.testerAgent.getAuthCmdFactory().isErrorAddingReceived = false; - fixture.testerAgent.getAuthCmdFactory().responseReasonStr = null; - fixture.testerAgent.getAuthCmdFactory().isRequestAccepted = false; + IcqSlickFixture.testerAgent.getAuthCmdFactory().requestReasonStr = "Deny my first request!"; + IcqSlickFixture.testerAgent.getAuthCmdFactory().isErrorAddingReceived = false; + IcqSlickFixture.testerAgent.getAuthCmdFactory().responseReasonStr = null; + IcqSlickFixture.testerAgent.getAuthCmdFactory().isRequestAccepted = false; // be sure buddy is not already in the list - fixture.testerAgent.deleteBuddy(fixture.ourUserID); - fixture.testerAgent.addBuddy(fixture.ourUserID); + IcqSlickFixture.testerAgent.deleteBuddy(fixture.ourUserID); + IcqSlickFixture.testerAgent.addBuddy(fixture.ourUserID); // wait agent to receive error and to request us for our authorization authEventCollector.waitForAuthRequest(25000); @@ -1319,7 +1322,7 @@ public class TestOperationSetPresence assertTrue("Error adding buddy not recieved or the buddy(" + fixture.ourUserID + ") doesn't require authorization 1", - fixture.testerAgent.getAuthCmdFactory().isErrorAddingReceived); + IcqSlickFixture.testerAgent.getAuthCmdFactory().isErrorAddingReceived); assertTrue("We haven't received any authorization request ", authEventCollector.isAuthorizationRequestReceived); @@ -1328,7 +1331,7 @@ public class TestOperationSetPresence authEventCollector.authorizationRequestReason); assertEquals("Error sent request reason is not as the received one", - fixture.testerAgent.getAuthCmdFactory().requestReasonStr, + IcqSlickFixture.testerAgent.getAuthCmdFactory().requestReasonStr, authEventCollector.authorizationRequestReason ); @@ -1348,18 +1351,18 @@ public class TestOperationSetPresence authEventCollector.authorizationRequestReason); assertEquals("Received auth response from agent is not as the sent one", - fixture.testerAgent.getAuthCmdFactory().responseReasonStr, + IcqSlickFixture.testerAgent.getAuthCmdFactory().responseReasonStr, firstRequestResponse); boolean isAcceptedAuthReuest = authEventCollector.responseToRequest.getResponseCode().equals(AuthorizationResponse.ACCEPT); assertEquals("Agent received Response is not as the sent one", - fixture.testerAgent.getAuthCmdFactory().isRequestAccepted, + IcqSlickFixture.testerAgent.getAuthCmdFactory().isRequestAccepted, isAcceptedAuthReuest); // delete us from his list // be sure buddy is not already in the list - fixture.testerAgent.deleteBuddy(fixture.ourUserID); + IcqSlickFixture.testerAgent.deleteBuddy(fixture.ourUserID); // set second response isAccepted and responseString // the second test is the same as first, but this time we accept @@ -1369,13 +1372,13 @@ public class TestOperationSetPresence new AuthorizationResponse(AuthorizationResponse.ACCEPT, secondRequestResponse); authEventCollector.isAuthorizationRequestReceived = false; authEventCollector.authorizationRequestReason = null; - fixture.testerAgent.getAuthCmdFactory().requestReasonStr = "Accept my second request!"; - fixture.testerAgent.getAuthCmdFactory().isErrorAddingReceived = false; - fixture.testerAgent.getAuthCmdFactory().responseReasonStr = null; - fixture.testerAgent.getAuthCmdFactory().isRequestAccepted = false; + IcqSlickFixture.testerAgent.getAuthCmdFactory().requestReasonStr = "Accept my second request!"; + IcqSlickFixture.testerAgent.getAuthCmdFactory().isErrorAddingReceived = false; + IcqSlickFixture.testerAgent.getAuthCmdFactory().responseReasonStr = null; + IcqSlickFixture.testerAgent.getAuthCmdFactory().isRequestAccepted = false; // add us to his list again - fixture.testerAgent.addBuddy(fixture.ourUserID); + IcqSlickFixture.testerAgent.addBuddy(fixture.ourUserID); // wait agent to receive error and to request us for our authorization authEventCollector.waitForAuthRequest(25000); @@ -1384,7 +1387,7 @@ public class TestOperationSetPresence assertTrue("Error adding buddy not recieved or the buddy(" + fixture.ourUserID + ") doesn't require authorization 2", - fixture.testerAgent.getAuthCmdFactory().isErrorAddingReceived); + IcqSlickFixture.testerAgent.getAuthCmdFactory().isErrorAddingReceived); assertTrue("We haven't received any authorization request ", authEventCollector.isAuthorizationRequestReceived); @@ -1393,7 +1396,7 @@ public class TestOperationSetPresence authEventCollector.authorizationRequestReason); assertEquals("Error sent request reason is not as the received one", - fixture.testerAgent.getAuthCmdFactory().requestReasonStr, + IcqSlickFixture.testerAgent.getAuthCmdFactory().requestReasonStr, authEventCollector.authorizationRequestReason ); // wait agent to receive our response @@ -1409,13 +1412,13 @@ public class TestOperationSetPresence authEventCollector.authorizationRequestReason); assertEquals("Received auth response from agent is not as the sent one", - fixture.testerAgent.getAuthCmdFactory().responseReasonStr, + IcqSlickFixture.testerAgent.getAuthCmdFactory().responseReasonStr, secondRequestResponse); isAcceptedAuthReuest = authEventCollector.responseToRequest.getResponseCode().equals(AuthorizationResponse.ACCEPT); assertEquals("Agent received Response is not as the sent one", - fixture.testerAgent.getAuthCmdFactory().isRequestAccepted, + IcqSlickFixture.testerAgent.getAuthCmdFactory().isRequestAccepted, isAcceptedAuthReuest); } } 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 33b73a4..6e6ff3f 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetServerStoredInfo.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetServerStoredInfo.java @@ -43,6 +43,7 @@ public class TestOperationSetServerStoredInfo * Get a reference to the contact and account info operation sets. * @throws Exception if this is not a good day. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -94,6 +95,7 @@ public class TestOperationSetServerStoredInfo } } + @Override protected void tearDown() throws Exception { super.tearDown(); @@ -135,7 +137,7 @@ public class TestOperationSetServerStoredInfo int suffix = (int)(Math.random()*100); String lastName = "TesterAgent" + String.valueOf(suffix); - fixture.testerAgent.setUserInfoLastName(lastName); + IcqSlickFixture.testerAgent.setUserInfoLastName(lastName); // give the server time to change things synchronized(lock) @@ -147,7 +149,7 @@ public class TestOperationSetServerStoredInfo // make the phonenumber also random String phoneNumber = "+3591234" + suffix; - fixture.testerAgent.setUserInfoPhoneNumber(phoneNumber); + IcqSlickFixture.testerAgent.setUserInfoPhoneNumber(phoneNumber); // give the server time to change things synchronized(lock) @@ -164,7 +166,7 @@ public class TestOperationSetServerStoredInfo int lang3 = 1 + (int)(Math.random() * 72); // setting this languages as spoken languages - fixture.testerAgent.setUserInfoLanguage(lang1, lang2, lang3); + IcqSlickFixture.testerAgent.setUserInfoLanguage(lang1, lang2, lang3); // give the server time to change things synchronized(lock) @@ -179,7 +181,7 @@ public class TestOperationSetServerStoredInfo int countryRandom = 0 + (int)(Math.random() * 232); int countryCode = ((Integer)countryIndexToLocaleString[countryRandom][0]).intValue(); String countryAbr = (String)countryIndexToLocaleString[countryRandom][1]; - fixture.testerAgent.setUserInfoHomeCountry(countryCode); + IcqSlickFixture.testerAgent.setUserInfoHomeCountry(countryCode); // give the server time to change things synchronized(lock) @@ -190,7 +192,7 @@ public class TestOperationSetServerStoredInfo } Contact testerAgentContact - = opSetPresence.findContactByID(fixture.testerAgent.getIcqUIN()); + = opSetPresence.findContactByID(IcqSlickFixture.testerAgent.getIcqUIN()); // Get the last name info Iterator<GenericDetail> iter = @@ -489,7 +491,7 @@ public class TestOperationSetServerStoredInfo logger.trace("Proceeding to Testing values!"); // make the tests here - Hashtable<String, Object> userInfo = fixture.testerAgent.getUserInfo(fixture.ourUserID); + Hashtable<String, Object> userInfo = IcqSlickFixture.testerAgent.getUserInfo(fixture.ourUserID); assertEquals("The LastName we set is not set or not read properly" , newLastName 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 bb9ceec..0897ac2 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetTypingNotifications.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestOperationSetTypingNotifications.java @@ -37,6 +37,7 @@ public class TestOperationSetTypingNotifications super(name); } + @Override protected void setUp() throws Exception { super.setUp(); @@ -79,6 +80,7 @@ public class TestOperationSetTypingNotifications } + @Override protected void tearDown() throws Exception { super.tearDown(); @@ -120,7 +122,7 @@ public class TestOperationSetTypingNotifications opSetTypingNotifs.addTypingNotificationsListener(evtCollector); - fixture.testerAgent.sendTypingNotification( + IcqSlickFixture.testerAgent.sendTypingNotification( fixture.ourUserID, TypingState.TYPING); evtCollector.waitForEvent(10000); @@ -135,7 +137,7 @@ public class TestOperationSetTypingNotifications .collectedEvents.get(0); assertEquals("Source of the typing notification event" - , fixture.testerAgent.getIcqUIN() + , IcqSlickFixture.testerAgent.getIcqUIN() , evt.getSourceContact().getAddress() ); assertEquals("Source of the typing notification event" @@ -155,15 +157,15 @@ public class TestOperationSetTypingNotifications = new JoustSimTypingEventCollector(); Contact contactToNotify = opSetPresence.findContactByID( - fixture.testerAgent.getIcqUIN()); + IcqSlickFixture.testerAgent.getIcqUIN()); - fixture.testerAgent.addTypingStateInfoListenerForBuddy( + IcqSlickFixture.testerAgent.addTypingStateInfoListenerForBuddy( contactToNotify.getAddress(), evtCollector); opSetTypingNotifs.sendTypingNotification( contactToNotify, OperationSetTypingNotifications.STATE_TYPING); - fixture.testerAgent.removeTypingStateInfoListenerForBuddy( + IcqSlickFixture.testerAgent.removeTypingStateInfoListenerForBuddy( contactToNotify.getAddress(), evtCollector); } 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 6c37916..7723687 100644 --- a/test/net/java/sip/communicator/slick/protocol/icq/TestProtocolProviderServiceIcqImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/icq/TestProtocolProviderServiceIcqImpl.java @@ -63,6 +63,7 @@ public class TestProtocolProviderServiceIcqImpl extends TestCase * Initializes the fixture. * @throws Exception if super.setUp() throws one. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -73,6 +74,7 @@ public class TestProtocolProviderServiceIcqImpl extends TestCase * Tears the fixture down. * @throws Exception if fixture.tearDown() fails. */ + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -148,7 +150,7 @@ public class TestProtocolProviderServiceIcqImpl extends TestCase // in TestOperationSetBasicInstantMessaging.testReceiveOfflineMessages() OperationSetBasicInstantMessaging opSetBasicIM = fixture.provider.getOperationSet(OperationSetBasicInstantMessaging.class); - fixture.offlineMsgCollector.register(opSetBasicIM); + IcqSlickFixture.offlineMsgCollector.register(opSetBasicIM); //give time for the AIM server to notify everyone of our arrival //simply waitinf is really not a reliable way of doing things but I @@ -168,7 +170,7 @@ public class TestProtocolProviderServiceIcqImpl extends TestCase assertTrue( "The tested ICQ implementation on-line status was OFFLINE", !IcqStatusEnum.OFFLINE.equals( - fixture.testerAgent.getBuddyStatus(fixture.ourUserID)) + IcqSlickFixture.testerAgent.getBuddyStatus(fixture.ourUserID)) ); //make sure that the registration process trigerred the corresponding @@ -192,7 +194,7 @@ public class TestProtocolProviderServiceIcqImpl extends TestCase public void testIsRegistered() { if (!IcqStatusEnum.OFFLINE.equals( - fixture.testerAgent.getBuddyStatus(fixture.ourUserID))) + IcqSlickFixture.testerAgent.getBuddyStatus(fixture.ourUserID))) assertTrue( "provider.isRegistered() returned false while registered" ,fixture.provider.isRegistered()); @@ -211,7 +213,7 @@ public class TestProtocolProviderServiceIcqImpl extends TestCase public void testGetRegistrationState() { if (!IcqStatusEnum.OFFLINE.equals( - fixture.testerAgent.getBuddyStatus(fixture.ourUserID))) + IcqSlickFixture.testerAgent.getBuddyStatus(fixture.ourUserID))) assertEquals( "a provider was not in a REGISTERED state while registered." ,RegistrationState.REGISTERED @@ -343,18 +345,18 @@ public class TestProtocolProviderServiceIcqImpl extends TestCase /** * Sets the userNameEditable property, which should indicate if the * user name could be changed by user or not. - * + * * @param isUserNameEditable indicates if the user name could be changed */ public void setUserNameEditable(boolean isUserNameEditable) { this.isUserNameEditable = isUserNameEditable; } - + /** * Indicates if the user name is currently editable, i.e. could be changed * by user or not. - * + * * @return <code>true</code> if the user name could be changed, * <code>false</code> - otherwise. */ diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/JabberProtocolProviderServiceLick.java b/test/net/java/sip/communicator/slick/protocol/jabber/JabberProtocolProviderServiceLick.java index 59cdadf..f87a82e 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/JabberProtocolProviderServiceLick.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/JabberProtocolProviderServiceLick.java @@ -36,7 +36,7 @@ public class JabberProtocolProviderServiceLick */ public static final String ACCOUNT_2_PREFIX = "accounts.jabber.account2."; - + /** * The prefix used for property names containing settings for our third * testing account. @@ -102,7 +102,7 @@ public class JabberProtocolProviderServiceLick addTest(TestOperationSetBasicInstantMessaging.suite()); addTest(TestOperationSetInstantMessageTransformJabberImpl.suite()); - + addTest(TestOperationSetTypingNotifications.suite()); //tests currently fails due to jingle lib bugs. 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 431df22..32f3377 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/JabberSlickFixture.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/JabberSlickFixture.java @@ -58,7 +58,7 @@ public class JabberSlickFixture * The user ID associated with testing account 2. */ public String userID2 = null; - + /** * An osgi service reference for the protocol provider corresponding to our * third testing account. @@ -117,6 +117,7 @@ public class JabberSlickFixture * @throws java.lang.Exception in case we meet problems while retrieving * protocol providers through OSGI */ + @Override public void setUp() throws Exception { @@ -149,7 +150,7 @@ public class JabberSlickFixture = System.getProperty( JabberProtocolProviderServiceLick.ACCOUNT_2_PREFIX + ProtocolProviderFactory.USER_ID); - + userID3 = System.getProperty( JabberProtocolProviderServiceLick.ACCOUNT_3_PREFIX @@ -189,7 +190,7 @@ public class JabberSlickFixture + userID2, jabberProvider2Refs); assertTrue("No Protocol Provider was found for Jabber account2:"+ userID2, jabberProvider2Refs.length > 0); - + ServiceReference[] jabberProvider3Refs = bc.getServiceReferences( ProtocolProviderService.class.getName(), @@ -202,16 +203,16 @@ public class JabberSlickFixture //again make sure we found a service. assertNotNull("No Protocol Provider was found for Jabber account3:" + userID3, jabberProvider3Refs); - assertTrue("No Protocol Provider was found for Jabber account3:"+ + assertTrue("No Protocol Provider was found for Jabber account3:"+ userID3, jabberProvider3Refs.length > 0); //save the service for other tests to use. provider1ServiceRef = jabberProvider1Refs[0]; provider1 = (ProtocolProviderService)bc.getService(provider1ServiceRef); - + provider2ServiceRef = jabberProvider2Refs[0]; provider2 = (ProtocolProviderService)bc.getService(provider2ServiceRef); - + provider3ServiceRef = jabberProvider3Refs[0]; provider3 = (ProtocolProviderService)bc.getService(provider3ServiceRef); } @@ -219,6 +220,7 @@ public class JabberSlickFixture /** * Un get service references used in here. */ + @Override public void tearDown() { bc.ungetService(provider1ServiceRef); @@ -263,7 +265,7 @@ public class JabberSlickFixture /** * Clears all the providers of this fixture. - * + * * @throws Exception */ public void clearProvidersLists() @@ -273,20 +275,20 @@ public class JabberSlickFixture clearProvider(provider2); clearProvider(provider3); } - - + + /** * Clears the given <tt>provider</tt>. It means delete existing contacts, * existing groups. - * + * * @param provider * @throws IllegalArgumentException * @throws IllegalStateException * @throws OperationFailedException */ - public void clearProvider(ProtocolProviderService provider) - throws IllegalArgumentException, - IllegalStateException, + public void clearProvider(ProtocolProviderService provider) + throws IllegalArgumentException, + IllegalStateException, OperationFailedException { Map<String, OperationSet> supportedOperationSets = @@ -310,25 +312,25 @@ public class JabberSlickFixture "An implementation of the Jabber service must provide an " + "implementation of at least the one of the Presence " + "Operation Sets"); - + deleteGroups(opSetPersPresence); } - - + + /** * Delete all groups and contacts for the given persistent presence op. set. - * + * * @param opSetPersPresence * @throws IllegalArgumentException * @throws IllegalStateException * @throws OperationFailedException */ - public void deleteGroups(OperationSetPersistentPresence opSetPersPresence) - throws IllegalArgumentException, - IllegalStateException, + public void deleteGroups(OperationSetPersistentPresence opSetPersPresence) + throws IllegalArgumentException, + IllegalStateException, OperationFailedException { - ContactGroup rootGroup = + ContactGroup rootGroup = opSetPersPresence.getServerStoredContactListRoot(); // first delete the groups diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/TestAccountInstallation.java b/test/net/java/sip/communicator/slick/protocol/jabber/TestAccountInstallation.java index dda7121..cc0134c 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestAccountInstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestAccountInstallation.java @@ -37,6 +37,7 @@ public class TestAccountInstallation * JUnit setup method. * @throws Exception in case anything goes wrong. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -46,6 +47,7 @@ public class TestAccountInstallation * JUnit teardown method. * @throws Exception in case anything goes wrong. */ + @Override protected void tearDown() throws Exception { super.tearDown(); diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/TestAccountUninstallation.java b/test/net/java/sip/communicator/slick/protocol/jabber/TestAccountUninstallation.java index db36592..bae84bd 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestAccountUninstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestAccountUninstallation.java @@ -38,6 +38,7 @@ public class TestAccountUninstallation * JUnit setup method. * @throws Exception in case anything goes wrong. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -48,6 +49,7 @@ public class TestAccountUninstallation * JUnit teardown method. * @throws Exception in case anything goes wrong. */ + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -107,7 +109,7 @@ public class TestAccountUninstallation ServiceReference[] jabberProviderRefs = null; try { - jabberProviderRefs = fixture.bc.getServiceReferences( + jabberProviderRefs = JabberSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(&" + "(" + ProtocolProviderFactory.PROTOCOL @@ -138,7 +140,7 @@ public class TestAccountUninstallation == null); //Now reinstall the bundle - providerBundle = fixture.bc.installBundle(providerBundle.getLocation()); + providerBundle = JabberSlickFixture.bc.installBundle(providerBundle.getLocation()); //set the global providerBundle reference that we will be using //in the last series of tests (Account uninstallation persistency) @@ -156,7 +158,7 @@ public class TestAccountUninstallation //verify that the provider is no longer available try { - jabberProviderRefs = fixture.bc.getServiceReferences( + jabberProviderRefs = JabberSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(&" + "(" + ProtocolProviderFactory.PROTOCOL @@ -178,7 +180,7 @@ public class TestAccountUninstallation ServiceReference[] jabberFactoryRefs = null; try { - jabberFactoryRefs = fixture.bc.getServiceReferences( + jabberFactoryRefs = JabberSlickFixture.bc.getServiceReferences( ProtocolProviderFactory.class.getName(), "(" + ProtocolProviderFactory.PROTOCOL + "=" +ProtocolNames.JABBER + ")"); @@ -191,9 +193,9 @@ public class TestAccountUninstallation //we're the ones who've reinstalled the factory so it's our //responsibility to update the fixture. fixture.providerFactory - = (ProtocolProviderFactory)fixture.bc.getService(jabberFactoryRefs[0]); + = (ProtocolProviderFactory)JabberSlickFixture.bc.getService(jabberFactoryRefs[0]); fixture.provider1 - = (ProtocolProviderService)fixture.bc.getService(jabberProviderRefs[0]); + = (ProtocolProviderService)JabberSlickFixture.bc.getService(jabberProviderRefs[0]); //verify that the provider is also restored in the provider factory @@ -242,7 +244,7 @@ public class TestAccountUninstallation ServiceReference[] jabberProviderRefs = null; try { - jabberProviderRefs = fixture.bc.getServiceReferences( + jabberProviderRefs = JabberSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(" + ProtocolProviderFactory.PROTOCOL + "=" +ProtocolNames.JABBER + ")"); 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 8eff7bf..eb8970f 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetBasicInstantMessaging.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetBasicInstantMessaging.java @@ -44,6 +44,7 @@ public class TestOperationSetBasicInstantMessaging * Get a reference to the basic IM operation set. * @throws Exception if this is not a good day. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -116,6 +117,7 @@ public class TestOperationSetBasicInstantMessaging } + @Override protected void tearDown() throws Exception { super.tearDown(); @@ -255,25 +257,25 @@ public class TestOperationSetBasicInstantMessaging ContactGroup rootGroup1 = ((OperationSetPersistentPresence)opSetPresence1). getServerStoredContactListRoot(); - + logger.debug("=========== Server Stored Contact List 1 ================="); logger.debug("rootGroup="+rootGroup1.getGroupName() +" rootGroup.childContacts="+rootGroup1.countContacts() + "rootGroup.childGroups="+rootGroup1.countSubgroups() + "Printing rootGroupContents=\n"+rootGroup1.toString()); - + ContactGroup rootGroup2 = ((OperationSetPersistentPresence)opSetPresence2). getServerStoredContactListRoot(); - + logger.debug("=========== Server Stored Contact List 2 ================="); logger.debug("rootGroup="+rootGroup2.getGroupName() +" rootGroup.childContacts="+rootGroup2.countContacts() + "rootGroup.childGroups="+rootGroup2.countSubgroups() + "Printing rootGroupContents=\n"+rootGroup2.toString()); - + String body = "This is an IM coming from the tested implementation" + " on " + new Date().toString(); @@ -321,12 +323,12 @@ public class TestOperationSetBasicInstantMessaging //verify that the message has successfully arived at the destination assertTrue( "No messages received by the tester agent" , imEvtCollector2.collectedEvents.size() > 0); - - - assertFalse( "Message was unable to deliver !", - imEvtCollector2.collectedEvents.get(0) + + + assertFalse( "Message was unable to deliver !", + imEvtCollector2.collectedEvents.get(0) instanceof MessageDeliveryFailedEvent); - + String receivedBody = ((MessageReceivedEvent)imEvtCollector2.collectedEvents .get(0)).getSourceMessage().getContent(); diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetBasicTelephonyJabberImpl.java b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetBasicTelephonyJabberImpl.java index c7dd668..9d7481a 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetBasicTelephonyJabberImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetBasicTelephonyJabberImpl.java @@ -45,6 +45,7 @@ public class TestOperationSetBasicTelephonyJabberImpl * JUnit setup method. * @throws Exception in case anything goes wrong. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -55,6 +56,7 @@ public class TestOperationSetBasicTelephonyJabberImpl * JUnit teardown method. * @throws Exception in case anything goes wrong. */ + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -881,6 +883,7 @@ public class TestOperationSetBasicTelephonyJabberImpl * * @param event the event containing the source call. */ + @Override public void peerStateChanged(CallPeerChangeEvent event) { synchronized(this) @@ -1004,6 +1007,7 @@ public class TestOperationSetBasicTelephonyJabberImpl * * @param event the event containing the source call. */ + @Override public void callStateChanged(CallChangeEvent event) { synchronized(this) diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetFileTransferImpl.java b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetFileTransferImpl.java index 84ff049..a361996 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetFileTransferImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetFileTransferImpl.java @@ -35,6 +35,7 @@ public class TestOperationSetFileTransferImpl private static Contact contact1 = null; private static Contact contact2 = null; + @Override public Contact getContact1() { if(contact1 == null) @@ -45,6 +46,7 @@ public class TestOperationSetFileTransferImpl return contact1; } + @Override public Contact getContact2() { if(contact2 == null) @@ -55,6 +57,7 @@ public class TestOperationSetFileTransferImpl return contact2; } + @Override public void start() throws Exception { @@ -130,6 +133,7 @@ public class TestOperationSetFileTransferImpl prepareContactList(); } + @Override public void stop() throws Exception { @@ -188,21 +192,25 @@ public class TestOperationSetFileTransferImpl } } + @Override public OperationSetFileTransfer getOpSetFilTransfer1() { return opSetFT1; } + @Override public OperationSetFileTransfer getOpSetFilTransfer2() { return opSetFT2; } + @Override public BundleContext getContext() { - return fixture.bc; + return JabberSlickFixture.bc; } + @Override public boolean enableTestSendAndReceive() { return true; @@ -212,11 +220,13 @@ public class TestOperationSetFileTransferImpl * Its not implemented and its not available in jabber. * @return */ + @Override public boolean enableTestSenderCancelBeforeAccepted() { return false; } + @Override public boolean enableTestReceiverDecline() { return true; @@ -227,11 +237,13 @@ public class TestOperationSetFileTransferImpl * canceled. * @return */ + @Override public boolean enableTestReceiverCancelsWhileTransfering() { return false; } + @Override public boolean enableTestSenderCancelsWhileTransfering() { return true; diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetInstantMessageTransformJabberImpl.java b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetInstantMessageTransformJabberImpl.java index 3ec9aee..7af7743 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetInstantMessageTransformJabberImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetInstantMessageTransformJabberImpl.java @@ -35,6 +35,7 @@ public class TestOperationSetInstantMessageTransformJabberImpl super(name); } + @Override protected void setUp() throws Exception { super.setUp(); @@ -130,6 +131,7 @@ public class TestOperationSetInstantMessageTransformJabberImpl } + @Override protected void tearDown() throws Exception { super.tearDown(); 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 649e570..25dd1fe 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetMultiUserChat.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetMultiUserChat.java @@ -91,6 +91,7 @@ public class TestOperationSetMultiUserChat * JUnit setup method. * @throws Exception in case anything goes wrong. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -168,6 +169,7 @@ public class TestOperationSetMultiUserChat * * @throws Exception in case anything goes wrong. */ + @Override protected void tearDown() throws Exception { super.tearDown(); diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetMultiUserChat2.java b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetMultiUserChat2.java index 4d5fcc6..69963d6 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetMultiUserChat2.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetMultiUserChat2.java @@ -136,7 +136,7 @@ public class TestOperationSetMultiUserChat2 "An implementation of the service must provide an " + "implementation of at least one of the PresenceOperationSets"); } - + Map<String, OperationSet> supportedOperationSets3 = fixture.provider3.getSupportedOperationSets(); @@ -214,7 +214,7 @@ public class TestOperationSetMultiUserChat2 { // the contact already exist its OK } - + try { opSetPresence2.subscribe(fixture.userID1); @@ -223,7 +223,7 @@ public class TestOperationSetMultiUserChat2 { // the contact already exist its OK } - + try { opSetPresence2.subscribe(fixture.userID3); @@ -232,7 +232,7 @@ public class TestOperationSetMultiUserChat2 { // the contact already exist its OK } - + try { opSetPresence3.subscribe(fixture.userID1); @@ -250,7 +250,7 @@ public class TestOperationSetMultiUserChat2 { // the contact already exist its OK } - + logger.info("will wait till the list prepare is completed"); synchronized (o) { @@ -326,50 +326,50 @@ public class TestOperationSetMultiUserChat2 suite.addTest( new TestOperationSetMultiUserChat2("testMemberKick")); - - /* + + /* * Unit tests who belong to users role functionalities are orderly added - * below. They are added in a specific order which match a predefined - * scenario. It's not recommended to change this order, some tests may + * below. They are added in a specific order which match a predefined + * scenario. It's not recommended to change this order, some tests may * then fail. - * + * * Please note: * - when the room is created, participants are considered (by default) * as members (not guests). * - in this test suite, the room will use three participants. - * + * * Scenario: * - testInitialParticipantsRoles: verify participants role in the newly * created room. - * - testRevokeMembership: administrator/owner of the room revokes + * - testRevokeMembership: administrator/owner of the room revokes * membership to a participant of the room. - * - testGrantMembership: administrator/owner of the room grants - * membership to the participant of the room who just loses it in the + * - testGrantMembership: administrator/owner of the room grants + * membership to the participant of the room who just loses it in the * previous test. - * - testGrantModerator: administrator/owner of the room grants + * - testGrantModerator: administrator/owner of the room grants * moderator rights to a participant of the room. * - testRevokeVoice: the new moderator of the room (previous test) will * revoke voice right to the remaining guest, who will become a silent - * member (the room currently includes the administrator/owner, the - * moderator from the previous test, and it remains a participant). - * - testGrantVoice: moderator will grant voice the user he previously + * member (the room currently includes the administrator/owner, the + * moderator from the previous test, and it remains a participant). + * - testGrantVoice: moderator will grant voice the user he previously * revokes voice right. - * - testRevokeModerator: moderator of the room will have his rights + * - testRevokeModerator: moderator of the room will have his rights * revoked by the owner/admin of the room. * - testGrantAdmin: owner/admin of the room grants administrator rights * to the revoked-moderator (previous test). * - testGrantOwnership: owner/admin of the room grants the new admin as * co-owner of the room. - * - testRevokeOwnership: owner/admin of the room revokes ownership to + * - testRevokeOwnership: owner/admin of the room revokes ownership to * his co-owner (granted in previous test). - * - testRevokeAdmin: after having been ownership-revoked, the - * considered member is supposed to be an administrator: here his + * - testRevokeAdmin: after having been ownership-revoked, the + * considered member is supposed to be an administrator: here his * administrative rights are revoked by owner/admin of the room. - * + * */ suite.addTest( new TestOperationSetMultiUserChat2("testInitialParticipantsRoles")); - + //suite.addTest( // new TestOperationSetMultiUserChat2("testRevokeMembership")); @@ -381,19 +381,19 @@ public class TestOperationSetMultiUserChat2 suite.addTest(new TestOperationSetMultiUserChat2("testRevokeVoice")); suite.addTest(new TestOperationSetMultiUserChat2("testGrantVoice")); - + suite.addTest( new TestOperationSetMultiUserChat2("testRevokeModerator")); - + // suite.addTest(new TestOperationSetMultiUserChat2("testGrantAdmin")); -// +// // suite.addTest(new TestOperationSetMultiUserChat2("testGrantOwnership")); // // suite.addTest( // new TestOperationSetMultiUserChat2("testRevokeOwnership")); -// +// // suite.addTest(new TestOperationSetMultiUserChat2("testRevokeAdmin")); - + return suite; } @@ -590,8 +590,8 @@ public class TestOperationSetMultiUserChat2 ChatRoomInvitation invitation = invitationReceivedEvent.getInvitation(); - assertEquals("The inviter is not the expected user", - StringUtils.parseBareAddress(fixture.userID1), + assertEquals("The inviter is not the expected user", + StringUtils.parseBareAddress(fixture.userID1), StringUtils.parseBareAddress(invitation.getInviter())); assertEquals("The invitation reason received differs from the one sent" @@ -613,7 +613,7 @@ public class TestOperationSetMultiUserChat2 opSet1Collector.collectedEvents.get(0); assertEquals("the invitation has been declined by an unexpected user", - StringUtils.parseBareAddress(fixture.userID2), + StringUtils.parseBareAddress(fixture.userID2), StringUtils.parseBareAddress(invitationRejectedEvent.getInvitee())); assertEquals("the invitation is not declined for the expected reason", @@ -622,7 +622,7 @@ public class TestOperationSetMultiUserChat2 /** * <tt>testInviteJoin</tt> reproduces the following scenario : user1 - * invite user2. user2 retrieves the room where he is invited then, + * invite user2. user2 retrieves the room where he is invited then, * he joins it. */ public void testInviteJoin() @@ -659,7 +659,7 @@ public class TestOperationSetMultiUserChat2 ChatRoomInvitation invitation = invitationReceivedEvent.getInvitation(); assertEquals("The inviter is not the expected user", - StringUtils.parseBareAddress(fixture.userID1), + StringUtils.parseBareAddress(fixture.userID1), StringUtils.parseBareAddress(invitation.getInviter())); assertEquals("The invitation reason received differs from the one sent" @@ -1254,14 +1254,14 @@ public class TestOperationSetMultiUserChat2 } /** - * Tests participant roles when the room just has been created. - * The member who has created the room should have OWNER role. - * Others participants who are invited to the room should be MEMBER. - * - * @throws OperationNotSupportedException - * @throws OperationFailedException + * Tests participant roles when the room just has been created. + * The member who has created the room should have OWNER role. + * Others participants who are invited to the room should be MEMBER. + * + * @throws OperationNotSupportedException + * @throws OperationFailedException */ - public void testInitialParticipantsRoles() + public void testInitialParticipantsRoles() throws OperationFailedException, OperationNotSupportedException { String roomName = testRoomBaseName + roomID; @@ -1277,7 +1277,7 @@ public class TestOperationSetMultiUserChat2 roomUser1Collector.waitForEvent(10000); // wait for user1 // User1 who just created the room is supposed to be the owner: - assertEquals("Unexpected role for user1", + assertEquals("Unexpected role for user1", roomUser1.getUserRole(), ChatRoomMemberRole.MODERATOR); assertEquals("Unexpected role for user1", roomUser1.getUserRole(), getRole(fixture.userID1, roomUser1.getMembers(), @@ -1288,7 +1288,7 @@ public class TestOperationSetMultiUserChat2 assertNotNull("Room can't be retrieved on user2's side", roomUser2); roomUser2.join(); roomUser1Collector.waitForEvent(10000); // wait for user2 - + ChatRoom roomUser3 = opSetMUC3.findRoom(roomName); assertNotNull("Room can't be retrieved on user3's side", roomUser2); roomUser3.join(); @@ -1300,19 +1300,19 @@ public class TestOperationSetMultiUserChat2 , nameIsOnMemberList(fixture.userID3, roomUser1.getMembers())); List<ChatRoomMember> members = roomUser1.getMembers(); - + // Three members are supposed to be in the room: assertEquals("Unexpected members count", 3, members.size()); - // We are sure two of these members are our peers (checked before the + // We are sure two of these members are our peers (checked before the // last assertion), now we make sure they are both members: // (Note that the first element of the list refers to the owner) assertEquals("The current implementation requires that room's new " + - "comers must have MEMBER role", + "comers must have MEMBER role", ChatRoomMemberRole.MEMBER, getRole(fixture.userID2, members, roomName, true)); assertEquals("The current implementation requires that room's new " + - "comers must have the MEMBER role", + "comers must have the MEMBER role", ChatRoomMemberRole.MEMBER, getRole(fixture.userID3, members, roomName, true)); @@ -1352,18 +1352,18 @@ public class TestOperationSetMultiUserChat2 return roleFound; } - + /** - * The owner of the room (the user who created it, and which is an - * administrator too, typically user1) will grant membership's role to one + * The owner of the room (the user who created it, and which is an + * administrator too, typically user1) will grant membership's role to one * of our peers (user2). * Membership means a long-life affiliation to the room, rather than being a * guest. - * - * @throws OperationNotSupportedException - * @throws OperationFailedException + * + * @throws OperationNotSupportedException + * @throws OperationFailedException */ - public void testGrantMembership() + public void testGrantMembership() throws OperationFailedException, OperationNotSupportedException { String roomName = testRoomBaseName + roomID; @@ -1372,47 +1372,47 @@ public class TestOperationSetMultiUserChat2 ChatRoom roomUser1 = opSetMUC1.findRoom(roomName); assertNotNull("The room can't be retrieved on user1's side", roomUser1); - + ChatRoom roomUser3 = opSetMUC3.findRoom(roomName); assertNotNull("The room can't be retrieved on user3's side", roomUser3); - + MUCEventCollector roomUser1Col = new MUCEventCollector( roomUser1, MUCEventCollector.EVENT_ROLE); MUCEventCollector roomUser3Col = new MUCEventCollector( roomUser3, MUCEventCollector.EVENT_ROLE); - + // Owner of the room grants user2 member rights: roomUser1.grantMembership(fixture.userID2); - + roomUser1Col.waitForEvent(10000); roomUser3Col.waitForEvent(10000); - + assertEquals("Wrong count of collected events on user1's side", 1, roomUser1Col.collectedEvents.size()); - ChatRoomMemberRoleChangeEvent roleEventUser1 = + ChatRoomMemberRoleChangeEvent roleEventUser1 = (ChatRoomMemberRoleChangeEvent) roomUser1Col.collectedEvents.get(0); - + assertEquals("Wrong count of collected events on user3's side", 1, roomUser3Col.collectedEvents.size()); - ChatRoomMemberRoleChangeEvent roleEventUser3 = + ChatRoomMemberRoleChangeEvent roleEventUser3 = (ChatRoomMemberRoleChangeEvent) roomUser3Col.collectedEvents.get(0); - - assertEquals("Collected event does not belong to the right chatroom", + + assertEquals("Collected event does not belong to the right chatroom", roomName, StringUtils.parseName( roleEventUser1.getSourceChatRoom().getName())); assertEquals("Collected event does not belong to the expected user", - fixture.userID2, + fixture.userID2, roleEventUser1.getSourceMember().getContactAddress()); assertEquals("User2's previous role does not match", ChatRoomMemberRole.GUEST, roleEventUser1.getPreviousRole()); assertEquals("Unexpected new role", ChatRoomMemberRole.MEMBER, roleEventUser1.getNewRole()); - - assertEquals("Collected event does not belong to the right chatroom", + + assertEquals("Collected event does not belong to the right chatroom", roomName, StringUtils.parseName( roleEventUser3.getSourceChatRoom().getName())); assertEquals("Collected event does not belong to the expected user", - fixture.userID2, + fixture.userID2, roleEventUser3.getSourceMember().getContactAddress()); assertEquals("User2's previous role does not match", ChatRoomMemberRole.GUEST, roleEventUser3.getPreviousRole()); @@ -1421,19 +1421,19 @@ public class TestOperationSetMultiUserChat2 logger.info("--- End testGrantMembership room:" + roomName); } - + /** - * The owner of the room (the user who created it, and which is an - * administrator too, typically user1) will grant moderator role to one + * The owner of the room (the user who created it, and which is an + * administrator too, typically user1) will grant moderator role to one * of our peers (user2). - * A moderator is allowed to kick users, grant and revoke voice, - * invite other users, modify room's subject plus all the participants + * A moderator is allowed to kick users, grant and revoke voice, + * invite other users, modify room's subject plus all the participants * privileges. - * - * @throws OperationNotSupportedException - * @throws OperationFailedException + * + * @throws OperationNotSupportedException + * @throws OperationFailedException */ - public void testGrantModerator() + public void testGrantModerator() throws OperationFailedException, OperationNotSupportedException { String roomName = testRoomBaseName + roomID; @@ -1442,47 +1442,47 @@ public class TestOperationSetMultiUserChat2 ChatRoom roomUser1 = opSetMUC1.findRoom(roomName); assertNotNull("The room can't be retrieved on user1's side", roomUser1); - + ChatRoom roomUser3 = opSetMUC3.findRoom(roomName); assertNotNull("The room can't be retrieved on user3's side", roomUser3); - + MUCEventCollector roomUser1Col = new MUCEventCollector( roomUser1, MUCEventCollector.EVENT_ROLE); MUCEventCollector roomUser3Col = new MUCEventCollector( roomUser3, MUCEventCollector.EVENT_ROLE); - + // Owner of the room grants user2 moderator rights: roomUser1.grantModerator(fixture.userID2); - + roomUser1Col.waitForEvent(10000); roomUser3Col.waitForEvent(10000); - + assertEquals("Wrong count of collected events on user1's side", 1, roomUser1Col.collectedEvents.size()); - ChatRoomMemberRoleChangeEvent roleEventUser1 = + ChatRoomMemberRoleChangeEvent roleEventUser1 = (ChatRoomMemberRoleChangeEvent) roomUser1Col.collectedEvents.get(0); - + assertEquals("Wrong count of collected events on user3's side", 1, roomUser3Col.collectedEvents.size()); - ChatRoomMemberRoleChangeEvent roleEventUser3 = + ChatRoomMemberRoleChangeEvent roleEventUser3 = (ChatRoomMemberRoleChangeEvent) roomUser3Col.collectedEvents.get(0); - - assertEquals("Collected event does not belong to the right chatroom", + + assertEquals("Collected event does not belong to the right chatroom", roomName, StringUtils.parseName( roleEventUser1.getSourceChatRoom().getName())); assertEquals("Collected event does not belong to the expected user", - fixture.userID2, + fixture.userID2, roleEventUser1.getSourceMember().getContactAddress()); assertEquals("User2's previous role does not match", ChatRoomMemberRole.MEMBER, roleEventUser1.getPreviousRole()); assertEquals("Unexpected new role", ChatRoomMemberRole.MODERATOR, roleEventUser1.getNewRole()); - - assertEquals("Collected event does not belong to the right chatroom", + + assertEquals("Collected event does not belong to the right chatroom", roomName, StringUtils.parseName( roleEventUser3.getSourceChatRoom().getName())); assertEquals("Collected event does not belong to the expected user", - fixture.userID2, + fixture.userID2, roleEventUser3.getSourceMember().getContactAddress()); assertEquals("User2's previous role does not match", ChatRoomMemberRole.MEMBER, roleEventUser3.getPreviousRole()); @@ -1491,18 +1491,18 @@ public class TestOperationSetMultiUserChat2 logger.info("--- End testGrantModerator room:" + roomName); } - + /** - * User2 which is currently moderator in the room for our scenario will + * User2 which is currently moderator in the room for our scenario will * revoke voice to user3, thanks to his moderator privileges. - * + * * We will first check that user3 has become a silent member before making * sure that he can't send messages through the room. - * - * @throws OperationNotSupportedException - * @throws OperationFailedException + * + * @throws OperationNotSupportedException + * @throws OperationFailedException */ - public void testRevokeVoice() + public void testRevokeVoice() throws OperationFailedException, OperationNotSupportedException { String roomName = testRoomBaseName + roomID; @@ -1511,50 +1511,50 @@ public class TestOperationSetMultiUserChat2 ChatRoom roomUser1 = opSetMUC1.findRoom(roomName); assertNotNull("The room can't be retrieved on user1's side", roomUser1); - + ChatRoom roomUser2 = opSetMUC2.findRoom(roomName); assertNotNull("The room can't be retrieved on user2's side", roomUser2); - + ChatRoom roomUser3 = opSetMUC3.findRoom(roomName); assertNotNull("The room can't be retrieved on user3's side", roomUser3); - + MUCEventCollector roomUser1Col = new MUCEventCollector( roomUser1, MUCEventCollector.EVENT_ROLE); MUCEventCollector roomUser2Col = new MUCEventCollector( roomUser2, MUCEventCollector.EVENT_ROLE); - + // User2 (moderator role) revokes voice right to user2 (guest): roomUser2.revokeVoice(fixture.userID3); - + roomUser1Col.waitForEvent(10000); roomUser2Col.waitForEvent(10000); - + assertEquals("Wrong count of collected events on user1's side", 1, roomUser1Col.collectedEvents.size()); - ChatRoomMemberRoleChangeEvent roleEventUser1 = + ChatRoomMemberRoleChangeEvent roleEventUser1 = (ChatRoomMemberRoleChangeEvent) roomUser1Col.collectedEvents.get(0); - + assertEquals("Wrong count of collected events on user2's side", 1, roomUser2Col.collectedEvents.size()); - ChatRoomMemberRoleChangeEvent roleEventUser2 = + ChatRoomMemberRoleChangeEvent roleEventUser2 = (ChatRoomMemberRoleChangeEvent) roomUser2Col.collectedEvents.get(0); - - assertEquals("Collected event does not belong to the right chatroom", + + assertEquals("Collected event does not belong to the right chatroom", roomName, StringUtils.parseName( roleEventUser1.getSourceChatRoom().getName())); assertEquals("Collected event does not belong to the expected user", - fixture.userID3, + fixture.userID3, roleEventUser1.getSourceMember().getContactAddress()); assertEquals("User3's previous role does not match", ChatRoomMemberRole.MEMBER, roleEventUser1.getPreviousRole()); assertEquals("Unexpected new role", ChatRoomMemberRole.SILENT_MEMBER, roleEventUser1.getNewRole()); - - assertEquals("Collected event does not belong to the right chatroom", + + assertEquals("Collected event does not belong to the right chatroom", roomName, StringUtils.parseName( roleEventUser2.getSourceChatRoom().getName())); assertEquals("Collected event does not belong to the expected user", - fixture.userID3, + fixture.userID3, roleEventUser2.getSourceMember().getContactAddress()); assertEquals("User3's previous role does not match", ChatRoomMemberRole.MEMBER, roleEventUser2.getPreviousRole()); @@ -1563,19 +1563,19 @@ public class TestOperationSetMultiUserChat2 logger.info("---= End test for RevokeVoice =--- room: " + roomName); } - + /** - * User2 which is currently moderator in the room for our scenario will + * User2 which is currently moderator in the room for our scenario will * grant voice to user3 (thanks to his moderator privileges) after having * revoked him it in the previous test of the suite. - * + * * We will first check that user3 has become a guest before making * sure that he can again send messages through the room. - * - * @throws OperationNotSupportedException - * @throws OperationFailedException + * + * @throws OperationNotSupportedException + * @throws OperationFailedException */ - public void testGrantVoice() + public void testGrantVoice() throws OperationFailedException, OperationNotSupportedException { String roomName = testRoomBaseName + roomID; @@ -1584,47 +1584,47 @@ public class TestOperationSetMultiUserChat2 ChatRoom roomUser1 = opSetMUC1.findRoom(roomName); assertNotNull("The room can't be retrieved on user1's side", roomUser1); - + ChatRoom roomUser2 = opSetMUC2.findRoom(roomName); assertNotNull("The room can't be retrieved on user2's side", roomUser2); - + MUCEventCollector roomUser1Col = new MUCEventCollector( roomUser1, MUCEventCollector.EVENT_ROLE); MUCEventCollector roomUser2Col = new MUCEventCollector( roomUser2, MUCEventCollector.EVENT_ROLE); - + // User2 of the room grants voice right to user2: roomUser2.grantVoice(fixture.userID3); - + roomUser1Col.waitForEvent(10000); roomUser2Col.waitForEvent(10000); - + assertEquals("Wrong count of collected events on user1's side", 1, roomUser1Col.collectedEvents.size()); - ChatRoomMemberRoleChangeEvent roleEventUser1 = + ChatRoomMemberRoleChangeEvent roleEventUser1 = (ChatRoomMemberRoleChangeEvent) roomUser1Col.collectedEvents.get(0); - + assertEquals("Wrong count of collected events on user3's side", 1, roomUser2Col.collectedEvents.size()); - ChatRoomMemberRoleChangeEvent roleEventUser2 = + ChatRoomMemberRoleChangeEvent roleEventUser2 = (ChatRoomMemberRoleChangeEvent) roomUser2Col.collectedEvents.get(0); - - assertEquals("Collected event does not belong to the right chatroom", + + assertEquals("Collected event does not belong to the right chatroom", roomName, StringUtils.parseName( roleEventUser1.getSourceChatRoom().getName())); assertEquals("Collected event does not belong to the expected user", - fixture.userID3, + fixture.userID3, roleEventUser1.getSourceMember().getContactAddress()); assertEquals("User3's previous role does not match", ChatRoomMemberRole.SILENT_MEMBER, roleEventUser1.getPreviousRole()); assertEquals("Unexpected new role", ChatRoomMemberRole.MEMBER, roleEventUser1.getNewRole()); - - assertEquals("Collected event does not belong to the right chatroom", + + assertEquals("Collected event does not belong to the right chatroom", roomName, StringUtils.parseName( roleEventUser2.getSourceChatRoom().getName())); assertEquals("Collected event does not belong to the expected user", - fixture.userID3, + fixture.userID3, roleEventUser2.getSourceMember().getContactAddress()); assertEquals("User3's previous role does not match", ChatRoomMemberRole.SILENT_MEMBER, roleEventUser2.getPreviousRole()); @@ -1633,18 +1633,18 @@ public class TestOperationSetMultiUserChat2 logger.info("---= End test for GrantVoice =--- room: " + roomName); } - + /** - * The owner of the room (the user who created it, and which is an - * administrator too, typically user1) will grant administrator role to one + * The owner of the room (the user who created it, and which is an + * administrator too, typically user1) will grant administrator role to one * of our peers (user2). * An administrator is allowed to perform administrative functions such as * banning users and edit moderator list. - * - * @throws OperationNotSupportedException - * @throws OperationFailedException + * + * @throws OperationNotSupportedException + * @throws OperationFailedException */ - public void testGrantAdmin() + public void testGrantAdmin() throws OperationFailedException, OperationNotSupportedException { String roomName = testRoomBaseName + roomID; @@ -1653,50 +1653,50 @@ public class TestOperationSetMultiUserChat2 ChatRoom roomUser1 = opSetMUC1.findRoom(roomName); assertNotNull("The room can't be retrieved on user1's side", roomUser1); - + ChatRoom roomUser2 = opSetMUC2.findRoom(roomName); assertNotNull("The room can't be retrieved on user3's side", roomUser2); - + ChatRoom roomUser3 = opSetMUC3.findRoom(roomName); assertNotNull("The room can't be retrieved on user3's side", roomUser3); - + MUCEventCollector roomUser1Col = new MUCEventCollector( roomUser1, MUCEventCollector.EVENT_ROLE); MUCEventCollector roomUser3Col = new MUCEventCollector( roomUser3, MUCEventCollector.EVENT_ROLE); - + // Owner of the room grants administrator rights to user2: roomUser1.grantAdmin(fixture.userID2); - + roomUser1Col.waitForEvent(10000); roomUser3Col.waitForEvent(10000); - + assertEquals("Wrong count of collected events on user1's side", 1, roomUser1Col.collectedEvents.size()); - ChatRoomMemberRoleChangeEvent roleEventUser1 = + ChatRoomMemberRoleChangeEvent roleEventUser1 = (ChatRoomMemberRoleChangeEvent) roomUser1Col.collectedEvents.get(0); - + assertEquals("Wrong count of collected events on user3's side", 1, roomUser3Col.collectedEvents.size()); - ChatRoomMemberRoleChangeEvent roleEventUser3 = + ChatRoomMemberRoleChangeEvent roleEventUser3 = (ChatRoomMemberRoleChangeEvent) roomUser3Col.collectedEvents.get(0); - - assertEquals("Collected event does not belong to the right chatroom", + + assertEquals("Collected event does not belong to the right chatroom", roomName, StringUtils.parseName( roleEventUser1.getSourceChatRoom().getName())); assertEquals("Collected event does not belong to the expected user", - fixture.userID2, + fixture.userID2, roleEventUser1.getSourceMember().getContactAddress()); assertEquals("User2's previous role does not match", ChatRoomMemberRole.MEMBER, roleEventUser1.getPreviousRole()); assertEquals("Unexpected new role", ChatRoomMemberRole.ADMINISTRATOR, roleEventUser1.getNewRole()); - - assertEquals("Collected event does not belong to the right chatroom", + + assertEquals("Collected event does not belong to the right chatroom", roomName, StringUtils.parseName( roleEventUser3.getSourceChatRoom().getName())); assertEquals("Collected event does not belong to the expected user", - fixture.userID2, + fixture.userID2, roleEventUser3.getSourceMember().getContactAddress()); assertEquals("User2's previous role does not match", ChatRoomMemberRole.MEMBER, roleEventUser3.getPreviousRole()); @@ -1705,18 +1705,18 @@ public class TestOperationSetMultiUserChat2 logger.info("--- End testGrantAdmin room:" + roomName); } - + /** - * The owner of the room (the user who created it, and which is an - * administrator too, typically user1) will grant ownership privileges to + * The owner of the room (the user who created it, and which is an + * administrator too, typically user1) will grant ownership privileges to * one of our peers (user2). - * An owner is allowed to change defining room features as well as perform + * An owner is allowed to change defining room features as well as perform * all administrative functions. - * - * @throws OperationNotSupportedException - * @throws OperationFailedException + * + * @throws OperationNotSupportedException + * @throws OperationFailedException */ - public void testGrantOwnership() + public void testGrantOwnership() throws OperationFailedException, OperationNotSupportedException { String roomName = testRoomBaseName + roomID; @@ -1725,47 +1725,47 @@ public class TestOperationSetMultiUserChat2 ChatRoom roomUser1 = opSetMUC1.findRoom(roomName); assertNotNull("The room can't be retrieved on user1's side", roomUser1); - + ChatRoom roomUser3 = opSetMUC3.findRoom(roomName); assertNotNull("The room can't be retrieved on user3's side", roomUser3); - + MUCEventCollector roomUser1Col = new MUCEventCollector( roomUser1, MUCEventCollector.EVENT_ROLE); MUCEventCollector roomUser3Col = new MUCEventCollector( roomUser3, MUCEventCollector.EVENT_ROLE); - + // Owner of the room grants ownership privileges to user2: roomUser1.grantOwnership(fixture.userID2); - + roomUser1Col.waitForEvent(10000); roomUser3Col.waitForEvent(10000); - + assertEquals("Wrong count of collected events on user1's side", 1, roomUser1Col.collectedEvents.size()); - ChatRoomMemberRoleChangeEvent roleEventUser1 = + ChatRoomMemberRoleChangeEvent roleEventUser1 = (ChatRoomMemberRoleChangeEvent) roomUser1Col.collectedEvents.get(0); - + assertEquals("Wrong count of collected events on user3's side", 1, roomUser3Col.collectedEvents.size()); - ChatRoomMemberRoleChangeEvent roleEventUser3 = + ChatRoomMemberRoleChangeEvent roleEventUser3 = (ChatRoomMemberRoleChangeEvent) roomUser3Col.collectedEvents.get(0); - - assertEquals("Collected event does not belong to the right chatroom", + + assertEquals("Collected event does not belong to the right chatroom", roomName, StringUtils.parseName( roleEventUser1.getSourceChatRoom().getName())); assertEquals("Collected event does not belong to the expected user", - fixture.userID2, + fixture.userID2, roleEventUser1.getSourceMember().getContactAddress()); assertEquals("User2's previous role does not match", ChatRoomMemberRole.ADMINISTRATOR, roleEventUser1.getPreviousRole()); assertEquals("Unexpected new role", ChatRoomMemberRole.OWNER, roleEventUser1.getNewRole()); - - assertEquals("Collected event does not belong to the right chatroom", + + assertEquals("Collected event does not belong to the right chatroom", roomName, StringUtils.parseName( roleEventUser3.getSourceChatRoom().getName())); assertEquals("Collected event does not belong to the expected user", - fixture.userID2, + fixture.userID2, roleEventUser3.getSourceMember().getContactAddress()); assertEquals("User2's previous role does not match", ChatRoomMemberRole.ADMINISTRATOR, roleEventUser3.getPreviousRole()); @@ -1774,17 +1774,17 @@ public class TestOperationSetMultiUserChat2 logger.info("--- End testGrantOwnership room:" + roomName); } - + /** - * The owner of the room (the user who created it, and which is an - * administrator too, typically user1) will revoke membership's role to one + * The owner of the room (the user who created it, and which is an + * administrator too, typically user1) will revoke membership's role to one * of our peers (user2). * The considered participant is then supposed to be a guest. - * - * @throws OperationNotSupportedException - * @throws OperationFailedException + * + * @throws OperationNotSupportedException + * @throws OperationFailedException */ - public void testRevokeMembership() + public void testRevokeMembership() throws OperationFailedException, OperationNotSupportedException { String roomName = testRoomBaseName + roomID; @@ -1793,28 +1793,28 @@ public class TestOperationSetMultiUserChat2 ChatRoom roomUser1 = opSetMUC1.findRoom(roomName); assertNotNull("The room can't be retrieved on user1's side", roomUser1); - + ChatRoom roomUser3 = opSetMUC3.findRoom(roomName); assertNotNull("The room can't be retrieved on user3's side", roomUser3); - + MUCEventCollector roomUser3Col = new MUCEventCollector( roomUser3, MUCEventCollector.EVENT_ROLE); - + // Owner of the room revokes user2 member rights: roomUser1.revokeMembership(fixture.userID2); - + roomUser3Col.waitForEvent(10000); assertEquals("Wrong count of collected events on user3's side", 1, roomUser3Col.collectedEvents.size()); - ChatRoomMemberRoleChangeEvent roleEventUser3 = + ChatRoomMemberRoleChangeEvent roleEventUser3 = (ChatRoomMemberRoleChangeEvent) roomUser3Col.collectedEvents.get(0); - - assertEquals("Collected event does not belong to the right chatroom", + + assertEquals("Collected event does not belong to the right chatroom", roomName, StringUtils.parseName( roleEventUser3.getSourceChatRoom().getName())); assertEquals("Collected event does not belong to the expected user", - fixture.userID2, + fixture.userID2, roleEventUser3.getSourceMember().getContactAddress()); assertEquals("User2's previous role does not match", ChatRoomMemberRole.MEMBER, roleEventUser3.getPreviousRole()); @@ -1823,16 +1823,16 @@ public class TestOperationSetMultiUserChat2 logger.info("--- End testRevokeMembership room:" + roomName); } - + /** - * The owner of the room (the user who created it, and which is an + * The owner of the room (the user who created it, and which is an * administrator too, typically user1) will revoke moderator role to user2. * The considered participant is then supposed to be a member. - * - * @throws OperationNotSupportedException - * @throws OperationFailedException + * + * @throws OperationNotSupportedException + * @throws OperationFailedException */ - public void testRevokeModerator() + public void testRevokeModerator() throws OperationFailedException, OperationNotSupportedException { String roomName = testRoomBaseName + roomID; @@ -1841,47 +1841,47 @@ public class TestOperationSetMultiUserChat2 ChatRoom roomUser1 = opSetMUC1.findRoom(roomName); assertNotNull("The room can't be retrieved on user1's side", roomUser1); - + ChatRoom roomUser3 = opSetMUC3.findRoom(roomName); assertNotNull("The room can't be retrieved on user3's side", roomUser3); - + MUCEventCollector roomUser1Col = new MUCEventCollector( roomUser1, MUCEventCollector.EVENT_ROLE); MUCEventCollector roomUser3Col = new MUCEventCollector( roomUser3, MUCEventCollector.EVENT_ROLE); - + // Owner of the room revokes user2 member rights: roomUser1.revokeModerator(fixture.userID2); - + roomUser1Col.waitForEvent(10000); roomUser3Col.waitForEvent(10000); - + assertEquals("Wrong count of collected events on user1's side", 1, roomUser1Col.collectedEvents.size()); - ChatRoomMemberRoleChangeEvent roleEventUser1 = + ChatRoomMemberRoleChangeEvent roleEventUser1 = (ChatRoomMemberRoleChangeEvent) roomUser1Col.collectedEvents.get(0); - + assertEquals("Wrong count of collected events on user3's side", 1, roomUser3Col.collectedEvents.size()); - ChatRoomMemberRoleChangeEvent roleEventUser3 = + ChatRoomMemberRoleChangeEvent roleEventUser3 = (ChatRoomMemberRoleChangeEvent) roomUser3Col.collectedEvents.get(0); - - assertEquals("Collected event does not belong to the right chatroom", + + assertEquals("Collected event does not belong to the right chatroom", roomName, StringUtils.parseName( roleEventUser1.getSourceChatRoom().getName())); assertEquals("Collected event does not belong to the expected user", - fixture.userID2, + fixture.userID2, roleEventUser1.getSourceMember().getContactAddress()); assertEquals("User2's previous role does not match", ChatRoomMemberRole.MODERATOR, roleEventUser1.getPreviousRole()); assertEquals("Unexpected new role", ChatRoomMemberRole.MEMBER, roleEventUser1.getNewRole()); - - assertEquals("Collected event does not belong to the right chatroom", + + assertEquals("Collected event does not belong to the right chatroom", roomName, StringUtils.parseName( roleEventUser3.getSourceChatRoom().getName())); assertEquals("Collected event does not belong to the expected user", - fixture.userID2, + fixture.userID2, roleEventUser3.getSourceMember().getContactAddress()); assertEquals("User2's previous role does not match", ChatRoomMemberRole.MODERATOR, roleEventUser3.getPreviousRole()); @@ -1890,17 +1890,17 @@ public class TestOperationSetMultiUserChat2 logger.info("--- End testRevokeModerator room:" + roomName); } - + /** - * The owner of the room (the user who created it, and which is an - * administrator too, typically user1) will revoke administrator role to + * The owner of the room (the user who created it, and which is an + * administrator too, typically user1) will revoke administrator role to * user2. * The considered participant is then supposed to be a moderator. - * - * @throws OperationNotSupportedException - * @throws OperationFailedException + * + * @throws OperationNotSupportedException + * @throws OperationFailedException */ - public void testRevokeAdmin() + public void testRevokeAdmin() throws OperationFailedException, OperationNotSupportedException { String roomName = testRoomBaseName + roomID; @@ -1909,47 +1909,47 @@ public class TestOperationSetMultiUserChat2 ChatRoom roomUser1 = opSetMUC1.findRoom(roomName); assertNotNull("The room can't be retrieved on user1's side", roomUser1); - + ChatRoom roomUser3 = opSetMUC3.findRoom(roomName); assertNotNull("The room can't be retrieved on user3's side", roomUser3); - + MUCEventCollector roomUser1Col = new MUCEventCollector( roomUser1, MUCEventCollector.EVENT_ROLE); MUCEventCollector roomUser3Col = new MUCEventCollector( roomUser3, MUCEventCollector.EVENT_ROLE); - + // Owner of the room revokes user2 member rights: roomUser1.revokeAdmin(fixture.userID2); - + roomUser1Col.waitForEvent(10000); roomUser3Col.waitForEvent(10000); - + assertEquals("Wrong count of collected events on user1's side", 1, roomUser1Col.collectedEvents.size()); - ChatRoomMemberRoleChangeEvent roleEventUser1 = + ChatRoomMemberRoleChangeEvent roleEventUser1 = (ChatRoomMemberRoleChangeEvent) roomUser1Col.collectedEvents.get(0); - + assertEquals("Wrong count of collected events on user3's side", 1, roomUser3Col.collectedEvents.size()); - ChatRoomMemberRoleChangeEvent roleEventUser3 = + ChatRoomMemberRoleChangeEvent roleEventUser3 = (ChatRoomMemberRoleChangeEvent) roomUser3Col.collectedEvents.get(0); - - assertEquals("Collected event does not belong to the right chatroom", + + assertEquals("Collected event does not belong to the right chatroom", roomName, StringUtils.parseName( roleEventUser1.getSourceChatRoom().getName())); assertEquals("Collected event does not belong to the expected user", - fixture.userID2, + fixture.userID2, roleEventUser1.getSourceMember().getContactAddress()); assertEquals("User2's previous role does not match", ChatRoomMemberRole.ADMINISTRATOR, roleEventUser1.getPreviousRole()); assertEquals("Unexpected new role", ChatRoomMemberRole.MODERATOR, roleEventUser1.getNewRole()); - - assertEquals("Collected event does not belong to the right chatroom", + + assertEquals("Collected event does not belong to the right chatroom", roomName, StringUtils.parseName( roleEventUser3.getSourceChatRoom().getName())); assertEquals("Collected event does not belong to the expected user", - fixture.userID2, + fixture.userID2, roleEventUser3.getSourceMember().getContactAddress()); assertEquals("User2's previous role does not match", ChatRoomMemberRole.ADMINISTRATOR, roleEventUser3.getPreviousRole()); @@ -1958,17 +1958,17 @@ public class TestOperationSetMultiUserChat2 logger.info("--- End testRevokeAdmin room:" + roomName); } - + /** - * The owner of the room (the user who created it, and which is an - * administrator too, typically user1) will revoke ownership rights to + * The owner of the room (the user who created it, and which is an + * administrator too, typically user1) will revoke ownership rights to * user2. * The considered participant is then supposed to be an admin. - * - * @throws OperationNotSupportedException - * @throws OperationFailedException + * + * @throws OperationNotSupportedException + * @throws OperationFailedException */ - public void testRevokeOwnership() + public void testRevokeOwnership() throws OperationFailedException, OperationNotSupportedException { String roomName = testRoomBaseName + roomID; @@ -1977,47 +1977,47 @@ public class TestOperationSetMultiUserChat2 ChatRoom roomUser1 = opSetMUC1.findRoom(roomName); assertNotNull("The room can't be retrieved on user1's side", roomUser1); - + ChatRoom roomUser3 = opSetMUC3.findRoom(roomName); assertNotNull("The room can't be retrieved on user3's side", roomUser3); - + MUCEventCollector roomUser1Col = new MUCEventCollector( roomUser1, MUCEventCollector.EVENT_ROLE); MUCEventCollector roomUser3Col = new MUCEventCollector( roomUser3, MUCEventCollector.EVENT_ROLE); - + // Owner of the room revokes user2 member rights: roomUser1.revokeOwnership(fixture.userID2); - + roomUser1Col.waitForEvent(10000); roomUser3Col.waitForEvent(10000); - + assertEquals("Wrong count of collected events on user1's side", 1, roomUser1Col.collectedEvents.size()); - ChatRoomMemberRoleChangeEvent roleEventUser1 = + ChatRoomMemberRoleChangeEvent roleEventUser1 = (ChatRoomMemberRoleChangeEvent) roomUser1Col.collectedEvents.get(0); - + assertEquals("Wrong count of collected events on user3's side", 1, roomUser3Col.collectedEvents.size()); - ChatRoomMemberRoleChangeEvent roleEventUser3 = + ChatRoomMemberRoleChangeEvent roleEventUser3 = (ChatRoomMemberRoleChangeEvent) roomUser3Col.collectedEvents.get(0); - - assertEquals("Collected event does not belong to the right chatroom", + + assertEquals("Collected event does not belong to the right chatroom", roomName, StringUtils.parseName( roleEventUser1.getSourceChatRoom().getName())); assertEquals("Collected event does not belong to the expected user", - fixture.userID2, + fixture.userID2, roleEventUser1.getSourceMember().getContactAddress()); assertEquals("User2's previous role does not match", ChatRoomMemberRole.OWNER, roleEventUser1.getPreviousRole()); assertEquals("Unexpected new role", ChatRoomMemberRole.ADMINISTRATOR, roleEventUser1.getNewRole()); - - assertEquals("Collected event does not belong to the right chatroom", + + assertEquals("Collected event does not belong to the right chatroom", roomName, StringUtils.parseName( roleEventUser3.getSourceChatRoom().getName())); assertEquals("Collected event does not belong to the expected user", - fixture.userID2, + fixture.userID2, roleEventUser3.getSourceMember().getContactAddress()); assertEquals("User2's previous role does not match", ChatRoomMemberRole.OWNER, roleEventUser3.getPreviousRole()); @@ -2026,7 +2026,7 @@ public class TestOperationSetMultiUserChat2 logger.info("--- End testRevokeOwnership room:" + roomName); } - + /** * Utility class used to collect events received during tests. */ @@ -2041,7 +2041,7 @@ public class TestOperationSetMultiUserChat2 ChatRoomMemberRoleListener, ChatRoomLocalUserRoleListener { - private final ArrayList<EventObject> collectedEvents + private final ArrayList<EventObject> collectedEvents = new ArrayList<EventObject>(); private int waitCount = 0; diff --git a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPersistentPresence.java b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPersistentPresence.java index 70e1365..5d24a25 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPersistentPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPersistentPresence.java @@ -65,6 +65,7 @@ public class TestOperationSetPersistentPresence return suite; } + @Override protected void setUp() throws Exception { super.setUp(); @@ -116,6 +117,7 @@ public class TestOperationSetPersistentPresence + "Operation Sets"); } + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -140,7 +142,7 @@ public class TestOperationSetPersistentPresence + "Printing rootGroupContents=\n"+rootGroup.toString()); Hashtable<String, List<String>> expectedContactList - = fixture.preInstalledBuddyList; + = JabberSlickFixture.preInstalledBuddyList; logger.debug("============== Expected Contact List ==================="); logger.debug(expectedContactList); 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 fbc269a..382c70d 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetPresence.java @@ -54,6 +54,7 @@ public class TestOperationSetPresence super(name); } + @Override protected void setUp() throws Exception { super.setUp(); @@ -132,6 +133,7 @@ public class TestOperationSetPresence } } + @Override protected void tearDown() throws Exception { super.tearDown(); 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 ee8dd99..8812622 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetTypingNotifications.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestOperationSetTypingNotifications.java @@ -39,6 +39,7 @@ public class TestOperationSetTypingNotifications super(name); } + @Override protected void setUp() throws Exception { super.setUp(); @@ -166,6 +167,7 @@ public class TestOperationSetTypingNotifications } } + @Override protected void tearDown() throws Exception { super.tearDown(); @@ -253,10 +255,10 @@ public class TestOperationSetTypingNotifications assertTrue("Number of typing events received was zero." , evtCollector.collectedEvents.size() > 0); - logger.trace("We have collected " + evtCollector.collectedEvents.size() + logger.trace("We have collected " + evtCollector.collectedEvents.size() + " typing notifications."); logger.trace("Notifications: " + evtCollector.collectedEvents); - + evt = (TypingNotificationEvent)evtCollector.collectedEvents.get(0); assertEquals("Source of the typing notification event" 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 b0b8034..4e000df 100644 --- a/test/net/java/sip/communicator/slick/protocol/jabber/TestProtocolProviderServiceJabberImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/jabber/TestProtocolProviderServiceJabberImpl.java @@ -17,7 +17,7 @@ import net.java.sip.communicator.util.*; /** * Performs testing on protocol provider methods. * @todo add more detailed docs once the tests are written. - * + * * @author Emil Ivov * @author Valentin Martinet */ @@ -40,7 +40,7 @@ public class TestProtocolProviderServiceJabberImpl */ public RegistrationEventCollector regEvtCollector2 = new RegistrationEventCollector(); - + /** * An event adapter that would collec registation state change events */ @@ -60,6 +60,7 @@ public class TestProtocolProviderServiceJabberImpl * Initializes the fixture. * @throws Exception if super.setUp() throws one. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -70,6 +71,7 @@ public class TestProtocolProviderServiceJabberImpl * Tears the fixture down. * @throws Exception if fixture.tearDown() fails. */ + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -97,7 +99,7 @@ public class TestProtocolProviderServiceJabberImpl fixture.provider1.addRegistrationStateChangeListener(regEvtCollector1); fixture.provider2.addRegistrationStateChangeListener(regEvtCollector2); fixture.provider3.addRegistrationStateChangeListener(regEvtCollector3); - + //register our three providers fixture.provider1.register(new SecurityAuthorityImpl( System.getProperty( @@ -144,7 +146,7 @@ public class TestProtocolProviderServiceJabberImpl +"All events were: " + regEvtCollector2.collectedNewStates ,regEvtCollector2.collectedNewStates .contains(RegistrationState.REGISTERED)); - + //now the same for provider 3 assertTrue( "No events were dispatched during the registration process " diff --git a/test/net/java/sip/communicator/slick/protocol/msn/MsnProtocolProviderServiceLick.java b/test/net/java/sip/communicator/slick/protocol/msn/MsnProtocolProviderServiceLick.java index 24bd012..a240601 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/MsnProtocolProviderServiceLick.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/MsnProtocolProviderServiceLick.java @@ -36,7 +36,7 @@ public class MsnProtocolProviderServiceLick */ public static final String ACCOUNT_2_PREFIX = "accounts.msn.account2."; - + /** * The prefix used for property names containing settings for our third * testing account. @@ -92,7 +92,7 @@ public class MsnProtocolProviderServiceLick addTest(TestOperationSetPersistentPresence.suite()); addTest(TestOperationSetBasicInstantMessaging.suite()); - + addTest(TestOperationSetInstantMessageTransformMsnImpl.suite()); addTest(TestOperationSetTypingNotifications.suite()); 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 12b61db..bfe1a6e 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/MsnSlickFixture.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/MsnSlickFixture.java @@ -28,14 +28,15 @@ public class MsnSlickFixture { super(); } - + /** * Initializes protocol provider references and whatever else there is to * initialize. - * + * * @throws InvalidSyntaxException in case we meet problems while retrieving * protocol providers through OSGI */ + @Override public void setUp() throws InvalidSyntaxException { // first obtain a reference to the provider factory @@ -67,7 +68,7 @@ public class MsnSlickFixture System.getProperty( MsnProtocolProviderServiceLick.ACCOUNT_2_PREFIX + ProtocolProviderFactory.USER_ID); - + userID3 = System.getProperty( MsnProtocolProviderServiceLick.ACCOUNT_3_PREFIX @@ -105,7 +106,7 @@ public class MsnSlickFixture , msnProvider2Refs); assertTrue("No Protocol Provider was found for msn account2:"+ userID2, msnProvider2Refs.length > 0); - + ServiceReference[] msnProvider3Refs = bc.getServiceReferences( ProtocolProviderService.class.getName(), diff --git a/test/net/java/sip/communicator/slick/protocol/msn/TestAccountInstallation.java b/test/net/java/sip/communicator/slick/protocol/msn/TestAccountInstallation.java index b02d8e0..ea26c41 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestAccountInstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestAccountInstallation.java @@ -30,6 +30,7 @@ public class TestAccountInstallation * JUnit setup method. * @throws Exception in case anything goes wrong. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -39,6 +40,7 @@ public class TestAccountInstallation * JUnit teardown method. * @throws Exception in case anything goes wrong. */ + @Override protected void tearDown() throws Exception { super.tearDown(); diff --git a/test/net/java/sip/communicator/slick/protocol/msn/TestAccountUninstallation.java b/test/net/java/sip/communicator/slick/protocol/msn/TestAccountUninstallation.java index 7df766d..394d1b1 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestAccountUninstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestAccountUninstallation.java @@ -8,6 +8,7 @@ package net.java.sip.communicator.slick.protocol.msn; import junit.framework.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.slick.protocol.generic.*; import org.osgi.framework.*; @@ -38,6 +39,7 @@ public class TestAccountUninstallation * JUnit setup method. * @throws Exception in case anything goes wrong. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -48,6 +50,7 @@ public class TestAccountUninstallation * JUnit teardown method. * @throws Exception in case anything goes wrong. */ + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -82,7 +85,7 @@ public class TestAccountUninstallation public void testInstallationPersistency() throws Exception { Bundle providerBundle - = fixture.findProtocolProviderBundle(fixture.provider1); + = AdHocMultiUserChatSlickFixture.findProtocolProviderBundle(fixture.provider1); //set the global providerBundle reference that we will be using //in the last series of tests (Account uninstallation persistency) @@ -107,7 +110,7 @@ public class TestAccountUninstallation ServiceReference[] msnProviderRefs = null; try { - msnProviderRefs = fixture.bc.getServiceReferences( + msnProviderRefs = AdHocMultiUserChatSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(&" + "(" + ProtocolProviderFactory.PROTOCOL @@ -138,7 +141,7 @@ public class TestAccountUninstallation == null); //Now reinstall the bundle - providerBundle = fixture.bc.installBundle(providerBundle.getLocation()); + providerBundle = AdHocMultiUserChatSlickFixture.bc.installBundle(providerBundle.getLocation()); //set the global providerBundle reference that we will be using //in the last series of tests (Account uninstallation persistency) @@ -147,7 +150,7 @@ public class TestAccountUninstallation assertEquals("Couldn't re-install protocol provider bundle." , Bundle.INSTALLED, providerBundle.getState()); - AccountManagerUtils.startBundleAndWaitStoredAccountsLoaded(fixture.bc, + AccountManagerUtils.startBundleAndWaitStoredAccountsLoaded(AdHocMultiUserChatSlickFixture.bc, providerBundle, ProtocolNames.MSN); assertEquals("Couldn't re-start protocol provider bundle." , Bundle.ACTIVE, providerBundle.getState()); @@ -156,7 +159,7 @@ public class TestAccountUninstallation //verify that the provider is no longer available try { - msnProviderRefs = fixture.bc.getServiceReferences( + msnProviderRefs = AdHocMultiUserChatSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(&" + "(" + ProtocolProviderFactory.PROTOCOL @@ -178,7 +181,7 @@ public class TestAccountUninstallation ServiceReference[] msnFactoryRefs = null; try { - msnFactoryRefs = fixture.bc.getServiceReferences( + msnFactoryRefs = AdHocMultiUserChatSlickFixture.bc.getServiceReferences( ProtocolProviderFactory.class.getName(), "(" + ProtocolProviderFactory.PROTOCOL + "=" +ProtocolNames.MSN + ")"); @@ -191,9 +194,9 @@ public class TestAccountUninstallation //we're the ones who've reinstalled the factory so it's our //responsibility to update the fixture. fixture.providerFactory - = (ProtocolProviderFactory)fixture.bc.getService(msnFactoryRefs[0]); + = (ProtocolProviderFactory)AdHocMultiUserChatSlickFixture.bc.getService(msnFactoryRefs[0]); fixture.provider1 - = (ProtocolProviderService)fixture.bc.getService(msnProviderRefs[0]); + = (ProtocolProviderService)AdHocMultiUserChatSlickFixture.bc.getService(msnProviderRefs[0]); //verify that the provider is also restored in the provider factory @@ -242,7 +245,7 @@ public class TestAccountUninstallation ServiceReference[] msnProviderRefs = null; try { - msnProviderRefs = fixture.bc.getServiceReferences( + msnProviderRefs = AdHocMultiUserChatSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(" + ProtocolProviderFactory.PROTOCOL + "=" +ProtocolNames.MSN + ")"); diff --git a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetAdHocMultiUserChatMsnImpl.java b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetAdHocMultiUserChatMsnImpl.java index 590fb26..5249b8c 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetAdHocMultiUserChatMsnImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetAdHocMultiUserChatMsnImpl.java @@ -14,15 +14,15 @@ import net.java.sip.communicator.slick.protocol.generic.*; /** * Tests for the MSN ad-hoc multi-user chat operation set. - * + * * @author Valentin Martinet */ -public class TestOperationSetAdHocMultiUserChatMsnImpl -extends TestOperationSetAdHocMultiUserChat +public class TestOperationSetAdHocMultiUserChatMsnImpl +extends TestOperationSetAdHocMultiUserChat { /** * Creates the test with the specified method name. - * + * * @param name the name of the method to execute. */ public TestOperationSetAdHocMultiUserChatMsnImpl(String name) @@ -62,18 +62,19 @@ extends TestOperationSetAdHocMultiUserChat System.getProperty( MsnProtocolProviderServiceLick.ACCOUNT_3_PREFIX + ProtocolProviderFactory.PASSWORD).toCharArray())); - - assertEquals(fixture.provider3.getRegistrationState(), + + assertEquals(fixture.provider3.getRegistrationState(), RegistrationState.REGISTERED); } - - public void start() throws Exception + + @Override + public void start() throws Exception { fixture = new MsnSlickFixture(); fixture.setUp(); // Supported operation sets by each protocol provider. - Map<String, OperationSet> + Map<String, OperationSet> supportedOpSets1, supportedOpSets2, supportedOpSets3; supportedOpSets1 = fixture.provider1.getSupportedOperationSets(); @@ -101,7 +102,7 @@ extends TestOperationSetAdHocMultiUserChat if (opSetPresence1 == null) throw new NullPointerException( - "An implementation of the service must provide an " + + "An implementation of the service must provide an " + "implementation of at least one of the PresenceOperationSets"); @@ -111,7 +112,7 @@ extends TestOperationSetAdHocMultiUserChat if (supportedOpSets2 == null || supportedOpSets2.size() < 1) throw new NullPointerException( - "No OperationSet implementations are supported by " + + "No OperationSet implementations are supported by " + "this implementation. "); opSetAHMUC2 = (OperationSetAdHocMultiUserChat) supportedOpSets2.get( @@ -126,7 +127,7 @@ extends TestOperationSetAdHocMultiUserChat if (opSetPresence2 == null) throw new NullPointerException( - "An implementation of the service must provide an " + + "An implementation of the service must provide an " + "implementation of at least one of the PresenceOperationSets"); @@ -136,7 +137,7 @@ extends TestOperationSetAdHocMultiUserChat if (supportedOpSets3 == null || supportedOpSets3.size() < 1) throw new NullPointerException( - "No OperationSet implementations are supported by " + + "No OperationSet implementations are supported by " + "this implementation. "); opSetAHMUC3 = (OperationSetAdHocMultiUserChat) supportedOpSets3.get( @@ -151,7 +152,7 @@ extends TestOperationSetAdHocMultiUserChat if (opSetPresence3 == null) throw new NullPointerException( - "An implementation of the service must provide an " + + "An implementation of the service must provide an " + "implementation of at least one of the PresenceOperationSets"); } } 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 4fd4df9..bd0376b 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetBasicInstantMessaging.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetBasicInstantMessaging.java @@ -44,6 +44,7 @@ public class TestOperationSetBasicInstantMessaging * Get a reference to the basic IM operation set. * @throws Exception if this is not a good day. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -116,6 +117,7 @@ public class TestOperationSetBasicInstantMessaging } + @Override protected void tearDown() throws Exception { super.tearDown(); diff --git a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetFileTransferImpl.java b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetFileTransferImpl.java index 9d39107..ea29d75 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetFileTransferImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetFileTransferImpl.java @@ -18,7 +18,7 @@ import org.osgi.framework.*; * Implementation for generic file transfer. * @author Damian Minkov */ -public class TestOperationSetFileTransferImpl +public class TestOperationSetFileTransferImpl extends TestOperationSetFileTransfer { private static final Logger logger = @@ -35,6 +35,7 @@ public class TestOperationSetFileTransferImpl private static Contact contact1 = null; private static Contact contact2 = null; + @Override public Contact getContact1() { if(contact1 == null) @@ -45,6 +46,7 @@ public class TestOperationSetFileTransferImpl return contact1; } + @Override public Contact getContact2() { if(contact2 == null) @@ -55,6 +57,7 @@ public class TestOperationSetFileTransferImpl return contact2; } + @Override public void start() throws Exception { @@ -130,6 +133,7 @@ public class TestOperationSetFileTransferImpl prepareContactList(); } + @Override public void stop() throws Exception { @@ -190,21 +194,25 @@ public class TestOperationSetFileTransferImpl } } + @Override public OperationSetFileTransfer getOpSetFilTransfer1() { return opSetFT1; } + @Override public OperationSetFileTransfer getOpSetFilTransfer2() { return opSetFT2; } + @Override public BundleContext getContext() { - return fixture.bc; + return AdHocMultiUserChatSlickFixture.bc; } + @Override public boolean enableTestSendAndReceive() { // as this is the first test to be executed @@ -218,21 +226,25 @@ public class TestOperationSetFileTransferImpl return true; } + @Override public boolean enableTestSenderCancelBeforeAccepted() { return true; } + @Override public boolean enableTestReceiverDecline() { return true; } + @Override public boolean enableTestReceiverCancelsWhileTransfering() { return true; } + @Override public boolean enableTestSenderCancelsWhileTransfering() { return true; diff --git a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetInstantMessageTransformMsnImpl.java b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetInstantMessageTransformMsnImpl.java index 095e47a..e3246d8 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetInstantMessageTransformMsnImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetInstantMessageTransformMsnImpl.java @@ -34,6 +34,7 @@ public class TestOperationSetInstantMessageTransformMsnImpl super(name); } + @Override protected void setUp() throws Exception { super.setUp(); @@ -129,6 +130,7 @@ public class TestOperationSetInstantMessageTransformMsnImpl } + @Override protected void tearDown() throws Exception { super.tearDown(); 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 715ab6f..dee8605 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetPersistentPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetPersistentPresence.java @@ -11,6 +11,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.slick.protocol.generic.*; import net.java.sip.communicator.util.*; /** @@ -65,6 +66,7 @@ public class TestOperationSetPersistentPresence return suite; } + @Override protected void setUp() throws Exception { super.setUp(); @@ -116,6 +118,7 @@ public class TestOperationSetPersistentPresence + "Operation Sets"); } + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -131,7 +134,7 @@ public class TestOperationSetPersistentPresence throws Exception { waitFor(5000); - + ContactGroup rootGroup = opSetPersPresence1.getServerStoredContactListRoot(); @@ -143,7 +146,7 @@ public class TestOperationSetPersistentPresence + "Printing rootGroupContents=\n"+rootGroup.toString()); Hashtable<String, List<String>> expectedContactList - = fixture.preInstalledBuddyList; + = AdHocMultiUserChatSlickFixture.preInstalledBuddyList; logger.debug("============== Expected Contact List ==================="); logger.debug(expectedContactList); @@ -427,7 +430,7 @@ public class TestOperationSetPersistentPresence logger.debug("Will add group " + groupName); groupChangeCollector.collectedEvents.clear(); - + opSetPersPresence1.createServerStoredContactGroup( opSetPersPresence1.getServerStoredContactListRoot(), groupName); 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 9f183d2..8d69435 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetPresence.java @@ -43,6 +43,7 @@ public class TestOperationSetPresence super(name); } + @Override protected void setUp() throws Exception { super.setUp(); @@ -98,6 +99,7 @@ public class TestOperationSetPresence } } + @Override protected void tearDown() throws Exception { super.tearDown(); @@ -284,9 +286,9 @@ public class TestOperationSetPresence //test provider event notification. statusEventCollector.waitForPresEvent(10000); - + // wait for status change in other provider - // as later its not actually queryed but the last received + // as later its not actually queryed but the last received // status is returned contactStatusEventCollector.waitForEvent(10000); @@ -314,10 +316,10 @@ public class TestOperationSetPresence operationSetPresence1.getPresenceStatus()); logger.trace("will query for contact(" + fixture.userID1 + ") status!"); - + MsnStatusEnum actualStatus = (MsnStatusEnum) operationSetPresence2.queryContactStatus(fixture.userID1); - + assertEquals("The underlying implementation did not switch to the " +"requested presence status.", newStatus, @@ -402,28 +404,28 @@ public class TestOperationSetPresence logger.trace("will query for contact("+ fixture.userID2 + ") status!"); PresenceStatus actualReturn = operationSetPresence1.queryContactStatus(fixture.userID2); - + // sometimes happens that no status are received // will change the status and try again if(!actualReturn.equals(expectedReturn)) { - logger.info("subtestQueryContactStatus for " + status + + logger.info("subtestQueryContactStatus for " + status + " Failed - trying again!"); - + // reset the status so we can change it once again operationSetPresence2.publishPresenceStatus(status, "status message"); - + pauseAfterStateChanges(); - + // now try again operationSetPresence2.publishPresenceStatus(status, "status message"); pauseAfterStateChanges(); - + actualReturn = operationSetPresence1.queryContactStatus(fixture.userID2); } - + assertEquals("Querying a " + expectedReturn.getStatusName() + " state did not return as expected" @@ -454,7 +456,7 @@ public class TestOperationSetPresence subEvtCollector.waitForEvent(10000); operationSetPresence1.removeSubscriptionListener(subEvtCollector); } - + SubscriptionEventCollector subEvtCollector2 = new SubscriptionEventCollector(); operationSetPresence2.addSubscriptionListener(subEvtCollector2); @@ -560,7 +562,7 @@ public class TestOperationSetPresence { // happens if the user is already subscribed } - + Object lock = new Object(); synchronized(lock) { 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 313003b..5a79cc1 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetTypingNotifications.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestOperationSetTypingNotifications.java @@ -39,6 +39,7 @@ public class TestOperationSetTypingNotifications super(name); } + @Override protected void setUp() throws Exception { super.setUp(); @@ -166,6 +167,7 @@ public class TestOperationSetTypingNotifications } } + @Override protected void tearDown() throws Exception { super.tearDown(); 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 4f28ad1..fa0f269 100644 --- a/test/net/java/sip/communicator/slick/protocol/msn/TestProtocolProviderServiceMsnImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/msn/TestProtocolProviderServiceMsnImpl.java @@ -39,7 +39,7 @@ public class TestProtocolProviderServiceMsnImpl */ public RegistrationEventCollector regEvtCollector2 = new RegistrationEventCollector(); - + /** * An event adapter that would collec registation state change events */ @@ -59,6 +59,7 @@ public class TestProtocolProviderServiceMsnImpl * Initializes the fixture. * @throws Exception if super.setUp() throws one. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -69,6 +70,7 @@ public class TestProtocolProviderServiceMsnImpl * Tears the fixture down. * @throws Exception if fixture.tearDown() fails. */ + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -135,7 +137,7 @@ public class TestProtocolProviderServiceMsnImpl +"All events were: " + regEvtCollector2.collectedNewStates ,regEvtCollector2.collectedNewStates .contains(RegistrationState.REGISTERED)); - + //now the same for provider 3 // assertTrue( // "No events were dispatched during the registration process " diff --git a/test/net/java/sip/communicator/slick/protocol/rss/RssSlickFixture.java b/test/net/java/sip/communicator/slick/protocol/rss/RssSlickFixture.java index cd75d41..a8b8e69 100755 --- a/test/net/java/sip/communicator/slick/protocol/rss/RssSlickFixture.java +++ b/test/net/java/sip/communicator/slick/protocol/rss/RssSlickFixture.java @@ -65,6 +65,7 @@ public class RssSlickFixture * @throws java.lang.Exception in case we meet problems while retriving * protocol providers through OSGI */ + @Override public void setUp() throws Exception { @@ -107,6 +108,7 @@ public class RssSlickFixture /** * Un get service references used in here. */ + @Override public void tearDown() { bc.ungetService(providerServiceReference); diff --git a/test/net/java/sip/communicator/slick/protocol/rss/TestAccountInstallation.java b/test/net/java/sip/communicator/slick/protocol/rss/TestAccountInstallation.java index d59fada..4c4c42c 100755 --- a/test/net/java/sip/communicator/slick/protocol/rss/TestAccountInstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/rss/TestAccountInstallation.java @@ -34,6 +34,7 @@ public class TestAccountInstallation /** * JUnit setup method. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -42,6 +43,7 @@ public class TestAccountInstallation /** * JUnit cleanup method. */ + @Override protected void tearDown() throws Exception { super.tearDown(); diff --git a/test/net/java/sip/communicator/slick/protocol/rss/TestAccountUninstallation.java b/test/net/java/sip/communicator/slick/protocol/rss/TestAccountUninstallation.java index b870448..e9b72bd 100755 --- a/test/net/java/sip/communicator/slick/protocol/rss/TestAccountUninstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/rss/TestAccountUninstallation.java @@ -38,6 +38,7 @@ public class TestAccountUninstallation * JUnit setup method. * @throws Exception in case anything goes wrong. */ + @Override public void setUp() throws Exception { super.setUp(); @@ -48,6 +49,7 @@ public class TestAccountUninstallation * JUnit teardown method. * @throws Exception in case anything goes wrong. */ + @Override public void tearDown() throws Exception { fixture.tearDown(); @@ -82,7 +84,7 @@ public class TestAccountUninstallation public void testInstallationPersistence() throws Exception { Bundle providerBundle = - fixture.findProtocolProviderBundle(fixture.provider); + RssSlickFixture.findProtocolProviderBundle(fixture.provider); //set the global providerBundle reference that we will be using //in the last series of tests (Account uninstallation persistency) @@ -104,7 +106,7 @@ public class TestAccountUninstallation //verify that the provider is no longer available ServiceReference providerRefs[] = null; try { - providerRefs = fixture.bc.getServiceReferences( + providerRefs = RssSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(&(" + ProtocolProviderFactory.PROTOCOL + "=" + ProtocolNames.RSS + "))"); @@ -124,21 +126,21 @@ public class TestAccountUninstallation fixture.provider.getAccountID()) == null); //reinstall provider - providerBundle = fixture.bc.installBundle(providerBundle.getLocation()); + providerBundle = RssSlickFixture.bc.installBundle(providerBundle.getLocation()); RssSlickFixture.providerBundle = providerBundle; assertTrue("Couldn't reinstall provider bundle", providerBundle.getState() == Bundle.INSTALLED); - AccountManagerUtils.startBundleAndWaitStoredAccountsLoaded(fixture.bc, + AccountManagerUtils.startBundleAndWaitStoredAccountsLoaded(RssSlickFixture.bc, providerBundle, ProtocolNames.RSS); assertTrue("Couldn't start provider", providerBundle.getState() == Bundle.ACTIVE); providerRefs = null; try { - providerRefs = fixture.bc.getServiceReferences( + providerRefs = RssSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(&(" + ProtocolProviderFactory.PROTOCOL + "=" + ProtocolNames.RSS + "))"); @@ -152,7 +154,7 @@ public class TestAccountUninstallation ServiceReference factoryRefs[] = null; try { - factoryRefs = fixture.bc.getServiceReferences( + factoryRefs = RssSlickFixture.bc.getServiceReferences( ProtocolProviderFactory.class.getName(), "(" + ProtocolProviderFactory.PROTOCOL + "=RSS)"); } catch (InvalidSyntaxException ise) @@ -161,9 +163,9 @@ public class TestAccountUninstallation } fixture.providerFactory = - (ProtocolProviderFactory) fixture.bc.getService(factoryRefs[0]); + (ProtocolProviderFactory) RssSlickFixture.bc.getService(factoryRefs[0]); fixture.provider = - (ProtocolProviderService) fixture.bc.getService(providerRefs[0]); + (ProtocolProviderService) RssSlickFixture.bc.getService(providerRefs[0]); assertFalse("RSS provider did not restore its own reference to the" + " provider that we just reinstalled.", @@ -190,7 +192,7 @@ public class TestAccountUninstallation ServiceReference[] providerRefs = null; try { - providerRefs = fixture.bc.getServiceReferences( + providerRefs = RssSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(" + ProtocolProviderFactory.PROTOCOL + "=" + ProtocolNames.RSS + ")"); 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 1d47cc1..d389a38 100755 --- a/test/net/java/sip/communicator/slick/protocol/rss/TestProtocolProviderServiceRssImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/rss/TestProtocolProviderServiceRssImpl.java @@ -55,6 +55,7 @@ public class TestProtocolProviderServiceRssImpl * * @throws Exception if <code>super.setUp()</code> throws one. */ + @Override public void setUp() throws Exception { super.setUp(); @@ -66,6 +67,7 @@ public class TestProtocolProviderServiceRssImpl * * @throws Exception if <code>fixture.tearDown()</code> fails. */ + @Override public void tearDown() throws Exception { fixture.tearDown(); diff --git a/test/net/java/sip/communicator/slick/protocol/rss/TestingServerThread.java b/test/net/java/sip/communicator/slick/protocol/rss/TestingServerThread.java index 03456b6..e5815be 100755 --- a/test/net/java/sip/communicator/slick/protocol/rss/TestingServerThread.java +++ b/test/net/java/sip/communicator/slick/protocol/rss/TestingServerThread.java @@ -57,6 +57,7 @@ public class TestingServerThread * connections on <code>serverSocket</code>, and upon a successful request * serves the file according to the <code>launcher</code>'s settings. */ + @Override public void run() { if (launcher.isActive()) diff --git a/test/net/java/sip/communicator/slick/protocol/sip/SipProtocolProviderServiceLick.java b/test/net/java/sip/communicator/slick/protocol/sip/SipProtocolProviderServiceLick.java index a046f99..daf5be8 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/SipProtocolProviderServiceLick.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/SipProtocolProviderServiceLick.java @@ -35,7 +35,7 @@ public class SipProtocolProviderServiceLick */ public static final String ACCOUNT_2_PREFIX = "accounts.sip.account2."; - + /** * The name of the property that indicates whether the user would like to * only run the offline tests. @@ -69,14 +69,14 @@ public class SipProtocolProviderServiceLick properties.put("service.pid", getName()); SipSlickFixture.bc = context; - + // verify whether the user wants to avoid online testing String offlineMode = System.getProperty( DISABLE_ONLINE_TESTS_PROPERTY_NAME, null); if (offlineMode != null && offlineMode.equalsIgnoreCase("true")) SipSlickFixture.onlineTestingDisabled = true; - + // xcap parsing tests addTest(TestXCapParse.suite()); @@ -90,7 +90,7 @@ public class SipProtocolProviderServiceLick //This must remain second as that's where the protocol would be //made to login/authenticate/signon its service provider. addTestSuite(TestProtocolProviderServiceSipImpl.class); - + // presence tests addTest(TestOperationSetPresence.suite()); @@ -99,10 +99,10 @@ public class SipProtocolProviderServiceLick { // persistent presence addTest(TestOperationSetPersistentPresence.suite()); - + //IM test addTest(TestOperationSetBasicInstantMessaging.suite()); - + // telephony addTestSuite(TestOperationSetBasicTelephonySipImpl.class); 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 7555a8f..6546cc1 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/SipSlickFixture.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/SipSlickFixture.java @@ -61,7 +61,7 @@ public class SipSlickFixture * The tested protocol provider factory. */ public ProtocolProviderFactory providerFactory = null; - + /** * Indicates whether the user has requested for online tests not to be run. * (e.g. due to lack of network connectivity or ... time constraints ;)). @@ -74,7 +74,7 @@ public class SipSlickFixture * the account uninstallation persistence testing. */ public static Bundle providerBundle = null; - + /** * A Hashtable containing group names mapped against array lists of buddy * screen names. This is a snapshot of the server stored buddy list for @@ -92,6 +92,7 @@ public class SipSlickFixture * @throws java.lang.Exception in case we meet problems while retrieving * protocol providers through OSGI */ + @Override public void setUp() throws Exception { @@ -168,6 +169,7 @@ public class SipSlickFixture /** * Un get service references used in here. */ + @Override public void tearDown() { bc.ungetService(provider1ServiceRef); diff --git a/test/net/java/sip/communicator/slick/protocol/sip/TestAccountInstallation.java b/test/net/java/sip/communicator/slick/protocol/sip/TestAccountInstallation.java index 4dc9fc3..a77a2e8 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestAccountInstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestAccountInstallation.java @@ -31,6 +31,7 @@ public class TestAccountInstallation * JUnit setup method. * @throws Exception in case anything goes wrong. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -40,6 +41,7 @@ public class TestAccountInstallation * JUnit teardown method. * @throws Exception in case anything goes wrong. */ + @Override protected void tearDown() throws Exception { super.tearDown(); @@ -257,7 +259,7 @@ public class TestAccountInstallation xCapServerUri); } - table.put(ProtocolProviderFactory.FORCE_P2P_MODE, + table.put(ProtocolProviderFactory.FORCE_P2P_MODE, Boolean.FALSE.toString()); return table; diff --git a/test/net/java/sip/communicator/slick/protocol/sip/TestAccountUninstallation.java b/test/net/java/sip/communicator/slick/protocol/sip/TestAccountUninstallation.java index ae29edf..29f552d 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestAccountUninstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestAccountUninstallation.java @@ -45,6 +45,7 @@ public class TestAccountUninstallation * JUnit setup method. * @throws Exception in case anything goes wrong. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -55,6 +56,7 @@ public class TestAccountUninstallation * JUnit teardown method. * @throws Exception in case anything goes wrong. */ + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -138,7 +140,7 @@ public class TestAccountUninstallation public void testInstallationPersistency() throws Exception { Bundle providerBundle - = fixture.findProtocolProviderBundle(fixture.provider1); + = SipSlickFixture.findProtocolProviderBundle(fixture.provider1); //set the global providerBundle reference that we will be using //in the last series of tests (Account uninstallation persistence) @@ -163,7 +165,7 @@ public class TestAccountUninstallation ServiceReference[] sipProviderRefs = null; try { - sipProviderRefs = fixture.bc.getServiceReferences( + sipProviderRefs = SipSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(&" + "(" + ProtocolProviderFactory.PROTOCOL @@ -194,7 +196,7 @@ public class TestAccountUninstallation == null); //Now reinstall the bundle - providerBundle = fixture.bc.installBundle(providerBundle.getLocation()); + providerBundle = SipSlickFixture.bc.installBundle(providerBundle.getLocation()); //set the global providerBundle reference that we will be using //in the last series of tests (Account uninstallation persistency) @@ -203,7 +205,7 @@ public class TestAccountUninstallation assertEquals("Couldn't re-install protocol provider bundle." , Bundle.INSTALLED, providerBundle.getState()); - AccountManagerUtils.startBundleAndWaitStoredAccountsLoaded(fixture.bc, + AccountManagerUtils.startBundleAndWaitStoredAccountsLoaded(SipSlickFixture.bc, providerBundle, ProtocolNames.SIP); assertEquals("Couldn't re-start protocol provider bundle." , Bundle.ACTIVE, providerBundle.getState()); @@ -212,7 +214,7 @@ public class TestAccountUninstallation //verify that the provider is no longer available try { - sipProviderRefs = fixture.bc.getServiceReferences( + sipProviderRefs = SipSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(&" + "(" + ProtocolProviderFactory.PROTOCOL @@ -234,7 +236,7 @@ public class TestAccountUninstallation ServiceReference[] sipFactoryRefs = null; try { - sipFactoryRefs = fixture.bc.getServiceReferences( + sipFactoryRefs = SipSlickFixture.bc.getServiceReferences( ProtocolProviderFactory.class.getName(), "(" + ProtocolProviderFactory.PROTOCOL + "=" +ProtocolNames.SIP + ")"); @@ -247,9 +249,9 @@ public class TestAccountUninstallation //we're the ones who've reinstalled the factory so it's our //responsibility to update the fixture. fixture.providerFactory - = (ProtocolProviderFactory)fixture.bc.getService(sipFactoryRefs[0]); + = (ProtocolProviderFactory)SipSlickFixture.bc.getService(sipFactoryRefs[0]); fixture.provider1 - = (ProtocolProviderService)fixture.bc.getService(sipProviderRefs[0]); + = (ProtocolProviderService)SipSlickFixture.bc.getService(sipProviderRefs[0]); //verify that the provider is also restored in the provider factory @@ -293,7 +295,7 @@ public class TestAccountUninstallation ServiceReference[] sipProviderRefs = null; try { - sipProviderRefs = fixture.bc.getServiceReferences( + sipProviderRefs = SipSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(" + ProtocolProviderFactory.PROTOCOL + "=" +ProtocolNames.SIP + ")"); diff --git a/test/net/java/sip/communicator/slick/protocol/sip/TestAutoProxyDetection.java b/test/net/java/sip/communicator/slick/protocol/sip/TestAutoProxyDetection.java index 3d1415f..a3bad92 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestAutoProxyDetection.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestAutoProxyDetection.java @@ -23,7 +23,7 @@ import net.java.sip.communicator.util.*; /**
* Tests all variations of automatic proxy detection through (simulated) DNS.
- *
+ *
* @author Ingo Bauersachs
*/
public class TestAutoProxyDetection
@@ -64,6 +64,7 @@ public class TestAutoProxyDetection private InetAddress ia4;
private TestedAutoProxyDetection apd;
+ @Override
public void setUp()
{
account = createMock(SipAccountID.class);
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 4d65f6c..04aaf6b 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetBasicInstantMessaging.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetBasicInstantMessaging.java @@ -44,6 +44,7 @@ public class TestOperationSetBasicInstantMessaging * Get a reference to the basic IM operation set. * @throws Exception if this is not a good day. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -116,6 +117,7 @@ public class TestOperationSetBasicInstantMessaging } + @Override protected void tearDown() throws Exception { super.tearDown(); diff --git a/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetBasicTelephonySipImpl.java b/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetBasicTelephonySipImpl.java index 8956f9a..5a317c1 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetBasicTelephonySipImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetBasicTelephonySipImpl.java @@ -44,6 +44,7 @@ public class TestOperationSetBasicTelephonySipImpl * JUnit setup method. * @throws Exception in case anything goes wrong. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -54,6 +55,7 @@ public class TestOperationSetBasicTelephonySipImpl * JUnit teardown method. * @throws Exception in case anything goes wrong. */ + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -886,6 +888,7 @@ public class TestOperationSetBasicTelephonySipImpl * * @param event the event containing the source call. */ + @Override public void peerStateChanged(CallPeerChangeEvent event) { synchronized(this) @@ -1009,6 +1012,7 @@ public class TestOperationSetBasicTelephonySipImpl * * @param event the event containing the source call. */ + @Override public void callStateChanged(CallChangeEvent event) { synchronized(this) 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 9b41f9f..7a3ad7f 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetPersistentPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetPersistentPresence.java @@ -68,6 +68,7 @@ public class TestOperationSetPersistentPresence return suite; } + @Override protected void setUp() throws Exception { super.setUp(); @@ -119,6 +120,7 @@ public class TestOperationSetPersistentPresence + "Operation Sets"); } + @Override protected void tearDown() throws Exception { this.fixture.tearDown(); @@ -143,7 +145,7 @@ public class TestOperationSetPersistentPresence + "Printing rootGroupContents=\n"+rootGroup.toString()); Hashtable<String, List<String>> expectedContactList - = fixture.preInstalledBuddyList; + = SipSlickFixture.preInstalledBuddyList; logger.debug("============== Expected Contact List ==================="); logger.debug(expectedContactList); 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 13b046e..c94d67e 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetPresence.java @@ -25,7 +25,7 @@ import net.java.sip.communicator.util.*; * we want run in a specific order like for example - postTestSubscribe() and * postTestUnsubscribe(). * <p> - * + * * @author Benoit Pradelle */ public class TestOperationSetPresence @@ -44,6 +44,7 @@ public class TestOperationSetPresence super(name); } + @Override protected void setUp() throws Exception { super.setUp(); @@ -77,7 +78,7 @@ public class TestOperationSetPresence Map<String, OperationSet> supportedOperationSets2 = this.fixture.provider2.getSupportedOperationSets(); - if (supportedOperationSets2 == null + if (supportedOperationSets2 == null || supportedOperationSets2.size() < 1) throw new NullPointerException( "No OperationSet implementations are supported by " @@ -99,6 +100,7 @@ public class TestOperationSetPresence } } + @Override protected void tearDown() throws Exception { super.tearDown(); @@ -176,11 +178,11 @@ public class TestOperationSetPresence { logger.trace(" --=== beginning state transition test ===--"); - PresenceStatus oldStatus = + PresenceStatus oldStatus = this.operationSetPresence2.getPresenceStatus(); - String oldStatusMessage = + String oldStatusMessage = this.operationSetPresence2.getCurrentStatusMessage(); - String newStatusMessage = + String newStatusMessage = this.statusMessageRoot + newStatus; logger.debug( "old status is=" + oldStatus.getStatusName() @@ -231,12 +233,12 @@ public class TestOperationSetPresence lock.wait(5000); } - PresenceStatus actualStatus = + PresenceStatus actualStatus = this.operationSetPresence1.queryContactStatus(this.fixture.userID2); // in case of switching to the OFFLINE state, the contact will appear // in the unknown state, not offline - if (newStatus.getStatus() != 0) { + if (newStatus.getStatus() != 0) { assertEquals("The underlying implementation did not switch to the " +"requested presence status.", newStatus, @@ -284,7 +286,7 @@ public class TestOperationSetPresence logger.debug("Pausing between state changes was interrupted", ex); } } - + /** * Verifies that querying status works fine. The tester agent would * change status and the operation set would have to return the right status @@ -330,7 +332,7 @@ public class TestOperationSetPresence PresenceStatus actualReturn = this.operationSetPresence1.queryContactStatus( this.fixture.userID2); - // in the case of setting the contact offline, it may appear in the + // in the case of setting the contact offline, it may appear in the // UNKNOWN state until the next poll if (status.getStatus() != 0) { assertEquals("Querying a " @@ -386,7 +388,7 @@ public class TestOperationSetPresence subEvt.getSourceProvider()); subEvtCollector.collectedEvents.clear(); - + // wait the resolution of the contact before continuing synchronized (subEvtCollector) { @@ -396,7 +398,7 @@ public class TestOperationSetPresence } subEvtCollector.collectedEvents.clear(); - + // wait to be sure that every responses for the subscribe have been // received Object lock = new Object(); @@ -405,11 +407,11 @@ public class TestOperationSetPresence logger.info("Will wait all subscription events to be received"); lock.wait(10000); } - + // make the user agent tester change its states and make sure we are // notified logger.debug("Testing presence notifications."); - PresenceStatus oldStatus = + PresenceStatus oldStatus = this.operationSetPresence2.getPresenceStatus(); PresenceStatus newStatus = getSampleStatus1(); @@ -419,7 +421,7 @@ public class TestOperationSetPresence if(oldStatus.equals(newStatus)){ newStatus = getSampleStatus2(); } - + logger.debug("trying to set status " + newStatus + " for contact 2"); //now do the actual status notification testing @@ -497,7 +499,7 @@ public class TestOperationSetPresence logger.info("Stopped waiting"); } } - + /** * Returns the online status with a highest connectivity index. * @@ -556,7 +558,7 @@ public class TestOperationSetPresence secondMostConnectedPresenceStatusInt) { secondMostConnectedPresenceStatus = supportedStatus; - secondMostConnectedPresenceStatusInt = + secondMostConnectedPresenceStatusInt = supportedStatus.getStatus(); } } @@ -617,9 +619,9 @@ public class TestOperationSetPresence // make the user agent tester change its states and make sure we don't // get notifications as we're now unsubscribed. logger.debug("Testing (lack of) presence notifications."); - PresenceStatus oldStatus = + PresenceStatus oldStatus = this.operationSetPresence2.getPresenceStatus(); - + PresenceStatus newStatus = getSampleStatus1(); //in case we are by any chance already in that status, we'll @@ -677,7 +679,7 @@ public class TestOperationSetPresence { synchronized(this) { - logger.debug("Collected evt(" + this.collectedPresEvents.size() + logger.debug("Collected evt(" + this.collectedPresEvents.size() + ")= " + evt); this.collectedPresEvents.add(evt); notifyAll(); @@ -708,7 +710,7 @@ public class TestOperationSetPresence synchronized(this) { if(this.collectedPresEvents.size() > 0){ - logger.trace("Change already received. " + + logger.trace("Change already received. " + this.collectedPresEvents); return; } @@ -804,7 +806,7 @@ public class TestOperationSetPresence { synchronized(this) { - logger.debug("Collected evt(" + this.collectedEvents.size() + + logger.debug("Collected evt(" + this.collectedEvents.size() + ")= " + evt); this.collectedEvents.add(evt); notifyAll(); @@ -820,7 +822,7 @@ public class TestOperationSetPresence { synchronized(this) { - logger.debug("Collected evt(" + this.collectedEvents.size() + + logger.debug("Collected evt(" + this.collectedEvents.size() + ")= " + evt); this.collectedEvents.add(evt); notifyAll(); @@ -853,7 +855,7 @@ public class TestOperationSetPresence { synchronized(this) { - logger.debug("Collected evt(" + this.collectedEvents.size() + logger.debug("Collected evt(" + this.collectedEvents.size() + ")= " + evt); this.collectedEvents.add(evt); notifyAll(); @@ -869,7 +871,7 @@ public class TestOperationSetPresence { synchronized(this) { - logger.debug("Collected evt(" + this.collectedEvents.size() + logger.debug("Collected evt(" + this.collectedEvents.size() + ")= " + evt); this.collectedEvents.add(evt); notifyAll(); @@ -885,7 +887,7 @@ public class TestOperationSetPresence { synchronized(this) { - logger.debug("Collected evt(" + this.collectedEvents.size() + logger.debug("Collected evt(" + this.collectedEvents.size() + ")= " + evt); this.collectedEvents.add(evt); notifyAll(); @@ -957,7 +959,7 @@ public class TestOperationSetPresence && this.status != evt.getNewStatus()) return; - logger.debug("Collected evt(" + this.collectedEvents.size() + logger.debug("Collected evt(" + this.collectedEvents.size() + ")= " + evt); this.collectedEvents.add(evt); notifyAll(); diff --git a/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetServerStoredInfo.java b/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetServerStoredInfo.java index 4647862..f419881 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetServerStoredInfo.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetServerStoredInfo.java @@ -57,6 +57,7 @@ public class TestOperationSetServerStoredInfo extends TestCase * * @throws Exception */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -111,6 +112,7 @@ public class TestOperationSetServerStoredInfo extends TestCase } } + @Override protected void tearDown() throws Exception { super.tearDown(); diff --git a/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetServerStoredInfoData.java b/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetServerStoredInfoData.java index 4de77c5..3763110 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetServerStoredInfoData.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestOperationSetServerStoredInfoData.java @@ -10,7 +10,7 @@ package net.java.sip.communicator.slick.protocol.sip; * Contains data for server stored info tests. * * @author Grigorii Balutsel - */ + */ public class TestOperationSetServerStoredInfoData { /** 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 ed3bfa0..876cf7c 100644 --- a/test/net/java/sip/communicator/slick/protocol/sip/TestProtocolProviderServiceSipImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/sip/TestProtocolProviderServiceSipImpl.java @@ -51,6 +51,7 @@ public class TestProtocolProviderServiceSipImpl * Initializes the fixture. * @throws Exception if super.setUp() throws one. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -61,6 +62,7 @@ public class TestProtocolProviderServiceSipImpl * Tears the fixture down. * @throws Exception if fixture.tearDown() fails. */ + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -305,18 +307,18 @@ public class TestProtocolProviderServiceSipImpl /** * Sets the userNameEditable property, which should indicate if the * user name could be changed by user or not. - * + * * @param isUserNameEditable indicates if the user name could be changed */ public void setUserNameEditable(boolean isUserNameEditable) { this.isUserNameEditable = isUserNameEditable; } - + /** * Indicates if the user name is currently editable, i.e. could be changed * by user or not. - * + * * @return <code>true</code> if the user name could be changed, * <code>false</code> - otherwise. */ diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountInstallation.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountInstallation.java index 08ad13a..0ea666a 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountInstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountInstallation.java @@ -30,6 +30,7 @@ public class TestAccountInstallation * JUnit setup method. * @throws Exception in case anything goes wrong. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -39,6 +40,7 @@ public class TestAccountInstallation * JUnit teardown method. * @throws Exception in case anything goes wrong. */ + @Override protected void tearDown() throws Exception { super.tearDown(); diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountUninstallation.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountUninstallation.java index 4e9ea05..1a77a49 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountUninstallation.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestAccountUninstallation.java @@ -8,6 +8,7 @@ package net.java.sip.communicator.slick.protocol.yahoo; import junit.framework.*; import net.java.sip.communicator.service.protocol.*; +import net.java.sip.communicator.slick.protocol.generic.*; import org.osgi.framework.*; @@ -39,6 +40,7 @@ public class TestAccountUninstallation * JUnit setup method. * @throws Exception in case anything goes wrong. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -49,6 +51,7 @@ public class TestAccountUninstallation * JUnit teardown method. * @throws Exception in case anything goes wrong. */ + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -83,7 +86,7 @@ public class TestAccountUninstallation public void testInstallationPersistency() throws Exception { Bundle providerBundle - = fixture.findProtocolProviderBundle(fixture.provider1); + = AdHocMultiUserChatSlickFixture.findProtocolProviderBundle(fixture.provider1); //set the global providerBundle reference that we will be using //in the last series of tests (Account uninstallation persistency) @@ -108,7 +111,7 @@ public class TestAccountUninstallation ServiceReference[] yahooProviderRefs = null; try { - yahooProviderRefs = fixture.bc.getServiceReferences( + yahooProviderRefs = AdHocMultiUserChatSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(&" + "(" + ProtocolProviderFactory.PROTOCOL @@ -139,7 +142,7 @@ public class TestAccountUninstallation == null); //Now reinstall the bundle - providerBundle = fixture.bc.installBundle(providerBundle.getLocation()); + providerBundle = AdHocMultiUserChatSlickFixture.bc.installBundle(providerBundle.getLocation()); //set the global providerBundle reference that we will be using //in the last series of tests (Account uninstallation persistency) @@ -148,7 +151,7 @@ public class TestAccountUninstallation assertEquals("Couldn't re-install protocol provider bundle." , Bundle.INSTALLED, providerBundle.getState()); - AccountManagerUtils.startBundleAndWaitStoredAccountsLoaded(fixture.bc, + AccountManagerUtils.startBundleAndWaitStoredAccountsLoaded(AdHocMultiUserChatSlickFixture.bc, providerBundle, ProtocolNames.YAHOO); assertEquals("Couldn't re-start protocol provider bundle." , Bundle.ACTIVE, providerBundle.getState()); @@ -157,7 +160,7 @@ public class TestAccountUninstallation //verify that the provider is no longer available try { - yahooProviderRefs = fixture.bc.getServiceReferences( + yahooProviderRefs = AdHocMultiUserChatSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(&" + "(" + ProtocolProviderFactory.PROTOCOL @@ -179,7 +182,7 @@ public class TestAccountUninstallation ServiceReference[] yahooFactoryRefs = null; try { - yahooFactoryRefs = fixture.bc.getServiceReferences( + yahooFactoryRefs = AdHocMultiUserChatSlickFixture.bc.getServiceReferences( ProtocolProviderFactory.class.getName(), "(" + ProtocolProviderFactory.PROTOCOL + "=" +ProtocolNames.YAHOO + ")"); @@ -192,9 +195,9 @@ public class TestAccountUninstallation //we're the ones who've reinstalled the factory so it's our //responsibility to update the fixture. fixture.providerFactory - = (ProtocolProviderFactory)fixture.bc.getService(yahooFactoryRefs[0]); + = (ProtocolProviderFactory)AdHocMultiUserChatSlickFixture.bc.getService(yahooFactoryRefs[0]); fixture.provider1 - = (ProtocolProviderService)fixture.bc.getService(yahooProviderRefs[0]); + = (ProtocolProviderService)AdHocMultiUserChatSlickFixture.bc.getService(yahooProviderRefs[0]); //verify that the provider is also restored in the provider factory @@ -243,7 +246,7 @@ public class TestAccountUninstallation ServiceReference[] yahooProviderRefs = null; try { - yahooProviderRefs = fixture.bc.getServiceReferences( + yahooProviderRefs = AdHocMultiUserChatSlickFixture.bc.getServiceReferences( ProtocolProviderService.class.getName(), "(" + ProtocolProviderFactory.PROTOCOL + "=" +ProtocolNames.YAHOO + ")"); diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetAdHocMultiUserChatYahooImpl.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetAdHocMultiUserChatYahooImpl.java index c8b40bb..2e0b294 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetAdHocMultiUserChatYahooImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetAdHocMultiUserChatYahooImpl.java @@ -14,15 +14,15 @@ import net.java.sip.communicator.slick.protocol.generic.*; /** * Tests for the Yahoo! ad-hoc multi-user chat operation set. - * + * * @author Valentin Martinet */ -public class TestOperationSetAdHocMultiUserChatYahooImpl +public class TestOperationSetAdHocMultiUserChatYahooImpl extends TestOperationSetAdHocMultiUserChat { /** * Creates the test with the specified method name. - * + * * @param name the name of the method to execute. */ public TestOperationSetAdHocMultiUserChatYahooImpl(String name) @@ -58,7 +58,7 @@ extends TestOperationSetAdHocMultiUserChat /** * Register the third testing account. - * + * * @throws OperationFailedException */ public void testRegisterAccount3() throws OperationFailedException @@ -68,24 +68,25 @@ extends TestOperationSetAdHocMultiUserChat System.getProperty( YahooProtocolProviderServiceLick.ACCOUNT_3_PREFIX + ProtocolProviderFactory.PASSWORD).toCharArray())); - - assertEquals(fixture.provider3.getRegistrationState(), + + assertEquals(fixture.provider3.getRegistrationState(), RegistrationState.REGISTERED); } - + /** * JUnit setUp method. - * @throws Exception - * - * @throws Exception + * @throws Exception + * + * @throws Exception */ - public void start() throws Exception + @Override + public void start() throws Exception { fixture = new YahooSlickFixture(); fixture.setUp(); // Supported operation sets by each protocol provider. - Map<String, OperationSet> + Map<String, OperationSet> supportedOpSets1, supportedOpSets2, supportedOpSets3; supportedOpSets1 = fixture.provider1.getSupportedOperationSets(); @@ -113,7 +114,7 @@ extends TestOperationSetAdHocMultiUserChat if (opSetPresence1 == null) throw new NullPointerException( - "An implementation of the service must provide an " + + "An implementation of the service must provide an " + "implementation of at least one of the PresenceOperationSets"); @@ -123,7 +124,7 @@ extends TestOperationSetAdHocMultiUserChat if (supportedOpSets2 == null || supportedOpSets2.size() < 1) throw new NullPointerException( - "No OperationSet implementations are supported by " + + "No OperationSet implementations are supported by " + "this implementation. "); opSetAHMUC2 = (OperationSetAdHocMultiUserChat) supportedOpSets2.get( @@ -138,7 +139,7 @@ extends TestOperationSetAdHocMultiUserChat if (opSetPresence2 == null) throw new NullPointerException( - "An implementation of the service must provide an " + + "An implementation of the service must provide an " + "implementation of at least one of the PresenceOperationSets"); @@ -148,7 +149,7 @@ extends TestOperationSetAdHocMultiUserChat if (supportedOpSets3 == null || supportedOpSets3.size() < 1) throw new NullPointerException( - "No OperationSet implementations are supported by " + + "No OperationSet implementations are supported by " + "this implementation. "); opSetAHMUC3 = (OperationSetAdHocMultiUserChat) supportedOpSets3.get( @@ -163,7 +164,7 @@ extends TestOperationSetAdHocMultiUserChat if (opSetPresence3 == null) throw new NullPointerException( - "An implementation of the service must provide an " + + "An implementation of the service must provide an " + "implementation of at least one of the PresenceOperationSets"); } 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 7c200de..f42263d 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetBasicInstantMessaging.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetBasicInstantMessaging.java @@ -44,6 +44,7 @@ public class TestOperationSetBasicInstantMessaging * Get a reference to the basic IM operation set. * @throws Exception if this is not a good day. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -116,6 +117,7 @@ public class TestOperationSetBasicInstantMessaging } + @Override protected void tearDown() throws Exception { super.tearDown(); @@ -208,7 +210,7 @@ public class TestOperationSetBasicInstantMessaging +" rootGroup.childContacts="+rootGroup.countContacts() + "rootGroup.childGroups="+rootGroup.countSubgroups() + "Printing rootGroupContents=\n"+rootGroup.toString()); - + String body = "This is an IM coming from the tester agent" + " on " + new Date().toString(); diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetFileTransferImpl.java b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetFileTransferImpl.java index 166f358..ab1414d 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetFileTransferImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetFileTransferImpl.java @@ -18,7 +18,7 @@ import org.osgi.framework.*; * Implementation for generic file transfer. * @author Damian Minkov */ -public class TestOperationSetFileTransferImpl +public class TestOperationSetFileTransferImpl extends TestOperationSetFileTransfer { private static final Logger logger = @@ -35,6 +35,7 @@ public class TestOperationSetFileTransferImpl private static Contact contact1 = null; private static Contact contact2 = null; + @Override public Contact getContact1() { if(contact1 == null) @@ -45,6 +46,7 @@ public class TestOperationSetFileTransferImpl return contact1; } + @Override public Contact getContact2() { if(contact2 == null) @@ -55,6 +57,7 @@ public class TestOperationSetFileTransferImpl return contact2; } + @Override public void start() throws Exception { @@ -130,6 +133,7 @@ public class TestOperationSetFileTransferImpl prepareContactList(); } + @Override public void stop() throws Exception { @@ -188,41 +192,49 @@ public class TestOperationSetFileTransferImpl } } + @Override public OperationSetFileTransfer getOpSetFilTransfer1() { return opSetFT1; } + @Override public OperationSetFileTransfer getOpSetFilTransfer2() { return opSetFT2; } + @Override public BundleContext getContext() { - return fixture.bc; + return AdHocMultiUserChatSlickFixture.bc; } + @Override public boolean enableTestSendAndReceive() { return true; } + @Override public boolean enableTestSenderCancelBeforeAccepted() { return true; } + @Override public boolean enableTestReceiverDecline() { return true; } + @Override public boolean enableTestReceiverCancelsWhileTransfering() { return true; } + @Override public boolean enableTestSenderCancelsWhileTransfering() { return true; 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 e4bc6e3..50b2b79 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPersistentPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPersistentPresence.java @@ -11,6 +11,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.slick.protocol.generic.*; import net.java.sip.communicator.util.*; /** @@ -65,6 +66,7 @@ public class TestOperationSetPersistentPresence return suite; } + @Override protected void setUp() throws Exception { super.setUp(); @@ -116,6 +118,7 @@ public class TestOperationSetPersistentPresence + "Operation Sets"); } + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -140,7 +143,7 @@ public class TestOperationSetPersistentPresence + "Printing rootGroupContents=\n"+rootGroup.toString()); Hashtable<String, List<String>> expectedContactList - = fixture.preInstalledBuddyList; + = AdHocMultiUserChatSlickFixture.preInstalledBuddyList; logger.debug("============== Expected Contact List ==================="); logger.debug(expectedContactList); 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 ef05fa9..06e2a66 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPresence.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetPresence.java @@ -37,7 +37,7 @@ public class TestOperationSetPresence private YahooSlickFixture fixture = new YahooSlickFixture(); private OperationSetPresence operationSetPresence1 = null; private OperationSetPresence operationSetPresence2 = null; - + private AuthHandler authHandler1 = null; private AuthHandler authHandler2 = null; @@ -46,6 +46,7 @@ public class TestOperationSetPresence super(name); } + @Override protected void setUp() throws Exception { super.setUp(); @@ -99,13 +100,13 @@ public class TestOperationSetPresence + "implementation of at least the one of the Presence " + "Operation Sets"); } - + if(authHandler1 == null) { authHandler1 = new AuthHandler(operationSetPresence1); operationSetPresence1.setAuthorizationHandler(authHandler1); } - + if(authHandler2 == null) { authHandler2 = new AuthHandler(operationSetPresence2); @@ -113,6 +114,7 @@ public class TestOperationSetPresence } } + @Override protected void tearDown() throws Exception { super.tearDown(); @@ -350,7 +352,7 @@ public class TestOperationSetPresence logger.debug("Testing Subscription and Subscription Event Dispatch."); dumplists(); - + SubscriptionEventCollector subEvtCollector = new SubscriptionEventCollector(); operationSetPresence1.addSubscriptionListener(subEvtCollector); @@ -410,15 +412,15 @@ public class TestOperationSetPresence .removeContactPresenceStatusListener(contactPresEvtCollector); } - // something happened. the friend is not added correctly will + // something happened. the friend is not added correctly will // try to remove it and add it again if(contactPresEvtCollector.collectedEvents.size() == 0) { logger.info("ATTENTION: Yahoo friend not added correctly will remove and add him again"); - + // remove it operationSetPresence1.unsubscribe(subEvt.getSourceContact()); - + // wait remove to be finished Object lock = new Object(); synchronized(lock){ @@ -426,7 +428,7 @@ public class TestOperationSetPresence lock.wait(3000); }catch (Exception e){} } - + // add it operationSetPresence1.addSubscriptionListener(subEvtCollector); subEvtCollector.collectedEvents.clear(); @@ -437,13 +439,13 @@ public class TestOperationSetPresence operationSetPresence1.removeSubscriptionListener(subEvtCollector); } subEvtCollector.collectedEvents.clear(); - + if(newStatus.equals(YahooStatusEnum.BUSY)){ newStatus = YahooStatusEnum.OUT_TO_LUNCH; } else newStatus = YahooStatusEnum.BUSY; - + // query it again for the status contactPresEvtCollector = new ContactPresenceEventCollector( fixture.userID2, newStatus); @@ -600,12 +602,12 @@ public class TestOperationSetPresence { o.wait(2000); } - + // wait for a moment // give time the impl to get the lists logger.debug("start clearing"); fixture.clearProvidersLists(); - + synchronized(o) { o.wait(3000); @@ -915,7 +917,7 @@ public class TestOperationSetPresence /** * AuthorizationHandler which accepts all requests! */ - private class AuthHandler + private class AuthHandler implements AuthorizationHandler { private OperationSetPresence opset = null; @@ -923,7 +925,7 @@ public class TestOperationSetPresence { this.opset = opset; } - + public AuthorizationResponse processAuthorisationRequest( AuthorizationRequest req, Contact sourceContact) { @@ -941,7 +943,7 @@ public class TestOperationSetPresence public void processAuthorizationResponse( AuthorizationResponse response, Contact sourceContact){} } - + private void dumplists() { // just wait a little all modification events to be received @@ -949,11 +951,11 @@ public class TestOperationSetPresence synchronized(o) { try{o.wait(3000);}catch (InterruptedException ex){} - } - + } + OperationSetPersistentPresence op1 = (OperationSetPersistentPresence)operationSetPresence1; OperationSetPersistentPresence op2 = (OperationSetPersistentPresence)operationSetPresence2; - + logger.info("------------ START DUMP LIST " + fixture.userID1 + " ------------"); ContactGroup rootGroup = op1.getServerStoredContactListRoot(); Iterator<ContactGroup> groups = rootGroup.subgroups(); @@ -961,7 +963,7 @@ public class TestOperationSetPresence { ContactGroup group = groups.next(); logger.info("group " + group.getGroupName()); - + Iterator<Contact> contactsIter = group.contacts(); while(contactsIter.hasNext()) { @@ -969,8 +971,8 @@ public class TestOperationSetPresence } } logger.info("------------ END DUMP LIST " + fixture.userID1 + " ------------"); - - + + logger.info("------------ START DUMP LIST " + fixture.userID2 + " ------------"); rootGroup = op2.getServerStoredContactListRoot(); groups = rootGroup.subgroups(); @@ -978,7 +980,7 @@ public class TestOperationSetPresence { ContactGroup group = groups.next(); logger.info("group " + group.getGroupName()); - + Iterator<Contact> contactsIter = group.contacts(); while(contactsIter.hasNext()) { 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 32aef18..c77a167 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetTypingNotifications.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestOperationSetTypingNotifications.java @@ -39,6 +39,7 @@ public class TestOperationSetTypingNotifications super(name); } + @Override protected void setUp() throws Exception { super.setUp(); @@ -166,6 +167,7 @@ public class TestOperationSetTypingNotifications } } + @Override protected void tearDown() throws Exception { super.tearDown(); 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 ad7feb0..2f63440 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/TestProtocolProviderServiceYahooImpl.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/TestProtocolProviderServiceYahooImpl.java @@ -38,7 +38,7 @@ public class TestProtocolProviderServiceYahooImpl */ public RegistrationEventCollector regEvtCollector2 = new RegistrationEventCollector(); - + /** * An event adapter that would collec registation state change events */ @@ -58,6 +58,7 @@ public class TestProtocolProviderServiceYahooImpl * Initializes the fixture. * @throws Exception if super.setUp() throws one. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -68,6 +69,7 @@ public class TestProtocolProviderServiceYahooImpl * Tears the fixture down. * @throws Exception if fixture.tearDown() fails. */ + @Override protected void tearDown() throws Exception { fixture.tearDown(); @@ -134,7 +136,7 @@ public class TestProtocolProviderServiceYahooImpl +"All events were: " + regEvtCollector2.collectedNewStates ,regEvtCollector2.collectedNewStates .contains(RegistrationState.REGISTERED)); - + fixture.provider1 .removeRegistrationStateChangeListener(regEvtCollector1); fixture.provider2 diff --git a/test/net/java/sip/communicator/slick/protocol/yahoo/YahooProtocolProviderServiceLick.java b/test/net/java/sip/communicator/slick/protocol/yahoo/YahooProtocolProviderServiceLick.java index 029925a..560be37 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/YahooProtocolProviderServiceLick.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/YahooProtocolProviderServiceLick.java @@ -36,7 +36,7 @@ public class YahooProtocolProviderServiceLick */ public static final String ACCOUNT_2_PREFIX = "accounts.yahoo.account2."; - + /** * The prefix used for property names containing settings for our third * testing account. @@ -96,7 +96,7 @@ public class YahooProtocolProviderServiceLick addTest(TestOperationSetTypingNotifications.suite()); addTestSuite(TestOperationSetFileTransferImpl.class); - + //addTest(TestOperationSetAdHocMultiUserChatYahooImpl.suite()); } 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 8d12dec..61c981b 100644 --- a/test/net/java/sip/communicator/slick/protocol/yahoo/YahooSlickFixture.java +++ b/test/net/java/sip/communicator/slick/protocol/yahoo/YahooSlickFixture.java @@ -15,7 +15,7 @@ import org.osgi.framework.*; * Contains fields and methods used by most or all tests in the yahoo slick. * * @author Damian Minkov - * @author Valentin Martinet + * @author Valentin Martinet */ public class YahooSlickFixture extends AdHocMultiUserChatSlickFixture @@ -27,14 +27,15 @@ public class YahooSlickFixture { super(); } - + /** * Initializes protocol provider references and whatever else there is to * initialize. - * + * * @throws InvalidSyntaxException in case we meet problems while retrieving * protocol providers through OSGI */ + @Override public void setUp() throws InvalidSyntaxException { // first obtain a reference to the provider factory @@ -66,7 +67,7 @@ public class YahooSlickFixture System.getProperty( YahooProtocolProviderServiceLick.ACCOUNT_2_PREFIX + ProtocolProviderFactory.USER_ID); - + userID3 = System.getProperty( YahooProtocolProviderServiceLick.ACCOUNT_3_PREFIX @@ -104,7 +105,7 @@ public class YahooSlickFixture , yahooProvider2Refs); assertTrue("No Protocol Provider was found for yahoo account2:"+userID2, yahooProvider2Refs.length > 0); - + ServiceReference[] yahooProvider3Refs = bc.getServiceReferences( ProtocolProviderService.class.getName(), diff --git a/test/net/java/sip/communicator/slick/runner/ScTestRunner.java b/test/net/java/sip/communicator/slick/runner/ScTestRunner.java index 1e52237..6e8f66e 100644 --- a/test/net/java/sip/communicator/slick/runner/ScTestRunner.java +++ b/test/net/java/sip/communicator/slick/runner/ScTestRunner.java @@ -60,21 +60,25 @@ public class ScTestRunner extends BaseTestRunner { * Always use the StandardTestSuiteLoader. Overridden from * BaseTestRunner. */ + @Override public TestSuiteLoader getLoader() { return new StandardTestSuiteLoader(); } + @Override public void testFailed(int status, Test test, Throwable t) { logger.debug("test " + test.toString() + " failed."); } + @Override public void testStarted(String testName) { logger.debug("started testName"+testName); } + @Override public void testEnded(String testName) { logger.debug("ended testName"+testName); @@ -156,6 +160,7 @@ public class ScTestRunner extends BaseTestRunner { } } + @Override protected void runFailed(String message) { System.err.println(message); diff --git a/test/net/java/sip/communicator/slick/runner/SipCommunicatorSlickRunner.java b/test/net/java/sip/communicator/slick/runner/SipCommunicatorSlickRunner.java index 57fbfe7..b3d7aa7 100644 --- a/test/net/java/sip/communicator/slick/runner/SipCommunicatorSlickRunner.java +++ b/test/net/java/sip/communicator/slick/runner/SipCommunicatorSlickRunner.java @@ -246,6 +246,7 @@ public class SipCommunicatorSlickRunner { obj = new TestCase("No id=" + id) { + @Override public void runTest() { throw new IllegalArgumentException("No test with id=" + @@ -257,6 +258,7 @@ public class SipCommunicatorSlickRunner { obj = new TestCase("Multiple id=" + id) { + @Override public void runTest() { throw new IllegalArgumentException( @@ -273,6 +275,7 @@ public class SipCommunicatorSlickRunner { obj = new TestCase("Bad filter syntax id=" + id) { + @Override public void runTest() { throw new IllegalArgumentException("Bad syntax id=" + id); @@ -285,6 +288,7 @@ public class SipCommunicatorSlickRunner final Object oldObj = obj; obj = new TestCase("ClassCastException") { + @Override public void runTest() { throw new ClassCastException("Service implements " + diff --git a/test/net/java/sip/communicator/slick/runner/XmlFormatter.java b/test/net/java/sip/communicator/slick/runner/XmlFormatter.java index b1a4d87..df17eaf 100644 --- a/test/net/java/sip/communicator/slick/runner/XmlFormatter.java +++ b/test/net/java/sip/communicator/slick/runner/XmlFormatter.java @@ -174,6 +174,7 @@ public class XmlFormatter extends ResultPrinter implements XMLConstants { * * <p>A new Test is started. */ + @Override public void startTest(Test test) { testStarts.put(test, new Long(System.currentTimeMillis())); @@ -184,6 +185,7 @@ public class XmlFormatter extends ResultPrinter implements XMLConstants { * * <p>A Test is finished. */ + @Override public void endTest(Test test) { // Fix for bug #5637 - if a junit.extensions.TestSetup is @@ -239,6 +241,7 @@ public class XmlFormatter extends ResultPrinter implements XMLConstants { * * <p>A Test failed. */ + @Override public void addFailure(Test test, AssertionFailedError t) { addFailure(test, (Throwable) t); @@ -249,6 +252,7 @@ public class XmlFormatter extends ResultPrinter implements XMLConstants { * * <p>An error occurred while running the test. */ + @Override public void addError(Test test, Throwable t) { formatError(ERROR, test, t); diff --git a/test/net/java/sip/communicator/slick/slickless/SlicklessTests.java b/test/net/java/sip/communicator/slick/slickless/SlicklessTests.java index 6c19767..97bfe90 100644 --- a/test/net/java/sip/communicator/slick/slickless/SlicklessTests.java +++ b/test/net/java/sip/communicator/slick/slickless/SlicklessTests.java @@ -62,7 +62,7 @@ public class SlicklessTests public void stop(BundleContext bundlecontext) throws Exception { } - + /** * allow these tests to be run directly under jUnit */ diff --git a/test/net/java/sip/communicator/slick/slickless/util/TestBase64.java b/test/net/java/sip/communicator/slick/slickless/util/TestBase64.java index 9c59360..20d1fa6 100644 --- a/test/net/java/sip/communicator/slick/slickless/util/TestBase64.java +++ b/test/net/java/sip/communicator/slick/slickless/util/TestBase64.java @@ -30,6 +30,7 @@ public class TestBase64 extends TestCase * Initializes the fixture. * @throws Exception if anything goes wrong. */ + @Override protected void setUp() throws Exception { super.setUp(); @@ -39,6 +40,7 @@ public class TestBase64 extends TestCase * Finalization * @throws Exception if anything goes wrong. */ + @Override protected void tearDown() throws Exception { super.tearDown(); diff --git a/test/net/java/sip/communicator/slick/slickless/util/xml/TestXMLUtils.java b/test/net/java/sip/communicator/slick/slickless/util/xml/TestXMLUtils.java index 87cb691..9cfb0b4 100644 --- a/test/net/java/sip/communicator/slick/slickless/util/xml/TestXMLUtils.java +++ b/test/net/java/sip/communicator/slick/slickless/util/xml/TestXMLUtils.java @@ -88,6 +88,7 @@ public class TestXMLUtils extends TestCase * Create a XML Document that will be used as a fixture in later testing. * @throws Exception if sth goes nuts */ + @Override protected void setUp() throws Exception { factory = @@ -107,6 +108,7 @@ public class TestXMLUtils extends TestCase * Standard JUnit tear down * @throws Exception ... don't know when */ + @Override protected void tearDown() throws Exception { super.tearDown(); |