Fix Device creation events processing from Edge
This commit is contained in:
		
							parent
							
								
									910008b9a4
								
							
						
					
					
						commit
						7ce98560a3
					
				@ -215,7 +215,7 @@ public class DeviceEdgeProcessor extends BaseEdgeProcessor {
 | 
			
		||||
                device.setDeviceProfileId(deviceProfileId);
 | 
			
		||||
            }
 | 
			
		||||
            Device savedDevice = deviceService.saveDevice(device, false);
 | 
			
		||||
            tbClusterService.onDeviceUpdated(savedDevice, device, false);
 | 
			
		||||
            tbClusterService.onDeviceUpdated(savedDevice, created ? null : device, false);
 | 
			
		||||
            if (created) {
 | 
			
		||||
                DeviceCredentials deviceCredentials = new DeviceCredentials();
 | 
			
		||||
                deviceCredentials.setDeviceId(new DeviceId(savedDevice.getUuidId()));
 | 
			
		||||
 | 
			
		||||
@ -1367,9 +1367,9 @@ abstract public class BaseEdgeTest extends AbstractControllerTest {
 | 
			
		||||
        Assert.assertEquals(timeseriesValue, timeseries.get(timeseriesKey).get(0).get("value"));
 | 
			
		||||
 | 
			
		||||
        List<Map<String, String>> attributes = doGetAsyncTyped("/api/plugins/telemetry/DEVICE/" + device.getId() + "/values/attributes/" + DataConstants.SERVER_SCOPE, new TypeReference<>() {});
 | 
			
		||||
        Assert.assertEquals(1, attributes.size());
 | 
			
		||||
        Assert.assertEquals(attributes.get(0).get("key"), attributesKey);
 | 
			
		||||
        Assert.assertEquals(attributes.get(0).get("value"), attributesValue);
 | 
			
		||||
        Assert.assertEquals(2, attributes.size());
 | 
			
		||||
        var result = attributes.stream().filter(kv -> kv.get("key").equals(attributesKey)).filter(kv -> kv.get("value").equals(attributesValue)).findFirst();
 | 
			
		||||
        Assert.assertTrue(result.isPresent());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private Map<String, List<Map<String, String>>> loadDeviceTimeseries(Device device, String timeseriesKey) throws Exception {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user