@Test public void sendMessage_toUsersAliasesAndTags_complete_noPush() { masterKeyMockServer.expect(requestTo("https: .andExpect(method(HttpMethod.POST)) .andExpect(body(readCompactedJsonResource(jsonResource("data/message-tousersaliasestags-complete-nopush")))) .andRespond(withResponse("", responseHeaders, HttpStatus.OK, "Okay")); Map<String, String> extra = new LinkedHashMap<String, String>(); extra.put("key1","value1"); extra.put("key2","value2"); urbanAirship.richPushOperations().sendMessage(OutgoingMessage.builder("Hello").users("user1","user2").aliases("alias1","alias2").tags("tag1","tag2").title("title").contentType("text/html").extra(extra).build()); masterKeyMockServer.verify(); }
public void sendMessage(OutgoingMessage message) { if (message.hasRecipients()) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<OutgoingMessage> requestEntity = new HttpEntity<OutgoingMessage>(message, headers); restOperations.exchange(AIRMAIL_URL, HttpMethod.POST, requestEntity, String.class); } else { throw new IncompleteMessageException("A message must have at least one user, alias, or tag as recipient unless sending as a broadcast."); } }
RichPushTemplate implements RichPushOperations { public void sendMessage(OutgoingMessage message) { if (message.hasRecipients()) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<OutgoingMessage> requestEntity = new HttpEntity<OutgoingMessage>(message, headers); restOperations.exchange(AIRMAIL_URL, HttpMethod.POST, requestEntity, String.class); } else { throw new IncompleteMessageException("A message must have at least one user, alias, or tag as recipient unless sending as a broadcast."); } } }
RichPushTemplate implements RichPushOperations { public void sendMessage(OutgoingMessage message) { if (message.hasRecipients()) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<OutgoingMessage> requestEntity = new HttpEntity<OutgoingMessage>(message, headers); restOperations.exchange(AIRMAIL_URL, HttpMethod.POST, requestEntity, String.class); } else { throw new IncompleteMessageException("A message must have at least one user, alias, or tag as recipient unless sending as a broadcast."); } } RichPushTemplate(RestOperations restOperations); }
RichPushTemplate implements RichPushOperations { public void sendMessage(OutgoingMessage message) { if (message.hasRecipients()) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<OutgoingMessage> requestEntity = new HttpEntity<OutgoingMessage>(message, headers); restOperations.exchange(AIRMAIL_URL, HttpMethod.POST, requestEntity, String.class); } else { throw new IncompleteMessageException("A message must have at least one user, alias, or tag as recipient unless sending as a broadcast."); } } RichPushTemplate(RestOperations restOperations); void sendMessage(OutgoingMessage message); void sendBroadcast(OutgoingMessage message); }
RichPushTemplate implements RichPushOperations { public void sendMessage(OutgoingMessage message) { if (message.hasRecipients()) { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<OutgoingMessage> requestEntity = new HttpEntity<OutgoingMessage>(message, headers); restOperations.exchange(AIRMAIL_URL, HttpMethod.POST, requestEntity, String.class); } else { throw new IncompleteMessageException("A message must have at least one user, alias, or tag as recipient unless sending as a broadcast."); } } RichPushTemplate(RestOperations restOperations); void sendMessage(OutgoingMessage message); void sendBroadcast(OutgoingMessage message);  }