blob: 74f86d84e922cbf90cfae1b663f8dece5e1bc5ab [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
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
17package android.test.mock;
18
19import android.content.ContentValues;
20import android.content.IContentProvider;
Fred Quintana6a8d5332f2009-05-07 17:35:38 -070021import android.content.Entity;
22import android.content.EntityIterator;
Fred Quintana89437372009-05-15 15:10:40 -070023import android.content.ContentProviderResult;
24import android.content.ContentProviderOperation;
25import android.content.OperationApplicationException;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080026import android.content.res.AssetFileDescriptor;
27import android.database.Cursor;
28import android.database.CursorWindow;
29import android.database.IBulkCursor;
30import android.database.IContentObserver;
31import android.net.Uri;
32import android.os.RemoteException;
33import android.os.IBinder;
34import android.os.ParcelFileDescriptor;
35
36import java.io.FileNotFoundException;
Fred Quintana03d94902009-05-22 14:23:31 -070037import java.util.ArrayList;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080038
39/**
40 * Mock implementation of IContentProvider that does nothing. All methods are non-functional and
41 * throw {@link java.lang.UnsupportedOperationException}. Tests can extend this class to
42 * implement behavior needed for tests.
43 *
44 * @hide - Because IContentProvider hides bulkQuery(), this doesn't pass through JavaDoc
45 * without generating errors.
46 *
47 */
48public class MockContentProvider implements IContentProvider {
49
50 @SuppressWarnings("unused")
51 public int bulkInsert(Uri url, ContentValues[] initialValues) throws RemoteException {
52 // TODO Auto-generated method stub
53 return 0;
54 }
55
Fred Quintana89437372009-05-15 15:10:40 -070056 public Uri insertEntity(Uri uri, Entity entities) throws RemoteException {
Fred Quintana6a8d5332f2009-05-07 17:35:38 -070057 throw new UnsupportedOperationException("unimplemented mock method");
58 }
59
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080060 @SuppressWarnings("unused")
61 public IBulkCursor bulkQuery(Uri url, String[] projection, String selection,
62 String[] selectionArgs, String sortOrder, IContentObserver observer,
63 CursorWindow window) throws RemoteException {
64 throw new UnsupportedOperationException("unimplemented mock method");
65 }
66
67 @SuppressWarnings("unused")
68 public int delete(Uri url, String selection, String[] selectionArgs)
69 throws RemoteException {
70 throw new UnsupportedOperationException("unimplemented mock method");
71 }
72
73 @SuppressWarnings("unused")
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074 public String getType(Uri url) throws RemoteException {
75 throw new UnsupportedOperationException("unimplemented mock method");
76 }
77
78 @SuppressWarnings("unused")
79 public Uri insert(Uri url, ContentValues initialValues) throws RemoteException {
80 throw new UnsupportedOperationException("unimplemented mock method");
81 }
82
83 @SuppressWarnings("unused")
84 public ParcelFileDescriptor openFile(Uri url, String mode) throws RemoteException,
85 FileNotFoundException {
86 throw new UnsupportedOperationException("unimplemented mock method");
87 }
88
89 @SuppressWarnings("unused")
90 public AssetFileDescriptor openAssetFile(Uri uri, String mode)
91 throws FileNotFoundException {
92 throw new UnsupportedOperationException("unimplemented mock method");
93 }
Fred Quintana89437372009-05-15 15:10:40 -070094
Fred Quintana03d94902009-05-22 14:23:31 -070095 public ContentProviderResult[] applyBatch(ArrayList<ContentProviderOperation> operations)
96 throws RemoteException, OperationApplicationException {
Fred Quintana89437372009-05-15 15:10:40 -070097 throw new UnsupportedOperationException("unimplemented mock method");
98 }
99
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800100 @SuppressWarnings("unused")
101 public Cursor query(Uri url, String[] projection, String selection, String[] selectionArgs,
102 String sortOrder) throws RemoteException {
103 throw new UnsupportedOperationException("unimplemented mock method");
104 }
105
Fred Quintana6a8d5332f2009-05-07 17:35:38 -0700106 public EntityIterator queryEntities(Uri url, String selection, String[] selectionArgs,
107 String sortOrder) throws RemoteException {
108 throw new UnsupportedOperationException("unimplemented mock method");
109 }
110
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800111 @SuppressWarnings("unused")
112 public int update(Uri url, ContentValues values, String selection, String[] selectionArgs)
113 throws RemoteException {
114 throw new UnsupportedOperationException("unimplemented mock method");
115 }
116
Fred Quintana89437372009-05-15 15:10:40 -0700117 public int updateEntity(Uri uri, Entity entity) throws RemoteException {
Fred Quintana6a8d5332f2009-05-07 17:35:38 -0700118 throw new UnsupportedOperationException("unimplemented mock method");
119 }
120
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800121 public IBinder asBinder() {
122 throw new UnsupportedOperationException("unimplemented mock method");
123 }
124
125}