Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce nested data provider #929

Merged
merged 30 commits into from
May 28, 2020
Merged

Conversation

BenHenning
Copy link
Member

@BenHenning BenHenning commented Apr 1, 2020

Introduce a dynamic nested data provider. This behaves essentially the same as transformAsync, except the data provider being transformed can be changed. This is specifically needed by questions in order to handle multiple sessions (e.g. each new session involves generating another list of questions to play, and that list is subsequently transformed into the ephemeral state of the question session). See #397 for specifics.

test coroutine dispatcher.

This includes introducing a test-only module to contain testing
dependencies.
DataProviders in a way that doesn't have the same limitations as the
previous MutableLiveData-based bridge.
…w-coroutine-live-data-mechanism

Conflicts:
	domain/src/test/java/org/oppia/domain/audio/CellularAudioDialogControllerTest.kt
DataProvider to be set up like transformAsync() but with the ability to
change the root DataProvider.
…w-coroutine-live-data-mechanism

Conflicts:
	utility/src/main/java/org/oppia/util/data/DataProviders.kt
@BenHenning BenHenning marked this pull request as draft May 9, 2020 23:58
…w-coroutine-live-data-mechanism

Conflicts:
	data/src/test/java/org/oppia/data/persistence/PersistentCacheStoreTest.kt
@BenHenning
Copy link
Member Author

BenHenning commented May 13, 2020

For future me, proposed tests that could be added (incomplete):

fun testNestedXformedProvider_toLiveData_deliversTransformedValue()
fun testNestedXformedProvider_toLiveData_diffValue_notifiesNested_deliversXformedValueTwo()
fun testNestedXformedProvider_toLiveData_diffValue_notifiesBase_deliversXformedValueTwo()
fun testNestedXformedProvider_toLiveData_diffVal_notifiesXform_deliversXformedValueTwo()
fun testNestedXformedProvider_diffValue_notifiesNested_observeNested_deliversSecondVal()
fun testNestedXformedProvider_differentValue_notifiesBase_observeNested_deliversFirstVal()
fun testNestedXformedProvider_diffValue_notifiesXformed_observeNested_deliversFirstVal()
fun testNestedXformedProvider_diffValue_notifiesNested_observeBase_deliversSecondVal()
fun testNestedXformedProvider_differentValue_notifiesBase_observeBase_deliversSecondVal()
fun testNestedXformedProvider_diffValue_notifiesXformed_observeBase_deliversFirstVal()
fun testNestedXformedProvider_toLiveData_nestedPending_deliversPending()
fun testNestedXformedProvider_toLiveData_nestedFailure_deliversFailure()
fun testNestedXformedProvider_toLiveData_withObserver_callsNestedProvider()
fun testNestedXformedProvider_toLiveData_noObserver_doesNotCallNestedProvider()

These are based on the transform async tests except there are some minor alterations (and overall a bunch of simplifications).

Edit: actually, these are missing some tests that aren't focusing on the transform function that's passed in. These need to be updated yet.

DataProviders tests to using TestCoroutineDispatchers utility.
…acheStoreTest, and fix FakeSystemClock so that it works properly in test environments.
@BenHenning BenHenning changed the title Introduce nested data provider [DO NOT MERGE] [Blocked: #928] Introduce nested data provider [Blocked: #928] May 21, 2020
@BenHenning BenHenning marked this pull request as ready for review May 21, 2020 05:08
Copy link
Contributor

@rt4914 rt4914 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LTGM, thanks.

@rt4914 rt4914 assigned BenHenning and unassigned rt4914 May 21, 2020
@vinitamurthi vinitamurthi removed their assignment May 21, 2020
@BenHenning
Copy link
Member Author

@aggarwalpulkit596 de-assigning you since it seems you completed your review without any follow up action items.

Base automatically changed from introduce-new-coroutine-live-data-mechanism to develop May 28, 2020 05:53
@BenHenning BenHenning changed the title Introduce nested data provider [Blocked: #928] Introduce nested data provider May 28, 2020
@BenHenning
Copy link
Member Author

Thanks for the reviews!

@BenHenning BenHenning merged commit 127efb5 into develop May 28, 2020
@BenHenning BenHenning deleted the introduce-nested-data-provider branch May 28, 2020 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants