private void insertReadBook() { ContentValues bookValues = com.ogasimli.alexandria.TestDb.getBookValues(); Uri bookUri = mContext.getContentResolver().insert(AlexandriaContract.BookEntry.CONTENT_URI, bookValues); long bookRowId = ContentUris.parseId(bookUri); assertTrue(bookRowId != -1); Cursor cursor = mContext .getContentResolver() .query( AlexandriaContract.BookEntry.CONTENT_URI, null, // leaving "columns" null just returns all the columns. null, // cols for "where" clause null, // values for "where" clause null // sort order ); com.ogasimli.alexandria.TestDb.validateCursor(cursor, bookValues); cursor = mContext .getContentResolver() .query( AlexandriaContract.BookEntry.buildBookUri(bookRowId), null, // leaving "columns" null just returns all the columns. null, // cols for "where" clause null, // values for "where" clause null // sort order ); com.ogasimli.alexandria.TestDb.validateCursor(cursor, bookValues); }
private void insertReadCategory() { ContentValues categoryValues = com.ogasimli.alexandria.TestDb.getCategoryValues(); Uri categoryUri = mContext .getContentResolver() .insert(AlexandriaContract.CategoryEntry.CONTENT_URI, categoryValues); long categoryRowId = ContentUris.parseId(categoryUri); assertTrue(categoryRowId != -1); assertEquals(categoryRowId, com.ogasimli.alexandria.TestDb.ean); Cursor cursor = mContext .getContentResolver() .query( AlexandriaContract.CategoryEntry.CONTENT_URI, null, // projection null, // selection null, // selection args null // sort order ); com.ogasimli.alexandria.TestDb.validateCursor(cursor, categoryValues); cursor = mContext .getContentResolver() .query( AlexandriaContract.CategoryEntry.buildCategoryUri(categoryRowId), null, // projection null, // selection null, // selection args null // sort order ); com.ogasimli.alexandria.TestDb.validateCursor(cursor, categoryValues); }
private void insertReadAuthor() { ContentValues authorValues = com.ogasimli.alexandria.TestDb.getAuthorValues(); Uri authorUri = mContext .getContentResolver() .insert(AlexandriaContract.AuthorEntry.CONTENT_URI, authorValues); long authorRowId = ContentUris.parseId(authorUri); assertTrue(authorRowId != -1); assertEquals(authorRowId, com.ogasimli.alexandria.TestDb.ean); Cursor cursor = mContext .getContentResolver() .query( AlexandriaContract.AuthorEntry.CONTENT_URI, null, // leaving "columns" null just returns all the columns. null, // cols for "where" clause null, // values for "where" clause null // sort order ); com.ogasimli.alexandria.TestDb.validateCursor(cursor, authorValues); cursor = mContext .getContentResolver() .query( AlexandriaContract.AuthorEntry.buildAuthorUri(authorRowId), null, // leaving "columns" null just returns all the columns. null, // cols for "where" clause null, // values for "where" clause null // sort order ); com.ogasimli.alexandria.TestDb.validateCursor(cursor, authorValues); }
private void readFullList() { Cursor cursor = mContext .getContentResolver() .query( AlexandriaContract.BookEntry.FULL_CONTENT_URI, null, // projection null, // selection null, // selection args null // sort order ); com.ogasimli.alexandria.TestDb.validateCursor( cursor, com.ogasimli.alexandria.TestDb.getFullListValues()); }
private void readFullBook() { Cursor cursor = mContext .getContentResolver() .query( AlexandriaContract.BookEntry.buildFullBookUri(com.ogasimli.alexandria.TestDb.ean), null, // projection null, // selection null, // selection args null // sort order ); com.ogasimli.alexandria.TestDb.validateCursor( cursor, com.ogasimli.alexandria.TestDb.getFullDetailValues()); }