| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 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.ContentValues; |
| 20 | import android.content.IContentProvider; |
| Fred Quintana | 6a8d5332f | 2009-05-07 17:35:38 -0700 | [diff] [blame] | 21 | import android.content.Entity; |
| 22 | import android.content.EntityIterator; |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 23 | import android.content.res.AssetFileDescriptor; |
| 24 | import android.database.Cursor; |
| 25 | import android.database.CursorWindow; |
| 26 | import android.database.IBulkCursor; |
| 27 | import android.database.IContentObserver; |
| 28 | import android.net.Uri; |
| 29 | import android.os.RemoteException; |
| 30 | import android.os.IBinder; |
| 31 | import android.os.ParcelFileDescriptor; |
| 32 | |
| 33 | import java.io.FileNotFoundException; |
| 34 | |
| 35 | /** |
| 36 | * Mock implementation of IContentProvider that does nothing. All methods are non-functional and |
| 37 | * throw {@link java.lang.UnsupportedOperationException}. Tests can extend this class to |
| 38 | * implement behavior needed for tests. |
| 39 | * |
| 40 | * @hide - Because IContentProvider hides bulkQuery(), this doesn't pass through JavaDoc |
| 41 | * without generating errors. |
| 42 | * |
| 43 | */ |
| 44 | public class MockContentProvider implements IContentProvider { |
| 45 | |
| 46 | @SuppressWarnings("unused") |
| 47 | public int bulkInsert(Uri url, ContentValues[] initialValues) throws RemoteException { |
| 48 | // TODO Auto-generated method stub |
| 49 | return 0; |
| 50 | } |
| 51 | |
| Fred Quintana | 6a8d5332f | 2009-05-07 17:35:38 -0700 | [diff] [blame] | 52 | public Uri[] bulkInsertEntities(Uri uri, Entity[] entities) throws RemoteException { |
| 53 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 54 | } |
| 55 | |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 56 | @SuppressWarnings("unused") |
| 57 | public IBulkCursor bulkQuery(Uri url, String[] projection, String selection, |
| 58 | String[] selectionArgs, String sortOrder, IContentObserver observer, |
| 59 | CursorWindow window) throws RemoteException { |
| 60 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 61 | } |
| 62 | |
| 63 | @SuppressWarnings("unused") |
| 64 | public int delete(Uri url, String selection, String[] selectionArgs) |
| 65 | throws RemoteException { |
| 66 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 67 | } |
| 68 | |
| 69 | @SuppressWarnings("unused") |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 70 | public String getType(Uri url) throws RemoteException { |
| 71 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 72 | } |
| 73 | |
| 74 | @SuppressWarnings("unused") |
| 75 | public Uri insert(Uri url, ContentValues initialValues) throws RemoteException { |
| 76 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 77 | } |
| 78 | |
| 79 | @SuppressWarnings("unused") |
| 80 | public ParcelFileDescriptor openFile(Uri url, String mode) throws RemoteException, |
| 81 | FileNotFoundException { |
| 82 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 83 | } |
| 84 | |
| 85 | @SuppressWarnings("unused") |
| 86 | public AssetFileDescriptor openAssetFile(Uri uri, String mode) |
| 87 | throws FileNotFoundException { |
| 88 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 89 | } |
| 90 | |
| 91 | @SuppressWarnings("unused") |
| 92 | public Cursor query(Uri url, String[] projection, String selection, String[] selectionArgs, |
| 93 | String sortOrder) throws RemoteException { |
| 94 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 95 | } |
| 96 | |
| Fred Quintana | 6a8d5332f | 2009-05-07 17:35:38 -0700 | [diff] [blame] | 97 | public EntityIterator queryEntities(Uri url, String selection, String[] selectionArgs, |
| 98 | String sortOrder) throws RemoteException { |
| 99 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 100 | } |
| 101 | |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 102 | @SuppressWarnings("unused") |
| 103 | public int update(Uri url, ContentValues values, String selection, String[] selectionArgs) |
| 104 | throws RemoteException { |
| 105 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 106 | } |
| 107 | |
| Fred Quintana | 6a8d5332f | 2009-05-07 17:35:38 -0700 | [diff] [blame] | 108 | public int[] bulkUpdateEntities(Uri uri, Entity[] entities) throws RemoteException { |
| 109 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 110 | } |
| 111 | |
| The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 112 | public IBinder asBinder() { |
| 113 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 114 | } |
| 115 | |
| 116 | } |