blob: 183be415880c39db48c7b9292f6c9e4994b8d3d3 [file] [log] [blame]
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +09001/*
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
17package android.test.mock;
18
19import android.content.ContentProviderOperation;
20import android.content.ContentProviderResult;
21import android.content.ContentValues;
22import android.content.EntityIterator;
23import android.content.IContentProvider;
24import android.content.res.AssetFileDescriptor;
25import android.database.Cursor;
26import android.database.CursorWindow;
27import android.database.IBulkCursor;
28import android.database.IContentObserver;
29import android.net.Uri;
Brad Fitzpatrick1877d012010-03-04 17:48:13 -080030import android.os.Bundle;
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +090031import android.os.IBinder;
32import android.os.ParcelFileDescriptor;
33import android.os.RemoteException;
34
Dianne Hackborn23fdaf62010-08-06 12:16:55 -070035import java.io.FileNotFoundException;
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +090036import java.util.ArrayList;
37
38/**
39 * Mock implementation of IContentProvider. All methods are non-functional and throw
40 * {@link java.lang.UnsupportedOperationException}. Tests can extend this class to
41 * implement behavior needed for tests.
42 *
Brad Fitzpatrick1877d012010-03-04 17:48:13 -080043 * @hide - @hide because this exposes bulkQuery() and call(), which must also be hidden.
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +090044 */
45public class MockIContentProvider implements IContentProvider {
46 public int bulkInsert(Uri url, ContentValues[] initialValues) {
47 throw new UnsupportedOperationException("unimplemented mock method");
48 }
49
50 public IBulkCursor bulkQuery(Uri url, String[] projection, String selection,
51 String[] selectionArgs, String sortOrder, IContentObserver observer,
52 CursorWindow window) {
53 throw new UnsupportedOperationException("unimplemented mock method");
54 }
55
56 @SuppressWarnings("unused")
57 public int delete(Uri url, String selection, String[] selectionArgs)
58 throws RemoteException {
59 throw new UnsupportedOperationException("unimplemented mock method");
60 }
61
62 public String getType(Uri url) {
63 throw new UnsupportedOperationException("unimplemented mock method");
64 }
65
66 @SuppressWarnings("unused")
67 public Uri insert(Uri url, ContentValues initialValues) throws RemoteException {
68 throw new UnsupportedOperationException("unimplemented mock method");
69 }
70
71 public ParcelFileDescriptor openFile(Uri url, String mode) {
72 throw new UnsupportedOperationException("unimplemented mock method");
73 }
74
75 public AssetFileDescriptor openAssetFile(Uri uri, String mode) {
76 throw new UnsupportedOperationException("unimplemented mock method");
77 }
78
79 public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations) {
80 throw new UnsupportedOperationException("unimplemented mock method");
81 }
82
83 public Cursor query(Uri url, String[] projection, String selection, String[] selectionArgs,
84 String sortOrder) {
85 throw new UnsupportedOperationException("unimplemented mock method");
86 }
87
88 public EntityIterator queryEntities(Uri url, String selection, String[] selectionArgs,
89 String sortOrder) {
90 throw new UnsupportedOperationException("unimplemented mock method");
91 }
92
93 public int update(Uri url, ContentValues values, String selection, String[] selectionArgs)
94 throws RemoteException {
95 throw new UnsupportedOperationException("unimplemented mock method");
96 }
97
Brad Fitzpatrick1877d012010-03-04 17:48:13 -080098 public Bundle call(String method, String request, Bundle args)
99 throws RemoteException {
100 throw new UnsupportedOperationException("unimplemented mock method");
101 }
102
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +0900103 public IBinder asBinder() {
104 throw new UnsupportedOperationException("unimplemented mock method");
105 }
Dianne Hackborn23fdaf62010-08-06 12:16:55 -0700106
107 public String[] getStreamTypes(Uri url, String mimeTypeFilter) throws RemoteException {
108 throw new UnsupportedOperationException("unimplemented mock method");
109 }
110
111 public AssetFileDescriptor openTypedAssetFile(Uri url, String mimeType, Bundle opts)
112 throws RemoteException, FileNotFoundException {
113 throw new UnsupportedOperationException("unimplemented mock method");
114 }
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +0900115}