Android RenamingDelegatingContext - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android RenamingDelegatingContext class.

This code example shows how to use the following methods:
	@Override 
	protected void setUp() throws Exception { 
		super.setUp(); 
 
		RenamingDelegatingContext context 
		= new RenamingDelegatingContext(getContext(), TEST_FILE_PREFIX);
 
		itemsAdapter = new ItemsDbAdapter(context);
		itemsAdapter.open();
		listAdapter = new ListsDbAdapter(context);
		listAdapter.open();
	} 
 
	@Override 
	protected void tearDown() throws Exception { 
		super.tearDown(); 
 
		itemsAdapter.close();
		itemsAdapter = null;
		listAdapter.close();
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:makeExistingFilesAndDbsAccessible
            public String getPackageName() {
                return "no.package"; 
            } 
        }; 
        RenamingDelegatingContext targetContextWrapper =
                new RenamingDelegatingContext(context, targetContext, "perf.");
        targetContextWrapper.makeExistingFilesAndDbsAccessible();
        IsolatedContext providerContext = new IsolatedContext(resolver, targetContextWrapper);
        SynchronousContactsProvider2 provider = new SynchronousContactsProvider2();
        provider.setDataWipeEnabled(false);
        provider.attachInfo(providerContext, null);
        resolver.addProvider(ContactsContract.AUTHORITY, provider);
 
        long rawContactCount = provider.getRawContactCount();
        if (rawContactCount == 0) {
            Log.w(TAG, "The test has not been set up. Use this command to copy a contact db"
                    + " to the device:\nadb push <large contacts2.db> " 
                    + "data/data/com.android.providers.contacts/databases/perf.contacts2.db"); 
            return; 
        } 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
    protected Context targetContext;
 
    @Override 
    protected void setUp() { 
        // Run tests in an isolated context 
        targetContext = new RenamingDelegatingContext(getInstrumentation().getTargetContext(), "test_");
        testContext = getInstrumentation().getContext();
    } 
 
    public void testLoadDB() { 
        SQLiteDatabase db = TestUtils.loadDBFromDump(targetContext, testContext,
                "one_category.sql"); 
        CategoryNode node = CategoryNode.createCategoryTreeFromDB(1);
        // At least 1 category exists in test db: malformed_category_parent_id.sql 
        assertTrue((node.getChildren().size() != 0));
        db.close();
    } 
 
    public void testLoadDB_MalformedCategoryParentId() { 
        SQLiteDatabase db = TestUtils.loadDBFromDump(targetContext, testContext,
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:makeExistingFilesAndDbsAccessible
            @Override 
            public String getPackageName() {
                return "no.package"; 
            } 
        }; 
        RenamingDelegatingContext targetContextWrapper = new RenamingDelegatingContext(context,
                targetContext, "perf_imp.");
        targetContextWrapper.makeExistingFilesAndDbsAccessible();
        IsolatedContext providerContext = new IsolatedContext(resolver, targetContextWrapper);
        SynchronousContactsProvider2 provider = new SynchronousContactsProvider2();
        provider.setDataWipeEnabled(false);
        provider.attachInfo(providerContext, null);
        resolver.addProvider(ContactsContract.AUTHORITY, provider);
 
        ContentProvider callLogProvider = new TestCallLogProvider();
        callLogProvider.attachInfo(providerContext, null);
        resolver.addProvider(CallLog.AUTHORITY, callLogProvider);
 
        LegacyContactImporter importer = new LegacyContactImporter(providerContext, provider);
 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
	Account account;
	HomeScreenController controller;
	 
	protected void setUp() throws Exception { 
		super.setUp(); 
		RenamingDelegatingContext context = new RenamingDelegatingContext(
				getContext(), "_test");
		controller = new HomeScreenController(new HomeScreenModel(context));
		account = Account.getInstance(context);
 
	} 
	public void testCalculatePercentage() { 
		account.addBudgetItem(account.getCategory(Constants.EXPENSE_ID), 10.0);
		account.addTransaction(9.0, new Date(),"test", account.getCategory(Constants.EXPENSE_ID));
		controller.calculatePercentage();
		if(controller.getModel().getPercentage() != 90.0){
			fail("Calculate percantage doesn't work");
		} 
	} 
 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
	protected void setUp() { 
 
		//delegates to the given context, but performs database and  
		// file operations with a renamed database/file  
		// name (prefixes default names with a given prefix). 
		context = new RenamingDelegatingContext(getContext(), "test_");
		 
		if (Analytics.isInitialized()) Analytics.close(); 
		 
		Analytics.initialize(context, "testsecret");
	} 
	 
	@AfterClass 
	protected void close() { 
		Analytics.close(); 
	} 
	 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
	Account account;
	OptionsController controller;
 
	protected void setUp() throws Exception { 
		super.setUp(); 
		RenamingDelegatingContext context = new RenamingDelegatingContext(
				getContext(), "_test");
		controller = new OptionsController(context);
		account = Account.getInstance(context);
 
	} 
 
	public void testClearTransactions() { 
		account.addTransaction(10.0, new Date(), "test", new Category("test",
				0, account.getCategory(Constants.EXPENSE_ID)));
		controller.clearTransactions();
		if (account.getTransactions(2,
				account.getCategory(Constants.EXPENSE_ID)).size() != 0) {
			fail("Did not clear transactions");
		} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
        TouchUtils.clickView(this, a.getConfirmDeleteMeetingDialog().getButton(AlertDialog.BUTTON_NEGATIVE));
        assertNotNull(meetingDao.findById(meetingToDelete.getId()));
    } 
 
    private void createTestData() { 
        Context context = new RenamingDelegatingContext(getInstrumentation().getTargetContext(), "test_");
        TeamDAO teamFixturesDao = daoFactory.getTeamDAO(context);
        MeetingDAO meetingFixturesDao = daoFactory.getMeetingDAO(context);
 
        Team team = teamFixturesDao.save(new Team("Test Team"));
        meetingFixturesDao.save(new Meeting(team, new GregorianCalendar(2010, 0, 5, 10, 15, 0).getTime(), 5, 301, 343, 30, 65));
        meetingFixturesDao.save(new Meeting(team, new GregorianCalendar(2010, 0, 6, 10, 17, 0).getTime(), 8, 534, 550, 32, 120));
        meetingToDelete = meetingFixturesDao.save(new Meeting(team, new GregorianCalendar(2010, 0, 7, 10, 16, 0).getTime(), 2, 234, 300, 23, 122));
        meetingFixturesDao.save(new Meeting(team, new GregorianCalendar(2010, 0, 8, 10, 14, 0).getTime(), 3, 765, 765, 15, 78));
        meetingFixturesDao.save(new Meeting(team, new GregorianCalendar(2010, 0, 9, 10, 12, 0).getTime(), 9, 444, 445, 10, 93));        
    } 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 
    @Override 
    protected void setUp() throws Exception { 
        super.setUp(); 
        Context targetContext = getInstrumentation().getTargetContext();
        RenamingDelegatingContext rdContext = new RenamingDelegatingContext(targetContext, "test_");
        mHelper = new MyDbOpenHelper(rdContext);
    } 
 
    @Override 
    protected void tearDown() throws Exception { 
        super.tearDown(); 
        mHelper.close();
        mHelper = null;
    } 
 
    public void testGetStr() { 
        // 最初に登録されていないのでnullが返されることを確認する 
        assertNull(mHelper.getStr(3));
        { // テストデータをINSERTする 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:makeExistingFilesAndDbsAccessible
                ai.packageName = "contactsTestPackage";
                return ai;
            } 
        }; 
        RenamingDelegatingContext targetContextWrapper =
                new RenamingDelegatingContext(context, targetContext, "perf.");
        targetContextWrapper.makeExistingFilesAndDbsAccessible();
        IsolatedContext providerContext = new IsolatedContext(resolver, targetContextWrapper);
        SynchronousContactsProvider2 provider = new SynchronousContactsProvider2();
        provider.setDataWipeEnabled(false);
        provider.attachInfo(providerContext, null);
        resolver.addProvider(ContactsContract.AUTHORITY, provider);
 
        long rawContactCount = provider.getRawContactCount();
        if (rawContactCount == 0) {
            Log.w(TAG, "The test has not been set up. Use this command to copy a contact db"
                    + " to the device:\nadb push <large contacts2.db> " 
                    + "data/data/com.android.providers.contacts/databases/perf.contacts2.db"); 
            return; 
        } 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Android RenamingDelegatingContext Questions & Answers:

See Code Examples for Android RenamingDelegatingContext Methods: