You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2019/07/04 12:02:28 UTC

[plc4x] branch develop updated (4edd2c5 -> 0d8267f)

This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git.


    from 4edd2c5  - Added some debug code to track down regular build failures on our jenkins build agent (Missing to detect python)
     new 9efec5f  - Updated the JUnit dependencies - Added missing dependencies causing maven to skip some of the JUnit5 tests
     new 219034b  Fixed a bug in the code-generation.
     new 0d8267f  - Added KNX parsing of "Additional Information". - Added initial support for parsing of cEMI packages.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../main/resources/templates/java/io-template.ftlh |  2 +-
 .../protocol/test/ProtocolTestsuiteRunner.java     |  7 ++-
 pom.xml                                            | 35 ++++++++++-
 .../resources/protocols/knxnetip/knxnetip.mspec    | 72 +++++++++++++++++++---
 sandbox/code-gen/pom.xml                           |  5 ++
 sandbox/test-java-knxnetip-driver/pom.xml          |  5 ++
 .../org/apache/plc4x/java/knxnetip/IOTest.java     |  2 +-
 .../{KNXNetIpTestsuite.java => KNXNetIpTest.java}  |  4 +-
 .../test/resources/testsuite/KNXNetIPTestsuite.xml | 21 ++++---
 9 files changed, 131 insertions(+), 22 deletions(-)
 rename sandbox/test-java-knxnetip-driver/src/test/java/org/apache/plc4x/java/knxnetip/{KNXNetIpTestsuite.java => KNXNetIpTest.java} (90%)


[plc4x] 01/03: - Updated the JUnit dependencies - Added missing dependencies causing maven to skip some of the JUnit5 tests

Posted by cd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 9efec5fd65dbc43632b3a8caae8d8584e941cf22
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Thu Jul 4 13:53:12 2019 +0200

    - Updated the JUnit dependencies
    - Added missing dependencies causing maven to skip some of the JUnit5 tests
---
 pom.xml                                   | 35 +++++++++++++++++++++++++++++--
 sandbox/code-gen/pom.xml                  |  5 +++++
 sandbox/test-java-knxnetip-driver/pom.xml |  5 +++++
 3 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 63ddf18..fe731af 100644
--- a/pom.xml
+++ b/pom.xml
@@ -136,8 +136,8 @@
     <jna.version>4.5.1</jna.version>
     <joda-time.version>2.10</joda-time.version>
     <jopt-simple.version>5.0.2</jopt-simple.version>
-    <junit.jupiter.version>5.2.0</junit.jupiter.version>
-    <junit.platform.version>1.2.0</junit.platform.version>
+    <junit.jupiter.version>5.5.0</junit.jupiter.version>
+    <junit.platform.version>1.3.2</junit.platform.version>
     <junit.version>4.12</junit.version>
     <log4j.version>2.11.1</log4j.version>
     <logback.version>1.2.3</logback.version>
@@ -1114,6 +1114,37 @@
 
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <version>2.22.2</version>
+          <dependencies>
+            <dependency>
+              <groupId>org.junit.jupiter</groupId>
+              <artifactId>junit-jupiter-engine</artifactId>
+              <version>${junit.jupiter.version}</version>
+            </dependency>
+          </dependencies>
+        </plugin>
+
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-failsafe-plugin</artifactId>
+          <version>2.22.2</version>
+          <dependencies>
+            <dependency>
+              <groupId>org.junit.platform</groupId>
+              <artifactId>junit-platform-surefire-provider</artifactId>
+              <version>${junit.platform.version}</version>
+            </dependency>
+            <dependency>
+              <groupId>org.junit.jupiter</groupId>
+              <artifactId>junit-jupiter-engine</artifactId>
+              <version>${junit.jupiter.version}</version>
+            </dependency>
+          </dependencies>
+        </plugin>
+
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-source-plugin</artifactId>
           <executions>
             <execution>
diff --git a/sandbox/code-gen/pom.xml b/sandbox/code-gen/pom.xml
index 5928747..e5af414 100644
--- a/sandbox/code-gen/pom.xml
+++ b/sandbox/code-gen/pom.xml
@@ -54,6 +54,11 @@
     </dependency>
     <dependency>
       <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
       <artifactId>junit-jupiter-api</artifactId>
       <scope>test</scope>
     </dependency>
diff --git a/sandbox/test-java-knxnetip-driver/pom.xml b/sandbox/test-java-knxnetip-driver/pom.xml
index cdcc0cc..7cd88c8 100644
--- a/sandbox/test-java-knxnetip-driver/pom.xml
+++ b/sandbox/test-java-knxnetip-driver/pom.xml
@@ -86,6 +86,11 @@
       <artifactId>junit-jupiter-api</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.junit.jupiter</groupId>
+      <artifactId>junit-jupiter-engine</artifactId>
+      <scope>test</scope>
+    </dependency>
 
     <dependency>
       <groupId>org.apache.plc4x</groupId>


[plc4x] 03/03: - Added KNX parsing of "Additional Information". - Added initial support for parsing of cEMI packages.

Posted by cd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 0d8267f94479d41a1cea7549b1ddd30d4f3763ce
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Thu Jul 4 14:02:21 2019 +0200

    - Added KNX parsing of "Additional Information".
    - Added initial support for parsing of cEMI packages.
---
 .../protocol/test/ProtocolTestsuiteRunner.java     |  7 ++-
 .../resources/protocols/knxnetip/knxnetip.mspec    | 72 +++++++++++++++++++---
 .../org/apache/plc4x/java/knxnetip/IOTest.java     |  2 +-
 .../{KNXNetIpTestsuite.java => KNXNetIpTest.java}  |  4 +-
 .../test/resources/testsuite/KNXNetIPTestsuite.xml | 21 ++++---
 5 files changed, 87 insertions(+), 19 deletions(-)

diff --git a/plc4j/utils/protocol-test-utils/src/main/java/org/apache/plc4x/protocol/test/ProtocolTestsuiteRunner.java b/plc4j/utils/protocol-test-utils/src/main/java/org/apache/plc4x/protocol/test/ProtocolTestsuiteRunner.java
index 7853aba..f85d3af 100644
--- a/plc4j/utils/protocol-test-utils/src/main/java/org/apache/plc4x/protocol/test/ProtocolTestsuiteRunner.java
+++ b/plc4j/utils/protocol-test-utils/src/main/java/org/apache/plc4x/protocol/test/ProtocolTestsuiteRunner.java
@@ -32,6 +32,8 @@ import org.dom4j.*;
 import org.junit.jupiter.api.DynamicTest;
 import org.junit.jupiter.api.TestFactory;
 import org.dom4j.io.SAXReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.xmlunit.builder.DiffBuilder;
 import org.xmlunit.diff.Diff;
 
@@ -41,7 +43,7 @@ import java.util.*;
 
 public class ProtocolTestsuiteRunner {
 
-    private static final Namespace TEST_NAMESPACE = new Namespace("test", "https://plc4x.apache.org/schemas/testsuite.xsd");
+    private static final Logger LOGGER = LoggerFactory.getLogger(ProtocolTestsuiteRunner.class);
 
     private final String testsuiteDocument;
 
@@ -50,7 +52,7 @@ public class ProtocolTestsuiteRunner {
     }
 
     @TestFactory
-    public List<DynamicTest> getTestsuiteTests() throws ProtocolTestsuiteException {
+    public Iterable<DynamicTest> getTestsuiteTests() throws ProtocolTestsuiteException {
         ProtocolTestsuite testSuite = parseTestsuite(ProtocolTestsuiteRunner.class.getResourceAsStream(testsuiteDocument));
         List<DynamicTest> dynamicTests = new LinkedList<>();
         for(Testcase testcase : testSuite.getTestcases()) {
@@ -86,6 +88,7 @@ public class ProtocolTestsuiteRunner {
 
                 testcases.add(new Testcase(name, description, raw, rootType, xmlElement));
             }
+            LOGGER.info(String.format("Found %d testcases.", testcases.size()));
             return new ProtocolTestsuite(testsuiteName.getTextTrim(), testcases);
         } catch (DocumentException e) {
             throw new ProtocolTestsuiteException("Error parsing testsuite xml", e);
diff --git a/protocols/knxnetip/src/main/resources/protocols/knxnetip/knxnetip.mspec b/protocols/knxnetip/src/main/resources/protocols/knxnetip/knxnetip.mspec
index 419840d..30ffe2a 100644
--- a/protocols/knxnetip/src/main/resources/protocols/knxnetip/knxnetip.mspec
+++ b/protocols/knxnetip/src/main/resources/protocols/knxnetip/knxnetip.mspec
@@ -69,18 +69,20 @@
         ]
         ['0x0310' DeviceConfigurationRequest [uint 16 'totalLength']
             [field DeviceConfigurationRequestDataBlock 'deviceConfigurationRequestDataBlock']
-            [field CEMI                                'cEMI' ['totalLength - (6 + deviceConfigurationRequestDataBlock.lengthInBytes)']]
+            [field CEMI                                'cemi' ['totalLength - (6 + deviceConfigurationRequestDataBlock.lengthInBytes)']]
         ]
         ['0x0311' DeviceConfigurationAck
             [field DeviceConfigurationAckDataBlock 'deviceConfigurationAckDataBlock']
         ]
         ['0x0420' TunnelingRequest [uint 16 'totalLength']
             [field TunnelingRequestDataBlock 'tunnelingRequestDataBlock']
-            [field CEMI                      'cEMI' ['totalLength - (6 + tunnelingRequestDataBlock.lengthInBytes)']]
+            [field CEMI                      'cemi' ['totalLength - (6 + tunnelingRequestDataBlock.lengthInBytes)']]
         ]
         ['0x0421' TunnelingResponse
             [field TunnelingResponseDataBlock 'tunnelingResponseDataBlock']
         ]
+        ['0x0530' RoutingIndication
+        ]
     ]
 ]
 
@@ -193,7 +195,7 @@
 
 [type 'DeviceStatus'
     [reserved uint 7 '0x00']
-    [field    bit  1 'programMode']
+    [field    bit    'programMode']
 ]
 
 [type 'ProjectInstallationIdentifier'
@@ -219,6 +221,29 @@
 [discriminatedType 'CEMI' [uint 8 'size']
     [discriminator uint 8 'messageCode']
     [typeSwitch 'messageCode'
+        ['0x10' CEMILRawReq
+        ]
+        ['0x11' CEMILDataReq
+        ]
+        ['0x13' CEMILPollDataReq
+        ]
+
+        ['0x25' CEMILPollDataCon
+        ]
+        ['0x29' CEMILDataInd
+        ]
+        ['0x2B' CEMILBusmonInd
+            [field      uint 8                    'additionalInformationLength']
+            [arrayField CEMIAdditionalInformation 'additionalInformation' length 'additionalInformationLength']
+            [arrayField uint 8                    'rawFrame'              count  'size - (additionalInformationLength + 2)']
+        ]
+        ['0x2D' CEMILRawInd
+        ]
+        ['0x2E' CEMILDataCon
+        ]
+        ['0x2F' CEMILRawCon
+        ]
+
         ['0xFC' CEMIMPropReadReq
             [field uint 16 'interfaceObjectType']
             [field uint  8 'objectInstance']
@@ -233,11 +258,44 @@
             [field uint  4 'numberOfElements']
             [field uint 12 'startIndex']
         ]
-        ['0x2B' CEMILBusmonInd
-            [field      uint 8 'additionalInformationLength']
-            [arrayField uint 8 'additionalInformation' count 'additionalInformationLength']
-            [arrayField uint 8 'rawFrame'              count 'size - (additionalInformationLength + 2)']
+    ]
+]
+
+[discriminatedType 'CEMIAdditionalInformation'
+    [discriminator uint 8 'additionalInformationType']
+    [typeSwitch 'additionalInformationType'
+        ['0x03' CEMIAdditionalInformationBusmonitorInfo
+            [implicit uint 8 'len' '1']
+            [field    bit    'frameErrorFlag']
+            [field    bit    'bitErrorFlag']
+            [field    bit    'parityErrorFlag']
+            [field    bit    'unknownFlag']
+            [field    bit    'lostFlag']
+            [field    uint 3 'sequenceNumber']
+        ]
+        ['0x04' CEMIAdditionalInformationRelativeTimestamp
+            [implicit uint 8  'len' '2']
+            [field RelativeTimestamp 'relativeTimestamp']
         ]
     ]
 ]
 
+[type 'CEMIControlField1'
+    [field    bit    'standardFrame']
+    [reserved uint 1 '0x00']
+    [field    bit    'doNotRepeat']
+    [field    bit    'broadcast']
+    [field    uint 2 'priority']
+    [field    bit    'ackRequested']
+    [field    bit    'error']
+]
+
+[type 'CEMIControlField2'
+    [field    bit    'groupAddress']
+    [field    uint 3 'hopCount']
+    [field    uint 3 'extendedFrameFormat']
+]
+
+[type 'RelativeTimestamp'
+    [field    uint 16 'timestamp']
+]
diff --git a/sandbox/test-java-knxnetip-driver/src/test/java/org/apache/plc4x/java/knxnetip/IOTest.java b/sandbox/test-java-knxnetip-driver/src/test/java/org/apache/plc4x/java/knxnetip/IOTest.java
index 8ce22ad..e43ecfa 100644
--- a/sandbox/test-java-knxnetip-driver/src/test/java/org/apache/plc4x/java/knxnetip/IOTest.java
+++ b/sandbox/test-java-knxnetip-driver/src/test/java/org/apache/plc4x/java/knxnetip/IOTest.java
@@ -33,7 +33,7 @@ public class IOTest {
 
     @Test
     public void testXml() throws Exception {
-        byte[] rData = Hex.decodeHex("0610020500180801c0a82a46c4090801c0a82a46c40a0203");
+        byte[] rData = Hex.decodeHex("06100420001c046b00002b0703010504024502bc360a1e0ce100810d");
         ObjectMapper mapper = new XmlMapper().enableDefaultTyping();
         ReadBuffer rBuf = new ReadBuffer(rData);
         KNXNetIPMessage packet = new KNXNetIPMessageIO().parse(rBuf);
diff --git a/sandbox/test-java-knxnetip-driver/src/test/java/org/apache/plc4x/java/knxnetip/KNXNetIpTestsuite.java b/sandbox/test-java-knxnetip-driver/src/test/java/org/apache/plc4x/java/knxnetip/KNXNetIpTest.java
similarity index 90%
rename from sandbox/test-java-knxnetip-driver/src/test/java/org/apache/plc4x/java/knxnetip/KNXNetIpTestsuite.java
rename to sandbox/test-java-knxnetip-driver/src/test/java/org/apache/plc4x/java/knxnetip/KNXNetIpTest.java
index bb6fcde..b968eeb 100644
--- a/sandbox/test-java-knxnetip-driver/src/test/java/org/apache/plc4x/java/knxnetip/KNXNetIpTestsuite.java
+++ b/sandbox/test-java-knxnetip-driver/src/test/java/org/apache/plc4x/java/knxnetip/KNXNetIpTest.java
@@ -21,9 +21,9 @@ package org.apache.plc4x.java.knxnetip;
 
 import org.apache.plc4x.protocol.test.ProtocolTestsuiteRunner;
 
-public class KNXNetIpTestsuite extends ProtocolTestsuiteRunner {
+public class KNXNetIpTest extends ProtocolTestsuiteRunner {
 
-    public KNXNetIpTestsuite() {
+    public KNXNetIpTest() {
         super("/testsuite/KNXNetIPTestsuite.xml");
     }
 
diff --git a/sandbox/test-java-knxnetip-driver/src/test/resources/testsuite/KNXNetIPTestsuite.xml b/sandbox/test-java-knxnetip-driver/src/test/resources/testsuite/KNXNetIPTestsuite.xml
index 759de02..ffe965b 100644
--- a/sandbox/test-java-knxnetip-driver/src/test/resources/testsuite/KNXNetIPTestsuite.xml
+++ b/sandbox/test-java-knxnetip-driver/src/test/resources/testsuite/KNXNetIPTestsuite.xml
@@ -460,13 +460,19 @@
         <cemi className="org.apache.plc4x.java.knxnetip.CEMILBusmonInd">
           <additionalInformationLength>7</additionalInformationLength>
           <additionalInformation>
-            <additionalInformation>3</additionalInformation>
-            <additionalInformation>1</additionalInformation>
-            <additionalInformation>5</additionalInformation>
-            <additionalInformation>4</additionalInformation>
-            <additionalInformation>2</additionalInformation>
-            <additionalInformation>69</additionalInformation>
-            <additionalInformation>2</additionalInformation>
+            <additionalInformation className="org.apache.plc4x.java.knxnetip.CEMIAdditionalInformationBusmonitorInfo">
+              <frameErrorFlag>false</frameErrorFlag>
+              <bitErrorFlag>false</bitErrorFlag>
+              <parityErrorFlag>false</parityErrorFlag>
+              <unknownFlag>false</unknownFlag>
+              <lostFlag>false</lostFlag>
+              <sequenceNumber>5</sequenceNumber>
+            </additionalInformation>
+            <additionalInformation className="org.apache.plc4x.java.knxnetip.CEMIAdditionalInformationRelativeTimestamp">
+              <relativeTimestamp>
+                <timestamp>17666</timestamp>
+              </relativeTimestamp>
+            </additionalInformation>
           </additionalInformation>
           <rawFrame>
             <rawFrame>188</rawFrame>
@@ -481,6 +487,7 @@
           </rawFrame>
         </cemi>
       </TunnelingRequest>
+
     </xml>
   </testcase>
 


[plc4x] 02/03: Fixed a bug in the code-generation.

Posted by cd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 219034b31bcb82911cd148962944bb3aa9cd228b
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Thu Jul 4 14:00:16 2019 +0200

    Fixed a bug in the code-generation.
---
 .../language-java/src/main/resources/templates/java/io-template.ftlh    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/build-utils/language-java/src/main/resources/templates/java/io-template.ftlh b/build-utils/language-java/src/main/resources/templates/java/io-template.ftlh
index 4cb4234..bfdee08 100644
--- a/build-utils/language-java/src/main/resources/templates/java/io-template.ftlh
+++ b/build-utils/language-java/src/main/resources/templates/java/io-template.ftlh
@@ -130,7 +130,7 @@ public class ${typeName}IO implements MessageIO<${typeName}<#if helper.isDiscrim
 
         // Reserved Field (Compartmentalized so the "reserved" variable can't leak)
         {
-            ${helper.getLanguageTypeNameForField(field)} reserved = io.${helper.getReadMethodName(field.type)}(${field.type.size});
+            ${helper.getLanguageTypeNameForField(field)} reserved = io.${helper.getReadBufferReadMethodCall(field.type)};
             if(reserved != ${field.referenceValue}) {
                 LOGGER.info("Expected constant value " + ${field.referenceValue} + " but got " + reserved + " for reserved field.");
             }