Address review feedback on the integration test:
- Read latest telemetry with useStrictDataTypes=true always, so the value node
keeps its stored type (numeric -> JSON number, str_v -> JSON string).
- Assert the aggregation result is a numeric node across all existing scenarios
via a shared assertNumericValue helper, instead of a separate standalone test.
isNumber() is the actual regression guard; asLong()/asText() would coerce a
str_v string and miss it, so the type is asserted explicitly and the value is
compared numerically.
- Drop the redundant standalone test that duplicated an existing scenario.
Cover the fix that makes EntityAggregationCalculatedFieldState.toResult()
emit numeric aggregation results as numeric JSON nodes (dbl_v/long_v) instead
of JSON strings (str_v), which had broken server-side AVG/SUM aggregation.
- New unit test EntityAggregationCalculatedFieldStateTest: asserts toResult()
serializes a numeric result as a numeric node and a genuine string result
(lexical MIN/MAX over string telemetry) as a string node. Assertions check
the node type (isNumber/isTextual) rather than asText(), since asText()
coerces both node kinds identically - which is why the bug went unnoticed.
- EntityAggregationCalculatedFieldTest: add a strict-types read helper
(useStrictDataTypes=true) and a test asserting the stored SUM/AVG telemetry
are numeric JSON nodes end-to-end. Existing asText()-based assertions are
left untouched (they read via the non-strict endpoint, which stringifies
every value and therefore cannot observe the storage type).
EntityAggregationCalculatedFieldState.toResult() serialized every metric
result via ObjectNode.put(name, JacksonUtil.toString(value)), which produces
a JSON *string* node even for numeric aggregation results (SUM/AVG/COUNT/...).
When persisted (in particular with transport.json.type_cast_enabled=false, or
for non-parsable values) the result lands in ts_kv.str_v, so server-side AVG/SUM
aggregation returns no data in widgets/queries while COUNT/MIN/MAX still return.
Serialize with JacksonUtil.valueToTree(...) so numeric results are emitted as
numeric JSON nodes (-> dbl_v/long_v), mirroring
RelatedEntitiesAggregationCalculatedFieldState. Genuine string MIN/MAX results
over string telemetry are preserved as string nodes. The instanceof Number
guard is retained (it only governs rounding).
The deprecation cleanup set @EqualsAndHashCode(callSuper = true) on AlarmComment,
so equals/hashCode now include the BaseData id and createdTime. The delete tests
built the expected comment via a fresh builder (no id), which no longer matches the
server-generated deletion comment (which reuses the original comment id).
Mutate the original alarm comment (already carrying the correct id/createdTime) into
the expected SYSTEM deletion comment instead of building a fresh one.
Forward-merge of lts-4.2 into lts-4.3, bringing the deprecation-warning
cleanups (#15487, #15491, #15499, #15503, #15504, #15505, #15509, #15511,
#15512, #15515, #15517, #15522) in as real ancestry rather than the earlier
copy-paste (#15661).
Conflicts resolved toward the reviewed lts-4.2 form for shared code
(explicit @EqualsAndHashCode(callSuper=true), typed StringUtils/removeStart,
imported test annotations). lts-4.3-only implementations kept as-is
(calculated-field state classes, native CF repository); tests removed on
lts-4.3 (CalculatedFieldLinkDataValidatorTest, DefaultDataUpdateServiceTest)
stay removed.
The device-install wizard substituted ${...} placeholders via a plain
string replace, so a quoted boolean macro like "cleanSession":
"${mqttCleanSession}" parsed as the string "false" (truthy) instead of
the JSON boolean false. Unchecking a boolean field (e.g. clean session)
therefore had no effect and read as true in the resulting integration.
Add a type-aware resolveTemplateJson() that, using the form-field type
recorded in form.json, emits BOOLEAN/INTEGER placeholders occupying a
whole quoted token as raw JSON values (unquoted) while leaving string
fields and embedded placeholders quoted. Route all template-parse call
sites through it. Fixes cleanSession, ssl, port and connectTimeoutSec
across all existing device packages without any template changes.