Search in sources :

Example 1 with GeoReporter

use of org.infobip.mobile.messaging.geo.report.GeoReporter in project mobile-messaging-sdk-android by infobip.

the class GeoReporterTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    // Enable message store for notification messages
    enableMessageStoreForReceivedMessages();
    messageStore = MobileMessaging.getInstance(context).getMessageStore();
    mobileApiGeo = mock(MobileApiGeo.class);
    geoReporter = new GeoReporter(context, mobileMessagingCore, geoBroadcaster, mobileMessagingCore.getStats(), mobileApiGeo);
    geoReportCaptor = new ArgumentCaptor<>();
    reportBodyCaptor = ArgumentCaptor.forClass(EventReportBody.class);
    given(mobileApiGeo.report(reportBodyCaptor.capture())).willReturn(new EventReportResponse());
}
Also used : EventReportResponse(org.infobip.mobile.messaging.api.geo.EventReportResponse) MobileApiGeo(org.infobip.mobile.messaging.api.geo.MobileApiGeo) GeoReporter(org.infobip.mobile.messaging.geo.report.GeoReporter) EventReportBody(org.infobip.mobile.messaging.api.geo.EventReportBody)

Example 2 with GeoReporter

use of org.infobip.mobile.messaging.geo.report.GeoReporter in project mobile-messaging-sdk-android by infobip.

the class RetryableSynchronizerTest method setUp.

@SuppressLint("CommitPrefEdits")
@Override
public void setUp() throws Exception {
    super.setUp();
    PreferenceHelper.saveBoolean(context, MobileMessagingProperty.REPORT_SYSTEM_INFO, true);
    PreferenceHelper.saveInt(context, MobileMessagingProperty.DEFAULT_EXP_BACKOFF_MULTIPLIER, 0);
    PreferenceHelper.remove(context, MobileMessagingProperty.REPORTED_SYSTEM_DATA_HASH);
    executor = Executors.newSingleThreadExecutor();
    mobileApiGeo = mock(MobileApiGeo.class);
    geoReporter = new GeoReporter(context, mobileMessagingCore, geoBroadcaster, mobileMessagingCore.getStats(), mobileApiGeo);
}
Also used : MobileApiGeo(org.infobip.mobile.messaging.api.geo.MobileApiGeo) GeoReporter(org.infobip.mobile.messaging.geo.report.GeoReporter) SuppressLint(android.annotation.SuppressLint)

Example 3 with GeoReporter

use of org.infobip.mobile.messaging.geo.report.GeoReporter in project mobile-messaging-sdk-android by infobip.

the class PushUnregisteredTest method setUp.

@SuppressLint({ "CommitPrefEdits", "ApplySharedPref" })
@Override
public void setUp() throws Exception {
    super.setUp();
    ExecutorService taskExecutor = Executors.newSingleThreadExecutor();
    MobileMessagingStats stats = mobileMessagingCore.getStats();
    PreferenceHelper.saveLong(context, MobileMessagingProperty.BATCH_REPORTING_DELAY, 100L);
    PreferenceHelper.saveBoolean(context, MobileMessagingProperty.GEOFENCING_ACTIVATED, true);
    mobileApiMessages = mock(MobileApiMessages.class);
    mobileApiGeo = mock(MobileApiGeo.class);
    mobileMessageHandler = mock(MobileMessageHandler.class);
    RetryPolicyProvider retryPolicyProvider = new RetryPolicyProvider(context);
    retryPolicy = retryPolicyProvider.DEFAULT();
    registrationSynchronizer = new RegistrationSynchronizer(context, mobileMessagingCore, stats, taskExecutor, coreBroadcaster, retryPolicyProvider, mobileApiRegistration);
    seenStatusReporter = new SeenStatusReporter(mobileMessagingCore, stats, taskExecutor, coreBroadcaster, mobileApiMessages, new BatchReporter(100L));
    geoReporter = new GeoReporter(context, mobileMessagingCore, geoBroadcaster, mobileMessagingCore.getStats(), mobileApiGeo);
    messagesSynchronizer = new MessagesSynchronizer(mobileMessagingCore, stats, taskExecutor, coreBroadcaster, retryPolicy, mobileMessageHandler, mobileApiMessages);
    captor = ArgumentCaptor.forClass(Boolean.class);
}
Also used : MobileMessageHandler(org.infobip.mobile.messaging.gcm.MobileMessageHandler) MobileMessagingStats(org.infobip.mobile.messaging.stats.MobileMessagingStats) RetryPolicyProvider(org.infobip.mobile.messaging.mobile.common.RetryPolicyProvider) ExecutorService(java.util.concurrent.ExecutorService) MobileApiGeo(org.infobip.mobile.messaging.api.geo.MobileApiGeo) BatchReporter(org.infobip.mobile.messaging.mobile.BatchReporter) MessagesSynchronizer(org.infobip.mobile.messaging.mobile.messages.MessagesSynchronizer) MobileApiMessages(org.infobip.mobile.messaging.api.messages.MobileApiMessages) GeoReporter(org.infobip.mobile.messaging.geo.report.GeoReporter) Matchers.anyBoolean(org.mockito.Matchers.anyBoolean) RegistrationSynchronizer(org.infobip.mobile.messaging.mobile.registration.RegistrationSynchronizer) SeenStatusReporter(org.infobip.mobile.messaging.mobile.seen.SeenStatusReporter) SuppressLint(android.annotation.SuppressLint)

Example 4 with GeoReporter

use of org.infobip.mobile.messaging.geo.report.GeoReporter in project mobile-messaging-sdk-android by infobip.

the class GeoAreasHandlerTests method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    enableMessageStoreForReceivedMessages();
    geoNotificationHelper = Mockito.mock(GeoNotificationHelper.class);
    geoReporter = Mockito.mock(GeoReporter.class);
    messageStore = Mockito.mock(MessageStore.class);
    geoAreasHandler = new GeoAreasHandler(contextMock, mobileMessagingCore, geoNotificationHelper, geoReporter, new GeofencingHelper(context));
    geoReportCaptor = ArgumentCaptor.forClass(GeoReport[].class);
    geoNotificationCaptor = new ArgumentCaptor<>();
}
Also used : MessageStore(org.infobip.mobile.messaging.storage.MessageStore) GeofencingHelper(org.infobip.mobile.messaging.geo.geofencing.GeofencingHelper) GeoAreasHandler(org.infobip.mobile.messaging.geo.transition.GeoAreasHandler) GeoReporter(org.infobip.mobile.messaging.geo.report.GeoReporter) GeoNotificationHelper(org.infobip.mobile.messaging.geo.transition.GeoNotificationHelper)

Aggregations

GeoReporter (org.infobip.mobile.messaging.geo.report.GeoReporter)4 MobileApiGeo (org.infobip.mobile.messaging.api.geo.MobileApiGeo)3 SuppressLint (android.annotation.SuppressLint)2 ExecutorService (java.util.concurrent.ExecutorService)1 EventReportBody (org.infobip.mobile.messaging.api.geo.EventReportBody)1 EventReportResponse (org.infobip.mobile.messaging.api.geo.EventReportResponse)1 MobileApiMessages (org.infobip.mobile.messaging.api.messages.MobileApiMessages)1 MobileMessageHandler (org.infobip.mobile.messaging.gcm.MobileMessageHandler)1 GeofencingHelper (org.infobip.mobile.messaging.geo.geofencing.GeofencingHelper)1 GeoAreasHandler (org.infobip.mobile.messaging.geo.transition.GeoAreasHandler)1 GeoNotificationHelper (org.infobip.mobile.messaging.geo.transition.GeoNotificationHelper)1 BatchReporter (org.infobip.mobile.messaging.mobile.BatchReporter)1 RetryPolicyProvider (org.infobip.mobile.messaging.mobile.common.RetryPolicyProvider)1 MessagesSynchronizer (org.infobip.mobile.messaging.mobile.messages.MessagesSynchronizer)1 RegistrationSynchronizer (org.infobip.mobile.messaging.mobile.registration.RegistrationSynchronizer)1 SeenStatusReporter (org.infobip.mobile.messaging.mobile.seen.SeenStatusReporter)1 MobileMessagingStats (org.infobip.mobile.messaging.stats.MobileMessagingStats)1 MessageStore (org.infobip.mobile.messaging.storage.MessageStore)1 Matchers.anyBoolean (org.mockito.Matchers.anyBoolean)1