use of zipkin2.Callback in project mapbox-events-android by mapbox.
the class MapboxTelemetryTest method obtainMapboxTelemetryWith.
private MapboxTelemetry obtainMapboxTelemetryWith(Context context, SchedulerFlusher schedulerFlusher) {
MapboxTelemetry.applicationContext = context;
String aValidAccessToken = "validAccessToken";
String aValidUserAgent = "MapboxTelemetryAndroid/";
EventsQueue mockedEventsQueue = mock(EventsQueue.class);
TelemetryClient mockedTelemetryClient = mock(TelemetryClient.class);
Callback mockedHttpCallback = mock(Callback.class);
Clock mockedClock = mock(Clock.class);
boolean indifferentServiceBound = true;
TelemetryEnabler telemetryEnabler = new TelemetryEnabler(false);
TelemetryLocationEnabler telemetryLocationEnabler = new TelemetryLocationEnabler(false);
MapboxTelemetry mapboxTelemetry = new MapboxTelemetry(context, aValidAccessToken, aValidUserAgent, mockedEventsQueue, mockedTelemetryClient, mockedHttpCallback, schedulerFlusher, mockedClock, indifferentServiceBound, telemetryEnabler, telemetryLocationEnabler);
return mapboxTelemetry;
}
use of zipkin2.Callback in project mapbox-events-android by mapbox.
the class MapboxTelemetryTest method checksOnFullQueueSendEventsNotCalledWhenConnectivityNotAvailable.
@Test
public void checksOnFullQueueSendEventsNotCalledWhenConnectivityNotAvailable() throws Exception {
Context mockedContext = obtainNetworkNotAvailableMockedContext();
TelemetryClient mockedTelemetryClient = mock(TelemetryClient.class);
Callback mockedHttpCallback = mock(Callback.class);
MapboxTelemetry theMapboxTelemetry = obtainMapboxTelemetryWith(mockedContext, mockedTelemetryClient, mockedHttpCallback);
List<Event> mockedList = mock(List.class);
theMapboxTelemetry.enable();
theMapboxTelemetry.onFullQueue(mockedList);
verify(mockedTelemetryClient, never()).sendEvents(eq(mockedList), eq(mockedHttpCallback));
}
use of zipkin2.Callback in project mapbox-events-android by mapbox.
the class MapboxTelemetryTest method checksOnFullQueueSendEventsNotCalledWhenNullTelemetryClient.
@Test
public void checksOnFullQueueSendEventsNotCalledWhenNullTelemetryClient() throws Exception {
Context mockedContext = obtainNetworkConnectedMockedContext();
MapboxTelemetry.applicationContext = mockedContext;
String nullAccessToken = null;
String nullUserAgent = null;
TelemetryClient mockedTelemetryClient = mock(TelemetryClient.class);
Callback mockedHttpCallback = mock(Callback.class);
TelemetryLocationEnabler telemetryLocationEnabler = new TelemetryLocationEnabler(false);
telemetryLocationEnabler.injectTelemetryLocationState(TelemetryLocationEnabler.LocationState.ENABLED);
MapboxTelemetry theMapboxTelemetry = obtainMapboxTelemetryWith(mockedContext, nullAccessToken, nullUserAgent, mockedTelemetryClient, mockedHttpCallback);
List<Event> mockedList = mock(List.class);
theMapboxTelemetry.onFullQueue(mockedList);
verify(mockedTelemetryClient, never()).sendEvents(eq(mockedList), eq(mockedHttpCallback));
}
use of zipkin2.Callback in project mapbox-events-android by mapbox.
the class MapboxTelemetryTest method obtainMapboxTelemetryWith.
private MapboxTelemetry obtainMapboxTelemetryWith(boolean isServiceBound, TelemetryService telemetryService) {
Context mockedContext = mock(Context.class);
MapboxTelemetry.applicationContext = mockedContext;
String aValidAccessToken = "validAccessToken";
String aValidUserAgent = "MapboxTelemetryAndroid/";
EventsQueue mockedEventsQueue = mock(EventsQueue.class);
TelemetryClient mockedTelemetryClient = mock(TelemetryClient.class);
Callback mockedHttpCallback = mock(Callback.class);
SchedulerFlusher mockedSchedulerFlusher = mock(SchedulerFlusher.class);
Clock mockedClock = mock(Clock.class);
TelemetryEnabler telemetryEnabler = new TelemetryEnabler(false);
TelemetryLocationEnabler telemetryLocationEnabler = new TelemetryLocationEnabler(false);
MapboxTelemetry theMapboxTelemetry = new MapboxTelemetry(mockedContext, aValidAccessToken, aValidUserAgent, mockedEventsQueue, mockedTelemetryClient, mockedHttpCallback, mockedSchedulerFlusher, mockedClock, isServiceBound, telemetryEnabler, telemetryLocationEnabler);
if (isServiceBound) {
theMapboxTelemetry.injectTelemetryService(telemetryService);
}
return theMapboxTelemetry;
}
use of zipkin2.Callback in project mapbox-events-android by mapbox.
the class MapboxTelemetryTest method obtainMapboxTelemetryWith.
private MapboxTelemetry obtainMapboxTelemetryWith(Context context, EventsQueue eventsQueue, TelemetryEnabler.State state) {
MapboxTelemetry.applicationContext = context;
String aValidAccessToken = "validAccessToken";
String aValidUserAgent = "MapboxTelemetryAndroid/";
TelemetryClient mockedTelemetryClient = mock(TelemetryClient.class);
Callback mockedHttpCallback = mock(Callback.class);
SchedulerFlusher mockedSchedulerFlusher = mock(SchedulerFlusher.class);
Clock mockedClock = mock(Clock.class);
boolean indifferentServiceBound = true;
TelemetryEnabler telemetryEnabler = new TelemetryEnabler(false);
telemetryEnabler.updatePreferences(state);
TelemetryLocationEnabler telemetryLocationEnabler = new TelemetryLocationEnabler(false);
MapboxTelemetry mapboxTelemetry = new MapboxTelemetry(context, aValidAccessToken, aValidUserAgent, eventsQueue, mockedTelemetryClient, mockedHttpCallback, mockedSchedulerFlusher, mockedClock, indifferentServiceBound, telemetryEnabler, telemetryLocationEnabler);
return mapboxTelemetry;
}
Aggregations