use of org.infobip.mobile.messaging.geo.report.GeoReport in project mobile-messaging-sdk-android by infobip.
the class GeoReportHelperTest method test_should_find_signaling_messages_for_report.
@Test
public void test_should_find_signaling_messages_for_report() throws Exception {
// Given
Message m1 = createMessage(context, "signalingMessageId", "campaignId", true, createArea("areaId"));
Message m2 = createMessage(context, "signalingMessageI2", "campaignId", true, createArea("areaId"));
Message m3 = createMessage(context, "signalingMessageI3", "campaignId", true, createArea("areaId"));
GeoReport report = createReport(context, "signalingMessageId", "campaignId", "sdkMessageId", false);
// When
Message foundMessage = GeoReportHelper.getSignalingMessageForReport(Arrays.asList(m1, m2, m3), report);
// Then
assertJEquals(m1, foundMessage);
}
use of org.infobip.mobile.messaging.geo.report.GeoReport in project mobile-messaging-sdk-android by infobip.
the class GeoReportHelperTest method test_should_filter_reports_for_inactive_campaigns.
@Test
public void test_should_filter_reports_for_inactive_campaigns() throws Exception {
// Given
Area area = createArea("areaId");
EventReportResponse reportResponse = new EventReportResponse();
reportResponse.setFinishedCampaignIds(Sets.newSet("campaignId1"));
reportResponse.setSuspendedCampaignIds(Sets.newSet("campaignId2"));
createMessage(context, "signalingMessageId1", "campaignId1", true, area);
createMessage(context, "signalingMessageId2", "campaignId2", true, area);
createMessage(context, "signalingMessageId3", "campaignId3", true, area);
GeoReportingResult geoReportingResult = new GeoReportingResult(reportResponse);
List<GeoReport> reports = Arrays.asList(createReport(context, "signalingMessageId1", "campaignId1", "sdkMessageId1", false, area), createReport(context, "signalingMessageId2", "campaignId2", "sdkMessageId2", false, area), createReport(context, "signalingMessageId3", "campaignId3", "sdkMessageId3", false, area));
// When
List<GeoReport> filtered = GeoReportHelper.filterOutNonActiveReports(context, reports, geoReportingResult);
// Then
assertJEquals(reports.get(2), filtered.get(0));
}
use of org.infobip.mobile.messaging.geo.report.GeoReport in project mobile-messaging-sdk-android by infobip.
the class GeoReportHelperTest method test_should_create_messages_with_generated_ids_for_unsuccessful_report.
@Test
public void test_should_create_messages_with_generated_ids_for_unsuccessful_report() {
// Given
Area area = createArea("areaId");
GeoReport report = createReport(context, "signalingMessageId", "campaignId", "sdkMessageId", false, area);
GeoReportingResult geoReportingResult = new GeoReportingResult(new Exception());
createMessage(context, "signalingMessageId", "campaignId", true, area);
// When
Map<Message, GeoEventType> messages = GeoReportHelper.createMessagesToNotify(context, Collections.singletonList(report), geoReportingResult);
// Then
Message generated = messages.keySet().iterator().next();
assertEquals("sdkMessageId", generated.getMessageId());
assertEquals(GeoEventType.entry, messages.values().iterator().next());
}
Aggregations