Viacheslav Klimov
7 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
11 additions and
3 deletions
-
application/src/main/java/org/thingsboard/server/controller/TelemetryController.java
-
application/src/test/java/org/thingsboard/server/controller/TelemetryControllerTest.java
|
|
|
@ -87,6 +87,7 @@ import org.thingsboard.server.service.telemetry.TsData; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.LinkedHashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
@ -888,11 +889,11 @@ public class TelemetryController extends BaseController { |
|
|
|
} |
|
|
|
|
|
|
|
private List<String> toKeysList(String keys) { |
|
|
|
List<String> keyList = null; |
|
|
|
if (!StringUtils.isEmpty(keys)) { |
|
|
|
keyList = Arrays.asList(keys.split(",")); |
|
|
|
return Arrays.asList(keys.split(",")); |
|
|
|
} else { |
|
|
|
return Collections.emptyList(); |
|
|
|
} |
|
|
|
return keyList; |
|
|
|
} |
|
|
|
|
|
|
|
private DeferredResult<ResponseEntity> getImmediateDeferredResult(String message, HttpStatus status) { |
|
|
|
|
|
|
|
@ -113,6 +113,13 @@ public class TelemetryControllerTest extends AbstractControllerTest { |
|
|
|
var monthResult = result.get("t").get(0); |
|
|
|
Assert.assertEquals(22L, monthResult.get("value").asLong()); |
|
|
|
Assert.assertEquals(middleOfTheInterval, monthResult.get("ts").asLong()); |
|
|
|
|
|
|
|
// get all latest (without keys parameter)
|
|
|
|
ObjectNode allLatest = doGetAsync("/api/plugins/telemetry/DEVICE/" + device.getId() + |
|
|
|
"/values/timeseries?startTs={startTs}&endTs={endTs}&agg={agg}&intervalType={intervalType}&timeZone={timeZone}", |
|
|
|
ObjectNode.class, startTs, endTs, "SUM", "WEEK_ISO", "Europe/Kyiv"); |
|
|
|
Assert.assertNotNull(allLatest); |
|
|
|
Assert.assertNotNull(allLatest.get("t")); |
|
|
|
} |
|
|
|
|
|
|
|
@Test |
|
|
|
|