From fddab4b8125174cb6000afdb56a0cffb868bac43 Mon Sep 17 00:00:00 2001 From: mguessan Date: Tue, 27 Jul 2010 13:19:28 +0000 Subject: [PATCH] EWS: rename equals to isEqualTo and format search date git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1300 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- .../davmail/exchange/ExchangeSession.java | 36 +++++++++---------- .../exchange/dav/DavExchangeSession.java | 33 ++++++++++++----- .../exchange/ews/EwsExchangeSession.java | 33 ++++++++++++----- src/java/davmail/imap/ImapConnection.java | 4 +-- src/java/davmail/ldap/LdapConnection.java | 4 +-- src/test/davmail/caldav/TestCaldav.java | 2 +- .../exchange/TestExchangeSessionMessage.java | 6 ++-- .../TestExchangeSessionSearchContact.java | 2 +- .../exchange/dav/TestDavExchangeSession.java | 4 +-- src/test/davmail/smtp/TestSmtp.java | 2 +- 10 files changed, 76 insertions(+), 50 deletions(-) diff --git a/src/java/davmail/exchange/ExchangeSession.java b/src/java/davmail/exchange/ExchangeSession.java index a4633048..15619691 100644 --- a/src/java/davmail/exchange/ExchangeSession.java +++ b/src/java/davmail/exchange/ExchangeSession.java @@ -116,9 +116,9 @@ public abstract class ExchangeSession { private final String userName; private boolean disableGalLookup; - private static final String YYYY_MM_DD_HH_MM_SS = "yyyy/MM/dd HH:mm:ss"; + protected static final String YYYY_MM_DD_HH_MM_SS = "yyyy/MM/dd HH:mm:ss"; private static final String YYYYMMDD_T_HHMMSS_Z = "yyyyMMdd'T'HHmmss'Z'"; - private static final String YYYY_MM_DD_T_HHMMSS_Z = "yyyy-MM-dd'T'HH:mm:ss'Z'"; + protected static final String YYYY_MM_DD_T_HHMMSS_Z = "yyyy-MM-dd'T'HH:mm:ss'Z'"; private static final String YYYY_MM_DD = "yyyy-MM-dd"; private static final String YYYY_MM_DD_T_HHMMSS_SSS_Z = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"; @@ -193,11 +193,7 @@ public abstract class ExchangeSession { * @param date date object * @return formatted search date */ - public static String formatSearchDate(Date date) { - SimpleDateFormat dateFormatter = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS, Locale.ENGLISH); - dateFormatter.setTimeZone(GMT_TIMEZONE); - return dateFormatter.format(date); - } + public abstract String formatSearchDate(Date date); /** * Return standard zulu date formatter. @@ -762,7 +758,7 @@ public abstract class ExchangeSession { * @param value attribute value * @return condition */ - public abstract Condition equals(String attributeName, String value); + public abstract Condition isEqualTo(String attributeName, String value); /** * Equals condition. @@ -771,7 +767,7 @@ public abstract class ExchangeSession { * @param value attribute value * @return condition */ - public abstract Condition equals(String attributeName, int value); + public abstract Condition isEqualTo(String attributeName, int value); /** * MIME header equals condition. @@ -780,7 +776,7 @@ public abstract class ExchangeSession { * @param value attribute value * @return condition */ - public abstract Condition headerEquals(String headerName, String value); + public abstract Condition headerIsEqualTo(String headerName, String value); /** * Greater than or equals condition. @@ -870,7 +866,7 @@ public abstract class ExchangeSession { * @throws IOException on error */ public List getSubFolders(String folderName, boolean recursive) throws IOException { - return getSubFolders(folderName, or(equals("folderclass", "IPF.Note"), isNull("folderclass")), + return getSubFolders(folderName, or(isEqualTo("folderclass", "IPF.Note"), isNull("folderclass")), recursive); } @@ -883,7 +879,7 @@ public abstract class ExchangeSession { * @throws IOException on error */ public List getSubCalendarFolders(String folderName, boolean recursive) throws IOException { - return getSubFolders(folderName, equals("folderclass", "IPF.Appointment"), recursive); + return getSubFolders(folderName, isEqualTo("folderclass", "IPF.Appointment"), recursive); } /** @@ -939,7 +935,7 @@ public abstract class ExchangeSession { */ public void sendMessage(List rcptToRecipients, MimeMessage mimeMessage) throws IOException, MessagingException { // check Sent folder for duplicates - ExchangeSession.MessageList messages = searchMessages(SENT, headerEquals("message-id", mimeMessage.getMessageID())); + ExchangeSession.MessageList messages = searchMessages(SENT, headerIsEqualTo("message-id", mimeMessage.getMessageID())); if (!messages.isEmpty()) { LOGGER.debug("Dropping message id " + mimeMessage.getMessageID() + ": already sent"); } else { @@ -2521,7 +2517,7 @@ public abstract class ExchangeSession { * @throws IOException on error */ public List getAllContacts(String folderPath) throws IOException { - return searchContacts(folderPath, ITEM_PROPERTIES, equals("outlookmessageclass", "IPM.Contact")); + return searchContacts(folderPath, ITEM_PROPERTIES, isEqualTo("outlookmessageclass", "IPM.Contact")); } @@ -2545,7 +2541,7 @@ public abstract class ExchangeSession { */ public List getEventMessages(String folderPath) throws IOException { return searchEvents(folderPath, ITEM_PROPERTIES, - and(equals("outlookmessageclass", "IPM.Schedule.Meeting.Request"), + and(isEqualTo("outlookmessageclass", "IPM.Schedule.Meeting.Request"), or(isNull("processed"), isFalse("processed")))); } @@ -2587,7 +2583,7 @@ public abstract class ExchangeSession { if (timeRangeEnd != null) { andCondition.add(lte("dtend", formatSearchDate(parser.parse(timeRangeEnd)))); } - andCondition.add(equals("instancetype", 0)); + andCondition.add(isEqualTo("instancetype", 0)); return searchEvents(folderPath, ITEM_PROPERTIES, andCondition); } catch (ParseException e) { throw new IOException(e); @@ -2607,14 +2603,14 @@ public abstract class ExchangeSession { Condition privateCondition = null; if (isSharedFolder(folderPath)) { LOGGER.debug("Shared or public calendar: exclude private events"); - privateCondition = equals("sensitivity", 0); + privateCondition = isEqualTo("sensitivity", 0); } // instancetype 0 single appointment / 1 master recurring appointment return searchEvents(folderPath, ITEM_PROPERTIES, and(or(isNull("instancetype"), - equals("instancetype", 1), - and(equals("instancetype", 0), dateCondition)), - equals("outlookmessageclass", "IPM.Appointment"), + isEqualTo("instancetype", 1), + and(isEqualTo("instancetype", 0), dateCondition)), + isEqualTo("outlookmessageclass", "IPM.Appointment"), privateCondition)); } diff --git a/src/java/davmail/exchange/dav/DavExchangeSession.java b/src/java/davmail/exchange/dav/DavExchangeSession.java index 75170034..18a55fec 100644 --- a/src/java/davmail/exchange/dav/DavExchangeSession.java +++ b/src/java/davmail/exchange/dav/DavExchangeSession.java @@ -51,6 +51,7 @@ import java.net.NoRouteToHostException; import java.net.URL; import java.net.UnknownHostException; import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.*; import java.util.zip.GZIPInputStream; @@ -501,17 +502,17 @@ public class DavExchangeSession extends ExchangeSession { } @Override - public Condition equals(String attributeName, String value) { + public Condition isEqualTo(String attributeName, String value) { return new AttributeCondition(attributeName, Operator.IsEqualTo, value); } @Override - public Condition equals(String attributeName, int value) { + public Condition isEqualTo(String attributeName, int value) { return new AttributeCondition(attributeName, Operator.IsEqualTo, value); } @Override - public Condition headerEquals(String headerName, String value) { + public Condition headerIsEqualTo(String headerName, String value) { return new HeaderCondition(headerName, Operator.IsEqualTo, value); } @@ -648,7 +649,7 @@ public class DavExchangeSession extends ExchangeSession { } else if (status == HttpStatus.SC_NOT_FOUND) { LOGGER.debug("Contact not found at " + encodedHref + ", searching permanenturl by urlcompname"); // failover, search item by urlcompname - MultiStatusResponse[] responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, DavExchangeSession.this.equals("urlcompname", convertItemNameToEML(itemName)), FolderQueryTraversal.Shallow); + MultiStatusResponse[] responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, DavExchangeSession.this.isEqualTo("urlcompname", convertItemNameToEML(itemName)), FolderQueryTraversal.Shallow); if (responses.length == 1) { encodedHref = getPropertyIfExists(responses[0].getProperties(HttpStatus.SC_OK), "permanenturl"); LOGGER.warn("Contact found, permanenturl is " + encodedHref); @@ -861,7 +862,7 @@ public class DavExchangeSession extends ExchangeSession { } else if (status == HttpStatus.SC_NOT_FOUND) { LOGGER.debug("Event not found at " + encodedHref + ", searching permanenturl by urlcompname"); // failover, search item by urlcompname - MultiStatusResponse[] responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, DavExchangeSession.this.equals("urlcompname", convertItemNameToEML(itemName)), FolderQueryTraversal.Shallow); + MultiStatusResponse[] responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, DavExchangeSession.this.isEqualTo("urlcompname", convertItemNameToEML(itemName)), FolderQueryTraversal.Shallow); if (responses.length == 1) { encodedHref = getPropertyIfExists(responses[0].getProperties(HttpStatus.SC_OK), "permanenturl"); LOGGER.warn("Event found, permanenturl is " + encodedHref); @@ -1182,7 +1183,7 @@ public class DavExchangeSession extends ExchangeSession { public List searchContacts(String folderPath, Set attributes, Condition condition) throws IOException { List contacts = new ArrayList(); MultiStatusResponse[] responses = searchItems(folderPath, attributes, - and(equals("outlookmessageclass", "IPM.Contact"), isFalse("isfolder"), isFalse("ishidden"), condition), + and(isEqualTo("outlookmessageclass", "IPM.Contact"), isFalse("isfolder"), isFalse("ishidden"), condition), FolderQueryTraversal.Shallow); for (MultiStatusResponse response : responses) { contacts.add(new Contact(response)); @@ -1267,7 +1268,7 @@ public class DavExchangeSession extends ExchangeSession { } catch (HttpNotFoundException e) { LOGGER.debug(itemPath + " not found, searching by urlcompname"); // failover: try to get event by displayname - responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, equals("urlcompname", emlItemName), FolderQueryTraversal.Shallow); + responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, isEqualTo("urlcompname", emlItemName), FolderQueryTraversal.Shallow); if (responses.length == 0) { throw new HttpNotFoundException(itemPath + " not found"); } @@ -1277,7 +1278,7 @@ public class DavExchangeSession extends ExchangeSession { String urlcompname = getPropertyIfExists(responses[0].getProperties(HttpStatus.SC_OK), "urlcompname"); if ("urn:content-classes:person".equals(contentClass)) { // retrieve Contact properties - List contacts = searchContacts(folderPath, CONTACT_ATTRIBUTES, equals("urlcompname", urlcompname)); + List contacts = searchContacts(folderPath, CONTACT_ATTRIBUTES, isEqualTo("urlcompname", urlcompname)); if (contacts.isEmpty()) { LOGGER.warn("Item found, but unable to build contact"); throw new HttpNotFoundException(itemPath + " not found"); @@ -1453,7 +1454,7 @@ public class DavExchangeSession extends ExchangeSession { Set attributes = new HashSet(); attributes.add("roamingdictionary"); - MultiStatusResponse[] responses = searchItems("/users/" + getEmail() + "/NON_IPM_SUBTREE", attributes, equals("messageclass", "IPM.Configuration.OWA.UserOptions"), DavExchangeSession.FolderQueryTraversal.Deep); + MultiStatusResponse[] responses = searchItems("/users/" + getEmail() + "/NON_IPM_SUBTREE", attributes, isEqualTo("messageclass", "IPM.Configuration.OWA.UserOptions"), DavExchangeSession.FolderQueryTraversal.Deep); if (responses.length == 1) { byte[] roamingdictionary = getBinaryPropertyIfExists(responses[0].getProperties(HttpStatus.SC_OK), "roamingdictionary"); if (roamingdictionary != null) { @@ -1742,4 +1743,18 @@ public class DavExchangeSession extends ExchangeSession { } return zuluDateValue; } + + /** + * Format date to exchange search format. + * + * @param date date object + * @return formatted search date + */ + @Override + public String formatSearchDate(Date date) { + SimpleDateFormat dateFormatter = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS, Locale.ENGLISH); + dateFormatter.setTimeZone(GMT_TIMEZONE); + return dateFormatter.format(date); + } + } diff --git a/src/java/davmail/exchange/ews/EwsExchangeSession.java b/src/java/davmail/exchange/ews/EwsExchangeSession.java index 1e6f7f43..0c479d85 100644 --- a/src/java/davmail/exchange/ews/EwsExchangeSession.java +++ b/src/java/davmail/exchange/ews/EwsExchangeSession.java @@ -36,6 +36,7 @@ import java.net.HttpURLConnection; import java.net.NoRouteToHostException; import java.net.UnknownHostException; import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.*; /** @@ -428,17 +429,17 @@ public class EwsExchangeSession extends ExchangeSession { } @Override - public Condition equals(String attributeName, String value) { + public Condition isEqualTo(String attributeName, String value) { return new AttributeCondition(attributeName, Operator.IsEqualTo, value); } @Override - public Condition equals(String attributeName, int value) { + public Condition isEqualTo(String attributeName, int value) { return new AttributeCondition(attributeName, Operator.IsEqualTo, String.valueOf(value)); } @Override - public Condition headerEquals(String headerName, String value) { + public Condition headerIsEqualTo(String headerName, String value) { return new HeaderCondition(headerName, Operator.IsEqualTo, value); } @@ -714,7 +715,7 @@ public class EwsExchangeSession extends ExchangeSession { String currentEtag = null; ItemId currentItemId = null; FileAttachment currentFileAttachment = null; - List responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, EwsExchangeSession.this.equals("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW); + List responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, EwsExchangeSession.this.isEqualTo("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW); if (!responses.isEmpty()) { EWSMethod.Item response = responses.get(0); currentItemId = new ItemId(response); @@ -836,7 +837,7 @@ public class EwsExchangeSession extends ExchangeSession { String urlcompname = convertItemNameToEML(itemName); String currentEtag = null; ItemId currentItemId = null; - List responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, EwsExchangeSession.this.equals("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW); + List responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, EwsExchangeSession.this.isEqualTo("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW); if (!responses.isEmpty()) { EWSMethod.Item response = responses.get(0); currentItemId = new ItemId(response); @@ -952,14 +953,14 @@ public class EwsExchangeSession extends ExchangeSession { @Override public Item getItem(String folderPath, String itemName) throws IOException { String urlcompname = convertItemNameToEML(itemName); - List responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, equals("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW); + List responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, isEqualTo("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW); if (responses.isEmpty()) { throw new DavMailException("EXCEPTION_ITEM_NOT_FOUND"); } String itemType = responses.get(0).type; if ("Contact".equals(itemType)) { // retrieve Contact properties - List contacts = searchContacts(folderPath, CONTACT_ATTRIBUTES, equals("urlcompname", urlcompname)); + List contacts = searchContacts(folderPath, CONTACT_ATTRIBUTES, isEqualTo("urlcompname", urlcompname)); if (contacts.isEmpty()) { throw new DavMailException("EXCEPTION_ITEM_NOT_FOUND"); } @@ -1005,7 +1006,7 @@ public class EwsExchangeSession extends ExchangeSession { @Override public void deleteItem(String folderPath, String itemName) throws IOException { String urlcompname = convertItemNameToEML(itemName); - List responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, equals("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW); + List responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, isEqualTo("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW); if (!responses.isEmpty()) { DeleteItemMethod deleteItemMethod = new DeleteItemMethod(new ItemId(responses.get(0)), DeleteType.HardDelete); executeMethod(deleteItemMethod); @@ -1015,7 +1016,7 @@ public class EwsExchangeSession extends ExchangeSession { @Override public void processItem(String folderPath, String itemName) throws IOException { String urlcompname = convertItemNameToEML(itemName); - List responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, equals("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW); + List responses = searchItems(folderPath, EVENT_REQUEST_PROPERTIES, isEqualTo("urlcompname", urlcompname), FolderQueryTraversal.SHALLOW); if (!responses.isEmpty()) { HashMap localProperties = new HashMap(); localProperties.put("processed", "1"); @@ -1157,5 +1158,19 @@ public class EwsExchangeSession extends ExchangeSession { return zuluDateValue; } + /** + * Format date to exchange search format. + * + * @param date date object + * @return formatted search date + */ + @Override + public String formatSearchDate(Date date) { + SimpleDateFormat dateFormatter = new SimpleDateFormat(YYYY_MM_DD_T_HHMMSS_Z, Locale.ENGLISH); + dateFormatter.setTimeZone(GMT_TIMEZONE); + return dateFormatter.format(date); + } + + } diff --git a/src/java/davmail/imap/ImapConnection.java b/src/java/davmail/imap/ImapConnection.java index 8beb0f54..938419f0 100644 --- a/src/java/davmail/imap/ImapConnection.java +++ b/src/java/davmail/imap/ImapConnection.java @@ -1042,7 +1042,7 @@ public class ImapConnection extends AbstractConnection { return session.isFalse("read"); } else if ("DELETED".equals(token)) { // conditions.deleted = Boolean.TRUE; - return session.equals("deleted", "1"); + return session.isEqualTo("deleted", "1"); } else if ("UNDELETED".equals(token) || "NOT DELETED".equals(token)) { // conditions.deleted = Boolean.FALSE; return session.isNull("deleted"); @@ -1060,7 +1060,7 @@ public class ImapConnection extends AbstractConnection { if ("message-id".equals(headerName) && !value.startsWith("<")) { value = '<' + value + '>'; } - return session.headerEquals(headerName, value); + return session.headerIsEqualTo(headerName, value); } else if ("UID".equals(token)) { String range = tokens.nextToken(); if ("1:*".equals(range)) { diff --git a/src/java/davmail/ldap/LdapConnection.java b/src/java/davmail/ldap/LdapConnection.java index 2b5445a0..559f7167 100644 --- a/src/java/davmail/ldap/LdapConnection.java +++ b/src/java/davmail/ldap/LdapConnection.java @@ -1091,7 +1091,7 @@ public class LdapConnection extends AbstractConnection { ExchangeSession.Condition condition = null; if (operator == LDAP_FILTER_EQUALITY) { - condition = session.equals(contactAttributeName, value); + condition = session.isEqualTo(contactAttributeName, value); } else if ("*".equals(value)) { condition = session.not(session.isNull(contactAttributeName)); // do not allow substring search on integer field imapUid @@ -1263,7 +1263,7 @@ public class LdapConnection extends AbstractConnection { try { // check if this is a contact uid Integer.parseInt(uid); - persons = contactFind(session.equals("imapUid", uid), returningAttributes); + persons = contactFind(session.isEqualTo("imapUid", uid), returningAttributes); } catch (NumberFormatException e) { // ignore, this is not a contact uid } diff --git a/src/test/davmail/caldav/TestCaldav.java b/src/test/davmail/caldav/TestCaldav.java index 58e73bac..94400923 100644 --- a/src/test/davmail/caldav/TestCaldav.java +++ b/src/test/davmail/caldav/TestCaldav.java @@ -156,7 +156,7 @@ public class TestCaldav extends AbstractDavMailTestCase { session.gt("dtstart", session.formatSearchDate(start)), session.lt("dtend", session.formatSearchDate(end)) ) - , session.or(session.equals("instancetype", 1), session.equals("instancetype", 0)) + , session.or(session.isEqualTo("instancetype", 1), session.isEqualTo("instancetype", 0)) ) ); diff --git a/src/test/davmail/exchange/TestExchangeSessionMessage.java b/src/test/davmail/exchange/TestExchangeSessionMessage.java index 7aeb8dd0..63f465b8 100644 --- a/src/test/davmail/exchange/TestExchangeSessionMessage.java +++ b/src/test/davmail/exchange/TestExchangeSessionMessage.java @@ -104,7 +104,7 @@ public class TestExchangeSessionMessage extends AbstractExchangeSessionTestCase HashMap properties = new HashMap(); properties.put("draft", "0"); session.createMessage("testfolder", messageName, properties, getMimeBody(mimeMessage)); - ExchangeSession.MessageList messageList = session.searchMessages("testfolder", session.equals("urlcompname", messageName)); + ExchangeSession.MessageList messageList = session.searchMessages("testfolder", session.isEqualTo("urlcompname", messageName)); assertNotNull(messageList); assertEquals(1, messageList.size()); } @@ -117,7 +117,7 @@ public class TestExchangeSessionMessage extends AbstractExchangeSessionTestCase HashMap properties = new HashMap(); properties.put("draft", "0"); session.createMessage("testfolder", messageName, properties, getMimeBody(mimeMessage)); - ExchangeSession.MessageList messageList = session.searchMessages("testfolder", session.equals("urlcompname", messageName)); + ExchangeSession.MessageList messageList = session.searchMessages("testfolder", session.isEqualTo("urlcompname", messageName)); assertNotNull(messageList); assertEquals(1, messageList.size()); } @@ -131,7 +131,7 @@ public class TestExchangeSessionMessage extends AbstractExchangeSessionTestCase HashMap properties = new HashMap(); properties.put("draft", "0"); session.createMessage("testfolder", messageName, properties, getMimeBody(mimeMessage)); - ExchangeSession.MessageList messageList = session.searchMessages("testfolder", session.equals("urlcompname", messageName)); + ExchangeSession.MessageList messageList = session.searchMessages("testfolder", session.isEqualTo("urlcompname", messageName)); assertNotNull(messageList); assertEquals(1, messageList.size()); } diff --git a/src/test/davmail/exchange/TestExchangeSessionSearchContact.java b/src/test/davmail/exchange/TestExchangeSessionSearchContact.java index f29de8d7..60609716 100644 --- a/src/test/davmail/exchange/TestExchangeSessionSearchContact.java +++ b/src/test/davmail/exchange/TestExchangeSessionSearchContact.java @@ -70,7 +70,7 @@ public class TestExchangeSessionSearchContact extends AbstractExchangeSessionTes attributes.add("uid"); List contacts = session.searchContacts(ExchangeSession.CONTACTS, attributes, null); for (ExchangeSession.Contact contact : contacts) { - System.out.println(session.searchContacts(ExchangeSession.CONTACTS, attributes, session.equals("uid", contact.get("uid")))); + System.out.println(session.searchContacts(ExchangeSession.CONTACTS, attributes, session.isEqualTo("uid", contact.get("uid")))); } } diff --git a/src/test/davmail/exchange/dav/TestDavExchangeSession.java b/src/test/davmail/exchange/dav/TestDavExchangeSession.java index c1571473..e1da9948 100644 --- a/src/test/davmail/exchange/dav/TestDavExchangeSession.java +++ b/src/test/davmail/exchange/dav/TestDavExchangeSession.java @@ -112,7 +112,7 @@ public class TestDavExchangeSession extends AbstractExchangeSessionTestCase { Set attributes = new HashSet(); attributes.add("permanenturl"); attributes.add("roamingxmlstream"); - MultiStatusResponse[] responses = davSession.searchItems("/users/" + davSession.getEmail() + "/calendar", attributes, davSession.and(davSession.isFalse("isfolder"), davSession.equals("messageclass", "IPM.Configuration.CategoryList")), DavExchangeSession.FolderQueryTraversal.Shallow); + MultiStatusResponse[] responses = davSession.searchItems("/users/" + davSession.getEmail() + "/calendar", attributes, davSession.and(davSession.isFalse("isfolder"), davSession.isEqualTo("messageclass", "IPM.Configuration.CategoryList")), DavExchangeSession.FolderQueryTraversal.Shallow); String value = (String) responses[0].getProperties(HttpStatus.SC_OK).get(Field.getPropertyName("roamingxmlstream")).getValue(); String propertyList = new String(Base64.decodeBase64(value.getBytes()), "UTF-8"); System.out.println(propertyList); @@ -127,7 +127,7 @@ public class TestDavExchangeSession extends AbstractExchangeSessionTestCase { Set attributes = new HashSet(); attributes.add("permanenturl"); attributes.add("roamingxmlstream"); - MultiStatusResponse[] responses = davSession.searchItems("/users/" + davSession.getEmail() + "/calendar", attributes, davSession.and(davSession.isFalse("isfolder"), davSession.equals("messageclass", "IPM.Configuration.Calendar")), DavExchangeSession.FolderQueryTraversal.Shallow); + MultiStatusResponse[] responses = davSession.searchItems("/users/" + davSession.getEmail() + "/calendar", attributes, davSession.and(davSession.isFalse("isfolder"), davSession.isEqualTo("messageclass", "IPM.Configuration.Calendar")), DavExchangeSession.FolderQueryTraversal.Shallow); String value = (String) responses[0].getProperties(HttpStatus.SC_OK).get(Field.getPropertyName("roamingxmlstream")).getValue(); String propertyList = new String(Base64.decodeBase64(value.getBytes()), "UTF-8"); System.out.println(propertyList); diff --git a/src/test/davmail/smtp/TestSmtp.java b/src/test/davmail/smtp/TestSmtp.java index a8ee3ab1..9b8018bd 100644 --- a/src/test/davmail/smtp/TestSmtp.java +++ b/src/test/davmail/smtp/TestSmtp.java @@ -114,7 +114,7 @@ public class TestSmtp extends AbstractDavMailTestCase { // wait for asynchronous message send ExchangeSession.MessageList messages = null; for (int i=0;i<5;i++) { - messages = session.searchMessages("Sent", session.headerEquals("message-id", mimeMessage.getMessageID())); + messages = session.searchMessages("Sent", session.headerIsEqualTo("message-id", mimeMessage.getMessageID())); if (messages.size() > 0) { break; }