From 2464acc6da6393f0163894094468f68b8e496cea Mon Sep 17 00:00:00 2001 From: Fred Quintana Date: Tue, 24 Nov 2009 09:47:01 -0800 Subject: [PATCH] moved the gdata library to vendor/google --- Android.mk | 1 - core/java/android/provider/Calendar.java | 56 +- .../gdata/client/AndroidGDataClient.java | 508 --------------- .../gdata/client/AndroidXmlParserFactory.java | 31 - .../android/gdata/client/QueryParamsImpl.java | 102 --- .../gdata2/client/AndroidGDataClient.java | 603 ------------------ .../client/AndroidXmlParserFactory.java | 31 - .../gdata2/client/QueryParamsImpl.java | 99 --- preloaded-classes | 15 - tests/AndroidTests/res/raw/calendarjs.txt | 1 - tests/AndroidTests/res/raw/calendarjsgz.jsgz | Bin 1956 -> 0 bytes tests/AndroidTests/res/raw/calendarxml.xml | 38 -- .../AndroidTests/res/raw/calendarxmlgz.xmlgz | Bin 2412 -> 0 bytes tests/AndroidTests/res/xml/calendar.xml | 38 -- .../android/unit_tests/GDataParseTest.java | 162 ----- 15 files changed, 1 insertion(+), 1684 deletions(-) delete mode 100644 core/java/com/google/android/gdata/client/AndroidGDataClient.java delete mode 100644 core/java/com/google/android/gdata/client/AndroidXmlParserFactory.java delete mode 100644 core/java/com/google/android/gdata/client/QueryParamsImpl.java delete mode 100644 core/java/com/google/android/gdata2/client/AndroidGDataClient.java delete mode 100644 core/java/com/google/android/gdata2/client/AndroidXmlParserFactory.java delete mode 100644 core/java/com/google/android/gdata2/client/QueryParamsImpl.java delete mode 100644 tests/AndroidTests/res/raw/calendarjs.txt delete mode 100644 tests/AndroidTests/res/raw/calendarjsgz.jsgz delete mode 100644 tests/AndroidTests/res/raw/calendarxml.xml delete mode 100644 tests/AndroidTests/res/raw/calendarxmlgz.xmlgz delete mode 100644 tests/AndroidTests/res/xml/calendar.xml delete mode 100644 tests/AndroidTests/src/com/android/unit_tests/GDataParseTest.java diff --git a/Android.mk b/Android.mk index 8d13e3b4b3ed1..be3f5692d7c31 100644 --- a/Android.mk +++ b/Android.mk @@ -525,7 +525,6 @@ include $(BUILD_DROIDDOC) ext_dirs := \ ../../external/apache-http/src \ - ../../external/gdata/src \ ../../external/tagsoup/src ext_src_files := $(call all-java-files-under,$(ext_dirs)) diff --git a/core/java/android/provider/Calendar.java b/core/java/android/provider/Calendar.java index b8cf6c2955ce2..1652ebdb31042 100644 --- a/core/java/android/provider/Calendar.java +++ b/core/java/android/provider/Calendar.java @@ -33,17 +33,6 @@ import android.text.format.Time; import android.util.Config; import android.util.Log; import android.accounts.Account; -import com.android.internal.database.ArrayListCursor; -import com.google.android.gdata.client.AndroidGDataClient; -import com.google.android.gdata.client.AndroidXmlParserFactory; -import com.google.wireless.gdata.calendar.client.CalendarClient; -import com.google.wireless.gdata.calendar.data.EventEntry; -import com.google.wireless.gdata.calendar.data.Who; -import com.google.wireless.gdata.calendar.parser.xml.XmlCalendarGDataParserFactory; -import com.google.wireless.gdata.data.StringUtils; - -import java.util.ArrayList; -import java.util.Vector; /** * The Calendar provider contains all calendar events. @@ -547,8 +536,6 @@ public final class Calendar { AttendeesColumns.ATTENDEE_TYPE, AttendeesColumns.ATTENDEE_STATUS }; - private static CalendarClient sCalendarClient = null; - public static final Cursor query(ContentResolver cr, String[] projection) { return cr.query(CONTENT_URI, projection, null, null, DEFAULT_SORT_ORDER); } @@ -600,7 +587,7 @@ public final class Calendar { // where String where = extractValue(event, "LOCATION"); - if (!StringUtils.isEmpty(where)) { + if (!TextUtils.isEmpty(where)) { values.put(EVENT_LOCATION, where); } @@ -686,47 +673,6 @@ public final class Calendar { return cr.insert(CONTENT_URI, values); } - /** - * Returns a singleton instance of the CalendarClient used to fetch entries from the - * calendar server. - * @param cr The ContentResolver used to lookup the address of the calendar server in the - * settings database. - * @return The singleton instance of the CalendarClient used to fetch entries from the - * calendar server. - */ - private static synchronized CalendarClient getCalendarClient(ContentResolver cr) { - if (sCalendarClient == null) { - sCalendarClient = new CalendarClient( - new AndroidGDataClient(cr), - new XmlCalendarGDataParserFactory(new AndroidXmlParserFactory())); - } - return sCalendarClient; - } - - /** - * Extracts the attendees information out of event and adds it to a new ArrayList of columns - * within the supplied ArrayList of rows. These rows are expected to be used within an - * {@link ArrayListCursor}. - */ - private static final void extractAttendeesIntoArrayList(EventEntry event, - ArrayList rows) { - Log.d(TAG, "EVENT: " + event.toString()); - Vector attendees = (Vector) event.getAttendees(); - - int numAttendees = attendees == null ? 0 : attendees.size(); - - for (int i = 0; i < numAttendees; ++i) { - Who attendee = attendees.elementAt(i); - ArrayList row = new ArrayList(); - row.add(attendee.getValue()); - row.add(attendee.getEmail()); - row.add(attendee.getRelationship()); - row.add(attendee.getType()); - row.add(attendee.getStatus()); - rows.add(row); - } - } - /** * The content:// style URL for this table */ diff --git a/core/java/com/google/android/gdata/client/AndroidGDataClient.java b/core/java/com/google/android/gdata/client/AndroidGDataClient.java deleted file mode 100644 index 9a2a51d4c86b5..0000000000000 --- a/core/java/com/google/android/gdata/client/AndroidGDataClient.java +++ /dev/null @@ -1,508 +0,0 @@ -// Copyright 2007 The Android Open Source Project - -package com.google.android.gdata.client; - -import com.google.android.net.GoogleHttpClient; -import com.google.wireless.gdata.client.GDataClient; -import com.google.wireless.gdata.client.HttpException; -import com.google.wireless.gdata.client.QueryParams; -import com.google.wireless.gdata.data.StringUtils; -import com.google.wireless.gdata.parser.ParseException; -import com.google.wireless.gdata.serializer.GDataSerializer; - -import org.apache.http.Header; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.StatusLine; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpUriRequest; -import org.apache.http.entity.InputStreamEntity; -import org.apache.http.entity.AbstractHttpEntity; -import org.apache.http.entity.ByteArrayEntity; - -import android.content.ContentResolver; -import android.content.Context; -import android.net.http.AndroidHttpClient; -import android.text.TextUtils; -import android.util.Config; -import android.util.Log; -import android.os.SystemProperties; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.io.BufferedInputStream; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URLEncoder; - -/** - * Implementation of a GDataClient using GoogleHttpClient to make HTTP - * requests. Always issues GETs and POSTs, using the X-HTTP-Method-Override - * header when a PUT or DELETE is desired, to avoid issues with firewalls, etc., - * that do not allow methods other than GET or POST. - */ -public class AndroidGDataClient implements GDataClient { - - private static final String TAG = "GDataClient"; - private static final boolean DEBUG = false; - private static final boolean LOCAL_LOGV = DEBUG ? Config.LOGD : Config.LOGV; - - private static final String X_HTTP_METHOD_OVERRIDE = - "X-HTTP-Method-Override"; - - private static final String DEFAULT_USER_AGENT_APP_VERSION = "Android-GData/1.1"; - - private static final int MAX_REDIRECTS = 10; - - // boolean system property that can be used to control whether or not - // requests/responses are gzip'd. - private static final String NO_GZIP_SYSTEM_PROPERTY = "sync.nogzip"; - - private final GoogleHttpClient mHttpClient; - private ContentResolver mResolver; - - /** - * Interface for creating HTTP requests. Used by - * {@link AndroidGDataClient#createAndExecuteMethod}, since HttpUriRequest does not allow for - * changing the URI after creation, e.g., when you want to follow a redirect. - */ - private interface HttpRequestCreator { - HttpUriRequest createRequest(URI uri); - } - - private static class GetRequestCreator implements HttpRequestCreator { - public GetRequestCreator() { - } - - public HttpUriRequest createRequest(URI uri) { - HttpGet get = new HttpGet(uri); - return get; - } - } - - private static class PostRequestCreator implements HttpRequestCreator { - private final String mMethodOverride; - private final HttpEntity mEntity; - public PostRequestCreator(String methodOverride, HttpEntity entity) { - mMethodOverride = methodOverride; - mEntity = entity; - } - - public HttpUriRequest createRequest(URI uri) { - HttpPost post = new HttpPost(uri); - if (mMethodOverride != null) { - post.addHeader(X_HTTP_METHOD_OVERRIDE, mMethodOverride); - } - post.setEntity(mEntity); - return post; - } - } - - // MAJOR TODO: make this work across redirects (if we can reset the InputStream). - // OR, read the bits into a local buffer (yuck, the media could be large). - private static class MediaPutRequestCreator implements HttpRequestCreator { - private final InputStream mMediaInputStream; - private final String mContentType; - public MediaPutRequestCreator(InputStream mediaInputStream, String contentType) { - mMediaInputStream = mediaInputStream; - mContentType = contentType; - } - - public HttpUriRequest createRequest(URI uri) { - HttpPost post = new HttpPost(uri); - post.addHeader(X_HTTP_METHOD_OVERRIDE, "PUT"); - // mMediaInputStream.reset(); - InputStreamEntity entity = new InputStreamEntity(mMediaInputStream, - -1 /* read until EOF */); - entity.setContentType(mContentType); - post.setEntity(entity); - return post; - } - } - - /** - * @deprecated Use AndroidGDAtaClient(Context) instead. - */ - public AndroidGDataClient(ContentResolver resolver) { - mHttpClient = new GoogleHttpClient(resolver, DEFAULT_USER_AGENT_APP_VERSION, - true /* gzip capable */); - mHttpClient.enableCurlLogging(TAG, Log.VERBOSE); - mResolver = resolver; - } - - /** - * Creates a new AndroidGDataClient. - * - * @param context The ContentResolver to get URL rewriting rules from - * through the Android proxy server, using null to indicate not using proxy. - * The context will also be used by GoogleHttpClient for configuration of - * SSL session persistence. - */ - public AndroidGDataClient(Context context) { - this(context, DEFAULT_USER_AGENT_APP_VERSION); - } - - /** - * Creates a new AndroidGDataClient. - * - * @param context The ContentResolver to get URL rewriting rules from - * through the Android proxy server, using null to indicate not using proxy. - * The context will also be used by GoogleHttpClient for configuration of - * SSL session persistence. - * @param appAndVersion The application name and version to be used as the basis of the - * User-Agent. e.g., Android-GData/1.5.0. - */ - public AndroidGDataClient(Context context, String appAndVersion) { - mHttpClient = new GoogleHttpClient(context, appAndVersion, - true /* gzip capable */); - mHttpClient.enableCurlLogging(TAG, Log.VERBOSE); - mResolver = context.getContentResolver(); - } - - public void close() { - mHttpClient.close(); - } - - /* - * (non-Javadoc) - * @see GDataClient#encodeUri(java.lang.String) - */ - public String encodeUri(String uri) { - String encodedUri; - try { - encodedUri = URLEncoder.encode(uri, "UTF-8"); - } catch (UnsupportedEncodingException uee) { - // should not happen. - Log.e("JakartaGDataClient", - "UTF-8 not supported -- should not happen. " - + "Using default encoding.", uee); - encodedUri = URLEncoder.encode(uri); - } - return encodedUri; - } - - /* - * (non-Javadoc) - * @see com.google.wireless.gdata.client.GDataClient#createQueryParams() - */ - public QueryParams createQueryParams() { - return new QueryParamsImpl(); - } - - // follows redirects - private InputStream createAndExecuteMethod(HttpRequestCreator creator, - String uriString, - String authToken) - throws HttpException, IOException { - - HttpResponse response = null; - int status = 500; - int redirectsLeft = MAX_REDIRECTS; - - URI uri; - try { - uri = new URI(uriString); - } catch (URISyntaxException use) { - Log.w(TAG, "Unable to parse " + uriString + " as URI.", use); - throw new IOException("Unable to parse " + uriString + " as URI: " - + use.getMessage()); - } - - // we follow redirects ourselves, since we want to follow redirects even on POSTs, which - // the HTTP library does not do. following redirects ourselves also allows us to log - // the redirects using our own logging. - while (redirectsLeft > 0) { - - HttpUriRequest request = creator.createRequest(uri); - - if (!SystemProperties.getBoolean(NO_GZIP_SYSTEM_PROPERTY, false)) { - AndroidHttpClient.modifyRequestToAcceptGzipResponse(request); - } - - // only add the auth token if not null (to allow for GData feeds that do not require - // authentication.) - if (!TextUtils.isEmpty(authToken)) { - request.addHeader("Authorization", "GoogleLogin auth=" + authToken); - } - if (LOCAL_LOGV) { - for (Header h : request.getAllHeaders()) { - Log.v(TAG, h.getName() + ": " + h.getValue()); - } - } - - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Executing " + request.getRequestLine().toString()); - } - - response = null; - - try { - response = mHttpClient.execute(request); - } catch (IOException ioe) { - Log.w(TAG, "Unable to execute HTTP request." + ioe); - throw ioe; - } - - StatusLine statusLine = response.getStatusLine(); - if (statusLine == null) { - Log.w(TAG, "StatusLine is null."); - throw new NullPointerException("StatusLine is null -- should not happen."); - } - - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, response.getStatusLine().toString()); - for (Header h : response.getAllHeaders()) { - Log.d(TAG, h.getName() + ": " + h.getValue()); - } - } - status = statusLine.getStatusCode(); - - HttpEntity entity = response.getEntity(); - - if ((status >= 200) && (status < 300) && entity != null) { - InputStream in = AndroidHttpClient.getUngzippedContent(entity); - if (Log.isLoggable(TAG, Log.DEBUG)) { - in = logInputStreamContents(in); - } - return in; - } - - // TODO: handle 301, 307? - // TODO: let the http client handle the redirects, if we can be sure we'll never get a - // redirect on POST. - if (status == 302) { - // consume the content, so the connection can be closed. - entity.consumeContent(); - Header location = response.getFirstHeader("Location"); - if (location == null) { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Redirect requested but no Location " - + "specified."); - } - break; - } - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Following redirect to " + location.getValue()); - } - try { - uri = new URI(location.getValue()); - } catch (URISyntaxException use) { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Unable to parse " + location.getValue() + " as URI.", use); - throw new IOException("Unable to parse " + location.getValue() - + " as URI."); - } - break; - } - --redirectsLeft; - } else { - break; - } - } - - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "Received " + status + " status code."); - } - String errorMessage = null; - HttpEntity entity = response.getEntity(); - try { - if (response != null && entity != null) { - InputStream in = AndroidHttpClient.getUngzippedContent(entity); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - byte[] buf = new byte[8192]; - int bytesRead = -1; - while ((bytesRead = in.read(buf)) != -1) { - baos.write(buf, 0, bytesRead); - } - // TODO: use appropriate encoding, picked up from Content-Type. - errorMessage = new String(baos.toByteArray()); - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, errorMessage); - } - } - } finally { - if (entity != null) { - entity.consumeContent(); - } - } - String exceptionMessage = "Received " + status + " status code"; - if (errorMessage != null) { - exceptionMessage += (": " + errorMessage); - } - throw new HttpException(exceptionMessage, status, null /* InputStream */); - } - - /* - * (non-Javadoc) - * @see GDataClient#getFeedAsStream(java.lang.String, java.lang.String) - */ - public InputStream getFeedAsStream(String feedUrl, - String authToken) - throws HttpException, IOException { - - InputStream in = createAndExecuteMethod(new GetRequestCreator(), feedUrl, authToken); - if (in != null) { - return in; - } - throw new IOException("Unable to access feed."); - } - - /** - * Log the contents of the input stream. - * The original input stream is consumed, so the caller must use the - * BufferedInputStream that is returned. - * @param in InputStream - * @return replacement input stream for caller to use - * @throws IOException - */ - private InputStream logInputStreamContents(InputStream in) throws IOException { - if (in == null) { - return in; - } - // bufferSize is the (arbitrary) maximum amount to log. - // The original InputStream is wrapped in a - // BufferedInputStream with a 16K buffer. This lets - // us read up to 16K, write it to the log, and then - // reset the stream so the the original client can - // then read the data. The BufferedInputStream - // provides the mark and reset support, even when - // the original InputStream does not. - final int bufferSize = 16384; - BufferedInputStream bin = new BufferedInputStream(in, bufferSize); - bin.mark(bufferSize); - int wanted = bufferSize; - int totalReceived = 0; - byte buf[] = new byte[wanted]; - while (wanted > 0) { - int got = bin.read(buf, totalReceived, wanted); - if (got <= 0) break; // EOF - wanted -= got; - totalReceived += got; - } - Log.d(TAG, new String(buf, 0, totalReceived, "UTF-8")); - bin.reset(); - return bin; - } - - public InputStream getMediaEntryAsStream(String mediaEntryUrl, String authToken) - throws HttpException, IOException { - - InputStream in = createAndExecuteMethod(new GetRequestCreator(), mediaEntryUrl, authToken); - - if (in != null) { - return in; - } - throw new IOException("Unable to access media entry."); - } - - /* (non-Javadoc) - * @see GDataClient#createEntry - */ - public InputStream createEntry(String feedUrl, - String authToken, - GDataSerializer entry) - throws HttpException, IOException { - - HttpEntity entity = createEntityForEntry(entry, GDataSerializer.FORMAT_CREATE); - InputStream in = createAndExecuteMethod( - new PostRequestCreator(null /* override */, entity), - feedUrl, - authToken); - if (in != null) { - return in; - } - throw new IOException("Unable to create entry."); - } - - /* (non-Javadoc) - * @see GDataClient#updateEntry - */ - public InputStream updateEntry(String editUri, - String authToken, - GDataSerializer entry) - throws HttpException, IOException { - HttpEntity entity = createEntityForEntry(entry, GDataSerializer.FORMAT_UPDATE); - InputStream in = createAndExecuteMethod( - new PostRequestCreator("PUT", entity), - editUri, - authToken); - if (in != null) { - return in; - } - throw new IOException("Unable to update entry."); - } - - /* (non-Javadoc) - * @see GDataClient#deleteEntry - */ - public void deleteEntry(String editUri, String authToken) - throws HttpException, IOException { - if (StringUtils.isEmpty(editUri)) { - throw new IllegalArgumentException( - "you must specify an non-empty edit url"); - } - InputStream in = - createAndExecuteMethod( - new PostRequestCreator("DELETE", null /* entity */), - editUri, - authToken); - if (in == null) { - throw new IOException("Unable to delete entry."); - } - try { - in.close(); - } catch (IOException ioe) { - // ignore - } - } - - public InputStream updateMediaEntry(String editUri, String authToken, - InputStream mediaEntryInputStream, String contentType) - throws HttpException, IOException { - InputStream in = createAndExecuteMethod( - new MediaPutRequestCreator(mediaEntryInputStream, contentType), - editUri, - authToken); - if (in != null) { - return in; - } - throw new IOException("Unable to write media entry."); - } - - private HttpEntity createEntityForEntry(GDataSerializer entry, int format) throws IOException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try { - entry.serialize(baos, format); - } catch (IOException ioe) { - Log.e(TAG, "Unable to serialize entry.", ioe); - throw ioe; - } catch (ParseException pe) { - Log.e(TAG, "Unable to serialize entry.", pe); - throw new IOException("Unable to serialize entry: " + pe.getMessage()); - } - - byte[] entryBytes = baos.toByteArray(); - - if (entryBytes != null && Log.isLoggable(TAG, Log.DEBUG)) { - try { - Log.d(TAG, "Serialized entry: " + new String(entryBytes, "UTF-8")); - } catch (UnsupportedEncodingException uee) { - // should not happen - throw new IllegalStateException("UTF-8 should be supported!", - uee); - } - } - - AbstractHttpEntity entity; - if (SystemProperties.getBoolean(NO_GZIP_SYSTEM_PROPERTY, false)) { - entity = new ByteArrayEntity(entryBytes); - } else { - entity = AndroidHttpClient.getCompressedEntity(entryBytes, mResolver); - } - entity.setContentType(entry.getContentType()); - return entity; - } -} diff --git a/core/java/com/google/android/gdata/client/AndroidXmlParserFactory.java b/core/java/com/google/android/gdata/client/AndroidXmlParserFactory.java deleted file mode 100644 index a308fc0b9b11d..0000000000000 --- a/core/java/com/google/android/gdata/client/AndroidXmlParserFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.google.android.gdata.client; - -import com.google.wireless.gdata.parser.xml.XmlParserFactory; - -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; -import org.xmlpull.v1.XmlSerializer; - -import android.util.Xml; - -/** - * XmlParserFactory for the Android platform. - */ -public class AndroidXmlParserFactory implements XmlParserFactory { - - /* - * (non-javadoc) - * @see XmlParserFactory#createParser - */ - public XmlPullParser createParser() throws XmlPullParserException { - return Xml.newPullParser(); - } - - /* - * (non-javadoc) - * @see XmlParserFactory#createSerializer - */ - public XmlSerializer createSerializer() throws XmlPullParserException { - return Xml.newSerializer(); - } -} diff --git a/core/java/com/google/android/gdata/client/QueryParamsImpl.java b/core/java/com/google/android/gdata/client/QueryParamsImpl.java deleted file mode 100644 index fbe0d22930cb0..0000000000000 --- a/core/java/com/google/android/gdata/client/QueryParamsImpl.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.google.android.gdata.client; - -import com.google.wireless.gdata.client.QueryParams; - -import android.text.TextUtils; -import android.util.Log; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -/** - * Simple implementation of the QueryParams interface. - */ -// TODO: deal with categories -public class QueryParamsImpl extends QueryParams { - - private final Map mParams = new HashMap(); - - /** - * Creates a new empty QueryParamsImpl. - */ - public QueryParamsImpl() { - } - - @Override - public void clear() { - setEntryId(null); - mParams.clear(); - } - - @Override - public String generateQueryUrl(String feedUrl) { - - if (TextUtils.isEmpty(getEntryId()) && - mParams.isEmpty()) { - // nothing to do - return feedUrl; - } - - // handle entry IDs - if (!TextUtils.isEmpty(getEntryId())) { - if (!mParams.isEmpty()) { - throw new IllegalStateException("Cannot set both an entry ID " - + "and other query paramters."); - } - return feedUrl + '/' + getEntryId(); - } - - // otherwise, append the querystring params. - StringBuilder sb = new StringBuilder(); - sb.append(feedUrl); - Set params = mParams.keySet(); - boolean first = true; - if (feedUrl.contains("?")) { - first = false; - } else { - sb.append('?'); - } - for (String param : params) { - String value = mParams.get(param); - if (value == null) continue; - if (first) { - first = false; - } else { - sb.append('&'); - } - sb.append(param); - sb.append('='); - - String encodedValue = null; - - try { - encodedValue = URLEncoder.encode(value, "UTF-8"); - } catch (UnsupportedEncodingException uee) { - // should not happen. - Log.w("QueryParamsImpl", - "UTF-8 not supported -- should not happen. " - + "Using default encoding.", uee); - encodedValue = URLEncoder.encode(value); - } - sb.append(encodedValue); - } - return sb.toString(); - } - - @Override - public String getParamValue(String param) { - if (!(mParams.containsKey(param))) { - return null; - } - return mParams.get(param); - } - - @Override - public void setParamValue(String param, String value) { - mParams.put(param, value); - } - -} diff --git a/core/java/com/google/android/gdata2/client/AndroidGDataClient.java b/core/java/com/google/android/gdata2/client/AndroidGDataClient.java deleted file mode 100644 index 3721fa4b2148c..0000000000000 --- a/core/java/com/google/android/gdata2/client/AndroidGDataClient.java +++ /dev/null @@ -1,603 +0,0 @@ -// Copyright 2007 The Android Open Source Project - -package com.google.android.gdata2.client; - -import com.google.android.net.GoogleHttpClient; -import com.google.wireless.gdata2.client.GDataClient; -import com.google.wireless.gdata2.client.HttpException; -import com.google.wireless.gdata2.client.QueryParams; -import com.google.wireless.gdata2.data.StringUtils; -import com.google.wireless.gdata2.parser.ParseException; -import com.google.wireless.gdata2.serializer.GDataSerializer; -import com.google.android.gdata2.client.QueryParamsImpl; - -import org.apache.http.Header; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.StatusLine; -import org.apache.http.params.HttpParams; -import org.apache.http.params.BasicHttpParams; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpUriRequest; -import org.apache.http.entity.InputStreamEntity; -import org.apache.http.entity.AbstractHttpEntity; -import org.apache.http.entity.ByteArrayEntity; - -import android.content.ContentResolver; -import android.content.Context; -import android.net.http.AndroidHttpClient; -import android.text.TextUtils; -import android.util.Config; -import android.util.Log; -import android.os.SystemProperties; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.io.BufferedInputStream; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URLEncoder; - -/** - * Implementation of a GDataClient using GoogleHttpClient to make HTTP - * requests. Always issues GETs and POSTs, using the X-HTTP-Method-Override - * header when a PUT or DELETE is desired, to avoid issues with firewalls, etc., - * that do not allow methods other than GET or POST. - */ -public class AndroidGDataClient implements GDataClient { - - private static final String TAG = "GDataClient"; - private static final boolean DEBUG = false; - private static final boolean LOCAL_LOGV = DEBUG ? Config.LOGD : Config.LOGV; - - private static final String X_HTTP_METHOD_OVERRIDE = - "X-HTTP-Method-Override"; - - private static final String DEFAULT_USER_AGENT_APP_VERSION = "Android-GData/1.2"; - - private static final int MAX_REDIRECTS = 10; - private static String DEFAULT_GDATA_VERSION = "2.0"; - - // boolean system property that can be used to control whether or not - // requests/responses are gzip'd. - private static final String NO_GZIP_SYSTEM_PROPERTY = "sync.nogzip"; - - private String mGDataVersion; - private final GoogleHttpClient mHttpClient; - private ContentResolver mResolver; - - /** - * Interface for creating HTTP requests. Used by - * {@link AndroidGDataClient#createAndExecuteMethod}, since HttpUriRequest does not allow for - * changing the URI after creation, e.g., when you want to follow a redirect. - */ - private interface HttpRequestCreator { - HttpUriRequest createRequest(URI uri); - } - - private static class GetRequestCreator implements HttpRequestCreator { - public GetRequestCreator() { - } - - public HttpUriRequest createRequest(URI uri) { - HttpGet get = new HttpGet(uri); - return get; - } - } - - private static class PostRequestCreator implements HttpRequestCreator { - private final String mMethodOverride; - private final HttpEntity mEntity; - public PostRequestCreator(String methodOverride, HttpEntity entity) { - mMethodOverride = methodOverride; - mEntity = entity; - } - - public HttpUriRequest createRequest(URI uri) { - HttpPost post = new HttpPost(uri); - if (mMethodOverride != null) { - post.addHeader(X_HTTP_METHOD_OVERRIDE, mMethodOverride); - } - post.setEntity(mEntity); - return post; - } - } - - // MAJOR TODO: make this work across redirects (if we can reset the InputStream). - // OR, read the bits into a local buffer (yuck, the media could be large). - private static class MediaPutRequestCreator implements HttpRequestCreator { - private final InputStream mMediaInputStream; - private final String mContentType; - public MediaPutRequestCreator(InputStream mediaInputStream, String contentType) { - mMediaInputStream = mediaInputStream; - mContentType = contentType; - } - - public HttpUriRequest createRequest(URI uri) { - HttpPost post = new HttpPost(uri); - post.addHeader(X_HTTP_METHOD_OVERRIDE, "PUT"); - // mMediaInputStream.reset(); - InputStreamEntity entity = new InputStreamEntity(mMediaInputStream, - -1 /* read until EOF */); - entity.setContentType(mContentType); - post.setEntity(entity); - return post; - } - } - - - /** - * Creates a new AndroidGDataClient. - * - * @param context The ContentResolver to get URL rewriting rules from - * through the Android proxy server, using null to indicate not using proxy. - * The context will also be used by GoogleHttpClient for configuration of - * SSL session persistence. - */ - public AndroidGDataClient(Context context) { - this(context, DEFAULT_USER_AGENT_APP_VERSION); - } - - /** - * Creates a new AndroidGDataClient. - * - * @param context The ContentResolver to get URL rewriting rules from - * through the Android proxy server, using null to indicate not using proxy. - * The context will also be used by GoogleHttpClient for configuration of - * SSL session persistence. - * @param appAndVersion The application name and version to be used as the basis of the - * User-Agent. e.g., Android-GData/1.5.0. - */ - public AndroidGDataClient(Context context, String appAndVersion) { - this(context, appAndVersion, DEFAULT_GDATA_VERSION); - } - - /** - * Creates a new AndroidGDataClient. - * - * @param context The ContentResolver to get URL rewriting rules from - * through the Android proxy server, using null to indicate not using proxy. - * The context will also be used by GoogleHttpClient for configuration of - * SSL session persistence. - * @param appAndVersion The application name and version to be used as the basis of the - * User-Agent. e.g., Android-GData/1.5.0. - * @param gdataVersion The gdata service version that should be - * used, e.g. "2.0" - * - */ - public AndroidGDataClient(Context context, String appAndVersion, String gdataVersion) { - mHttpClient = new GoogleHttpClient(context, appAndVersion, - true /* gzip capable */); - mHttpClient.enableCurlLogging(TAG, Log.VERBOSE); - mResolver = context.getContentResolver(); - mGDataVersion = gdataVersion; - } - - - public void close() { - mHttpClient.close(); - } - - /* - * (non-Javadoc) - * @see GDataClient#encodeUri(java.lang.String) - */ - public String encodeUri(String uri) { - String encodedUri; - try { - encodedUri = URLEncoder.encode(uri, "UTF-8"); - } catch (UnsupportedEncodingException uee) { - // should not happen. - Log.e("JakartaGDataClient", - "UTF-8 not supported -- should not happen. " - + "Using default encoding.", uee); - encodedUri = URLEncoder.encode(uri); - } - return encodedUri; - } - - /* - * (non-Javadoc) - * @see com.google.wireless.gdata.client.GDataClient#createQueryParams() - */ - public QueryParams createQueryParams() { - return new QueryParamsImpl(); - } - - // follows redirects - private InputStream createAndExecuteMethod(HttpRequestCreator creator, - String uriString, - String authToken, - String eTag, - String protocolVersion) - throws HttpException, IOException { - - HttpResponse response = null; - int status = 500; - int redirectsLeft = MAX_REDIRECTS; - - URI uri; - try { - uri = new URI(uriString); - } catch (URISyntaxException use) { - Log.w(TAG, "Unable to parse " + uriString + " as URI.", use); - throw new IOException("Unable to parse " + uriString + " as URI: " - + use.getMessage()); - } - - // we follow redirects ourselves, since we want to follow redirects even on POSTs, which - // the HTTP library does not do. following redirects ourselves also allows us to log - // the redirects using our own logging. - while (redirectsLeft > 0) { - - HttpUriRequest request = creator.createRequest(uri); - - if (!SystemProperties.getBoolean(NO_GZIP_SYSTEM_PROPERTY, false)) { - AndroidHttpClient.modifyRequestToAcceptGzipResponse(request); - } - - // only add the auth token if not null (to allow for GData feeds that do not require - // authentication.) - if (!TextUtils.isEmpty(authToken)) { - request.addHeader("Authorization", "GoogleLogin auth=" + authToken); - } - - // while by default we have a 2.0 in this variable, it is possible to construct - // a client that has an empty version field, to work with 1.0 services. - if (!TextUtils.isEmpty(mGDataVersion)) { - request.addHeader("GDataVersion", mGDataVersion); - } - - // if we have a passed down eTag value, we need to add several headers - if (!TextUtils.isEmpty(eTag)) { - String method = request.getMethod(); - Header overrideMethodHeader = request.getFirstHeader(X_HTTP_METHOD_OVERRIDE); - if (overrideMethodHeader != null) { - method = overrideMethodHeader.getValue(); - } - if ("GET".equals(method)) { - // add the none match header, if the resource is not changed - // this request will result in a 304 now. - request.addHeader("If-None-Match", eTag); - } else if ("DELETE".equals(method) - || "PUT".equals(method)) { - // now we send an if-match, but only if the passed in eTag is a strong eTag - // as this only makes sense for a strong eTag - if (!eTag.startsWith("W/")) { - request.addHeader("If-Match", eTag); - } - } - } - - if (LOCAL_LOGV) { - for (Header h : request.getAllHeaders()) { - Log.v(TAG, h.getName() + ": " + h.getValue()); - } - } - - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Executing " + request.getRequestLine().toString()); - } - - response = null; - - try { - response = mHttpClient.execute(request); - } catch (IOException ioe) { - Log.w(TAG, "Unable to execute HTTP request." + ioe); - throw ioe; - } - - StatusLine statusLine = response.getStatusLine(); - if (statusLine == null) { - Log.w(TAG, "StatusLine is null."); - throw new NullPointerException("StatusLine is null -- should not happen."); - } - - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, response.getStatusLine().toString()); - for (Header h : response.getAllHeaders()) { - Log.d(TAG, h.getName() + ": " + h.getValue()); - } - } - status = statusLine.getStatusCode(); - - HttpEntity entity = response.getEntity(); - - if ((status >= 200) && (status < 300) && entity != null) { - InputStream in = AndroidHttpClient.getUngzippedContent(entity); - if (Log.isLoggable(TAG, Log.DEBUG)) { - in = logInputStreamContents(in); - } - return in; - } - - // TODO: handle 301, 307? - // TODO: let the http client handle the redirects, if we can be sure we'll never get a - // redirect on POST. - if (status == 302) { - // consume the content, so the connection can be closed. - entity.consumeContent(); - Header location = response.getFirstHeader("Location"); - if (location == null) { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Redirect requested but no Location " - + "specified."); - } - break; - } - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Following redirect to " + location.getValue()); - } - try { - uri = new URI(location.getValue()); - } catch (URISyntaxException use) { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Unable to parse " + location.getValue() + " as URI.", use); - throw new IOException("Unable to parse " + location.getValue() - + " as URI."); - } - break; - } - --redirectsLeft; - } else { - break; - } - } - - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "Received " + status + " status code."); - } - String errorMessage = null; - HttpEntity entity = response.getEntity(); - try { - if (response != null && entity != null) { - InputStream in = AndroidHttpClient.getUngzippedContent(entity); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - byte[] buf = new byte[8192]; - int bytesRead = -1; - while ((bytesRead = in.read(buf)) != -1) { - baos.write(buf, 0, bytesRead); - } - // TODO: use appropriate encoding, picked up from Content-Type. - errorMessage = new String(baos.toByteArray()); - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, errorMessage); - } - } - } finally { - if (entity != null) { - entity.consumeContent(); - } - } - String exceptionMessage = "Received " + status + " status code"; - if (errorMessage != null) { - exceptionMessage += (": " + errorMessage); - } - throw new HttpException(exceptionMessage, status, null /* InputStream */); - } - - /* - * (non-Javadoc) - * @see GDataClient#getFeedAsStream(java.lang.String, java.lang.String) - */ - public InputStream getFeedAsStream(String feedUrl, - String authToken, - String eTag, - String protocolVersion) - throws HttpException, IOException { - - InputStream in = createAndExecuteMethod(new GetRequestCreator(), feedUrl, authToken, eTag, protocolVersion); - if (in != null) { - return in; - } - throw new IOException("Unable to access feed."); - } - - /** - * Log the contents of the input stream. - * The original input stream is consumed, so the caller must use the - * BufferedInputStream that is returned. - * @param in InputStream - * @return replacement input stream for caller to use - * @throws IOException - */ - private InputStream logInputStreamContents(InputStream in) throws IOException { - if (in == null) { - return in; - } - // bufferSize is the (arbitrary) maximum amount to log. - // The original InputStream is wrapped in a - // BufferedInputStream with a 16K buffer. This lets - // us read up to 16K, write it to the log, and then - // reset the stream so the the original client can - // then read the data. The BufferedInputStream - // provides the mark and reset support, even when - // the original InputStream does not. - final int bufferSize = 16384; - BufferedInputStream bin = new BufferedInputStream(in, bufferSize); - bin.mark(bufferSize); - int wanted = bufferSize; - int totalReceived = 0; - byte buf[] = new byte[wanted]; - while (wanted > 0) { - int got = bin.read(buf, totalReceived, wanted); - if (got <= 0) break; // EOF - wanted -= got; - totalReceived += got; - } - Log.d(TAG, new String(buf, 0, totalReceived, "UTF-8")); - bin.reset(); - return bin; - } - - public InputStream getMediaEntryAsStream(String mediaEntryUrl, String authToken, String eTag, String protocolVersion) - throws HttpException, IOException { - - InputStream in = createAndExecuteMethod(new GetRequestCreator(), mediaEntryUrl, authToken, eTag, protocolVersion); - - if (in != null) { - return in; - } - throw new IOException("Unable to access media entry."); - } - - /* (non-Javadoc) - * @see GDataClient#createEntry - */ - public InputStream createEntry(String feedUrl, - String authToken, - String protocolVersion, - GDataSerializer entry) - throws HttpException, IOException { - - HttpEntity entity = createEntityForEntry(entry, GDataSerializer.FORMAT_CREATE); - InputStream in = createAndExecuteMethod( - new PostRequestCreator(null /* override */, entity), - feedUrl, - authToken, - null, - protocolVersion); - if (in != null) { - return in; - } - throw new IOException("Unable to create entry."); - } - - /* (non-Javadoc) - * @see GDataClient#updateEntry - */ - public InputStream updateEntry(String editUri, - String authToken, - String eTag, - String protocolVersion, - GDataSerializer entry) - throws HttpException, IOException { - HttpEntity entity = createEntityForEntry(entry, GDataSerializer.FORMAT_UPDATE); - final String method = entry.getSupportsPartial() ? "PATCH" : "PUT"; - InputStream in = createAndExecuteMethod( - new PostRequestCreator(method, entity), - editUri, - authToken, - eTag, - protocolVersion); - if (in != null) { - return in; - } - throw new IOException("Unable to update entry."); - } - - /* (non-Javadoc) - * @see GDataClient#deleteEntry - */ - public void deleteEntry(String editUri, String authToken, String eTag) - throws HttpException, IOException { - if (StringUtils.isEmpty(editUri)) { - throw new IllegalArgumentException( - "you must specify an non-empty edit url"); - } - InputStream in = - createAndExecuteMethod( - new PostRequestCreator("DELETE", null /* entity */), - editUri, - authToken, - eTag, - null /* protocolVersion, not required for a delete */); - if (in == null) { - throw new IOException("Unable to delete entry."); - } - try { - in.close(); - } catch (IOException ioe) { - // ignore - } - } - - public InputStream updateMediaEntry(String editUri, String authToken, String eTag, - String protocolVersion, InputStream mediaEntryInputStream, String contentType) - throws HttpException, IOException { - InputStream in = createAndExecuteMethod( - new MediaPutRequestCreator(mediaEntryInputStream, contentType), - editUri, - authToken, - eTag, - protocolVersion); - if (in != null) { - return in; - } - throw new IOException("Unable to write media entry."); - } - - private HttpEntity createEntityForEntry(GDataSerializer entry, int format) throws IOException { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - try { - entry.serialize(baos, format); - } catch (IOException ioe) { - Log.e(TAG, "Unable to serialize entry.", ioe); - throw ioe; - } catch (ParseException pe) { - Log.e(TAG, "Unable to serialize entry.", pe); - throw new IOException("Unable to serialize entry: " + pe.getMessage()); - } - - byte[] entryBytes = baos.toByteArray(); - - if (entryBytes != null && Log.isLoggable(TAG, Log.DEBUG)) { - try { - Log.d(TAG, "Serialized entry: " + new String(entryBytes, "UTF-8")); - } catch (UnsupportedEncodingException uee) { - // should not happen - throw new IllegalStateException("UTF-8 should be supported!", - uee); - } - } - - AbstractHttpEntity entity; - if (SystemProperties.getBoolean(NO_GZIP_SYSTEM_PROPERTY, false)) { - entity = new ByteArrayEntity(entryBytes); - } else { - entity = AndroidHttpClient.getCompressedEntity(entryBytes, mResolver); - } - - entity.setContentType(entry.getContentType()); - return entity; - } - - /** - * Connects to a GData server (specified by the batchUrl) and submits a - * batch for processing. The response from the server is returned as an - * {@link InputStream}. The caller is responsible for calling - * {@link InputStream#close()} on the returned {@link InputStream}. - * - * @param batchUrl The batch url to which the batch is submitted. - * @param authToken the authentication token that should be used when - * submitting the batch. - * @param protocolVersion The version of the protocol that - * should be used for this request. - * @param batch The batch of entries to submit. - * @throws IOException Thrown if an io error occurs while communicating with - * the service. - * @throws HttpException if the service returns an error response. - */ - public InputStream submitBatch(String batchUrl, - String authToken, - String protocolVersion, - GDataSerializer batch) - throws HttpException, IOException - { - HttpEntity entity = createEntityForEntry(batch, GDataSerializer.FORMAT_BATCH); - InputStream in = createAndExecuteMethod( - new PostRequestCreator("POST", entity), - batchUrl, - authToken, - null, - protocolVersion); - if (in != null) { - return in; - } - throw new IOException("Unable to process batch request."); - } -} diff --git a/core/java/com/google/android/gdata2/client/AndroidXmlParserFactory.java b/core/java/com/google/android/gdata2/client/AndroidXmlParserFactory.java deleted file mode 100644 index f09770619be2c..0000000000000 --- a/core/java/com/google/android/gdata2/client/AndroidXmlParserFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.google.android.gdata2.client; - -import com.google.wireless.gdata2.parser.xml.XmlParserFactory; - -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; -import org.xmlpull.v1.XmlSerializer; - -import android.util.Xml; - -/** - * XmlParserFactory for the Android platform. - */ -public class AndroidXmlParserFactory implements XmlParserFactory { - - /* - * (non-javadoc) - * @see XmlParserFactory#createParser - */ - public XmlPullParser createParser() throws XmlPullParserException { - return Xml.newPullParser(); - } - - /* - * (non-javadoc) - * @see XmlParserFactory#createSerializer - */ - public XmlSerializer createSerializer() throws XmlPullParserException { - return Xml.newSerializer(); - } -} diff --git a/core/java/com/google/android/gdata2/client/QueryParamsImpl.java b/core/java/com/google/android/gdata2/client/QueryParamsImpl.java deleted file mode 100644 index a26f4ce82c7c3..0000000000000 --- a/core/java/com/google/android/gdata2/client/QueryParamsImpl.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.google.android.gdata2.client; -import com.google.wireless.gdata2.client.QueryParams; - -import android.text.TextUtils; -import android.util.Log; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -/** - * Simple implementation of the QueryParams interface. - */ -// TODO: deal with categories -public class QueryParamsImpl extends QueryParams { - - private final Map mParams = new HashMap(); - - /** - * Creates a new empty QueryParamsImpl. - */ - public QueryParamsImpl() { - } - - @Override - public void clear() { - setEntryId(null); - mParams.clear(); - } - - @Override - public String generateQueryUrl(String feedUrl) { - - if (TextUtils.isEmpty(getEntryId()) && - mParams.isEmpty()) { - // nothing to do - return feedUrl; - } - - // handle entry IDs - if (!TextUtils.isEmpty(getEntryId())) { - if (!mParams.isEmpty()) { - throw new IllegalStateException("Cannot set both an entry ID " - + "and other query paramters."); - } - return feedUrl + '/' + getEntryId(); - } - - // otherwise, append the querystring params. - StringBuilder sb = new StringBuilder(); - sb.append(feedUrl); - Set params = mParams.keySet(); - boolean first = true; - if (feedUrl.contains("?")) { - first = false; - } else { - sb.append('?'); - } - for (String param : params) { - if (first) { - first = false; - } else { - sb.append('&'); - } - sb.append(param); - sb.append('='); - String value = mParams.get(param); - String encodedValue = null; - - try { - encodedValue = URLEncoder.encode(value, "UTF-8"); - } catch (UnsupportedEncodingException uee) { - // should not happen. - Log.w("QueryParamsImpl", - "UTF-8 not supported -- should not happen. " - + "Using default encoding.", uee); - encodedValue = URLEncoder.encode(value); - } - sb.append(encodedValue); - } - return sb.toString(); - } - - @Override - public String getParamValue(String param) { - if (!(mParams.containsKey(param))) { - return null; - } - return mParams.get(param); - } - - @Override - public void setParamValue(String param, String value) { - mParams.put(param, value); - } - -} diff --git a/preloaded-classes b/preloaded-classes index ab83b67cc350c..08fc2a13806f2 100644 --- a/preloaded-classes +++ b/preloaded-classes @@ -1097,10 +1097,6 @@ com.android.internal.widget.NumberPicker$NumberRangeKeyListener com.android.internal.widget.NumberPickerButton com.android.internal.widget.RotarySelector com.android.internal.widget.Smileys -com.google.android.gdata.client.AndroidGDataClient -com.google.android.gdata.client.AndroidGDataClient$GetRequestCreator -com.google.android.gdata.client.AndroidGDataClient$PostRequestCreator -com.google.android.gdata.client.QueryParamsImpl com.google.android.gles_jni.EGLDisplayImpl com.google.android.gles_jni.EGLImpl com.google.android.gles_jni.EGLSurfaceImpl @@ -1115,17 +1111,6 @@ com.google.android.net.ParentalControlState com.google.android.net.ParentalControlState$1 com.google.android.net.UrlRules com.google.android.net.UrlRules$Rule -com.google.wireless.gdata.calendar.client.CalendarClient -com.google.wireless.gdata.calendar.data.CalendarEntry -com.google.wireless.gdata.calendar.data.CalendarsFeed -com.google.wireless.gdata.calendar.data.EventEntry -com.google.wireless.gdata.calendar.data.Who -com.google.wireless.gdata.calendar.parser.xml.XmlCalendarGDataParserFactory -com.google.wireless.gdata.calendar.serializer.xml.XmlEventEntryGDataSerializer -com.google.wireless.gdata.client.GDataServiceClient -com.google.wireless.gdata.client.QueryParams -com.google.wireless.gdata.data.Entry -com.google.wireless.gdata.parser.xml.XmlGDataParser com.ibm.icu4jni.charset.CharsetDecoderICU com.ibm.icu4jni.charset.CharsetEncoderICU com.ibm.icu4jni.charset.CharsetICU diff --git a/tests/AndroidTests/res/raw/calendarjs.txt b/tests/AndroidTests/res/raw/calendarjs.txt deleted file mode 100644 index 15f7bab3a2922..0000000000000 --- a/tests/AndroidTests/res/raw/calendarjs.txt +++ /dev/null @@ -1 +0,0 @@ -{"version":"1.0","encoding":"UTF-8","feed":{"xmlns":"http://www.w3.org/2005/Atom","xmlns$openSearch":"http://a9.com/-/spec/opensearchrss/1.0/","xmlns$gd":"http://schemas.google.com/g/2005","xmlns$gCal":"http://schemas.google.com/gCal/2005","id":{"$t":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic"},"updated":{"$t":"2007-02-06T02:55:15.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://schemas.google.com/g/2005#event"}],"title":{"type":"text","$t":"w g"},"subtitle":{"type":"text","$t":"w g"},"link":[{"rel":"http://schemas.google.com/g/2005#feed","type":"application/atom+xml","href":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic"},{"rel":"self","type":"application/atom+xml","href":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic?alt\u003Djson\u0026max-results\u003D25"}],"author":[{"name":{"$t":"w g"},"email":{"$t":"wg@voiceme.net"}}],"generator":{"version":"1.0","uri":"http://www.google.com/calendar","$t":"Google Calendar"},"openSearch$totalResults":{"$t":"13"},"openSearch$startIndex":{"$t":"1"},"openSearch$itemsPerPage":{"$t":"25"},"gCal$timezone":{"value":"America/Los_Angeles"},"entry":[{"id":{"$t":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/7iqc1ro0ihc69vhsiq3uabooig"},"published":{"$t":"2007-02-05T22:04:50.000Z"},"updated":{"$t":"2007-02-05T22:04:50.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://schemas.google.com/g/2005#event"}],"title":{"type":"text","$t":"skate"},"summary":{"type":"html","$t":"When: Wed Feb 7, 2007 13:30 to Wed Feb 7, 2007 16:00\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"content":{"type":"text","$t":"When: Wed Feb 7, 2007 13:30 to Wed Feb 7, 2007 16:00\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"link":[{"rel":"alternate","type":"text/html","href":"http://www.google.com/calendar/event?eid\u003DN2lxYzFybzBpaGM2OXZoc2lxM3VhYm9vaWcgd2dAdm9pY2VtZS5uZXQ","title":"alternate"},{"rel":"self","type":"application/atom+xml","href":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/7iqc1ro0ihc69vhsiq3uabooig"}],"author":[{"name":{"$t":"w g"},"email":{"$t":"wg@voiceme.net"}}],"gCal$sendEventNotifications":{"value":"false"}},{"id":{"$t":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/kp4gil76n2vcrkt9kaotj3s12c"},"published":{"$t":"2007-02-05T22:04:42.000Z"},"updated":{"$t":"2007-02-05T22:04:42.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://schemas.google.com/g/2005#event"}],"title":{"type":"text","$t":"skate"},"summary":{"type":"html","$t":"When: Fri Feb 9, 2007 15:30 to Fri Feb 9, 2007 18:00\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"content":{"type":"text","$t":"When: Fri Feb 9, 2007 15:30 to Fri Feb 9, 2007 18:00\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"link":[{"rel":"alternate","type":"text/html","href":"http://www.google.com/calendar/event?eid\u003Da3A0Z2lsNzZuMnZjcmt0OWthb3RqM3MxMmMgd2dAdm9pY2VtZS5uZXQ","title":"alternate"},{"rel":"self","type":"application/atom+xml","href":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/kp4gil76n2vcrkt9kaotj3s12c"}],"author":[{"name":{"$t":"w g"},"email":{"$t":"wg@voiceme.net"}}],"gCal$sendEventNotifications":{"value":"false"}},{"id":{"$t":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/gkhb48fj68lcp15fd1k03tjbj0"},"published":{"$t":"2007-02-05T22:04:35.000Z"},"updated":{"$t":"2007-02-05T22:04:35.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://schemas.google.com/g/2005#event"}],"title":{"type":"text","$t":"test event 6"},"summary":{"type":"html","$t":"When: Sat Feb 10, 2007 14:00 to Sat Feb 10, 2007 17:00\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"content":{"type":"text","$t":"When: Sat Feb 10, 2007 14:00 to Sat Feb 10, 2007 17:00\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"link":[{"rel":"alternate","type":"text/html","href":"http://www.google.com/calendar/event?eid\u003DZ2toYjQ4Zmo2OGxjcDE1ZmQxazAzdGpiajAgd2dAdm9pY2VtZS5uZXQ","title":"alternate"},{"rel":"self","type":"application/atom+xml","href":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/gkhb48fj68lcp15fd1k03tjbj0"}],"author":[{"name":{"$t":"w g"},"email":{"$t":"wg@voiceme.net"}}],"gCal$sendEventNotifications":{"value":"false"}},{"id":{"$t":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/32p5g68cpean3p2ol7kanj38sg"},"published":{"$t":"2007-02-05T22:04:29.000Z"},"updated":{"$t":"2007-02-05T22:04:29.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://schemas.google.com/g/2005#event"}],"title":{"type":"text","$t":"test event 5"},"summary":{"type":"html","$t":"When: Fri Feb 9, 2007 09:00 to 10:30\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"content":{"type":"text","$t":"When: Fri Feb 9, 2007 09:00 to 10:30\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"link":[{"rel":"alternate","type":"text/html","href":"http://www.google.com/calendar/event?eid\u003DMzJwNWc2OGNwZWFuM3Ayb2w3a2FuajM4c2cgd2dAdm9pY2VtZS5uZXQ","title":"alternate"},{"rel":"self","type":"application/atom+xml","href":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/32p5g68cpean3p2ol7kanj38sg"}],"author":[{"name":{"$t":"w g"},"email":{"$t":"wg@voiceme.net"}}],"gCal$sendEventNotifications":{"value":"false"}},{"id":{"$t":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/tfqpth26conshdmav0apje1tf4"},"published":{"$t":"2007-02-05T22:04:19.000Z"},"updated":{"$t":"2007-02-05T22:04:19.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://schemas.google.com/g/2005#event"}],"title":{"type":"text","$t":"skate"},"summary":{"type":"html","$t":"When: Thu Feb 8, 2007 15:00 to Thu Feb 8, 2007 17:00\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"content":{"type":"text","$t":"When: Thu Feb 8, 2007 15:00 to Thu Feb 8, 2007 17:00\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"link":[{"rel":"alternate","type":"text/html","href":"http://www.google.com/calendar/event?eid\u003DdGZxcHRoMjZjb25zaGRtYXYwYXBqZTF0ZjQgd2dAdm9pY2VtZS5uZXQ","title":"alternate"},{"rel":"self","type":"application/atom+xml","href":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/tfqpth26conshdmav0apje1tf4"}],"author":[{"name":{"$t":"w g"},"email":{"$t":"wg@voiceme.net"}}],"gCal$sendEventNotifications":{"value":"false"}},{"id":{"$t":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/onbo9mhbr5m6mo356nog7uel4s"},"published":{"$t":"2007-02-05T22:04:07.000Z"},"updated":{"$t":"2007-02-05T22:04:07.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://schemas.google.com/g/2005#event"}],"title":{"type":"text","$t":"Sharks at Anaheim"},"summary":{"type":"html","$t":"When: Wed Feb 7, 2007 19:00 to 22:00\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"content":{"type":"text","$t":"When: Wed Feb 7, 2007 19:00 to 22:00\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"link":[{"rel":"alternate","type":"text/html","href":"http://www.google.com/calendar/event?eid\u003Db25ibzltaGJyNW02bW8zNTZub2c3dWVsNHMgd2dAdm9pY2VtZS5uZXQ","title":"alternate"},{"rel":"self","type":"application/atom+xml","href":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/onbo9mhbr5m6mo356nog7uel4s"}],"author":[{"name":{"$t":"w g"},"email":{"$t":"wg@voiceme.net"}}],"gCal$sendEventNotifications":{"value":"true"}},{"id":{"$t":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/tjqrd9fve576hieh3sa67nql5k"},"published":{"$t":"2007-02-05T22:04:02.000Z"},"updated":{"$t":"2007-02-05T22:04:02.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://schemas.google.com/g/2005#event"}],"title":{"type":"text","$t":"Sharks vs. ANAHEIM"},"summary":{"type":"html","$t":"When: Tue Feb 6, 2007 19:30 to 22:30\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"content":{"type":"text","$t":"When: Tue Feb 6, 2007 19:30 to 22:30\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"link":[{"rel":"alternate","type":"text/html","href":"http://www.google.com/calendar/event?eid\u003DdGpxcmQ5ZnZlNTc2aGllaDNzYTY3bnFsNWsgd2dAdm9pY2VtZS5uZXQ","title":"alternate"},{"rel":"self","type":"application/atom+xml","href":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/tjqrd9fve576hieh3sa67nql5k"}],"author":[{"name":{"$t":"w g"},"email":{"$t":"wg@voiceme.net"}}],"gCal$sendEventNotifications":{"value":"true"}},{"id":{"$t":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/or6dtpn065f9mntond4jh2docc"},"published":{"$t":"2007-02-05T22:03:52.000Z"},"updated":{"$t":"2007-02-05T22:03:52.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://schemas.google.com/g/2005#event"}],"title":{"type":"text","$t":"skate"},"summary":{"type":"html","$t":"When: Tue Feb 6, 2007 14:00 to 15:00\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"content":{"type":"text","$t":"When: Tue Feb 6, 2007 14:00 to 15:00\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"link":[{"rel":"alternate","type":"text/html","href":"http://www.google.com/calendar/event?eid\u003Db3I2ZHRwbjA2NWY5bW50b25kNGpoMmRvY2Mgd2dAdm9pY2VtZS5uZXQ","title":"alternate"},{"rel":"self","type":"application/atom+xml","href":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/or6dtpn065f9mntond4jh2docc"}],"author":[{"name":{"$t":"w g"},"email":{"$t":"wg@voiceme.net"}}],"gCal$sendEventNotifications":{"value":"false"}},{"id":{"$t":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/k70v8o4jt1afi17hg2spavq1c0"},"published":{"$t":"2007-02-05T22:03:36.000Z"},"updated":{"$t":"2007-02-05T22:03:36.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://schemas.google.com/g/2005#event"}],"title":{"type":"text","$t":"lunch"},"summary":{"type":"html","$t":"Recurring Event\u003Cbr\u003E First start: 2007-02-06 12:00:00 PST \u003Cbr\u003E Duration: 3600 \u003Cbr\u003EEvent Status: confirmed"},"content":{"type":"text","$t":"Recurring Event\u003Cbr\u003E First start: 2007-02-06 12:00:00 PST \u003Cbr\u003E Duration: 3600 \u003Cbr\u003EEvent Status: confirmed"},"link":[{"rel":"alternate","type":"text/html","href":"http://www.google.com/calendar/event?eid\u003DazcwdjhvNGp0MWFmaTE3aGcyc3BhdnExYzBfMjAwNzAyMDZUMjAwMDAwWiB3Z0B2b2ljZW1lLm5ldA","title":"alternate"},{"rel":"self","type":"application/atom+xml","href":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/k70v8o4jt1afi17hg2spavq1c0"}],"author":[{"name":{"$t":"w g"},"email":{"$t":"wg@voiceme.net"}}],"gCal$sendEventNotifications":{"value":"true"}},{"id":{"$t":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/6ee7b8nohdt03tv0gknm4v7124"},"published":{"$t":"2007-02-05T22:03:19.000Z"},"updated":{"$t":"2007-02-05T22:03:19.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://schemas.google.com/g/2005#event"}],"title":{"type":"text","$t":"test event 4"},"summary":{"type":"html","$t":"When: Tue Feb 6, 2007 09:00 to 11:00\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"content":{"type":"text","$t":"When: Tue Feb 6, 2007 09:00 to 11:00\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"link":[{"rel":"alternate","type":"text/html","href":"http://www.google.com/calendar/event?eid\u003DNmVlN2I4bm9oZHQwM3R2MGdrbm00djcxMjQgd2dAdm9pY2VtZS5uZXQ","title":"alternate"},{"rel":"self","type":"application/atom+xml","href":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/6ee7b8nohdt03tv0gknm4v7124"}],"author":[{"name":{"$t":"w g"},"email":{"$t":"wg@voiceme.net"}}],"gCal$sendEventNotifications":{"value":"false"}},{"id":{"$t":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/of1vh1r2q5aqdplo65i8bqbn3o"},"published":{"$t":"2007-02-05T22:03:11.000Z"},"updated":{"$t":"2007-02-05T22:03:11.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://schemas.google.com/g/2005#event"}],"title":{"type":"text","$t":"test event 3"},"summary":{"type":"html","$t":"When: Mon Feb 5, 2007 18:00 to 19:00\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"content":{"type":"text","$t":"When: Mon Feb 5, 2007 18:00 to 19:00\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"link":[{"rel":"alternate","type":"text/html","href":"http://www.google.com/calendar/event?eid\u003Db2YxdmgxcjJxNWFxZHBsbzY1aThicWJuM28gd2dAdm9pY2VtZS5uZXQ","title":"alternate"},{"rel":"self","type":"application/atom+xml","href":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/of1vh1r2q5aqdplo65i8bqbn3o"}],"author":[{"name":{"$t":"w g"},"email":{"$t":"wg@voiceme.net"}}],"gCal$sendEventNotifications":{"value":"false"}},{"id":{"$t":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/s7ahgfomlgii9qbkgpfbinr9u8"},"published":{"$t":"2007-02-05T22:02:40.000Z"},"updated":{"$t":"2007-02-05T22:03:04.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://schemas.google.com/g/2005#event"}],"title":{"type":"text","$t":"test event 2"},"summary":{"type":"html","$t":"When: Mon Feb 5, 2007 16:30 to 17:30\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"content":{"type":"text","$t":"When: Mon Feb 5, 2007 16:30 to 17:30\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"link":[{"rel":"alternate","type":"text/html","href":"http://www.google.com/calendar/event?eid\u003DczdhaGdmb21sZ2lpOXFia2dwZmJpbnI5dTggd2dAdm9pY2VtZS5uZXQ","title":"alternate"},{"rel":"self","type":"application/atom+xml","href":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/s7ahgfomlgii9qbkgpfbinr9u8"}],"author":[{"name":{"$t":"w g"},"email":{"$t":"wg@voiceme.net"}}],"gCal$sendEventNotifications":{"value":"false"}},{"id":{"$t":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/rl8focglfe6jndql4u8lg73q5k"},"published":{"$t":"2007-02-05T22:02:28.000Z"},"updated":{"$t":"2007-02-05T22:02:53.000Z"},"category":[{"scheme":"http://schemas.google.com/g/2005#kind","term":"http://schemas.google.com/g/2005#event"}],"title":{"type":"text","$t":"test event 1"},"summary":{"type":"html","$t":"When: Mon Feb 5, 2007 15:00 to Mon Feb 5, 2007 16:00\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"content":{"type":"text","$t":"When: Mon Feb 5, 2007 15:00 to Mon Feb 5, 2007 16:00\u0026nbsp; PST\u003Cbr\u003E \u003Cbr\u003EEvent Status: confirmed"},"link":[{"rel":"alternate","type":"text/html","href":"http://www.google.com/calendar/event?eid\u003Dcmw4Zm9jZ2xmZTZqbmRxbDR1OGxnNzNxNWsgd2dAdm9pY2VtZS5uZXQ","title":"alternate"},{"rel":"self","type":"application/atom+xml","href":"http://www.google.com/calendar/feeds/wg%40voiceme.net/public/basic/rl8focglfe6jndql4u8lg73q5k"}],"author":[{"name":{"$t":"w g"},"email":{"$t":"wg@voiceme.net"}}],"gCal$sendEventNotifications":{"value":"false"}}]}} \ No newline at end of file diff --git a/tests/AndroidTests/res/raw/calendarjsgz.jsgz b/tests/AndroidTests/res/raw/calendarjsgz.jsgz deleted file mode 100644 index 6f1bf543ada85ad43f2562c9f834bf3d5abff00f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1956 zcmV;V2V3|biwFou?#D#}17l%qWo~3)axyM-cys{Wn%h$2Iu?ds#g*x~8X&TK$YCz_ zgoXsD?a+km4)M&cDcM$hh$T6eoS1a+?qeH5(sWO@n}WoF8&cM?^)Jc)S4)z=)#fc5a0gwHyqd%i?dwdqKy2URt`6RwiVv`6^zHtApf;sbTOz;WCq8=qy z=-YJ*ao?^z9MzJ@K?1Lzn)TB-2Jjf@Ljc>F)|Rys0Dzgt+F7K_;`>_r-`{G5P+TI> zzfFDWWYPtWNttjw$5hlF{><+1MTm1{;y%iI5;zsvg9@Ds$;~D4#3~UL`gB@|j&WE< zLh;5NtsaP?C>t^)ve&GRvX|r^*}P?~UW_MiH4Q6e9EX$Lb^IF&#eWh2l(T>{n*V}2 zLFsXfc@hf#*aWp=E>I#o78ip^5y8*z%hL#F1L=qBi|)TR`m8#e!R{h5*=i!r~Lk|LCQKl8RWgs=_Nwg#TP{eL;|lh`V8fKM|qk0c-j<(i(uJW<%C z2pf5rwxtnvq%O9k#*vigC&@}%0g_-pHt1~t9t}Y)9{p4Layu;S@Y#xs|L2k0Bof}1@;{r=i64_}Q1dZkROI>mJd3@{dqKzy3^=Cw$R2IVtv?NEIRX_E_#5_} zN09Vkn2wj-duw?bp`HP+?@VTA*9_&WHzut)8riM`osL6V(HMRe=B<{PcQ>`?`QK2r zFJf-B+?!A`M+?vN6!X<*!k;|l!#6=QK_SmZAs>dfManc%T|aE-6wd8q!tzMjh&@=ObYs7;W@}|l?a8x0G&J{tls(GZ0aB3C0VWK2e`zKLH3ORna6J;9 zr3_|iU_O#lthZ6l}CzF&DDy)Tu4Qz zq?aYjEfR%8Ww5fSnprgW?vE{veXwP(0(U?c6ACsCZd8*nc->0_`|Mmc$xVuuou$)@ zd=zx5PnT`(`v`PVV5GTv(~dBrN(5Qhm?9b|O?3i~h*YsL@}Tqi$j-oqG!|6a>2o3JleT2e8!H=B$rE4l$WU!h?GD za&XTfXbw;mU|CGmlH`zofgEz{@RvG6FDX3QT(2b_J^Dk#UdoX@%G&`_oSvE57XxMl zW?(^WiFyMuz8f#bcc(LR*ac>AQ+=dtv)o5O3ZoWl5zmS>q7$ZQI%RGn!J*1aA_X+c zBV{ADN=Ui&P(0;QwgTu-<+88Uop84A?9y6=wwv_{Qk ze`qEav=wLcmG>_WV5el8y>^HX5hw3ckOZ^XX-(!>Yv`VjJ%uB^L1&>hElZDI*n0)A z%Ji7?6RFehT%2DTrK^(!7k<^(epOa}-NS-rhjMmOeMG5EZZwmcVSi{t)C)s&)?bc? zW5uFf-XHM;s6Mv%>jU6}#kwOR3UqDKB2+NysDTF^W|up&IM3#aBgb zY5fVEB%E{fuY4FlsIDt3M5Ce=+m!RRff_nD7 zt(T64w^|6Uug%ai+#vLu|QDkV!ByHHbyM@=lv~TOjE0_X zkFF8}HVPM*oMurb - - -http://www.google.com/calendar/feeds/default/private/full2007-02-05T22:04:50.000Zw gw gw gwg@voiceme.netGoogle Calendar13125http://www.google.com/calendar/feeds/default/private/full/7iqc1ro0ihc69vhsiq3uabooig2007-02-05T22:04:50.000Z2007-02-05T22:04:50.000Zskatew gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/kp4gil76n2vcrkt9kaotj3s12c2007-02-05T22:04:42.000Z2007-02-05T22:04:42.000Zskatew gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/gkhb48fj68lcp15fd1k03tjbj02007-02-05T22:04:35.000Z2007-02-05T22:04:35.000Ztest event 6w gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/32p5g68cpean3p2ol7kanj38sg2007-02-05T22:04:29.000Z2007-02-05T22:04:29.000Ztest event 5w gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/tfqpth26conshdmav0apje1tf42007-02-05T22:04:19.000Z2007-02-05T22:04:19.000Zskatew gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/onbo9mhbr5m6mo356nog7uel4s2007-02-05T22:04:07.000Z2007-02-05T22:04:07.000ZSharks at Anaheimw gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/tjqrd9fve576hieh3sa67nql5k2007-02-05T22:04:02.000Z2007-02-05T22:04:02.000ZSharks vs. ANAHEIMw gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/or6dtpn065f9mntond4jh2docc2007-02-05T22:03:52.000Z2007-02-05T22:03:52.000Zskatew gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/k70v8o4jt1afi17hg2spavq1c02007-02-05T22:03:36.000Z2007-02-05T22:03:36.000Zlunchw gwg@voiceme.netDTSTART;TZID=America/Los_Angeles:20070206T120000 -DURATION:PT3600S -RRULE:FREQ=DAILY;WKST=SU -BEGIN:VTIMEZONE -TZID:America/Los_Angeles -X-LIC-LOCATION:America/Los_Angeles -BEGIN:STANDARD -TZOFFSETFROM:-0700 -TZOFFSETTO:-0800 -TZNAME:PST -DTSTART:19701025T020000 -RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU -END:STANDARD -BEGIN:DAYLIGHT -TZOFFSETFROM:-0800 -TZOFFSETTO:-0700 -TZNAME:PDT -DTSTART:19700405T020000 -RRULE:FREQ=YEARLY;BYMONTH=4;BYDAY=1SU -END:DAYLIGHT -END:VTIMEZONE -http://www.google.com/calendar/feeds/default/private/full/6ee7b8nohdt03tv0gknm4v71242007-02-05T22:03:19.000Z2007-02-05T22:03:19.000Ztest event 4w gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/of1vh1r2q5aqdplo65i8bqbn3o2007-02-05T22:03:11.000Z2007-02-05T22:03:11.000Ztest event 3w gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/s7ahgfomlgii9qbkgpfbinr9u82007-02-05T22:02:40.000Z2007-02-05T22:03:04.000Ztest event 2w gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/rl8focglfe6jndql4u8lg73q5k2007-02-05T22:02:28.000Z2007-02-05T22:02:53.000Ztest event 1w gwg@voiceme.net diff --git a/tests/AndroidTests/res/raw/calendarxmlgz.xmlgz b/tests/AndroidTests/res/raw/calendarxmlgz.xmlgz deleted file mode 100644 index 6c864627fa6ff2d06b4f1de775738367298b762f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2412 zcmV-y36u68iwFo!?#D#}17l%qWo~3)axyM>ZEOJToLO_?Iu^&@yQ;qfRrA2ZRAO1i zX1RnO(k!8GY&yi<1iwtlw(x>CY_Wt-KQa&?H!(|1?x5806eAr;|05rtACg6?-{!uT zo8mZe!r&&)UxR!O2S#W*fpwGrrM9k0`ERxA5Mwh(EraAHZxa$#IBqtZUC)H;Ft#`d zfXLNJ=;v29l`z7=BSx`dZ_H8o+6aB_ic2DFaH&DEG>DUgqoZ;!O)YcNBr$C4qvYBO zL(9X<=Bu$bw%?Jr*P7O^8q}(eS=$l5V`Lx?2PTTS)W?J~@eoZs!bPz&MFexhiRV>0 z+PXT4Oj=;pXotls0Iz_kLRbNXiU_U&09uuMv8WpKj}^wxxuqz4*rR`poWRWI2#)72|}K zCpS>sYCscWhjFbMARn*p)=4_*X4`}M@0m*X@19+v&qp9mQ9laHo2W=fm`bRh8^=pf!=(uXg%wT+X%H~ z*nQGMgOJjOCN%4&UycUwH_;x&iT3nBwWMzBsyjz!*b`Cj>A|K$&ZUQw z1OZ4wS%PKoVHwPm3m&x)&D(pV>_HT6KWx!>M*bce+^h(V#$Q}tIljJ4U9QPp6 zf?(*xJ|*m`+nt`4Jx`s)(H+kr&nI@gc6QzEwwrZkOz6ZkQ$r;r&Tt(a8}UQrC3uq= z-?v@LBQXk+2*vbENO))*L`4CffQpUr1r>)-frL8HpqD5MZ6XJnYxo3o`^46T-dGmo zx$MgxI(Ll}erw@#4_r zM?fI1?t+7;5X2Kuu`y-}6?CpiZfTj5SR;l8NjPvH3Ys6nZhP(;jV7=84|BArFU)r2 zAh*skF|q^eJjBS>vn57RWS$s%+_(_qlMsUkDqna*g15v-?TXA1Lx7QJNhKq~C=enT zdc_e6T%nX4-iLza6Ns@fW|bHsYs8QjKW0kbptMkCTE8`sh5EA&X99w)33BCv0h!*8 z$_}ja5F=a9mKai*d1CBw<3fzjv&I1BBZ!f%F~FO($hnC@hU19XP@#P`gJ4PlMUu>2|ECEugs%ETbYjqRxYg zY&~04i0q?cj~f?Md=^xc((R}tP*GxWaS;Z3SoUo_7JbPN1yKq@t2n`4AvuT&P&@$@ z8)K$W@o1xXl;jY})dOT>$7c;26cvuX@Ca)EcvkuV>iyC}QMHK<4Z-aHPLw;Q-(qA( z*Lkp!t!ImkLXmlF>~Z7&7aJs=FhGq}kB=l?9>>g|^7{Lz^+s`-Pgz@UxZ~I?52six zO16V-Awg0x7<=OAFhovy{S6?)5Sb>|xw=xnYj$Mz79Y{v@E=4i&^$#oAZmLaYAB0= zIuP`rl_>p$>BUE8c%5nSk*Q~gBJ95l-{Z!GBA=5YQc95{-i%9WLS=2&DvTwQL;;Y* zVc8Ez7?=guhGu9SIz%N@#N#QlV|>}QI=K80I#9do&2+a8mHt4~`y!xAl9AGmLfP+4 z2axUMM`lEwY59?0vlfbZZ}~`V3aD*78^Wz^2F>|kaXXaV z`b=5WpXG-3E4`K*^;zG!6*O=Qb?CWTpZD&4(KGAJ9K+2Fv@;#U&D66c2rqpgK`!6# zKR8Rr*qFrWM_g;Dk7~WA{-J7}#?3pwYpbOB2*5N2(<=bJerf#b)zwZ{sr*z034q71 zUwXY?_svSH*L=8X)I0ZsKl*<@syC0nzJ9rFwmVAYx7v}LT32a){gMt-d1sifU!Jb+ zJKwMFyWdxxziYGVjtW*9^6`#7)R2n-9R*GoteW!h=zEMVpCIJGO0&5ib zg=vw8g@Z6X;k1Cj=xKqS^JN9*e(vc1_7vDD=zclW?jB~c(1UW@jCCIX(>3NY+lL0S z1M58S%+|AkCtqg&(7+xyF3Ydav-~>ld>Lgw&)%VdAwRYG7>-3WHX|>TM5m;W^*{&@ z6N5j67(C;|5ZF5}FqoUZH84XVm~P(NK4SxI8HxAO@@y zzzM_v1;&X1StEwAFm2Q}eI4?N2EC~J)N&9sXPW;b(u0m@sus({$PTRY5F=a9mKdc1 z^TgQW#)TN4^l*Tf{^u0oD1a21I~)*urD14T-VjS}V2-`Qq~uveVSMn28LYt4(Ex!J zQD7V(JaYi?X9dkKyBeJPnyQU;zc<$#J-*wX2g*X3Gk&-%JFw0JkZe6$fD{Gh0kX%9 e3qU^6l0!Ul$?>uOlWQ4Swf_JT{t4adRsaAZNuekJ diff --git a/tests/AndroidTests/res/xml/calendar.xml b/tests/AndroidTests/res/xml/calendar.xml deleted file mode 100644 index 1adcd7486ef7d..0000000000000 --- a/tests/AndroidTests/res/xml/calendar.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - -http://www.google.com/calendar/feeds/default/private/full2007-02-05T22:04:50.000Zw gw gw gwg@voiceme.netGoogle Calendar13125http://www.google.com/calendar/feeds/default/private/full/7iqc1ro0ihc69vhsiq3uabooig2007-02-05T22:04:50.000Z2007-02-05T22:04:50.000Zskatew gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/kp4gil76n2vcrkt9kaotj3s12c2007-02-05T22:04:42.000Z2007-02-05T22:04:42.000Zskatew gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/gkhb48fj68lcp15fd1k03tjbj02007-02-05T22:04:35.000Z2007-02-05T22:04:35.000Ztest event 6w gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/32p5g68cpean3p2ol7kanj38sg2007-02-05T22:04:29.000Z2007-02-05T22:04:29.000Ztest event 5w gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/tfqpth26conshdmav0apje1tf42007-02-05T22:04:19.000Z2007-02-05T22:04:19.000Zskatew gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/onbo9mhbr5m6mo356nog7uel4s2007-02-05T22:04:07.000Z2007-02-05T22:04:07.000ZSharks at Anaheimw gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/tjqrd9fve576hieh3sa67nql5k2007-02-05T22:04:02.000Z2007-02-05T22:04:02.000ZSharks vs. ANAHEIMw gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/or6dtpn065f9mntond4jh2docc2007-02-05T22:03:52.000Z2007-02-05T22:03:52.000Zskatew gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/k70v8o4jt1afi17hg2spavq1c02007-02-05T22:03:36.000Z2007-02-05T22:03:36.000Zlunchw gwg@voiceme.netDTSTART;TZID=America/Los_Angeles:20070206T120000 -DURATION:PT3600S -RRULE:FREQ=DAILY;WKST=SU -BEGIN:VTIMEZONE -TZID:America/Los_Angeles -X-LIC-LOCATION:America/Los_Angeles -BEGIN:STANDARD -TZOFFSETFROM:-0700 -TZOFFSETTO:-0800 -TZNAME:PST -DTSTART:19701025T020000 -RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU -END:STANDARD -BEGIN:DAYLIGHT -TZOFFSETFROM:-0800 -TZOFFSETTO:-0700 -TZNAME:PDT -DTSTART:19700405T020000 -RRULE:FREQ=YEARLY;BYMONTH=4;BYDAY=1SU -END:DAYLIGHT -END:VTIMEZONE -http://www.google.com/calendar/feeds/default/private/full/6ee7b8nohdt03tv0gknm4v71242007-02-05T22:03:19.000Z2007-02-05T22:03:19.000Ztest event 4w gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/of1vh1r2q5aqdplo65i8bqbn3o2007-02-05T22:03:11.000Z2007-02-05T22:03:11.000Ztest event 3w gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/s7ahgfomlgii9qbkgpfbinr9u82007-02-05T22:02:40.000Z2007-02-05T22:03:04.000Ztest event 2w gwg@voiceme.nethttp://www.google.com/calendar/feeds/default/private/full/rl8focglfe6jndql4u8lg73q5k2007-02-05T22:02:28.000Z2007-02-05T22:02:53.000Ztest event 1w gwg@voiceme.net diff --git a/tests/AndroidTests/src/com/android/unit_tests/GDataParseTest.java b/tests/AndroidTests/src/com/android/unit_tests/GDataParseTest.java deleted file mode 100644 index af854832aff02..0000000000000 --- a/tests/AndroidTests/src/com/android/unit_tests/GDataParseTest.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (C) 2006 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.unit_tests; - -import android.content.res.XmlResourceParser; -import android.test.AndroidTestCase; -import android.test.PerformanceTestCase; -import android.test.suitebuilder.annotation.MediumTest; -import android.test.suitebuilder.annotation.SmallTest; -import android.util.Xml; -import com.google.wireless.gdata.data.Entry; -import com.google.wireless.gdata.data.Feed; -import com.google.wireless.gdata.parser.ParseException; -import com.google.wireless.gdata.parser.xml.XmlGDataParser; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.xmlpull.v1.XmlPullParser; -import org.xmlpull.v1.XmlPullParserException; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.zip.GZIPInputStream; - -/** - * Tests timing on parsing various formats of GData. - */ -public class GDataParseTest extends AndroidTestCase implements PerformanceTestCase { - - private static void parseXml(InputStream is) throws ParseException, IOException { - XmlPullParser xmlParser = Xml.newPullParser(); - XmlGDataParser parser = new XmlGDataParser(is, xmlParser); - Feed feed = parser.init(); - Entry entry = null; - while (parser.hasMoreData()) { - entry = parser.readNextEntry(entry); - } - } - - private static void parseXml(XmlPullParser xmlP) throws ParseException, IOException { - XmlGDataParser parser = new XmlGDataParser(null /* in */, xmlP); - Feed feed = parser.init(); - Entry entry = null; - while (parser.hasMoreData()) { - entry = parser.readNextEntry(entry); - } - } - - private static void dumpXml(XmlPullParser parser) throws - XmlPullParserException, IOException { - int eventType = parser.nextTag(); - while (eventType != XmlPullParser.END_DOCUMENT) { - switch (eventType) { - case XmlPullParser.START_TAG: - parser.getName(); - // System.out.print("<" + parser.getName()); - int nattrs = parser.getAttributeCount(); - for (int i = 0; i < nattrs; ++i) { - parser.getAttributeName(i); - parser.getAttributeValue(i); - // System.out.print(" " + parser.getAttributeName(i) + "=\"" - // + parser.getAttributeValue(i) + "\""); - } - // System.out.print(">"); - break; - case XmlPullParser.END_TAG: - parser.getName(); - // System.out.print(""); - break; - case XmlPullParser.TEXT: - parser.getText(); - // System.out.print(parser.getText()); - break; - default: - // do nothing - } - eventType = parser.next(); - } - } - - private byte[] getBytesForResource(int resid) throws Exception { - // all resources are written into a zip file, so the InputStream we - // get for a resource is on top of zipped - // data. in order to compare performance of parsing unzipped vs. - // zipped content, we first read the data into an in-memory buffer. - InputStream zipIs = null; - try { - zipIs = mContext.getResources().openRawResource(resid); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - byte buf[] = new byte[1024]; - int bytesRead = zipIs.read(buf); - while (bytesRead > 0) { - baos.write(buf, 0, bytesRead); - bytesRead = zipIs.read(buf); - } - return baos.toByteArray(); - } finally { - if (zipIs != null) { - zipIs.close(); - } - } - } - - public boolean isPerformanceOnly() { - return true; - } - - public int startPerformance(PerformanceTestCase.Intermediates intermediates) { - return 0; - } - - @MediumTest - public void testXml() throws Exception { - InputStream is = new ByteArrayInputStream(getBytesForResource(R.raw.calendarxml)); - try { - is.reset(); - parseXml(is); - } finally { - is.close(); - } - } - - @MediumTest - public void testXmlGzip() throws Exception { - InputStream gzIs = new GZIPInputStream( - new ByteArrayInputStream(getBytesForResource(R.raw.calendarxmlgz))); - try { - parseXml(gzIs); - } finally { - gzIs.close(); - } - } - - @MediumTest - public void testJson() throws Exception { - String jsonString = new String(getBytesForResource(R.raw.calendarjs), "UTF-8"); - JSONTokener tokens = new JSONTokener(jsonString); - assertNotNull(new JSONObject(tokens)); - } - - @SmallTest - public void testBinaryXml() throws Exception { - XmlResourceParser parser = mContext.getResources().getXml(R.xml.calendar); - parseXml(parser); - parser.close(); - } -}