use of org.thingsboard.server.extensions.api.device.DeviceAttributes in project thingsboard by thingsboard.
the class DeviceAttributesFilterTest method basicClientAttributesStressTest.
@Test(timeout = 30000)
public void basicClientAttributesStressTest() {
DeviceAttributesFilter filter = new DeviceAttributesFilter();
filter.init(wrap("doubleValue == 1.0 && booleanValue == false"));
List<AttributeKvEntry> clientAttributes = new ArrayList<>();
clientAttributes.add(new BaseAttributeKvEntry(new DoubleDataEntry("doubleValue", 1.0), 42));
clientAttributes.add(new BaseAttributeKvEntry(new BooleanDataEntry("booleanValue", false), 42));
DeviceAttributes attributes = new DeviceAttributes(clientAttributes, new ArrayList<>(), new ArrayList<>());
Mockito.when(ruleCtx.getDeviceMetaData()).thenReturn(new DeviceMetaData(new DeviceId(UUID.randomUUID()), "A", "A", attributes));
for (int i = 0; i < 10000; i++) {
Assert.assertTrue(filter.filter(ruleCtx, null));
}
filter.stop();
}
Aggregations