1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 03:02:22 -05:00

CARDDAV: Update contact test

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1577 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-12-12 20:02:08 +00:00
parent fc43e5b082
commit 80712f6063

View File

@ -71,8 +71,8 @@ public class TestExchangeSessionContact extends AbstractExchangeSessionTestCase
vCardWriter.appendProperty("ADR;TYPE=other", "otherpostofficebox", null, "otherstreet", "othercity", "otherstate", "otherpostalcode", "othercountry");
vCardWriter.appendProperty("EMAIL;TYPE=work", "email1@local.net");
//vCardWriter.appendProperty("EMAIL;TYPE=home", "email2@local.net");
//vCardWriter.appendProperty("EMAIL;TYPE=other", "email3@local.net");
vCardWriter.appendProperty("EMAIL;TYPE=home", "email2@local.net");
vCardWriter.appendProperty("EMAIL;TYPE=other", "email3@local.net");
vCardWriter.appendProperty("ORG", "o", "department");
@ -266,6 +266,24 @@ public class TestExchangeSessionContact extends AbstractExchangeSessionTestCase
assertNull(session.getContactPhoto(contact));
}
public void testUpdateEmail() throws IOException {
ExchangeSession.Contact contact = getCurrentContact();
VCardWriter vCardWriter = new VCardWriter();
vCardWriter.startCard();
vCardWriter.appendProperty("EMAIL;TYPE=work", "email1.test@local.net");
vCardWriter.endCard();
ExchangeSession.ItemResult result = session.createOrUpdateContact("testcontactfolder", itemName, vCardWriter.toString(), contact.etag, null);
assertEquals(200, result.status);
contact = getCurrentContact();
assertEquals("email1.test@local.net", contact.get("smtpemail1"));
}
public void testUpperCaseParamName() throws IOException {
ExchangeSession.Contact contact = getCurrentContact();
@ -467,4 +485,12 @@ public class TestExchangeSessionContact extends AbstractExchangeSessionTestCase
assertEquals("common name", contact.get("cn"));
}
public void testPagingSearchContacts() throws IOException {
int maxCount = 0;
List<ExchangeSession.Contact> contacts = session.searchContacts(ExchangeSession.CONTACTS, ExchangeSession.CONTACT_ATTRIBUTES, null, maxCount);
int folderSize = contacts.size();
assertEquals(50, session.searchContacts(ExchangeSession.CONTACTS, ExchangeSession.CONTACT_ATTRIBUTES, null, 50).size());
assertEquals(folderSize, session.searchContacts(ExchangeSession.CONTACTS, ExchangeSession.CONTACT_ATTRIBUTES, null, folderSize+1).size());
}
}