Daisuke Miyakawa | 8280c2b | 2009-10-22 08:36:42 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package android.test.mock; |
| 18 | |
| 19 | import android.content.ContentProviderOperation; |
| 20 | import android.content.ContentProviderResult; |
| 21 | import android.content.ContentValues; |
| 22 | import android.content.EntityIterator; |
| 23 | import android.content.IContentProvider; |
| 24 | import android.content.res.AssetFileDescriptor; |
| 25 | import android.database.Cursor; |
| 26 | import android.database.CursorWindow; |
| 27 | import android.database.IBulkCursor; |
| 28 | import android.database.IContentObserver; |
| 29 | import android.net.Uri; |
Brad Fitzpatrick | 1877d01 | 2010-03-04 17:48:13 -0800 | [diff] [blame^] | 30 | import android.os.Bundle; |
Daisuke Miyakawa | 8280c2b | 2009-10-22 08:36:42 +0900 | [diff] [blame] | 31 | import android.os.IBinder; |
| 32 | import android.os.ParcelFileDescriptor; |
| 33 | import android.os.RemoteException; |
| 34 | |
| 35 | import java.util.ArrayList; |
| 36 | |
| 37 | /** |
| 38 | * Mock implementation of IContentProvider. All methods are non-functional and throw |
| 39 | * {@link java.lang.UnsupportedOperationException}. Tests can extend this class to |
| 40 | * implement behavior needed for tests. |
| 41 | * |
Brad Fitzpatrick | 1877d01 | 2010-03-04 17:48:13 -0800 | [diff] [blame^] | 42 | * @hide - @hide because this exposes bulkQuery() and call(), which must also be hidden. |
Daisuke Miyakawa | 8280c2b | 2009-10-22 08:36:42 +0900 | [diff] [blame] | 43 | */ |
| 44 | public class MockIContentProvider implements IContentProvider { |
| 45 | public int bulkInsert(Uri url, ContentValues[] initialValues) { |
| 46 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 47 | } |
| 48 | |
| 49 | public IBulkCursor bulkQuery(Uri url, String[] projection, String selection, |
| 50 | String[] selectionArgs, String sortOrder, IContentObserver observer, |
| 51 | CursorWindow window) { |
| 52 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 53 | } |
| 54 | |
| 55 | @SuppressWarnings("unused") |
| 56 | public int delete(Uri url, String selection, String[] selectionArgs) |
| 57 | throws RemoteException { |
| 58 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 59 | } |
| 60 | |
| 61 | public String getType(Uri url) { |
| 62 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 63 | } |
| 64 | |
| 65 | @SuppressWarnings("unused") |
| 66 | public Uri insert(Uri url, ContentValues initialValues) throws RemoteException { |
| 67 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 68 | } |
| 69 | |
| 70 | public ParcelFileDescriptor openFile(Uri url, String mode) { |
| 71 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 72 | } |
| 73 | |
| 74 | public AssetFileDescriptor openAssetFile(Uri uri, String mode) { |
| 75 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 76 | } |
| 77 | |
| 78 | public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations) { |
| 79 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 80 | } |
| 81 | |
| 82 | public Cursor query(Uri url, String[] projection, String selection, String[] selectionArgs, |
| 83 | String sortOrder) { |
| 84 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 85 | } |
| 86 | |
| 87 | public EntityIterator queryEntities(Uri url, String selection, String[] selectionArgs, |
| 88 | String sortOrder) { |
| 89 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 90 | } |
| 91 | |
| 92 | public int update(Uri url, ContentValues values, String selection, String[] selectionArgs) |
| 93 | throws RemoteException { |
| 94 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 95 | } |
| 96 | |
Brad Fitzpatrick | 1877d01 | 2010-03-04 17:48:13 -0800 | [diff] [blame^] | 97 | public Bundle call(String method, String request, Bundle args) |
| 98 | throws RemoteException { |
| 99 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 100 | } |
| 101 | |
Daisuke Miyakawa | 8280c2b | 2009-10-22 08:36:42 +0900 | [diff] [blame] | 102 | public IBinder asBinder() { |
| 103 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 104 | } |
| 105 | } |