@Test public void testTranslate() { NotificationTranslator<PrebuiltNotificationsRequest> sut = new PreBuiltNotificationTranslator(); final String clientId = "CLIENT_ID"; final long recipientId = 80L; final String message = "MESSAGE"; final String url = "http: PrebuiltNotificationsRequest request = new PrebuiltNotificationsRequest(RequestType.EXTERNAL_PRE_BUILT, true, clientId, recipientId, message, url); NotificationBatch results = sut.translate(request); assertEquals(1, results.getRecipients().size()); TranslatorTestHelper.assertRecipients(results, NotificationType.PASS_THROUGH, recipientId); PropertyMap<Object> props = results.getProperties(); assertEquals(5, props.size()); PropertyMapTestHelper.assertValue(props, NotificationPropertyKeys.URL, url); PropertyMapTestHelper.assertValue(props, NotificationPropertyKeys.HIGH_PRIORITY, true); PropertyMapTestHelper.assertValue(props, "message", message); PropertyMapTestHelper.assertPlaceholder(props, NotificationPropertyKeys.SOURCE, OAuthConsumer.class, clientId); PropertyMapTestHelper.assertAlias(props, NotificationPropertyKeys.ACTOR, NotificationPropertyKeys.SOURCE); }
@Override public NotificationBatch translate(final PrebuiltNotificationsRequest inRequest) { NotificationBatch batch = new NotificationBatch(NotificationType.PASS_THROUGH, inRequest.getRecipientId()); batch.setProperty(NotificationPropertyKeys.URL, inRequest.getUrl()); batch.setProperty(NotificationPropertyKeys.HIGH_PRIORITY, inRequest.isHighPriority()); batch.setProperty("message", inRequest.getMessage()); batch.setProperty(NotificationPropertyKeys.SOURCE, OAuthConsumer.class, inRequest.getClientId()); batch.setPropertyAlias(NotificationPropertyKeys.ACTOR, NotificationPropertyKeys.SOURCE); return batch; }
PreBuiltNotificationTranslator implements NotificationTranslator<PrebuiltNotificationsRequest> { @Override public NotificationBatch translate(final PrebuiltNotificationsRequest inRequest) { NotificationBatch batch = new NotificationBatch(NotificationType.PASS_THROUGH, inRequest.getRecipientId()); batch.setProperty(NotificationPropertyKeys.URL, inRequest.getUrl()); batch.setProperty(NotificationPropertyKeys.HIGH_PRIORITY, inRequest.isHighPriority()); batch.setProperty("message", inRequest.getMessage()); batch.setProperty(NotificationPropertyKeys.SOURCE, OAuthConsumer.class, inRequest.getClientId()); batch.setPropertyAlias(NotificationPropertyKeys.ACTOR, NotificationPropertyKeys.SOURCE); return batch; } }
PreBuiltNotificationTranslator implements NotificationTranslator<PrebuiltNotificationsRequest> { @Override public NotificationBatch translate(final PrebuiltNotificationsRequest inRequest) { NotificationBatch batch = new NotificationBatch(NotificationType.PASS_THROUGH, inRequest.getRecipientId()); batch.setProperty(NotificationPropertyKeys.URL, inRequest.getUrl()); batch.setProperty(NotificationPropertyKeys.HIGH_PRIORITY, inRequest.isHighPriority()); batch.setProperty("message", inRequest.getMessage()); batch.setProperty(NotificationPropertyKeys.SOURCE, OAuthConsumer.class, inRequest.getClientId()); batch.setPropertyAlias(NotificationPropertyKeys.ACTOR, NotificationPropertyKeys.SOURCE); return batch; }  }
PreBuiltNotificationTranslator implements NotificationTranslator<PrebuiltNotificationsRequest> { @Override public NotificationBatch translate(final PrebuiltNotificationsRequest inRequest) { NotificationBatch batch = new NotificationBatch(NotificationType.PASS_THROUGH, inRequest.getRecipientId()); batch.setProperty(NotificationPropertyKeys.URL, inRequest.getUrl()); batch.setProperty(NotificationPropertyKeys.HIGH_PRIORITY, inRequest.isHighPriority()); batch.setProperty("message", inRequest.getMessage()); batch.setProperty(NotificationPropertyKeys.SOURCE, OAuthConsumer.class, inRequest.getClientId()); batch.setPropertyAlias(NotificationPropertyKeys.ACTOR, NotificationPropertyKeys.SOURCE); return batch; }  @Override NotificationBatch translate(final PrebuiltNotificationsRequest inRequest); }
PreBuiltNotificationTranslator implements NotificationTranslator<PrebuiltNotificationsRequest> { @Override public NotificationBatch translate(final PrebuiltNotificationsRequest inRequest) { NotificationBatch batch = new NotificationBatch(NotificationType.PASS_THROUGH, inRequest.getRecipientId()); batch.setProperty(NotificationPropertyKeys.URL, inRequest.getUrl()); batch.setProperty(NotificationPropertyKeys.HIGH_PRIORITY, inRequest.isHighPriority()); batch.setProperty("message", inRequest.getMessage()); batch.setProperty(NotificationPropertyKeys.SOURCE, OAuthConsumer.class, inRequest.getClientId()); batch.setPropertyAlias(NotificationPropertyKeys.ACTOR, NotificationPropertyKeys.SOURCE); return batch; }  @Override NotificationBatch translate(final PrebuiltNotificationsRequest inRequest);  }