use of org.eclipse.hono.service.management.device.DeviceManagementService in project hono by eclipse.
the class EdgeDeviceAutoProvisionerTest method verifySuccessfulAutoProvisioning.
@SuppressWarnings("unchecked")
private void verifySuccessfulAutoProvisioning() {
final ArgumentCaptor<Device> registeredDeviceArgumentCaptor = ArgumentCaptor.forClass(Device.class);
verify(deviceManagementService).createDevice(eq(Constants.DEFAULT_TENANT), eq(Optional.of(DEVICE_ID)), registeredDeviceArgumentCaptor.capture(), any());
final Device registeredDevice = registeredDeviceArgumentCaptor.getValue();
assertThat(registeredDevice).isEqualTo(NEW_EDGE_DEVICE);
final ArgumentCaptor<Map<String, Object>> messageArgumentCaptor = ArgumentCaptor.forClass(Map.class);
verify(sender).sendEvent(argThat(tenant -> tenant.getTenantId().equals(Constants.DEFAULT_TENANT)), argThat(assertion -> assertion.getDeviceId().equals(DEVICE_ID)), eq(EventConstants.CONTENT_TYPE_DEVICE_PROVISIONING_NOTIFICATION), any(), messageArgumentCaptor.capture(), any());
verify(deviceManagementService).updateDevice(eq(Constants.DEFAULT_TENANT), eq(DEVICE_ID), argThat(device -> device.getStatus().isAutoProvisioningNotificationSent()), any(Optional.class), any(Span.class));
final Map<String, Object> applicationProperties = messageArgumentCaptor.getValue();
verifyApplicationProperties(GATEWAY_ID, DEVICE_ID, applicationProperties);
}
Aggregations