use of org.thingsboard.server.common.data.id.DeviceCredentialsId in project thingsboard by thingsboard.
the class BaseDeviceCredentialsCacheTest method createDummyDeviceCredentialsEntity.
private DeviceCredentials createDummyDeviceCredentialsEntity(String deviceCredentialsId) {
DeviceCredentials result = new DeviceCredentials(new DeviceCredentialsId(UUID.randomUUID()));
result.setCredentialsId(deviceCredentialsId);
return result;
}
use of org.thingsboard.server.common.data.id.DeviceCredentialsId in project thingsboard by thingsboard.
the class DeviceCredentialsEntity method toData.
@Override
public DeviceCredentials toData() {
DeviceCredentials deviceCredentials = new DeviceCredentials(new DeviceCredentialsId(getId()));
deviceCredentials.setCreatedTime(UUIDs.unixTimestamp(getId()));
if (deviceId != null) {
deviceCredentials.setDeviceId(new DeviceId(toUUID(deviceId)));
}
deviceCredentials.setCredentialsType(credentialsType);
deviceCredentials.setCredentialsId(credentialsId);
deviceCredentials.setCredentialsValue(credentialsValue);
return deviceCredentials;
}
use of org.thingsboard.server.common.data.id.DeviceCredentialsId in project thingsboard by thingsboard.
the class DeviceCredentialsEntity method toData.
@Override
public DeviceCredentials toData() {
DeviceCredentials deviceCredentials = new DeviceCredentials(new DeviceCredentialsId(id));
deviceCredentials.setCreatedTime(UUIDs.unixTimestamp(id));
if (deviceId != null) {
deviceCredentials.setDeviceId(new DeviceId(deviceId));
}
deviceCredentials.setCredentialsType(credentialsType);
deviceCredentials.setCredentialsId(credentialsId);
deviceCredentials.setCredentialsValue(credentialsValue);
return deviceCredentials;
}
use of org.thingsboard.server.common.data.id.DeviceCredentialsId in project thingsboard by thingsboard.
the class BaseDeviceControllerTest method testSaveNonExistentDeviceCredentials.
@Test
public void testSaveNonExistentDeviceCredentials() throws Exception {
Device device = new Device();
device.setName("My device");
device.setType("default");
Device savedDevice = doPost("/api/device", device, Device.class);
DeviceCredentials deviceCredentials = doGet("/api/device/" + savedDevice.getId().getId().toString() + "/credentials", DeviceCredentials.class);
DeviceCredentials newDeviceCredentials = new DeviceCredentials(new DeviceCredentialsId(UUIDs.timeBased()));
newDeviceCredentials.setCreatedTime(deviceCredentials.getCreatedTime());
newDeviceCredentials.setDeviceId(deviceCredentials.getDeviceId());
newDeviceCredentials.setCredentialsType(deviceCredentials.getCredentialsType());
newDeviceCredentials.setCredentialsId(deviceCredentials.getCredentialsId());
doPost("/api/device/credentials", newDeviceCredentials).andExpect(status().isBadRequest()).andExpect(statusReason(containsString("Unable to update non-existent device credentials")));
}
use of org.thingsboard.server.common.data.id.DeviceCredentialsId in project thingsboard by thingsboard.
the class BaseDeviceCredentialsCacheTest method createDummyDeviceCredentials.
private DeviceCredentials createDummyDeviceCredentials(UUID id, String deviceCredentialsId, UUID deviceId) {
DeviceCredentials result = new DeviceCredentials();
result.setId(new DeviceCredentialsId(id));
result.setDeviceId(new DeviceId(deviceId));
result.setCredentialsId(deviceCredentialsId);
result.setCredentialsType(DeviceCredentialsType.ACCESS_TOKEN);
return result;
}
Aggregations