Search in sources :

Example 11 with RenamingDelegatingContext

use of android.test.RenamingDelegatingContext in project standup-timer by jwood.

the class TeamListTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    a = getActivity();
    daoFactory.setCacheDAOInstances(true);
    daoFactory.setGlobalContext(new RenamingDelegatingContext(a, "test_"));
    dao = daoFactory.getTeamDAO(a);
}
Also used : RenamingDelegatingContext(android.test.RenamingDelegatingContext)

Example 12 with RenamingDelegatingContext

use of android.test.RenamingDelegatingContext in project standup-timer by jwood.

the class MeetingDetailsTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    daoFactory.setCacheDAOInstances(true);
    createTestData();
    Intent intent = new Intent();
    intent.putExtra("teamName", meetingToDelete.getTeam().getName());
    intent.putExtra("meetingTime", meetingToDelete.getDescription());
    setActivityIntent(intent);
    a = getActivity();
    daoFactory.setGlobalContext(new RenamingDelegatingContext(a, "test_"));
    meetingDao = daoFactory.getMeetingDAO(a);
    teamDao = daoFactory.getTeamDAO(a);
}
Also used : RenamingDelegatingContext(android.test.RenamingDelegatingContext) Intent(android.content.Intent)

Example 13 with RenamingDelegatingContext

use of android.test.RenamingDelegatingContext in project standup-timer by jwood.

the class MeetingDetailsTest method createTestData.

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));
}
Also used : Context(android.content.Context) RenamingDelegatingContext(android.test.RenamingDelegatingContext) RenamingDelegatingContext(android.test.RenamingDelegatingContext) Meeting(net.johnpwood.android.standuptimer.model.Meeting) GregorianCalendar(java.util.GregorianCalendar) Team(net.johnpwood.android.standuptimer.model.Team) TeamDAO(net.johnpwood.android.standuptimer.dao.TeamDAO) MeetingDAO(net.johnpwood.android.standuptimer.dao.MeetingDAO)

Example 14 with RenamingDelegatingContext

use of android.test.RenamingDelegatingContext in project android_frameworks_base by ParanoidAndroid.

the class AccountManagerServiceTest method setUp.

@Override
protected void setUp() throws Exception {
    final String filenamePrefix = "test.";
    MockContentResolver resolver = new MockContentResolver();
    RenamingDelegatingContext targetContextWrapper = new RenamingDelegatingContext(// The context that most methods are delegated to
    new MyMockContext(), // The context that file methods are delegated to
    getContext(), filenamePrefix);
    Context context = new IsolatedContext(resolver, targetContextWrapper);
    setContext(context);
    mAms = new MyAccountManagerService(getContext(), new MyMockPackageManager(), new MockAccountAuthenticatorCache());
}
Also used : Context(android.content.Context) IsolatedContext(android.test.IsolatedContext) RenamingDelegatingContext(android.test.RenamingDelegatingContext) MockContext(android.test.mock.MockContext) RenamingDelegatingContext(android.test.RenamingDelegatingContext) MockContentResolver(android.test.mock.MockContentResolver) IsolatedContext(android.test.IsolatedContext)

Example 15 with RenamingDelegatingContext

use of android.test.RenamingDelegatingContext in project platform_frameworks_base by android.

the class JobStoreTest method setUp.

@Override
public void setUp() throws Exception {
    mTestContext = new RenamingDelegatingContext(getContext(), TEST_PREFIX);
    Log.d(TAG, "Saving tasks to '" + mTestContext.getFilesDir() + "'");
    mTaskStoreUnderTest = JobStore.initAndGetForTesting(mTestContext, mTestContext.getFilesDir());
    mComponent = new ComponentName(getContext().getPackageName(), StubClass.class.getName());
}
Also used : RenamingDelegatingContext(android.test.RenamingDelegatingContext) ComponentName(android.content.ComponentName)

Aggregations

RenamingDelegatingContext (android.test.RenamingDelegatingContext)22 ComponentName (android.content.ComponentName)4 Intent (android.content.Intent)4 Context (android.content.Context)3 IsolatedContext (android.test.IsolatedContext)2 MockContentResolver (android.test.mock.MockContentResolver)2 MockContext (android.test.mock.MockContext)2 GregorianCalendar (java.util.GregorianCalendar)2 MeetingDAO (net.johnpwood.android.standuptimer.dao.MeetingDAO)2 TeamDAO (net.johnpwood.android.standuptimer.dao.TeamDAO)2 Meeting (net.johnpwood.android.standuptimer.model.Meeting)2 Team (net.johnpwood.android.standuptimer.model.Team)2 ContentProvider (android.content.ContentProvider)1 ImageDaoImpl (com.jigdraw.draw.dao.impl.ImageDaoImpl)1 LongParcelable (com.jigdraw.draw.model.LongParcelable)1 JigsawServiceImpl (com.jigdraw.draw.service.impl.JigsawServiceImpl)1 TestWellSqlConfig (org.wordpress.android.TestWellSqlConfig)1 Dispatcher (org.wordpress.android.fluxc.Dispatcher)1 WellSqlConfig (org.wordpress.android.fluxc.persistence.WellSqlConfig)1 SiteStore (org.wordpress.android.fluxc.store.SiteStore)1