Android Open Source - android-webview-example Command Uri Matcher Test Case From Project Back to project page android-webview-example .
License The source code is released under:
Apache License
If you think the Android project android-webview-example listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code package com.significantfiles.android.db;
/ * f r o m w w w . j a v a 2 s . c o m * /
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.test.AndroidTestCase;
import com.significantfiles.android.provider.table.Authority;
import com.significantfiles.android.provider.table.UriPathExt;
import com.significantfiles.android.sqlite.commands.CommandBasedContentProvider;
import com.significantfiles.mrcounter.db.CommandUriMatcher;
import com.significantfiles.mrcounter.db.ContentProviderCmd;
import com.significantfiles.mrcounter.db.provider.CommandBasedCreditContentProvider;
// http://books.google.de/books?id=Bam8K5SIiTkC&pg=PA105&lpg=PA105&dq=android+UriMatcher+returns+-1&source=bl&ots=NGImB6ONSY&sig=SP3UWzQBsGt4xl7H-AoV5UDZ3Pk&hl=de&ei=4BY7TeX0OcTxsgbsp9HzBg&sa=X&oi=book_result&ct=result&resnum=2&ved=0CCAQ6AEwAQ#v=onepage&q&f=false
// https://github.com/plans
// https://github.com/der-harm/CouchOneProvider/blob/master/src/de/harm/android/couchone/common/CouchConstants.java
// http://www.assembla.com/wiki/show/breakoutdocs/Assembla_REST_API
// http://www.google.com/enterprise/marketplace/search?categoryId=4&orderBy=RATING&offset=10
// http://www.fm.nrw.de/allgemein_fa/service/formulare/est/01_est_jahr/2009/27_anlage_g_2009_bmf.pdf
// http://www.fm.nrw.de/allgemein_fa/service/formulare/est/01_est_jahr/2009/01_est1a_2009_bmf.pdf
//
public class CommandUriMatcherTestCase extends AndroidTestCase {
public static final String AUTHORITY = "sqleasytest" ;
public static final String NoOpCommand_PATH_EXT = "no" ;
public void testUriMatcher() {
UriMatcher m = new UriMatcher(UriMatcher.NO_MATCH);
String auth = "sqleasy" ;
Uri uri2 = Uri.parse( "content://sqleasy/uri/10" );
String path2 = "uri/#" ;
m.addURI(auth, path2, 1);
Uri uri = Uri.parse( "content://sqleasy/uri" );
String path = uri.getPath();
m.addURI(auth, "uri" , 2);
int match = m.match( uri );
int match2 = m.match( uri2 );
assertEquals(2, match);
assertEquals(1, match2);
}
public void testSimpleRegisterAndMatch() {
final CommandUriMatcher matcher = new CommandUriMatcher(TestNoOpProvider.class);
final NoOpCommand cmd = new NoOpCommand();
matcher.register( cmd );
final String uri = "content://" + AUTHORITY + "/" + NoOpCommand_PATH_EXT;
final ContentProviderCmd matchedCmd = matcher.match(uri);
assertSame(cmd, matchedCmd);
}
@Authority( uri= AUTHORITY )
static class TestNoOpProvider extends CommandBasedContentProvider {
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
return 0;
}
@Override
public String getType(Uri uri) {
return null;
}
@Override
public Uri insert(Uri uri, ContentValues values) {
return null;
}
@Override
public boolean onCreate() {
return false;
}
@Override
public Cursor query(Uri uri, String[] projection, String selection,
String[] selectionArgs, String sortOrder) {
return null;
}
@Override
public int update(Uri uri, ContentValues values, String selection,
String[] selectionArgs) {
return 0;
}
}
@UriPathExt(uri=NoOpCommand_PATH_EXT)
static class NoOpCommand implements ContentProviderCmd {
@Override
public void notifyChanges() {
;
}
@Override
public void exec(SQLiteDatabase db) {
// TODO Auto-generated method stub
}
}
}
Java Source Code List com.significantfiles.android.db.CommandUriMatcherTestCase.java com.significantfiles.android.db.CreditContentProviderTestCase.java com.significantfiles.android.db.SQLiteCreateTableTestCase.java com.significantfiles.android.db.SimpleProviderTestCase.java com.significantfiles.android.db.TestCommandBasedContentProvider.java com.significantfiles.android.provider.table.Authority.java com.significantfiles.android.provider.table.ColumnMethodEnumeration.java com.significantfiles.android.provider.table.OrderBy.java com.significantfiles.android.provider.table.SQLiteField.java com.significantfiles.android.provider.table.SQLiteTable.java com.significantfiles.android.provider.table.SQLiteType.java com.significantfiles.android.provider.table.UriPathExt.java com.significantfiles.android.provider.table.constraint.IsPrimaryKey.java com.significantfiles.android.provider.table.constraint.NotNull.java com.significantfiles.android.provider.table.constraint.Unique.java com.significantfiles.android.sqlite.DaoInvocationHandler.java com.significantfiles.android.sqlite.GET.java com.significantfiles.android.sqlite.InsertException.java com.significantfiles.android.sqlite.UnsupportedUri.java com.significantfiles.android.sqlite.commands.CommandBasedContentProvider.java com.significantfiles.android.sqlite.commands.CreateTable.java com.significantfiles.android.sqlite.commands.DaoManager.java com.significantfiles.android.sqlite.commands.InsertCmd.java com.significantfiles.android.sqlite.commands.InsertRow.java com.significantfiles.android.sqlite.create.ColumnExtractor.java com.significantfiles.android.sqlite.create.TableExtractor.java com.significantfiles.android.sqlite.query.InsertTxChoice.java com.significantfiles.android.sqlite.query.Insert.java com.significantfiles.android.sqlite.query.QueryType.java com.significantfiles.android.sqlite.query.Replace.java com.significantfiles.android.sqlite.query.SQL.java com.significantfiles.android.sqlite.types.BLOB.java com.significantfiles.android.sqlite.types.ID.java com.significantfiles.android.sqlite.types.INTEGER.java com.significantfiles.android.sqlite.types.REAL.java com.significantfiles.android.sqlite.types.TEXT.java com.significantfiles.mrcounter.ActivityRequestCode.java com.significantfiles.mrcounter.Constants.java com.significantfiles.mrcounter.IndexActivity.java com.significantfiles.mrcounter.StartActivity.java com.significantfiles.mrcounter.WebChromeClient.java com.significantfiles.mrcounter.WebViewClient.java com.significantfiles.mrcounter.db.CommandUriMatcher.java com.significantfiles.mrcounter.db.ContentProviderCmd.java com.significantfiles.mrcounter.db.ContentResolverUtil.java com.significantfiles.mrcounter.db.ContentValuesKeys.java com.significantfiles.mrcounter.db.CreditByIdResult.java com.significantfiles.mrcounter.db.CreditDao.java com.significantfiles.mrcounter.db.CreditQuery.java com.significantfiles.mrcounter.db.CreditSQLiteOpenHelper.java com.significantfiles.mrcounter.db.Credit.java com.significantfiles.mrcounter.db.Credits.java com.significantfiles.mrcounter.db.DaoConfig.java com.significantfiles.mrcounter.db.InsertCreditCmd.java com.significantfiles.mrcounter.db.UnknownQueryTypeException.java com.significantfiles.mrcounter.db.Uris.java com.significantfiles.mrcounter.db.provider.CommandBasedCreditContentProvider.java com.significantfiles.mrcounter.db.provider.CreditContentProvider.java com.significantfiles.mrcounter.db.provider.CreditDaoBasedContentProvider.java com.significantfiles.mrcounter.db.result.Converter.java com.significantfiles.mrcounter.db.result.Credit.java com.significantfiles.mrcounter.db.result.DefaultConverterStrategy.java com.significantfiles.mrcounter.db.result.DefautInteger2IntConverter.java com.significantfiles.mrcounter.db.result.QueryRef.java com.significantfiles.mrcounter.js.CreateCreditControl.java com.significantfiles.mrcounter.js.WebViewFacade.java