Example #1
0
  @Test
  public void registerNewDevice() throws Exception {

    Device device = new Device();
    device.setUser(user1);
    device.setName("john's computer");
    device.setOs("Linux");
    device.setLastIp("15.26.156.98");
    device.setAppVersion("1.2.3");

    UUID result = handler.doUpdateDevice(device);

    System.out.println("Result: " + result + " | Device: " + device);

    assertNotEquals("-1", result);
  }
  @Override
  public UUID updateDevice(UpdateDeviceRequest request)
      throws UserNotFoundException, DeviceNotValidException, DeviceNotUpdatedException {

    logger.debug(request.toString());

    User user = new User();
    user.setId(request.getUserId());

    Device device = new Device();
    device.setId(request.getDeviceId());
    device.setUser(user);
    device.setName(request.getDeviceName());
    device.setOs(request.getOs());
    device.setLastIp(request.getIp());
    device.setAppVersion(request.getAppVersion());

    UUID deviceId = getHandler().doUpdateDevice(device);

    return deviceId;
  }