use of android.content.UriMatcher in project android_frameworks_base by DirtyUnicorns.
the class UriMatcherTest method testContentUrisWithLeadingSlash.
@SmallTest
public void testContentUrisWithLeadingSlash() {
UriMatcher matcher = new UriMatcher(ROOT);
matcher.addURI("people", null, PEOPLE);
matcher.addURI("people", "/#", PEOPLE_ID);
matcher.addURI("people", "/#/phones", PEOPLE_PHONES);
matcher.addURI("people", "/#/phones/blah", PEOPLE_PHONES_ID);
matcher.addURI("people", "/#/phones/#", PEOPLE_PHONES_ID);
matcher.addURI("people", "/#/addresses", PEOPLE_ADDRESSES);
matcher.addURI("people", "/#/addresses/#", PEOPLE_ADDRESSES_ID);
matcher.addURI("people", "/#/contact-methods", PEOPLE_CONTACTMETH);
matcher.addURI("people", "/#/contact-methods/#", PEOPLE_CONTACTMETH_ID);
matcher.addURI("calls", null, CALLS);
matcher.addURI("calls", "/#", CALLS_ID);
matcher.addURI("caller-id", null, CALLERID);
matcher.addURI("caller-id", "/*", CALLERID_TEXT);
matcher.addURI("filter-recent", null, FILTERRECENT);
matcher.addURI("auth", "/another/path/segment", ANOTHER_PATH_SEGMENT);
checkAll(matcher);
}
use of android.content.UriMatcher in project android_frameworks_base by AOSPA.
the class UriMatcherTest method testContentUrisWithLeadingSlash.
@SmallTest
public void testContentUrisWithLeadingSlash() {
UriMatcher matcher = new UriMatcher(ROOT);
matcher.addURI("people", null, PEOPLE);
matcher.addURI("people", "/#", PEOPLE_ID);
matcher.addURI("people", "/#/phones", PEOPLE_PHONES);
matcher.addURI("people", "/#/phones/blah", PEOPLE_PHONES_ID);
matcher.addURI("people", "/#/phones/#", PEOPLE_PHONES_ID);
matcher.addURI("people", "/#/addresses", PEOPLE_ADDRESSES);
matcher.addURI("people", "/#/addresses/#", PEOPLE_ADDRESSES_ID);
matcher.addURI("people", "/#/contact-methods", PEOPLE_CONTACTMETH);
matcher.addURI("people", "/#/contact-methods/#", PEOPLE_CONTACTMETH_ID);
matcher.addURI("calls", null, CALLS);
matcher.addURI("calls", "/#", CALLS_ID);
matcher.addURI("caller-id", null, CALLERID);
matcher.addURI("caller-id", "/*", CALLERID_TEXT);
matcher.addURI("filter-recent", null, FILTERRECENT);
matcher.addURI("auth", "/another/path/segment", ANOTHER_PATH_SEGMENT);
checkAll(matcher);
}
use of android.content.UriMatcher in project android_frameworks_base by AOSPA.
the class UriMatcherTest method testContentUris.
@SmallTest
public void testContentUris() {
UriMatcher matcher = new UriMatcher(ROOT);
matcher.addURI("people", null, PEOPLE);
matcher.addURI("people", "#", PEOPLE_ID);
matcher.addURI("people", "#/phones", PEOPLE_PHONES);
matcher.addURI("people", "#/phones/blah", PEOPLE_PHONES_ID);
matcher.addURI("people", "#/phones/#", PEOPLE_PHONES_ID);
matcher.addURI("people", "#/addresses", PEOPLE_ADDRESSES);
matcher.addURI("people", "#/addresses/#", PEOPLE_ADDRESSES_ID);
matcher.addURI("people", "#/contact-methods", PEOPLE_CONTACTMETH);
matcher.addURI("people", "#/contact-methods/#", PEOPLE_CONTACTMETH_ID);
matcher.addURI("calls", null, CALLS);
matcher.addURI("calls", "#", CALLS_ID);
matcher.addURI("caller-id", null, CALLERID);
matcher.addURI("caller-id", "*", CALLERID_TEXT);
matcher.addURI("filter-recent", null, FILTERRECENT);
matcher.addURI("auth", "another/path/segment", ANOTHER_PATH_SEGMENT);
checkAll(matcher);
}
use of android.content.UriMatcher in project Sunshine-Version-2 by udacity.
the class TestUriMatcher method testUriMatcher.
/*
Students: This function tests that your UriMatcher returns the correct integer value
for each of the Uri types that our ContentProvider can handle. Uncomment this when you are
ready to test your UriMatcher.
*/
public void testUriMatcher() {
UriMatcher testMatcher = WeatherProvider.buildUriMatcher();
assertEquals("Error: The WEATHER URI was matched incorrectly.", testMatcher.match(TEST_WEATHER_DIR), WeatherProvider.WEATHER);
assertEquals("Error: The WEATHER WITH LOCATION URI was matched incorrectly.", testMatcher.match(TEST_WEATHER_WITH_LOCATION_DIR), WeatherProvider.WEATHER_WITH_LOCATION);
assertEquals("Error: The WEATHER WITH LOCATION AND DATE URI was matched incorrectly.", testMatcher.match(TEST_WEATHER_WITH_LOCATION_AND_DATE_DIR), WeatherProvider.WEATHER_WITH_LOCATION_AND_DATE);
assertEquals("Error: The LOCATION URI was matched incorrectly.", testMatcher.match(TEST_LOCATION_DIR), WeatherProvider.LOCATION);
}
use of android.content.UriMatcher in project muzei by romannurik.
the class GalleryProvider method buildUriMatcher.
/**
* Creates and initializes the URI matcher
*
* @return the URI Matcher
*/
private static UriMatcher buildUriMatcher() {
final UriMatcher matcher = new UriMatcher(UriMatcher.NO_MATCH);
matcher.addURI(GalleryContract.AUTHORITY, GalleryContract.ChosenPhotos.TABLE_NAME, GalleryProvider.CHOSEN_PHOTOS);
matcher.addURI(GalleryContract.AUTHORITY, GalleryContract.ChosenPhotos.TABLE_NAME + "/#", GalleryProvider.CHOSEN_PHOTOS_ID);
matcher.addURI(GalleryContract.AUTHORITY, GalleryContract.MetadataCache.TABLE_NAME, GalleryProvider.METADATA_CACHE);
return matcher;
}
Aggregations