testing - work in progress

cusax-fix
Emil Ivov 20 years ago
parent 9dae9ae07c
commit 9eca20c536

@ -79,7 +79,7 @@ public Iterator getChildContacts()
* Returns the contact with the specified identifier
*
* @param metaContactID a String identifier obtained through the
* <tt>MetaContact.getMetaContactID()</tt> method. <p>
* <tt>MetaContact.getMetaUID()</tt> method. <p>
* @return the <tt>MetaContact</tt> with the specified idnetifier.
*/
public MetaContact getMetaContact(String metaContactID)
@ -89,7 +89,7 @@ public MetaContact getMetaContact(String metaContactID)
{
MetaContact contact = (MetaContact)contactsIter.next();
if (contact.getMetaContactID().equals(metaContactID))
if (contact.getMetaUID().equals(metaContactID))
return contact;
}

@ -105,7 +105,7 @@ public Contact getDefaultContact()
*
* @return a String uniquely identifying this meta contact.
*/
public String getMetaContactID()
public String getMetaUID()
{
return uid;
}

@ -445,7 +445,7 @@ private void synchronizeOpSetWithLocalContactList(
/** @todo this shouldn't be that simple */
newMetaContact.setDisplayName(contact
.getAlias());
.getDisplayName());
newMetaGroup.addMetaContact(newMetaContact);
}
@ -466,7 +466,7 @@ private void synchronizeOpSetWithLocalContactList(
newMetaContact.addProtoContact(contact);
/** @todo this shouldn't be that simple */
newMetaContact.setDisplayName(contact.getAlias());
newMetaContact.setDisplayName(contact.getDisplayName());
rootMetaGroup.addMetaContact(newMetaContact);
@ -599,7 +599,7 @@ public void subscriptionCreated(SubscriptionEvent evt) {
.getSourceContact());
newMetaContact.setDisplayName(evt
.getSourceContact().getAlias());
.getSourceContact().getDisplayName());
parentGroup.addMetaContact(newMetaContact);
@ -663,7 +663,7 @@ public void groupCreated(ServerStoredGroupEvent evt) {
newMetaContact.addProtoContact(contact);
newMetaContact.setDisplayName(contact
.getAlias());
.getDisplayName());
newMetaGroup.addMetaContact(newMetaContact);
}

@ -92,7 +92,7 @@ public Iterator getChildContacts()
* Returns the contact with the specified identifier
*
* @param metaContactID a String identifier obtained through the
* <tt>MetaContact.getMetaContactID()</tt> method. <p>
* <tt>MetaContact.getMetaUID()</tt> method. <p>
* @return the <tt>MetaContact</tt> with the specified idnetifier.
*/
public MetaContact getMetaContact(String metaContactID)
@ -102,7 +102,7 @@ public MetaContact getMetaContact(String metaContactID)
{
MetaContact contact = (MetaContact)contactsIter.next();
if (contact.getMetaContactID().equals(metaContactID))
if (contact.getMetaUID().equals(metaContactID))
return contact;
}

@ -149,7 +149,7 @@ public PresenceStatus getPresenceStatus()
* @return a String that can be used for referring to this contact when
* interacting with the user.
*/
public String getAlias()
public String getDisplayName()
{
//temporarily return the uin as we don't have alias support in joust
//sim right now.

@ -28,7 +28,7 @@ public class TestMetaContactList
MclSlickFixture fixture = new MclSlickFixture(getClass().getName());
private static final Logger logger =
Logger.getLogger(TestOperationSetPersistentPresence.class);
Logger.getLogger(TestMetaContactList.class);
private OperationSetPersistentPresence opSetPersPresence;
@ -85,50 +85,79 @@ protected void tearDown() throws Exception
/**
* Verifies that the contacts retrieved by the meta contact list service,
* match those that were in the mock provider.
* matches the one that were in the mock provider.
*/
public void testContactListRetrieving()
{
ContactGroup root
ContactGroup expectedRoot
= opSetPersPresence.getServerStoredContactListRoot();
logger.debug("============== Predefined contact List ==============");
logger.debug("rootGroup="+root.getGroupName()
+" rootGroup.childContacts="+root.countContacts()
+ "rootGroup.childGroups="+root.countSubGroups()
+ "Printing rootGroupContents=\n"+root.toString());
logger.debug("rootGroup="+expectedRoot.getGroupName()
+" rootGroup.childContacts="+expectedRoot.countContacts()
+ "rootGroup.childGroups="+expectedRoot.countSubGroups()
+ " Printing rootGroupContents=\n"+expectedRoot.toString());
MetaContactGroup expectedRoot = fixture.metaClService.getRoot();
MetaContactGroup actualRoot = fixture.metaClService.getRoot();
logger.debug("================ Meta Contact List =================");
logger.debug("rootGroup="+expectedRoot.getGroupName()
+" rootGroup.childContacts="+expectedRoot.countChildContacts()
+ "rootGroup.childGroups="+expectedRoot.countSubgroups()
+ "Printing rootGroupContents=\n"+expectedRoot.toString());
Iterator groups = root.subGroups();
while (groups.hasNext() ){
ContactGroup group = (ContactGroup)groups.next();
MetaContactGroup expectedGroup
= expectedRoot
.getMetaContactSubgroup(group.getGroupName());
assertNotNull("Group " + group.getGroupName() + " was returned by "
+"the server but was not in the expected contact list."
, expectedGroup );
Iterator contactsIter = group.contacts();
while (contactsIter.hasNext()){
String contactID = ((Contact)contactsIter.next()).getAddress();
MetaContact expectedContact
= expectedGroup.getMetaContact(contactID);
assertNotNull("Contact " + contactID + " was returned by "
+"the server but was not in the expected contact list."
, expectedContact );
logger.debug("rootGroup="+actualRoot.getGroupName()
+" rootGroup.childContacts="+actualRoot.countChildContacts()
+ " rootGroup.childGroups="+actualRoot.countSubgroups()
+ " Printing rootGroupContents=\n"+actualRoot.toString());
Iterator expectedSubgroups = expectedRoot.subGroups();
//loop over mock groups and check whether they've all been added
//to the meta contact list.
while (expectedSubgroups.hasNext() ){
ContactGroup expectedGroup = (ContactGroup)expectedSubgroups.next();
MetaContactGroup actualGroup
= actualRoot
.getMetaContactSubgroup(expectedGroup.getGroupName());
assertNotNull("Group " + expectedGroup.getGroupName() + " was "
+ "returned by the MetaContactListService implementation "
+ "but was not in the expected contact list."
, actualGroup );
assertEquals("Group " + expectedGroup.getGroupName()
+ " did not have the expected number of member contacts"
, expectedGroup.countContacts()
, actualGroup.countChildContacts() );
assertEquals("Group " + expectedGroup.getGroupName()
+ " did not have the expected number of member contacts"
, expectedGroup.countContacts()
, actualGroup.countChildContacts() );
assertEquals("Group " + expectedGroup.getGroupName()
+ " did not have the expected number of sub groups"
, expectedGroup.countSubGroups()
, actualGroup.countSubgroups() );
Iterator actualContactsIter = actualGroup.getChildContacts();
//check whether every contact in the meta list exists in the source
//mock provider contact list.
while (actualContactsIter.hasNext()){
MetaContact actualMetaContact
= (MetaContact)actualContactsIter.next();
Contact actualProtoContact
= actualMetaContact.getContactForProvider(
MclSlickFixture.mockProvider);
Contact expectedProtoContact
= expectedGroup.getContact(actualProtoContact.getAddress());
assertNotNull("Contact " + actualMetaContact.getDisplayName()
+ " was returned by "
+ "the MetaContactListService implementation but was "
+ "not in the expected contact list."
, expectedProtoContact );
}
}
}

Loading…
Cancel
Save