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 2020/02/25 22:37:28 UTC

[plc4x] 03/04: - Fixed a typo in the filename of the driver testsuite for s7

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

cdutz pushed a commit to branch feature/driver-testsuite
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit e93cbc8d8d0bd6bc78464ddcb011535572b7fe6a
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Tue Feb 25 23:34:11 2020 +0100

    - Fixed a typo in the filename of the driver testsuite for s7
---
 .../plc4x/java/s7/readwrite/S7DriverTestsuite.java |   2 +-
 .../test/resources/testsuite/S7DriverTestsuie.xml  |  47 ----
 .../test/resources/testsuite/S7DriverTestsuite.xml | 285 +++++++++++++++++++++
 3 files changed, 286 insertions(+), 48 deletions(-)

diff --git a/plc4j/drivers/s7/src/test/java/org/apache/plc4x/java/s7/readwrite/S7DriverTestsuite.java b/plc4j/drivers/s7/src/test/java/org/apache/plc4x/java/s7/readwrite/S7DriverTestsuite.java
index 2a3fce8..97b2313 100644
--- a/plc4j/drivers/s7/src/test/java/org/apache/plc4x/java/s7/readwrite/S7DriverTestsuite.java
+++ b/plc4j/drivers/s7/src/test/java/org/apache/plc4x/java/s7/readwrite/S7DriverTestsuite.java
@@ -23,7 +23,7 @@ import org.apache.plc4x.test.driver.DriverTestsuiteRunner;
 public class S7DriverTestsuite extends DriverTestsuiteRunner {
 
     public S7DriverTestsuite() {
-        super("/testsuite/S7DriverTestsuie.xml");
+        super("/testsuite/S7DriverTestsuite.xml");
     }
 
 }
diff --git a/plc4j/drivers/s7/src/test/resources/testsuite/S7DriverTestsuie.xml b/plc4j/drivers/s7/src/test/resources/testsuite/S7DriverTestsuie.xml
deleted file mode 100644
index 0b2b356..0000000
--- a/plc4j/drivers/s7/src/test/resources/testsuite/S7DriverTestsuie.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one
-  or more contributor license agreements.  See the NOTICE file
-  distributed with this work for additional information
-  regarding copyright ownership.  The ASF licenses this file
-  to you under the Apache License, Version 2.0 (the
-  "License"); you may not use this file except in compliance
-  with the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing,
-  software distributed under the License is distributed on an
-  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-  KIND, either express or implied.  See the License for the
-  specific language governing permissions and limitations
-  under the License.
-  -->
-<test:driver-testsuite xmlns:test="https://plc4x.apache.org/schemas/driver-testsuite.xsd"
-                       bigEndian="true">
-
-  <name>S7</name>
-
-  <driver-name>s7</driver-name>
-
-  <setup>
-    <!-- First the driver is expected to send a COTP connection request -->
-    <send-bytes>
-      <root-type>TPKTPacket</root-type>
-      <raw>AAAAAAAA</raw>
-    </send-bytes>
-    <!-- The PLC will send a COTP connection response -->
-    <!-- After that the driver will send a S7 connection request -->
-    <!-- The PLC will send a S7 connection response -->
-  </setup>
-
-  <testcase>
-    <name>Hurz</name>
-    <steps>
-      <plc4x-request>
-
-      </plc4x-request>
-    </steps>
-  </testcase>
-
-</test:driver-testsuite>
\ No newline at end of file
diff --git a/plc4j/drivers/s7/src/test/resources/testsuite/S7DriverTestsuite.xml b/plc4j/drivers/s7/src/test/resources/testsuite/S7DriverTestsuite.xml
new file mode 100644
index 0000000..518c651
--- /dev/null
+++ b/plc4j/drivers/s7/src/test/resources/testsuite/S7DriverTestsuite.xml
@@ -0,0 +1,285 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+  -->
+<test:driver-testsuite xmlns:test="https://plc4x.apache.org/schemas/driver-testsuite.xsd"
+                       bigEndian="true">
+
+  <name>S7</name>
+
+  <driver-name>s7</driver-name>
+
+  <setup>
+    <!-- First the driver is expected to send a COTP connection request -->
+    <send-plc-message>
+      <TPKTPacket className="org.apache.plc4x.java.s7.readwrite.TPKTPacket">
+        <payload className="org.apache.plc4x.java.s7.readwrite.COTPPacketConnectionRequest">
+          <parameters>
+            <parameters className="org.apache.plc4x.java.s7.readwrite.COTPParameterCalledTsap">
+              <tsapId>256</tsapId>
+            </parameters>
+            <parameters className="org.apache.plc4x.java.s7.readwrite.COTPParameterCallingTsap">
+              <tsapId>785</tsapId>
+            </parameters>
+            <parameters className="org.apache.plc4x.java.s7.readwrite.COTPParameterTpduSize">
+              <tpduSize>SIZE_1024</tpduSize>
+            </parameters>
+          </parameters>
+          <payload/>
+          <destinationReference>0</destinationReference>
+          <sourceReference>15</sourceReference>
+          <protocolClass>CLASS_0</protocolClass>
+        </payload>
+      </TPKTPacket>
+    </send-plc-message>
+    <!-- The PLC will send a COTP connection response -->
+    <receive-plc-message>
+      <TPKTPacket className="org.apache.plc4x.java.s7.readwrite.TPKTPacket">
+        <payload className="org.apache.plc4x.java.s7.readwrite.COTPPacketConnectionResponse">
+          <parameters>
+            <parameters className="org.apache.plc4x.java.s7.readwrite.COTPParameterTpduSize">
+              <tpduSize>SIZE_1024</tpduSize>
+            </parameters>
+            <parameters className="org.apache.plc4x.java.s7.readwrite.COTPParameterCallingTsap">
+              <tsapId>785</tsapId>
+            </parameters>
+            <parameters className="org.apache.plc4x.java.s7.readwrite.COTPParameterCalledTsap">
+              <tsapId>256</tsapId>
+            </parameters>
+          </parameters>
+          <payload/>
+          <destinationReference>15</destinationReference>
+          <sourceReference>11</sourceReference>
+          <protocolClass>CLASS_0</protocolClass>
+        </payload>
+      </TPKTPacket>
+    </receive-plc-message>
+    <!-- After that the driver will send a S7 connection request -->
+    <send-plc-message>
+      <TPKTPacket className="org.apache.plc4x.java.s7.readwrite.TPKTPacket">
+        <payload className="org.apache.plc4x.java.s7.readwrite.COTPPacketData">
+          <parameters/>
+          <payload className="org.apache.plc4x.java.s7.readwrite.S7MessageRequest">
+            <tpduReference>0</tpduReference>
+            <parameter className="org.apache.plc4x.java.s7.readwrite.S7ParameterSetupCommunication">
+              <maxAmqCaller>8</maxAmqCaller>
+              <maxAmqCallee>8</maxAmqCallee>
+              <pduLength>1008</pduLength>
+            </parameter>
+            <payload/>
+          </payload>
+          <eot>true</eot>
+          <tpduRef>1</tpduRef>
+        </payload>
+      </TPKTPacket>
+    </send-plc-message>
+    <!-- The PLC will send a S7 connection response -->
+    <receive-plc-message>
+      <TPKTPacket className="org.apache.plc4x.java.s7.readwrite.TPKTPacket">
+        <payload className="org.apache.plc4x.java.s7.readwrite.COTPPacketData">
+          <parameters/>
+          <payload className="org.apache.plc4x.java.s7.readwrite.S7MessageResponseData">
+            <tpduReference>0</tpduReference>
+            <parameter className="org.apache.plc4x.java.s7.readwrite.S7ParameterSetupCommunication">
+              <maxAmqCaller>3</maxAmqCaller>
+              <maxAmqCallee>3</maxAmqCallee>
+              <pduLength>240</pduLength>
+            </parameter>
+            <payload/>
+            <errorClass>0</errorClass>
+            <errorCode>0</errorCode>
+          </payload>
+          <eot>true</eot>
+          <tpduRef>0</tpduRef>
+        </payload>
+      </TPKTPacket>
+    </receive-plc-message>
+    <!-- Next we'll query some type information -->
+    <send-plc-message>
+      <TPKTPacket className="org.apache.plc4x.java.s7.readwrite.TPKTPacket">
+        <payload className="org.apache.plc4x.java.s7.readwrite.COTPPacketData">
+          <parameters/>
+          <payload className="org.apache.plc4x.java.s7.readwrite.S7MessageUserData">
+            <tpduReference>1</tpduReference>
+            <parameter className="org.apache.plc4x.java.s7.readwrite.S7ParameterUserData">
+              <items>
+                <items className="org.apache.plc4x.java.s7.readwrite.S7ParameterUserDataItemCPUFunctions">
+                  <method>17</method>
+                  <cpuFunctionType>4</cpuFunctionType>
+                  <cpuFunctionGroup>4</cpuFunctionGroup>
+                  <cpuSubfunction>1</cpuSubfunction>
+                  <sequenceNumber>0</sequenceNumber>
+                  <dataUnitReferenceNumber/>
+                  <lastDataUnit/>
+                  <errorCode/>
+                </items>
+              </items>
+            </parameter>
+            <payload className="org.apache.plc4x.java.s7.readwrite.S7PayloadUserData">
+              <items>
+                <items className="org.apache.plc4x.java.s7.readwrite.S7PayloadUserDataItemCpuFunctionReadSzlRequest">
+                  <returnCode>OK</returnCode>
+                  <transportSize>OCTET_STRING</transportSize>
+                  <szlId className="org.apache.plc4x.java.s7.readwrite.SzlId">
+                    <typeClass>CPU</typeClass>
+                    <sublistExtract>0</sublistExtract>
+                    <sublistList>MODULE_IDENTIFICATION</sublistList>
+                  </szlId>
+                  <szlIndex>0</szlIndex>
+                </items>
+              </items>
+            </payload>
+          </payload>
+          <eot>true</eot>
+          <tpduRef>2</tpduRef>
+        </payload>
+      </TPKTPacket>
+    </send-plc-message>
+    <!-- Which the PLC will gladly provide to us -->
+    <receive-plc-message>
+      <TPKTPacket className="org.apache.plc4x.java.s7.readwrite.TPKTPacket">
+        <payload className="org.apache.plc4x.java.s7.readwrite.COTPPacketData">
+          <parameters/>
+          <payload className="org.apache.plc4x.java.s7.readwrite.S7MessageUserData">
+            <tpduReference>1</tpduReference>
+            <parameter className="org.apache.plc4x.java.s7.readwrite.S7ParameterUserData">
+              <items>
+                <items className="org.apache.plc4x.java.s7.readwrite.S7ParameterUserDataItemCPUFunctions">
+                  <method>18</method>
+                  <cpuFunctionType>8</cpuFunctionType>
+                  <cpuFunctionGroup>4</cpuFunctionGroup>
+                  <cpuSubfunction>1</cpuSubfunction>
+                  <sequenceNumber>1</sequenceNumber>
+                  <dataUnitReferenceNumber>0</dataUnitReferenceNumber>
+                  <lastDataUnit>0</lastDataUnit>
+                  <errorCode>0</errorCode>
+                </items>
+              </items>
+            </parameter>
+            <payload className="org.apache.plc4x.java.s7.readwrite.S7PayloadUserData">
+              <items>
+                <items className="org.apache.plc4x.java.s7.readwrite.S7PayloadUserDataItemCpuFunctionReadSzlResponse">
+                  <returnCode>OK</returnCode>
+                  <transportSize>OCTET_STRING</transportSize>
+                  <szlId className="org.apache.plc4x.java.s7.readwrite.SzlId">
+                    <typeClass>CPU</typeClass>
+                    <sublistExtract>0</sublistExtract>
+                    <sublistList>MODULE_IDENTIFICATION</sublistList>
+                  </szlId>
+                  <szlIndex>0</szlIndex>
+                  <items>
+                    <items className="org.apache.plc4x.java.s7.readwrite.SzlDataTreeItem">
+                      <itemIndex>1</itemIndex>
+                      <mlfb>NkVTNyAyMTItMUJEMzAtMFhCMCA=</mlfb>
+                      <moduleTypeId>8224</moduleTypeId>
+                      <ausbg>1</ausbg>
+                      <ausbe>8224</ausbe>
+                    </items>
+                    <items className="org.apache.plc4x.java.s7.readwrite.SzlDataTreeItem">
+                      <itemIndex>6</itemIndex>
+                      <mlfb>NkVTNyAyMTItMUJEMzAtMFhCMCA=</mlfb>
+                      <moduleTypeId>8224</moduleTypeId>
+                      <ausbg>1</ausbg>
+                      <ausbe>8224</ausbe>
+                    </items>
+                    <items className="org.apache.plc4x.java.s7.readwrite.SzlDataTreeItem">
+                      <itemIndex>7</itemIndex>
+                      <mlfb>NkVTNyAyMTItMUJEMzAtMFhCMCA=</mlfb>
+                      <moduleTypeId>8224</moduleTypeId>
+                      <ausbg>22018</ausbg>
+                      <ausbe>2</ausbe>
+                    </items>
+                  </items>
+                </items>
+              </items>
+            </payload>
+          </payload>
+          <eot>true</eot>
+          <tpduRef>0</tpduRef>
+        </payload>
+      </TPKTPacket>
+    </receive-plc-message>
+  </setup>
+
+  <testcase>
+    <name>Single element read request</name>
+    <steps>
+      <!--api-request-message>
+
+      </api-request-message-->
+      <send-plc-message>
+        <TPKTPacket className="org.apache.plc4x.java.s7.readwrite.TPKTPacket">
+          <payload className="org.apache.plc4x.java.s7.readwrite.COTPPacketData">
+            <parameters/>
+            <payload className="org.apache.plc4x.java.s7.readwrite.S7MessageRequest">
+              <tpduReference>11</tpduReference>
+              <parameter className="org.apache.plc4x.java.s7.readwrite.S7ParameterReadVarRequest">
+                <items>
+                  <items className="org.apache.plc4x.java.s7.readwrite.S7VarRequestParameterItemAddress">
+                    <address className="org.apache.plc4x.java.s7.readwrite.S7AddressAny">
+                      <transportSize>BOOL</transportSize>
+                      <numberOfElements>1</numberOfElements>
+                      <dbNumber>0</dbNumber>
+                      <area>OUTPUTS</area>
+                      <byteAddress>0</byteAddress>
+                      <bitAddress>0</bitAddress>
+                    </address>
+                  </items>
+                </items>
+              </parameter>
+              <payload/>
+            </payload>
+            <eot>true</eot>
+            <tpduRef>11</tpduRef>
+          </payload>
+        </TPKTPacket>
+      </send-plc-message>
+      <receive-plc-message>
+        <TPKTPacket className="org.apache.plc4x.java.s7.readwrite.TPKTPacket">
+          <payload className="org.apache.plc4x.java.s7.readwrite.COTPPacketData">
+            <parameters/>
+            <payload className="org.apache.plc4x.java.s7.readwrite.S7MessageResponseData">
+              <tpduReference>11</tpduReference>
+              <parameter className="org.apache.plc4x.java.s7.readwrite.S7ParameterReadVarResponse">
+                <numItems>1</numItems>
+              </parameter>
+              <payload className="org.apache.plc4x.java.s7.readwrite.S7PayloadReadVarResponse">
+                <items>
+                  <items className="org.apache.plc4x.java.s7.readwrite.S7VarPayloadDataItem">
+                    <returnCode>OK</returnCode>
+                    <transportSize>BIT</transportSize>
+                    <dataLength>1</dataLength>
+                    <data>AQ==</data>
+                  </items>
+                </items>
+              </payload>
+              <errorClass>0</errorClass>
+              <errorCode>0</errorCode>
+            </payload>
+            <eot>true</eot>
+            <tpduRef>0</tpduRef>
+          </payload>
+        </TPKTPacket>
+      </receive-plc-message>
+      <!--api-response-message>
+
+      </api-response-message-->
+    </steps>
+  </testcase>
+
+</test:driver-testsuite>
\ No newline at end of file