You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by jm...@apache.org on 2017/12/28 00:47:53 UTC

[incubator-plc4x] 15/19: add payload test

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

jmclean pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git

commit ce1f208a8b41ece936f23b77790ae84f05c4d73f
Author: Justin Mclean <jm...@apache.org>
AuthorDate: Thu Dec 28 09:44:40 2017 +1100

    add payload test
---
 .../s7/netty/model/messages/S7MessageTests.java    | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/s7/netty/model/messages/S7MessageTests.java b/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/s7/netty/model/messages/S7MessageTests.java
index ddd19a4..0294ccd 100644
--- a/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/s7/netty/model/messages/S7MessageTests.java
+++ b/plc4j/protocols/s7/src/test/java/org/apache/plc4x/java/s7/netty/model/messages/S7MessageTests.java
@@ -148,4 +148,33 @@ class S7MessageTests {
         assertTrue(message.getParameters().size() == 0, "Unexpected number of parameters");
     }
 
+    @Test
+    @Tag("fast")
+    void s7AnyVarParameterItem() {
+        MessageType messageType = MessageType.USER_DATA;
+        short tpduReference = 1;
+        ArrayList<S7Parameter> s7Parameters = new ArrayList<>();
+        ArrayList<S7Payload> s7Payloads = new ArrayList<>();
+        ParameterType parameterType = ParameterType.READ_VAR;
+        ArrayList<VarParameterItem> parameterItems = new ArrayList<>();
+        SpecificationType specificationType = SpecificationType.VARIABLE_SPECIFICATION;
+        MemoryArea memoryArea = MemoryArea.DATA_BLOCKS;
+        TransportSize transportSize = TransportSize.INT;
+        short numElements = 1;
+        byte dataBlock = (byte) 0x1;
+        byte byteOffset = (byte) 0x10;
+        byte bitOffset = (byte) 0x0;
+
+        S7AnyVarParameterItem parameterItem = new S7AnyVarParameterItem(specificationType, memoryArea, transportSize, numElements, dataBlock, byteOffset, bitOffset);
+
+        assertTrue(parameterItem.getSpecificationType() == specificationType, "Unexpected specification type");
+        assertTrue(parameterItem.getMemoryArea() == MemoryArea.DATA_BLOCKS, "Unexpected memory area");
+        assertTrue(parameterItem.getTransportSize() == transportSize, "Unexpected transport size");
+        assertTrue(parameterItem.getNumElements() == numElements, "Unexpected number elements");
+        assertTrue(parameterItem.getDataBlockNumber() == dataBlock, "Unexpected data block");
+        assertTrue(parameterItem.getByteOffset() == byteOffset, "Unexpected byte offset");
+        assertTrue(parameterItem.getBitOffset() == bitOffset, "Unexpected bit offset");
+        assertTrue(parameterItem.getAddressingMode() == VariableAddressingMode.S7ANY, "Unexpected adressing mode");
+    }
+
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@plc4x.apache.org" <co...@plc4x.apache.org>.