@Test public void registerAndroidDevice_completeConfig() { mockServer.expect(requestTo("https: .andExpect(method(PUT)) .andExpect(header("Content-Type", "application/json")) .andExpect(body(readCompactedJsonResource(jsonResource("data/registration-aliasandtags")))) .andRespond(withResponse("", responseHeaders, HttpStatus.CREATED, "Created")); urbanAirship.registrationOperations().registerAndroidDevice(AndroidDeviceConfig.builder("apid1").alias("alias1").tags("tag1", "tag2").build()); mockServer.verify(); }
public void registerAndroidDevice(AndroidDeviceConfig deviceConfig) { if (deviceConfig.isEmpty()) { restOperations.put(APIDS_URL + deviceConfig.getApid(), ""); } else { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<AndroidDeviceConfig> requestEntity = new HttpEntity<AndroidDeviceConfig>(deviceConfig, headers); restOperations.exchange(APIDS_URL + deviceConfig.getApid(), HttpMethod.PUT, requestEntity, String.class); } }
RegistrationTemplate implements RegistrationOperations { public void registerAndroidDevice(AndroidDeviceConfig deviceConfig) { if (deviceConfig.isEmpty()) { restOperations.put(APIDS_URL + deviceConfig.getApid(), ""); } else { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<AndroidDeviceConfig> requestEntity = new HttpEntity<AndroidDeviceConfig>(deviceConfig, headers); restOperations.exchange(APIDS_URL + deviceConfig.getApid(), HttpMethod.PUT, requestEntity, String.class); } } }
RegistrationTemplate implements RegistrationOperations { public void registerAndroidDevice(AndroidDeviceConfig deviceConfig) { if (deviceConfig.isEmpty()) { restOperations.put(APIDS_URL + deviceConfig.getApid(), ""); } else { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<AndroidDeviceConfig> requestEntity = new HttpEntity<AndroidDeviceConfig>(deviceConfig, headers); restOperations.exchange(APIDS_URL + deviceConfig.getApid(), HttpMethod.PUT, requestEntity, String.class); } } RegistrationTemplate(RestOperations restOperations); }
RegistrationTemplate implements RegistrationOperations { public void registerAndroidDevice(AndroidDeviceConfig deviceConfig) { if (deviceConfig.isEmpty()) { restOperations.put(APIDS_URL + deviceConfig.getApid(), ""); } else { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<AndroidDeviceConfig> requestEntity = new HttpEntity<AndroidDeviceConfig>(deviceConfig, headers); restOperations.exchange(APIDS_URL + deviceConfig.getApid(), HttpMethod.PUT, requestEntity, String.class); } } RegistrationTemplate(RestOperations restOperations); void registerIOSDevice(IOSDeviceConfig deviceConfig); void registerAndroidDevice(AndroidDeviceConfig deviceConfig); void registerBlackberryDevice(BlackberryDeviceConfig deviceConfig); IOSDevice getIOSDevice(String deviceToken); AndroidDevice getAndroidDevice(String apid); BlackberryDevice getBlackberryDevice(String devicePin); void removeIOSDevice(String deviceToken); void removeAndroidDevice(String apid); void removeBlackberryDevice(String devicePin); }
RegistrationTemplate implements RegistrationOperations { public void registerAndroidDevice(AndroidDeviceConfig deviceConfig) { if (deviceConfig.isEmpty()) { restOperations.put(APIDS_URL + deviceConfig.getApid(), ""); } else { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<AndroidDeviceConfig> requestEntity = new HttpEntity<AndroidDeviceConfig>(deviceConfig, headers); restOperations.exchange(APIDS_URL + deviceConfig.getApid(), HttpMethod.PUT, requestEntity, String.class); } } RegistrationTemplate(RestOperations restOperations); void registerIOSDevice(IOSDeviceConfig deviceConfig); void registerAndroidDevice(AndroidDeviceConfig deviceConfig); void registerBlackberryDevice(BlackberryDeviceConfig deviceConfig); IOSDevice getIOSDevice(String deviceToken); AndroidDevice getAndroidDevice(String apid); BlackberryDevice getBlackberryDevice(String devicePin); void removeIOSDevice(String deviceToken); void removeAndroidDevice(String apid); void removeBlackberryDevice(String devicePin);  }