aboutsummaryrefslogtreecommitdiffstats
path: root/test/net/java/sip/communicator/slick/contactlist
diff options
context:
space:
mode:
authorLyubomir Marinov <lyubomir.marinov@jitsi.org>2013-05-23 18:50:35 +0300
committerLyubomir Marinov <lyubomir.marinov@jitsi.org>2013-05-23 18:50:35 +0300
commitb211c26d6c8f51a75d3b64b6092284c3847a3a8a (patch)
treea51b7d816a27f8db492cf9c44f998e2da8176635 /test/net/java/sip/communicator/slick/contactlist
parent24e81b82808681c6b5741b14048ef58c4e665e37 (diff)
downloadjitsi-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/slick/contactlist')
-rw-r--r--test/net/java/sip/communicator/slick/contactlist/MclSlickFixture.java2
-rw-r--r--test/net/java/sip/communicator/slick/contactlist/TestMetaContact.java20
-rw-r--r--test/net/java/sip/communicator/slick/contactlist/TestMetaContactGroup.java31
-rw-r--r--test/net/java/sip/communicator/slick/contactlist/TestMetaContactList.java99
-rw-r--r--test/net/java/sip/communicator/slick/contactlist/TestMetaContactListPersistence.java76
-rw-r--r--test/net/java/sip/communicator/slick/contactlist/TestSupportForMultipleProviders.java46
6 files changed, 149 insertions, 125 deletions
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);
}