use of com.amazon.dataloader.testResources.MockDataLoadManager in project zype-firebuilder by zype.
the class DataLoadManagerTest method testUpdaterListenerRegisterationAndDeregistration.
/**
* Tests successful registration and de-registration of {@link com.amazon.dataloader
* .dataloadmanager.DataLoadManager.IDataUpdateListener}s.
*/
@Test
public void testUpdaterListenerRegisterationAndDeregistration() throws Exception {
MockDataLoadManager.IDataUpdateListener dataUpdateListener = mock(DataLoadManager.IDataUpdateListener.class);
MockDataLoadManager testDataLoadManager = new MockDataLoadManager(InstrumentationRegistry.getTargetContext());
// Register update listener and validate successful registration
testDataLoadManager.registerUpdateListener(dataUpdateListener);
assertTrue("Listener not registered ", testDataLoadManager.isUpdateListenerRegistered(dataUpdateListener));
// Deregister update listener and validate successful de-registration
testDataLoadManager.deregisterUpdateListener(dataUpdateListener);
assertFalse("Listener still registered ", testDataLoadManager.isUpdateListenerRegistered(dataUpdateListener));
}
use of com.amazon.dataloader.testResources.MockDataLoadManager in project zype-firebuilder by zype.
the class DataUpdaterModuleTest method setUpManager.
/**
* Sets up DataLoadManager as MockDataLoadManager
*/
private void setUpManager() throws Exception {
mTestDataLoadManager = new MockDataLoadManager(InstrumentationRegistry.getTargetContext());
mTestDataLoadManager.registerUpdateListener(mUpdateListener);
}
use of com.amazon.dataloader.testResources.MockDataLoadManager in project zype-firebuilder by zype.
the class DataUpdaterModuleTest method testNonScheduledDataUpdater.
/**
* Tests non-scheduled data updater, verifying that DataUpdaterTask is not executed by
* Scheduler
*/
@Test
public void testNonScheduledDataUpdater() throws Exception {
MockDataLoadManager testDataLoadManagerNoUpdater = new MockDataLoadManagerWithoutDataUpdater(InstrumentationRegistry.getTargetContext());
testDataLoadManagerNoUpdater.registerUpdateListener(mUpdateListener);
Thread.sleep(5000);
verify(MockCacheManagerAdapter.mockCacheManagerAdapter, never()).clearCache();
verify(mUpdateListener, never()).onSuccess(any(Data.class));
}
use of com.amazon.dataloader.testResources.MockDataLoadManager in project zype-firebuilder by zype.
the class DataLoadManagerTest method runRecipeOnTestDataLoadManager.
/**
* Calls the {@link MockDataLoadManager#cookRecipe(Recipe, Object, IRecipeCookerCallbacks,
* Bundle, String[])} with the mock recipe and the param recipeCallback. It also verifies that
* the {@link VerifyUtil#verified()} is called the required number of times.
*
* @param recipeCallback The recipe callback handler to be passed to the {@link
* DataLoadManager}.
* @param verifyCalledCount Number of times the verified call should have been called.
*/
private void runRecipeOnTestDataLoadManager(IRecipeCookerCallbacks recipeCallback, int verifyCalledCount) throws Exception {
new MockDataLoadManager(mContext).cookRecipe(recipe, null, recipeCallback, null, null);
Thread.sleep(1000);
verify(verifyUtil, times(verifyCalledCount)).verified();
}
Aggregations