blob: 0be5bea276f3a57b79a34057dd5bb5a3506457c9 [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
35import 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 Fitzpatrick1877d012010-03-04 17:48:13 -080042 * @hide - @hide because this exposes bulkQuery() and call(), which must also be hidden.
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +090043 */
44public 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 Fitzpatrick1877d012010-03-04 17:48:13 -080097 public Bundle call(String method, String request, Bundle args)
98 throws RemoteException {
99 throw new UnsupportedOperationException("unimplemented mock method");
100 }
101
Daisuke Miyakawa8280c2b2009-10-22 08:36:42 +0900102 public IBinder asBinder() {
103 throw new UnsupportedOperationException("unimplemented mock method");
104 }
105}