From bdbdbee50c4f67b29b180ce45186bfd912896fed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Mikul=C3=A1=C5=A1ek?= Date: Sat, 16 Sep 2023 10:06:30 +0200 Subject: [PATCH] Deserialize KNX extension in status properly --- .../cz/smarteon/loxone/system/status/ExtensionAdapter.java | 1 + src/test/kotlin/system/status/MiniserverStatusTest.kt | 3 ++- src/test/resources/system/status/status_13_1_Gen2.xml | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/cz/smarteon/loxone/system/status/ExtensionAdapter.java b/src/main/java/cz/smarteon/loxone/system/status/ExtensionAdapter.java index b534e34..090e831 100644 --- a/src/main/java/cz/smarteon/loxone/system/status/ExtensionAdapter.java +++ b/src/main/java/cz/smarteon/loxone/system/status/ExtensionAdapter.java @@ -22,6 +22,7 @@ public Extension unmarshal(final Extension v) { case "AO Extension": case "AI Extension": case "RS232 Extension": + case "KNX Extension": return new BasicExtension(v); case "Dali Extension": return new DaliExtension(v); diff --git a/src/test/kotlin/system/status/MiniserverStatusTest.kt b/src/test/kotlin/system/status/MiniserverStatusTest.kt index 283c1ad..5dc430b 100644 --- a/src/test/kotlin/system/status/MiniserverStatusTest.kt +++ b/src/test/kotlin/system/status/MiniserverStatusTest.kt @@ -137,7 +137,7 @@ class MiniserverStatusTest { val ms = readResourceXml("system/status/status_13_1_Gen2.xml") expectThat(ms) { - get { extensions }.hasSize(3) + get { extensions }.hasSize(5) get { getExtensions(TreeExtension::class.java) }.hasSize(2).and { get { firstOrNull { it.type == "BuiltIn Tree" } }.isNotNull().and { get { serialNumber }.isEqualTo("13000001") @@ -145,6 +145,7 @@ class MiniserverStatusTest { get { rightBranch?.devices }.isNotNull().hasSize(1) } } + get { getExtensions(BasicExtension::class.java).filter { it.type == "KNX Extension" } }.hasSize(2) } } } diff --git a/src/test/resources/system/status/status_13_1_Gen2.xml b/src/test/resources/system/status/status_13_1_Gen2.xml index 583dbef..2b2dd98 100644 --- a/src/test/resources/system/status/status_13_1_Gen2.xml +++ b/src/test/resources/system/status/status_13_1_Gen2.xml @@ -16,6 +16,8 @@ + +