use of org.sagebionetworks.bridge.models.notifications.NotificationRegistration in project BridgeServer2 by Sage-Bionetworks.
the class TestUtils method getNotificationRegistration.
public static NotificationRegistration getNotificationRegistration() {
NotificationRegistration registration = NotificationRegistration.create();
registration.setDeviceId("deviceId");
registration.setEndpoint("endpoint");
registration.setGuid("registrationGuid");
registration.setHealthCode("healthCode");
registration.setOsName("osName");
registration.setCreatedOn(1484173675648L);
return registration;
}
use of org.sagebionetworks.bridge.models.notifications.NotificationRegistration in project BridgeServer2 by Sage-Bionetworks.
the class NotificationsServiceTest method serviceFixesSynonymOsNamesOnCreate.
@Test
public void serviceFixesSynonymOsNamesOnCreate() {
NotificationRegistration registration = getNotificationRegistration();
registration.setOsName("iOS");
doReturn(registration).when(mockRegistrationDao).createPushNotificationRegistration(PLATFORM_ARN, registration);
NotificationRegistration result = service.createRegistration(TEST_APP_ID, DUMMY_CONTEXT, registration);
assertEquals(result.getOsName(), OperatingSystem.IOS);
}
use of org.sagebionetworks.bridge.models.notifications.NotificationRegistration in project BridgeServer2 by Sage-Bionetworks.
the class NotificationsServiceTest method createRegistration_PushNotification.
@Test
public void createRegistration_PushNotification() {
// Mock registration DAO.
NotificationRegistration registration = getNotificationRegistration();
registration.setHealthCode(HEALTH_CODE);
registration.setOsName(OS_NAME);
doReturn(registration).when(mockRegistrationDao).createPushNotificationRegistration(PLATFORM_ARN, registration);
// Execute and validate.
NotificationRegistration result = service.createRegistration(TEST_APP_ID, DUMMY_CONTEXT, registration);
verify(mockRegistrationDao).createPushNotificationRegistration(PLATFORM_ARN, registration);
assertEquals(result, registration);
// We also manage criteria-based topics.
verify(mockNotificationTopicService).manageCriteriaBasedSubscriptions(TEST_APP_ID, DUMMY_CONTEXT, HEALTH_CODE);
}
use of org.sagebionetworks.bridge.models.notifications.NotificationRegistration in project BridgeServer2 by Sage-Bionetworks.
the class NotificationsServiceTest method updateRegistration.
@Test
public void updateRegistration() {
NotificationRegistration registration = getNotificationRegistration();
registration.setOsName(OS_NAME);
doReturn(registration).when(mockRegistrationDao).updateRegistration(registration);
NotificationRegistration result = service.updateRegistration(TEST_APP_ID, registration);
verify(mockRegistrationDao).updateRegistration(registration);
assertEquals(result, registration);
}
use of org.sagebionetworks.bridge.models.notifications.NotificationRegistration in project BridgeServer2 by Sage-Bionetworks.
the class NotificationsServiceTest method throwsUnimplementedExceptionIfPlatformHasNoARN.
@Test(expectedExceptions = NotImplementedException.class)
public void throwsUnimplementedExceptionIfPlatformHasNoARN() {
NotificationRegistration registration = getNotificationRegistration();
registration.setOsName(OperatingSystem.ANDROID);
service.createRegistration(TEST_APP_ID, DUMMY_CONTEXT, registration);
}
Aggregations