mirror of
https://github.com/moparisthebest/davmail
synced 2025-02-28 09:21:49 -05:00
Carddav: handle param values as parameter list
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1208 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
7419375ab7
commit
1406d34ee3
@ -73,7 +73,12 @@ public class VCardReader extends ICSBufferedReader {
|
||||
if (params == null) {
|
||||
params = new HashMap<String, Set<String>>();
|
||||
}
|
||||
params.put(paramName, paramValues);
|
||||
if (params.get(paramName) == null) {
|
||||
params.put(paramName, paramValues);
|
||||
} else {
|
||||
params.get(paramName).addAll(paramValues);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void addValue(String value) {
|
||||
|
@ -18,14 +18,12 @@
|
||||
*/
|
||||
package davmail.exchange;
|
||||
|
||||
import davmail.Settings;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -295,22 +293,21 @@ public class TestExchangeSessionContact extends AbstractExchangeSessionTestCase
|
||||
|
||||
}
|
||||
|
||||
public void testSearchPublicContacts() throws IOException {
|
||||
String folderPath = Settings.getProperty("davmail.publicContactFolder");
|
||||
List<ExchangeSession.Contact> contacts = session.searchContacts(folderPath, ExchangeSession.CONTACT_ATTRIBUTES, null);
|
||||
int count = 0;
|
||||
for (ExchangeSession.Contact contact : contacts) {
|
||||
System.out.println("Contact "+(++count)+ '/' +contacts.size()+session.getItem(folderPath, contact.getName()));
|
||||
}
|
||||
public void testMultipleTypesParamName() throws IOException {
|
||||
ExchangeSession.Contact contact = (ExchangeSession.Contact) session.getItem("testcontactfolder", itemName);
|
||||
|
||||
VCardWriter vCardWriter = new VCardWriter();
|
||||
vCardWriter.startCard();
|
||||
vCardWriter.appendProperty("TEL;TYPE=CELL;TYPE=PREF", "mobile");
|
||||
vCardWriter.endCard();
|
||||
|
||||
ExchangeSession.ItemResult result = session.createOrUpdateContact("testcontactfolder", itemName, vCardWriter.toString(), contact.etag, null);
|
||||
assertEquals(200, result.status);
|
||||
|
||||
contact = (ExchangeSession.Contact) session.getItem("testcontactfolder", itemName);
|
||||
|
||||
assertEquals("mobile", contact.get("mobile"));
|
||||
|
||||
}
|
||||
|
||||
public void testSearchPublicContactsWithPicture() throws IOException {
|
||||
String folderPath = Settings.getProperty("davmail.publicContactFolder");
|
||||
List<ExchangeSession.Contact> contacts = session.searchContacts(folderPath, ExchangeSession.CONTACT_ATTRIBUTES, session.isTrue("haspicture"));
|
||||
int count = 0;
|
||||
for (ExchangeSession.Contact contact : contacts) {
|
||||
System.out.println("Contact "+(++count)+ '/' +contacts.size()+contact.getBody());
|
||||
assertNotNull(session.getContactPhoto(contact));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* DavMail POP/IMAP/SMTP/CalDav/LDAP Exchange Gateway
|
||||
* Copyright (C) 2010 Mickael Guessant
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
package davmail.exchange;
|
||||
|
||||
import davmail.Settings;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Test contact search.
|
||||
*/
|
||||
@SuppressWarnings({"UseOfSystemOutOrSystemErr"})
|
||||
public class TestExchangeSessionSearchContact extends AbstractExchangeSessionTestCase {
|
||||
public void testSearchPublicContacts() throws IOException {
|
||||
String folderPath = Settings.getProperty("davmail.publicContactFolder");
|
||||
List<ExchangeSession.Contact> contacts = session.searchContacts(folderPath, ExchangeSession.CONTACT_ATTRIBUTES, null);
|
||||
int count = 0;
|
||||
for (ExchangeSession.Contact contact : contacts) {
|
||||
System.out.println("Contact " + (++count) + '/' + contacts.size() + session.getItem(folderPath, contact.getName()));
|
||||
}
|
||||
}
|
||||
|
||||
public void testSearchPublicContactsWithPicture() throws IOException {
|
||||
String folderPath = Settings.getProperty("davmail.publicContactFolder");
|
||||
List<ExchangeSession.Contact> contacts = session.searchContacts(folderPath, ExchangeSession.CONTACT_ATTRIBUTES, session.isTrue("haspicture"));
|
||||
int count = 0;
|
||||
for (ExchangeSession.Contact contact : contacts) {
|
||||
System.out.println("Contact " + (++count) + '/' + contacts.size() + contact.getBody());
|
||||
assertNotNull(session.getContactPhoto(contact));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user