use of com.optimizely.ab.android.shared.DatafileConfig in project android-sdk by optimizely.
the class DatafileReschedulerTest method dispatchingOneWithoutEnvironment.
@Test
@SdkSuppress(maxSdkVersion = Build.VERSION_CODES.N)
public void dispatchingOneWithoutEnvironment() throws InterruptedException {
// projectId: number string
// sdkKey: alphabet string
backgroundWatchersCache.setIsWatching(new DatafileConfig("1", null), true);
dispatcher.dispatch();
TimeUnit.SECONDS.sleep(1);
verify(dispatcher).rescheduleService(captor.capture());
assertEquals(new DatafileConfig("1", null), captor.getValue());
}
use of com.optimizely.ab.android.shared.DatafileConfig in project android-sdk by optimizely.
the class DatafileReschedulerTest method dispatchingManyForLegacy.
@Test
@SdkSuppress(maxSdkVersion = Build.VERSION_CODES.N)
public void dispatchingManyForLegacy() throws InterruptedException {
backgroundWatchersCache.setIsWatching(new DatafileConfig("1", null), true);
backgroundWatchersCache.setIsWatching(new DatafileConfig("2", "A"), true);
backgroundWatchersCache.setIsWatching(new DatafileConfig(null, "B"), true);
backgroundWatchersCache.setIsWatching(new DatafileConfig("3", null), true);
dispatcher.dispatch();
TimeUnit.SECONDS.sleep(1);
verify(dispatcher, times(4)).rescheduleService(captor.capture());
List array = new ArrayList<String>();
for (DatafileConfig config : captor.getAllValues()) {
array.add(config.toString());
}
assert (array.contains(new DatafileConfig("1", null).toString()));
assert (array.contains(new DatafileConfig(null, "A").toString()));
assert (array.contains(new DatafileConfig(null, "B").toString()));
assert (array.contains(new DatafileConfig("3", null).toString()));
}
use of com.optimizely.ab.android.shared.DatafileConfig in project android-sdk by optimizely.
the class DatafileReschedulerTest method dispatchingManyForJobScheduler.
@Test
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.O)
public void dispatchingManyForJobScheduler() throws InterruptedException {
backgroundWatchersCache.setIsWatching(new DatafileConfig("1", null), true);
backgroundWatchersCache.setIsWatching(new DatafileConfig(null, "A"), true);
dispatcher.dispatch();
TimeUnit.SECONDS.sleep(1);
verify(dispatcher, never()).rescheduleService(captor.capture());
}
use of com.optimizely.ab.android.shared.DatafileConfig in project android-sdk by optimizely.
the class DatafileReschedulerTest method dispatchingOneWithEnvironment.
@Test
@SdkSuppress(maxSdkVersion = Build.VERSION_CODES.N)
public void dispatchingOneWithEnvironment() throws InterruptedException {
// projectId: number string
// sdkKey: alphabet string
backgroundWatchersCache.setIsWatching(new DatafileConfig(null, "A"), true);
dispatcher.dispatch();
TimeUnit.SECONDS.sleep(1);
verify(dispatcher).rescheduleService(captor.capture());
assertEquals(new DatafileConfig(null, "A"), captor.getValue());
}
use of com.optimizely.ab.android.shared.DatafileConfig in project android-sdk by optimizely.
the class DatafileServiceTest method testGetDatafileEnvironmentUrl.
@Test
public void testGetDatafileEnvironmentUrl() {
// HARD-CODING link here to make sure we don't unintentionally mess up the datafile version
// and url by accidentally changing those constants.
// us to update this test.
String datafileUrl = new DatafileConfig("1", "2").getUrl();
assertEquals("https://cdn.optimizely.com/datafiles/2.json", datafileUrl);
}
Aggregations