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; |
Daisuke Miyakawa | 8280c2b | 2009-10-22 08:36:42 +0900 | [diff] [blame] | 26 | import android.net.Uri; |
Brad Fitzpatrick | 1877d01 | 2010-03-04 17:48:13 -0800 | [diff] [blame] | 27 | import android.os.Bundle; |
Daisuke Miyakawa | 8280c2b | 2009-10-22 08:36:42 +0900 | [diff] [blame] | 28 | import android.os.IBinder; |
| 29 | import android.os.ParcelFileDescriptor; |
| 30 | import android.os.RemoteException; |
| 31 | |
Dianne Hackborn | 23fdaf6 | 2010-08-06 12:16:55 -0700 | [diff] [blame] | 32 | import java.io.FileNotFoundException; |
Daisuke Miyakawa | 8280c2b | 2009-10-22 08:36:42 +0900 | [diff] [blame] | 33 | import java.util.ArrayList; |
| 34 | |
| 35 | /** |
| 36 | * Mock implementation of IContentProvider. All methods are non-functional and throw |
| 37 | * {@link java.lang.UnsupportedOperationException}. Tests can extend this class to |
| 38 | * implement behavior needed for tests. |
| 39 | * |
Brad Fitzpatrick | 1877d01 | 2010-03-04 17:48:13 -0800 | [diff] [blame] | 40 | * @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] | 41 | */ |
| 42 | public class MockIContentProvider implements IContentProvider { |
| 43 | public int bulkInsert(Uri url, ContentValues[] initialValues) { |
| 44 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 45 | } |
| 46 | |
Daisuke Miyakawa | 8280c2b | 2009-10-22 08:36:42 +0900 | [diff] [blame] | 47 | @SuppressWarnings("unused") |
| 48 | public int delete(Uri url, String selection, String[] selectionArgs) |
| 49 | throws RemoteException { |
| 50 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 51 | } |
| 52 | |
| 53 | public String getType(Uri url) { |
| 54 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 55 | } |
| 56 | |
| 57 | @SuppressWarnings("unused") |
| 58 | public Uri insert(Uri url, ContentValues initialValues) throws RemoteException { |
| 59 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 60 | } |
| 61 | |
| 62 | public ParcelFileDescriptor openFile(Uri url, String mode) { |
| 63 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 64 | } |
| 65 | |
| 66 | public AssetFileDescriptor openAssetFile(Uri uri, String mode) { |
| 67 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 68 | } |
| 69 | |
| 70 | public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations) { |
| 71 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 72 | } |
| 73 | |
| 74 | public Cursor query(Uri url, String[] projection, String selection, String[] selectionArgs, |
| 75 | String sortOrder) { |
| 76 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 77 | } |
| 78 | |
| 79 | public EntityIterator queryEntities(Uri url, String selection, String[] selectionArgs, |
| 80 | String sortOrder) { |
| 81 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 82 | } |
| 83 | |
| 84 | public int update(Uri url, ContentValues values, String selection, String[] selectionArgs) |
| 85 | throws RemoteException { |
| 86 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 87 | } |
| 88 | |
Brad Fitzpatrick | 1877d01 | 2010-03-04 17:48:13 -0800 | [diff] [blame] | 89 | public Bundle call(String method, String request, Bundle args) |
| 90 | throws RemoteException { |
| 91 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 92 | } |
| 93 | |
Daisuke Miyakawa | 8280c2b | 2009-10-22 08:36:42 +0900 | [diff] [blame] | 94 | public IBinder asBinder() { |
| 95 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 96 | } |
Dianne Hackborn | 23fdaf6 | 2010-08-06 12:16:55 -0700 | [diff] [blame] | 97 | |
| 98 | public String[] getStreamTypes(Uri url, String mimeTypeFilter) throws RemoteException { |
| 99 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 100 | } |
| 101 | |
| 102 | public AssetFileDescriptor openTypedAssetFile(Uri url, String mimeType, Bundle opts) |
| 103 | throws RemoteException, FileNotFoundException { |
| 104 | throw new UnsupportedOperationException("unimplemented mock method"); |
| 105 | } |
Daisuke Miyakawa | 8280c2b | 2009-10-22 08:36:42 +0900 | [diff] [blame] | 106 | } |