Search in sources :

Example 1 with MobileApiGeo

use of org.infobip.mobile.messaging.api.geo.MobileApiGeo in project mobile-messaging-sdk-android by infobip.

the class MobileApiGeoTest method setUp.

@Before
public void setUp() throws Exception {
    debugServer = new DebugServer();
    debugServer.start();
    Properties properties = new Properties();
    properties.put("api.key", "my_API_key");
    Generator generator = new Generator.Builder().withBaseUrl("http://127.0.0.1:" + debugServer.getListeningPort() + "/").withProperties(properties).build();
    mobileApiGeo = generator.create(MobileApiGeo.class);
}
Also used : DebugServer(org.infobip.mobile.messaging.api.tools.DebugServer) MobileApiGeo(org.infobip.mobile.messaging.api.geo.MobileApiGeo) Properties(java.util.Properties) Generator(org.infobip.mobile.messaging.api.support.Generator) Before(org.junit.Before)

Example 2 with MobileApiGeo

use of org.infobip.mobile.messaging.api.geo.MobileApiGeo 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 3 with MobileApiGeo

use of org.infobip.mobile.messaging.api.geo.MobileApiGeo 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 4 with MobileApiGeo

use of org.infobip.mobile.messaging.api.geo.MobileApiGeo 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)

Aggregations

MobileApiGeo (org.infobip.mobile.messaging.api.geo.MobileApiGeo)4 GeoReporter (org.infobip.mobile.messaging.geo.report.GeoReporter)3 SuppressLint (android.annotation.SuppressLint)2 Properties (java.util.Properties)1 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 Generator (org.infobip.mobile.messaging.api.support.Generator)1 DebugServer (org.infobip.mobile.messaging.api.tools.DebugServer)1 MobileMessageHandler (org.infobip.mobile.messaging.gcm.MobileMessageHandler)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 Before (org.junit.Before)1 Matchers.anyBoolean (org.mockito.Matchers.anyBoolean)1